Index: trunk/extensions/Quiz/Quiz.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | * * Add this line at the end of your LocalSettings.php file : |
30 | 30 | * require_once 'extensions/quiz/Quiz.php'; |
31 | 31 | * |
32 | | - * @version 0.5b |
| 32 | + * @version 0.6b |
33 | 33 | * @link http://www.mediawiki.org/wiki/Extension:Quiz |
34 | 34 | * |
35 | 35 | * @author BABE Louis-R�mi <lrbabe@gmail.com> |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | */ |
41 | 41 | $wgExtensionCredits['parserhook'][] = array( |
42 | 42 | 'name'=>'Quiz', |
43 | | - 'version'=>'0.5b', |
| 43 | + 'version'=>'0.6b', |
44 | 44 | 'author'=>'lrbabe', |
45 | 45 | 'url'=>'http://www.mediawiki.org/wiki/Extension:Quiz', |
46 | 46 | 'description' => 'Quiz tool for MediaWiki' |
— | — | @@ -199,6 +199,8 @@ |
200 | 200 | $head .= ".quiz .correction { background-color: ".$this->getColor('correction').";}\n"; |
201 | 201 | $head .= ".quiz .hideCorrection .correction { display: none; }\n"; |
202 | 202 | $head .= ".quiz .settings td { padding: 0.1em 0.4em 0.1em 0.4em }\n"; |
| 203 | + $head .= ".quiz .sign {text-align:center; }\n"; |
| 204 | + $head .= ".quiz .sign>input {border: none !important; }\n"; |
203 | 205 | $head .= "</style>\n"; |
204 | 206 | global $wgJsMimeType, $wgScriptPath, $wgOut; |
205 | 207 | $head .= "<script type=\"$wgJsMimeType\" src=\"$wgScriptPath/extensions/quiz/quiz.js\"></script>\n"; |
— | — | @@ -210,21 +212,21 @@ |
211 | 213 | $output .= "<table class=\"settings\"><tbody>"; |
212 | 214 | $output .= "<tr><td>".wfMsgHtml('quiz_addedPoints')." : </td>" . |
213 | 215 | "<td><input class=\"text\" type=\"text\" name=\"addedPoints\" value=\"$this->mAddedPoints\"/></td><td></td>" . |
214 | | - "<td>".wfMsgHtml('quiz_colorError')." : </td>" . |
215 | | - "<td style=\"background: ".$this->getColor('error')."\"></td></tr>"; |
| 216 | + "<td style=\"background: ".$this->getColor('error')."\"></td>" . |
| 217 | + "<td>".wfMsgHtml('quiz_colorError')."</td></tr>"; |
216 | 218 | $output .= "<tr><td>".wfMsgHtml('quiz_cutoffPoints')." : </td>" . |
217 | 219 | "<td><input class=\"text\" type=\"text\" name=\"cutoffPoints\" value=\"$this->mCutoffPoints\"/></td><td></td>" . |
218 | | - "<td class=\"correction\" style=\"background: transparent;\">".wfMsgHtml('quiz_colorRight')." : </td>" . |
219 | | - "<td class=\"correction\" style=\"background: ".$this->getColor('right')."\"></td></tr>"; |
220 | | - $bChecked = ($this->mIgnoringCoef)? "checked" : ""; |
| 220 | + "<td class=\"correction\" style=\"background: ".$this->getColor('right')."\"></td>" . |
| 221 | + "<td class=\"correction\" style=\"background: transparent;\">".wfMsgHtml('quiz_colorRight')."</td></tr>"; |
| 222 | + $bChecked = ($this->mIgnoringCoef)? "checked=\"checked\"" : ""; |
221 | 223 | $output .= "<tr><td>".wfMsgHtml('quiz_ignoreCoef')." : </td>" . |
222 | 224 | "<td><input type=\"checkbox\" name=\"ignoringCoef\" $bChecked/></td><td></td>" . |
223 | | - "<td class=\"correction\" style=\"background: transparent;\">".wfMsgHtml('quiz_colorWrong')." : </td>" . |
224 | | - "<td class=\"correction\" style=\"background: ".$this->getColor('wrong')."\"></td></tr>"; |
| 225 | + "<td class=\"correction\" style=\"background: ".$this->getColor('wrong')."\"></td>" . |
| 226 | + "<td class=\"correction\" style=\"background: transparent;\">".wfMsgHtml('quiz_colorWrong')."</td></tr>"; |
225 | 227 | $output .= "<tr><td></td>" . |
226 | 228 | "<td><input type=\"hidden\" name=\"quizId\" value=\"$this->mQuizId\"/></td><td></td>" . |
227 | | - "<td class=\"correction\" style=\"background: transparent;\">".wfMsgHtml('quiz_colorNA')." : </td>" . |
228 | | - "<td class=\"correction\" style=\"background: ".$this->getColor('NA')."\"></td></tr>"; |
| 229 | + "<td class=\"correction\" style=\"background: ".$this->getColor('NA')."\"></td>" . |
| 230 | + "<td class=\"correction\" style=\"background: transparent;\">".wfMsgHtml('quiz_colorNA')."</td></tr>"; |
229 | 231 | $output .= "</tbody></table>"; |
230 | 232 | |
231 | 233 | $input = $this->parseIncludes($input); |
— | — | @@ -499,7 +501,8 @@ |
500 | 502 | $typeId = substr($this->mType, 0, 1); |
501 | 503 | $typeId .= array_key_exists(1, $matches)? "c" : "n"; |
502 | 504 | foreach($matches as $signId => $sign) { |
503 | | - $cellStyle = ""; |
| 505 | + //$ieStyle = $ffStyle = ""; |
| 506 | + $inputStyle = ""; |
504 | 507 | # Determine the input's name and value. |
505 | 508 | switch($typeId) { |
506 | 509 | case "mn": |
— | — | @@ -520,7 +523,7 @@ |
521 | 524 | break; |
522 | 525 | } |
523 | 526 | # Determine if the input had to be checked. |
524 | | - $checked = ($quiz->mBeingCorrected && $quiz->mRequest->getVal($name) == $value)? "checked" : NULL; |
| 527 | + $checked = ($quiz->mBeingCorrected && $quiz->mRequest->getVal($name) == $value)? "checked=\"checked\"" : NULL; |
525 | 528 | # Determine the color of the cell and modify the state of the question. |
526 | 529 | switch($sign) { |
527 | 530 | case "+": |
— | — | @@ -530,16 +533,16 @@ |
531 | 534 | if($this->mType == "singleChoice" && $expectOn > 1) { |
532 | 535 | $expected = "="; |
533 | 536 | $this->setState("error"); |
534 | | - $cellStyle = " style=\"background: ".$quiz->getColor('error').";\""; |
| 537 | + $inputStyle = "style=\"outline: ".$quiz->getColor('error')." solid 3px; border: 3px solid ".$quiz->getColor('error').";\""; |
535 | 538 | } |
536 | 539 | if($quiz->mBeingCorrected) { |
537 | 540 | if($checked) { |
538 | 541 | $checkedCount++; |
539 | 542 | $this->setState("right"); |
540 | | - $cellStyle = " style=\"background: ".$quiz->getColor('right').";\""; |
| 543 | + $inputStyle = "style=\"outline: ".$quiz->getColor('right')." solid 3px; border: 3px solid ".$quiz->getColor('right').";\""; |
541 | 544 | } else { |
542 | 545 | $this->setState("na_wrong"); |
543 | | - $cellStyle = " style=\"background: ".$quiz->getColor('wrong').";\""; |
| 546 | + $inputStyle = "style=\"outline: ".$quiz->getColor('wrong')." solid 3px; border: 3px solid ".$quiz->getColor('wrong').";\""; |
544 | 547 | } |
545 | 548 | } |
546 | 549 | break; |
— | — | @@ -549,7 +552,7 @@ |
550 | 553 | if($checked) { |
551 | 554 | $checkedCount++; |
552 | 555 | $this->setState("wrong"); |
553 | | - $cellStyle = " style=\"background: ".$quiz->getColor('wrong').";\""; |
| 556 | + $inputStyle = "style=\"outline: ".$quiz->getColor('wrong')." solid 3px; border: 3px solid ".$quiz->getColor('wrong').";\""; |
554 | 557 | } else { |
555 | 558 | $this->setState("na_right"); |
556 | 559 | } |
— | — | @@ -558,11 +561,11 @@ |
559 | 562 | default: |
560 | 563 | $expected = "="; |
561 | 564 | $this->setState("error"); |
562 | | - $cellStyle = " style=\"background: ".$quiz->getColor('error').";\""; |
| 565 | + $inputStyle = "style=\"outline: ".$quiz->getColor('error')." solid 3px; border: 3px solid ".$quiz->getColor('error').";\""; |
563 | 566 | break; |
564 | 567 | } |
565 | | - $signesOutput .= "<td$cellStyle>"; |
566 | | - $signesOutput .= "<input class=\"$expected\" type=\"$inputType\" name=\"$name\" value=\"$value\" $checked/>"; |
| 568 | + $signesOutput .= "<td class=\"sign\">"; |
| 569 | + $signesOutput .= "<input class=\"$expected\" $inputStyle type=\"$inputType\" name=\"$name\" value=\"$value\" $checked/>"; |
567 | 570 | $signesOutput .= "</td>"; |
568 | 571 | } |
569 | 572 | if($typeId == "sc") { |
— | — | @@ -594,7 +597,7 @@ |
595 | 598 | } |
596 | 599 | } |
597 | 600 | # A single choice object with no correct proposal is a syntax error. |
598 | | - if($typeId == "sn" && $expectOn == 0) { |
| 601 | + if(isset($typeId) && $typeId == "sn" && $expectOn == 0) { |
599 | 602 | $this->setState("error"); |
600 | 603 | } |
601 | 604 | return $output; |