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