Update MediaWiki skin to 1.16
authorJesper Kristensen <mail@jesperkristensen.dk>
Thu, 03 Feb 2011 16:34:51 +0100
changeset 289 d618e51f2c8e
parent 288 80b87bf08af4
child 290 b633a07de427
push id137
push usermail@jesperkristensen.dk
push dateThu, 03 Feb 2011 15:35:22 +0000
Update MediaWiki skin to 1.16
mediawiki/INSTALL
mediawiki/theme/MCS.php
--- a/mediawiki/INSTALL
+++ b/mediawiki/INSTALL
@@ -1,12 +1,12 @@
 1) Download latest stable Mediawiki from SVN or as a zip bundle
  * http://www.mediawiki.org/wiki/Download_from_SVN
  * http://svn.wikimedia.org/svnroot/mediawiki/branches/REL1_14/phase3
- * Minimum required MediaWiki is 1.14
+ * Minimum required MediaWiki is 1.16.2
 
 2) Setup MediaWiki
 
 3) Prettify URLs
  * Modify your LocalSettings.php by adding several lines below $wgScriptPath:
   $wgScriptPath       = "%%RELPATH%%";
   $wgArticlePath      = "$wgScriptPath/$1";
   $wgScriptExtension  = ".php";
--- a/mediawiki/theme/MCS.php
+++ b/mediawiki/theme/MCS.php
@@ -20,28 +20,38 @@ class SkinMCS extends SkinTemplate {
 	 * We don't like the default getPoweredBy, the icon clashes with the 
 	 * skin L&F.
 	 */
 	function getPoweredBy() {
 		global	$wgVersion;
 		return "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>";
 	}
 
-	function initPage( OutputPage $out ) {
-		Skin::initPage( $out );
-		$this->skinname  = 'mcs';
-		$this->stylename = 'mcs';
-		$this->template  = 'MCSTemplate';
-	}
+	var $skinname = 'mcs', $stylename = 'mcs',
+		$template = 'MCSTemplate', $useHeadElement = true;
 
 	function setupSkinUserCss( OutputPage $out ){
+		global $wgStylePath;
 		$out->addStyle( 'mcs/css/layout.css', 'screen' );
 		$out->addStyle( 'mcs/custom.css', 'screen' );
 		$out->addStyle( 'mcs/mediawiki.css', 'screen' );
 		$out->addStyle( 'mcs/css/rtl.css', 'screen', '', 'rtl' );
+		$p = htmlspecialchars($wgStylePath);
+		$out->addHeadItem('McsIeStyle', '<!--[if lt IE 8]>
+  <meta http-equiv="imagetoolbar" content="no" />
+  <link rel="stylesheet" href="'.$p.'/mcs/css/ie7.css" type="text/css" media="screen" />
+<![endif]-->
+<!--[if lt IE 7]>
+  <link rel="stylesheet" href="'.$p.'/mcs/css/ie6.css" type="text/css" media="screen" />
+  <script type="text/javascript" src="'.$p.'/mcs/js/dd_belatedpng_0.0.8a-min.js"></script>
+  <script type="text/javascript"> 
+    DD_belatedPNG.fix(\'*\');
+  </script> 
+<![endif]-->
+');
 	}
 }
 /**
  * @todo document
  * @ingroup Skins
  */
 class MCSTemplate extends QuickTemplate {
 	var $skin;
@@ -60,81 +70,35 @@ class MCSTemplate extends QuickTemplate 
 		$this->skin = $skin = $this->data['skin'];
 		$action = $wgRequest->getText( 'action' );
 		$mix = $this->extractTOC($this->data['bodytext']);
 		$body = $mix[0];
 		$toc = $mix[1];
 
 		// Suppress warnings to prevent notices about missing indexes in $this->data
 		wfSuppressWarnings();
-print('<?');
-?>xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php 
-	foreach($this->data['xhtmlnamespaces'] as $tag => $ns) {
-		?>xmlns:<?php echo "{$tag}=\"{$ns}\" ";
-	} ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
-	<head>
-		<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 $this->html('csslinks') ?>
-<!--[if lt IE 8]>
-  <meta http-equiv="imagetoolbar" content="no" />
-  <link rel="stylesheet" href="<?php $this->text('stylepath' ) ?>/mcs/css/ie7.css" type="text/css" media="screen" />
-<![endif]-->
-<!--[if lt IE 7]>
-  <link rel="stylesheet" href="<?php $this->text('stylepath' ) ?>/mcs/css/ie6.css" type="text/css" media="screen" />
-  <script type="text/javascript" src="<?php $this->text('stylepath' ) ?>/mcs/js/dd_belatedpng_0.0.8a-min.js"></script>
-  <script type="text/javascript"> 
-    DD_belatedPNG.fix('*');
-  </script> 
-<![endif]-->
-		
-		<?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
-                
-		<script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script>
-		<!-- Head Scripts -->
-<?php $this->html('headscripts') ?>
-<?php	if($this->data['jsvarurl'  ]) { ?>
-		<script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl'  ) ?>"><!-- site js --></script>
-<?php	} ?>
-<?php	if($this->data['pagecss'   ]) { ?>
-		<style type="text/css"><?php $this->html('pagecss'   ) ?></style>
-<?php	}
-		if($this->data['usercss'   ]) { ?>
-		<style type="text/css"><?php $this->html('usercss'   ) ?></style>
-<?php	}
-		if($this->data['userjs'    ]) { ?>
-		<script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
-<?php	}
-		if($this->data['userjsprev']) { ?>
-		<script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
-<?php	}
-		if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
-	</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('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
+
+		$this->html( 'headelement' );
+?>
   <ul id="nav-access">
     <li><a href="#content">Skip to content<!-- TODO L10N --></a></li>
 <?php if($this->data['showjumplinks']) { ?>
 		<li><a href="#mw_portlets"><?php $this->msg('jumptonavigation') ?></a></li>
 		<li><a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></li>
 <?php } ?>
   </ul>
   <div id="header-bar" class="header">
     <div class="doc">
       <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">
+      <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>
@@ -208,17 +172,17 @@ if ($toc and $this->tocPos=='left') {
 if ($toc and $this->tocPos=='right') {
 ?>
 				<li class="box toc border<?php echo ' '.$this->tocStyle?>">
 					<?php $this->hackTOC($toc) ?>
 				</li>
 <?php
 }
 ?>
-				<li class="box border">
+				<li class="box border" <?php $this->html('userlangattributes') ?>>
 					<h3><?php $this->msg('views') ?></h3>
 					<ul>
 						<?php echo $ca_normal . $ca_weak; ?>
 					</ul>
 				</li>
 				<!-- portlets -->
 				<?php 
 					$sidebar = $this->data['sidebar'];		
@@ -239,30 +203,30 @@ if ($toc and $this->tocPos=='right') {
 				?>
 			</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">
-					<h1><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1>
+				<div class="article" <?php $this->html("specialpageattributes") ?>>
+					<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>
 						<?php } ?>
 					</div>
 <?php } ?>
 <?php if ($this->data['subtitle']) { ?>
-					<div id="contentSub" class="subheadline"><?php $this->html('subtitle') ?></div>
+					<div id="contentSub" class="subheadline" <?php $this->html('userlangattributes') ?>><?php $this->html('subtitle') ?></div>
 <?php } ?>
 			
 					<?php if($this->data['undelete']) { ?><div id="contentSub2"><?php     $this->html('undelete') ?></div><?php } ?>
 <?php
 if ($toc and strpos($this->tocPos,'content')!==false) {
 	$class = strpos($this->tocPos,'left')!==false?'left':(strpos($this->tocPos,'right')!==false?'right':'');
 ?>
 				<div class="box toc border <?php echo $class.' '.$this->tocStyle?>">
@@ -332,36 +296,43 @@ if ($toc and strpos($this->tocPos,'conte
 <?php $this->text( 'debug' ); ?>
 -->
 <?php endif; ?>
 </body></html>
 <?php
 	wfRestoreWarnings();
 	} // end of execute() method
 
+	function getMsg( $str ) {
+		return htmlspecialchars( $this->translator->translate( $str ) );
+	}
 	/*************************************************************************************************/
 	function searchBox() {
+		global $wgUseTwoButtonsSearchForm;
 ?>
 	<li id="hb-search-box">
-		<form action="<?php $this->text('searchaction') ?>" method="post" id="search">
+		<form action="<?php $this->text('wgScript') ?>" method="post" id="search">
 			<div>
-				<input
-					name="search" id="hb-searchinput" type="text"
-					value="<?php
-					if(isset($this->data['search']) && !empty($this->data['search'])) {
-						$this->text('search');
-					} else {
-						$this->msg('search');
-						echo '…';
-					} ?>"
-					<?php echo $this->skin->tooltipAndAccesskey('search'); ?>
-					onclick="if(this.value=='<?php $this->msg('search') ?>…')this.value='';"
-					onblur="if(this.value=='')this.value='<?php $this->msg('search') ?>…';" />
+				<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 if ($wgUseTwoButtonsSearchForm) { ?>
 				<input name="fulltext" class="hb-searchbutton" type="submit" value="<?php $this->msg('searchbutton') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
+<?php } else { ?>
+				<a href="<?php $this->text('searchaction') ?>" rel="search"><?php $this->msg('powersearch-legend') ?></a>
+<?php } ?>
 			</div>
 
 		</form>
 	</li>
 <?php
 	}
 
 	/*************************************************************************************************/
@@ -375,42 +346,42 @@ if ($toc and strpos($this->tocPos,'conte
 	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>
 <?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') ?></a></li>
+			?>"<?php echo $this->skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked-toolbox') ?></a></li>
 <?php 		}
 	}
-	if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
+	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) {
-				?><span id="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php
-				echo htmlspecialchars($feed['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;</span>
+				?><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>&nbsp;
 				<?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'])
-			?>"<?php echo $this->skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php
+			?>" 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
 	}
@@ -423,33 +394,33 @@ if ($toc and strpos($this->tocPos,'conte
 
 	/*************************************************************************************************/
 	function languageBox() {
 ?>
 	<!-- languages -->
 <?php
 		if( $this->data['language_urls'] ) { ?>
 	<li id="p-lang" class="box color portlet">
-		<h3><?php $this->msg('otherlanguages') ?></h3>
+		<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']) ?>"><?php echo $langlink['text'] ?></a></li>
 <?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 $bar; else echo $out; ?></h3>
+		<h3><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo htmlspecialchars($bar); else echo htmlspecialchars($out); ?></h3>
 <?php   if ( is_array( $cont ) ) { ?>
 		<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 $this->skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
 <?php			} ?>
 		</ul>