1 <?php rcs_id('$Id: Toolbar.php,v 1.5 2002-01-03 19:12:39 carstenklapp Exp $');
3 //require_once("lib/ErrorManager.php");
4 //require_once("lib/WikiPlugin.php");
8 $toolbar_style = "text";
9 select ( $toolbar_style ) {
17 $separator = "<img alt=\" | \" src=\"" .DATA_URL( '$placeholder' ) ."\" />";
22 // just using a hardcoded separator for now
28 These functions will replace the PHP logic currently embedded in
29 the html templates, used to build the Wiki commands and navigation
30 links at the bottom of the screen.
32 If you feel inspired please contribute here!
34 (This is all in a state of flux, so don't count on any of this being
39 // Some of these functions are ready to be used as ${tokens}
40 // in the xhtml templates.
43 // IncludePage plugin for EditHelp needs to be dealt with.
45 // Plugins shuold be cleaned up, in this state they won't display
48 // The raw html should be replaced with calls to
49 // Element() and/or QElement()
54 //Calling function should provide: - done
55 //$is_current = ($current->getVersion() == $revision->getVersion());
56 //$pagename = ($pagename);
57 function toolbar_Warning_IsCurrent($is_current, $pagename) {
60 $html .= "<p><strong>" ._("Note:") ."</strong> " ._("You are viewing an old revision of this page.");
61 $html .= "<a href=\"" .WikiURL('') .rawurlencode($pagename) ."\"> " ._("View the current version") ."</a></p>";
62 $html .= "<hr class=\"ignore\" noshade=\"noshade\" />";
67 //Calling function should provide: - done
68 //$is_current = ($current->getVersion() == $revision->getVersion());
69 //$lastmodified = (strftime($datetimeformat, $revision->get('mtime')));
70 //$version = ($revision->getVersion());
71 function toolbar_Info_LastModified($is_current, $lastmodified, $version) {
74 $html .= sprintf(_("Last edited on %s."), $lastmodified);
76 $html .= sprintf(_("Version %s, saved on %s."),$version, $lastmodified);
81 //Calling function should provide:
82 //$pagelocked = ($page->get('locked'));
83 //$userisadmin = ($user->is_admin());
84 //$is_current = ($current->getVersion() == $revision->getVersion());
85 //$version = ($revision->getVersion());
86 //$pagename = ($page->getName());
87 function toolabr_action_PageActions($pagelocked, $userisadmin, $is_current, $version, $pagename) {
89 if ($pagelocked && !$userisadmin) {
90 $html .= _("Page locked");
93 $html .= "<a class=\"wikiaction\" href=\"" .WikiURL($pagename, array('action' => 'edit')) ."\">" ._("Edit") ."</a>";
95 $html .= "<a class=\"wikiaction\" href=\"" .WikiURL($pagename, array('action' => 'edit&version=' .$version));
96 $html .= ">" ._("Edit old revision") ."</a>";
101 $html .= separator() ."<a class=\"wikiadmin\" href=\"" .WikiURL($pagename, array('action' => 'unlock')) ."\">" ._("Unlock page") ."</a>";
103 $html .= separator() ."<a class=\"wikiadmin\" href=\"" .WikiURL($pagename, array('action' => 'lock')) ."\">" ._("Lock page") ."</a>";
105 $html .= separator() ."<a class=\"wikiadmin\" href=\"" .WikiURL($pagename, array('action' => 'remove')) ."\">" ._("Remove page") ."</a>";
107 //$html .= separator() ."<plugin-link PageHistory page=\"" .$pagename ."\"";
108 $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("PageHistory"), array('page' => $pagename)) ."\">" ._("PageHistory") ."</a>";
111 $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL($pagename, array('action' => 'diff&previous=major')) ."\">" ._("Diff") ."</a>";
113 $html .= separator() ."<a class=\"wikiaction\"";
114 $html .= "href=\"" . WikiURL($pagename, array('action' => 'diff&version=' .$version .'&previous=major')) ."\">" ._("Diff") ."</a>";
116 //$html .= separator() ."<plugin-link BackLinks page=\"" .$pagename ."\"";
117 $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("BackLinks"), array('page' => $pagename)) ."\">" ._("BackLinks") ."</a>";
122 //Calling function should provide:
123 //$pagename = ($page->getName());
124 //$charset = (CHARSET);
125 function toolbar_action_SearchActions($pagename, $charset) {
127 $html .= "<form action=\"" .WikiURL(_("TitleSearch")) ."\" method=\"get\" accept-charset=\"" .$charset ."\">";
128 $html .= toolbar_action_Navigation($pagename) .separator() .LinkExistingWikiWord(_("FindPage"));
129 $html .= separator() ."<span><input type=\"hidden\" name=\"auto_redirect\" value=\"1\" />";
130 $html .= "<input type=\"text\" name=\"s\" size=\"12\"";
131 $html .= " title=" ._("Quick Search");
132 $html .= " onmouseover=\"window.status='" ._("Quick Search") ."'; return true;";
133 $html .= " onmouseout=\"window.status=''; return true;\" /></span>";
135 //$html .= separator() ."<plugin-link LikePages page=\"" .$pagename ."\" >";
136 $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("LikePages"), array('page' => $pagename)) ."\">" ._("LikePages") ."</a>";
138 // $html .= "</form>";
142 //Calling function should provide: done - WARNING: hackage! $pagename is not being passed here yet
143 //$userauth = ($user->is_authenticated();
144 //$userid = ($user->id());
145 //$pagename = ($pagename);
146 function toolbar_User_UserSignInOut($userauth, $userid, $pagename) {
149 $html .= sprintf(_("You are signed in as %s"), LinkWikiWord($userid));
150 $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL($pagename, array('action' => 'logout')) ."\">" ._("SignOut") ."</a>";
152 $html .= "<a class=\"wikiaction\" href=\"" . WikiURL($pagename, array('action' => 'login')) ."\">" ._("SignIn") ."</a>";
157 //Calling function should provide: - done
158 //$wiki_name = (WIKI_NAME);
160 function toolbar_action_Logo($wiki_name, $logo) {
162 $html .= "<a class=\"wikilink\" href=\"" .WikiURL(_("HomePage")) ."\">";
163 $html .= "<img alt=\"" .$wiki_name .":" ._("HomePage") ."\"";
164 $html .= " src=\"" . DataURL($logo) ."\"";
165 $html .= " border=\"0\" align=\"right\" /></a>";
169 //Calling function should provide: - done
170 //$pagename = ($pagename);
171 function toolbar_action_Navigation($pagename) {
173 $html .= LinkExistingWikiWord(_("RecentChanges"));
174 //$html .= separator() ."<plugin-link RandomPage page=\"" .$pagename ."\" >";
175 //FIXME: What to use instead of WikiURL?
176 // $html .= separator() ."<a class=\"wikiaction\" href=\"" .WikiURL('_("RandomPage")', array('page' => $pagename)) ."\">" ._("RandomPage") ."</a>";
177 //$html .= separator() ."<plugin-link WantedPages >";
178 // $html .= separator() ."<a class=\"wikiaction\" href=\"" . WikiURL(_("WantedPages")) ."\">" ._("WantedPages") ."</a>";
179 // $html .= separator() .LinkExistingWikiWord(_("SandBox"));
186 //Calling function should provide:
187 //$ispreview = (!empty($PREVIEW_CONTENT));
188 function toolbar_Warning_Preview($ispreview) {
191 $html .= "<p><strong>" ._("Preview only! Changes not saved.") ."</strong></p>";
196 //Calling function should provide:
197 //$is_current = ($current->getVersion() == $revision->getVersion());
198 function toolbar_Warning_OldRevision($is_current) {
201 $html .= "<p><strong>" ._("Warning: You are editing an old revision.");
202 $html .= " " ._("Saving this page will overwrite the current version.") ."</strong></p>";
203 $html .= "<hr class=\"ignore\" noshade />";
208 //$userid = ($user->id())
209 function toolbar_User_AuthorSignInOut($userid) {
211 if ($user->is_authenticated()) {
212 $html .= sprintf(_("You are signed in as %s."), LinkWikiWord($userid));
214 $html .= sprintf(_("Author will be logged as %s."),"<em>" .$userid ."</em>");
215 $html .= separator() ."<a class=\"wikiaction\" href=\"" .WikiURL($pagename, array('action' => 'login')) ."\">" ._("SignIn") ."</a>";
216 $html .= "<small>*</small><br><small>*backup and reload after signing in</small>";
221 function toolbar_Info_EditTips() {
223 $html .= sprintf(_("You can change the size of the editing area in %s."), LinkExistingWikiWord(_("UserPreferences")));
224 $html .= sprintf(_("See %s tips for editing."),LinkExistingWikiWord(_("GoodStyle")));
228 //FIXME: plugin IncludePage
229 function toolbar_Info_EditHelp() {
231 $html .= "<div class=\"wiki-edithelp\">";
232 $html .= "<plugin IncludePage page=" ._("TextFormattingRules") ."section=" ._("Synopsis") ."quiet=1>";
238 // This is a stub for a Toolbar class to eventually replace the
245 //$this->_tmpl = $this->_munge_input($tmpl);
246 //$this->_tmpl = $tmpl;
247 //$this->_tname = $tname;
248 //$this->_vars = array();
251 function appenditem($item) {
255 identify: command or info-display?
260 toolbar style, text-only or graphic buttons?
261 -if text-only, use " | " as item separator
276 function WikiToolbar($tname) {
280 send html back to transform (or whatever will be calling this)
285 function build_html_Toolbar() {
288 toolbars could be an array of commands or labels
291 - label, info display only (Modification date)
292 - label, info display only ("See Goodstyle Tips for editing".)
293 - Search navigation (FindPage, LikePages, search field)
294 - Wiki navigation (RecentChanges, RandomPages, WantedPages, Top10 etc.)
295 - Logo navigation (Homepage)
296 - label and command ("You are logged in as Bogouser. | SignOut")
300 requires user authenticated?
301 - check is authenticated
317 // c-hanging-comment-ender-p: nil
318 // indent-tabs-mode: nil