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;
27 * @param $out OutputPage
29 function setupSkinUserCss( OutputPage
$out ) {
30 global $wgHandheldStyle;
31 parent
::setupSkinUserCss( $out );
33 $out->addModuleStyles( 'skins.monobook' );
35 // Ugh. Can't do this properly because $wgHandheldStyle may be a URL
36 if( $wgHandheldStyle ) {
37 // Currently in testing... try 'chick/main.css'
38 $out->addStyle( $wgHandheldStyle, 'handheld' );
41 // TODO: Migrate all of these
42 //$out->addStyle( 'monobook/IE50Fixes.css', 'screen', 'lt IE 5.5000' );
43 //$out->addStyle( 'monobook/IE55Fixes.css', 'screen', 'IE 5.5000' );
44 //$out->addStyle( 'monobook/IE60Fixes.css', 'screen', 'IE 6' );
45 //$out->addStyle( 'monobook/IE70Fixes.css', 'screen', 'IE 7' );
48 //$out->addStyle( 'monobook/rtl.css', 'screen', '', 'rtl' );
57 class MonoBookTemplate
extends BaseTemplate
{
65 * Template filter callback for MonoBook skin.
66 * Takes an associative array of data set from a SkinTemplate-based
67 * class, and a wrapper for MediaWiki's localization database, and
68 * outputs a formatted page.
73 $this->skin
= $this->data
['skin'];
75 // Suppress warnings to prevent notices about missing indexes in $this->data
78 $this->html( 'headelement' );
79 ?
><div id
="globalWrapper">
80 <div id
="column-content"><div id
="content">
82 <?php
if($this->data
['sitenotice']) { ?
><div id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
><?php
} ?
>
84 <h1 id
="firstHeading" class="firstHeading"><?php
$this->html('title') ?
></h1
>
85 <div id
="bodyContent">
86 <div id
="siteSub"><?php
$this->msg('tagline') ?
></div
>
87 <div id
="contentSub"<?php
$this->html('userlangattributes') ?
>><?php
$this->html('subtitle') ?
></div
>
88 <?php
if($this->data
['undelete']) { ?
>
89 <div id
="contentSub2"><?php
$this->html('undelete') ?
></div
>
90 <?php
} ?
><?php
if($this->data
['newtalk'] ) { ?
>
91 <div
class="usermessage"><?php
$this->html('newtalk') ?
></div
>
92 <?php
} ?
><?php
if($this->data
['showjumplinks']) { ?
>
93 <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
>
95 <!-- start content
-->
96 <?php
$this->html('bodytext') ?
>
97 <?php
if($this->data
['printfooter']) { ?
><div
class="printfooter"><?php
$this->html('printfooter'); ?
></div
><?php
} ?
>
98 <?php
$this->html('debughtml'); ?
>
99 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
101 <?php
if($this->data
['dataAfterContent']) { $this->html ('dataAfterContent'); } ?
>
102 <div
class="visualClear"></div
>
105 <div id
="column-one"<?php
$this->html('userlangattributes') ?
>>
106 <?php
$this->cactions(); ?
>
107 <div
class="portlet" id
="p-personal">
108 <h5
><?php
$this->msg('personaltools') ?
></h5
>
110 <ul
<?php
$this->html('userlangattributes') ?
>>
111 <?php
foreach($this->getPersonalTools() as $key => $item) { ?
>
112 <?php
echo $this->makeListItem($key, $item); ?
>
118 <div
class="portlet" id
="p-logo">
120 $logoAttribs = array() + Linker
::tooltipAndAccesskeyAttribs('p-logo');
121 $logoAttribs['style'] = "background-image: url({$this->data['logopath']});";
122 $logoAttribs['href'] = $this->data
['nav_urls']['mainpage']['href'];
123 echo Html
::element( 'a', $logoAttribs );
127 <script type
="<?php $this->text('jsmimetype') ?>"> if (window
.isMSIE55
) fixalpha(); </script
>
129 $this->renderPortals( $this->data
['sidebar'] );
131 </div
><!-- end of the
left (by
default at least
) column
-->
132 <div
class="visualClear"></div
>
134 $validFooterIcons = $this->getFooterIcons( "icononly" );
135 $validFooterLinks = $this->getFooterLinks( "flat" ); // Additional footer links
137 if ( count( $validFooterIcons ) +
count( $validFooterLinks ) > 0 ) { ?
>
138 <div id
="footer"<?php
$this->html('userlangattributes') ?
>>
140 $footerEnd = '</div>';
144 foreach ( $validFooterIcons as $blockName => $footerIcons ) { ?
>
145 <div id
="f-<?php echo htmlspecialchars($blockName); ?>ico">
146 <?php
foreach ( $footerIcons as $icon ) { ?
>
147 <?php
echo $this->skin
->makeFooterIcon( $icon ); ?
>
154 if ( count( $validFooterLinks ) > 0 ) {
157 foreach( $validFooterLinks as $aLink ) { ?
>
158 <li id
="<?php echo $aLink ?>"><?php
$this->html($aLink) ?
></li
>
170 echo Html
::closeElement( 'body' );
171 echo Html
::closeElement( 'html' );
173 } // end of execute() method
175 /*************************************************************************************************/
177 protected function renderPortals( $sidebar ) {
178 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
179 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
180 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
182 foreach( $sidebar as $boxName => $content ) {
183 if ( $content === false )
186 if ( $boxName == 'SEARCH' ) {
188 } elseif ( $boxName == 'TOOLBOX' ) {
190 } elseif ( $boxName == 'LANGUAGES' ) {
191 $this->languageBox();
193 $this->customBox( $boxName, $content );
198 function searchBox() {
199 global $wgUseTwoButtonsSearchForm;
201 <div id
="p-search" class="portlet">
202 <h5
><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
203 <div id
="searchBody" class="pBody">
204 <form action
="<?php $this->text('wgScript') ?>" id
="searchform">
205 <input type
='hidden' name
="title" value
="<?php $this->text('searchtitle') ?>"/>
206 <?php
echo $this->makeSearchInput(array( "id" => "searchInput" )); ?
>
208 <?php
echo $this->makeSearchButton("go", array( "id" => "searchGoButton", "class" => "searchButton" ));
209 if ($wgUseTwoButtonsSearchForm): ?
> 
210 <?php
echo $this->makeSearchButton("fulltext", array( "id" => "mw-searchButton", "class" => "searchButton" ));
213 <div
><a href
="<?php $this->text('searchaction') ?>" rel
="search"><?php
$this->msg('powersearch-legend') ?
></a
></div
><?php
223 * Prints the cactions bar.
224 * Shared between MonoBook and Modern
228 function cactions() {
230 <div id
="p-cactions" class="portlet">
231 <h5
><?php
$this->msg('views') ?
></h5
>
234 foreach($this->data
['content_actions'] as $key => $tab) {
235 $linkAttribs = array( 'href' => $tab['href'] );
237 if( isset( $tab["tooltiponly"] ) && $tab["tooltiponly"] ) {
238 $title = Linker
::titleAttrib( "ca-$key" );
239 if ( $title !== false ) {
240 $linkAttribs['title'] = $title;
243 $linkAttribs +
= Linker
::tooltipAndAccesskeyAttribs( "ca-$key" );
245 $linkHtml = Html
::element( 'a', $linkAttribs, $tab['text'] );
247 /* Surround with a <li> */
248 $liAttribs = array( 'id' => Sanitizer
::escapeId( "ca-$key" ) );
249 if( $tab['class'] ) {
250 $liAttribs['class'] = $tab['class'];
253 ' . Html
::rawElement( 'li', $liAttribs, $linkHtml );
261 /*************************************************************************************************/
264 <div
class="portlet" id
="p-tb">
265 <h5
><?php
$this->msg('toolbox') ?
></h5
>
269 foreach ( $this->getToolbox() as $key => $tbitem ) { ?
>
270 <?php
echo $this->makeListItem($key, $tbitem); ?
>
274 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
275 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
283 /*************************************************************************************************/
284 function languageBox() {
285 if( $this->data
['language_urls'] ) {
287 <div id
="p-lang" class="portlet">
288 <h5
<?php
$this->html('userlangattributes') ?
>><?php
$this->msg('otherlanguages') ?
></h5
>
291 <?php
foreach($this->data
['language_urls'] as $key => $langlink) { ?
>
292 <?php
echo $this->makeListItem($key, $langlink); ?
>
302 /*************************************************************************************************/
303 function customBox( $bar, $cont ) {
304 $portletAttribs = array( 'class' => 'generated-sidebar portlet', 'id' => Sanitizer
::escapeId( "p-$bar" ) );
305 $tooltip = Linker
::titleAttrib( "p-$bar" );
306 if ( $tooltip !== false ) {
307 $portletAttribs['title'] = $tooltip;
309 echo ' ' . Html
::openElement( 'div', $portletAttribs );
312 <h5
><?php
$msg = wfMessage( $bar ); echo htmlspecialchars( $msg->exists() ?
$msg->text() : $bar ); ?
></h5
>
314 <?php
if ( is_array( $cont ) ) { ?
>
316 <?php
foreach($cont as $key => $val) { ?
>
317 <?php
echo $this->makeListItem($key, $val); ?
>
322 # allow raw HTML block to be defined by extensions