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( OutputPage
$out ) {
24 parent
::initPage( $out );
25 $this->skinname
= 'monobook';
26 $this->stylename
= 'monobook';
27 $this->template
= 'MonoBookTemplate';
31 function setupSkinUserCss( OutputPage
$out ) {
32 global $wgHandheldStyle;
34 parent
::setupSkinUserCss( $out );
36 // Append to the default screen common & print styles...
37 $out->addStyle( 'monobook/main.css', 'screen' );
38 if( $wgHandheldStyle ) {
39 // Currently in testing... try 'chick/main.css'
40 $out->addStyle( $wgHandheldStyle, 'handheld' );
43 $out->addStyle( 'monobook/IE50Fixes.css', 'screen', 'lt IE 5.5000' );
44 $out->addStyle( 'monobook/IE55Fixes.css', 'screen', 'IE 5.5000' );
45 $out->addStyle( 'monobook/IE60Fixes.css', 'screen', 'IE 6' );
46 $out->addStyle( 'monobook/IE70Fixes.css', 'screen', 'IE 7' );
48 $out->addStyle( 'monobook/rtl.css', 'screen', '', 'rtl' );
56 class MonoBookTemplate
extends QuickTemplate
{
59 * Template filter callback for MonoBook skin.
60 * Takes an associative array of data set from a SkinTemplate-based
61 * class, and a wrapper for MediaWiki's localization database, and
62 * outputs a formatted page.
68 $this->skin
= $skin = $this->data
['skin'];
69 $action = $wgRequest->getText( 'action' );
71 // Suppress warnings to prevent notices about missing indexes in $this->data
74 ?
><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
75 <html xmlns
="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
76 foreach($this->data
['xhtmlnamespaces'] as $tag => $ns) {
77 ?
>xmlns
:<?php
echo "{$tag}=\"{$ns}\" ";
78 } ?
>xml
:lang
="<?php $this->text('lang') ?>" lang
="<?php $this->text('lang') ?>" dir
="<?php $this->text('dir') ?>">
80 <meta http
-equiv
="Content-Type" content
="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
81 <?php
$this->html('headlinks') ?
>
82 <title
><?php
$this->text('pagetitle') ?
></title
>
83 <?php
$this->html('csslinks') ?
>
85 <!--[if lt IE
7]><script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script
>
86 <meta http
-equiv
="imagetoolbar" content
="no" /><![endif]-->
88 <?php
print Skin
::makeGlobalVariablesScript( $this->data
); ?
>
90 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js
--></script
>
91 <?php
$this->html('headscripts') ?
>
92 <?php
if($this->data
['jsvarurl']) { ?
>
93 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('jsvarurl') ?>"><!-- site js
--></script
>
95 <?php
if($this->data
['pagecss']) { ?
>
96 <style type
="text/css"><?php
$this->html('pagecss') ?
></style
>
98 if($this->data
['usercss']) { ?
>
99 <style type
="text/css"><?php
$this->html('usercss') ?
></style
>
101 if($this->data
['userjs']) { ?
>
102 <script type
="<?php $this->text('jsmimetype') ?>" src
="<?php $this->text('userjs' ) ?>"></script
>
104 if($this->data
['userjsprev']) { ?
>
105 <script type
="<?php $this->text('jsmimetype') ?>"><?php
$this->html('userjsprev') ?
></script
>
107 if($this->data
['trackbackhtml']) print $this->data
['trackbackhtml']; ?
>
109 <body
<?php
if($this->data
['body_ondblclick']) { ?
> ondblclick
="<?php $this->text('body_ondblclick') ?>"<?php
} ?
>
110 <?php
if($this->data
['body_onload']) { ?
> onload
="<?php $this->text('body_onload') ?>"<?php
} ?
>
111 class="mediawiki <?php $this->text('dir'); $this->text('capitalizeallnouns') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
112 <div id
="globalWrapper">
113 <div id
="column-content">
115 <a name
="top" id
="top"></a
>
116 <?php
if($this->data
['sitenotice']) { ?
><div id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
><?php
} ?
>
117 <h1 id
="firstHeading" class="firstHeading"><?php
$this->html('title') ?
></h1
>
118 <div id
="bodyContent">
119 <h3 id
="siteSub"><?php
$this->msg('tagline') ?
></h3
>
120 <div id
="contentSub"><?php
$this->html('subtitle') ?
></div
>
121 <?php
if($this->data
['undelete']) { ?
><div id
="contentSub2"><?php
$this->html('undelete') ?
></div
><?php
} ?
>
122 <?php
if($this->data
['newtalk'] ) { ?
><div
class="usermessage"><?php
$this->html('newtalk') ?
></div
><?php
} ?
>
123 <?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
} ?
>
124 <!-- start content
-->
125 <?php
$this->html('bodytext') ?
>
126 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
128 <?php
if($this->data
['dataAfterContent']) { $this->html ('dataAfterContent'); } ?
>
129 <div
class="visualClear"></div
>
133 <div id
="column-one">
134 <div id
="p-cactions" class="portlet">
135 <h5
><?php
$this->msg('views') ?
></h5
>
137 <ul
<?php
$this->html('userlangattributes') ?
>>
138 <?php
foreach($this->data
['content_actions'] as $key => $tab) {
140 <li id="' . Sanitizer
::escapeId( "ca-$key" ) . '"';
141 if( $tab['class'] ) {
142 echo ' class="'.htmlspecialchars($tab['class']).'"';
144 echo '><a href="'.htmlspecialchars($tab['href']).'"';
145 # We don't want to give the watch tab an accesskey if the
146 # page is being edited, because that conflicts with the
147 # accesskey on the watch checkbox. We also don't want to
148 # give the edit tab an accesskey, because that's fairly su-
149 # perfluous and conflicts with an accesskey (Ctrl-E) often
150 # used for editing in Safari.
151 if( in_array( $action, array( 'edit', 'submit' ) )
152 && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
153 echo $skin->tooltip( "ca-$key" );
155 echo $skin->tooltipAndAccesskey( "ca-$key" );
157 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
162 <div
class="portlet" id
="p-personal">
163 <h5
><?php
$this->msg('personaltools') ?
></h5
>
165 <ul
<?php
$this->html('userlangattributes') ?
>>
166 <?php
foreach($this->data
['personal_urls'] as $key => $item) { ?
>
167 <li id
="<?php echo Sanitizer::escapeId( "pt
-$key" ) ?>"<?php
168 if ($item['active']) { ?
> class="active"<?php
} ?
>><a href
="<?php
169 echo htmlspecialchars($item['href']) ?>"<?php
echo $skin->tooltipAndAccesskey('pt-'.$key) ?
><?php
170 if(!empty($item['class'])) { ?
> class="<?php
171 echo htmlspecialchars($item['class']) ?>"<?php
} ?
>><?php
172 echo htmlspecialchars($item['text']) ?
></a
></li
>
177 <div
class="portlet" id
="p-logo">
178 <a style
="background-image: url(<?php $this->text('logopath') ?>);" <?php
179 ?
>href
="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php
180 echo $skin->tooltipAndAccesskey('p-logo') ?
>></a
>
182 <script type
="<?php $this->text('jsmimetype') ?>"> if (window
.isMSIE55
) fixalpha(); </script
>
184 $sidebar = $this->data
['sidebar'];
185 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
186 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
187 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
188 foreach ($sidebar as $boxName => $cont) {
189 if ( $boxName == 'SEARCH' ) {
191 } elseif ( $boxName == 'TOOLBOX' ) {
193 } elseif ( $boxName == 'LANGUAGES' ) {
194 $this->languageBox();
196 $this->customBox( $boxName, $cont );
200 </div
><!-- end of the
left (by
default at least
) column
-->
201 <div
class="visualClear"></div
>
204 if($this->data
['poweredbyico']) { ?
>
205 <div id
="f-poweredbyico"><?php
$this->html('poweredbyico') ?
></div
>
207 if($this->data
['copyrightico']) { ?
>
208 <div id
="f-copyrightico"><?php
$this->html('copyrightico') ?
></div
>
211 // Generate additional footer links
212 $footerlinks = array(
213 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
214 'privacy', 'about', 'disclaimer', 'tagline',
216 $validFooterLinks = array();
217 foreach( $footerlinks as $aLink ) {
218 if( isset( $this->data
[$aLink] ) && $this->data
[$aLink] ) {
219 $validFooterLinks[] = $aLink;
222 if ( count( $validFooterLinks ) > 0 ) {
225 foreach( $validFooterLinks as $aLink ) {
226 if( isset( $this->data
[$aLink] ) && $this->data
[$aLink] ) {
227 ?
> <li id
="<?php echo $aLink ?>"><?php
$this->html($aLink) ?
></li
>
236 <?php
$this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?
>
237 <?php
$this->html('reporttime') ?
>
238 <?php
if ( $this->data
['debug'] ): ?
>
240 <?php
$this->text( 'debug' ); ?
>
247 } // end of execute() method
249 /*************************************************************************************************/
250 function searchBox() {
251 global $wgUseTwoButtonsSearchForm;
253 <div id
="p-search" class="portlet">
254 <h5
<?php
$this->html('userlangattributes') ?
>><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
255 <div id
="searchBody" class="pBody">
256 <form action
="<?php $this->text('wgScript') ?>" id
="searchform"><div
>
257 <input type
='hidden' name
="title" value
="<?php $this->text('searchtitle') ?>"/>
258 <input id
="searchInput" name
="search" type
="text"<?php
echo $this->skin
->tooltipAndAccesskey('search');
259 if( isset( $this->data
['search'] ) ) {
260 ?
> value
="<?php $this->text('search') ?>"<?php
} ?
> />
261 <input type
='submit' name
="go" class="searchButton" id
="searchGoButton" value
="<?php $this->msg('searcharticle') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-go' ); ?
> /><?php
if ($wgUseTwoButtonsSearchForm) { ?
> 
;
262 <input type
='submit' name
="fulltext" class="searchButton" id
="mw-searchButton" value
="<?php $this->msg('searchbutton') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-fulltext' ); ?
> /><?php
} else { ?
>
264 <div
><a href
="<?php $this->text('searchaction') ?>" rel
="search"><?php
$this->msg('powersearch-legend') ?
></a
></div
><?php
} ?
>
272 /*************************************************************************************************/
275 <div
class="portlet" id
="p-tb">
276 <h5
<?php
$this->html('userlangattributes')?
>><?php
$this->msg('toolbox') ?
></h5
>
280 if($this->data
['notspecialpage']) { ?
>
281 <li id
="t-whatlinkshere"><a href
="<?php
282 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
283 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-whatlinkshere') ?
>><?php
$this->msg('whatlinkshere') ?
></a
></li
>
285 if( $this->data
['nav_urls']['recentchangeslinked'] ) { ?
>
286 <li id
="t-recentchangeslinked"><a href
="<?php
287 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
288 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-recentchangeslinked') ?
>><?php
$this->msg('recentchangeslinked-toolbox') ?
></a
></li
>
291 if(isset($this->data
['nav_urls']['trackbacklink'])) { ?
>
292 <li id
="t-trackbacklink"><a href
="<?php
293 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
294 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-trackbacklink') ?
>><?php
$this->msg('trackbacklink') ?
></a
></li
>
296 if($this->data
['feeds']) { ?
>
297 <li id
="feedlinks"><?php
foreach($this->data
['feeds'] as $key => $feed) {
298 ?
><a id
="<?php echo Sanitizer::escapeId( "feed
-$key" ) ?>" href
="<?php
299 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
> 
;
303 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
305 if($this->data
['nav_urls'][$special]) {
306 ?
><li id
="t-<?php echo $special ?>"><a href
="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
307 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-'.$special) ?
>><?php
$this->msg($special) ?
></a
></li
>
311 if(!empty($this->data
['nav_urls']['print']['href'])) { ?
>
312 <li id
="t-print"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
313 ?>" rel
="alternate"<?php
echo $this->skin
->tooltipAndAccesskey('t-print') ?
>><?php
$this->msg('printableversion') ?
></a
></li
><?php
316 if(!empty($this->data
['nav_urls']['permalink']['href'])) { ?
>
317 <li id
="t-permalink"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
318 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-permalink') ?
>><?php
$this->msg('permalink') ?
></a
></li
><?php
319 } elseif ($this->data
['nav_urls']['permalink']['href'] === '') { ?
>
320 <li id
="t-ispermalink"<?php
echo $this->skin
->tooltip('t-ispermalink') ?
>><?php
$this->msg('permalink') ?
></li
><?php
323 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
324 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
332 /*************************************************************************************************/
333 function languageBox() {
334 if( $this->data
['language_urls'] ) {
336 <div id
="p-lang" class="portlet">
337 <h5
<?php
$this->html('userlangattributes') ?
>><?php
$this->msg('otherlanguages') ?
></h5
>
340 <?php
foreach($this->data
['language_urls'] as $langlink) { ?
>
341 <li
class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
342 ?
><a href
="<?php echo htmlspecialchars($langlink['href']) ?>"><?php
echo $langlink['text'] ?
></a
></li
>
351 /*************************************************************************************************/
352 function customBox( $bar, $cont ) {
354 <div
class='generated-sidebar portlet' id
='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php
echo $this->skin
->tooltip('p-'.$bar) ?
>>
355 <h5
<?php
$this->html('userlangattributes') ?
>><?php
$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo htmlspecialchars($bar); else echo htmlspecialchars($out); ?
></h5
>
357 <?php
if ( is_array( $cont ) ) { ?
>
359 <?php
foreach($cont as $key => $val) { ?
>
360 <li id
="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
361 if ( $val['active'] ) { ?
> class="active" <?php
}
362 ?
>><a href
="<?php echo htmlspecialchars($val['href']) ?>"<?php
echo $this->skin
->tooltipAndAccesskey($val['id']) ?
>><?php
echo htmlspecialchars($val['text']) ?
></a
></li
>
366 # allow raw HTML block to be defined by extensions