aeef8a9905f605a0adf1060b4a5b33e34b0dd819
5 * Translated from gwicke's previous TAL template version to remove
6 * dependency on PHPTAL.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * http://www.gnu.org/copyleft/gpl.html
28 if ( !defined( 'MEDIAWIKI' ) ) {
33 * Inherit main code from SkinTemplate, set the CSS and template filter.
37 class SkinMonoBook
extends SkinTemplate
{
38 /** Using monobook. */
39 public $skinname = 'monobook';
40 public $template = 'MonoBookTemplate';
43 * @param OutputPage $out
45 function setupSkinUserCss( OutputPage
$out ) {
46 parent
::setupSkinUserCss( $out );
48 $out->addModuleStyles( array( 'mediawiki.skinning.interface', 'skins.monobook.styles' ) );
50 // TODO: Migrate all of these
51 $out->addStyle( 'monobook/IE60Fixes.css', 'screen', 'IE 6' );
52 $out->addStyle( 'monobook/IE70Fixes.css', 'screen', 'IE 7' );
60 class MonoBookTemplate
extends BaseTemplate
{
63 * Template filter callback for MonoBook skin.
64 * Takes an associative array of data set from a SkinTemplate-based
65 * class, and a wrapper for MediaWiki's localization database, and
66 * outputs a formatted page.
71 // Suppress warnings to prevent notices about missing indexes in $this->data
74 $this->html( 'headelement' );
75 ?
><div id
="globalWrapper">
76 <div id
="column-content">
77 <div id
="content" class="mw-body-primary" role
="main">
80 if ( $this->data
['sitenotice'] ) {
82 <div id
="siteNotice"><?php
83 $this->html( 'sitenotice' )
88 <h1 id
="firstHeading" class="firstHeading" lang
="<?php
89 $this->data['pageLanguage'] =
90 $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
91 $this->text( 'pageLanguage' );
92 ?>"><span dir
="auto"><?php
$this->html( 'title' ) ?
></span
></h1
>
94 <div id
="bodyContent" class="mw-body">
95 <div id
="siteSub"><?php
$this->msg( 'tagline' ) ?
></div
>
96 <div id
="contentSub"<?php
97 $this->html( 'userlangattributes' ) ?
>><?php
$this->html( 'subtitle' )
99 <?php
if ( $this->data
['undelete'] ) { ?
>
100 <div id
="contentSub2"><?php
$this->html( 'undelete' ) ?
></div
>
104 if ( $this->data
['newtalk'] ) {
106 <div
class="usermessage"><?php
$this->html( 'newtalk' ) ?
></div
>
110 <div id
="jump-to-nav" class="mw-jump"><?php
111 $this->msg( 'jumpto' )
112 ?
> <a href
="#column-one"><?php
113 $this->msg( 'jumptonavigation' )
115 $this->msg( 'comma-separator' )
116 ?
><a href
="#searchInput"><?php
117 $this->msg( 'jumptosearch' )
120 <!-- start content
-->
121 <?php
$this->html( 'bodytext' ) ?
>
123 if ( $this->data
['catlinks'] ) {
124 $this->html( 'catlinks' );
129 if ( $this->data
['dataAfterContent'] ) {
130 $this->html( 'dataAfterContent'
134 <div
class="visualClear"></div
>
138 <div id
="column-one"<?php
$this->html( 'userlangattributes' ) ?
>>
139 <h2
><?php
$this->msg( 'navigation-heading' ) ?
></h2
>
140 <?php
$this->cactions(); ?
>
141 <div
class="portlet" id
="p-personal" role
="navigation">
142 <h3
><?php
$this->msg( 'personaltools' ) ?
></h3
>
145 <ul
<?php
$this->html( 'userlangattributes' ) ?
>>
146 <?php
foreach ( $this->getPersonalTools() as $key => $item ) { ?
>
147 <?php
echo $this->makeListItem( $key, $item ); ?
>
155 <div
class="portlet" id
="p-logo" role
="banner">
157 echo Html
::element( 'a', array(
158 'href' => $this->data
['nav_urls']['mainpage']['href'],
159 'style' => "background-image: url({$this->data['logopath']});" )
160 + Linker
::tooltipAndAccesskeyAttribs( 'p-logo' ) ); ?
>
164 $this->renderPortals( $this->data
['sidebar'] );
166 </div
><!-- end of the
left (by
default at least
) column
-->
167 <div
class="visualClear"></div
>
169 $validFooterIcons = $this->getFooterIcons( "icononly" );
170 $validFooterLinks = $this->getFooterLinks( "flat" ); // Additional footer links
172 if ( count( $validFooterIcons ) +
count( $validFooterLinks ) > 0 ) {
174 <div id
="footer" role
="contentinfo"<?php
$this->html( 'userlangattributes' ) ?
>>
176 $footerEnd = '</div>';
181 foreach ( $validFooterIcons as $blockName => $footerIcons ) {
183 <div id
="f-<?php echo htmlspecialchars( $blockName ); ?>ico">
184 <?php
foreach ( $footerIcons as $icon ) { ?
>
185 <?php
echo $this->getSkin()->makeFooterIcon( $icon ); ?
>
194 if ( count( $validFooterLinks ) > 0 ) {
198 foreach ( $validFooterLinks as $aLink ) {
200 <li id
="<?php echo $aLink ?>"><?php
$this->html( $aLink ) ?
></li
>
214 echo Html
::closeElement( 'body' );
215 echo Html
::closeElement( 'html' );
217 } // end of execute() method
219 /*************************************************************************************************/
222 * @param array $sidebar
224 protected function renderPortals( $sidebar ) {
225 if ( !isset( $sidebar['SEARCH'] ) ) {
226 $sidebar['SEARCH'] = true;
228 if ( !isset( $sidebar['TOOLBOX'] ) ) {
229 $sidebar['TOOLBOX'] = true;
231 if ( !isset( $sidebar['LANGUAGES'] ) ) {
232 $sidebar['LANGUAGES'] = true;
235 foreach ( $sidebar as $boxName => $content ) {
236 if ( $content === false ) {
240 if ( $boxName == 'SEARCH' ) {
242 } elseif ( $boxName == 'TOOLBOX' ) {
244 } elseif ( $boxName == 'LANGUAGES' ) {
245 $this->languageBox();
247 $this->customBox( $boxName, $content );
252 function searchBox() {
253 global $wgUseTwoButtonsSearchForm;
255 <div id
="p-search" class="portlet" role
="search">
256 <h3
><label
for="searchInput"><?php
$this->msg( 'search' ) ?
></label
></h3
>
258 <div id
="searchBody" class="pBody">
259 <form action
="<?php $this->text( 'wgScript' ) ?>" id
="searchform">
260 <input type
='hidden' name
="title" value
="<?php $this->text( 'searchtitle' ) ?>"/>
261 <?php
echo $this->makeSearchInput( array( "id" => "searchInput" ) ); ?
>
264 echo $this->makeSearchButton(
266 array( "id" => "searchGoButton", "class" => "searchButton" )
269 if ( $wgUseTwoButtonsSearchForm ) {
271 <?php
echo $this->makeSearchButton(
273 array( "id" => "mw-searchButton", "class" => "searchButton" )
279 $this->text( 'searchaction' )
280 ?>" rel
="search"><?php
$this->msg( 'powersearch-legend' ) ?
></a
></div
><?php
285 <?php
$this->renderAfterPortlet( 'search' ); ?
>
292 * Prints the cactions bar.
293 * Shared between MonoBook and Modern
295 function cactions() {
297 <div id
="p-cactions" class="portlet" role
="navigation">
298 <h3
><?php
$this->msg( 'views' ) ?
></h3
>
302 foreach ( $this->data
['content_actions'] as $key => $tab ) {
304 ' . $this->makeListItem( $key, $tab );
308 <?php
$this->renderAfterPortlet( 'cactions' ); ?
>
314 /*************************************************************************************************/
317 <div
class="portlet" id
="p-tb" role
="navigation">
318 <h3
><?php
$this->msg( 'toolbox' ) ?
></h3
>
323 foreach ( $this->getToolbox() as $key => $tbitem ) {
325 <?php
echo $this->makeListItem( $key, $tbitem ); ?
>
329 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
330 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) );
333 <?php
$this->renderAfterPortlet( 'tb' ); ?
>
339 /*************************************************************************************************/
340 function languageBox() {
341 if ( $this->data
['language_urls'] !== false ) {
343 <div id
="p-lang" class="portlet" role
="navigation">
344 <h3
<?php
$this->html( 'userlangattributes' ) ?
>><?php
$this->msg( 'otherlanguages' ) ?
></h3
>
348 <?php
foreach ( $this->data
['language_urls'] as $key => $langlink ) { ?
>
349 <?php
echo $this->makeListItem( $key, $langlink ); ?
>
356 <?php
$this->renderAfterPortlet( 'lang' ); ?
>
363 /*************************************************************************************************/
366 * @param array|string $cont
368 function customBox( $bar, $cont ) {
369 $portletAttribs = array(
370 'class' => 'generated-sidebar portlet',
371 'id' => Sanitizer
::escapeId( "p-$bar" ),
372 'role' => 'navigation'
375 $tooltip = Linker
::titleAttrib( "p-$bar" );
376 if ( $tooltip !== false ) {
377 $portletAttribs['title'] = $tooltip;
379 echo ' ' . Html
::openElement( 'div', $portletAttribs );
380 $msgObj = wfMessage( $bar );
383 <h3
><?php
echo htmlspecialchars( $msgObj->exists() ?
$msgObj->text() : $bar ); ?
></h3
>
386 if ( is_array( $cont ) ) {
390 foreach ( $cont as $key => $val ) {
392 <?php
echo $this->makeListItem( $key, $val ); ?
>
400 # allow raw HTML block to be defined by extensions
404 $this->renderAfterPortlet( $bar );