* skin L&F.
*/
function getPoweredBy() {
- global $wgVersion;
+ global $wgVersion;
return "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>";
}
- function initPage( &$out ) {
- SkinTemplate::initPage( $out );
+ function initPage( OutputPage $out ) {
+ parent::initPage( $out );
$this->skinname = 'modern';
$this->stylename = 'modern';
$this->template = 'ModernTemplate';
}
+
+ function setupSkinUserCss( OutputPage $out ){
+ // Do not call parent::setupSkinUserCss(), we have our own print style
+ $out->addStyle( 'common/shared.css', 'screen' );
+ $out->addStyle( 'modern/main.css', 'screen' );
+ $out->addStyle( 'modern/print.css', 'print' );
+ $out->addStyle( 'modern/rtl.css', 'screen', '', 'rtl' );
+ }
}
/**
* @ingroup Skins
*/
class ModernTemplate extends QuickTemplate {
+ var $skin;
/**
* Template filter callback for Modern skin.
* Takes an associative array of data set from a SkinTemplate-based
* @access private
*/
function execute() {
- global $wgUser;
- $skin = $wgUser->getSkin();
+ global $wgRequest;
+ $this->skin = $skin = $this->data['skin'];
+ $action = $wgRequest->getText( 'action' );
// Suppress warnings to prevent notices about missing indexes in $this->data
wfSuppressWarnings();
<meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
<?php $this->html('headlinks') ?>
<title><?php $this->text('pagetitle') ?></title>
- <?php if(empty($this->data['printable']) ) { ?>
- <style type="text/css" media="screen, projection">/*<![CDATA[*/
- @import "<?php $this->text('stylepath') ?>/common/shared.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
- @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
- /*]]>*/</style>
- <?php } ?>
- <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/print.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
+ <?php $this->html('csslinks') ?>
<!--[if lt IE 7]><meta http-equiv="imagetoolbar" content="no" /><![endif]-->
<?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
</head>
<body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
<?php if($this->data['body_onload' ]) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
- class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>">
+ class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
<!-- heading -->
- <div id="mw_header">
- <h1 id="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1>
- </div>
+ <div id="mw_header"><h1 id="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1></div>
<div id="mw_main">
<div id="mw_contentwrapper">
<h5><?php $this->msg('views') ?></h5>
<div class="pBody">
<ul>
- <?php foreach($this->data['content_actions'] as $key => $tab) { ?>
- <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php
- if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php }
- ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskey('ca-'.$key) ?>><?php
- echo htmlspecialchars($tab['text']) ?></a></li>
- <?php } ?>
+ <?php foreach($this->data['content_actions'] as $key => $tab) {
+ echo '
+ <li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
+ if( $tab['class'] ) {
+ echo ' class="'.htmlspecialchars($tab['class']).'"';
+ }
+ echo'><a href="'.htmlspecialchars($tab['href']).'"';
+ # We don't want to give the watch tab an accesskey if the
+ # page is being edited, because that conflicts with the
+ # accesskey on the watch checkbox. We also don't want to
+ # give the edit tab an accesskey, because that's fairly su-
+ # perfluous and conflicts with an accesskey (Ctrl-E) often
+ # used for editing in Safari.
+ if( in_array( $action, array( 'edit', 'submit' ) )
+ && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
+ echo $skin->tooltip( "ca-$key" );
+ } else {
+ echo $skin->tooltipAndAccesskey( "ca-$key" );
+ }
+ echo '>'.htmlspecialchars($tab['text']).'</a></li>';
+ } ?>
</ul>
</div>
</div>
for the margins -->
<div id="mw_contentholder">
<div class='mw-topboxes'>
+ <div id="mw-js-message" style="display:none;"></div>
<div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
<?php if($this->data['newtalk'] ) {
?><div class="usermessage mw-topbox"><?php $this->html('newtalk') ?></div>
<?php $this->html('bodytext') ?>
<div class='mw_clear'></div>
<?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
+ <?php $this->html ('dataAfterContent') ?>
</div><!-- mw_contentholder -->
</div><!-- mw_content -->
</div><!-- mw_contentwrapper -->
<div id="mw_portlets">
- <!-- other portlets -->
- <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
- <div class='generated-sidebar portlet' id='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php echo $skin->tooltip('p-'.$bar) ?>>
- <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
- <div class='pBody'>
-<?php if ( is_array( $cont ) ) { ?>
+ <!-- portlets -->
+ <?php
+ $sidebar = $this->data['sidebar'];
+ if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
+ if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
+ if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
+
+ foreach ($sidebar as $boxName => $cont) {
+ if ( $boxName == 'SEARCH' ) {
+ $this->searchBox();
+ } elseif ( $boxName == 'TOOLBOX' ) {
+ $this->toolbox();
+ } elseif ( $boxName == 'LANGUAGES' ) {
+ $this->languageBox();
+ } else {
+ $this->customBox( $boxName, $cont );
+ }
+ }
+ ?>
+
+ </div><!-- mw_portlets -->
+
+
+ </div><!-- main -->
+
+ <div class="mw_clear"></div>
+
+ <!-- personal portlet -->
+ <div class="portlet" id="p-personal">
+ <h5><?php $this->msg('personaltools') ?></h5>
+ <div class="pBody">
<ul>
-<?php foreach($cont as $key => $val) { ?>
- <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
- if ( $val['active'] ) { ?> class="active" <?php }
- ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
+<?php foreach($this->data['personal_urls'] as $key => $item) { ?>
+ <li id="<?php echo Sanitizer::escapeId( "pt-$key" ) ?>"<?php
+ if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
+ echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php
+ if(!empty($item['class'])) { ?> class="<?php
+ echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
+ echo htmlspecialchars($item['text']) ?></a></li>
<?php } ?>
</ul>
-<?php } else {
- # allow raw HTML block to be defined by extensions
- print $cont;
- }
+ </div>
+ </div>
+
+
+ <!-- footer -->
+ <div id="footer">
+ <ul id="f-list">
+<?php
+ $footerlinks = array(
+ 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
+ 'privacy', 'about', 'disclaimer', 'tagline',
+ );
+ foreach( $footerlinks as $aLink ) {
+ if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
+?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
+<?php }
+ }
?>
- </div><!-- pBody -->
- </div><!-- portlet -->
- <?php } ?>
+ </ul>
+ <?php echo $this->html("poweredbyico"); ?>
+ </div>
+ <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
+<?php $this->html('reporttime') ?>
+<?php if ( $this->data['debug'] ): ?>
+<!-- Debug output:
+<?php $this->text( 'debug' ); ?>
+-->
+<?php endif; ?>
+</body></html>
+<?php
+ wfRestoreWarnings();
+ } // end of execute() method
+
+ /*************************************************************************************************/
+ function searchBox() {
+?>
<!-- search -->
<div id="p-search" class="portlet">
<h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
<div id="searchBody" class="pBody">
<form action="<?php $this->text('searchaction') ?>" id="searchform"><div>
- <input id="searchInput" name="search" type="text"<?php echo $skin->tooltipAndAccesskey('search');
+ <input id="searchInput" name="search" type="text"<?php echo $this->skin->tooltipAndAccesskey('search');
if( isset( $this->data['search'] ) ) {
?> value="<?php $this->text('search') ?>"<?php } ?> />
- <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-go' ); ?> />
- <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
+ <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> />
+ <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
+ <a href="<?php $this->text('searchaction') ?>" rel="search"><?php $this->msg('powersearch-legend') ?></a>
</div></form>
</div><!-- pBody -->
</div><!-- portlet -->
+<?php
+ }
+ /*************************************************************************************************/
+ function toolbox() {
+?>
<!-- toolbox -->
<div class="portlet" id="p-tb">
<h5><?php $this->msg('toolbox') ?></h5>
if($this->data['notspecialpage']) { ?>
<li id="t-whatlinkshere"><a href="<?php
echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
- ?>"<?php echo $skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li>
+ ?>"<?php echo $this->skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li>
<?php
if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
<li id="t-recentchangeslinked"><a href="<?php
echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
- ?>"<?php echo $skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked') ?></a></li>
+ ?>"<?php echo $this->skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked') ?></a></li>
<?php }
}
if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
<li id="t-trackbacklink"><a href="<?php
echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
- ?>"<?php echo $skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li>
+ ?>"<?php echo $this->skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li>
<?php }
if($this->data['feeds']) { ?>
<li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
- ?><span id="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php
- echo htmlspecialchars($feed['href']) ?>"<?php echo $skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a> </span>
+ ?><span id="<?php echo Sanitizer::escapeId( "feed-$key" ) ?>"><a href="<?php
+ echo htmlspecialchars($feed['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a> </span>
<?php } ?></li><?php
}
if($this->data['nav_urls'][$special]) {
?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
- ?>"<?php echo $skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li>
+ ?>"<?php echo $this->skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li>
<?php }
}
if(!empty($this->data['nav_urls']['print']['href'])) { ?>
<li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
- ?>"<?php echo $skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php
+ ?>"<?php echo $this->skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php
}
if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
<li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
- ?>"<?php echo $skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php
+ ?>"<?php echo $this->skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php
} elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
- <li id="t-ispermalink"<?php echo $skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
+ <li id="t-ispermalink"<?php echo $this->skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
}
wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
?> </ul>
</div><!-- pBody -->
</div><!-- portlet -->
+<?php
+ }
+ /*************************************************************************************************/
+ function languageBox() {
+?>
<!-- languages -->
<?php
if( $this->data['language_urls'] ) { ?>
<h5><?php $this->msg('otherlanguages') ?></h5>
<div class="pBody">
<ul>
-<?php foreach($this->data['language_urls'] as $langlink) { ?>
+<?php foreach($this->data['language_urls'] as $langlink) {
+ // Add title tag only if differ from shown text
+ $titleTag = $langlink['title'] == $langlink['text']
+ ? ''
+ : 'title="' . htmlspecialchars( $langlink['title'] ) . '"';
+ ?>
<li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
- ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li>
+ ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"
+ <? echo $titleTag ?> > <?php echo $langlink['text'] ?></a></li>
<?php } ?>
</ul>
</div><!-- pBody -->
</div><!-- portlet -->
-<?php } ?>
-
- </div><!-- mw_portlets -->
-
-
- </div><!-- main -->
-
- <div class="mw_clear"></div>
+<?php
+ }
+ }
- <!-- personal portlet -->
- <div class="portlet" id="p-personal">
- <h5><?php $this->msg('personaltools') ?></h5>
- <div class="pBody">
+ /*************************************************************************************************/
+ function customBox( $bar, $cont ) {
+?>
+ <div class='generated-sidebar portlet' id='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php echo $this->skin->tooltip('p-'.$bar) ?>>
+ <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
+ <div class='pBody'>
+<?php if ( is_array( $cont ) ) { ?>
<ul>
-<?php foreach($this->data['personal_urls'] as $key => $item) { ?>
- <li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php
- if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
- echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php
- if(!empty($item['class'])) { ?> class="<?php
- echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
- echo htmlspecialchars($item['text']) ?></a></li>
+<?php foreach($cont as $key => $val) { ?>
+ <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
+ if ( $val['active'] ) { ?> class="active" <?php }
+ ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
<?php } ?>
</ul>
- </div>
- </div>
-
-
- <!-- footer -->
- <div id="footer">
- <ul id="f-list">
-<?php
- $footerlinks = array(
- 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
- 'privacy', 'about', 'disclaimer', 'tagline',
- );
- foreach( $footerlinks as $aLink ) {
- if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
-?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
-<?php }
- }
+<?php } else {
+ # allow raw HTML block to be defined by extensions
+ print $cont;
+ }
?>
- </ul>
- <?php echo $this->html("poweredbyico"); ?>
- </div>
-
- <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
-<?php $this->html('reporttime') ?>
-<?php if ( $this->data['debug'] ): ?>
-<!-- Debug output:
-<?php $this->text( 'debug' ); ?>
--->
-<?php endif; ?>
-</body></html>
+ </div><!-- pBody -->
+ </div><!-- portlet -->
<?php
- wfRestoreWarnings();
- } // end of execute() method
+ }
+
} // end of class
?>