Migrate skins/common/search.js functionality to mediawiki.special.search.js. Make...
[lhc/web/wiklou.git] / skins / MonoBook.php
index a766e94..472bbf3 100644 (file)
@@ -31,13 +31,13 @@ class SkinMonoBook extends SkinTemplate {
                parent::setupSkinUserCss( $out );
 
                $out->addModuleStyles( 'skins.monobook' );
-               
+
                // Ugh. Can't do this properly because $wgHandheldStyle may be a URL
                if( $wgHandheldStyle ) {
                        // Currently in testing... try 'chick/main.css'
                        $out->addStyle( $wgHandheldStyle, 'handheld' );
                }
-               
+
                // TODO: Migrate all of these
                //$out->addStyle( 'monobook/IE50Fixes.css', 'screen', 'lt IE 5.5000' );
                //$out->addStyle( 'monobook/IE55Fixes.css', 'screen', 'IE 5.5000' );
@@ -70,14 +70,14 @@ class MonoBookTemplate extends BaseTemplate {
         * @access private
         */
        function execute() {
-               $this->skin = $skin = $this->data['skin'];
+               $this->skin = $this->data['skin'];
 
                // Suppress warnings to prevent notices about missing indexes in $this->data
                wfSuppressWarnings();
 
                $this->html( 'headelement' );
 ?><div id="globalWrapper">
-<div id="column-content"><div id="content"<?php $this->html("specialpageattributes") ?>>
+<div id="column-content"><div id="content">
        <a id="top"></a>
        <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
 
@@ -103,7 +103,7 @@ class MonoBookTemplate extends BaseTemplate {
        </div>
 </div></div>
 <div id="column-one"<?php $this->html('userlangattributes')  ?>>
-<?php $this->cactions( $skin ); ?>
+<?php $this->cactions(); ?>
        <div class="portlet" id="p-personal">
                <h5><?php $this->msg('personaltools') ?></h5>
                <div class="pBody">
@@ -126,21 +126,7 @@ class MonoBookTemplate extends BaseTemplate {
        </div>
        <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
 <?php
-               $sidebar = $this->data['sidebar'];
-               if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
-               if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
-               if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
-               foreach ($sidebar as $boxName => $cont) {
-                       if ( $boxName == 'SEARCH' ) {
-                               $this->searchBox();
-                       } elseif ( $boxName == 'TOOLBOX' ) {
-                               $this->toolbox();
-                       } elseif ( $boxName == 'LANGUAGES' ) {
-                               $this->languageBox();
-                       } else {
-                               $this->customBox( $boxName, $cont );
-                       }
-               }
+       $this->renderPortals( $this->data['sidebar'] );
 ?>
 </div><!-- end of the left (by default at least) column -->
 <div class="visualClear"></div>
@@ -187,6 +173,28 @@ echo $footerEnd;
        } // end of execute() method
 
        /*************************************************************************************************/
+
+       protected function renderPortals( $sidebar ) {
+               if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
+               if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
+               if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
+
+               foreach( $sidebar as $boxName => $content ) {
+                       if ( $content === false )
+                               continue;
+
+                       if ( $boxName == 'SEARCH' ) {
+                               $this->searchBox();
+                       } elseif ( $boxName == 'TOOLBOX' ) {
+                               $this->toolbox();
+                       } elseif ( $boxName == 'LANGUAGES' ) {
+                               $this->languageBox();
+                       } else {
+                               $this->customBox( $boxName, $content );
+                       }
+               }
+       }
+
        function searchBox() {
                global $wgUseTwoButtonsSearchForm;
 ?>
@@ -217,7 +225,7 @@ echo $footerEnd;
         *
         * @param $skin Skin
         */
-       function cactions( Skin $skin ) {
+       function cactions() {
 ?>
        <div id="p-cactions" class="portlet">
                <h5><?php $this->msg('views') ?></h5>
@@ -225,7 +233,7 @@ echo $footerEnd;
                        <ul><?php
                                foreach($this->data['content_actions'] as $key => $tab) {
                                        $linkAttribs = array( 'href' => $tab['href'] );
-                                       
+
                                        if( isset( $tab["tooltiponly"] ) && $tab["tooltiponly"] ) {
                                                $title = Linker::titleAttrib( "ca-$key" );
                                                if ( $title !== false ) {
@@ -235,7 +243,7 @@ echo $footerEnd;
                                                $linkAttribs += Linker::tooltipAndAccesskeyAttribs( "ca-$key" );
                                        }
                                        $linkHtml = Html::element( 'a', $linkAttribs, $tab['text'] );
-                                       
+
                                        /* Surround with a <li> */
                                        $liAttribs = array( 'id' => Sanitizer::escapeId( "ca-$key" ) );
                                        if( $tab['class'] ) {