<?php // -*-php-*-
  rcs_id('$Id: navbar.tmpl,v 1.38 2005/02/04 13:25:08 rurban Exp $');
?>
<!-- The top navigation/search bar -->
<form action="<?= WikiURL(
_("TitleSearch"))?>" target="_top"
      method="get" accept-charset="<?=CHARSET?>">
<div id="navbuttons">
<?php // this requires the Talk: map to end in "/Discussion"
if (!string_ends_with($page->getName(), _("Discussion"))) { ?>
  <?= WikiLink(new WikiPagename('Talk:'.$page->getName(), $page->getName()), 
               'button', _("Discussion")) ?>
<?=$SEP?><?php } ?><?= WikiLink(_("RecentChanges"), "button") ?>
<?=$SEP?><?= WikiLink(_("FindPage"), "button") ?>
<?=HTML::raw('&nbsp;')?><input type="hidden" name="auto_redirect" value="1" />
<?php if (! USE_PATH_INFO) { ?>
<input type="hidden" name="pagename" value="<?=
_("TitleSearch")?>" />
<?php } ?>
<input type="text"  name="s" size="12" maxlength="256"
       title='<?=
_("Quick Search")?>'
       onmouseover="window.status='<?=
_("Quick Search")?>'; return true;"
       onmouseout="window.status=''; return true;" />
<?php if (!empty($revision)) { ?>
<?=$SEP?><?= $WikiTheme->makeLinkButton($revision,_("LikePages"),_("LikePages")) 
?><?=$SEP?><?= $WikiTheme->makeLinkButton($revision,_("BackLinks"),_("BackLinks")) 
?><?php
  $links = $page->getPageLinks();
  if ($links->count() > 1) { ?><?=$SEP?><?= $WikiTheme->makeLinkButton($revision,_("RelatedChanges"),_("RelatedChanges")) ?><?php } ?>
<?php } ?>
<?php if (!empty($user) && $user->isSignedIn()) { ?>
<?=$SEP?><?= WikiLink(_("UserPreferences"), 'button',_("Preferences")) ?>
<?php } ?>
<?php if (!empty($user)) { ?>
<?php
      /* Today's calendar page for the user, if the Calender subpage is defined. */
      $UserCalPageTitle = $user->getId() . SUBPAGE_SEPARATOR . _("Calendar");
      $dbi = $request->getDbh();
      if ($dbi->isWikiPage($UserCalPageTitle)) {
        $UserCalPageTodayTitle = $UserCalPageTitle . SUBPAGE_SEPARATOR . strftime("%Y-%m-%d", time());
        //$UserCalPageTodayUrl = WikiURL($UserCalPageTodayTitle);
        ?>
<?=$SEP?><?= WikiLink($UserCalPageTodayTitle, "button", _("Today")) ?>
<?php } ?>
<?php } ?>
<?php if (!empty($user) && $user->isAdmin()) { ?>
<?=$SEP?><?= WikiLink(_("PhpWikiAdministration"), "button", _("Admin")) ?>
<?php } ?></div>
</form>
<?php if (DEBUG & 2) {
        if (isset($links)) {
            $s = '';
            while ($p = $links->next()) { $s .= $p->_pagename.', '; }
            echo asXML(HTML::strong("PageLinks: "),$s ? HTML::em($s) : HTML::em('<none>'));
        }
} ?>
