]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/MonoBook/themeinfo.php
Compress CSS
[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 extends WikiTheme_Wikilens
53 {
54   
55     /* this adds selected to the class */
56     function makeActionButton ($action, $label=false, $page_or_rev=false, $options=false) {
57         extract($this->_get_name_and_rev($page_or_rev));
58
59         if (is_array($action)) {
60             $attr = $action;
61             $action = isset($attr['action']) ? $attr['action'] : 'browse';
62         }
63         else
64             $attr['action'] = $action;
65
66         $class = is_safe_action($action) ? /*'named-wiki'*/'new' : 'wikiadmin';
67         /* if selected action is current then prepend selected */
68         global $request;
69         if ($request->getArg("action") == $action)
70             $class = "selected $class";
71             //$class = "selected";
72         if (!empty($options['class']))
73             $class = $options['class'];
74         if (!$label)
75             $label = $this->_labelForAction($action);
76
77         if ($version)
78             $attr['version'] = $version;
79
80         if ($action == 'browse')
81             unset($attr['action']);
82
83         $options = $this->fixAccesskey($options);
84         return $this->makeButton($label, WikiURL($pagename, $attr), $class, $options);
85     }
86
87     function load() {
88         $this->addMoreHeaders(JavaScript("var ta;\nvar skin = '".$this->_name."';\n"));
89         $this->addMoreHeaders(JavaScript('',array('src' => $this->_findData("wikibits.js"))));
90         if (isBrowserIE()) {
91             $ver = browserVersion();
92             if ($ver > 5.1 and $ver < 5.9)
93                 $this->addMoreHeaders($this->_CSSlink(0,$this->_findFile('IE55Fixes.css'),'all'));
94             elseif ($ver > 5.5 and $ver < 7.0)
95                 $this->addMoreHeaders($this->_CSSlink(0,$this->_findFile('IE60Fixes.css'),'all'));
96             elseif ($ver >= 7.0)
97                 $this->addMoreHeaders($this->_CSSlink(0,$this->_findFile('IE70Fixes.css'),'all'));
98             else
99                 $this->addMoreHeaders($this->_CSSlink(0,$this->_findFile('IE50Fixes.css'),'all'));
100             unset($ver);
101             $this->addMoreHeaders("\n");
102             $this->addMoreHeaders(JavaScript('',array('src' => $this->_findData("IEFixes.js"))));
103             $this->addMoreHeaders("\n");
104             $this->addMoreHeaders(HTML::Raw('<meta http-equiv="imagetoolbar" content="no" />'));
105         }
106         $this->addMoreAttr('body', "class-ns-0", HTML::Raw('class="ns-0"'));
107
108         // CSS file defines fonts, colors and background images for this
109         // style.  The companion '*-heavy.css' file isn't defined, it's just
110         // expected to be in the same directory that the base style is in.
111
112         // This should result in phpwiki-printer.css being used when
113         // printing or print-previewing with style "PhpWiki" or "MacOSX" selected.
114         $this->setDefaultCSS('PhpWiki',
115                              array(''      => 'monobook.css',
116                                    'print' => 'commonPrint.css'));
117
118         // This allows one to manually select "Printer" style (when browsing page)
119         // to see what the printer style looks like.
120         $this->addAlternateCSS(_("Printer"), 'commonPrint.css', 'print, screen');
121         $this->addAlternateCSS(_("Top & bottom toolbars"), 'phpwiki-topbottombars.css');
122         $this->addAlternateCSS(_("Modern"), 'phpwiki-modern.css');
123
124         /**
125          * The logo image appears on every page and links to the HomePage.
126          */
127         $this->addImageAlias('logo', 'MonoBook-Logo.png');
128         //$this->addImageAlias('logo', WIKI_NAME . 'Logo.png');
129
130         /**
131          * The Signature image is shown after saving an edited page. If this
132          * is set to false then the "Thank you for editing..." screen will
133          * be omitted.
134          */
135
136         $this->addImageAlias('signature', "Signature.png");
137         // Uncomment this next line to disable the signature.
138         $this->addImageAlias('signature', false);
139
140         /*
141          * Link icons.
142          */
143         /*
144           $this->setLinkIcon('http');
145           $this->setLinkIcon('https');
146           $this->setLinkIcon('ftp');
147           $this->setLinkIcon('mailto');
148           //$this->setLinkIcon('interwiki');
149           */
150         $this->setLinkIcon('wikiuser');
151         //$this->setLinkIcon('*', 'url');
152         // front or after
153         //$this->setLinkIconAttr('after');
154
155         //$this->setButtonSeparator("\n | ");
156
157         /**
158          * WikiWords can automatically be split by inserting spaces between
159          * the words. The default is to leave WordsSmashedTogetherLikeSo.
160          */
161         //$this->setAutosplitWikiWords(false);
162
163         /**
164          * Layout improvement with dangling links for mostly closed wiki's:
165          * If false, only users with edit permissions will be presented the
166          * special wikiunknown class with "?" and Tooltip.
167          * If true (default), any user will see the ?, but will be presented
168          * the PrintLoginForm on a click.
169          */
170         $this->setAnonEditUnknownLinks(false);
171
172         /*
173          * You may adjust the formats used for formatting dates and times
174          * below.  (These examples give the default formats.)
175          * Formats are given as format strings to PHP strftime() function See
176          * http://www.php.net/manual/en/function.strftime.php for details.
177          * Do not include the server's zone (%Z), times are converted to the
178          * user's time zone.
179          */
180         $this->setDateFormat("%B %d, %Y");
181         $this->setTimeFormat("%H:%M");
182
183         /*
184          * To suppress times in the "Last edited on" messages, give a
185          * give a second argument of false:
186          */
187         //$this->setDateFormat("%B %d, %Y", false);
188     }
189 }
190
191 $WikiTheme = new WikiTheme_MonoBook('MonoBook');
192
193 // Local Variables:
194 // mode: php
195 // tab-width: 8
196 // c-basic-offset: 4
197 // c-hanging-comment-ender-p: nil
198 // indent-tabs-mode: nil
199 // End: 
200 ?>