From: Carsten K. <car...@us...> - 2002-01-03 19:12:41
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv22698 Modified Files: Template.php Toolbar.php Log Message: Some template sections have been simplified with tokens. Template.php recognises new tokens and calls the necessary functions in Toolbar.php. Index: Template.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/Template.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** Template.php 2002/01/03 00:32:33 1.10 --- Template.php 2002/01/03 19:12:38 1.11 *************** *** 3,6 **** --- 3,7 ---- require_once("lib/ErrorManager.php"); require_once("lib/WikiPlugin.php"); + require_once("lib/Toolbar.php"); //FIXME: This is a mess and needs to be refactored. *************** *** 215,218 **** --- 216,222 ---- $pagename = $page->getName(); + $this->replace('NAVIGATION', toolbar_action_Navigation($pagename)); + $this->replace('SEARCH', toolbar_action_SearchActions($pagename,CHARSET)); + $this->replace('page', $page); $this->qreplace('CHARSET', CHARSET); *************** *** 237,240 **** --- 241,246 ---- $previous = & $page->getRevisionBefore($revision->getVersion()); + $this->replace('NOT_VIEWING_CURRENT', + toolbar_Warning_IsCurrent($current->getVersion() == $revision->getVersion(),$page->getName())); $this->replace('IS_CURRENT', $current->getVersion() == $revision->getVersion()); *************** *** 247,252 **** global $datetimeformat; ! $this->qreplace('LASTMODIFIED', ! strftime($datetimeformat, $revision->get('mtime'))); $this->qreplace('LASTAUTHOR', $revision->get('author')); $this->qreplace('VERSION', $revision->getVersion()); --- 253,264 ---- global $datetimeformat; ! $this->replace('LASTMODIFIED', ! toolbar_Info_LastModified( ! ($current->getVersion() == $revision->getVersion()), ! strftime($datetimeformat, $revision->get('mtime')), ! $revision->getVersion() )); ! // $this->qreplace('LASTMODIFIED', ! // strftime($datetimeformat, $revision->get('mtime'))); ! $this->qreplace('LASTAUTHOR', $revision->get('author')); $this->qreplace('VERSION', $revision->getVersion()); *************** *** 267,270 **** --- 279,287 ---- $this->replace('user', $user); $this->qreplace('USERID', $user->id()); + + //WARNING: hackage! $pagename is not available here + $pagename=""; + $this->replace('SIGNIN', toolbar_User_UserSignInOut($user->is_authenticated(), $user->id(), $pagename)); + $prefs = $user->getPreferences(); $this->qreplace('EDIT_AREA_WIDTH', $prefs['edit_area.width']); *************** *** 283,287 **** $this->setWikiUserTokens($user); if (isset($logo)) ! $this->qreplace('LOGO', DataURL($logo)); if (isset($RCS_IDS)) $this->qreplace('RCS_IDS', $RCS_IDS); --- 300,305 ---- $this->setWikiUserTokens($user); if (isset($logo)) ! $this->replace('LOGO', toolbar_action_Logo(WIKI_NAME, $logo)); ! // $this->qreplace('LOGO', DataURL($logo)); if (isset($RCS_IDS)) $this->qreplace('RCS_IDS', $RCS_IDS); Index: Toolbar.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/Toolbar.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Toolbar.php 2002/01/03 15:47:06 1.4 --- Toolbar.php 2002/01/03 19:12:39 1.5 *************** *** 1,6 **** <?php rcs_id('$Id$'); ! require_once("lib/ErrorManager.php"); ! require_once("lib/WikiPlugin.php"); function separator() { --- 1,6 ---- <?php rcs_id('$Id$'); ! //require_once("lib/ErrorManager.php"); ! //require_once("lib/WikiPlugin.php"); function separator() { *************** *** 52,63 **** // BrowsePage stuff ! //Calling function should provide: ! //$is_current = ($current->getVersion() == $revision->getVersion()) ! //$pagename = ($pagename) function toolbar_Warning_IsCurrent($is_current, $pagename) { $html = ""; if (!$is_current) { $html .= "<p><strong>" ._("Note:") ."</strong> " ._("You are viewing an old revision of this page."); ! $html .= "<a href=\"" .WikiURL('') .rawurlencode($pagename) ."\">" ._("View the current version") ."</a>.</p>"; $html .= "<hr class=\"ignore\" noshade=\"noshade\" />"; } --- 52,63 ---- // BrowsePage stuff ! //Calling function should provide: - done ! //$is_current = ($current->getVersion() == $revision->getVersion()); ! //$pagename = ($pagename); function toolbar_Warning_IsCurrent($is_current, $pagename) { $html = ""; if (!$is_current) { $html .= "<p><strong>" ._("Note:") ."</strong> " ._("You are viewing an old revision of this page."); ! $html .= "<a href=\"" .WikiURL('') .rawurlencode($pagename) ."\"> " ._("View the current version") ."</a></p>"; $html .= "<hr class=\"ignore\" noshade=\"noshade\" />"; } *************** *** 65,76 **** } ! //Calling function should provide: ! //$is_current = ($current->getVersion() == $revision->getVersion()) ! //$lastmodified = (strftime($datetimeformat, $revision->get('mtime'))) ! //$version = ($revision->getVersion()) function toolbar_Info_LastModified($is_current, $lastmodified, $version) { $html = ""; if ($is_current) { ! $html .= sprintf(_("Last edited on %s.") $lastmodified); } else { $html .= sprintf(_("Version %s, saved on %s."),$version, $lastmodified); --- 65,76 ---- } ! //Calling function should provide: - done ! //$is_current = ($current->getVersion() == $revision->getVersion()); ! //$lastmodified = (strftime($datetimeformat, $revision->get('mtime'))); ! //$version = ($revision->getVersion()); function toolbar_Info_LastModified($is_current, $lastmodified, $version) { $html = ""; if ($is_current) { ! $html .= sprintf(_("Last edited on %s."), $lastmodified); } else { $html .= sprintf(_("Version %s, saved on %s."),$version, $lastmodified); *************** *** 80,88 **** //Calling function should provide: ! //$pagelocked = ($page->get('locked')) ! //$userisadmin = ($user->is_admin()) ! //$is_current = ($current->getVersion() == $revision->getVersion()) ! //$version = ($revision->getVersion())) ! //$pagename = ($page->getName()) function toolabr_action_PageActions($pagelocked, $userisadmin, $is_current, $version, $pagename) { $html = ""; --- 80,88 ---- //Calling function should provide: ! //$pagelocked = ($page->get('locked')); ! //$userisadmin = ($user->is_admin()); ! //$is_current = ($current->getVersion() == $revision->getVersion()); ! //$version = ($revision->getVersion()); ! //$pagename = ($page->getName()); function toolabr_action_PageActions($pagelocked, $userisadmin, $is_current, $version, $pagename) { $html = ""; *************** *** 105,109 **** $html .= separator() ."<a class=\"wikiadmin\" href=\"" .WikiURL($pagename, array('action' => 'remove')) ."\">" ._("Remove page") ."</a>"; } ! //$html .= separator() ."<?plugin-link PageHistory page=\"" .$pagename ."\""; $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("PageHistory"), array('page' => $pagename)) ."\">" ._("PageHistory") ."</a>"; --- 105,109 ---- $html .= separator() ."<a class=\"wikiadmin\" href=\"" .WikiURL($pagename, array('action' => 'remove')) ."\">" ._("Remove page") ."</a>"; } ! //$html .= separator() ."<plugin-link PageHistory page=\"" .$pagename ."\""; $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("PageHistory"), array('page' => $pagename)) ."\">" ._("PageHistory") ."</a>"; *************** *** 111,119 **** $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL($pagename, array('action' => 'diff&previous=major')) ."\">" ._("Diff") ."</a>"; } else { ! $html .= separator() ."<a class=\"wikiaction\""; $html .= "href=\"" . WikiURL($pagename, array('action' => 'diff&version=' .$version .'&previous=major')) ."\">" ._("Diff") ."</a>"; } ! $html .= ! //$html .= separator() ."<?plugin-link BackLinks page=\"" .$pagename ."\""; $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("BackLinks"), array('page' => $pagename)) ."\">" ._("BackLinks") ."</a>"; --- 111,118 ---- $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL($pagename, array('action' => 'diff&previous=major')) ."\">" ._("Diff") ."</a>"; } else { ! $html .= separator() ."<a class=\"wikiaction\""; $html .= "href=\"" . WikiURL($pagename, array('action' => 'diff&version=' .$version .'&previous=major')) ."\">" ._("Diff") ."</a>"; } ! //$html .= separator() ."<plugin-link BackLinks page=\"" .$pagename ."\""; $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("BackLinks"), array('page' => $pagename)) ."\">" ._("BackLinks") ."</a>"; *************** *** 122,132 **** //Calling function should provide: ! //$pagename = ($page->getName()) ! //$charset = (CHARSET) function toolbar_action_SearchActions($pagename, $charset) { $html = ""; $html .= "<form action=\"" .WikiURL(_("TitleSearch")) ."\" method=\"get\" accept-charset=\"" .$charset ."\">"; ! $html .= LinkExistingWikiWord(_("RecentChanges")); ! $html .= separator() .LinkExistingWikiWord(_("FindPage")); $html .= separator() ."<span><input type=\"hidden\" name=\"auto_redirect\" value=\"1\" />"; $html .= "<input type=\"text\" name=\"s\" size=\"12\""; --- 121,130 ---- //Calling function should provide: ! //$pagename = ($page->getName()); ! //$charset = (CHARSET); function toolbar_action_SearchActions($pagename, $charset) { $html = ""; $html .= "<form action=\"" .WikiURL(_("TitleSearch")) ."\" method=\"get\" accept-charset=\"" .$charset ."\">"; ! $html .= toolbar_action_Navigation($pagename) .separator() .LinkExistingWikiWord(_("FindPage")); $html .= separator() ."<span><input type=\"hidden\" name=\"auto_redirect\" value=\"1\" />"; $html .= "<input type=\"text\" name=\"s\" size=\"12\""; *************** *** 135,149 **** $html .= " onmouseout=\"window.status=''; return true;\" /></span>"; ! //$html .= separator() ."<?plugin-link LikePages page=\"" .$pagename ."\" ?>"; $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("LikePages"), array('page' => $pagename)) ."\">" ._("LikePages") ."</a>"; ! $html .= "</form>"; return $html; } ! //Calling function should provide: ! //$userauth = ($user->is_authenticated() ! //$userid = ($user->id()) ! function toolbar_User_UserSignInOut($userauth, $userid) { $html = ""; if ($userauth) { --- 133,148 ---- $html .= " onmouseout=\"window.status=''; return true;\" /></span>"; ! //$html .= separator() ."<plugin-link LikePages page=\"" .$pagename ."\" >"; $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("LikePages"), array('page' => $pagename)) ."\">" ._("LikePages") ."</a>"; ! // $html .= "</form>"; return $html; } ! //Calling function should provide: done - WARNING: hackage! $pagename is not being passed here yet ! //$userauth = ($user->is_authenticated(); ! //$userid = ($user->id()); ! //$pagename = ($pagename); ! function toolbar_User_UserSignInOut($userauth, $userid, $pagename) { $html = ""; if ($userauth) { *************** *** 156,180 **** } ! //Calling function should provide: ! //$wiki_name = (WIKI_NAME) ! //$logo = ($logo) function toolbar_action_Logo($wiki_name, $logo) { $html = ""; - $html .= "<div>"; $html .= "<a class=\"wikilink\" href=\"" .WikiURL(_("HomePage")) ."\">"; ! $html .= "<img alt=\"" .$wiki_name .":" ._("HomePage"); $html .= " src=\"" . DataURL($logo) ."\""; ! $html .= " border=\"0\" align=\"right\" />"; ! $html .= "</a></div>"; return $html; } ! function toolbar_action_Navigation() { $html = ""; $html .= LinkExistingWikiWord(_("RecentChanges")); ! //$html .= separator() ."<?plugin-link RandomPage page=\"" .$pagename ."\" ?>"; ! $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("RandomPage"), array('page' => $pagename)) ."\">" ._("RandomPage") ."</a>"; ! //$html .= separator() ."<?plugin-link WantedPages ?>"; ! $html .= separator() ."<a class=\"wikiaction\" href=\"" . LinkExistingWikiWord(_("WantedPages")) ."\">" ._("WantedPages") ."</a>"; // $html .= separator() .LinkExistingWikiWord(_("SandBox")); return $html; --- 155,180 ---- } ! //Calling function should provide: - done ! //$wiki_name = (WIKI_NAME); ! //$logo = ($logo); function toolbar_action_Logo($wiki_name, $logo) { $html = ""; $html .= "<a class=\"wikilink\" href=\"" .WikiURL(_("HomePage")) ."\">"; ! $html .= "<img alt=\"" .$wiki_name .":" ._("HomePage") ."\""; $html .= " src=\"" . DataURL($logo) ."\""; ! $html .= " border=\"0\" align=\"right\" /></a>"; return $html; } ! //Calling function should provide: - done ! //$pagename = ($pagename); ! function toolbar_action_Navigation($pagename) { $html = ""; $html .= LinkExistingWikiWord(_("RecentChanges")); ! //$html .= separator() ."<plugin-link RandomPage page=\"" .$pagename ."\" >"; ! //FIXME: What to use instead of WikiURL? ! // $html .= separator() ."<a class=\"wikiaction\" href=\"" .WikiURL('_("RandomPage")', array('page' => $pagename)) ."\">" ._("RandomPage") ."</a>"; ! //$html .= separator() ."<plugin-link WantedPages >"; ! // $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("WantedPages")) ."\">" ._("WantedPages") ."</a>"; // $html .= separator() .LinkExistingWikiWord(_("SandBox")); return $html; *************** *** 185,189 **** //Calling function should provide: ! //$ispreview = (!empty($PREVIEW_CONTENT)) function toolbar_Warning_Preview($ispreview) { $html = ""; --- 185,189 ---- //Calling function should provide: ! //$ispreview = (!empty($PREVIEW_CONTENT)); function toolbar_Warning_Preview($ispreview) { $html = ""; *************** *** 195,199 **** //Calling function should provide: ! //$is_current = ($current->getVersion() == $revision->getVersion()) function toolbar_Warning_OldRevision($is_current) { $html = ""; --- 195,199 ---- //Calling function should provide: ! //$is_current = ($current->getVersion() == $revision->getVersion()); function toolbar_Warning_OldRevision($is_current) { $html = ""; *************** *** 230,234 **** $html = ""; $html .= "<div class=\"wiki-edithelp\">"; ! $html .= "<?plugin IncludePage page=" ._("TextFormattingRules") ."section=" ._("Synopsis") ."quiet=1?>"; $html .= "</div>"; return $html; --- 230,234 ---- $html = ""; $html .= "<div class=\"wiki-edithelp\">"; ! $html .= "<plugin IncludePage page=" ._("TextFormattingRules") ."section=" ._("Synopsis") ."quiet=1>"; $html .= "</div>"; return $html; *************** *** 317,320 **** // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil ! // End: ?> --- 317,320 ---- // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil ! // End: ?> |