Refactor the get-legend-for-section-fieldset logic out into its own function so it...
[lhc/web/wiklou.git] / skins / Vector.php
index 2d812c7..6afd587 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
- * Vector - Branch of MonoBook which has many usability improvements and
- * somewhat cleaner code.
+ * Vector - Modern version of MonoBook with fresh look and many usability
+ * improvements.
  *
  * @todo document
  * @file
@@ -18,7 +18,6 @@ if( !defined( 'MEDIAWIKI' ) ) {
  */
 class SkinVector extends SkinTemplate {
 
-       /* Functions */
        var $skinname = 'vector', $stylename = 'vector',
                $template = 'VectorTemplate', $useHeadElement = true;
 
@@ -27,17 +26,18 @@ class SkinVector extends SkinTemplate {
         * @param $out OutputPage object to initialize
         */
        public function initPage( OutputPage $out ) {
-               global $wgLocalStylePath;
+               global $wgLocalStylePath, $wgRequest;
 
                parent::initPage( $out );
-
+               
                // Append CSS which includes IE only behavior fixes for hover support -
                // this is better than including this in a CSS fille since it doesn't
                // wait for the CSS file to load before fetching the HTC file.
-               $out->addScript(
+               $min = $wgRequest->getFuzzyBool( 'debug' ) ? '' : '.min';
+               $out->addHeadItem( 'csshover',
                        '<!--[if lt IE 7]><style type="text/css">body{behavior:url("' .
                                htmlspecialchars( $wgLocalStylePath ) .
-                               "/{$this->stylename}/csshover.htc\")}</style><![endif]-->"
+                               "/{$this->stylename}/csshover{$min}.htc\")}</style><![endif]-->"
                );
        }
 
@@ -61,33 +61,35 @@ class VectorTemplate extends BaseTemplate {
        /* Members */
 
        /**
-        * @var Cached skin object
+        * @var Skin Cached skin object
         */
        var $skin;
 
        /* Functions */
 
        /**
-        * Outputs the entire contents of the XHTML page
+        * Outputs the entire contents of the (X)HTML page
         */
        public function execute() {
-               global $wgRequest, $wgLang, $wgVectorUseIconWatch;
+               global $wgLang, $wgVectorUseIconWatch;
 
                $this->skin = $this->data['skin'];
-               $action = $wgRequest->getText( 'action' );
 
                // Build additional attributes for navigation urls
                //$nav = $this->skin->buildNavigationUrls();
                $nav = $this->data['content_navigation'];
                
                if ( $wgVectorUseIconWatch ) {
-                       $mode = $this->skin->mTitle->userIsWatching() ? 'unwatch' : 'watch';
-                       $nav['views'][$mode] = $nav['actions'][$mode];
-                       $nav['views'][$mode]['class'] = rtrim('icon ' . $nav['views'][$mode]['class'], ' ');
-                       $nav['views'][$mode]['primary'] = true;
-                       unset($nav['actions'][$mode]);
+                       $mode = $this->skin->getTitle()->userIsWatching() ? 'unwatch' : 'watch';
+                       if ( isset($nav['actions'][$mode]) ) {
+                               $nav['views'][$mode] = $nav['actions'][$mode];
+                               $nav['views'][$mode]['class'] = rtrim('icon ' . $nav['views'][$mode]['class'], ' ');
+                               $nav['views'][$mode]['primary'] = true;
+                               unset($nav['actions'][$mode]);
+                       }
                }
-               
+
+               $xmlID = '';
                foreach ( $nav as $section => $links ) {
                        foreach ( $links as $key => $link ) {
                                if ( $section == "views" && !(isset($link["primary"]) && $link["primary"]) ) {
@@ -144,9 +146,11 @@ class VectorTemplate extends BaseTemplate {
                        <!-- /firstHeading -->
                        <!-- bodyContent -->
                        <div id="bodyContent">
+                               <?php if ( $this->data['isarticle'] ): ?>
                                <!-- tagline -->
                                <div id="siteSub"><?php $this->msg( 'tagline' ) ?></div>
                                <!-- /tagline -->
+                               <?php endif; ?>
                                <!-- subtitle -->
                                <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html( 'subtitle' ) ?></div>
                                <!-- /subtitle -->
@@ -230,14 +234,11 @@ class VectorTemplate extends BaseTemplate {
                        <div style="clear:both"></div>
                </div>
                <!-- /footer -->
-               <?php $this->html( 'bottomscripts' ); /* JS call to runBodyOnloadHook */ ?>
                <!-- fixalpha -->
                <script type="<?php $this->text('jsmimetype') ?>"> if ( window.isMSIE55 ) fixalpha(); </script>
                <!-- /fixalpha -->
-               <?php $this->html( 'reporttime' ) ?>
-               <?php if ( $this->data['debug'] ): ?>
-               <!-- Debug output: <?php $this->text( 'debug' ); ?> -->
-               <?php endif; ?>
+               <?php $this->printTrail(); ?>
+
        </body>
 </html>
 <?php
@@ -279,7 +280,7 @@ class VectorTemplate extends BaseTemplate {
                }
                ?>
 <div class="portal" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo $this->skin->tooltip( 'p-' . $name ) ?>>
-       <h5<?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $msg ); if ( wfEmptyMsg( $msg, $out ) ) echo htmlspecialchars( $msg ); else echo htmlspecialchars( $out ); ?></h5>
+       <h5<?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $msg ); if ( wfEmptyMsg( $msg ) ) echo htmlspecialchars( $msg ); else echo htmlspecialchars( $out ); ?></h5>
        <div class="body">
 <?php
                if ( is_array( $content ) ): ?>
@@ -361,11 +362,16 @@ class VectorTemplate extends BaseTemplate {
                                break;
                                case 'VIEWS':
 ?>
-<div id="p-views" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
+<div id="p-views" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) { echo ' emptyPortlet'; } ?>">
        <h5><?php $this->msg('views') ?></h5>
        <ul<?php $this->html('userlangattributes') ?>>
                <?php foreach ( $this->data['view_urls'] as $link ): ?>
-                       <li<?php echo $link['attributes'] ?>><span><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo (array_key_exists('img',$link) ?  '<img src="'.$link['img'].'" alt="'.$link['text'].'" />' : htmlspecialchars( $link['text'] ) ) ?></a></span></li>
+                       <li<?php echo $link['attributes'] ?>><span><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php
+                               // $link['text'] can be undefined - bug 27764
+                               if ( array_key_exists( 'text', $link ) ) {
+                                       echo array_key_exists( 'img', $link ) ?  '<img src="' . $link['img'] . '" alt="' . $link['text'] . '" />' : htmlspecialchars( $link['text'] );
+                               }
+                               ?></a></span></li>
                <?php endforeach; ?>
        </ul>
 </div>