Moving watch/unwatch action out of the drop down
[lhc/web/wiklou.git] / skins / Vector.php
index 99f6d53..bd863f8 100644 (file)
@@ -19,7 +19,7 @@ class SkinVector extends SkinTemplate {
 
        /* Functions */
        var $skinname = 'vector', $stylename = 'vector',
-               $template = 'VectorTemplate';
+               $template = 'VectorTemplate', $useHeadElement = true;
 
        /**
         * Initializes output page and sets up skin-specific parameters
@@ -59,7 +59,7 @@ class SkinVector extends SkinTemplate {
         * @private
         */
        function buildNavigationUrls() {
-               global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle;
+               global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle, $wgStylePath;
                global $wgDisableLangConversion;
 
                wfProfileIn( __METHOD__ );
@@ -285,21 +285,23 @@ class SkinVector extends SkinTemplate {
                        if( $this->loggedin ) {
                                // Checks if the user is watching this page
                                if( !$this->mTitle->userIsWatching() ) {
-                                       // Adds watch action link
-                                       $links['actions']['watch'] = array(
+                                       // Adds watch view link
+                                       $links['views']['watch'] = array(
                                                'class' =>
                                                        ( $action == 'watch' or $action == 'unwatch' ) ?
                                                                'selected' : false,
                                                'text' => wfMsg( 'watch' ),
+                                               'img' => "{$wgStylePath}/vector/images/watch_off.gif",
                                                'href' => $this->mTitle->getLocalUrl( 'action=watch' )
                                        );
                                } else {
-                                       // Adds unwatch action link
-                                       $links['actions']['unwatch'] = array(
+                                       // Adds unwatch view link
+                                       $links['views']['unwatch'] = array(
                                                'class' =>
                                                        ($action == 'unwatch' or $action == 'watch') ?
                                                                'selected' : false,
                                                'text' => wfMsg( 'unwatch' ),
+                                               'img' => "{$wgStylePath}/vector/images/watch_on.gif",
                                                'href' => $this->mTitle->getLocalUrl( 'action=unwatch' )
                                        );
                                }
@@ -366,15 +368,11 @@ class VectorTemplate extends QuickTemplate {
         * Outputs the entire contents of the XHTML page
         */
        public function execute() {
-               global $wgRequest, $wgOut, $wgContLang, $wgDevelopmentWarnings;
+               global $wgRequest, $wgOut, $wgContLang;
 
                $this->skin = $this->data['skin'];
                $action = $wgRequest->getText( 'action' );
 
-               // Suppress warnings to prevent notices about missing indexes in
-               // $this->data (is this really the best way to handle this?)
-               $wgDevelopmentWarnings && wfSuppressWarnings();
-
                // Build additional attributes for navigation urls
                $nav = $this->skin->buildNavigationUrls();
                foreach ( $nav as $section => $links ) {
@@ -463,7 +461,7 @@ class VectorTemplate extends QuickTemplate {
                                array_reverse( $this->data['personal_urls'] );
                }
                // Output HTML Page
-               echo $wgOut->headElement( $this->skin );
+               $this->html( 'headelement' );
 ?>
        <body<?php if ( $this->data['body_ondblclick'] ): ?> ondblclick="<?php $this->text( 'body_ondblclick' ) ?>"<?php endif; ?> <?php if ( $this->data['body_onload'] ): ?> onload="<?php $this->text( 'body_onload' ) ?>"<?php endif; ?> class="mediawiki <?php $this->text( 'dir' ) ?> <?php $this->text( 'pageclass' ) ?> <?php $this->text( 'skinnameclass' ) ?>" dir="<?php $this->text( 'dir' ) ?>">
                <div id="page-base" class="noprint"></div>
@@ -578,8 +576,6 @@ class VectorTemplate extends QuickTemplate {
        </body>
 </html>
 <?php
-               // We're done with abusing arrays now...
-               $wgDevelopmentWarnings && wfRestoreWarnings();
        }
 
        /**
@@ -697,9 +693,8 @@ class VectorTemplate extends QuickTemplate {
                        echo "\n<!-- {$name} -->\n";
                        switch ( $element ) {
                                case 'NAMESPACES':
-                                       if ( count( $this->data[ 'namespace_urls' ] ) > 0 ) {
 ?>
-<div id="namespaces" class="vectorTabs">
+<div id="p-namespaces" class="vectorTabs<?php if ( count( $this->data['namespace_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><?php $this->msg('namespaces') ?></h5>
        <ul <?php $this->html('userlangattributes') ?>>
                <?php foreach ($this->data['namespace_urls'] as $key => $link ): ?>
@@ -708,12 +703,10 @@ class VectorTemplate extends QuickTemplate {
        </ul>
 </div>
 <?php
-                                       }
                                break;
                                case 'VARIANTS':
-                                       if ( count( $this->data[ 'variant_urls' ] ) > 0 ) {
 ?>
-<div id="variants" class="vectorMenu">
+<div id="p-variants" class="vectorMenu<?php if ( count( $this->data['variant_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><span><?php $this->msg('variants') ?></span><a href="#"></a></h5>
        <div class="menu">
                <ul <?php $this->html('userlangattributes') ?>>
@@ -724,26 +717,22 @@ class VectorTemplate extends QuickTemplate {
        </div>
 </div>
 <?php
-                                       }
                                break;
                                case 'VIEWS':
-                                       if ( count( $this->data[ 'view_urls' ] ) > 0 ) {
 ?>
-<div id="views" class="vectorTabs">
+<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 $key => $link ): ?>
-                       <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><span><?php echo htmlspecialchars( $link['text'] ) ?></span></a></li>
+                       <li<?php echo $link['attributes'] ?>><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'].'" />' : '<span>'.htmlspecialchars( $link['text'] ).'</span>') ?></a></li>
                <?php endforeach; ?>
        </ul>
 </div>
 <?php
-                                       }
                                break;
                                case 'ACTIONS':
-                                       if ( count( $this->data[ 'action_urls' ] ) > 0 ) {
 ?>
-<div id="p-cactions" class="vectorMenu">
+<div id="p-cactions" class="vectorMenu<?php if ( count( $this->data['action_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><span><?php $this->msg('actions') ?></span><a href="#"></a></h5>
        <div class="menu">
                <ul <?php $this->html('userlangattributes') ?>>
@@ -754,12 +743,10 @@ class VectorTemplate extends QuickTemplate {
        </div>
 </div>
 <?php
-                                       }
                                break;
                                case 'PERSONAL':
-                                       if ( count( $this->data['personal_urls'] ) > 0 ) {
 ?>
-<div id="p-personal">
+<div id="p-personal" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
        <h5><?php $this->msg('personaltools') ?></h5>
        <ul <?php $this->html('userlangattributes') ?>>
                <?php foreach($this->data['personal_urls'] as $key => $item): ?>
@@ -768,7 +755,6 @@ class VectorTemplate extends QuickTemplate {
        </ul>
 </div>
 <?php
-                                       }
                                break;
                                case 'SEARCH':
 ?>
@@ -779,7 +765,7 @@ class VectorTemplate extends QuickTemplate {
                <?php if ( $wgVectorUseSimpleSearch ): ?>
                <div id="simpleSearch">
                        <input id="searchInput" name="search" type="text" <?php echo $this->skin->tooltipAndAccesskey( 'search' ); ?> <?php if( isset( $this->data['search'] ) ): ?> value="<?php $this->text( 'search' ) ?>"<?php endif; ?> />
-                       <button id="searchButton" type='submit' name='fulltext' <?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?>>&nbsp;</button>
+                       <button id="searchButton" type='submit' name='button' <?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?>>&nbsp;</button>
                </div>
                <?php else: ?>
                <input id="searchInput" name="search" type="text" <?php echo $this->skin->tooltipAndAccesskey( 'search' ); ?> <?php if( isset( $this->data['search'] ) ): ?> value="<?php $this->text( 'search' ) ?>"<?php endif; ?> />