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