merging latest master
[lhc/web/wiklou.git] / skins / CologneBlue.php
index ad0dc6f..155dace 100644 (file)
@@ -2,6 +2,21 @@
 /**
  * Cologne Blue: A nicer-looking alternative to Standard.
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
  * @todo document
  * @file
  * @ingroup Skins
@@ -32,19 +47,23 @@ class SkinCologneBlue extends SkinLegacy {
                if ( 2 == $qb ) { # Right
                        $rules[] = "/* @noflip */#quickbar { position: absolute; right: 4px; }";
                        $rules[] = "/* @noflip */#article { margin-left: 4px; margin-right: 148px; }";
+                       $rules[] = "/* @noflip */#footer { margin-right: 152px; }";
                } elseif ( 1 == $qb ) {
                        $rules[] = "/* @noflip */#quickbar { position: absolute; left: 4px; }";
                        $rules[] = "/* @noflip */#article { margin-left: 148px; margin-right: 4px; }";
+                       $rules[] = "/* @noflip */#footer { margin-left: 152px; }";
                } elseif ( 3 == $qb ) { # Floating left
                        $rules[] = "/* @noflip */#quickbar { position:absolute; left:4px }";
                        $rules[] = "/* @noflip */#topbar { margin-left: 148px }";
                        $rules[] = "/* @noflip */#article { margin-left:148px; margin-right: 4px; }";
                        $rules[] = "/* @noflip */body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto; bottom:4px;}"; # Hides from IE
+                       $rules[] = "/* @noflip */#footer { margin-left: 152px; }";
                } elseif ( 4 == $qb ) { # Floating right
                        $rules[] = "/* @noflip */#quickbar { position: fixed; right: 4px; }";
                        $rules[] = "/* @noflip */#topbar { margin-right: 148px }";
                        $rules[] = "/* @noflip */#article { margin-right: 148px; margin-left: 4px; }";
                        $rules[] = "/* @noflip */body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto; bottom:4px;}"; # Hides from IE
+                       $rules[] = "/* @noflip */#footer { margin-right: 152px; }";
                }
                $style = implode( "\n", $rules );
                $out->addInlineStyle( $style, 'flip' );
