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