Move the text direction class from <html> to <body>, HTML doesn't allow class on...
[lhc/web/wiklou.git] / skins / CologneBlue.php
index 729739b..969526d 100644 (file)
@@ -1,12 +1,15 @@
 <?php
 /**
- * See skin.doc
+ * See skin.txt
  *
  * @todo document
  * @package MediaWiki
  * @subpackage Skins
  */
 
+if( !defined( 'MEDIAWIKI' ) )
+       die( -1 );
+
 /**
  * @todo document
  * @package MediaWiki
 class SkinCologneBlue extends Skin {
 
        function getStylesheet() {
-               return "common/cologneblue.css";
+               return "common/cologneblue.css?1";
        }
        function getSkinName() {
                return "cologneblue";
        }
 
        function doBeforeContent() {
-               global $wgUser, $wgOut, $wgTitle, $wgSiteNotice;
+               global $wgOut, $wgTitle;
 
                $s = "";
                $qb = $this->qbSetting();
                $mainPageObj = Title::newMainPage();
-               
+
                $s .= "\n<div id='content'>\n<div id='topbar'>" .
                  "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
 
@@ -44,7 +47,7 @@ class SkinCologneBlue extends Skin {
                $s .= "</td><td align='right'>" ;
 
                $s .= "<font size='-1'><span id='langlinks'>" ;
-               $s .= str_replace ( "<br>" , "" , $this->otherLanguages() );
+               $s .= str_replace ( "<br />" , "" , $this->otherLanguages() );
                $cat = $this->getCategoryLinks();
                if( $cat ) $s .= "<br />$cat\n";
                $s .= "<br />" . $this->pageTitleLinks();
@@ -54,8 +57,9 @@ class SkinCologneBlue extends Skin {
 
                $s .= "\n</div>\n<div id='article'>";
 
-               if( $wgSiteNotice ) {
-                       $s .= "\n<div id='siteNotice'>$wgSiteNotice</div>\n";
+               $notice = wfGetSiteNotice();
+               if( $notice ) {
+                       $s .= "\n<div id='siteNotice'>$notice</div>\n";
                }
                $s .= $this->pageTitle();
                $s .= $this->pageSubtitle() . "\n";
@@ -64,7 +68,7 @@ class SkinCologneBlue extends Skin {
 
        function doAfterContent()
        {
-               global $wgUser, $wgOut;
+               global $wgOut;
 
                $s = "\n</div><br clear='all' />\n";
 
@@ -93,10 +97,10 @@ class SkinCologneBlue extends Skin {
                if ( 0 != $qb ) { $s .= $this->quickBar(); }
                return $s;
        }
-       function doGetUserStyles()
-       {
-               global $wgUser, $wgOut, $wgStyleSheetPath;
-               $s = '';
+
+       function doGetUserStyles() {
+               global $wgOut, $wgStyleSheetPath;
+               $s = parent::doGetUserStyles();
                $qb = $this->qbSetting();
 
                if ( 2 == $qb ) { # Right
@@ -105,17 +109,21 @@ class SkinCologneBlue extends Skin {
                } else if ( 1 == $qb ) {
                        $s .= "#quickbar { position: absolute; left: 4px; }\n" .
                          "#article { margin-left: 148px; margin-right: 4px; }\n";
-               } else if ( 3 == $qb ) { # Floating
+               } else if ( 3 == $qb ) { # Floating left
                        $s .= "#quickbar { position:absolute; left:4px } \n" .
                          "#topbar { margin-left: 148px }\n" .
                          "#article { margin-left:148px; margin-right: 4px; } \n" .
                          "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
+               } else if ( 4 == $qb ) { # Floating right
+                       $s .= "#quickbar { position: fixed; right: 4px; } \n" .
+                         "#topbar { margin-right: 148px }\n" .
+                         "#article { margin-right: 148px; margin-left: 4px; } \n" .
+                         "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
                }
-               $s .= parent::doGetUserStyles();
                return $s;
        }
-       function sysLinks()
-       {
+
+       function sysLinks() {
                global $wgUser, $wgContLang, $wgTitle;
                $li = $wgContLang->specialPage("Userlogin");
                $lo = $wgContLang->specialPage("Userlogout");
@@ -123,10 +131,10 @@ class SkinCologneBlue extends Skin {
                $rt = $wgTitle->getPrefixedURL();
                if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
                        $q = "";
-               } else { 
-                       $q = "returnto={$rt}"; 
+               } else {
+                       $q = "returnto={$rt}";
                }
-               
+
                $s = "" .
                  $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
                  . " | " .
@@ -138,25 +146,37 @@ class SkinCologneBlue extends Skin {
                  . " | " .
                  $this->specialLink( "specialpages" ) . " | ";
 
-               if ( $wgUser->getID() )
-               {
+               if ( $wgUser->isLoggedIn() ) {
                        $s .=  $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
-               }
-               else
-               {
+               } else {
                        $s .=  $this->makeKnownLink( $li, wfMsg( "login" ), $q );
                }
 
+               /* show links to different language variants */
+               global $wgDisableLangConversion;
+               $variants = $wgContLang->getVariants();
+               if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
+                       $actstr = '';
+                       foreach( $variants as $code ) {
+                               $varname = $wgContLang->getVariantname( $code );
+                               if( $varname == 'disable' )
+                                       continue;
+                               $s .= ' | <a href="' . $wgTitle->getLocalUrl( 'variant=' . $code ) . '">' . $varname . '</a>';
+                       }
+               }
+
+
+
                return $s;
        }
 
        /**
         * Compute the sidebar
-        * @private
+        * @access private
         */
        function quickBar()
        {
-               global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgDisableUploads, $wgNavigationLinks;
+               global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
 
                $tns=$wgTitle->getNamespace();
 
@@ -168,11 +188,14 @@ class SkinCologneBlue extends Skin {
 
                $s .= $this->menuHead( "qbbrowse" );
 
-               foreach ( $wgNavigationLinks as $link ) {
-                       $msg = wfMsgForContent( $link['href'] );
-                       if ( $msg != '-' ) {
-                               $s .= '<a href="' . $this->makeInternalOrExternalUrl( $msg ) . '">' .
-                                       wfMsg( $link['text'] ) . '</a>' . $sep;
+               # Use the first heading from the Monobook sidebar as the "browse" section
+               $bar = $this->buildSidebar();
+               $browseLinks = reset( $bar );
+
+               foreach ( $browseLinks as $link ) {
+                       if ( $link['text'] != '-' ) {
+                               $s .= "<a href=\"{$link['href']}\">" .
+                                       htmlspecialchars( $link['text'] ) . '</a>' . $sep;
                        }
                }
 
@@ -182,7 +205,7 @@ class SkinCologneBlue extends Skin {
 
                        $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
 
-                       if ( 0 != $wgUser->getID() ) {
+                       if( $wgUser->isLoggedIn() ) {
                                $s .= $sep . $this->moveThisPage();
                        }
                        if ( $wgUser->isAllowed('delete') ) {
@@ -201,9 +224,9 @@ class SkinCologneBlue extends Skin {
 
                        $s .= $this->menuHead( "qbpageoptions" );
                        $s .= $this->talkLink()
-                         . $sep . $this->commentLink() 
+                         . $sep . $this->commentLink()
                          . $sep . $this->printableLink();
-                       if ( 0 != $wgUser->getID() ) {
+                       if ( $wgUser->isLoggedIn() ) {
                                $s .= $sep . $this->watchThisPage();
                        }
 
@@ -213,8 +236,8 @@ class SkinCologneBlue extends Skin {
                          . $this->historyLink()
                          . $sep . $this->whatLinksHere()
                          . $sep . $this->watchPageLinksLink();
-                         
-                       if ( Namespace::getUser() == $tns || Namespace::getTalk(Namespace::getUser()) == $tns ) {
+
+                       if( $tns == NS_USER || $tns == NS_USER_TALK ) {
                                $id=User::idFromName($wgTitle->getText());
                                if ($id != 0) {
                                        $s .= $sep . $this->userContribsLink();
@@ -227,19 +250,20 @@ class SkinCologneBlue extends Skin {
                }
 
                $s .= $this->menuHead( "qbmyoptions" );
-               if ( 0 != $wgUser->getID() ) {
+               if ( $wgUser->isLoggedIn() ) {
                        $name = $wgUser->getName();
-                       $tl = $this->makeKnownLink( $wgContLang->getNsText(
-                         Namespace::getTalk( Namespace::getUser() ) ) . ":{$name}",
-                         wfMsg( "mytalk" ) );
-                       if ( 0 != $wgUser->getNewtalk() ) { $tl .= " *"; }
+                       $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
+                               wfMsg( 'mytalk' ) );
+                       if ( $wgUser->getNewtalk() ) {
+                               $tl .= " *";
+                       }
 
-                       $s .= $this->makeKnownLink( $wgContLang->getNsText(
-                         Namespace::getUser() ) . ":{$name}", wfMsg( "mypage" ) )
+                       $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
+                               wfMsg( "mypage" ) )
                          . $sep . $tl
                          . $sep . $this->specialLink( "watchlist" )
-                         . $sep . $this->makeKnownLink( $wgContLang->specialPage( "Contributions" ),
-                               wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )            
+                         . $sep . $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions" ),
+                               wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
                          . $sep . $this->specialLink( "preferences" )
                          . $sep . $this->specialLink( "userlogout" );
                } else {
@@ -247,11 +271,11 @@ class SkinCologneBlue extends Skin {
                }
 
                $s .= $this->menuHead( "qbspecialpages" )
-                 . $this->specialLink( "newpages" ) 
-                 . $sep . $this->specialLink( "imagelist" ) 
-                 . $sep . $this->specialLink( "statistics" ) 
+                 . $this->specialLink( "newpages" )
+                 . $sep . $this->specialLink( "imagelist" )
+                 . $sep . $this->specialLink( "statistics" )
                  . $sep . $this->bugReportsLink();
-               if ( 0 != $wgUser->getID() && !$wgDisableUploads ) {
+               if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
                        $s .= $sep . $this->specialLink( "upload" );
                }
                global $wgSiteSupportPage;
@@ -259,8 +283,10 @@ class SkinCologneBlue extends Skin {
                        $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
                              .wfMsg( "sitesupport" )."</a>";
                }
-               
-               $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( "Specialpages" ), wfMsg("moredotdotdot") );
+
+               $s .= $sep . $this->makeKnownLinkObj(
+                       Title::makeTitle( NS_SPECIAL, 'Specialpages' ),
+                       wfMsg( 'moredotdotdot' ) );
 
                $s .= $sep . "\n</div>\n";
                return $s;