Naiad MediaWiki skin from the Blender wiki
[NaiadSkin.git] / Naiad.skin.php
blobd9c0e8c64bcaf3a9c2072d14e40f982e612dc62c
1 <?php
2 /*
3 * Copyright (c) 2011-2012 Francesco Siddi (fsiddi.com), Luca Bonavita (mindrones.com)
4 *
5 * This file is part of Naiad Skin for Mediawiki:
6 * http://wiki.blender.org/index.php/Meta:Skins/Naiad/Mediawiki
7 *
8 * Naiad is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * Naiad is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with Naiad. If not, see <http://www.gnu.org/licenses/>.
23 /**
24 * Inherit main code from SkinTemplate, set the CSS and template filter.
25 * @ingroup Skins
27 class SkinNaiad extends SkinTemplate {
28 /** Using naiad. */
29 var $skinname = 'naiad', $stylename = 'naiad',
30 $template = 'NaiadTemplate', $useHeadElement = true;
32 public function initPage( OutputPage $out ) {
33 parent::initPage( $out );
34 $out->addModules( 'skins.naiad' );
39 /**
40 * @todo document
41 * @addtogroup Skins
43 class NaiadTemplate extends BaseTemplate {
44 /**
45 * Template filter callback for MonoBook skin.
46 * Takes an associative array of data set from a SkinTemplate-based
47 * class, and a wrapper for MediaWiki's localization database, and
48 * outputs a formatted page.
50 * @access private
52 function execute() {
53 $skin = $this->getSkin();
54 $body = $this->data['bodycontent'];
56 $skin_path = $this->data['stylepath'].'/'.$this->data['stylename'];
57 $toc_pattern = '/<table id="toc".*?<\/table>/s';
58 global $foo_toc;
59 $foo_toc = '';
60 $body = preg_replace_callback(
61 $toc_pattern,
62 create_function('$match','global $foo_toc; $foo_toc=$match[0]; return "";'),
63 $body
66 // Suppress warnings to prevent notices about missing indexes in $this->data
67 wfSuppressWarnings();
69 // Output HTML Page
70 $this->html( 'headelement' );
73 <!-- START main page container -->
74 <div id="pagecontainer">
76 <!-- START subsection header and subnav -->
77 <div id="headerWrapper">
78 <div class="subnav boxheader">
79 <div id="left_controls">
80 <a id="logo" href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href']) ?>" title="Go to Main Page">
81 <img src="<?php echo($skin_path);?>/images/blender_logo.png" />
82 </a>
83 <ul class="external_nav">
84 <li><a href="http://www.blender.org" title="Go to blender.org website">blender.org</a></li>
85 <li><a href="http://code.blender.org" title="Go to blender development blog">code.blender.org</a></li>
86 </ul>
87 </div>
88 <h1 class="title_link">
89 <?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?>
90 </h1>
92 <?php // to remove
93 $pitems=$this->data['personal_urls'];
94 $us = array_shift($pitems);
95 $lo = array_pop($pitems);
96 array_unshift($pitems,$us);
97 if($lo) { array_push($pitems,$lo); }
98 $lo['text']=preg_replace('/\s*\/.+$/','',$lo['text']);
100 <span class="right_controls">
102 <?php if(sizeof($pitems)>1) { # if logged-in ?>
103 <!-- (<a href="<?php echo htmlspecialchars($lo['href']) ?>"><?php echo htmlspecialchars($lo['text']) ?></a>)-->
104 <div id="extras_one" class="dd_item">
105 <div class="button grey"><p><?php echo htmlspecialchars($us['text']) ?></p></div>
106 <div class="dd_menu extras_one">
107 <?php array_shift($pitems); ?>
108 <ul>
109 <li><a class="userid" href="<?php echo htmlspecialchars($us['href']) ?>"><?php echo htmlspecialchars($us['text']) ?></a></li>
110 <?php
111 foreach($pitems as $key => $item) { ?>
112 <li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php
113 if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
114 echo htmlspecialchars($item['href']) ?>"<?php
115 if(!empty($item['class'])) { ?> class="<?php
116 echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
117 echo htmlspecialchars($item['text']) ?></a></li>
118 <?php } ?>
119 </ul>
121 </div>
122 </div>
123 <?php } else { ?>
125 <a class="userid" href="<?php echo htmlspecialchars($us['href']) ?>"><?php echo htmlspecialchars($us['text']) ?></a>
127 <?php } ?>
128 </span>
130 </div>
131 <div id="p-cactions" class="subnav sublevel2">
132 <div id="contentSub"><?php $this->html('subtitle') ?></div>
134 <div id="dd_selectors">
135 <?php wfRunHooks( 'Series', array( &$this ) );?>
136 <?php wfRunHooks( 'Languages', array( &$this ) );?>
137 <?php //wfRunHooks( 'NavigationArrows', array( &$this ) );?>
138 </div>
140 <ul id="content_actions">
141 <?php $i=0; foreach($this->data['content_actions'] as $key => $tab) {?>
142 <?php if(preg_match("/nstab/i", $key) || $key == "talk" || $key == "edit" || $key == "history" || $key == "watch" || $key == "viewsource" || $key == "current"){?>
143 <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php
144 if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php }?>>
145 <a href="<?php echo htmlspecialchars($tab['href']) ?>"><?php echo htmlspecialchars($tab['text']) ?></a>
146 </li>
147 <?php }
148 $i++;}?>
149 </ul>
151 <div id="extras_two" class="dd_item">
152 <div class="button grey"><p>Page</p></div>
153 <div class="dd_menu extras_two">
155 <ul>
156 <?php $i=0; foreach($this->data['content_actions'] as $key => $tab) {?>
157 <?php if(!(preg_match("/nstab/i", $key) || $key == "talk" || $key == "edit" || $key == "history" || $key == "watch" || $key == "viewsource" || $key == "current")){?>
158 <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php
159 if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php }?>>
160 <a href="<?php echo htmlspecialchars($tab['href']) ?>"><?php echo htmlspecialchars($tab['text']) ?></a>
161 </li>
162 <?php }
163 $i++;}?>
165 <?php if($this->data['notspecialpage']) { ?>
166 <li id="t-whatlinkshere">
167 <a href="<?php echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])?>"><?php $this->msg('whatlinkshere') ?></a>
168 </li>
169 <?php if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
170 <li id="t-recentchangeslinked">
171 <a href="<?php echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])?>"><?php $this->msg('recentchangeslinked') ?></a>
172 </li>
173 <?php }
175 if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
176 <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
177 ?>"><?php $this->msg('permalink') ?></a></li><?php
178 } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
179 <li id="t-ispermalink"><?php $this->msg('permalink') ?></li><?php
181 </ul>
183 </div>
184 </div>
186 </div>
187 </div>
188 <!-- END subsection header and subnav -->
190 <div id="globalWrapper">
191 <div id="col-content">
192 <div id="content">
193 <a name="top" id="top"></a>
194 <div id="bodyContent">
195 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
197 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
199 <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
201 <!-- START content -->
202 <?php echo $body ?>
203 <?php if($this->data['catlinks']) { ?><div id="catlinks"><?php $this->html('catlinks') ?></div><?php } ?>
204 <!-- END content -->
206 <div class="visualClear"></div>
207 </div>
208 </div>
209 </div>
211 <!-- START column left -->
212 <div id="column-one">
214 <?php wfRunHooks( 'NavTreeTopPages', array( &$this ) );?>
216 <div id="scrollbar2">
218 <div class="viewport">
219 <div class="overview">
220 <!-- START navtree -->
221 <?php wfRunHooks( 'NavTreeSidebar', array( &$this ) ); ?>
222 <!-- END navtree -->
223 </div>
224 </div>
225 </div>
227 </div>
228 <!-- END column left -->
230 <!-- START column right -->
231 <div id="column-two">
232 <div id="scrollbar_right" class="nano">
235 <div class="overview">
236 <!-- USER MESSAGES -->
237 <?php /*if($this->data['newtalk'] ) { */?><div class="usermessage shade">new user message<?php /*$this->html('newtalk') */?></div><?php /*} */?>
238 <!-- SITENOTICE -->
239 <?php if($this->data['sitenotice']) { ?><div id="site_notice" class="sidebar_panel"><?php $this->html('sitenotice') ?></div><?php } ?>
240 <!-- MINIBANNER -->
241 <?php wfRunHooks( 'SidebarBanner', array( &$this ) );?>
242 <!-- PAGE STATUS -->
243 <div id="review_status_container"></div>
244 <!-- FLAGGED REVS -->
245 <div id="flagged_revs_container" class="sidebar_panel">
246 <!-- dataAfterContent -->
247 <?php $this->html( 'dataAfterContent' ); ?>
248 <!-- /dataAfterContent -->
249 </div>
250 <!-- START TOC -->
251 <?php
252 $foo_toc=preg_replace('/^.+<td[^>]*>\s*/','',$foo_toc);
253 $foo_toc=preg_replace('!</td>.*$!','',$foo_toc);
254 $foo_toc=preg_replace('!<ul>!','<ul id="toc-ul">',$foo_toc,1);
255 if($foo_toc) {
257 <div class="port" id="toc">
258 <?php echo $foo_toc; ?>
259 </div>
260 <?php } ?>
261 <!-- END TOC -->
263 </div>
265 </div>
266 <!-- END column right -->
268 </div>
269 <div class="visualClear"></div>
270 <div id="footer" class="boxbg">
273 <form action="<?php $this->text('searchaction') ?>" id="searchform">
274 <div id="p-search-div">
275 <input onfocus="if (this.value == 'quick search...') {this.value=''}; this.style.color='#000'" onblur="if (this.value == '') {this.value = 'quick search...'; this.style.color='#999';}" value="quick search..." id="searchInput" name="search" type="text" autocomplete="on" <?php
276 if( isset( $this->data['search'] ) ) {
277 ?> value="<?php $this->text('search') ?>"<?php
278 } ?> />
279 <input type="hidden" value="en" id="searchLang" name="searchLang">
280 <input type="hidden" value="" id="searchSer" name="searchSer">
281 <button type="submit" title="Quick search" name="fulltext" id="searchGoButton"><img src="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/images/magnifier.png" /></button>
282 </div>
284 </form>
286 <?php wfRunHooks( 'SearchSeries', array( &$this ) );?>
287 <?php wfRunHooks( 'SearchLanguages', array( &$this ) );?>
289 <div id="wiki_dd" class="dd_item">
290 <div class="button grey">
291 <p>Wiki</p>
292 </div>
293 <div class="dd_menu wiki">
295 <ul>
296 <?php $cont=$this->data['sidebar']['maintenance'];
297 foreach($cont as $key => $val) { ?>
298 <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
299 if ( $val['active'] ) { ?> class="active" <?php }?>>
300 <a href="<?php echo htmlspecialchars($val['href']) ?>">
301 <?php echo htmlspecialchars($val['text']) ?></a>
302 </li>
303 <?php } ?>
304 </ul>
306 <ul>
307 <?php if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
308 <li id="t-track">
309 <a href="<?php echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])?>"><?php $this->msg('trackbacklink') ?></a>
310 </li>
311 <?php }
312 if($this->data['feeds']) { ?>
313 <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
314 ?><span id="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php
315 echo htmlspecialchars($feed['href']) ?>"><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;</span>
316 <?php } ?></li><?php
319 foreach( array('contributions', 'blockip', 'emailuser') as $special ) {
321 if($this->data['nav_urls'][$special]) {
322 ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
323 ?>"><?php $this->msg($special) ?></a></li><?php
327 </ul>
329 <ul>
330 <?php $specialpages = 'specialpages';
331 if($this->data['nav_urls'][$specialpages]) {
332 ?><li id="t-<?php echo $specialpages ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$specialpages]['href'])
333 ?>"><?php $this->msg($specialpages) ?></a></li><?php
336 <?php $cont=$this->data['sidebar']['monitoring'];
337 foreach($cont as $key => $val) { ?>
338 <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
339 if ( $val['active'] ) { ?> class="active" <?php }?>>
340 <a href="<?php echo htmlspecialchars($val['href']) ?>">
341 <?php echo htmlspecialchars($val['text']) ?></a>
342 </li><?php
344 </ul>
346 <ul>
347 <?php $upload = 'upload';
348 if($this->data['nav_urls'][$upload]) {
349 ?><li id="t-<?php echo $upload ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$upload]['href'])
350 ?>"><?php $this->msg($upload) ?></a></li><?php
353 </ul>
355 </div>
356 </div>
359 <?php
360 if($this->data['poweredbyico']) { ?>
361 <a title="Powered by mediawiki.org" class="poweredbyico" href="http://www.mediawiki.org/">
362 <img src="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/images/poweredby_mediawiki.png" alt="power" />
363 </a>
364 <?php }
365 if($this->data['copyrightico']) { ?>
366 <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div>
367 <?php }
369 // Generate additional footer links
371 <ul class="links">
372 <?php
373 $footerlinks = array(
374 //'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
375 //'privacy', 'about', 'disclaimer', 'tagline',
376 'viewcount',
378 foreach( $footerlinks as $aLink ) {
379 if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
380 ?> <li id="<?php echo $aLink?>"><?php $this->html($aLink) ?></li>
381 <?php }
384 </ul>
385 </div>
386 </div>
387 <?php $this->html('reporttime') ?>
388 <?php if ( $this->data['debug'] ): ?>
389 <!-- Debug output:
390 <?php $this->text( 'debug' ); ?>
393 <?php endif;
395 $this->printTrail();
397 </body>
398 </html><?php
399 wfRestoreWarnings();