]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/MonoBook/themeinfo.php
Harmonize file footer
[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         $this->addMoreAttr('body', "class-ns-0", HTML::Raw('class="ns-0"'));
109
110         // CSS file defines fonts, colors and background images for this
111         // style.  The companion '*-heavy.css' file isn't defined, it's just
112         // expected to be in the same directory that the base style is in.
113
114         // This should result in phpwiki-printer.css being used when
115         // printing or print-previewing with style "PhpWiki" or "MacOSX" selected.
116         $this->setDefaultCSS('PhpWiki',
117                              array(''      => 'monobook.css',
118                                    'print' => 'commonPrint.css'));
119
120         // This allows one to manually select "Printer" style (when browsing page)
121         // to see what the printer style looks like.
122         $this->addAlternateCSS(_("Printer"), 'commonPrint.css', 'print, screen');
123         $this->addAlternateCSS(_("Top & bottom toolbars"), 'phpwiki-topbottombars.css');
124         $this->addAlternateCSS(_("Modern"), 'phpwiki-modern.css');
125
126         /**
127          * The logo image appears on every page and links to the HomePage.
128          */
129         $this->addImageAlias('logo', 'MonoBook-Logo.png');
130         //$this->addImageAlias('logo', WIKI_NAME . 'Logo.png');
131
132         /**
133          * The Signature image is shown after saving an edited page. If this
134          * is set to false then the "Thank you for editing..." screen will
135          * be omitted.
136          */
137
138         $this->addImageAlias('signature', "Signature.png");
139         // Uncomment this next line to disable the signature.
140         $this->addImageAlias('signature', false);
141
142         /*
143          * Link icons.
144          */
145         /*
146           $this->setLinkIcon('http');
147           $this->setLinkIcon('https');
148           $this->setLinkIcon('ftp');
149           $this->setLinkIcon('mailto');
150           //$this->setLinkIcon('interwiki');
151           */
152         $this->setLinkIcon('wikiuser');
153         //$this->setLinkIcon('*', 'url');
154         // front or after
155         //$this->setLinkIconAttr('after');
156
157         //$this->setButtonSeparator("\n | ");
158
159         /**
160          * WikiWords can automatically be split by inserting spaces between
161          * the words. The default is to leave WordsSmashedTogetherLikeSo.
162          */
163         //$this->setAutosplitWikiWords(false);
164
165         /**
166          * Layout improvement with dangling links for mostly closed wiki's:
167          * If false, only users with edit permissions will be presented the
168          * special wikiunknown class with "?" and Tooltip.
169          * If true (default), any user will see the ?, but will be presented
170          * the PrintLoginForm on a click.
171          */
172         $this->setAnonEditUnknownLinks(false);
173
174         /*
175          * You may adjust the formats used for formatting dates and times
176          * below.  (These examples give the default formats.)
177          * Formats are given as format strings to PHP strftime() function See
178          * http://www.php.net/manual/en/function.strftime.php for details.
179          * Do not include the server's zone (%Z), times are converted to the
180          * user's time zone.
181          */
182         $this->setDateFormat("%B %d, %Y");
183         $this->setTimeFormat("%H:%M");
184
185         /*
186          * To suppress times in the "Last edited on" messages, give a
187          * give a second argument of false:
188          */
189         //$this->setDateFormat("%B %d, %Y", false);
190     }
191 }
192
193 $WikiTheme = new WikiTheme_MonoBook('MonoBook');
194
195 // Local Variables:
196 // mode: php
197 // tab-width: 8
198 // c-basic-offset: 4
199 // c-hanging-comment-ender-p: nil
200 // indent-tabs-mode: nil
201 // End: 
202 ?>