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( OutputPage
$out ) {
29 parent
::initPage( $out );
30 $this->skinname
= 'modern';
31 $this->stylename
= 'modern';
32 $this->template
= 'ModernTemplate';
35 function setupSkinUserCss( OutputPage
$out ){
36 // Do not call parent::setupSkinUserCss(), we have our own print style
37 $out->addStyle( 'common/shared.css', 'screen' );
38 $out->addStyle( 'modern/main.css', 'screen' );
39 $out->addStyle( 'modern/print.css', 'print' );
40 $out->addStyle( 'modern/rtl.css', 'screen', '', 'rtl' );
48 class ModernTemplate
extends QuickTemplate
{
51 * Template filter callback for Modern skin.
52 * Takes an associative array of data set from a SkinTemplate-based
53 * class, and a wrapper for MediaWiki's localization database, and
54 * outputs a formatted page.
59 global $wgRequest, $wgOut;
60 $this->skin
= $skin = $this->data
['skin'];
61 $action = $wgRequest->getText( 'action' );
63 // Suppress warnings to prevent notices about missing indexes in $this->data
66 $wgOut->addScript( <<<HTML
67 <!--[if lt IE 7]><script type="$wgJsMimeType" src="$path/common/IEFixes.js?$wgStyleVersion"></script>
68 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
72 echo $wgOut->headElement( $this->skin
);
73 ?
><body
<?php
if($this->data
['body_ondblclick']) { ?
> ondblclick
="<?php $this->text('body_ondblclick') ?>"<?php
} ?
>
74 <?php
if($this->data
['body_onload' ]) { ?
> onload
="<?php $this->text('body_onload') ?>"<?php
} ?
>
75 class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
78 <div id
="mw_header"><h1 id
="firstHeading"><?php
$this->html('title') ?
></h1
></div
>
81 <div id
="mw_contentwrapper">
82 <!-- navigation portlet
-->
83 <div id
="p-cactions" class="portlet">
84 <h5
><?php
$this->msg('views') ?
></h5
>
87 <?php
foreach($this->data
['content_actions'] as $key => $tab) {
89 <li id="' . Sanitizer
::escapeId( "ca-$key" ) . '"';
91 echo ' class="'.htmlspecialchars($tab['class']).'"';
93 echo'><a href="'.htmlspecialchars($tab['href']).'"';
94 # We don't want to give the watch tab an accesskey if the
95 # page is being edited, because that conflicts with the
96 # accesskey on the watch checkbox. We also don't want to
97 # give the edit tab an accesskey, because that's fairly su-
98 # perfluous and conflicts with an accesskey (Ctrl-E) often
99 # used for editing in Safari.
100 if( in_array( $action, array( 'edit', 'submit' ) )
101 && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
102 echo $skin->tooltip( "ca-$key" );
104 echo $skin->tooltipAndAccesskey( "ca-$key" );
106 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
113 <div id
="mw_content">
114 <!-- contentholder does nothing by
default, but it allows users to style the text inside
115 the content area without affecting the meaning of
'em' in
#mw_content, which is used
117 <div id
="mw_contentholder">
118 <div
class='mw-topboxes'>
119 <div id
="mw-js-message" style
="display:none;"></div
>
120 <div
class="mw-topbox" id
="siteSub"><?php
$this->msg('tagline') ?
></div
>
121 <?php
if($this->data
['newtalk'] ) {
122 ?
><div
class="usermessage mw-topbox"><?php
$this->html('newtalk') ?
></div
>
124 <?php
if($this->data
['sitenotice']) {
125 ?
><div
class="mw-topbox" id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
>
129 <div id
="contentSub"><?php
$this->html('subtitle') ?
></div
>
131 <?php
if($this->data
['undelete']) { ?
><div id
="contentSub2"><?php
$this->html('undelete') ?
></div
><?php
} ?
>
132 <?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
} ?
>
134 <?php
$this->html('bodytext') ?
>
135 <div
class='mw_clear'></div
>
136 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
137 <?php
$this->html ('dataAfterContent') ?
>
138 </div
><!-- mw_contentholder
-->
139 </div
><!-- mw_content
-->
140 </div
><!-- mw_contentwrapper
-->
142 <div id
="mw_portlets">
146 $sidebar = $this->data
['sidebar'];
147 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
148 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
149 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
151 foreach ($sidebar as $boxName => $cont) {
152 if ( $boxName == 'SEARCH' ) {
154 } elseif ( $boxName == 'TOOLBOX' ) {
156 } elseif ( $boxName == 'LANGUAGES' ) {
157 $this->languageBox();
159 $this->customBox( $boxName, $cont );
164 </div
><!-- mw_portlets
-->
169 <div
class="mw_clear"></div
>
171 <!-- personal portlet
-->
172 <div
class="portlet" id
="p-personal">
173 <h5
><?php
$this->msg('personaltools') ?
></h5
>
176 <?php
foreach($this->data
['personal_urls'] as $key => $item) { ?
>
177 <li id
="<?php echo Sanitizer::escapeId( "pt
-$key" ) ?>"<?php
178 if ($item['active']) { ?
> class="active"<?php
} ?
>><a href
="<?php
179 echo htmlspecialchars($item['href']) ?>"<?php
echo $skin->tooltipAndAccesskey('pt-'.$key) ?
><?php
180 if(!empty($item['class'])) { ?
> class="<?php
181 echo htmlspecialchars($item['class']) ?>"<?php
} ?
>><?php
182 echo htmlspecialchars($item['text']) ?
></a
></li
>
193 $footerlinks = array(
194 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
195 'privacy', 'about', 'disclaimer', 'tagline',
197 foreach( $footerlinks as $aLink ) {
198 if( isset( $this->data
[$aLink] ) && $this->data
[$aLink] ) {
199 ?
> <li id
="<?php echo$aLink?>"><?php
$this->html($aLink) ?
></li
>
204 <?php
echo $this->html("poweredbyico"); ?
>
207 <?php
$this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?
>
208 <?php
$this->html('reporttime') ?
>
209 <?php
if ( $this->data
['debug'] ): ?
>
211 <?php
$this->text( 'debug' ); ?
>
217 } // end of execute() method
219 /*************************************************************************************************/
220 function searchBox() {
221 global $wgUseTwoButtonsSearchForm;
224 <div id
="p-search" class="portlet">
225 <h5
><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
226 <div id
="searchBody" class="pBody">
227 <form action
="<?php $this->text('wgScript') ?>" id
="searchform"><div
>
228 <input type
='hidden' name
="title" value
="<?php $this->text('searchtitle') ?>"/>
229 <input id
="searchInput" name
="search" type
="text"<?php
echo $this->skin
->tooltipAndAccesskey('search');
230 if( isset( $this->data
['search'] ) ) {
231 ?
> value
="<?php $this->text('search') ?>"<?php
} ?
> />
232 <input type
='submit' name
="go" class="searchButton" id
="searchGoButton" value
="<?php $this->msg('searcharticle') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-go' ); ?
> /><?php
if ($wgUseTwoButtonsSearchForm) { ?
> 
;
233 <input type
='submit' name
="fulltext" class="searchButton" id
="mw-searchButton" value
="<?php $this->msg('searchbutton') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-fulltext' ); ?
> /><?php
} else { ?
>
235 <div
><a href
="<?php $this->text('searchaction') ?>" rel
="search"><?php
$this->msg('powersearch-legend') ?
></a
></div
><?php
} ?
>
239 </div
><!-- portlet
-->
243 /*************************************************************************************************/
247 <div
class="portlet" id
="p-tb">
248 <h5
><?php
$this->msg('toolbox') ?
></h5
>
252 if($this->data
['notspecialpage']) { ?
>
253 <li id
="t-whatlinkshere"><a href
="<?php
254 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
255 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-whatlinkshere') ?
>><?php
$this->msg('whatlinkshere') ?
></a
></li
>
257 if( $this->data
['nav_urls']['recentchangeslinked'] ) { ?
>
258 <li id
="t-recentchangeslinked"><a href
="<?php
259 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
260 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-recentchangeslinked') ?
>><?php
$this->msg('recentchangeslinked-toolbox') ?
></a
></li
>
263 if(isset($this->data
['nav_urls']['trackbacklink'])) { ?
>
264 <li id
="t-trackbacklink"><a href
="<?php
265 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
266 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-trackbacklink') ?
>><?php
$this->msg('trackbacklink') ?
></a
></li
>
268 if($this->data
['feeds']) { ?
>
269 <li id
="feedlinks"><?php
foreach($this->data
['feeds'] as $key => $feed) {
270 ?
><a id
="<?php echo Sanitizer::escapeId( "feed
-$key" ) ?>" href
="<?php
271 echo htmlspecialchars($feed['href']) ?>" rel
="alternate" type
="application/<?php echo $key ?>+xml" class="feedlink"<?php
echo $this->skin
->tooltipAndAccesskey('feed-'.$key) ?
>><?php
echo htmlspecialchars($feed['text'])?
></a
> 
;
275 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
277 if($this->data
['nav_urls'][$special]) {
278 ?
><li id
="t-<?php echo $special ?>"><a href
="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
279 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-'.$special) ?
>><?php
$this->msg($special) ?
></a
></li
>
283 if(!empty($this->data
['nav_urls']['print']['href'])) { ?
>
284 <li id
="t-print"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
285 ?>" rel
="alternate"<?php
echo $this->skin
->tooltipAndAccesskey('t-print') ?
>><?php
$this->msg('printableversion') ?
></a
></li
><?php
288 if(!empty($this->data
['nav_urls']['permalink']['href'])) { ?
>
289 <li id
="t-permalink"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
290 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-permalink') ?
>><?php
$this->msg('permalink') ?
></a
></li
><?php
291 } elseif ($this->data
['nav_urls']['permalink']['href'] === '') { ?
>
292 <li id
="t-ispermalink"<?php
echo $this->skin
->tooltip('t-ispermalink') ?
>><?php
$this->msg('permalink') ?
></li
><?php
295 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
298 </div
><!-- portlet
-->
302 /*************************************************************************************************/
303 function languageBox() {
307 if( $this->data
['language_urls'] ) { ?
>
308 <div id
="p-lang" class="portlet">
309 <h5
><?php
$this->msg('otherlanguages') ?
></h5
>
312 <?php
foreach($this->data
['language_urls'] as $langlink) { ?
>
313 <li
class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
314 ?
><a href
="<?php echo htmlspecialchars($langlink['href']) ?>"><?php
echo $langlink['text'] ?
></a
></li
>
318 </div
><!-- portlet
-->
323 /*************************************************************************************************/
324 function customBox( $bar, $cont ) {
326 <div
class='generated-sidebar portlet' id
='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php
echo $this->skin
->tooltip('p-'.$bar) ?
>>
327 <h5
><?php
$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?
></h5
>
329 <?php
if ( is_array( $cont ) ) { ?
>
331 <?php
foreach($cont as $key => $val) { ?
>
332 <li id
="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
333 if ( $val['active'] ) { ?
> class="active" <?php
}
334 ?
>><a href
="<?php echo htmlspecialchars($val['href']) ?>"<?php
echo $this->skin
->tooltipAndAccesskey($val['id']) ?
>><?php
echo htmlspecialchars($val['text']) ?
></a
></li
>
338 # allow raw HTML block to be defined by extensions
343 </div
><!-- portlet
-->