da5517d45cb4555727fef92b900582c3adeb3ce1
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 var $skinname = 'monobook', $stylename = 'monobook',
24 $template = 'MonoBookTemplate', $useHeadElement = true;
26 function setupSkinUserCss( OutputPage
$out ) {
27 global $wgHandheldStyle, $wgStyleVersion, $wgJsMimeType, $wgStylePath;
29 parent
::setupSkinUserCss( $out );
31 // Append to the default screen common & print styles...
32 $out->addStyle( 'monobook/main.css', 'screen' );
33 if( $wgHandheldStyle ) {
34 // Currently in testing... try 'chick/main.css'
35 $out->addStyle( $wgHandheldStyle, 'handheld' );
38 $out->addStyle( 'monobook/IE50Fixes.css', 'screen', 'lt IE 5.5000' );
39 $out->addStyle( 'monobook/IE55Fixes.css', 'screen', 'IE 5.5000' );
40 $out->addStyle( 'monobook/IE60Fixes.css', 'screen', 'IE 6' );
41 $out->addStyle( 'monobook/IE70Fixes.css', 'screen', 'IE 7' );
43 $out->addStyle( 'monobook/rtl.css', 'screen', '', 'rtl' );
52 class MonoBookTemplate
extends QuickTemplate
{
55 * Template filter callback for MonoBook skin.
56 * Takes an associative array of data set from a SkinTemplate-based
57 * class, and a wrapper for MediaWiki's localization database, and
58 * outputs a formatted page.
65 $this->skin
= $skin = $this->data
['skin'];
66 $action = $wgRequest->getText( 'action' );
68 // Suppress warnings to prevent notices about missing indexes in $this->data
71 $this->html( 'headelement' );
72 ?
><body
<?php
if($this->data
['body_ondblclick']) { ?
> ondblclick
="<?php $this->text('body_ondblclick') ?>"<?php
} ?
>
73 class="mediawiki <?php $this->text('dir'); $this->text('capitalizeallnouns') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
74 <div id
="globalWrapper">
75 <div id
="column-content">
76 <div id
="content" <?php
$this->html("specialpageattributes") ?
>>
78 <?php
if($this->data
['sitenotice']) { ?
><div id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
><?php
} ?
>
79 <h1 id
="firstHeading" class="firstHeading"><?php
$this->html('title') ?
></h1
>
80 <div id
="bodyContent">
81 <h3 id
="siteSub"><?php
$this->msg('tagline') ?
></h3
>
82 <div id
="contentSub" <?php
$this->html('userlangattributes') ?
>><?php
$this->html('subtitle') ?
></div
>
83 <?php
if($this->data
['undelete']) { ?
><div id
="contentSub2"><?php
$this->html('undelete') ?
></div
><?php
} ?
>
84 <?php
if($this->data
['newtalk'] ) { ?
><div
class="usermessage"><?php
$this->html('newtalk') ?
></div
><?php
} ?
>
85 <?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
} ?
>
86 <!-- start content
-->
87 <?php
$this->html('bodytext') ?
>
88 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
90 <?php
if($this->data
['dataAfterContent']) { $this->html ('dataAfterContent'); } ?
>
91 <div
class="visualClear"></div
>
95 <div id
="column-one" <?php
$this->html('userlangattributes') ?
>>
96 <div id
="p-cactions" class="portlet">
97 <h5
><?php
$this->msg('views') ?
></h5
>
100 <?php
foreach($this->data
['content_actions'] as $key => $tab) {
102 <li id="' . Sanitizer
::escapeId( "ca-$key" ) . '"';
103 if( $tab['class'] ) {
104 echo ' class="'.htmlspecialchars($tab['class']).'"';
106 echo '><a href="'.htmlspecialchars($tab['href']).'"';
107 # We don't want to give the watch tab an accesskey if the
108 # page is being edited, because that conflicts with the
109 # accesskey on the watch checkbox. We also don't want to
110 # give the edit tab an accesskey, because that's fairly su-
111 # perfluous and conflicts with an accesskey (Ctrl-E) often
112 # used for editing in Safari.
113 if( in_array( $action, array( 'edit', 'submit' ) )
114 && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
115 echo $skin->tooltip( "ca-$key" );
117 echo $skin->tooltipAndAccesskey( "ca-$key" );
119 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
124 <div
class="portlet" id
="p-personal">
125 <h5
><?php
$this->msg('personaltools') ?
></h5
>
127 <ul
<?php
$this->html('userlangattributes') ?
>>
128 <?php
foreach($this->data
['personal_urls'] as $key => $item) { ?
>
129 <li id
="<?php echo Sanitizer::escapeId( "pt
-$key" ) ?>"<?php
130 if ($item['active']) { ?
> class="active"<?php
} ?
>><a href
="<?php
131 echo htmlspecialchars($item['href']) ?>"<?php
echo $skin->tooltipAndAccesskey('pt-'.$key) ?
><?php
132 if(!empty($item['class'])) { ?
> class="<?php
133 echo htmlspecialchars($item['class']) ?>"<?php
} ?
>><?php
134 echo htmlspecialchars($item['text']) ?
></a
></li
>
139 <div
class="portlet" id
="p-logo">
140 <a style
="background-image: url(<?php $this->text('logopath') ?>);" <?php
141 ?
>href
="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php
142 echo $skin->tooltipAndAccesskey('p-logo') ?
>></a
>
144 <script type
="<?php $this->text('jsmimetype') ?>"> if (window
.isMSIE55
) fixalpha(); </script
>
146 $sidebar = $this->data
['sidebar'];
147 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
148 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
149 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
150 foreach ($sidebar as $boxName => $cont) {
151 if ( $boxName == 'SEARCH' ) {
153 } elseif ( $boxName == 'TOOLBOX' ) {
155 } elseif ( $boxName == 'LANGUAGES' ) {
156 $this->languageBox();
158 $this->customBox( $boxName, $cont );
162 </div
><!-- end of the
left (by
default at least
) column
-->
163 <div
class="visualClear"></div
>
164 <div id
="footer" <?php
$this->html('userlangattributes') ?
>>
166 if($this->data
['poweredbyico']) { ?
>
167 <div id
="f-poweredbyico"><?php
$this->html('poweredbyico') ?
></div
>
169 if($this->data
['copyrightico']) { ?
>
170 <div id
="f-copyrightico"><?php
$this->html('copyrightico') ?
></div
>
173 // Generate additional footer links
174 $footerlinks = array(
175 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
176 'privacy', 'about', 'disclaimer', 'tagline',
178 $validFooterLinks = array();
179 foreach( $footerlinks as $aLink ) {
180 if( isset( $this->data
[$aLink] ) && $this->data
[$aLink] ) {
181 $validFooterLinks[] = $aLink;
184 if ( count( $validFooterLinks ) > 0 ) {
187 foreach( $validFooterLinks as $aLink ) {
188 if( isset( $this->data
[$aLink] ) && $this->data
[$aLink] ) {
189 ?
> <li id
="<?php echo $aLink ?>"><?php
$this->html($aLink) ?
></li
>
198 <?php
$this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?
>
199 <?php
$this->html('reporttime') ?
>
200 <?php
if ( $this->data
['debug'] ): ?
>
202 <?php
$this->text( 'debug' ); ?
>
209 } // end of execute() method
211 /*************************************************************************************************/
212 function searchBox() {
213 global $wgUseTwoButtonsSearchForm;
215 <div id
="p-search" class="portlet">
216 <h5
><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
217 <div id
="searchBody" class="pBody">
218 <form action
="<?php $this->text('wgScript') ?>" id
="searchform">
219 <input type
='hidden' name
="title" value
="<?php $this->text('searchtitle') ?>"/>
221 echo Html
::input( 'search',
222 isset( $this->data
['search'] ) ?
$this->data
['search'] : '', 'search',
224 'id' => 'searchInput',
225 'title' => $this->skin
->titleAttrib( 'search' ),
226 'accesskey' => $this->skin
->accesskey( 'search' )
229 <input type
='submit' name
="go" class="searchButton" id
="searchGoButton" value
="<?php $this->msg('searcharticle') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-go' ); ?
> /><?php
if ($wgUseTwoButtonsSearchForm) { ?
> 
;
230 <input type
='submit' name
="fulltext" class="searchButton" id
="mw-searchButton" value
="<?php $this->msg('searchbutton') ?>"<?php
echo $this->skin
->tooltipAndAccesskey( 'search-fulltext' ); ?
> /><?php
} else { ?
>
232 <div
><a href
="<?php $this->text('searchaction') ?>" rel
="search"><?php
$this->msg('powersearch-legend') ?
></a
></div
><?php
} ?
>
240 /*************************************************************************************************/
243 <div
class="portlet" id
="p-tb">
244 <h5
><?php
$this->msg('toolbox') ?
></h5
>
248 if($this->data
['notspecialpage']) { ?
>
249 <li id
="t-whatlinkshere"><a href
="<?php
250 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
251 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-whatlinkshere') ?
>><?php
$this->msg('whatlinkshere') ?
></a
></li
>
253 if( $this->data
['nav_urls']['recentchangeslinked'] ) { ?
>
254 <li id
="t-recentchangeslinked"><a href
="<?php
255 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
256 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-recentchangeslinked') ?
>><?php
$this->msg('recentchangeslinked-toolbox') ?
></a
></li
>
259 if( isset( $this->data
['nav_urls']['trackbacklink'] ) && $this->data
['nav_urls']['trackbacklink'] ) { ?
>
260 <li id
="t-trackbacklink"><a href
="<?php
261 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
262 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-trackbacklink') ?
>><?php
$this->msg('trackbacklink') ?
></a
></li
>
264 if($this->data
['feeds']) { ?
>
265 <li id
="feedlinks"><?php
foreach($this->data
['feeds'] as $key => $feed) {
266 ?
><a id
="<?php echo Sanitizer::escapeId( "feed
-$key" ) ?>" href
="<?php
267 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
> 
;
271 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
273 if($this->data
['nav_urls'][$special]) {
274 ?
><li id
="t-<?php echo $special ?>"><a href
="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
275 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-'.$special) ?
>><?php
$this->msg($special) ?
></a
></li
>
279 if(!empty($this->data
['nav_urls']['print']['href'])) { ?
>
280 <li id
="t-print"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
281 ?>" rel
="alternate"<?php
echo $this->skin
->tooltipAndAccesskey('t-print') ?
>><?php
$this->msg('printableversion') ?
></a
></li
><?php
284 if(!empty($this->data
['nav_urls']['permalink']['href'])) { ?
>
285 <li id
="t-permalink"><a href
="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
286 ?>"<?php
echo $this->skin
->tooltipAndAccesskey('t-permalink') ?
>><?php
$this->msg('permalink') ?
></a
></li
><?php
287 } elseif ($this->data
['nav_urls']['permalink']['href'] === '') { ?
>
288 <li id
="t-ispermalink"<?php
echo $this->skin
->tooltip('t-ispermalink') ?
>><?php
$this->msg('permalink') ?
></li
><?php
291 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
292 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
300 /*************************************************************************************************/
301 function languageBox() {
302 if( $this->data
['language_urls'] ) {
304 <div id
="p-lang" class="portlet">
305 <h5
<?php
$this->html('userlangattributes') ?
>><?php
$this->msg('otherlanguages') ?
></h5
>
308 <?php
foreach($this->data
['language_urls'] as $langlink) { ?
>
309 <li
class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
310 ?
><a href
="<?php echo htmlspecialchars($langlink['href']) ?>"><?php
echo $langlink['text'] ?
></a
></li
>
319 /*************************************************************************************************/
320 function customBox( $bar, $cont ) {
322 <div
class='generated-sidebar portlet' id
='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php
echo $this->skin
->tooltip('p-'.$bar) ?
>>
323 <h5
><?php
$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo htmlspecialchars($bar); else echo htmlspecialchars($out); ?
></h5
>
325 <?php
if ( is_array( $cont ) ) { ?
>
327 <?php
foreach($cont as $key => $val) { ?
>
328 <li id
="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
329 if ( $val['active'] ) { ?
> class="active" <?php
}
330 ?
>><a href
="<?php echo htmlspecialchars($val['href']) ?>"<?php
echo $this->skin
->tooltipAndAccesskey($val['id']) ?
>><?php
echo htmlspecialchars($val['text']) ?
></a
></li
>
334 # allow raw HTML block to be defined by extensions