* Make tests work better together. Tests are now skipped or marked incomplete.
[lhc/web/wiklou.git] / skins / Vector.php
index bd863f8..616b784 100644 (file)
@@ -26,8 +26,8 @@ class SkinVector extends SkinTemplate {
         * @param object $out Output page object to initialize
         */
        public function initPage( OutputPage $out ) {
-               global $wgStylePath, $wgJsMimeType, $wgStyleVersion;
-
+               global $wgStylePath, $wgJsMimeType, $wgStyleVersion, $wgScriptPath, $wgVectorExtraStyles;
+               
                parent::initPage( $out );
 
                // Append skin-specific styles
@@ -41,17 +41,13 @@ class SkinVector extends SkinTemplate {
                                $wgStylePath .
                                '/vector/csshover.htc")}</style><![endif]-->'
                );
-               // Append common IE fixes, which perhaps should be included in all
-               // skins, but for now it seems each skin needs to include them
-               // explicitly
-               $out->addScript(
-                       '<!--[if lt IE 7]><script type="' . $wgJsMimeType . '" src="' .
-                               $wgStylePath .
-                               '/common/IEFixes.js?' .
-                               $wgStyleVersion .
-                               '"></script>' .
-                               '<meta http-equiv="imagetoolbar" content="no" /><![endif]-->'
-               );
+               // Add extra stylesheets
+               // THIS IS ONLY USEFUL FOR EXPERIMENTING WITH DIFFERNT STYLE OPTIONS! THIS WILL BE REMOVED IN THE NEAR FUTURE.
+               if ( is_array( $wgVectorExtraStyles ) ) {
+                       foreach ( $wgVectorExtraStyles as $style ) {
+                               $out->addStyle( 'vector/' . $style, 'screen' );
+                       }
+               }
        }
        /**
         * Builds a structured array of links used for tabs and menus
@@ -60,7 +56,7 @@ class SkinVector extends SkinTemplate {
         */
        function buildNavigationUrls() {
                global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle, $wgStylePath;
-               global $wgDisableLangConversion;
+               global $wgDisableLangConversion, $wgVectorUseIconWatch;
 
                wfProfileIn( __METHOD__ );
 
@@ -150,7 +146,7 @@ class SkinVector extends SkinTemplate {
                                                // Adds new section link
                                                //$links['actions']['addsection']
                                                $links['views']['addsection'] = array(
-                                                       'class' => $section == 'new' ? 'selected' : false,
+                                                       'class' => 'collapsible ' . ( $section == 'new' ? 'selected' : false ),
                                                        'text' => wfMsg( 'vector-action-addsection' ),
                                                        'href' => $this->mTitle->getLocalUrl(
                                                                'action=edit&section=new'
@@ -176,7 +172,7 @@ class SkinVector extends SkinTemplate {
                        if ( $this->mTitle->exists() ) {
                                // Adds history view link
                                $links['views']['history'] = array(
-                                       'class' => ($action == 'history') ? 'selected' : false,
+                                       'class' => 'collapsible ' . ( ($action == 'history') ? 'selected' : false ),
                                        'text' => wfMsg( 'vector-view-history' ),
                                        'href' => $this->mTitle->getLocalUrl( 'action=history' ),
                                        'rel' => 'archives',
@@ -271,7 +267,6 @@ class SkinVector extends SkinTemplate {
                                }
                        }
                        wfProfileOut( __METHOD__ . '-live' );
-
                        /**
                         * The following actions use messages which, if made particular to
                         * the Vector skin, would break the Ajax code which makes this
@@ -282,31 +277,21 @@ class SkinVector extends SkinTemplate {
                         * the global versions.
                         */
                        // Checks if the user is logged in
-                       if( $this->loggedin ) {
-                               // Checks if the user is watching this page
-                               if( !$this->mTitle->userIsWatching() ) {
-                                       // 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' )
-                                       );
+                       if ( $this->loggedin ) {
+                               if ( $wgVectorUseIconWatch ) {
+                                       $class = 'icon ';
+                                       $place = 'views';
                                } else {
-                                       // 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' )
-                                       );
+                                       $class = '';
+                                       $place = 'actions';
                                }
+                               $mode = $this->mTitle->userIsWatching() ? 'unwatch' : 'watch';
+                               $links[$place][$mode] = array(
+                                       'class' => $class . ( ( $action == 'watch' || $action == 'unwatch' ) ? ' selected' : false ),
+                                       'text' => wfMsg( $mode ), // uses 'watch' or 'unwatch' message
+                                       'href' => $this->mTitle->getLocalUrl( 'action=' . $mode )
+                               );
                        }
-
                        // This is instead of SkinTemplateTabs - which uses a flat array
                        wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) );
 
@@ -463,13 +448,12 @@ class VectorTemplate extends QuickTemplate {
                // Output HTML Page
                $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>
                <div id="head-base" class="noprint"></div>
                <!-- content -->
-               <div id="content">
+               <div id="content" <?php $this->html('specialpageattributes') ?>>
                        <a id="top"></a>
-                       <div id="mw-js-message" style="display:none;"></div>
+                       <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes') ?>></div>
                        <?php if ( $this->data['sitenotice'] ): ?>
                        <!-- sitenotice -->
                        <div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
@@ -484,7 +468,7 @@ class VectorTemplate extends QuickTemplate {
                                <h3 id="siteSub"><?php $this->msg( 'tagline' ) ?></h3>
                                <!-- /tagline -->
                                <!-- subtitle -->
-                               <div id="contentSub"><?php $this->html( 'subtitle' ) ?></div>
+                               <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html( 'subtitle' ) ?></div>
                                <!-- /subtitle -->
                                <?php if ( $this->data['undelete'] ): ?>
                                <!-- undelete -->
@@ -542,7 +526,7 @@ class VectorTemplate extends QuickTemplate {
                        </div>
                <!-- /panel -->
                <!-- footer -->
-               <div id="footer">
+               <div id="footer"<?php $this->html('userlangattributes') ?>>
                        <?php foreach( $validFooterLinks as $category => $links ): ?>
                                <?php if ( count( $links ) > 0 ): ?>
                                <ul id="footer-<?php echo $category ?>">
@@ -595,7 +579,7 @@ class VectorTemplate extends QuickTemplate {
                                case 'TOOLBOX':
 ?>
 <div class="portal" id="p-tb">
-       <h5 <?php $this->html('userlangattributes') ?>><?php $this->msg( 'toolbox' ) ?></h5>
+       <h5<?php $this->html('userlangattributes') ?>><?php $this->msg( 'toolbox' ) ?></h5>
        <div class="body">
                <ul>
                <?php if( $this->data['notspecialpage'] ): ?>
@@ -638,7 +622,7 @@ class VectorTemplate extends QuickTemplate {
                                        if ( $this->data['language_urls'] ) {
 ?>
 <div class="portal" id="p-lang">
-       <h5 <?php $this->html('userlangattributes') ?>><?php $this->msg( 'otherlanguages' ) ?></h5>
+       <h5<?php $this->html('userlangattributes') ?>><?php $this->msg( 'otherlanguages' ) ?></h5>
        <div class="body">
                <ul>
                <?php foreach ( $this->data['language_urls'] as $langlink ): ?>
@@ -653,7 +637,7 @@ class VectorTemplate extends QuickTemplate {
                                default:
 ?>
 <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( $name ); if ( wfEmptyMsg( $name, $out ) ) echo htmlspecialchars( $name ); else echo htmlspecialchars( $out ); ?></h5>
+       <h5<?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $name ); if ( wfEmptyMsg( $name, $out ) ) echo htmlspecialchars( $name ); else echo htmlspecialchars( $out ); ?></h5>
        <div class="body">
                <?php if ( is_array( $content ) ): ?>
                <ul>
@@ -696,7 +680,7 @@ class VectorTemplate extends QuickTemplate {
 ?>
 <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') ?>>
+       <ul<?php $this->html('userlangattributes') ?>>
                <?php foreach ($this->data['namespace_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>
                <?php endforeach; ?>
@@ -709,7 +693,7 @@ class VectorTemplate extends QuickTemplate {
 <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') ?>>
+               <ul<?php $this->html('userlangattributes') ?>>
                        <?php foreach ($this->data['variant_urls'] as $key => $link ): ?>
                                <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
                        <?php endforeach; ?>
@@ -722,7 +706,7 @@ class VectorTemplate extends QuickTemplate {
 ?>
 <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') ?>>
+       <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'] ?>><?php echo (array_key_exists('img',$link) ?  '<img src="'.$link['img'].'" alt="'.$link['text'].'" />' : '<span>'.htmlspecialchars( $link['text'] ).'</span>') ?></a></li>
                <?php endforeach; ?>
@@ -735,7 +719,7 @@ class VectorTemplate extends QuickTemplate {
 <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') ?>>
+               <ul<?php $this->html('userlangattributes') ?>>
                        <?php foreach ($this->data['action_urls'] as $key => $link ): ?>
                                <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
                        <?php endforeach; ?>
@@ -748,7 +732,7 @@ class VectorTemplate extends QuickTemplate {
 ?>
 <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') ?>>
+       <ul<?php $this->html('userlangattributes') ?>>
                <?php foreach($this->data['personal_urls'] as $key => $item): ?>
                        <li <?php echo $item['attributes'] ?>><a href="<?php echo htmlspecialchars($item['href']) ?>"<?php echo $item['key'] ?><?php if(!empty($item['class'])): ?> class="<?php echo htmlspecialchars($item['class']) ?>"<?php endif; ?>><?php echo htmlspecialchars($item['text']) ?></a></li>
                <?php endforeach; ?>
@@ -759,7 +743,7 @@ class VectorTemplate extends QuickTemplate {
                                case 'SEARCH':
 ?>
 <div id="p-search">
-       <h5 <?php $this->html('userlangattributes') ?>><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
+       <h5<?php $this->html('userlangattributes') ?>><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
        <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
                <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
                <?php if ( $wgVectorUseSimpleSearch ): ?>