Bug 2557: Sidebar items missing from classic, cologne blue, simple skins
authorMarcin Cieślak <saper@users.mediawiki.org>
Sun, 13 Mar 2011 23:12:59 +0000 (23:12 +0000)
committerMarcin Cieślak <saper@users.mediawiki.org>
Sun, 13 Mar 2011 23:12:59 +0000 (23:12 +0000)
* Simple skin support multiple sidebar items
* Standard (a.k.a. Classic) likes to add "my watchlist" and "my contributions"
  links at the bottom of the first sidebar box. It also has no titles for boxes.
* Cologne blue supports multiple sidebar boxes with titles.

skins/CologneBlue.php
skins/Standard.php

index e157ed4..6dd3137 100644 (file)
@@ -213,13 +213,25 @@ class CologneBlueTemplate extends LegacyTemplate {
                unset( $bar['SEARCH'] );
                unset( $bar['LANGUAGES'] );
                unset( $bar['TOOLBOX'] );
-               $browseLinks = reset( $bar );
 
-               foreach ( $browseLinks as $link ) {
-                       if ( $link['text'] != '-' ) {
-                               $s .= "<a href=\"{$link['href']}\">" .
-                                       htmlspecialchars( $link['text'] ) . '</a>' . $sep;
+               $barnumber = 1;
+               foreach ( $bar as $heading => $browseLinks ) {
+                       $heading_text = wfMsg ( $heading );
+                       if ( $barnumber > 1 ) {
+                               if ( wfEmptyMsg( $heading, $heading_text ) ) {
+                                       $h = $heading;
+                               } else {
+                                       $h = $heading_text;
+                               }
+                               $s .= "\n<h6>" . htmlspecialchars( $h ) . "</h6>";
+                       }
+                       foreach ( $browseLinks as $link ) {
+                               if ( $link['text'] != '-' ) {
+                                       $s .= "<a href=\"{$link['href']}\">" .
+                                               htmlspecialchars( $link['text'] ) . '</a>' . $sep;
+                               }
                        }
+                       $barnumber = $barnumber + 1;
                }
 
                if ( $wgOut->isArticle() ) {
index 38ed860..a8f304f 100644 (file)
@@ -118,25 +118,33 @@ class StandardTemplate extends LegacyTemplate {
                unset( $bar['SEARCH'] );
                unset( $bar['LANGUAGES'] );
                unset( $bar['TOOLBOX'] );
-               $browseLinks = reset( $bar );
 
-               foreach ( $browseLinks as $link ) {
-                       if ( $link['text'] != '-' ) {
-                               $s .= "<a href=\"{$link['href']}\">" .
-                                       htmlspecialchars( $link['text'] ) . '</a>' . $sep;
+               $barnumber = 1;
+               foreach ( $bar as $heading => $browseLinks ) {
+                       if ( $barnumber > 1 ) {
+                               $s .= "\n<hr class='sep' />";
+                       } 
+                       foreach ( $browseLinks as $link ) {
+                               if ( $link['text'] != '-' ) {
+                                       $s .= "<a href=\"{$link['href']}\">" .
+                                               htmlspecialchars( $link['text'] ) . '</a>' . $sep;
+                               }
                        }
+                       if ( $barnumber == 1 ) {
+                               // only show watchlist link if logged in
+                               if( $wgUser->isLoggedIn() ) {
+                                       $s.= $this->getSkin()->specialLink( 'Watchlist' ) ;
+                                       $s .= $sep . $this->getSkin()->linkKnown(
+                                               SpecialPage::getTitleFor( 'Contributions' ),
+                                               wfMsg( 'mycontris' ),
+                                               array(),
+                                               array( 'target' => $wgUser->getName() )
+                                       );
+                               }
+                       }
+                       $barnumber = $barnumber + 1;
                }
 
-               if( $wgUser->isLoggedIn() ) {
-                       $s.= $this->getSkin()->specialLink( 'Watchlist' ) ;
-                       $s .= $sep . $this->getSkin()->linkKnown(
-                               SpecialPage::getTitleFor( 'Contributions' ),
-                               wfMsg( 'mycontris' ),
-                               array(),
-                               array( 'target' => $wgUser->getName() )
-                       );
-               }
-               // only show watchlist link if logged in
                $s .= "\n<hr class='sep' />";
                $articleExists = $this->getSkin()->getTitle()->getArticleId();
                if ( $wgOut->isArticle() || $action == 'edit' || $action == 'history' || $wpPreview ) {