From 73f0366e23368cdd043593d0226e6dbc3fc72eb7 Mon Sep 17 00:00:00 2001 From: Robin Pepermans Date: Tue, 20 Sep 2011 19:47:57 +0000 Subject: [PATCH] Fix support of legacy skins Standard & CologneBlue for user language direction: the topbar and footer used a "quickbar compensator" which relied on the topbar and footer following the content language direction. Therefore it's easier to do it via CSS (which simplifies PHP code). See also bug 31031. --- includes/SkinLegacy.php | 25 +++++++++---------------- skins/CologneBlue.php | 13 +++++-------- skins/Standard.php | 27 ++++++++------------------- 3 files changed, 22 insertions(+), 43 deletions(-) diff --git a/includes/SkinLegacy.php b/includes/SkinLegacy.php index f8ff1e3b35..d636883656 100644 --- a/includes/SkinLegacy.php +++ b/includes/SkinLegacy.php @@ -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
\n
\n" . - "\n\n"; + "
\n\n"; - $shove = ( $qb != 0 ); - $left = ( $qb == 1 || $qb == 3 ); - - if ( !$shove ) { + if ( $this->getSkin()->qbSetting() == 0 ) { $s .= "'; - } elseif ( $left ) { - $s .= $this->getQuickbarCompensator( $rows ); + $this->getSkin()->logoText( $wgLang->alignStart() ) . ''; } - $l = $wgContLang->alignStart(); + $l = $wgLang->alignStart(); $s .= "\n'; @@ -134,10 +128,6 @@ class LegacyTemplate extends BaseTemplate { $s .= "\n\n\n"; } - if ( $shove && !$left ) { # Right - $s .= $this->getQuickbarCompensator( $rows ); - } - $s .= "\n
\n" . - $this->getSkin()->logoText() . '\n"; $s .= $this->topLinks(); $s .= '

' . $this->pageTitleLinks() . "

\n"; - $r = $wgContLang->alignEnd(); + $r = $wgLang->alignEnd(); $s .= "
"; $s .= $this->nameAndLogin(); $s .= "\n
" . $this->searchForm() . '
$langlinks
\n
\n"; $s .= "\n
\n"; @@ -593,6 +583,9 @@ class LegacyTemplate extends BaseTemplate { return $wgLang->pipeList( $s ); } + /** + * @deprecated in 1.19 + */ function getQuickbarCompensator( $rows = 1 ) { return " "; } diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index 3e5bc0f310..12d0926620 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -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\n
\n"; - if ( 0 != $qb ) { + if ( $this->getSkin()->qbSetting() != 0 ) { $s .= $this->quickBar(); } return $s; diff --git a/skins/Standard.php b/skins/Standard.php index fd063ed052..c3e189daee 100644 --- a/skins/Standard.php +++ b/skins/Standard.php @@ -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 .= ""; $s .= $this->bottomLinks(); @@ -86,17 +78,14 @@ class StandardTemplate extends LegacyTemplate { . '
' . $this->pageStats() . ''; $s .= ''; - if ( $shove && !$left ) { # Right - $s .= $this->getQuickbarCompensator(); - } $s .= "\n
\n\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; } -- 2.20.1