2 rcs_id('$Id: themeinfo.php,v 1.15 2004-06-03 16:56:21 rurban Exp $');
5 * This file defines the Sidebar appearance ("theme") of PhpWiki.
8 require_once('lib/Theme.php');
10 class Theme_Sidebar extends Theme {
12 function findTemplate ($name) {
13 // hack for navbar.tmpl to hide the buttonseparator
14 if ($name == "navbar") {
15 //$old = $Theme->getButtonSeparator();
16 $this->setButtonSeparator(HTML::Raw('<br /> · '));
17 //$this->setButtonSeparator("\n");
18 //$Theme->setButtonSeparator($old);
20 if ($name == "actionbar" || $name == "signin") {
21 //$old = $Theme->getButtonSeparator();
22 //$this->setButtonSeparator(HTML::br());
23 $this->setButtonSeparator(" ");
24 //$Theme->setButtonSeparator($old);
26 return $this->_path . $this->_findFile("templates/$name.tmpl");
29 function calendarLink($date = false) {
30 return $this->calendarBase() . SUBPAGE_SEPARATOR .
31 strftime("%Y-%m-%d", $date ? $date : time());
34 function calendarBase() {
35 static $UserCalPageTitle = false;
36 if (!$UserCalPageTitle)
37 $UserCalPageTitle = $GLOBALS['request']->_user->getId() .
38 SUBPAGE_SEPARATOR . _("Calendar");
39 return $UserCalPageTitle;
42 $Theme = new Theme_Sidebar('Sidebar');
44 $dbi = $GLOBALS['request']->getDbh();
45 // display flat calender dhtml under the clock
46 if ($dbi->isWikiPage($Theme->calendarBase())) {
47 $jslang = @$GLOBALS['LANG'];
48 $Theme->addMoreHeaders($Theme->_CSSlink(0,
49 $Theme->_findFile('jscalendar/calendar-phpwiki.css'),'all'));
50 $Theme->addMoreHeaders("\n");
51 $Theme->addMoreHeaders(JavaScript('',
52 array('src' => $Theme->_findData('jscalendar/calendar_stripped.js'))));
53 $Theme->addMoreHeaders("\n");
54 if (!($langfile = $Theme->_findData("jscalendar/lang/calendar-$jslang.js")))
55 $langfile = $Theme->_findData("jscalendar/lang/calendar-en.js");
56 $Theme->addMoreHeaders(JavaScript('',array('src' => $langfile)));
57 $Theme->addMoreHeaders("\n");
58 $Theme->addMoreHeaders(JavaScript('',
59 array('src' => $Theme->_findData('jscalendar/calendar-setup_stripped.js'))));
60 $Theme->addMoreHeaders("\n");
61 require_once("lib/TextSearchQuery.php");
62 // get existing date entries for the current user:
63 $iter = $dbi->titleSearch(new TextSearchQuery($Theme->calendarBase().SUBPAGE_SEPARATOR));
65 while ($page = $iter->next()) {
67 $existing[] = basename($page->_pagename);
69 $js_exist = '{"'.join('":1,"',$existing).'":1}';
70 //var SPECIAL_DAYS = {"2004-05-11":1,"2004-05-12":1,"2004-06-01":1}
71 $Theme->addMoreHeaders(JavaScript('
72 // this table holds the existing calender entries for the current user
73 // calculated from the database
74 var SPECIAL_DAYS = '.$js_exist.';
75 // this function returns true if the date exists
76 function dateExists(date, y, m, d) {
77 var year = date.getFullYear();
79 m = m < 10 ? "0" + m : m; // integer, 0..11
80 d = d < 10 ? "0" + d : d; // integer, 1..31
81 var date = year+"-"+m+"-"+d;
82 var exists = SPECIAL_DAYS[date];
83 if (!exists) return false;
86 // this is the actual date status handler. Note that it receives the
87 // date object as well as separate values of year, month and date, for
89 function dateStatusHandler(date, y, m, d) {
90 if (dateExists(date, y, m, d)) return "existing";
95 // CSS file defines fonts, colors and background images for this
96 // style. The companion '*-heavy.css' file isn't defined, it's just
97 // expected to be in the same directory that the base style is in.
99 $Theme->setDefaultCSS(_("Sidebar"), 'sidebar.css');
100 //$Theme->addAlternateCSS('PhpWiki', 'phpwiki.css');
101 //$Theme->setDefaultCSS('PhpWiki', 'phpwiki.css');
102 $Theme->addAlternateCSS(_("Printer"), 'phpwiki-printer.css', 'print, screen');
103 $Theme->addAlternateCSS(_("Modern"), 'phpwiki-modern.css');
106 * The logo image appears on every page and links to the HomePage.
108 //$Theme->addImageAlias('logo', 'logo.png');
111 * The Signature image is shown after saving an edited page. If this
112 * is not set, any signature defined in index.php will be used. If it
113 * is not defined by index.php or in here then the "Thank you for
114 * editing..." screen will be omitted.
117 // Comment this next line out to enable signature.
118 $Theme->addImageAlias('signature', false);
123 $Theme->setLinkIcon('http');
124 $Theme->setLinkIcon('https');
125 $Theme->setLinkIcon('ftp');
126 $Theme->setLinkIcon('mailto');
127 $Theme->setLinkIcon('interwiki');
128 $Theme->setLinkIcon('*', 'url');
130 //$Theme->setButtonSeparator(' | ');
133 * WikiWords can automatically be split by inserting spaces between
134 * the words. The default is to leave WordsSmashedTogetherLikeSo.
136 $Theme->setAutosplitWikiWords(true);
139 * If true (default) show create '?' buttons on not existing pages, even if the
140 * user is not signed in.
141 * If false, anon users get no links and it looks cleaner, but then they
142 * cannot easily fix missing pages.
144 $Theme->setAnonEditUnknownLinks(false);
147 * You may adjust the formats used for formatting dates and times
148 * below. (These examples give the default formats.)
149 * Formats are given as format strings to PHP strftime() function See
150 * http://www.php.net/manual/en/function.strftime.php for details.
151 * Do not include the server's zone (%Z), times are converted to the
154 //$Theme->setDateFormat("%B %d, %Y");
157 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
158 // (c-file-style: "gnu")
163 // c-hanging-comment-ender-p: nil
164 // indent-tabs-mode: nil