Fix support of legacy skins Standard & CologneBlue for user language direction: the...
authorRobin Pepermans <robin@users.mediawiki.org>
Tue, 20 Sep 2011 19:47:57 +0000 (19:47 +0000)
committerRobin Pepermans <robin@users.mediawiki.org>
Tue, 20 Sep 2011 19:47:57 +0000 (19:47 +0000)
Therefore it's easier to do it via CSS (which simplifies PHP code).
See also bug 31031.

includes/SkinLegacy.php
skins/CologneBlue.php
skins/Standard.php

index f8ff1e3..d636883 100644 (file)
@@ -90,11 +90,10 @@ class LegacyTemplate extends BaseTemplate {
        }
 
        function doBeforeContent() {
-               global $wgContLang;
+               global $wgLang;
                wfProfileIn( __METHOD__ );
 
                $s = '';
-               $qb = $this->getSkin()->qbSetting();
 
                $langlinks = $this->otherLanguages();
                if ( $langlinks ) {
@@ -107,25 +106,20 @@ class LegacyTemplate extends BaseTemplate {
                }
 
                $s .= "\n<div id='content'>\n<div id='topbar'>\n" .
-                 "<table border='0' cellspacing='0' width='98%'>\n<tr>\n";
+                 "<table border='0' cellspacing='0' width='100%'>\n<tr>\n";
 
-               $shove = ( $qb != 0 );
-               $left = ( $qb == 1 || $qb == 3 );
-
-               if ( !$shove ) {
+               if ( $this->getSkin()->qbSetting() == 0 ) {
                        $s .= "<td class='top' align='left' valign='top' rowspan='{$rows}'>\n" .
-                               $this->getSkin()->logoText() . '</td>';
-               } elseif ( $left ) {
-                       $s .= $this->getQuickbarCompensator( $rows );
+                               $this->getSkin()->logoText( $wgLang->alignStart() ) . '</td>';
                }
 
-               $l = $wgContLang->alignStart();
+               $l = $wgLang->alignStart();
                $s .= "<td {$borderhack} align='$l' valign='top'>\n";
 
                $s .= $this->topLinks();
                $s .= '<p class="subtitle">' . $this->pageTitleLinks() . "</p>\n";
 
-               $r = $wgContLang->alignEnd();
+               $r = $wgLang->alignEnd();
                $s .= "</td>\n<td {$borderhack} valign='top' align='$r' nowrap='nowrap'>";
                $s .= $this->nameAndLogin();
                $s .= "\n<br />" . $this->searchForm() . '</td>';
@@ -134,10 +128,6 @@ class LegacyTemplate extends BaseTemplate {
                        $s .= "</tr>\n<tr>\n<td class='top' colspan=\"2\">$langlinks</td>\n";
                }
 
-               if ( $shove && !$left ) { # Right
-                       $s .= $this->getQuickbarCompensator( $rows );
-               }
-
                $s .= "</tr>\n</table>\n</div>\n";
                $s .= "\n<div id='article'>\n";
 
@@ -593,6 +583,9 @@ class LegacyTemplate extends BaseTemplate {
                return $wgLang->pipeList( $s );
        }
 
+       /**
+        * @deprecated in 1.19
+        */
        function getQuickbarCompensator( $rows = 1 ) {
                return "<td width='152' rowspan='{$rows}'>&#160;</td>";
        }
index 3e5bc0f..12d0926 100644 (file)
@@ -32,19 +32,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 */#topbar, #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 */#topbar, #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 */#topbar, #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 */#topbar, #footer { margin-left: 152px; }";
                }
                $style = implode( "\n", $rules );
                $out->addInlineStyle( $style, 'flip' );
@@ -105,10 +109,6 @@ 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();
@@ -127,12 +127,9 @@ class CologneBlueTemplate extends LegacyTemplate {
                $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;
index fd063ed..c3e189d 100644 (file)
@@ -31,9 +31,11 @@ class SkinStandard extends SkinLegacy {
                if ( 2 == $qb ) { # Right
                        $rules[] = "/* @noflip */#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
                        $rules[] = "/* @noflip */#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
+                       $rules[] = "/* @noflip */#topbar, #footer { margin-right: 152px; }";
                } elseif ( 1 == $qb || 3 == $qb ) {
                        $rules[] = "/* @noflip */#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
                        $rules[] = "/* @noflip */#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
+                       $rules[] = "/* @noflip */#topbar, #footer { margin-left: 152px; }";
                        if( 3 == $qb ) {
                                $rules[] = "/* @noflip */#quickbar { position: fixed; padding: 4px; }";
                        }
@@ -41,6 +43,7 @@ class SkinStandard extends SkinLegacy {
                        $rules[] = "/* @noflip */#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}";
                        $rules[] = "/* @noflip */#quickbar { border-right: 1px solid gray; }";
                        $rules[] = "/* @noflip */#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
+                       $rules[] = "/* @noflip */#topbar, #footer { margin-right: 152px; }";
                }
                $style = implode( "\n", $rules );
                $out->addInlineStyle( $style, 'flip' );
@@ -54,7 +57,6 @@ class StandardTemplate extends LegacyTemplate {
         * @return string
         */
        function doAfterContent() {
-               global $wgContLang;
                wfProfileIn( __METHOD__ );
                wfProfileIn( __METHOD__ . '-1' );
 
@@ -64,17 +66,7 @@ class StandardTemplate extends LegacyTemplate {
 
                wfProfileOut( __METHOD__ . '-1' );
                wfProfileIn( __METHOD__ . '-2' );
-
-               $qb = $this->getSkin()->qbSetting();
-               $shove = ( $qb != 0 );
-               $left = ( $qb == 1 || $qb == 3 );
-
-               if ( $shove && $left ) { # Left
-                       $s .= $this->getQuickbarCompensator();
-               }
-               wfProfileOut( __METHOD__ . '-2' );
-               wfProfileIn( __METHOD__ . '-3' );
-               $l = $wgContLang->alignStart();
+               $l = $this->getSkin()->getLang()->alignStart();
                $s .= "<td class='bottom' align='$l' valign='top'>";
 
                $s .= $this->bottomLinks();
@@ -86,17 +78,14 @@ class StandardTemplate extends LegacyTemplate {
                        . '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
 
                $s .= '</td>';
-               if ( $shove && !$left ) { # Right
-                       $s .= $this->getQuickbarCompensator();
-               }
                $s .= "</tr></table>\n</div>\n</div>\n";
 
-               wfProfileOut( __METHOD__ . '-3' );
-               wfProfileIn( __METHOD__ . '-4' );
-               if ( 0 != $qb ) {
+               wfProfileOut( __METHOD__ . '-2' );
+               wfProfileIn( __METHOD__ . '-3' );
+               if ( $this->getSkin()->qbSetting() != 0 ) {
                        $s .= $this->quickBar();
                }
-               wfProfileOut( __METHOD__ . '-4' );
+               wfProfileOut( __METHOD__ . '-3' );
                wfProfileOut( __METHOD__ );
                return $s;
        }