]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/MacOSX/themeinfo.php
No tabs
[SourceForge/phpwiki.git] / themes / MacOSX / themeinfo.php
1 <?php //-*-php-*-
2 // Avoid direct call to this file.
3 // PHPWIKI_VERSION is defined in lib/prepend.php
4 if (!defined('PHPWIKI_VERSION')) {
5     header("Location: /");
6     exit;
7 }
8
9 // $Id$
10
11 /**
12  * A PhpWiki theme inspired by the Aqua appearance of Mac OS X.
13  *
14  * The images used with this theme depend on the PNG alpha channel to
15  * blend in with whatever background color or texture is on the page.
16  * When viewed with an older browser, the images may be incorrectly
17  * rendered with a thick solid black border. When viewed with a modern
18  * browser, the images will display with nice edges and blended
19  * shadows.
20  *
21  * The defaut link icons I want to move into this theme, and come up
22  * with some new linkicons for the default look. (Any ideas,
23  * feedback?)
24  *
25  * Do you like the icons used in the buttons?
26  *
27  * See buttons/README for more info on the buttons.
28  *
29  * The background image is a subtle brushed paper texture or stucco
30  * effect very close to white. If your monitor isn't calibrated well
31  * you may not see it.
32  * */
33
34 require_once('lib/WikiTheme.php');
35
36 class WikiTheme_MacOSX extends WikiTheme {
37     function getCSS() {
38         // FIXME: this is a hack which will not be needed once
39         //        we have dynamic CSS.
40         $css = WikiTheme::getCSS();
41         $css->pushcontent(HTML::style(array('type' => 'text/css'),
42                              new RawXml(sprintf("<!--\nbody {background-image: url(%s);}\n-->\n",
43                                                 $this->getImageURL('bgpaper8')))));
44                                 //for non-browse pages, like former editpage, message etc.
45                                 //$this->getImageURL('bggranular')));
46         return $css;
47     }
48
49     function getRecentChangesFormatter ($format) {
50         include_once($this->file('lib/RecentChanges.php'));
51         if (preg_match('/^rss|^sidebar/', $format))
52             return false;       // use default
53         return '_MacOSX_RecentChanges_Formatter';
54     }
55
56     function getPageHistoryFormatter ($format) {
57         include_once($this->file('lib/RecentChanges.php'));
58         if (preg_match('/^rss|^sidebar/', $format))
59             return false;       // use default
60         return '_MacOSX_PageHistory_Formatter';
61     }
62
63     function linkUnknownWikiWord($wikiword, $linktext = '') {
64         global $request;
65
66         // Get rid of anchors on unknown wikiwords
67         if (isa($wikiword, 'WikiPageName')) {
68             $default_text = $wikiword->shortName;
69             $wikiword = $wikiword->name;
70         }
71         else {
72             $default_text = $wikiword;
73         }
74
75         $url = WikiURL($wikiword, array('action' => 'create'));
76         //$link = HTML::span(HTML::a(array('href' => $url), '?'));
77         $button = $this->makeButton('?', $url);
78         $button->addTooltip(sprintf(_("Create: %s"), $wikiword));
79         $link = HTML::span($button);
80
81
82         if (!empty($linktext)) {
83             $link->unshiftContent(HTML::u($linktext));
84             $link->setAttr('class', 'named-wikiunknown');
85         }
86         else {
87             $link->unshiftContent(HTML::u($this->maybeSplitWikiWord($default_text)));
88             $link->setAttr('class', 'wikiunknown');
89         }
90
91         return $link;
92     }
93
94     function load() {
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.
98
99    // This should result in phpwiki-printer.css being used when
100    // printing or print-previewing with style "PhpWiki" or "MacOSX" selected.
101    $this->setDefaultCSS('MacOSX', array('' => 'MacOSX.css', 'print' => 'phpwiki-printer.css'));
102
103    // This allows one to manually select "Printer" style (when browsing page)
104    // to see what the printer style looks like.
105    $this->addAlternateCSS(_("Printer"), 'phpwiki-printer.css', 'print, screen');
106    $this->addAlternateCSS(_("Top & bottom toolbars"), 'MacOSX-topbottombars.css');
107
108    /**
109     * The logo image appears on every page and links to the HomePage.
110     */
111    $this->addImageAlias('logo', WIKI_NAME . 'Logo.png');
112
113    /**
114     * The Signature image is shown after saving an edited page. If this
115     * is set to false then the "Thank you for editing..." screen will
116     * be omitted.
117     */
118    $this->addImageAlias('signature', WIKI_NAME . "Signature.png");
119    // Uncomment this next line to disable the signature.
120    //$this->addImageAlias('signature', false);
121
122    /*
123     * Link icons.
124     */
125    $this->setLinkIcon('http');
126    $this->setLinkIcon('https');
127    $this->setLinkIcon('ftp');
128    $this->setLinkIcon('mailto');
129    $this->setLinkIcon('interwiki');
130    $this->setLinkIcon('wikiuser');
131    $this->setLinkIcon('*', 'url');
132
133    $this->setButtonSeparator(""); //use no separator instead of default
134
135    $this->addButtonAlias('?', 'uww');
136    $this->addButtonAlias(_("Lock Page"), "Lock Page");
137    $this->addButtonAlias(_("Unlock Page"), "Unlock Page");
138    $this->addButtonAlias(_("Page Locked"), "Page Locked");
139    $this->addButtonAlias("...", "alltime");
140
141    /**
142     * WikiWords can automatically be split by inserting spaces between
143     * the words. The default is to leave WordsSmashedTogetherLikeSo.
144     */
145    //$this->setAutosplitWikiWords(false);
146
147    /*
148     * You may adjust the formats used for formatting dates and times
149     * below.  (These examples give the default formats.)
150     * Formats are given as format strings to PHP strftime() function See
151     * http://www.php.net/manual/en/function.strftime.php for details.
152     * Do not include the server's zone (%Z), times are converted to the
153     * user's time zone.
154     */
155    $this->setDateFormat("%A, %B %d, %Y"); // must not contain time
156    $this->setTimeFormat("%I:%M:%S %p");
157     }
158 }
159
160 $WikiTheme = new WikiTheme_MacOSX('MacOSX');
161
162 // Local Variables:
163 // mode: php
164 // tab-width: 8
165 // c-basic-offset: 4
166 // c-hanging-comment-ender-p: nil
167 // indent-tabs-mode: nil
168 // End:
169 ?>