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.
67 global $wgRequest, $wgOut, $wgStyleVersion, $wgJsMimeType, $wgStylePath;
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 $path = htmlspecialchars( $wgStylePath );
75 $wgOut->addScript( <<<HTML
76 <!--[if lt IE 7]><script type="$wgJsMimeType" src="$path/common/IEFixes.js?$wgStyleVersion"></script>
77 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
81 echo $wgOut->headElement( $this->skin
);
83 ?
><body
<?php
if($this->data
['body_ondblclick']) { ?
> ondblclick
="<?php $this->text('body_ondblclick') ?>"<?php
} ?
>
84 <?php
if($this->data
['body_onload']) { ?
> onload
="<?php $this->text('body_onload') ?>"<?php
} ?
>
85 class="mediawiki <?php $this->text('dir'); $this->text('capitalizeallnouns') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
86 <div id
="globalWrapper">
87 <div id
="column-content">
89 <a name
="top" id
="top"></a
>
90 <?php
if($this->data
['sitenotice']) { ?
><div id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
><?php
} ?
>
91 <h1 id
="firstHeading" class="firstHeading"><?php
$this->html('title') ?
></h1
>
92 <div id
="bodyContent">
93 <h3 id
="siteSub"><?php
$this->msg('tagline') ?
></h3
>
94 <div id
="contentSub"><?php
$this->html('subtitle') ?
></div
>
95 <?php
if($this->data
['undelete']) { ?
><div id
="contentSub2"><?php
$this->html('undelete') ?
></div
><?php
} ?
>
96 <?php
if($this->data
['newtalk'] ) { ?
><div
class="usermessage"><?php
$this->html('newtalk') ?
></div
><?php
} ?
>
97 <?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
} ?
>
98 <!-- start content
-->
99 <?php
$this->html('bodytext') ?
>
100 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
102 <?php
if($this->data
['dataAfterContent']) { $this->html ('dataAfterContent'); } ?
>
103 <div
class="visualClear"></div
>
107 <div id
="column-one">
108 <div id
="p-cactions" class="portlet">
109 <h5
><?php
$this->msg('views') ?
></h5
>
111 <ul
<?php
$this->html('userlangattributes') ?
>>
112 <?php
foreach($this->data
['content_actions'] as $key => $tab) {
114 <li id="' . Sanitizer
::escapeId( "ca-$key" ) . '"';
115 if( $tab['class'] ) {
116 echo ' class="'.htmlspecialchars($tab['class']).'"';
118 echo '><a href="'.htmlspecialchars($tab['href']).'"';
119 # We don't want to give the watch tab an accesskey if the
120 # page is being edited, because that conflicts with the
121 # accesskey on the watch checkbox. We also don't want to
122 # give the edit tab an accesskey, because that's fairly su-
123 # perfluous and conflicts with an accesskey (Ctrl-E) often
124 # used for editing in Safari.
125 if( in_array( $action, array( 'edit', 'submit' ) )
126 && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
127 echo $skin->tooltip( "ca-$key" );
129 echo $skin->tooltipAndAccesskey( "ca-$key" );
131 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
136 <div
class="portlet" id
="p-personal">
137 <h5
><?php
$this->msg('personaltools') ?
></h5
>
139 <ul
<?php
$this->html('userlangattributes') ?
>>
140 <?php
foreach($this->data
['personal_urls'] as $key => $item) { ?
>
141 <li id
="<?php echo Sanitizer::escapeId( "pt
-$key" ) ?>"<?php
142 if ($item['active']) { ?
> class="active"<?php
} ?
>><a href
="<?php
143 echo htmlspecialchars($item['href']) ?>"<?php
echo $skin->tooltipAndAccesskey('pt-'.$key) ?
><?php
144 if(!empty($item['class'])) { ?
> class="<?php
145 echo htmlspecialchars($item['class']) ?>"<?php
} ?
>><?php
146 echo htmlspecialchars($item['text']) ?
></a
></li
>
151 <div
class="portlet" id
="p-logo">
152 <a style
="background-image: url(<?php $this->text('logopath') ?>);" <?php
153 ?
>href
="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php
154 echo $skin->tooltipAndAccesskey('p-logo') ?
>></a
>
156 <script type
="<?php $this->text('jsmimetype') ?>"> if (window
.isMSIE55
) fixalpha(); </script
>
158 $sidebar = $this->data
['sidebar'];
159 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
160 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
161 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
162 foreach ($sidebar as $boxName => $cont) {
163 if ( $boxName == 'SEARCH' ) {
165 } elseif ( $boxName == 'TOOLBOX' ) {
167 } elseif ( $boxName == 'LANGUAGES' ) {
168 $this->languageBox();
170 $this->customBox( $boxName, $cont );
174 </div
><!-- end of the
left (by
default at least
) column
-->
175 <div
class="visualClear"></div
>
178 if($this->data
['poweredbyico']) { ?
>
179 <div id
="f-poweredbyico"><?php
$this->html('poweredbyico') ?
></div
>
181 if($this->data
['copyrightico']) { ?
>
182 <div id
="f-copyrightico"><?php
$this->html('copyrightico') ?
></div
>
185 // Generate additional footer links
186 $footerlinks = array(
187 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
188 'privacy', 'about', 'disclaimer', 'tagline',
190 $validFooterLinks = array();
191 foreach( $footerlinks as $aLink ) {
192 if( isset( $this->data
[$aLink] ) && $this->data
[$aLink] ) {
193 $validFooterLinks[] = $aLink;
196 if ( count( $validFooterLinks ) > 0 ) {
199 foreach( $validFooterLinks as $aLink ) {
200 if( isset( $this->data
[$aLink] ) && $this->data
[$aLink] ) {
201 ?
> <li id
="<?php echo $aLink ?>"><?php
$this->html($aLink) ?
></li
>
210 <?php
$this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?
>
211 <?php
$this->html('reporttime') ?
>
212 <?php
if ( $this->data
['debug'] ): ?
>
214 <?php
$this->text( 'debug' ); ?
>
221 } // end of execute() method
223 /*************************************************************************************************/
224 function searchBox() {
225 global $wgUseTwoButtonsSearchForm;
227 <div id
="p-search" class="portlet">
228 <h5
<?php
$this->html('userlangattributes') ?
>><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
229 <div id
="searchBody" class="pBody">
230 <form action
="<?php $this->text('wgScript') ?>" id
="searchform"><div
>
231 <input type
='hidden' name
="title" value
="<?php $this->text('searchtitle') ?>"/>
232 <input id
="searchInput" name
="search" type
="text"<?php
echo $this->skin
->tooltipAndAccesskey('search');
233 if( isset( $this->data
['search'] ) ) {
234 ?
> value
="<?php $this->text('search') ?>"<?php
} ?
> />
235 <input type
='submit' name
="go" class="searchButton" id
="searchGoButton" value
="<?php $this->msg('searcharticle') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-go' ); ?
> /><?php
if ($wgUseTwoButtonsSearchForm) { ?
> 
;
236 <input type
='submit' name
="fulltext" class="searchButton" id
="mw-searchButton" value
="<?php $this->msg('searchbutton') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-fulltext' ); ?
> /><?php
} else { ?
>
238 <div
><a href
="<?php $this->text('searchaction') ?>" rel
="search"><?php
$this->msg('powersearch-legend') ?
></a
></div
><?php
} ?
>
246 /*************************************************************************************************/
249 <div
class="portlet" id
="p-tb">
250 <h5
<?php
$this->html('userlangattributes')?
>><?php
$this->msg('toolbox') ?
></h5
>
254 if($this->data
['notspecialpage']) { ?
>
255 <li id
="t-whatlinkshere"><a href
="<?php
256 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
257 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-whatlinkshere') ?
>><?php
$this->msg('whatlinkshere') ?
></a
></li
>
259 if( $this->data
['nav_urls']['recentchangeslinked'] ) { ?
>
260 <li id
="t-recentchangeslinked"><a href
="<?php
261 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
262 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-recentchangeslinked') ?
>><?php
$this->msg('recentchangeslinked-toolbox') ?
></a
></li
>
265 if(isset($this->data
['nav_urls']['trackbacklink'])) { ?
>
266 <li id
="t-trackbacklink"><a href
="<?php
267 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
268 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-trackbacklink') ?
>><?php
$this->msg('trackbacklink') ?
></a
></li
>
270 if($this->data
['feeds']) { ?
>
271 <li id
="feedlinks"><?php
foreach($this->data
['feeds'] as $key => $feed) {
272 ?
><a id
="<?php echo Sanitizer::escapeId( "feed
-$key" ) ?>" href
="<?php
273 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
> 
;
277 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
279 if($this->data
['nav_urls'][$special]) {
280 ?
><li id
="t-<?php echo $special ?>"><a href
="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
281 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-'.$special) ?
>><?php
$this->msg($special) ?
></a
></li
>
285 if(!empty($this->data
['nav_urls']['print']['href'])) { ?
>
286 <li id
="t-print"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
287 ?>" rel
="alternate"<?php
echo $this->skin
->tooltipAndAccesskey('t-print') ?
>><?php
$this->msg('printableversion') ?
></a
></li
><?php
290 if(!empty($this->data
['nav_urls']['permalink']['href'])) { ?
>
291 <li id
="t-permalink"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
292 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-permalink') ?
>><?php
$this->msg('permalink') ?
></a
></li
><?php
293 } elseif ($this->data
['nav_urls']['permalink']['href'] === '') { ?
>
294 <li id
="t-ispermalink"<?php
echo $this->skin
->tooltip('t-ispermalink') ?
>><?php
$this->msg('permalink') ?
></li
><?php
297 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
298 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
306 /*************************************************************************************************/
307 function languageBox() {
308 if( $this->data
['language_urls'] ) {
310 <div id
="p-lang" class="portlet">
311 <h5
<?php
$this->html('userlangattributes') ?
>><?php
$this->msg('otherlanguages') ?
></h5
>
314 <?php
foreach($this->data
['language_urls'] as $langlink) { ?
>
315 <li
class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
316 ?
><a href
="<?php echo htmlspecialchars($langlink['href']) ?>"><?php
echo $langlink['text'] ?
></a
></li
>
325 /*************************************************************************************************/
326 function customBox( $bar, $cont ) {
328 <div
class='generated-sidebar portlet' id
='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php
echo $this->skin
->tooltip('p-'.$bar) ?
>>
329 <h5
<?php
$this->html('userlangattributes') ?
>><?php
$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo htmlspecialchars($bar); else echo htmlspecialchars($out); ?
></h5
>
331 <?php
if ( is_array( $cont ) ) { ?
>
333 <?php
foreach($cont as $key => $val) { ?
>
334 <li id
="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
335 if ( $val['active'] ) { ?
> class="active" <?php
}
336 ?
>><a href
="<?php echo htmlspecialchars($val['href']) ?>"<?php
echo $this->skin
->tooltipAndAccesskey($val['id']) ?
>><?php
echo htmlspecialchars($val['text']) ?
></a
></li
>
340 # allow raw HTML block to be defined by extensions