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 global $wgHandheldStyle;
26 SkinTemplate
::initPage( $out );
27 $this->skinname
= 'monobook';
28 $this->stylename
= 'monobook';
29 $this->template
= 'MonoBookTemplate';
31 // Append to the default screen common & print styles...
32 $this->addStyle( 'monobook/main.css', 'screen' );
33 if( $wgHandheldStyle ) {
34 // Currently in testing... try 'chick/main.css'
35 $this->addStyle( $wgHandheldStyle, 'handheld' );
38 $this->addStyle( 'monobook/IE50Fixes.css', 'screen', 'lt IE 5.5000' );
39 $this->addStyle( 'monobook/IE55Fixes.css', 'screen', 'IE 5.5000' );
40 $this->addStyle( 'monobook/IE60Fixes.css', 'screen', 'IE 6' );
41 $this->addStyle( 'monobook/IE70Fixes.css', 'screen', 'IE 7' );
43 $this->addStyle( 'monobook/rtl.css', 'screen', '', 'rtl' );
51 class MonoBookTemplate
extends QuickTemplate
{
54 * Template filter callback for MonoBook skin.
55 * Takes an associative array of data set from a SkinTemplate-based
56 * class, and a wrapper for MediaWiki's localization database, and
57 * outputs a formatted page.
63 $this->skin
= $skin = $this->data
['skin'];
64 $action = $wgRequest->getText( 'action' );
66 // Suppress warnings to prevent notices about missing indexes in $this->data
69 ?
><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
70 <html xmlns
="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
71 foreach($this->data
['xhtmlnamespaces'] as $tag => $ns) {
72 ?
>xmlns
:<?php
echo "{$tag}=\"{$ns}\" ";
73 } ?
>xml
:lang
="<?php $this->text('lang') ?>" lang
="<?php $this->text('lang') ?>" dir
="<?php $this->text('dir') ?>">
75 <meta http
-equiv
="Content-Type" content
="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
76 <?php
$this->html('headlinks') ?
>
77 <title
><?php
$this->text('pagetitle') ?
></title
>
78 <?php
$this->html('csslinks') ?
>
80 <!--[if lt IE
7]><script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script
>
81 <meta http
-equiv
="imagetoolbar" content
="no" /><![endif]-->
83 <?php
print Skin
::makeGlobalVariablesScript( $this->data
); ?
>
85 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js
--></script
>
87 <?php
$this->html('headscripts') ?
>
88 <?php
if($this->data
['jsvarurl']) { ?
>
89 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('jsvarurl') ?>"><!-- site js
--></script
>
91 <?php
if($this->data
['pagecss']) { ?
>
92 <style type
="text/css"><?php
$this->html('pagecss') ?
></style
>
94 if($this->data
['usercss']) { ?
>
95 <style type
="text/css"><?php
$this->html('usercss') ?
></style
>
97 if($this->data
['userjs']) { ?
>
98 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('userjs' ) ?>"></script
>
100 if($this->data
['userjsprev']) { ?
>
101 <script type
="<?php $this->text('jsmimetype') ?>"><?php
$this->html('userjsprev') ?
></script
>
103 if($this->data
['trackbackhtml']) print $this->data
['trackbackhtml']; ?
>
105 <body
<?php
if($this->data
['body_ondblclick']) { ?
> ondblclick
="<?php $this->text('body_ondblclick') ?>"<?php
} ?
>
106 <?php
if($this->data
['body_onload']) { ?
> onload
="<?php $this->text('body_onload') ?>"<?php
} ?
>
107 class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
108 <div id
="globalWrapper">
109 <div id
="column-content">
111 <a name
="top" id
="top"></a
>
112 <?php
if($this->data
['sitenotice']) { ?
><div id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
><?php
} ?
>
113 <h1
class="firstHeading"><?php
$this->data
['displaytitle']!=""?
$this->html('title'):$this->text('title') ?
></h1
>
114 <div id
="bodyContent">
115 <h3 id
="siteSub"><?php
$this->msg('tagline') ?
></h3
>
116 <div id
="contentSub"><?php
$this->html('subtitle') ?
></div
>
117 <?php
if($this->data
['undelete']) { ?
><div id
="contentSub2"><?php
$this->html('undelete') ?
></div
><?php
} ?
>
118 <?php
if($this->data
['newtalk'] ) { ?
><div
class="usermessage"><?php
$this->html('newtalk') ?
></div
><?php
} ?
>
119 <?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
} ?
>
120 <!-- start content
-->
121 <?php
$this->html('bodytext') ?
>
122 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
124 <?php
if($this->data
['dataAfterContent']) { $this->html ('dataAfterContent'); } ?
>
125 <div
class="visualClear"></div
>
129 <div id
="column-one">
130 <div id
="p-cactions" class="portlet">
131 <h5
><?php
$this->msg('views') ?
></h5
>
134 <?php
foreach($this->data
['content_actions'] as $key => $tab) {
136 <li id="ca-' . Sanitizer
::escapeId($key).'"';
137 if( $tab['class'] ) {
138 echo ' class="'.htmlspecialchars($tab['class']).'"';
140 echo'><a href="'.htmlspecialchars($tab['href']).'"';
141 # We don't want to give the watch tab an accesskey if the
142 # page is being edited, because that conflicts with the
143 # accesskey on the watch checkbox. We also don't want to
144 # give the edit tab an accesskey, because that's fairly su-
145 # perfluous and conflicts with an accesskey (Ctrl-E) often
146 # used for editing in Safari.
147 if( in_array( $action, array( 'edit', 'submit' ) )
148 && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
149 echo $skin->tooltip( "ca-$key" );
151 echo $skin->tooltipAndAccesskey( "ca-$key" );
153 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
158 <div
class="portlet" id
="p-personal">
159 <h5
><?php
$this->msg('personaltools') ?
></h5
>
162 <?php
foreach($this->data
['personal_urls'] as $key => $item) { ?
>
163 <li id
="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php
164 if ($item['active']) { ?
> class="active"<?php
} ?
>><a href
="<?php
165 echo htmlspecialchars($item['href']) ?>"<?php
echo $skin->tooltipAndAccesskey('pt-'.$key) ?
><?php
166 if(!empty($item['class'])) { ?
> class="<?php
167 echo htmlspecialchars($item['class']) ?>"<?php
} ?
>><?php
168 echo htmlspecialchars($item['text']) ?
></a
></li
>
173 <div
class="portlet" id
="p-logo">
174 <a style
="background-image: url(<?php $this->text('logopath') ?>);" <?php
175 ?
>href
="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php
176 echo $skin->tooltipAndAccesskey('n-mainpage') ?
>></a
>
178 <script type
="<?php $this->text('jsmimetype') ?>"> if (window
.isMSIE55
) fixalpha(); </script
>
180 $sidebar = $this->data
['sidebar'];
181 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
182 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
183 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
184 foreach ($sidebar as $boxName => $cont) {
185 if ( $boxName == 'SEARCH' ) {
187 } elseif ( $boxName == 'TOOLBOX' ) {
189 } elseif ( $boxName == 'LANGUAGES' ) {
190 $this->languageBox();
192 $this->customBox( $boxName, $cont );
196 </div
><!-- end of the
left (by
default at least
) column
-->
197 <div
class="visualClear"></div
>
200 if($this->data
['poweredbyico']) { ?
>
201 <div id
="f-poweredbyico"><?php
$this->html('poweredbyico') ?
></div
>
203 if($this->data
['copyrightico']) { ?
>
204 <div id
="f-copyrightico"><?php
$this->html('copyrightico') ?
></div
>
207 // Generate additional footer links
211 $footerlinks = array(
212 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
213 'privacy', 'about', 'disclaimer', 'tagline',
215 foreach( $footerlinks as $aLink ) {
216 if( isset( $this->data
[$aLink] ) && $this->data
[$aLink] ) {
217 ?
> <li id
="<?php echo$aLink?>"><?php
$this->html($aLink) ?
></li
>
224 <?php
$this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?
>
225 <?php
$this->html('reporttime') ?
>
226 <?php
if ( $this->data
['debug'] ): ?
>
228 <?php
$this->text( 'debug' ); ?
>
235 } // end of execute() method
237 /*************************************************************************************************/
238 function searchBox() {
240 <div id
="p-search" class="portlet">
241 <h5
><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
242 <div id
="searchBody" class="pBody">
243 <form action
="<?php $this->text('searchaction') ?>" id
="searchform"><div
>
244 <input id
="searchInput" name
="search" type
="text"<?php
echo $this->skin
->tooltipAndAccesskey('search');
245 if( isset( $this->data
['search'] ) ) {
246 ?
> value
="<?php $this->text('search') ?>"<?php
} ?
> />
247 <input type
='submit' name
="go" class="searchButton" id
="searchGoButton" value
="<?php $this->msg('searcharticle') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-go' ); ?
> /> 
;
248 <input type
='submit' name
="fulltext" class="searchButton" id
="mw-searchButton" value
="<?php $this->msg('searchbutton') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-fulltext' ); ?
> />
255 /*************************************************************************************************/
258 <div
class="portlet" id
="p-tb">
259 <h5
><?php
$this->msg('toolbox') ?
></h5
>
263 if($this->data
['notspecialpage']) { ?
>
264 <li id
="t-whatlinkshere"><a href
="<?php
265 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
266 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-whatlinkshere') ?
>><?php
$this->msg('whatlinkshere') ?
></a
></li
>
268 if( $this->data
['nav_urls']['recentchangeslinked'] ) { ?
>
269 <li id
="t-recentchangeslinked"><a href
="<?php
270 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
271 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-recentchangeslinked') ?
>><?php
$this->msg('recentchangeslinked') ?
></a
></li
>
274 if(isset($this->data
['nav_urls']['trackbacklink'])) { ?
>
275 <li id
="t-trackbacklink"><a href
="<?php
276 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
277 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-trackbacklink') ?
>><?php
$this->msg('trackbacklink') ?
></a
></li
>
279 if($this->data
['feeds']) { ?
>
280 <li id
="feedlinks"><?php
foreach($this->data
['feeds'] as $key => $feed) {
281 ?
><span id
="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href
="<?php
282 echo htmlspecialchars($feed['href']) ?>"<?php
echo $this->skin
->tooltipAndAccesskey('feed-'.$key) ?
>><?php
echo htmlspecialchars($feed['text'])?
></a
> 
;</span
>
286 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
288 if($this->data
['nav_urls'][$special]) {
289 ?
><li id
="t-<?php echo $special ?>"><a href
="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
290 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-'.$special) ?
>><?php
$this->msg($special) ?
></a
></li
>
294 if(!empty($this->data
['nav_urls']['print']['href'])) { ?
>
295 <li id
="t-print"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
296 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-print') ?
>><?php
$this->msg('printableversion') ?
></a
></li
><?php
299 if(!empty($this->data
['nav_urls']['permalink']['href'])) { ?
>
300 <li id
="t-permalink"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
301 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-permalink') ?
>><?php
$this->msg('permalink') ?
></a
></li
><?php
302 } elseif ($this->data
['nav_urls']['permalink']['href'] === '') { ?
>
303 <li id
="t-ispermalink"<?php
echo $this->skin
->tooltip('t-ispermalink') ?
>><?php
$this->msg('permalink') ?
></li
><?php
306 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
307 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
315 /*************************************************************************************************/
316 function languageBox() {
317 if( $this->data
['language_urls'] ) {
319 <div id
="p-lang" class="portlet">
320 <h5
><?php
$this->msg('otherlanguages') ?
></h5
>
323 <?php
foreach($this->data
['language_urls'] as $langlink) { ?
>
324 <li
class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
325 ?
><a href
="<?php echo htmlspecialchars($langlink['href']) ?>"><?php
echo $langlink['text'] ?
></a
></li
>
334 /*************************************************************************************************/
335 function customBox( $bar, $cont ) {
337 <div
class='generated-sidebar portlet' id
='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php
echo $this->skin
->tooltip('p-'.$bar) ?
>>
338 <h5
><?php
$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?
></h5
>
340 <?php
if ( is_array( $cont ) ) { ?
>
342 <?php
foreach($cont as $key => $val) { ?
>
343 <li id
="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
344 if ( $val['active'] ) { ?
> class="active" <?php
}
345 ?
>><a href
="<?php echo htmlspecialchars($val['href']) ?>"<?php
echo $this->skin
->tooltipAndAccesskey($val['id']) ?
>><?php
echo htmlspecialchars($val['text']) ?
></a
></li
>
349 # allow raw HTML block to be defined by extensions