1e7988c77242a56a9585a9ea399b6b0566f1fbe0
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' );
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 // Suppress warnings to prevent notices about missing indexes in $this->data
68 $this->html( 'headelement' );
69 ?
><div id
="globalWrapper">
70 <div id
="column-content"><div id
="content">
72 <?php
if($this->data
['sitenotice']) { ?
><div id
="siteNotice"><?php
$this->html('sitenotice') ?
></div
><?php
} ?
>
74 <h1 id
="firstHeading" class="firstHeading"><?php
$this->html('title') ?
></h1
>
75 <div id
="bodyContent" class="mw-body">
76 <div id
="siteSub"><?php
$this->msg('tagline') ?
></div
>
77 <div id
="contentSub"<?php
$this->html('userlangattributes') ?
>><?php
$this->html('subtitle') ?
></div
>
78 <?php
if($this->data
['undelete']) { ?
>
79 <div id
="contentSub2"><?php
$this->html('undelete') ?
></div
>
80 <?php
} ?
><?php
if($this->data
['newtalk'] ) { ?
>
81 <div
class="usermessage"><?php
$this->html('newtalk') ?
></div
>
82 <?php
} ?
><?php
if($this->data
['showjumplinks']) { ?
>
83 <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
>
85 <!-- start content
-->
86 <?php
$this->html('bodytext') ?
>
87 <?php
if($this->data
['catlinks']) { $this->html('catlinks'); } ?
>
89 <?php
if($this->data
['dataAfterContent']) { $this->html ('dataAfterContent'); } ?
>
90 <div
class="visualClear"></div
>
93 <div id
="column-one"<?php
$this->html('userlangattributes') ?
>>
94 <?php
$this->cactions(); ?
>
95 <div
class="portlet" id
="p-personal">
96 <h5
><?php
$this->msg('personaltools') ?
></h5
>
98 <ul
<?php
$this->html('userlangattributes') ?
>>
99 <?php
foreach($this->getPersonalTools() as $key => $item) { ?
>
100 <?php
echo $this->makeListItem($key, $item); ?
>
106 <div
class="portlet" id
="p-logo">
108 echo Html
::element( 'a', array(
109 'href' => $this->data
['nav_urls']['mainpage']['href'],
110 'style' => "background-image: url({$this->data['logopath']});" )
111 + Linker
::tooltipAndAccesskeyAttribs('p-logo') ); ?
>
114 <script type
="<?php $this->text('jsmimetype') ?>"> if (window
.isMSIE55
) fixalpha(); </script
>
116 $this->renderPortals( $this->data
['sidebar'] );
118 </div
><!-- end of the
left (by
default at least
) column
-->
119 <div
class="visualClear"></div
>
121 $validFooterIcons = $this->getFooterIcons( "icononly" );
122 $validFooterLinks = $this->getFooterLinks( "flat" ); // Additional footer links
124 if ( count( $validFooterIcons ) +
count( $validFooterLinks ) > 0 ) { ?
>
125 <div id
="footer"<?php
$this->html('userlangattributes') ?
>>
127 $footerEnd = '</div>';
131 foreach ( $validFooterIcons as $blockName => $footerIcons ) { ?
>
132 <div id
="f-<?php echo htmlspecialchars($blockName); ?>ico">
133 <?php
foreach ( $footerIcons as $icon ) { ?
>
134 <?php
echo $this->getSkin()->makeFooterIcon( $icon ); ?
>
141 if ( count( $validFooterLinks ) > 0 ) {
144 foreach( $validFooterLinks as $aLink ) { ?
>
145 <li id
="<?php echo $aLink ?>"><?php
$this->html($aLink) ?
></li
>
157 echo Html
::closeElement( 'body' );
158 echo Html
::closeElement( 'html' );
160 } // end of execute() method
162 /*************************************************************************************************/
164 protected function renderPortals( $sidebar ) {
165 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
166 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
167 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
169 foreach( $sidebar as $boxName => $content ) {
170 if ( $content === false )
173 if ( $boxName == 'SEARCH' ) {
175 } elseif ( $boxName == 'TOOLBOX' ) {
177 } elseif ( $boxName == 'LANGUAGES' ) {
178 $this->languageBox();
180 $this->customBox( $boxName, $content );
185 function searchBox() {
186 global $wgUseTwoButtonsSearchForm;
188 <div id
="p-search" class="portlet">
189 <h5
><label
for="searchInput"><?php
$this->msg('search') ?
></label
></h5
>
190 <div id
="searchBody" class="pBody">
191 <form action
="<?php $this->text('wgScript') ?>" id
="searchform">
192 <input type
='hidden' name
="title" value
="<?php $this->text('searchtitle') ?>"/>
193 <?php
echo $this->makeSearchInput(array( "id" => "searchInput" )); ?
>
195 <?php
echo $this->makeSearchButton("go", array( "id" => "searchGoButton", "class" => "searchButton" ));
196 if ($wgUseTwoButtonsSearchForm): ?
> 
197 <?php
echo $this->makeSearchButton("fulltext", array( "id" => "mw-searchButton", "class" => "searchButton" ));
200 <div
><a href
="<?php $this->text('searchaction') ?>" rel
="search"><?php
$this->msg('powersearch-legend') ?
></a
></div
><?php
210 * Prints the cactions bar.
211 * Shared between MonoBook and Modern
215 function cactions() {
217 <div id
="p-cactions" class="portlet">
218 <h5
><?php
$this->msg('views') ?
></h5
>
221 foreach($this->data
['content_actions'] as $key => $tab) {
223 ' . $this->makeListItem( $key, $tab );
231 /*************************************************************************************************/
234 <div
class="portlet" id
="p-tb">
235 <h5
><?php
$this->msg('toolbox') ?
></h5
>
239 foreach ( $this->getToolbox() as $key => $tbitem ) { ?
>
240 <?php
echo $this->makeListItem($key, $tbitem); ?
>
244 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
245 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
253 /*************************************************************************************************/
254 function languageBox() {
255 if( $this->data
['language_urls'] ) {
257 <div id
="p-lang" class="portlet">
258 <h5
<?php
$this->html('userlangattributes') ?
>><?php
$this->msg('otherlanguages') ?
></h5
>
261 <?php
foreach($this->data
['language_urls'] as $key => $langlink) { ?
>
262 <?php
echo $this->makeListItem($key, $langlink); ?
>
272 /*************************************************************************************************/
273 function customBox( $bar, $cont ) {
274 $portletAttribs = array( 'class' => 'generated-sidebar portlet', 'id' => Sanitizer
::escapeId( "p-$bar" ) );
275 $tooltip = Linker
::titleAttrib( "p-$bar" );
276 if ( $tooltip !== false ) {
277 $portletAttribs['title'] = $tooltip;
279 echo ' ' . Html
::openElement( 'div', $portletAttribs );
282 <h5
><?php
$msg = wfMessage( $bar ); echo htmlspecialchars( $msg->exists() ?
$msg->text() : $bar ); ?
></h5
>
284 <?php
if ( is_array( $cont ) ) { ?
>
286 <?php
foreach($cont as $key => $val) { ?
>
287 <?php
echo $this->makeListItem($key, $val); ?
>
292 # allow raw HTML block to be defined by extensions