@@ -64,23 +83,22 @@ class CologneBlueTemplate extends LegacyTemplate {
                  '<table width="100%" border="0" cellspacing="0" cellpadding="8"><tr>';
 
                $s .= '<td class="top" nowrap="nowrap">';
-               $s .= '<a href="' . $mainPageObj->escapeLocalURL() . '">';
-               $s .= '<span id="sitetitle">' . wfMsg( 'sitetitle' ) . '</span></a>';
+               $s .= '<a href="' . htmlspecialchars( $mainPageObj->getLocalURL() ) . '">';
+               $s .= '<span id="sitetitle">' . $this->msg( 'sitetitle' )->text() . '</span></a>';
 
                $s .= '</td><td class="top" id="top-syslinks" width="100%">';
                $s .= $this->sysLinks();
-               $s .= '</td></tr><tr><td class="top-linkcollection">';
+               $s .= '</td></tr><tr><td class="top-subheader">';
 
                $s .= '<font size="-1"><span id="sitesub">';
-               $s .= htmlspecialchars( wfMsg( 'sitesubtitle' ) ) . '</span></font>';
+               $s .= htmlspecialchars( $this->msg( 'sitesubtitle' )->text() ) . '</span></font>';
                $s .= '</td><td class="top-linkcollection">';
 
                $s .= '<font size="-1"><span id="langlinks">';
                $s .= str_replace( '<br />', '', $this->otherLanguages() );
-               $cat = '<div id="catlinks" class="catlinks">' . $this->getSkin()->getCategoryLinks() . '</div>';
-               if( $cat ) {
-                       $s .= "<br />$cat\n";
-               }
+
+               $s .= $this->getSkin()->getCategories();
+
                $s .= '<br />' . $this->pageTitleLinks();
                $s .= '</span></font>';
 
@@ -106,14 +124,10 @@ class CologneBlueTemplate extends LegacyTemplate {
                $s .= "\n<div id='footer'>";
                $s .= '<table width="98%" border="0" cellspacing="0"><tr>';
 
-               $qb = $this->getSkin()->qbSetting();
-               if ( 1 == $qb || 3 == $qb ) { # Left
-                       $s .= $this->getQuickbarCompensator();
-               }
                $s .= '<td class="bottom">';
 
                $s .= $this->bottomLinks();
-               $s .= $this->getSkin()->getLang()->pipeList( array(
+               $s .= $this->getSkin()->getLanguage()->pipeList( array(
                        "\n<br />" . Linker::link(
                                Title::newMainPage(),
                                null,
@@ -122,18 +136,15 @@ class CologneBlueTemplate extends LegacyTemplate {
                                array( 'known', 'noclasses' )
                        ),
                        $this->getSkin()->aboutLink(),
-                       $this->searchForm( wfMsg( 'qbfind' ) )
+                       $this->searchForm( $this->msg( 'qbfind' )->text() )
                ) );
 
                $s .= "\n<br />" . $this->pageStats();
 
                $s .= '</td>';
-               if ( 2 == $qb ) { # Right
-                       $s .= $this->getQuickbarCompensator();
-               }
                $s .= "</tr></table>\n</div>\n</div>\n";
 
-               if ( 0 != $qb ) {
+               if ( $this->getSkin()->qbSetting() != 0 ) {
                        $s .= $this->quickBar();
                }
                return $s;
@@ -156,16 +167,16 @@ class CologneBlueTemplate extends LegacyTemplate {
                $s = array(
                        $this->getSkin()->mainPageLink(),
                        Linker::linkKnown(
-                               Title::newFromText( wfMsgForContent( 'aboutpage' ) ),
-                               wfMsg( 'about' )
+                               Title::newFromText( $this->msg( 'aboutpage' )->inContentLanguage()->text() ),
+                               $this->msg( 'about' )->text()
                        ),
                        Linker::linkKnown(
-                               Title::newFromText( wfMsgForContent( 'helppage' ) ),
-                               wfMsg( 'help' )
+                               Title::newFromText( $this->msg( 'helppage' )->inContentLanguage()->text() ),
+                               $this->msg( 'help' )->text()
                        ),
                        Linker::linkKnown(
-                               Title::newFromText( wfMsgForContent( 'faqpage' ) ),
-                               wfMsg( 'faq' )
+                               Title::newFromText( $this->msg( 'faqpage' )->inContentLanguage()->text() ),
+                               $this->msg( 'faq' )->text()
                        ),
                        Linker::specialLink( 'Specialpages' )
                );
@@ -180,20 +191,20 @@ class CologneBlueTemplate extends LegacyTemplate {
                if ( $this->data['loggedin'] ) {
                        $s[] = Linker::linkKnown(
                                $lo,
-                               wfMsg( 'logout' ),
+                               $this->msg( 'logout' )->text(),
                                array(),
                                $q
                        );
                } else {
                        $s[] = Linker::linkKnown(
                                $li,
-                               wfMsg( 'login' ),
+                               $this->msg( 'login' )->text(),
                                array(),
                                $q
                        );
                }
 
-               return $this->getSkin()->getLang()->pipeList( $s );
+               return $this->getSkin()->getLanguage()->pipeList( $s );
        }
 
        /**
@@ -203,8 +214,6 @@ class CologneBlueTemplate extends LegacyTemplate {
         * @return string
         */
        function quickBar(){
-               $tns = $this->getSkin()->getTitle()->getNamespace();
-
                $s = "\n<div id='quickbar'>";
 
                $sep = '<br />';
@@ -241,25 +250,27 @@ class CologneBlueTemplate extends LegacyTemplate {
                        $barnumber++;
                }
 
+               $user = $this->getSkin()->getUser();
+
                if ( $this->data['isarticle'] ) {
                        $s .= $this->menuHead( 'qbedit' );
                        $s .= '<strong>' . $this->editThisPage() . '</strong>';
 
                        $s .= $sep . Linker::linkKnown(
-                               Title::newFromText( wfMsgForContent( 'edithelppage' ) ),
-                               wfMsg( 'edithelp' )
+                               Title::newFromText( $this->msg( 'edithelppage' )->inContentLanguage()->text() ),
+                               $this->msg( 'edithelp' )->text()
                        );
 
                        if( $this->data['loggedin'] ) {
                                $s .= $sep . $this->moveThisPage();
                        }
-                       if ( $this->getSkin()->getUser()->isAllowed( 'delete' ) ) {
+                       if ( $user->isAllowed( 'delete' ) ) {
                                $dtp = $this->deleteThisPage();
                                if ( $dtp != '' ) {
                                        $s .= $sep . $dtp;
                                }
                        }
-                       if ( $this->getSkin()->getUser()->isAllowed( 'protect' ) ) {
+                       if ( $user->isAllowed( 'protect' ) ) {
                                $ptp = $this->protectThisPage();
                                if ( $ptp != '' ) {
                                        $s .= $sep . $ptp;
@@ -282,8 +293,10 @@ class CologneBlueTemplate extends LegacyTemplate {
                                        . $sep . $this->whatLinksHere()
                                        . $sep . $this->watchPageLinksLink();
 
-                       if( $tns == NS_USER || $tns == NS_USER_TALK ) {
-                               $id = User::idFromName( $this->getSkin()->getTitle()->getText() );
+                       $title = $this->getSkin()->getTitle();
+                       $tns = $title->getNamespace();
+                       if ( $tns == NS_USER || $tns == NS_USER_TALK ) {
+                               $id = User::idFromName( $title->getText() );
                                if( $id != 0 ) {
                                        $s .= $sep . $this->userContribsLink();
                                        if( $this->getSkin()->showEmailUser( $id ) ) {
@@ -297,27 +310,27 @@ class CologneBlueTemplate extends LegacyTemplate {
                $s .= $this->menuHead( 'qbmyoptions' );
                if ( $this->data['loggedin'] ) {
                        $tl = Linker::link(
-                               $this->getSkin()->getUser()->getTalkPage(),
-                               wfMsg( 'mytalk' ),
+                               $user->getTalkPage(),
+                               $this->msg( 'mytalk' )->text(),
                                array(),
                                array(),
                                array( 'known', 'noclasses' )
                        );
-                       if ( $this->getSkin()->getUser()->getNewtalk() ) {
+                       if ( $user->getNewtalk() ) {
                                $tl .= ' *';
                        }
 
                        $s .= Linker::link(
-                                       $this->getSkin()->getUser()->getUserPage(),
-                                       wfMsg( 'mypage' ),
+                                       $user->getUserPage(),
+                                       $this->msg( 'mypage' )->text(),
                                        array(),
                                        array(),
                                        array( 'known', 'noclasses' )
                                ) . $sep . $tl . $sep . Linker::specialLink( 'Watchlist' )
                                        . $sep .
                                Linker::link(
-                                       SpecialPage::getSafeTitleFor( 'Contributions', $this->getSkin()->getUser()->getName() ),
-                                       wfMsg( 'mycontris' ),
+                                       SpecialPage::getSafeTitleFor( 'Contributions', $user->getName() ),
+                                       $this->msg( 'mycontris' )->text(),
                                        array(),
                                        array(),
                                        array( 'known', 'noclasses' )
@@ -331,7 +344,7 @@ class CologneBlueTemplate extends LegacyTemplate {
                        . Linker::specialLink( 'Newpages' )
                        . $sep . Linker::specialLink( 'Listfiles' )
                        . $sep . Linker::specialLink( 'Statistics' );
-               if( UploadBase::isEnabled() && UploadBase::isAllowed( $this->getSkin()->getUser() ) === true ) {
+               if( UploadBase::isEnabled() && UploadBase::isAllowed( $user ) === true ) {
                        $s .= $sep . $this->getUploadLink();
                }
 
@@ -339,12 +352,12 @@ class CologneBlueTemplate extends LegacyTemplate {
 
                if( $wgSiteSupportPage ) {
                        $s .= $sep . '<a href="' . htmlspecialchars( $wgSiteSupportPage ) . '" class="internal">'
-                                       . wfMsg( 'sitesupport' ) . '</a>';
+                                       . $this->msg( 'sitesupport' )->text() . '</a>';
                }
 
                $s .= $sep . Linker::link(
                        SpecialPage::getTitleFor( 'Specialpages' ),
-                       wfMsg( 'moredotdotdot' ),
+                       $this->msg( 'moredotdotdot' )->text(),
                        array(),
                        array(),
                        array( 'known', 'noclasses' )
@@ -359,7 +372,7 @@ class CologneBlueTemplate extends LegacyTemplate {
         * @return string
         */
        function menuHead( $key ) {
-               $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
+               $s = "\n<h6>" . $this->msg( $key )->text() . "</h6>";
                return $s;
        }
 
@@ -379,12 +392,12 @@ class CologneBlueTemplate extends LegacyTemplate {
 
                $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
                        . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" /><br />"
-                       . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( 'searcharticle' ) ) . "\" />";
+                       . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMessage( 'searcharticle' )->text() ) . "\" />";
 
                if( $wgUseTwoButtonsSearchForm ) {
-                       $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( 'search' ) ) . "\" />\n";
+                       $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( $this->msg( 'search' )->text() ) . "\" />\n";
                } else {
-                       $s .= '<div><a href="' . $action . '" rel="search">' . wfMsg( 'powersearch-legend' ) . "</a></div>\n";
+                       $s .= '<div><a href="' . $action . '" rel="search">' . $this->msg( 'powersearch-legend' )->text() . "</a></div>\n";
                }
 
                $s .= '</form>';