--- a/mediawiki/theme/MCS.php
+++ b/mediawiki/theme/MCS.php
@@ -39,32 +39,30 @@ class SkinMCS extends SkinTemplate {
<![endif]-->
');
}
}
/**
* @todo document
* @ingroup Skins
*/
-class MCSTemplate extends QuickTemplate {
+class MCSTemplate extends BaseTemplate {
var $skin;
var $tocPos = 'right'; # left | content | content-left | content-right | right
var $tocStyle = 'expand'; # expand | normal
/**
* Template filter callback for Modern skin.
* Takes an associative array of data set from a SkinTemplate-based
* class, and a wrapper for MediaWiki's localization database, and
* outputs a formatted page.
*
* @access private
*/
function execute() {
- global $wgRequest;
- $this->skin = $skin = $this->data['skin'];
- $action = $wgRequest->getText( 'action' );
+ $this->skin = $this->data['skin'];
$mix = $this->extractTOC($this->data['bodytext']);
$body = $mix[0];
$toc = $mix[1];
// Suppress warnings to prevent notices about missing indexes in $this->data
wfSuppressWarnings();
$this->html( 'headelement' );
@@ -81,24 +79,20 @@ class MCSTemplate extends QuickTemplate
<div class="logo">
<img src="<?php $this->text('stylepath' ) ?>/mcs/img/logo/dino.png" class="dino" alt="" />
<img src="<?php $this->text('stylepath' ) ?>/mcs/img/logo/mcs-logo-dark.png" class="mcs-logo-dark" alt="" />
<img src="<?php $this->text('stylepath' ) ?>/mcs/img/logo/mozilla.png" class="mozilla" alt="mozilla" />
<span>community website</span>
</div>
<ul class="nav" <?php $this->html('userlangattributes') ?>>
<?php $this->searchBox(); ?>
-<?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 } ?>
+<?php foreach($this->getPersonalTools() as $key => $item) { ?>
+ <?php echo $this->makeListItem($key, $item); ?>
+
+<?php } ?>
</ul>
</div>
</div>
<!-- heading -->
<div id="header" class="header">
<div class="doc">
<a href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>">
<img src="<?php $this->text('stylepath' ) ?>/mcs/img/mctlogo.png" id="logo" alt="" />
@@ -116,35 +110,35 @@ class MCSTemplate extends QuickTemplate
</div>
</div>
<div id="middle" class="doc">
<div class="row">
<?php $ca_strong = '';
$ca_normal = '';
$ca_weak = '';
foreach($this->data['content_actions'] as $key => $tab) {
- $ca = '
- <li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
+ $linkAttribs = array( 'href' => $tab['href'] );
+
+ if( isset( $tab["tooltiponly"] ) && $tab["tooltiponly"] ) {
+ $title = Linker::titleAttrib( "ca-$key" );
+ if ( $title !== false ) {
+ $linkAttribs['title'] = $title;
+ }
+ } else {
+ $linkAttribs += Linker::tooltipAndAccesskeyAttribs( "ca-$key" );
+ }
+ $linkHtml = Html::element( 'a', $linkAttribs, $tab['text'] );
+
+ /* Surround with a <li> */
+ $liAttribs = array( 'id' => Sanitizer::escapeId( "ca-$key" ) );
if( $tab['class'] ) {
- $ca .= ' class="'.htmlspecialchars($tab['class']).'"';
+ $liAttribs['class'] = $tab['class'];
}
- $ca .= '><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' ))) {
- $ca .= $skin->tooltip( "ca-$key" );
- } else {
- $ca .= $skin->tooltipAndAccesskey( "ca-$key" );
- }
- $ca .= '>'.htmlspecialchars($tab['text']).'</a></li>';
+ $ca = '
+ ' . Html::rawElement( 'li', $liAttribs, $linkHtml );
if (in_array($key, array('edit', 'addsection')))
$ca_strong .= $ca;
elseif (in_array($key, array('nstab-main', 'edit', 'talk', 'addsection', 'history')))
$ca_normal .= $ca;
else
$ca_weak .= $ca;
} ?>
<?php
@@ -176,35 +170,38 @@ if ($toc and $this->tocPos=='right') {
</li>
<!-- 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) {
+ foreach ($sidebar as $boxName => $content) {
+ if ( $content === false )
+ continue;
+
if ( $boxName == 'SEARCH' ) {
} elseif ( $boxName == 'TOOLBOX' ) {
$this->toolbox();
} elseif ( $boxName == 'LANGUAGES' ) {
$this->languageBox();
} else {
- $this->customBox( $boxName, $cont );
+ $this->customBox( $boxName, $content );
}
}
?>
</ul>
<div id="content" class="section">
<?php if ($ca_strong) { ?>
<ul class="mcs_edit_button metabox linklist right">
<?php echo $ca_strong; ?>
</ul>
<?php } ?>
- <div class="article" <?php $this->html("specialpageattributes") ?>>
+ <div class="article">
<h1><?php $this->html('title') ?></h1>
<?php if ($this->data['newtalk'] or $this->data['sitenotice']) { ?>
<div class='mw-topboxes'>
<?php if($this->data['newtalk'] ) {
?><div class="notice"><?php $this->html('newtalk') ?></div>
<?php } ?>
<?php if($this->data['sitenotice']) {
?><div class="notice" id="siteNotice"><?php $this->html('sitenotice') ?></div>
@@ -231,82 +228,55 @@ if ($toc and strpos($this->tocPos,'conte
<?php $this->html ('dataAfterContent') ?>
</div>
</div>
</div>
</div>
<div id="footer" class="footer">
<div class="doc">
<?php
- // Generate additional footer links
- $footerlinks = $this->data["footerlinks"]["info"];
- $validFooterLinks = array();
- foreach( $footerlinks as $aLink ) {
- if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
- $validFooterLinks[] = $aLink;
- }
- }
+ $validFooterIcons = $this->getFooterIcons( "icononly" );
+ $validFooterLinks = $this->getFooterLinks( "flat" ); // Additional footer links
+
if ( count( $validFooterLinks ) > 0 ) {
?>
<ul class="list nav">
<?php
foreach( $validFooterLinks as $aLink ) {
-?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
-<?php }
-?>
- </ul>
-<?php }
- $footerlinks = $this->data["footerlinks"]["places"];
- $validFooterLinks = array();
- foreach( $footerlinks as $aLink ) {
- if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
- $validFooterLinks[] = $aLink;
- }
- }
- if ( count( $validFooterLinks ) > 0 ) {
-?>
- <ul class="list nav">
-<?php
- foreach( $validFooterLinks as $aLink ) {
-?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
+?> <li id="<?php echo $aLink?>"><?php $this->html($aLink) ?></li>
<?php }
?>
</ul>
<?php }
?>
<span>Copyright © 2005–2008 Mozilla Atlantis. No rights reserved.</span>
<?php
// Generate additional footer icons
- $footericons = $this->data["footericons"];
// Unset copyright.copyright since we don't need the icon and already output a copyright from footerlinks
- unset($footericons["copyright"]["copyright"]);
- if ( count($footericons["copyright"]) <= 0 ) {
- unset($footericons["copyright"]);
+ unset($validFooterIcons["copyright"]["copyright"]);
+ if ( count($validFooterIcons["copyright"]) <= 0 ) {
+ unset($validFooterIcons["copyright"]);
}
- foreach ( $footericons as $blockName => $footerIcons ) { ?>
+ foreach ( $validFooterIcons as $blockName => $footerIcons ) { ?>
<div id="mw_<?php echo htmlspecialchars($blockName); ?>">
<?php
foreach ( $footerIcons as $icon ) { ?>
<?php echo $this->skin->makeFooterIcon( $icon, 'withoutImage' ); ?>
<?php
} ?>
</div>
<?php
}
?>
</div>
</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; ?>
+<?php
+ $this->printTrail();
+?>
</body></html>
<?php
wfRestoreWarnings();
} // end of execute() method
function getMsg( $str ) {
return htmlspecialchars( $this->translator->translate( $str ) );
}
@@ -315,29 +285,20 @@ if ($toc and strpos($this->tocPos,'conte
/*************************************************************************************************/
function searchBox() {
global $wgUseTwoButtonsSearchForm;
?>
<li id="hb-search-box">
<form action="<?php $this->text('wgScript') ?>" method="get" id="search">
<div>
<input type='hidden' name="title" value="<?php $this->text('searchtitle') ?>"/>
- <?php
- echo Html::input( 'search',
- isset( $this->data['search'] ) && !empty($this->data['search']) ? $this->data['search'] : $this->getMsg('search').'…', 'search',
- array(
- 'id' => 'hb-searchinput',
- 'title' => $this->skin->titleAttrib( 'search' ),
- 'accesskey' => $this->skin->accesskey( 'search' ),
- 'onclick' => "if(this.value=='".$this->getMsg('search')."…')this.value='';",
- 'onblur' => "if(this.value=='')this.value='".$this->getMsg('search')."…';"
- ) ); ?>
- <input name="go" class="hb-searchbutton" type="submit" value="<?php $this->msg('searcharticle') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> />
+ <?php echo $this->makeSearchInput(array( "id" => "hb-searchinput", "placeholder" => $this->getMsg('search') . "…" )); ?>
+ <?php echo $this->makeSearchButton("go", array( "class" => "hb-searchbutton" ));?>
<?php if ($wgUseTwoButtonsSearchForm) { ?>
- <input name="fulltext" class="hb-searchbutton" type="submit" value="<?php $this->msg('searchbutton') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
+ <?php echo $this->makeSearchButton("fulltext", array( "class" => "hb-searchbutton" )); ?>
<?php } else { ?>
<a href="<?php $this->text('searchaction') ?>" rel="search"><?php $this->msg('powersearch-legend') ?></a>
<?php } ?>
</div>
</form>
</li>
<?php
@@ -346,96 +307,53 @@ if ($toc and strpos($this->tocPos,'conte
/*************************************************************************************************/
function toolbox() {
?>
<!-- toolbox -->
<li class="box border portlet" id="p-tb">
<h3><?php $this->msg('toolbox') ?></h3>
<ul>
<?php
- if($this->data['notspecialpage']) { ?>
- <li id="t-whatlinkshere"><a href="<?php
- echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
- ?>"<?php echo $this->skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li>
+ foreach ( $this->getToolbox() as $key => $tbitem ) { ?>
+ <?php echo $this->makeListItem($key, $tbitem); ?>
<?php
- if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
- <li id="t-recentchangeslinked"><a href="<?php
- echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
- ?>"<?php echo $this->skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked-toolbox') ?></a></li>
-<?php }
- }
- if(isset($this->data['nav_urls']['trackbacklink']) && $this->data['nav_urls']['trackbacklink']) { ?>
- <li id="t-trackbacklink"><a href="<?php
- echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
- ?>"<?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) {
- ?><a id="feed-<?php echo Sanitizer::escapeId($key) ?>" href="<?php
- 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>&160;
- <?php } ?></li><?php
}
-
- foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
-
- 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 $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'])
- ?>" rel="alternate"<?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 $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 $this->skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
- }
-
- wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
+ wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) );
?> </ul>
</li><!-- portlet -->
<?php
}
/*************************************************************************************************/
function languageBox() {
?>
<!-- languages -->
<?php
if( $this->data['language_urls'] ) { ?>
<li id="p-lang" class="box color portlet">
<h3<?php $this->html('userlangattributes') ?>><?php $this->msg('otherlanguages') ?></h3>
<ul>
-<?php foreach($this->data['language_urls'] as $langlink) { ?>
- <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
- ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>" title="<?php
- echo htmlspecialchars($langlink['title']) ?>"><?php echo $langlink['text'] ?></a></li>
+<?php foreach($this->data['language_urls'] as $key => $langlink) { ?>
+ <?php echo $this->makeListItem($key, $langlink); ?>
<?php } ?>
</ul>
</li><!-- portlet -->
<?php
}
}
/*************************************************************************************************/
function customBox( $bar, $cont ) {
?>
<li class='box border generated-sidebar portlet' id='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php echo $this->skin->tooltip('p-'.$bar) ?>>
- <h3><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo htmlspecialchars($bar); else echo htmlspecialchars($out); ?></h3>
+ <h3><?php $msg = wfMessage( $bar ); echo htmlspecialchars( $msg->exists() ? $msg->text() : $bar ); ?></h3>
<?php if ( is_array( $cont ) ) { ?>
<ul>
-<?php foreach($cont as $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 foreach($cont as $key => $val) { ?>
+ <?php echo $this->makeListItem($key, $val); ?>
<?php } ?>
</ul>
<?php } else {
# allow raw HTML block to be defined by extensions
print $cont;
}
?>
</li><!-- portlet -->