]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/MonoBook/themeinfo.php
rcs_id no longer makes sense with Subversion global version number
[SourceForge/phpwiki.git] / themes / MonoBook / themeinfo.php
1 <?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 // rcs_id('$Id$');
10 /**
11  * The new mediawiki (Wikipedia.org) default style.
12  * Mediawiki 'monobook' style sheet for CSS2-capable browsers.
13  * Copyright Gabriel Wicke - http://www.aulinx.de/
14  * See main.css for more.
15  *
16  * Problems with IE: signin is at the left.
17  *
18  * We don't (yet) support all mediawiki UI options, but we try to.
19  * Besides that, maybe the mediawiki folks will see how much better phpwiki 
20  * will scale, esp. with a true database, not just mysql.
21  * Technically phpwiki has about 2-3 years advantage and our plugins 
22  * cannot destroy the layout.
23  * Anyway, the WikiParser perl module (and our php version) will be able to import
24  * and convert back and forth.
25  */
26 require_once('lib/WikiTheme.php');
27 require_once('themes/wikilens/themeinfo.php');
28
29 function ActionButton ($action, $label = false, $page_or_rev = false, $options = false) {
30     global $WikiTheme;
31     global $request;
32     if (is_array($action)) {
33         $attr = $action;
34         $act = isset($attr['action']) ? $attr['action'] : 'browse';
35     } else 
36         $act = $action;
37     $class = is_safe_action($act) ? 'named-wiki' : 'wikiadmin';
38     /* if selected action is current then prepend selected */
39     $curract = $request->getArg("action");
40     if ($curract == $act and $curract != 'browse')
41         $class = "selected $class";
42     if (!empty($options['class'])) {
43         if ($curract == 'browse')
44             $class = "$class ".$options['class'];
45         else
46             $class = $options['class'];
47     }
48     return HTML::li(array('class' => $class), 
49                     $WikiTheme->makeActionButton($action, $label, $page_or_rev, $options));
50 }
51
52 class WikiTheme_MonoBook 
53 /* extends WikiTheme */
54 extends WikiTheme_Wikilens
55 {
56     
57     /* this adds selected to the class */
58     function makeActionButton ($action, $label=false, $page_or_rev=false, $options=false) {
59         extract($this->_get_name_and_rev($page_or_rev));
60
61         if (is_array($action)) {
62             $attr = $action;
63             $action = isset($attr['action']) ? $attr['action'] : 'browse';
64         }
65         else
66             $attr['action'] = $action;
67
68         $class = is_safe_action($action) ? /*'named-wiki'*/'new' : 'wikiadmin';
69         /* if selected action is current then prepend selected */
70         global $request;
71         if ($request->getArg("action") == $action)
72             $class = "selected $class";
73             //$class = "selected";
74         if (!empty($options['class']))
75             $class = $options['class'];
76         if (!$label)
77             $label = $this->_labelForAction($action);
78
79         if ($version)
80             $attr['version'] = $version;
81
82         if ($action == 'browse')
83             unset($attr['action']);
84
85         $options = $this->fixAccesskey($options);
86         return $this->makeButton($label, WikiURL($pagename, $attr), $class, $options);
87     }
88
89     function load() {
90         $this->addMoreHeaders(JavaScript("var ta;\nvar skin = '".$this->_name."';\n"));
91         $this->addMoreHeaders(JavaScript('',array('src' => $this->_findData("wikibits.js"))));
92         if (isBrowserIE()) {
93             $ver = browserVersion();
94             if ($ver > 5.1 and $ver < 5.9)
95                 $this->addMoreHeaders($this->_CSSlink(0,$this->_findFile('IE55Fixes.css'),'all'));
96             elseif ($ver > 5.5 and $ver < 7.0)
97                 $this->addMoreHeaders($this->_CSSlink(0,$this->_findFile('IE60Fixes.css'),'all'));
98             elseif ($ver >= 7.0)
99                 $this->addMoreHeaders($this->_CSSlink(0,$this->_findFile('IE70Fixes.css'),'all'));
100             else
101                 $this->addMoreHeaders($this->_CSSlink(0,$this->_findFile('IE50Fixes.css'),'all'));
102             unset($ver);
103             $this->addMoreHeaders("\n");
104             $this->addMoreHeaders(JavaScript('',array('src' => $this->_findData("IEFixes.js"))));
105             $this->addMoreHeaders("\n");
106             $this->addMoreHeaders(HTML::Raw('<meta http-equiv="imagetoolbar" content="no" />'));
107         } 
108         // better done in wikibits.js
109         /*elseif (isBrowserSafari()) {
110           $this->addMoreHeaders($this->_CSSlink(0,$this->_findFile('IEMacFixes.css'),'all'));
111           } elseif (isBrowserKonqueror()) {
112           $this->addMoreHeaders($this->_CSSlink(0,$this->_findFile('KHTMLFixes.css'),'all'));
113           } elseif (isBrowserOpera()) {
114           $this->addMoreHeaders($this->_CSSlink
115           (0,
116           isBrowserOpera(7) ? $this->_findFile('Opera7Fixes.css')
117           : $this->_findFile('Opera6Fixes.css'),'all'));
118           }
119         */
120         // TODO: IEMAC, KHTML, Opera6, Opera7
121         $this->addMoreAttr('body', "class-ns-0", HTML::Raw('class="ns-0"'));
122
123         // CSS file defines fonts, colors and background images for this
124         // style.  The companion '*-heavy.css' file isn't defined, it's just
125         // expected to be in the same directory that the base style is in.
126
127         // This should result in phpwiki-printer.css being used when
128         // printing or print-previewing with style "PhpWiki" or "MacOSX" selected.
129         $this->setDefaultCSS('PhpWiki',
130                              array(''      => 'monobook.css',
131                                    'print' => 'commonPrint.css'));
132
133         // This allows one to manually select "Printer" style (when browsing page)
134         // to see what the printer style looks like.
135         $this->addAlternateCSS(_("Printer"), 'commonPrint.css', 'print, screen');
136         $this->addAlternateCSS(_("Top & bottom toolbars"), 'phpwiki-topbottombars.css');
137         $this->addAlternateCSS(_("Modern"), 'phpwiki-modern.css');
138
139         /**
140          * The logo image appears on every page and links to the HomePage.
141          */
142         $this->addImageAlias('logo', 'MonoBook-Logo.png');
143         //$this->addImageAlias('logo', WIKI_NAME . 'Logo.png');
144
145         /**
146          * The Signature image is shown after saving an edited page. If this
147          * is set to false then the "Thank you for editing..." screen will
148          * be omitted.
149          */
150         
151         $this->addImageAlias('signature', "Signature.png");
152         // Uncomment this next line to disable the signature.
153         $this->addImageAlias('signature', false);
154         
155         /*
156          * Link icons.
157          */
158         /*
159           $this->setLinkIcon('http');
160           $this->setLinkIcon('https');
161           $this->setLinkIcon('ftp');
162           $this->setLinkIcon('mailto');
163           //$this->setLinkIcon('interwiki');
164           */
165         $this->setLinkIcon('wikiuser');
166         //$this->setLinkIcon('*', 'url');
167         // front or after
168         //$this->setLinkIconAttr('after');
169         
170         //$this->setButtonSeparator("\n | ");
171
172         /**
173          * WikiWords can automatically be split by inserting spaces between
174          * the words. The default is to leave WordsSmashedTogetherLikeSo.
175          */
176         //$this->setAutosplitWikiWords(false);
177
178         /**
179          * Layout improvement with dangling links for mostly closed wiki's:
180          * If false, only users with edit permissions will be presented the 
181          * special wikiunknown class with "?" and Tooltip.
182          * If true (default), any user will see the ?, but will be presented 
183          * the PrintLoginForm on a click.
184          */
185         $this->setAnonEditUnknownLinks(false);
186
187         /*
188          * You may adjust the formats used for formatting dates and times
189          * below.  (These examples give the default formats.)
190          * Formats are given as format strings to PHP strftime() function See
191          * http://www.php.net/manual/en/function.strftime.php for details.
192          * Do not include the server's zone (%Z), times are converted to the
193          * user's time zone.
194          */
195         $this->setDateFormat("%B %d, %Y");
196         $this->setTimeFormat("%H:%M");
197
198         /*
199          * To suppress times in the "Last edited on" messages, give a
200          * give a second argument of false:
201          */
202         //$this->setDateFormat("%B %d, %Y", false); 
203     }
204 }
205
206 $WikiTheme = new WikiTheme_MonoBook('MonoBook');
207
208 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
209 // (c-file-style: "gnu")
210 // Local Variables:
211 // mode: php
212 // tab-width: 8
213 // c-basic-offset: 4
214 // c-hanging-comment-ender-p: nil
215 // indent-tabs-mode: nil
216 // End:   
217 ?>