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
{
19 var $skinname = 'modern', $stylename = 'modern',
20 $template = 'ModernTemplate', $useHeadElement = true;
23 * We don't like the default getPoweredBy, the icon clashes with the
26 function getPoweredBy() {
28 return "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>";
31 function setupSkinUserCss( OutputPage
$out ){
32 global $wgStyleVersion, $wgJsMimeType, $wgStylePath;
34 // Do not call parent::setupSkinUserCss(), we have our own print style
35 $out->addStyle( 'common/shared.css', 'screen' );
36 $out->addStyle( 'modern/main.css', 'screen' );
37 $out->addStyle( 'modern/print.css', 'print' );
38 $out->addStyle( 'modern/rtl.css', 'screen', '', 'rtl' );
46 class ModernTemplate
extends QuickTemplate
{
49 * Template filter callback for Modern skin.
50 * Takes an associative array of data set from a SkinTemplate-based
51 * class, and a wrapper for MediaWiki's localization database, and
52 * outputs a formatted page.
57 global $wgRequest, $wgOut;
58 $this->skin
= $skin = $this->data
['skin'];
59 $action = $wgRequest->getText( 'action' );
61 // Suppress warnings to prevent notices about missing indexes in $this->data
64 $this->html( 'headelement' );
65 ?
><body
<?php
if($this->data
['body_ondblclick']) { ?
> ondblclick
="<?php $this->text('body_ondblclick') ?>"<?php
} ?
>
66 class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
69 <div id
="mw_header"><h1 id
="firstHeading"><?php
$this->html('title') ?
></h1
></div
>
72 <div id
="mw_contentwrapper">
73 <!-- navigation portlet
-->
74 <div id
="p-cactions" class="portlet">
75 <h5
><?php
$this->msg('views') ?
></h5
>
78 <?php
foreach($this->data
['content_actions'] as $key => $tab) {
80 <li id="' . Sanitizer
::escapeId( "ca-$key" ) . '"';
82 echo ' class="'.htmlspecialchars($tab['class']).'"';
84 echo'><a href="'.htmlspecialchars($tab['href']).'"';
85 # We don't want to give the watch tab an accesskey if the
86 # page is being edited, because that conflicts with the
87 # accesskey on the watch checkbox. We also don't want to
88 # give the edit tab an accesskey, because that's fairly su-
89 # perfluous and conflicts with an accesskey (Ctrl-E) often
90 # used for editing in Safari.
91 if( in_array( $action, array( 'edit', 'submit' ) )
92 && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
93 echo $skin->tooltip( "ca-$key" );
95 echo $skin->tooltipAndAccesskey( "ca-$key" );
97 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
104 <div id
="mw_content">
105 <!-- contentholder does nothing by
default, but it allows users to style the text inside
106 the content area without affecting the meaning of
'em' in
#mw_content, which is used
108 <div id
="mw_contentholder" <?php
$this->html("specialpageattributes") ?
>>
109 <div
class='mw-topboxes'>
110 <div id
="mw-js-message" style
="display:none;" <?php
$this->html('userlangattributes')?
>></div
>
111 <div
class="mw-topbox" id
="siteSub"><?php
$this->msg('tagline') ?
></div
>
112 <?php
if($this->data
['newtalk'] ) {
113 ?
><div
class="usermessage mw-topbox"><?php
$this->html('newtalk') ?
></div
>
115 <?php
if($this->data
['sitenotice']) {
116 ?
><div
class="mw-topbox" id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
>
120 <div id
="contentSub" <?php
$this->html('userlangattributes') ?
>><?php
$this->html('subtitle') ?
></div
>
122 <?php
if($this->data
['undelete']) { ?
><div id
="contentSub2"><?php
$this->html('undelete') ?
></div
><?php
} ?
>
123 <?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
} ?
>
125 <?php
$this->html('bodytext') ?
>
126 <div
class='mw_clear'></div
>
127 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
128 <?php
$this->html ('dataAfterContent') ?
>
129 </div
><!-- mw_contentholder
-->
130 </div
><!-- mw_content
-->
131 </div
><!-- mw_contentwrapper
-->
133 <div id
="mw_portlets" <?php
$this->html("userlangattributes") ?
>>
137 $sidebar = $this->data
['sidebar'];
138 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
139 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
140 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
142 foreach ($sidebar as $boxName => $cont) {
143 if ( $boxName == 'SEARCH' ) {
145 } elseif ( $boxName == 'TOOLBOX' ) {
147 } elseif ( $boxName == 'LANGUAGES' ) {
148 $this->languageBox();
150 $this->customBox( $boxName, $cont );
155 </div
><!-- mw_portlets
-->
160 <div
class="mw_clear"></div
>
162 <!-- personal portlet
-->
163 <div
class="portlet" id
="p-personal">
164 <h5
><?php
$this->msg('personaltools') ?
></h5
>
167 <?php
foreach($this->data
['personal_urls'] as $key => $item) { ?
>
168 <li id
="<?php echo Sanitizer::escapeId( "pt
-$key" ) ?>"<?php
169 if ($item['active']) { ?
> class="active"<?php
} ?
>><a href
="<?php
170 echo htmlspecialchars($item['href']) ?>"<?php
echo $skin->tooltipAndAccesskey('pt-'.$key) ?
><?php
171 if(!empty($item['class'])) { ?
> class="<?php
172 echo htmlspecialchars($item['class']) ?>"<?php
} ?
>><?php
173 echo htmlspecialchars($item['text']) ?
></a
></li
>
181 <div id
="footer" <?php
$this->html('userlangattributes') ?
>>
184 $footerlinks = array(
185 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
186 'privacy', 'about', 'disclaimer', 'tagline',
188 foreach( $footerlinks as $aLink ) {
189 if( isset( $this->data
[$aLink] ) && $this->data
[$aLink] ) {
190 ?
> <li id
="<?php echo$aLink?>"><?php
$this->html($aLink) ?
></li
>
195 <?php
echo $this->html("poweredbyico"); ?
>
198 <?php
$this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?
>
199 <?php
$this->html('reporttime') ?
>
200 <?php
if ( $this->data
['debug'] ): ?
>
202 <?php
$this->text( 'debug' ); ?
>
208 } // end of execute() method
210 /*************************************************************************************************/
211 function searchBox() {
212 global $wgUseTwoButtonsSearchForm;
215 <div id
="p-search" class="portlet">
216 <h5
><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
217 <div id
="searchBody" class="pBody">
218 <form action
="<?php $this->text('wgScript') ?>" id
="searchform">
219 <input type
='hidden' name
="title" value
="<?php $this->text('searchtitle') ?>"/>
220 <input id
="searchInput" name
="search" type
="text"<?php
echo $this->skin
->tooltipAndAccesskey('search');
221 if( isset( $this->data
['search'] ) ) {
222 ?
> value
="<?php $this->text('search') ?>"<?php
} ?
> />
223 <input type
='submit' name
="go" class="searchButton" id
="searchGoButton" value
="<?php $this->msg('searcharticle') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-go' ); ?
> /><?php
if ($wgUseTwoButtonsSearchForm) { ?
> 
;
224 <input type
='submit' name
="fulltext" class="searchButton" id
="mw-searchButton" value
="<?php $this->msg('searchbutton') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-fulltext' ); ?
> /><?php
} else { ?
>
226 <div
><a href
="<?php $this->text('searchaction') ?>" rel
="search"><?php
$this->msg('powersearch-legend') ?
></a
></div
><?php
} ?
>
234 /*************************************************************************************************/
238 <div
class="portlet" id
="p-tb">
239 <h5
><?php
$this->msg('toolbox') ?
></h5
>
243 if($this->data
['notspecialpage']) { ?
>
244 <li id
="t-whatlinkshere"><a href
="<?php
245 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
246 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-whatlinkshere') ?
>><?php
$this->msg('whatlinkshere') ?
></a
></li
>
248 if( $this->data
['nav_urls']['recentchangeslinked'] ) { ?
>
249 <li id
="t-recentchangeslinked"><a href
="<?php
250 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
251 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-recentchangeslinked') ?
>><?php
$this->msg('recentchangeslinked-toolbox') ?
></a
></li
>
254 if(isset($this->data
['nav_urls']['trackbacklink'])) { ?
>
255 <li id
="t-trackbacklink"><a href
="<?php
256 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
257 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-trackbacklink') ?
>><?php
$this->msg('trackbacklink') ?
></a
></li
>
259 if($this->data
['feeds']) { ?
>
260 <li id
="feedlinks"><?php
foreach($this->data
['feeds'] as $key => $feed) {
261 ?
><a id
="<?php echo Sanitizer::escapeId( "feed
-$key" ) ?>" href
="<?php
262 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
> 
;
266 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
268 if($this->data
['nav_urls'][$special]) {
269 ?
><li id
="t-<?php echo $special ?>"><a href
="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
270 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-'.$special) ?
>><?php
$this->msg($special) ?
></a
></li
>
274 if(!empty($this->data
['nav_urls']['print']['href'])) { ?
>
275 <li id
="t-print"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
276 ?>" rel
="alternate"<?php
echo $this->skin
->tooltipAndAccesskey('t-print') ?
>><?php
$this->msg('printableversion') ?
></a
></li
><?php
279 if(!empty($this->data
['nav_urls']['permalink']['href'])) { ?
>
280 <li id
="t-permalink"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
281 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-permalink') ?
>><?php
$this->msg('permalink') ?
></a
></li
><?php
282 } elseif ($this->data
['nav_urls']['permalink']['href'] === '') { ?
>
283 <li id
="t-ispermalink"<?php
echo $this->skin
->tooltip('t-ispermalink') ?
>><?php
$this->msg('permalink') ?
></li
><?php
286 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
294 /*************************************************************************************************/
295 function languageBox() {
296 if( $this->data
['language_urls'] ) {
298 <div id
="p-lang" class="portlet">
299 <h5
><?php
$this->msg('otherlanguages') ?
></h5
>
302 <?php
foreach($this->data
['language_urls'] as $langlink) { ?
>
303 <li
class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
304 ?
><a href
="<?php echo htmlspecialchars($langlink['href']) ?>"><?php
echo $langlink['text'] ?
></a
></li
>
313 /*************************************************************************************************/
314 function customBox( $bar, $cont ) {
316 <div
class='generated-sidebar portlet' id
='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php
echo $this->skin
->tooltip('p-'.$bar) ?
>>
317 <h5
><?php
$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?
></h5
>
319 <?php
if ( is_array( $cont ) ) { ?
>
321 <?php
foreach($cont as $key => $val) { ?
>
322 <li id
="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
323 if ( $val['active'] ) { ?
> class="active" <?php
}
324 ?
>><a href
="<?php echo htmlspecialchars($val['href']) ?>"<?php
echo $this->skin
->tooltipAndAccesskey($val['id']) ?
>><?php
echo htmlspecialchars($val['text']) ?
></a
></li
>
328 # allow raw HTML block to be defined by extensions