5 * Translated from gwicke's previous TAL template version to remove
6 * dependency on PHPTAL.
13 if( !defined( 'MEDIAWIKI' ) )
17 * Inherit main code from SkinTemplate, set the CSS and template filter.
21 class SkinMonoBook
extends SkinTemplate
{
22 /** Using monobook. */
23 function initPage( &$out ) {
24 SkinTemplate
::initPage( $out );
25 $this->skinname
= 'monobook';
26 $this->stylename
= 'monobook';
27 $this->template
= 'MonoBookTemplate';
28 # Bug 14520: skins that just include this file shouldn't load nonexis-
30 $this->cssfiles
= array( 'IE', 'IE50', 'IE55', 'IE60', 'IE70', 'rtl' );
38 class MonoBookTemplate
extends QuickTemplate
{
41 * Template filter callback for MonoBook skin.
42 * Takes an associative array of data set from a SkinTemplate-based
43 * class, and a wrapper for MediaWiki's localization database, and
44 * outputs a formatted page.
50 $this->skin
= $skin = $wgUser->getSkin();
52 // Suppress warnings to prevent notices about missing indexes in $this->data
55 ?
><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
56 <html xmlns
="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
57 foreach($this->data
['xhtmlnamespaces'] as $tag => $ns) {
58 ?
>xmlns
:<?php
echo "{$tag}=\"{$ns}\" ";
59 } ?
>xml
:lang
="<?php $this->text('lang') ?>" lang
="<?php $this->text('lang') ?>" dir
="<?php $this->text('dir') ?>">
61 <meta http
-equiv
="Content-Type" content
="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
62 <?php
$this->html('headlinks') ?
>
63 <title
><?php
$this->text('pagetitle') ?
></title
>
64 <style type
="text/css" media
="screen, projection">/*<![CDATA[*/
65 @import
"<?php $this->text('stylepath') ?>/common/shared.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
66 @import
"<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
68 <link rel
="stylesheet" type
="text/css" <?php
if(empty($this->data
['printable']) ) { ?
>media
="print"<?php
} ?
> href
="<?php $this->text('printcss') ?>?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
69 <?php
if( in_array( 'IE50', $skin->cssfiles
) ) { ?
><!--[if lt IE
5.5000]><style type
="text/css">@import
"<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style
><![endif]-->
70 <?php
} if( in_array( 'IE55', $skin->cssfiles
) ) { ?
><!--[if IE
5.5000]><style type
="text/css">@import
"<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style
><![endif]-->
71 <?php
} if( in_array( 'IE60', $skin->cssfiles
) ) { ?
><!--[if IE
6]><style type
="text/css">@import
"<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style
><![endif]-->
72 <?php
} if( in_array( 'IE70', $skin->cssfiles
) ) { ?
><!--[if IE
7]><style type
="text/css">@import
"<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style
><![endif]-->
73 <?php
} ?
><!--[if lt IE
7]><?php
if( in_array( 'IE', $skin->cssfiles
) ) { ?
><script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script
>
74 <?php
} ?
><meta http
-equiv
="imagetoolbar" content
="no" /><![endif]-->
76 <?php
print Skin
::makeGlobalVariablesScript( $this->data
); ?
>
78 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js
--></script
>
80 <?php
$this->html('headscripts') ?
>
81 <?php
if($this->data
['jsvarurl']) { ?
>
82 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('jsvarurl') ?>"><!-- site js
--></script
>
84 <?php
if($this->data
['pagecss']) { ?
>
85 <style type
="text/css"><?php
$this->html('pagecss') ?
></style
>
87 if($this->data
['usercss']) { ?
>
88 <style type
="text/css"><?php
$this->html('usercss') ?
></style
>
90 if($this->data
['userjs']) { ?
>
91 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('userjs' ) ?>"></script
>
93 if($this->data
['userjsprev']) { ?
>
94 <script type
="<?php $this->text('jsmimetype') ?>"><?php
$this->html('userjsprev') ?
></script
>
96 if($this->data
['trackbackhtml']) print $this->data
['trackbackhtml']; ?
>
98 <body
<?php
if($this->data
['body_ondblclick']) { ?
> ondblclick
="<?php $this->text('body_ondblclick') ?>"<?php
} ?
>
99 <?php
if($this->data
['body_onload']) { ?
> onload
="<?php $this->text('body_onload') ?>"<?php
} ?
>
100 class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>">
101 <div id
="globalWrapper">
102 <div id
="column-content">
104 <a name
="top" id
="top"></a
>
105 <?php
if($this->data
['sitenotice']) { ?
><div id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
><?php
} ?
>
106 <h1
class="firstHeading"><?php
$this->data
['displaytitle']!=""?
$this->html('title'):$this->text('title') ?
></h1
>
107 <div id
="bodyContent">
108 <h3 id
="siteSub"><?php
$this->msg('tagline') ?
></h3
>
109 <div id
="contentSub"><?php
$this->html('subtitle') ?
></div
>
110 <?php
if($this->data
['undelete']) { ?
><div id
="contentSub2"><?php
$this->html('undelete') ?
></div
><?php
} ?
>
111 <?php
if($this->data
['newtalk'] ) { ?
><div
class="usermessage"><?php
$this->html('newtalk') ?
></div
><?php
} ?
>
112 <?php
if($this->data
['showjumplinks']) { ?
><div id
="jump-to-nav"><?php
$this->msg('jumpto') ?
> <a href
="#column-one"><?php
$this->msg('jumptonavigation') ?
></a
>, <a href
="#searchInput"><?php
$this->msg('jumptosearch') ?
></a
></div
><?php
} ?
>
113 <!-- start content
-->
114 <?php
$this->html('bodytext') ?
>
115 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
117 <div
class="visualClear"></div
>
121 <div id
="column-one">
122 <div id
="p-cactions" class="portlet">
123 <h5
><?php
$this->msg('views') ?
></h5
>
126 <?php
foreach($this->data
['content_actions'] as $key => $tab) { ?
>
127 <li id
="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php
128 if($tab['class']) { ?
> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php
}
129 ?
>><a href
="<?php echo htmlspecialchars($tab['href']) ?>"<?php
echo $skin->tooltipAndAccesskey('ca-'.$key) ?
>><?php
130 echo htmlspecialchars($tab['text']) ?
></a
></li
>
135 <div
class="portlet" id
="p-personal">
136 <h5
><?php
$this->msg('personaltools') ?
></h5
>
139 <?php
foreach($this->data
['personal_urls'] as $key => $item) { ?
>
140 <li id
="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php
141 if ($item['active']) { ?
> class="active"<?php
} ?
>><a href
="<?php
142 echo htmlspecialchars($item['href']) ?>"<?php
echo $skin->tooltipAndAccesskey('pt-'.$key) ?
><?php
143 if(!empty($item['class'])) { ?
> class="<?php
144 echo htmlspecialchars($item['class']) ?>"<?php
} ?
>><?php
145 echo htmlspecialchars($item['text']) ?
></a
></li
>
150 <div
class="portlet" id
="p-logo">
151 <a style
="background-image: url(<?php $this->text('logopath') ?>);" <?php
152 ?
>href
="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php
153 echo $skin->tooltipAndAccesskey('n-mainpage') ?
>></a
>
155 <script type
="<?php $this->text('jsmimetype') ?>"> if (window
.isMSIE55
) fixalpha(); </script
>
157 $sidebar = $this->data
['sidebar'];
158 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
159 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
160 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
161 foreach ($sidebar as $boxName => $cont) {
162 if ( $boxName == 'SEARCH' ) {
164 } elseif ( $boxName == 'TOOLBOX' ) {
166 } elseif ( $boxName == 'LANGUAGES' ) {
167 $this->languageBox();
169 $this->customBox( $boxName, $cont );
173 </div
><!-- end of the
left (by
default at least
) column
-->
174 <div
class="visualClear"></div
>
177 if($this->data
['poweredbyico']) { ?
>
178 <div id
="f-poweredbyico"><?php
$this->html('poweredbyico') ?
></div
>
180 if($this->data
['copyrightico']) { ?
>
181 <div id
="f-copyrightico"><?php
$this->html('copyrightico') ?
></div
>
184 // Generate additional footer links
188 $footerlinks = array(
189 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
190 'privacy', 'about', 'disclaimer', 'tagline',
192 foreach( $footerlinks as $aLink ) {
193 if( isset( $this->data
[$aLink] ) && $this->data
[$aLink] ) {
194 ?
> <li id
="<?php echo$aLink?>"><?php
$this->html($aLink) ?
></li
>
201 <?php
$this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?
>
202 <?php
$this->html('reporttime') ?
>
203 <?php
if ( $this->data
['debug'] ): ?
>
205 <?php
$this->text( 'debug' ); ?
>
212 } // end of execute() method
214 /*************************************************************************************************/
215 function searchBox() {
217 <div id
="p-search" class="portlet">
218 <h5
><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
219 <div id
="searchBody" class="pBody">
220 <form action
="<?php $this->text('searchaction') ?>" id
="searchform"><div
>
221 <input id
="searchInput" name
="search" type
="text"<?php
echo $this->skin
->tooltipAndAccesskey('search');
222 if( isset( $this->data
['search'] ) ) {
223 ?
> value
="<?php $this->text('search') ?>"<?php
} ?
> />
224 <input type
='submit' name
="go" class="searchButton" id
="searchGoButton" value
="<?php $this->msg('searcharticle') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-go' ); ?
> /> 
;
225 <input type
='submit' name
="fulltext" class="searchButton" id
="mw-searchButton" value
="<?php $this->msg('searchbutton') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-fulltext' ); ?
> />
232 /*************************************************************************************************/
235 <div
class="portlet" id
="p-tb">
236 <h5
><?php
$this->msg('toolbox') ?
></h5
>
240 if($this->data
['notspecialpage']) { ?
>
241 <li id
="t-whatlinkshere"><a href
="<?php
242 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
243 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-whatlinkshere') ?
>><?php
$this->msg('whatlinkshere') ?
></a
></li
>
245 if( $this->data
['nav_urls']['recentchangeslinked'] ) { ?
>
246 <li id
="t-recentchangeslinked"><a href
="<?php
247 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
248 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-recentchangeslinked') ?
>><?php
$this->msg('recentchangeslinked') ?
></a
></li
>
251 if(isset($this->data
['nav_urls']['trackbacklink'])) { ?
>
252 <li id
="t-trackbacklink"><a href
="<?php
253 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
254 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-trackbacklink') ?
>><?php
$this->msg('trackbacklink') ?
></a
></li
>
256 if($this->data
['feeds']) { ?
>
257 <li id
="feedlinks"><?php
foreach($this->data
['feeds'] as $key => $feed) {
258 ?
><span id
="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href
="<?php
259 echo htmlspecialchars($feed['href']) ?>"<?php
echo $this->skin
->tooltipAndAccesskey('feed-'.$key) ?
>><?php
echo htmlspecialchars($feed['text'])?
></a
> 
;</span
>
263 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
265 if($this->data
['nav_urls'][$special]) {
266 ?
><li id
="t-<?php echo $special ?>"><a href
="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
267 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-'.$special) ?
>><?php
$this->msg($special) ?
></a
></li
>
271 if(!empty($this->data
['nav_urls']['print']['href'])) { ?
>
272 <li id
="t-print"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
273 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-print') ?
>><?php
$this->msg('printableversion') ?
></a
></li
><?php
276 if(!empty($this->data
['nav_urls']['permalink']['href'])) { ?
>
277 <li id
="t-permalink"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
278 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-permalink') ?
>><?php
$this->msg('permalink') ?
></a
></li
><?php
279 } elseif ($this->data
['nav_urls']['permalink']['href'] === '') { ?
>
280 <li id
="t-ispermalink"<?php
echo $this->skin
->tooltip('t-ispermalink') ?
>><?php
$this->msg('permalink') ?
></li
><?php
283 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
284 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
292 /*************************************************************************************************/
293 function languageBox() {
294 if( $this->data
['language_urls'] ) {
296 <div id
="p-lang" class="portlet">
297 <h5
><?php
$this->msg('otherlanguages') ?
></h5
>
300 <?php
foreach($this->data
['language_urls'] as $langlink) { ?
>
301 <li
class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
302 ?
><a href
="<?php echo htmlspecialchars($langlink['href']) ?>"><?php
echo $langlink['text'] ?
></a
></li
>
311 /*************************************************************************************************/
312 function customBox( $bar, $cont ) {
314 <div
class='generated-sidebar portlet' id
='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php
echo $this->skin
->tooltip('p-'.$bar) ?
>>
315 <h5
><?php
$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?
></h5
>
317 <?php
if ( is_array( $cont ) ) { ?
>
319 <?php
foreach($cont as $key => $val) { ?
>
320 <li id
="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
321 if ( $val['active'] ) { ?
> class="active" <?php
}
322 ?
>><a href
="<?php echo htmlspecialchars($val['href']) ?>"<?php
echo $this->skin
->tooltipAndAccesskey($val['id']) ?
>><?php
echo htmlspecialchars($val['text']) ?
></a
></li
>
326 # allow raw HTML block to be defined by extensions