r80034 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80033‎ | r80034 | r80035 >
Date:20:22, 11 January 2011
Author:hartman
Status:resolved (Comments)
Tags:
Comment:
Repair quickbar of standard and cologneblue skins to work under Resourceloader.
Refs bug #26649

Factoring this out into seperate stylesheets seemed silly. Instead just moved
that last css line from skins/common/quickbar.css and skins/common/quickbar-right.css
inline as well.
Modified paths:
  • /trunk/phase3/skins/CologneBlue.php (modified) (history)
  • /trunk/phase3/skins/Standard.php (modified) (history)
  • /trunk/phase3/skins/common/quickbar-right.css (deleted) (history)
  • /trunk/phase3/skins/common/quickbar.css (deleted) (history)

Diff [purge]

Index: trunk/phase3/skins/CologneBlue.php
@@ -106,28 +106,33 @@
107107 return $s;
108108 }
109109
110 - function reallyGenerateUserStylesheet() {
111 - $s = parent::reallyGenerateUserStylesheet();
 110+ function setupSkinUserCss( OutputPage $out ){
 111+ global $wgContLang;
112112 $qb = $this->qbSetting();
113113
114114 if ( 2 == $qb ) { # Right
115 - $s .= "#quickbar { position: absolute; right: 4px; }\n" .
116 - "#article { margin-left: 4px; margin-right: 148px; }\n";
 115+ $rules[] = "#quickbar { position: absolute; right: 4px; }";
 116+ $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
117117 } elseif ( 1 == $qb ) {
118 - $s .= "#quickbar { position: absolute; left: 4px; }\n" .
119 - "#article { margin-left: 148px; margin-right: 4px; }\n";
 118+ $rules[] = "#quickbar { position: absolute; left: 4px; }";
 119+ $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
120120 } elseif ( 3 == $qb ) { # Floating left
121 - $s .= "#quickbar { position:absolute; left:4px } \n" .
122 - "#topbar { margin-left: 148px }\n" .
123 - "#article { margin-left:148px; margin-right: 4px; } \n" .
124 - "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
 121+ $rules[] = "#quickbar { position:absolute; left:4px }";
 122+ $rules[] = "#topbar { margin-left: 148px }";
 123+ $rules[] = "#article { margin-left:148px; margin-right: 4px; }";
 124+ $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}"; # Hides from IE
125125 } elseif ( 4 == $qb ) { # Floating right
126 - $s .= "#quickbar { position: fixed; right: 4px; } \n" .
127 - "#topbar { margin-right: 148px }\n" .
128 - "#article { margin-right: 148px; margin-left: 4px; } \n" .
129 - "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
 126+ $rules[] = "#quickbar { position: fixed; right: 4px; }";
 127+ $rules[] = "#topbar { margin-right: 148px }";
 128+ $rules[] = "#article { margin-right: 148px; margin-left: 4px; }";
 129+ $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}"; # Hides from IE
130130 }
131 - return $s;
 131+ $style = implode( "\n", $rules );
 132+ if ( $wgContLang->getDir() === 'rtl' ) {
 133+ $style = CSSJanus::transform( $style, true, false );
 134+ }
 135+ $out->addInlineStyle( $style );
 136+ parent::setupSkinUserCss( $out );
132137 }
133138
134139 function sysLinks() {
Index: trunk/phase3/skins/Standard.php
@@ -20,34 +20,28 @@
2121 *
2222 */
2323 function setupSkinUserCss( OutputPage $out ){
24 - if ( 3 == $this->qbSetting() ) { # Floating left
25 - $out->addStyle( 'common/quickbar.css' );
26 - } elseif ( 4 == $this->qbSetting() ) { # Floating right
27 - $out->addStyle( 'common/quickbar-right.css' );
28 - }
29 - parent::setupSkinUserCss( $out );
30 - }
31 -
32 - /**
33 - *
34 - */
35 - function reallyGenerateUserStylesheet() {
36 - $s = parent::reallyGenerateUserStylesheet();
 24+ global $wgContLang;
3725 $qb = $this->qbSetting();
38 -
3926 if ( 2 == $qb ) { # Right
40 - $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
41 - "border-left: 2px solid #000000; }\n" .
42 - "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }\n";
 27+ $rules[] = "#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
 28+ $rules[] = "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
4329 } elseif ( 1 == $qb || 3 == $qb ) {
44 - $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
45 - "border-right: 1px solid gray; }\n" .
46 - "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }\n";
 30+ $rules[] = "#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
 31+ $rules[] = "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
 32+ if( 3 == $qb ) {
 33+ $rules[] = "#quickbar { position: fixed; padding: 4px; }";
 34+ }
4735 } elseif ( 4 == $qb ) {
48 - $s .= "#quickbar { border-right: 1px solid gray; }\n" .
49 - "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }\n";
 36+ $rules[] = "#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}";
 37+ $rules[] = "#quickbar { border-right: 1px solid gray; }";
 38+ $rules[] = "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
5039 }
51 - return $s;
 40+ $style = implode( "\n", $rules );
 41+ if ( $wgContLang->getDir() === 'rtl' ) {
 42+ $style = CSSJanus::transform( $style, true, false );
 43+ }
 44+ $out->addInlineStyle( $style );
 45+ parent::setupSkinUserCss( $out );
5246 }
5347
5448 function doAfterContent() {
Index: trunk/phase3/skins/common/quickbar.css
@@ -1 +0,0 @@
2 -#quickbar { position: fixed; padding: 4px; }
Index: trunk/phase3/skins/common/quickbar-right.css
@@ -1 +0,0 @@
2 -#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}

Follow-up revisions

RevisionCommit summaryAuthorDate
r801751.17: MFT r79960, r80034, r80036, r80043, r80044, r80050, r80053, r80074, r80...catrope17:13, 13 January 2011
r80472Followup r80034. Make sure that $rules actually exists, otherwise we might ge...hartman23:05, 17 January 2011

Comments

#Comment by Catrope (talk | contribs)   20:34, 12 January 2011

This is fine for in 1.17 but we should really find a cleaner way to handle this some time.

#Comment by TheDJ (talk | contribs)   09:26, 17 January 2011

Needs a $rules = array() before the ifs, to make sure $rules exists before we implode the array. Will do when I get home.

Status & tagging log