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.
65 $this->skin
= $skin = $this->data
['skin'];
67 // Suppress warnings to prevent notices about missing indexes in $this->data
70 $this->html( 'headelement' );
71 ?
><div id
="globalWrapper">
72 <div id
="column-content"><div id
="content"<?php
$this->html("specialpageattributes") ?
>>
74 <?php
if($this->data
['sitenotice']) { ?
><div id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
><?php
} ?
>
76 <h1 id
="firstHeading" class="firstHeading"><?php
$this->html('title') ?
></h1
>
77 <div id
="bodyContent">
78 <div id
="siteSub"><?php
$this->msg('tagline') ?
></div
>
79 <div id
="contentSub"<?php
$this->html('userlangattributes') ?
>><?php
$this->html('subtitle') ?
></div
>
80 <?php
if($this->data
['undelete']) { ?
>
81 <div id
="contentSub2"><?php
$this->html('undelete') ?
></div
>
82 <?php
} ?
><?php
if($this->data
['newtalk'] ) { ?
>
83 <div
class="usermessage"><?php
$this->html('newtalk') ?
></div
>
84 <?php
} ?
><?php
if($this->data
['showjumplinks']) { ?
>
85 <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
>
87 <!-- start content
-->
88 <?php
$this->html('bodytext') ?
>
89 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
91 <?php
if($this->data
['dataAfterContent']) { $this->html ('dataAfterContent'); } ?
>
92 <div
class="visualClear"></div
>
95 <div id
="column-one"<?php
$this->html('userlangattributes') ?
>>
96 <?php
$this->cactions( $skin ); ?
>
97 <div
class="portlet" id
="p-personal">
98 <h5
><?php
$this->msg('personaltools') ?
></h5
>
100 <ul
<?php
$this->html('userlangattributes') ?
>>
101 <?php
foreach($this->getPersonalTools() as $key => $item) { ?
>
102 <?php
echo $this->makeListItem($key, $item); ?
>
108 <div
class="portlet" id
="p-logo">
110 $logoAttribs = array() +
$skin->tooltipAndAccesskeyAttribs('p-logo');
111 $logoAttribs['style'] = "background-image: url({$this->data['logopath']});";
112 $logoAttribs['href'] = $this->data
['nav_urls']['mainpage']['href'];
113 echo Html
::element( 'a', $logoAttribs );
117 <script type
="<?php $this->text('jsmimetype') ?>"> if (window
.isMSIE55
) fixalpha(); </script
>
119 $sidebar = $this->data
['sidebar'];
120 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
121 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
122 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
123 foreach ($sidebar as $boxName => $cont) {
124 if ( $boxName == 'SEARCH' ) {
126 } elseif ( $boxName == 'TOOLBOX' ) {
128 } elseif ( $boxName == 'LANGUAGES' ) {
129 $this->languageBox();
131 $this->customBox( $boxName, $cont );
135 </div
><!-- end of the
left (by
default at least
) column
-->
136 <div
class="visualClear"></div
>
137 <div id
="footer"<?php
$this->html('userlangattributes') ?
>>
138 <?php
foreach ( $this->getFooterIcons("icononly") as $blockName => $footerIcons ) { ?
>
139 <div id
="f-<?php echo htmlspecialchars($blockName); ?>ico">
140 <?php
foreach ( $footerIcons as $icon ) { ?
>
141 <?php
echo $this->skin
->makeFooterIcon( $icon ); ?
>
148 // Generate additional footer links
149 $validFooterLinks = $this->getFooterLinks("flat");
150 if ( count( $validFooterLinks ) > 0 ) {
153 foreach( $validFooterLinks as $aLink ) { ?
>
154 <li id
="<?php echo $aLink ?>"><?php
$this->html($aLink) ?
></li
>
166 echo Html
::closeElement( 'body' );
167 echo Html
::closeElement( 'html' );
169 } // end of execute() method
171 /*************************************************************************************************/
172 function searchBox() {
173 global $wgUseTwoButtonsSearchForm;
175 <div id
="p-search" class="portlet">
176 <h5
><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
177 <div id
="searchBody" class="pBody">
178 <form action
="<?php $this->text('wgScript') ?>" id
="searchform">
179 <input type
='hidden' name
="title" value
="<?php $this->text('searchtitle') ?>"/>
180 <?php
echo $this->makeSearchInput(array( "id" => "searchInput" )); ?
>
182 <?php
echo $this->makeSearchButton("go", array( "id" => "searchGoButton", "class" => "searchButton" ));
183 if ($wgUseTwoButtonsSearchForm): ?
> 
184 <?php
echo $this->makeSearchButton("fulltext", array( "id" => "mw-searchButton", "class" => "searchButton" ));
187 <div
><a href
="<?php $this->text('searchaction') ?>" rel
="search"><?php
$this->msg('powersearch-legend') ?
></a
></div
><?php
197 * Prints the cactions bar.
198 * Shared between MonoBook and Modern
200 function cactions( Skin
$skin ) {
202 <div id
="p-cactions" class="portlet">
203 <h5
><?php
$this->msg('views') ?
></h5
>
206 foreach($this->data
['content_actions'] as $key => $tab) {
207 $linkAttribs = array( 'href' => $tab['href'] );
209 if( isset( $tab["tooltiponly"] ) && $tab["tooltiponly"] ) {
210 $title = $skin->titleAttrib( "ca-$key" );
211 if ( $title !== false ) {
212 $linkAttribs['title'] = $title;
215 $linkAttribs +
= $skin->tooltipAndAccesskeyAttribs( "ca-$key" );
217 $linkHtml = Html
::element( 'a', $linkAttribs, $tab['text'] );
219 /* Surround with a <li> */
220 $liAttribs = array( 'id' => Sanitizer
::escapeId( "ca-$key" ) );
221 if( $tab['class'] ) {
222 $liAttribs['class'] = $tab['class'];
225 ' . Html
::rawElement( 'li', $liAttribs, $linkHtml );
233 /*************************************************************************************************/
236 <div
class="portlet" id
="p-tb">
237 <h5
><?php
$this->msg('toolbox') ?
></h5
>
241 foreach ( $this->getToolbox() as $key => $tbitem ) { ?
>
242 <?php
echo $this->makeListItem($key, $tbitem); ?
>
246 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
247 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
255 /*************************************************************************************************/
256 function languageBox() {
257 if( $this->data
['language_urls'] ) {
259 <div id
="p-lang" class="portlet">
260 <h5
<?php
$this->html('userlangattributes') ?
>><?php
$this->msg('otherlanguages') ?
></h5
>
263 <?php
foreach($this->data
['language_urls'] as $key => $langlink) { ?
>
264 <?php
echo $this->makeListItem($key, $langlink); ?
>
274 /*************************************************************************************************/
275 function customBox( $bar, $cont ) {
276 $portletAttribs = array( 'class' => 'generated-sidebar portlet', 'id' => Sanitizer
::escapeId( "p-$bar" ) );
277 $tooltip = $this->skin
->titleAttrib( "p-$bar" );
278 if ( $tooltip !== false ) {
279 $portletAttribs['title'] = $tooltip;
281 echo ' ' . Html
::openElement( 'div', $portletAttribs );
284 <h5
><?php
$out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo htmlspecialchars($bar); else echo htmlspecialchars($out); ?
></h5
>
286 <?php
if ( is_array( $cont ) ) { ?
>
288 <?php
foreach($cont as $key => $val) { ?
>
289 <?php
echo $this->makeListItem($key, $val); ?
>
294 # allow raw HTML block to be defined by extensions