r37379 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37378‎ | r37379 | r37380 >
Date:10:25, 9 July 2008
Author:rotem
Status:old
Tags:
Comment:
RTL compatibility.
Modified paths:
  • /trunk/extensions/Quiz/Quiz.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Quiz/Quiz.php
@@ -204,11 +204,14 @@
205205 function parseQuiz($input) {
206206 # Ouput the style and the script to the header once for all.
207207 if($this->mQuizId == 0) {
 208+ global $wgContLang;
 209+ $start = $wgContLang->isRTL() ? "right" : "left";
 210+ $end = $wgContLang->isRTL() ? "left" : "right";
208211 $head = "<style type=\"text/css\">\n";
209212 $head .= ".quiz .settings input.numerical { width:2em; }\n";
210 - $head .= ".quiz .question { margin-left:2em; }\n";
211 - $head .= ".quiz .margin { padding-left:20px; }\n";
212 - $head .= ".quiz .header .questionId {font-size: 1.1em; font-weight: bold; float: left;}\n";
 213+ $head .= ".quiz .question { margin-$start:2em; }\n";
 214+ $head .= ".quiz .margin { padding-$start:20px; }\n";
 215+ $head .= ".quiz .header .questionId {font-size: 1.1em; font-weight: bold; float: $start;}\n";
213216 $head .= "*>.quiz .header .questionId {text-indent: -1.5em; }\n"; // *> prevent ie6 to interprate it.
214217 $head .= ".quiz table.object, .quiz table.correction { background-color:transparent; }";
215218 $head .= ".quiz .correction { background-color: ".Quiz::getColor('correction').";}\n";
@@ -220,8 +223,8 @@
221224 # Part for the inputfields
222225 $head .= ".quiz a.input, .quiz a.input:hover, .quiz a.input:active, .quiz a.input:visited { text-decoration:none; color:black; outline:0 }\n";
223226 $head .= ".quiz a.input span { outline:#7F9DB9 solid 1px; *border:1px solid #7F9DB9; }\n"; // *border is for IE6/7
224 - $head .= ".quiz a.input em { color:black; background-color:#DFDFDF; margin-right:1px; }\n";
225 - $head .= ".quiz a.input input { padding-left:2px; border:0; }\n";
 227+ $head .= ".quiz a.input em { color:black; background-color:#DFDFDF; margin-$end:1px; }\n";
 228+ $head .= ".quiz a.input input { padding-$start:2px; border:0; }\n";
226229 $head .= ".quiz a.input span.correction { padding:3px; margin:0; list-style-type:none; display:none; background-color:".Quiz::getColor("correction")."; }\n";
227230 $head .= ".quiz a.input:active span.correction, .quiz a.input:focus span.correction { display:inline; position:absolute; margin:1.8em 0 0 0.1em; }\n";
228231 $head .= "</style>\n";
@@ -394,9 +397,11 @@
395398 $buffer = call_user_func(array($question, "{$question->mType}ParseObject"), $matches[3]);
396399 $output .= "<table class=\"object\" ";
397400 $lState = $question->getState();
398 - # Determine the border-left color, title, score and the total of the question.
 401+ # Determine the side border color, title, score and the total of the question.
399402 if($lState != "") {
400 - $output .= "style=\"border-left:3px solid ".$this->getColor($lState)."\"";
 403+ global $wgContLang;
 404+ $border = $wgContLang->isRTL() ? "border-right" : "border-left";
 405+ $output .= "style=\"$border:3px solid ".$this->getColor($lState)."\"";
401406 if($this->mIgnoringCoef) {
402407 $question->mCoef = 1;
403408 }
@@ -826,7 +831,9 @@
827832 }
828833 }
829834 if($state == "error" || $this->mBeingCorrected) {
830 - $style = "style=\"border-left:3px solid ".Quiz::getColor($state)."; \"";
 835+ global $wgContLang;
 836+ $border = $wgContLang->isRTL() ? "border-right" : "border-left";
 837+ $style = "style=\"$border:3px solid ".Quiz::getColor($state)."; \"";
831838 $this->setState(empty($value)? "new_NA" : $state);
832839 if($state == "error") {
833840 $size = "";

Status & tagging log