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;
28 parent
::setupSkinUserCss( $out );
30 $out->addModuleStyles( 'skins.monobook' );
32 // Ugh. Can't do this properly because $wgHandheldStyle may be a URL
33 if( $wgHandheldStyle ) {
34 // Currently in testing... try 'chick/main.css'
35 $out->addStyle( $wgHandheldStyle, 'handheld' );
38 // TODO: Migrate all of these
39 //$out->addStyle( 'monobook/IE50Fixes.css', 'screen', 'lt IE 5.5000' );
40 //$out->addStyle( 'monobook/IE55Fixes.css', 'screen', 'IE 5.5000' );
41 //$out->addStyle( 'monobook/IE60Fixes.css', 'screen', 'IE 6' );
42 //$out->addStyle( 'monobook/IE70Fixes.css', 'screen', 'IE 7' );
45 //$out->addStyle( 'monobook/rtl.css', 'screen', '', 'rtl' );
54 class MonoBookTemplate
extends BaseTemplate
{
57 * Template filter callback for MonoBook skin.
58 * Takes an associative array of data set from a SkinTemplate-based
59 * class, and a wrapper for MediaWiki's localization database, and
60 * outputs a formatted page.
67 $this->skin
= $skin = $this->data
['skin'];
68 $action = $wgRequest->getText( 'action' );
70 // Suppress warnings to prevent notices about missing indexes in $this->data
73 $this->html( 'headelement' );
74 ?
><div id
="globalWrapper">
75 <div id
="column-content"><div id
="content"<?php
$this->html("specialpageattributes") ?
>>
77 <?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 <div id
="siteSub"><?php
$this->msg('tagline') ?
></div
>
82 <div id
="contentSub"<?php
$this->html('userlangattributes') ?
>><?php
$this->html('subtitle') ?
></div
>
83 <?php
if($this->data
['undelete']) { ?
>
84 <div id
="contentSub2"><?php
$this->html('undelete') ?
></div
>
85 <?php
} ?
><?php
if($this->data
['newtalk'] ) { ?
>
86 <div
class="usermessage"><?php
$this->html('newtalk') ?
></div
>
87 <?php
} ?
><?php
if($this->data
['showjumplinks']) { ?
>
88 <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
>
90 <!-- start content
-->
91 <?php
$this->html('bodytext') ?
>
92 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
94 <?php
if($this->data
['dataAfterContent']) { $this->html ('dataAfterContent'); } ?
>
95 <div
class="visualClear"></div
>
98 <div id
="column-one"<?php
$this->html('userlangattributes') ?
>>
99 <div id
="p-cactions" class="portlet">
100 <h5
><?php
$this->msg('views') ?
></h5
>
103 foreach($this->data
['content_actions'] as $key => $tab) {
105 <li id="' . Sanitizer
::escapeId( "ca-$key" ) . '"';
106 if( $tab['class'] ) {
107 echo ' class="'.htmlspecialchars($tab['class']).'"';
109 echo '><a href="'.htmlspecialchars($tab['href']).'"';
110 if( $tab["tooltiponly"] ) {
111 echo $skin->tooltip( "ca-$key" );
113 echo $skin->tooltipAndAccesskey( "ca-$key" );
115 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
121 <div
class="portlet" id
="p-personal">
122 <h5
><?php
$this->msg('personaltools') ?
></h5
>
124 <ul
<?php
$this->html('userlangattributes') ?
>>
125 <?php
foreach($this->getPersonalTools() as $key => $item) { ?
>
126 <?php
echo $this->makeListItem($key, $item); ?
>
132 <div
class="portlet" id
="p-logo">
133 <a style
="background-image: url(<?php $this->text('logopath') ?>);" <?php
134 ?
>href
="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php
135 echo $skin->tooltipAndAccesskey('p-logo') ?
>></a
>
137 <script type
="<?php $this->text('jsmimetype') ?>"> if (window
.isMSIE55
) fixalpha(); </script
>
139 $sidebar = $this->data
['sidebar'];
140 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
141 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
142 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
143 foreach ($sidebar as $boxName => $cont) {
144 if ( $boxName == 'SEARCH' ) {
146 } elseif ( $boxName == 'TOOLBOX' ) {
148 } elseif ( $boxName == 'LANGUAGES' ) {
149 $this->languageBox();
151 $this->customBox( $boxName, $cont );
155 </div
><!-- end of the
left (by
default at least
) column
-->
156 <div
class="visualClear"></div
>
157 <div id
="footer"<?php
$this->html('userlangattributes') ?
>>
158 <?php
foreach ( $this->getFooterIcons("icononly") as $blockName => $footerIcons ) { ?
>
159 <div id
="f-<?php echo htmlspecialchars($blockName); ?>ico">
160 <?php
foreach ( $footerIcons as $icon ) { ?
>
161 <?php
echo $this->skin
->makeFooterIcon( $icon ); ?
>
168 // Generate additional footer links
169 $validFooterLinks = $this->getFooterLinks("flat");
170 if ( count( $validFooterLinks ) > 0 ) {
173 foreach( $validFooterLinks as $aLink ) { ?
>
174 <li id
="<?php echo $aLink ?>"><?php
$this->html($aLink) ?
></li
>
186 echo Html
::closeElement( 'body' );
187 echo Html
::closeElement( 'html' );
189 } // end of execute() method
191 /*************************************************************************************************/
192 function searchBox() {
193 global $wgUseTwoButtonsSearchForm;
195 <div id
="p-search" class="portlet">
196 <h5
><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
197 <div id
="searchBody" class="pBody">
198 <form action
="<?php $this->text('wgScript') ?>" id
="searchform">
199 <input type
='hidden' name
="title" value
="<?php $this->text('searchtitle') ?>"/>
200 <?php
echo $this->makeSearchInput(array( "id" => "searchInput" )); ?
>
202 <?php
echo $this->makeSearchButton("go", array( "id" => "searchGoButton", "class" => "searchButton" ));
203 if ($wgUseTwoButtonsSearchForm): ?
> 
204 <?php
echo $this->makeSearchButton("fulltext", array( "id" => "mw-searchButton", "class" => "searchButton" ));
207 <div
><a href
="<?php $this->text('searchaction') ?>" rel
="search"><?php
$this->msg('powersearch-legend') ?
></a
></div
><?php
216 /*************************************************************************************************/
219 <div
class="portlet" id
="p-tb">
220 <h5
><?php
$this->msg('toolbox') ?
></h5
>
224 foreach ( $this->getToolbox() as $key => $tbitem ) { ?
>
225 <?php
echo $this->makeListItem($key, $tbitem); ?
>
229 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
230 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
238 /*************************************************************************************************/
239 function languageBox() {
240 if( $this->data
['language_urls'] ) {
242 <div id
="p-lang" class="portlet">
243 <h5
<?php
$this->html('userlangattributes') ?
>><?php
$this->msg('otherlanguages') ?
></h5
>
246 <?php
foreach($this->data
['language_urls'] as $key => $langlink) { ?
>
247 <?php
echo $this->makeListItem($key, $langlink); ?
>
257 /*************************************************************************************************/
258 function customBox( $bar, $cont ) {
260 <div
class='generated-sidebar portlet' id
='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php
echo $this->skin
->tooltip('p-'.$bar) ?
>>
261 <h5
><?php
$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo htmlspecialchars($bar); else echo htmlspecialchars($out); ?
></h5
>
263 <?php
if ( is_array( $cont ) ) { ?
>
265 <?php
foreach($cont as $key => $val) { ?
>
266 <?php
echo $this->makeListItem($key, $val); ?
>
271 # allow raw HTML block to be defined by extensions