3 * Modern skin, derived from monobook template.
10 if( !defined( 'MEDIAWIKI' ) )
14 * Inherit main code from SkinTemplate, set the CSS and template filter.
18 class SkinModern
extends SkinTemplate
{
20 * We don't like the default getPoweredBy, the icon clashes with the
23 function getPoweredBy() {
25 return "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>";
28 function initPage( &$out ) {
29 Skin
::initPage( $out );
30 $this->skinname
= 'modern';
31 $this->stylename
= 'modern';
32 $this->template
= 'ModernTemplate';
34 $this->addStyle( 'common/shared.css', 'screen' );
35 $this->addStyle( 'modern/main.css', 'screen' );
36 $this->addStyle( 'modern/print.css', 'print' );
44 class ModernTemplate
extends QuickTemplate
{
47 * Template filter callback for Modern skin.
48 * Takes an associative array of data set from a SkinTemplate-based
49 * class, and a wrapper for MediaWiki's localization database, and
50 * outputs a formatted page.
56 $this->skin
= $skin = $this->data
['skin'];
57 $action = $wgRequest->getText( 'action' );
59 // Suppress warnings to prevent notices about missing indexes in $this->data
62 ?
><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
63 <html xmlns
="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
64 foreach($this->data
['xhtmlnamespaces'] as $tag => $ns) {
65 ?
>xmlns
:<?php
echo "{$tag}=\"{$ns}\" ";
66 } ?
>xml
:lang
="<?php $this->text('lang') ?>" lang
="<?php $this->text('lang') ?>" dir
="<?php $this->text('dir') ?>">
68 <meta http
-equiv
="Content-Type" content
="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
69 <?php
$this->html('headlinks') ?
>
70 <title
><?php
$this->text('pagetitle') ?
></title
>
71 <?php
$this->html('csslinks') ?
>
72 <!--[if lt IE
7]><meta http
-equiv
="imagetoolbar" content
="no" /><![endif]-->
74 <?php
print Skin
::makeGlobalVariablesScript( $this->data
); ?
>
76 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js
--></script
>
78 <?php
$this->html('headscripts') ?
>
79 <?php
if($this->data
['jsvarurl' ]) { ?
>
80 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('jsvarurl' ) ?>"><!-- site js
--></script
>
82 <?php
if($this->data
['pagecss' ]) { ?
>
83 <style type
="text/css"><?php
$this->html('pagecss' ) ?
></style
>
85 if($this->data
['usercss' ]) { ?
>
86 <style type
="text/css"><?php
$this->html('usercss' ) ?
></style
>
88 if($this->data
['userjs' ]) { ?
>
89 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('userjs' ) ?>"></script
>
91 if($this->data
['userjsprev']) { ?
>
92 <script type
="<?php $this->text('jsmimetype') ?>"><?php
$this->html('userjsprev') ?
></script
>
94 if($this->data
['trackbackhtml']) print $this->data
['trackbackhtml']; ?
>
96 <body
<?php
if($this->data
['body_ondblclick']) { ?
> ondblclick
="<?php $this->text('body_ondblclick') ?>"<?php
} ?
>
97 <?php
if($this->data
['body_onload' ]) { ?
> onload
="<?php $this->text('body_onload') ?>"<?php
} ?
>
98 class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>">
101 <div id
="mw_header"><h1 id
="firstHeading"><?php
$this->data
['displaytitle']!=""?
$this->html('title'):$this->text('title') ?
></h1
></div
>
104 <div id
="mw_contentwrapper">
105 <!-- navigation portlet
-->
106 <div id
="p-cactions" class="portlet">
107 <h5
><?php
$this->msg('views') ?
></h5
>
110 <?php
foreach($this->data
['content_actions'] as $key => $tab) {
112 <li id="ca-' . Sanitizer
::escapeId($key).'"';
113 if( $tab['class'] ) {
114 echo ' class="'.htmlspecialchars($tab['class']).'"';
116 echo'><a href="'.htmlspecialchars($tab['href']).'"';
117 # We don't want to give the watch tab an accesskey if the
118 # page is being edited, because that conflicts with the
119 # accesskey on the watch checkbox. We also don't want to
120 # give the edit tab an accesskey, because that's fairly su-
121 # perfluous and conflicts with an accesskey (Ctrl-E) often
122 # used for editing in Safari.
123 if( in_array( $action, array( 'edit', 'submit' ) )
124 && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
125 echo $skin->tooltip( "ca-$key" );
127 echo $skin->tooltipAndAccesskey( "ca-$key" );
129 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
136 <div id
="mw_content">
137 <!-- contentholder does nothing by
default, but it allows users to style the text inside
138 the content area without affecting the meaning of
'em' in
#mw_content, which is used
140 <div id
="mw_contentholder">
141 <div
class='mw-topboxes'>
142 <div
class="mw-topbox" id
="siteSub"><?php
$this->msg('tagline') ?
></div
>
143 <?php
if($this->data
['newtalk'] ) {
144 ?
><div
class="usermessage mw-topbox"><?php
$this->html('newtalk') ?
></div
>
146 <?php
if($this->data
['sitenotice']) {
147 ?
><div
class="mw-topbox" id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
>
151 <div id
="contentSub"><?php
$this->html('subtitle') ?
></div
>
153 <?php
if($this->data
['undelete']) { ?
><div id
="contentSub2"><?php
$this->html('undelete') ?
></div
><?php
} ?
>
154 <?php
if($this->data
['showjumplinks']) { ?
><div id
="jump-to-nav"><?php
$this->msg('jumpto') ?
> <a href
="#mw_portlets"><?php
$this->msg('jumptonavigation') ?
></a
>, <a href
="#searchInput"><?php
$this->msg('jumptosearch') ?
></a
></div
><?php
} ?
>
156 <?php
$this->html('bodytext') ?
>
157 <div
class='mw_clear'></div
>
158 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
159 </div
><!-- mw_contentholder
-->
160 </div
><!-- mw_content
-->
161 </div
><!-- mw_contentwrapper
-->
163 <div id
="mw_portlets">
167 $sidebar = $this->data
['sidebar'];
168 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
169 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
170 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
172 foreach ($sidebar as $boxName => $cont) {
173 if ( $boxName == 'SEARCH' ) {
175 } elseif ( $boxName == 'TOOLBOX' ) {
177 } elseif ( $boxName == 'LANGUAGES' ) {
178 $this->languageBox();
180 $this->customBox( $boxName, $cont );
185 </div
><!-- mw_portlets
-->
190 <div
class="mw_clear"></div
>
192 <!-- personal portlet
-->
193 <div
class="portlet" id
="p-personal">
194 <h5
><?php
$this->msg('personaltools') ?
></h5
>
197 <?php
foreach($this->data
['personal_urls'] as $key => $item) { ?
>
198 <li id
="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php
199 if ($item['active']) { ?
> class="active"<?php
} ?
>><a href
="<?php
200 echo htmlspecialchars($item['href']) ?>"<?php
echo $skin->tooltipAndAccesskey('pt-'.$key) ?
><?php
201 if(!empty($item['class'])) { ?
> class="<?php
202 echo htmlspecialchars($item['class']) ?>"<?php
} ?
>><?php
203 echo htmlspecialchars($item['text']) ?
></a
></li
>
214 $footerlinks = array(
215 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
216 'privacy', 'about', 'disclaimer', 'tagline',
218 foreach( $footerlinks as $aLink ) {
219 if( isset( $this->data
[$aLink] ) && $this->data
[$aLink] ) {
220 ?
> <li id
="<?php echo$aLink?>"><?php
$this->html($aLink) ?
></li
>
225 <?php
echo $this->html("poweredbyico"); ?
>
228 <?php
$this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?
>
229 <?php
$this->html('reporttime') ?
>
230 <?php
if ( $this->data
['debug'] ): ?
>
232 <?php
$this->text( 'debug' ); ?
>
238 } // end of execute() method
240 /*************************************************************************************************/
241 function searchBox() {
244 <div id
="p-search" class="portlet">
245 <h5
><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
246 <div id
="searchBody" class="pBody">
247 <form action
="<?php $this->text('searchaction') ?>" id
="searchform"><div
>
248 <input id
="searchInput" name
="search" type
="text"<?php
echo $this->skin
->tooltipAndAccesskey('search');
249 if( isset( $this->data
['search'] ) ) {
250 ?
> value
="<?php $this->text('search') ?>"<?php
} ?
> />
251 <input type
='submit' name
="go" class="searchButton" id
="searchGoButton" value
="<?php $this->msg('searcharticle') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-go' ); ?
> /> 
;
252 <input type
='submit' name
="fulltext" class="searchButton" id
="mw-searchButton" value
="<?php $this->msg('searchbutton') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-fulltext' ); ?
> />
255 </div
><!-- portlet
-->
259 /*************************************************************************************************/
263 <div
class="portlet" id
="p-tb">
264 <h5
><?php
$this->msg('toolbox') ?
></h5
>
268 if($this->data
['notspecialpage']) { ?
>
269 <li id
="t-whatlinkshere"><a href
="<?php
270 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
271 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-whatlinkshere') ?
>><?php
$this->msg('whatlinkshere') ?
></a
></li
>
273 if( $this->data
['nav_urls']['recentchangeslinked'] ) { ?
>
274 <li id
="t-recentchangeslinked"><a href
="<?php
275 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
276 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-recentchangeslinked') ?
>><?php
$this->msg('recentchangeslinked') ?
></a
></li
>
279 if(isset($this->data
['nav_urls']['trackbacklink'])) { ?
>
280 <li id
="t-trackbacklink"><a href
="<?php
281 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
282 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-trackbacklink') ?
>><?php
$this->msg('trackbacklink') ?
></a
></li
>
284 if($this->data
['feeds']) { ?
>
285 <li id
="feedlinks"><?php
foreach($this->data
['feeds'] as $key => $feed) {
286 ?
><span id
="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href
="<?php
287 echo htmlspecialchars($feed['href']) ?>"<?php
echo $this->skin
->tooltipAndAccesskey('feed-'.$key) ?
>><?php
echo htmlspecialchars($feed['text'])?
></a
> 
;</span
>
291 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
293 if($this->data
['nav_urls'][$special]) {
294 ?
><li id
="t-<?php echo $special ?>"><a href
="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
295 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-'.$special) ?
>><?php
$this->msg($special) ?
></a
></li
>
299 if(!empty($this->data
['nav_urls']['print']['href'])) { ?
>
300 <li id
="t-print"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
301 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-print') ?
>><?php
$this->msg('printableversion') ?
></a
></li
><?php
304 if(!empty($this->data
['nav_urls']['permalink']['href'])) { ?
>
305 <li id
="t-permalink"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
306 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-permalink') ?
>><?php
$this->msg('permalink') ?
></a
></li
><?php
307 } elseif ($this->data
['nav_urls']['permalink']['href'] === '') { ?
>
308 <li id
="t-ispermalink"<?php
echo $this->skin
->tooltip('t-ispermalink') ?
>><?php
$this->msg('permalink') ?
></li
><?php
311 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
314 </div
><!-- portlet
-->
318 /*************************************************************************************************/
319 function languageBox() {
323 if( $this->data
['language_urls'] ) { ?
>
324 <div id
="p-lang" class="portlet">
325 <h5
><?php
$this->msg('otherlanguages') ?
></h5
>
328 <?php
foreach($this->data
['language_urls'] as $langlink) { ?
>
329 <li
class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
330 ?
><a href
="<?php echo htmlspecialchars($langlink['href']) ?>"><?php
echo $langlink['text'] ?
></a
></li
>
334 </div
><!-- portlet
-->
339 /*************************************************************************************************/
340 function customBox( $bar, $cont ) {
342 <div
class='generated-sidebar portlet' id
='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php
echo $this->skin
->tooltip('p-'.$bar) ?
>>
343 <h5
><?php
$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?
></h5
>
345 <?php
if ( is_array( $cont ) ) { ?
>
347 <?php
foreach($cont as $key => $val) { ?
>
348 <li id
="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
349 if ( $val['active'] ) { ?
> class="active" <?php
}
350 ?
>><a href
="<?php echo htmlspecialchars($val['href']) ?>"<?php
echo $this->skin
->tooltipAndAccesskey($val['id']) ?
>><?php
echo htmlspecialchars($val['text']) ?
></a
></li
>
354 # allow raw HTML block to be defined by extensions
359 </div
><!-- portlet
-->