3 * Copyright (c) 2011-2012 Francesco Siddi (fsiddi.com), Luca Bonavita (mindrones.com)
5 * This file is part of Naiad Skin for Mediawiki:
6 * http://wiki.blender.org/index.php/Meta:Skins/Naiad/Mediawiki
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/>.
24 * Inherit main code from SkinTemplate, set the CSS and template filter.
27 class SkinNaiad
extends SkinTemplate
{
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' );
43 class NaiadTemplate
extends BaseTemplate
{
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.
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';
60 $body = preg_replace_callback(
62 create_function('$match','global $foo_toc; $foo_toc=$match[0]; return "";'),
66 // Suppress warnings to prevent notices about missing indexes in $this->data
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" />
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
>
88 <h1
class="title_link">
89 <?php
$this->data
['displaytitle']!=""?
$this->html('title'):$this->text('title') ?
>
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); ?
>
109 <li
><a
class="userid" href
="<?php echo htmlspecialchars($us['href']) ?>"><?php
echo htmlspecialchars($us['text']) ?
></a
></li
>
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
>
125 <a
class="userid" href
="<?php echo htmlspecialchars($us['href']) ?>"><?php
echo htmlspecialchars($us['text']) ?
></a
>
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 ) );?>
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
>
151 <div id
="extras_two" class="dd_item">
152 <div
class="button grey"><p
>Page
</p
></div
>
153 <div
class="dd_menu extras_two">
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
>
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
>
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
>
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
188 <!-- END subsection header
and subnav
-->
190 <div id
="globalWrapper">
191 <div id
="col-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
-->
203 <?php
if($this->data
['catlinks']) { ?
><div id
="catlinks"><?php
$this->html('catlinks') ?
></div
><?php
} ?
>
206 <div
class="visualClear"></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 ) ); ?
>
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
/*} */?
>
239 <?php
if($this->data
['sitenotice']) { ?
><div id
="site_notice" class="sidebar_panel"><?php
$this->html('sitenotice') ?
></div
><?php
} ?
>
241 <?php
wfRunHooks( 'SidebarBanner', array( &$this ) );?
>
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
-->
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);
257 <div
class="port" id
="toc">
258 <?php
echo $foo_toc; ?
>
266 <!-- END column right
-->
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
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
>
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">
293 <div
class="dd_menu wiki">
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
>
307 <?php
if(isset($this->data
['nav_urls']['trackbacklink'])) { ?
>
309 <a href
="<?php echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])?>"><?php
$this->msg('trackbacklink') ?
></a
>
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
> 
;</span
>
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
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
>
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
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" />
365 if($this->data
['copyrightico']) { ?
>
366 <div id
="f-copyrightico"><?php
$this->html('copyrightico') ?
></div
>
369 // Generate additional footer links
373 $footerlinks = array(
374 //'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
375 //'privacy', 'about', 'disclaimer', 'tagline',
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
>
387 <?php
$this->html('reporttime') ?
>
388 <?php
if ( $this->data
['debug'] ): ?
>
390 <?php
$this->text( 'debug' ); ?
>