Fixed bugs in the data structure of the result of buildNavigationUrls including inter...
[lhc/web/wiklou.git] / skins / Vector.php
index c1622a2..c910c99 100644 (file)
@@ -35,8 +35,13 @@ class SkinVector extends SkinTemplate {
         * @param object $out Output page to add styles to
         */
        public function setupSkinUserCss( OutputPage $out ) {
+               global $wgContLang;
                // Append to the default screen common & print styles...
-               $out->addStyle( 'vector/main.css', 'screen' );
+               if ( $wgContLang->isRTL() ) {
+                       $out->addStyle( 'vector/main-rtl.css', 'screen' );
+               } else {
+                       $out->addStyle( 'vector/main-ltr.css', 'screen' );
+               }
                // Add common styles
                parent::setupSkinUserCss( $out );
        }
@@ -58,7 +63,7 @@ class SkinVector extends SkinTemplate {
                        'actions' => array(),
                        'variants' => array()
                );
-
+               
                // Detects parameters
                $action = $wgRequest->getVal( 'action', 'view' );
                $section = $wgRequest->getVal( 'section' );
@@ -74,13 +79,18 @@ class SkinVector extends SkinTemplate {
                        $isTalk = $this->mTitle->isTalkPage();
 
                        // Generates XML IDs from namespace names
-                       $subjectId = $wgContLang->lc( $this->mTitle->getSubjectNsText() );
+                       $subjectId = $wgContLang->lc($wgCanonicalNamespaceNames[MWNamespace::getSubject($this->mTitle->getNamespace())]);
+                       
                        if ( $subjectId == '' ) {
                                $subjectId = 'main';
                        }
-                       $talkId = "{$subjectId}_talk";
+                       if ( $subjectId == 'main' ) {
+                               $talkId = 'talk';
+                       } else {
+                               $talkId = "{$subjectId}_talk";
+                       }
                        $currentId = $isTalk ? $talkId : $subjectId;
-
+                       
                        // Adds namespace links
                        $links['namespaces'][$subjectId] = $this->tabAction(
                                $subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true
@@ -88,7 +98,7 @@ class SkinVector extends SkinTemplate {
                        $links['namespaces'][$talkId] = $this->tabAction(
                                $talkPage, 'vector-namespace-talk', $isTalk, '', true
                        );
-
+                       
                        // Adds view view link
                        if ( $this->mTitle->exists() ) {
                                $links['views']['view'] = $this->tabAction(
@@ -98,7 +108,7 @@ class SkinVector extends SkinTemplate {
                        }
                        
                        wfProfileIn( __METHOD__ . '-edit' );
-
+                       
                        // Checks if user can...
                        if (
                                // edit the current page
@@ -287,7 +297,10 @@ class SkinVector extends SkinTemplate {
                                        );
                                }
                        }
-
+                       
+                       // This is instead of SkinTemplateTabs - which uses a flat array
+                       wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) );
+               
                // If it's not content, it's got to be a special page
                } else {
                        $links['namespaces']['special'] = array(
@@ -388,7 +401,7 @@ class VectorTemplate extends QuickTemplate {
                $this->data['view_urls'] = $nav['views'];
                $this->data['action_urls'] = $nav['actions'];
                $this->data['variant_urls'] = $nav['variants'];
-
+               
                // Build additional attributes for personal_urls
                foreach ( $this->data['personal_urls'] as $key => $item) {
                        $this->data['personal_urls'][$key]['attributes'] = 
@@ -556,7 +569,7 @@ class VectorTemplate extends QuickTemplate {
                                        <h5><?php $this->msg('namespaces') ?></h5>
                                        <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'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
+                                                       <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; ?>
                                        </ul>
                                </div>
@@ -564,7 +577,7 @@ class VectorTemplate extends QuickTemplate {
                                <!-- variants -->
                                <?php if ( count( $this->data['variant_urls'] ) > 0 ): ?>
                                <div id="variants">
-                                       <h5><div class="icon"><span><?php $this->msg('variants') ?></span></div></h5>
+                                       <h5><span><?php $this->msg('variants') ?></span><a href="#">&nbsp;</a></h5>
                                        <div class="menu">
                                                <ul <?php $this->html('userlangattributes') ?>>
                                                        <?php foreach ($this->data['variant_urls'] as $key => $link ): ?>
@@ -583,7 +596,7 @@ class VectorTemplate extends QuickTemplate {
                                        <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'] ?><?php if(!empty($link['class'])): ?> class="<?php echo htmlspecialchars($link['class']) ?>"<?php endif; ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
+                                                       <li<?php echo $link['attributes'] ?><?php if(!empty($link['class'])): ?> class="<?php echo htmlspecialchars($link['class']) ?>"<?php endif; ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><span><?php echo htmlspecialchars( $link['text'] ) ?></span></a></li>
                                                <?php endforeach; ?>
                                        </ul>
                                </div>