Big oops - merged to wrong branch.
[lhc/web/wiklou.git] / skins / Modern.php
index c5bddc6..efcf1de 100644 (file)
@@ -2,6 +2,21 @@
 /**
  * Modern skin, derived from monobook template.
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
  * @todo document
  * @file
  * @ingroup Skins
@@ -21,23 +36,12 @@ class SkinModern extends SkinTemplate {
        var $skinname = 'modern', $stylename = 'modern',
                $template = 'ModernTemplate', $useHeadElement = true;
 
-       /*
-        * We don't like the default getPoweredBy, the icon clashes with the
-        * skin L&F.
+       /**
+        * @param $out OutputPage
         */
-       function getPoweredBy() {
-               global $wgVersion;
-               $text = "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>";
-               wfRunHooks( 'SkinGetPoweredBy', array( &$text, $this ) );
-               return $text;
-       }
-
        function setupSkinUserCss( OutputPage $out ){
-               // Do not call parent::setupSkinUserCss(), we have our own print style
-               $out->addStyle( 'common/shared.css', 'screen' );
-               $out->addStyle( 'modern/main.css', 'screen' );
-               $out->addStyle( 'modern/print.css', 'print' );
-               $out->addStyle( 'modern/rtl.css', 'screen', '', 'rtl' );
+               parent::setupSkinUserCss( $out );
+               $out->addModuleStyles ('skins.modern');
        }
 }
 
@@ -46,7 +50,7 @@ class SkinModern extends SkinTemplate {
  * @ingroup Skins
  */
 class ModernTemplate extends MonoBookTemplate {
-       var $skin;
+
        /**
         * Template filter callback for Modern skin.
         * Takes an associative array of data set from a SkinTemplate-based
@@ -56,10 +60,6 @@ class ModernTemplate extends MonoBookTemplate {
         * @access private
         */
        function execute() {
-               global $wgRequest;
-               $this->skin = $skin = $this->data['skin'];
-               $action = $wgRequest->getText( 'action' );
-
                // Suppress warnings to prevent notices about missing indexes in $this->data
                wfSuppressWarnings();
 
@@ -67,46 +67,19 @@ class ModernTemplate extends MonoBookTemplate {
 ?>
 
        <!-- heading -->
-       <div id="mw_header"><h1 id="firstHeading"><?php $this->html('title') ?></h1></div>
+       <div id="mw_header"><h1 id="firstHeading"><span dir="auto"><?php $this->html('title') ?></span></h1></div>
 
        <div id="mw_main">
        <div id="mw_contentwrapper">
        <!-- navigation portlet -->
-       <div id="p-cactions" class="portlet">
-               <h5><?php $this->msg('views') ?></h5>
-               <div class="pBody">
-                       <ul>
-       <?php           foreach($this->data['content_actions'] as $key => $tab) {
-                                       echo '
-                                <li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
-                                       if( $tab['class'] ) {
-                                               echo ' class="'.htmlspecialchars($tab['class']).'"';
-                                       }
-                                       echo'><a href="'.htmlspecialchars($tab['href']).'"';
-                                       # We don't want to give the watch tab an accesskey if the
-                                       # page is being edited, because that conflicts with the
-                                       # accesskey on the watch checkbox.  We also don't want to
-                                       # give the edit tab an accesskey, because that's fairly su-
-                                       # perfluous and conflicts with an accesskey (Ctrl-E) often
-                                       # used for editing in Safari.
-                                       if( in_array( $action, array( 'edit', 'submit' ) )
-                                       && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
-                                               echo $skin->tooltip( "ca-$key" );
-                                       } else {
-                                               echo $skin->tooltipAndAccesskey( "ca-$key" );
-                                       }
-                                       echo '>'.htmlspecialchars($tab['text']).'</a></li>';
-                               } ?>
-                       </ul>
-               </div>
-       </div>
+<?php $this->cactions(); ?>
 
        <!-- content -->
        <div id="mw_content">
        <!-- contentholder does nothing by default, but it allows users to style the text inside
             the content area without affecting the meaning of 'em' in #mw_content, which is used
             for the margins -->
-       <div id="mw_contentholder" <?php $this->html("specialpageattributes") ?>>
+       <div id="mw_contentholder">
                <div class='mw-topboxes'>
                        <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes')?>></div>
                        <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
@@ -134,24 +107,7 @@ class ModernTemplate extends MonoBookTemplate {
        <div id="mw_portlets"<?php $this->html("userlangattributes") ?>>
 
        <!-- portlets -->
-       <?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 );
-                       }
-               }
-       ?>
+       <?php $this->renderPortals( $this->data['sidebar'] ); ?>
 
        </div><!-- mw_portlets -->
 
@@ -165,14 +121,10 @@ class ModernTemplate extends MonoBookTemplate {
                <h5><?php $this->msg('personaltools') ?></h5>
                <div class="pBody">
                        <ul>
-<?php                  foreach($this->data['personal_urls'] as $key => $item) { ?>
-                               <li id="<?php echo Sanitizer::escapeId( "pt-$key" ) ?>"<?php
-                                       if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
-                               echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php
-                               if(!empty($item['class'])) { ?> class="<?php
-                               echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
-                               echo htmlspecialchars($item['text']) ?></a></li>
-<?php                  } ?>
+<?php          foreach($this->getPersonalTools() as $key => $item) { ?>
+                               <?php echo $this->makeListItem($key, $item); ?>
+
+<?php          } ?>
                        </ul>
                </div>
        </div>
@@ -182,27 +134,29 @@ class ModernTemplate extends MonoBookTemplate {
        <div id="footer"<?php $this->html('userlangattributes') ?>>
                        <ul id="f-list">
 <?php
-               $footerlinks = array(
-                       'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
-                       'privacy', 'about', 'disclaimer', 'tagline',
-               );
-               foreach( $footerlinks as $aLink ) {
+               foreach( $this->getFooterLinks("flat") as $aLink ) {
                        if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
 ?>                             <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
 <?php          }
                }
 ?>
                        </ul>
-               <?php echo $this->html("poweredbyico"); ?>
+<?php
+               foreach ( $this->getFooterIcons("nocopyright") as $blockName => $footerIcons ) { ?>
+                       <div id="mw_<?php echo htmlspecialchars($blockName); ?>">
+<?php
+                       foreach ( $footerIcons as $icon ) { ?>
+                               <?php echo $this->getSkin()->makeFooterIcon( $icon, 'withoutImage' ); ?>
+
+<?php
+                       } ?>
+                       </div>
+<?php
+               }
+?>
        </div>
 
-       <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
-<?php $this->html('reporttime') ?>
-<?php if ( $this->data['debug'] ): ?>
-<!-- Debug output:
-<?php $this->text( 'debug' ); ?>
--->
-<?php endif; ?>
+       <?php $this->printTrail(); ?>
 </body></html>
 <?php
        wfRestoreWarnings();