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'];
69 // Suppress warnings to prevent notices about missing indexes in $this->data
72 $this->html( 'headelement' );
73 ?
><div id
="globalWrapper">
74 <div id
="column-content"><div id
="content"<?php
$this->html("specialpageattributes") ?
>>
76 <?php
if($this->data
['sitenotice']) { ?
><div id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
><?php
} ?
>
78 <h1 id
="firstHeading" class="firstHeading"><?php
$this->html('title') ?
></h1
>
79 <div id
="bodyContent">
80 <div id
="siteSub"><?php
$this->msg('tagline') ?
></div
>
81 <div id
="contentSub"<?php
$this->html('userlangattributes') ?
>><?php
$this->html('subtitle') ?
></div
>
82 <?php
if($this->data
['undelete']) { ?
>
83 <div id
="contentSub2"><?php
$this->html('undelete') ?
></div
>
84 <?php
} ?
><?php
if($this->data
['newtalk'] ) { ?
>
85 <div
class="usermessage"><?php
$this->html('newtalk') ?
></div
>
86 <?php
} ?
><?php
if($this->data
['showjumplinks']) { ?
>
87 <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
>
89 <!-- start content
-->
90 <?php
$this->html('bodytext') ?
>
91 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
93 <?php
if($this->data
['dataAfterContent']) { $this->html ('dataAfterContent'); } ?
>
94 <div
class="visualClear"></div
>
97 <div id
="column-one"<?php
$this->html('userlangattributes') ?
>>
98 <?php
$this->cactions( $skin ); ?
>
99 <div
class="portlet" id
="p-personal">
100 <h5
><?php
$this->msg('personaltools') ?
></h5
>
102 <ul
<?php
$this->html('userlangattributes') ?
>>
103 <?php
foreach($this->getPersonalTools() as $key => $item) { ?
>
104 <?php
echo $this->makeListItem($key, $item); ?
>
110 <div
class="portlet" id
="p-logo">
112 $logoAttribs = array() +
$skin->tooltipAndAccesskeyAttribs('p-logo');
113 $logoAttribs['style'] = "background-image: url({$this->data['logopath']});";
114 $logoAttribs['href'] = $this->data
['nav_urls']['mainpage']['href'];
115 echo Html
::element( 'a', $logoAttribs );
119 <script type
="<?php $this->text('jsmimetype') ?>"> if (window
.isMSIE55
) fixalpha(); </script
>
121 $sidebar = $this->data
['sidebar'];
122 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
123 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
124 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
125 foreach ($sidebar as $boxName => $cont) {
126 if ( $boxName == 'SEARCH' ) {
128 } elseif ( $boxName == 'TOOLBOX' ) {
130 } elseif ( $boxName == 'LANGUAGES' ) {
131 $this->languageBox();
133 $this->customBox( $boxName, $cont );
137 </div
><!-- end of the
left (by
default at least
) column
-->
138 <div
class="visualClear"></div
>
139 <div id
="footer"<?php
$this->html('userlangattributes') ?
>>
140 <?php
foreach ( $this->getFooterIcons("icononly") as $blockName => $footerIcons ) { ?
>
141 <div id
="f-<?php echo htmlspecialchars($blockName); ?>ico">
142 <?php
foreach ( $footerIcons as $icon ) { ?
>
143 <?php
echo $this->skin
->makeFooterIcon( $icon ); ?
>
150 // Generate additional footer links
151 $validFooterLinks = $this->getFooterLinks("flat");
152 if ( count( $validFooterLinks ) > 0 ) {
155 foreach( $validFooterLinks as $aLink ) { ?
>
156 <li id
="<?php echo $aLink ?>"><?php
$this->html($aLink) ?
></li
>
168 echo Html
::closeElement( 'body' );
169 echo Html
::closeElement( 'html' );
171 } // end of execute() method
173 /*************************************************************************************************/
174 function searchBox() {
175 global $wgUseTwoButtonsSearchForm;
177 <div id
="p-search" class="portlet">
178 <h5
><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
179 <div id
="searchBody" class="pBody">
180 <form action
="<?php $this->text('wgScript') ?>" id
="searchform">
181 <input type
='hidden' name
="title" value
="<?php $this->text('searchtitle') ?>"/>
182 <?php
echo $this->makeSearchInput(array( "id" => "searchInput" )); ?
>
184 <?php
echo $this->makeSearchButton("go", array( "id" => "searchGoButton", "class" => "searchButton" ));
185 if ($wgUseTwoButtonsSearchForm): ?
> 
186 <?php
echo $this->makeSearchButton("fulltext", array( "id" => "mw-searchButton", "class" => "searchButton" ));
189 <div
><a href
="<?php $this->text('searchaction') ?>" rel
="search"><?php
$this->msg('powersearch-legend') ?
></a
></div
><?php
199 * Prints the cactions bar.
200 * Shared between MonoBook and Modern
202 function cactions( Skin
$skin ) {
204 <div id
="p-cactions" class="portlet">
205 <h5
><?php
$this->msg('views') ?
></h5
>
208 foreach($this->data
['content_actions'] as $key => $tab) {
209 $linkAttribs = array( 'href' => $tab['href'] );
211 if( isset( $tab["tooltiponly"] ) && $tab["tooltiponly"] ) {
212 $title = $skin->titleAttrib( "ca-$key" );
213 if ( $title !== false ) {
214 $linkAttribs['title'] = $title;
217 $linkAttribs +
= $skin->tooltipAndAccesskeyAttribs( "ca-$key" );
219 $linkHtml = Html
::element( 'a', $linkAttribs, $tab['text'] );
221 /* Surround with a <li> */
222 $liAttribs = array( 'id' => Sanitizer
::escapeId( "ca-$key" ) );
223 if( $tab['class'] ) {
224 $liAttribs['class'] = $tab['class'];
227 ' . Html
::rawElement( 'li', $liAttribs, $linkHtml );
235 /*************************************************************************************************/
238 <div
class="portlet" id
="p-tb">
239 <h5
><?php
$this->msg('toolbox') ?
></h5
>
243 foreach ( $this->getToolbox() as $key => $tbitem ) { ?
>
244 <?php
echo $this->makeListItem($key, $tbitem); ?
>
248 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
249 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
257 /*************************************************************************************************/
258 function languageBox() {
259 if( $this->data
['language_urls'] ) {
261 <div id
="p-lang" class="portlet">
262 <h5
<?php
$this->html('userlangattributes') ?
>><?php
$this->msg('otherlanguages') ?
></h5
>
265 <?php
foreach($this->data
['language_urls'] as $key => $langlink) { ?
>
266 <?php
echo $this->makeListItem($key, $langlink); ?
>
276 /*************************************************************************************************/
277 function customBox( $bar, $cont ) {
278 $portletAttribs = array( 'class' => 'generated-sidebar portlet', 'id' => Sanitizer
::escapeId( "p-$bar" ) );
279 $tooltip = $this->skin
->titleAttrib( "p-$bar" );
280 if ( $tooltip !== false ) {
281 $portletAttribs['title'] = $tooltip;
283 echo ' ' . Html
::openElement( 'div', $portletAttribs );
286 <h5
><?php
$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo htmlspecialchars($bar); else echo htmlspecialchars($out); ?
></h5
>
288 <?php
if ( is_array( $cont ) ) { ?
>
290 <?php
foreach($cont as $key => $val) { ?
>
291 <?php
echo $this->makeListItem($key, $val); ?
>
296 # allow raw HTML block to be defined by extensions