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.8.1 |
| 32 | + * @version 0.8 |
33 | 33 | * @link http://www.mediawiki.org/wiki/Extension:Quiz |
34 | 34 | * @author BABE Louis-Remi <lrbabe@gmail.com> |
35 | 35 | */ |
— | — | @@ -38,10 +38,10 @@ |
39 | 39 | */ |
40 | 40 | $wgExtensionCredits['parserhook'][] = array( |
41 | 41 | 'name'=>'Quiz', |
42 | | - 'version'=>'0.8.1', |
| 42 | + 'version'=>'0.8.2', |
43 | 43 | 'author'=>'lrbabe', |
44 | 44 | 'url'=>'http://www.mediawiki.org/wiki/Extension:Quiz', |
45 | | - 'description' => 'Quiz tool for MediaWiki' |
| 45 | + 'description' => 'Allows creation of quizzes' |
46 | 46 | ); |
47 | 47 | |
48 | 48 | /** |
— | — | @@ -205,9 +205,9 @@ |
206 | 206 | $head .= ".quiz .sign {text-align:center; }\n"; |
207 | 207 | # Part for the inputfields |
208 | 208 | $head .= ".quiz a.input, .quiz a.input:hover, .quiz a.input:active, .quiz a.input:visited { text-decoration:none; color:black; outline:0 }"; |
209 | | - $head .= ".quiz a.input span { outline:black solid 1px}"; |
210 | | - $head .= "* html .quiz a.input span { border:1px solid black }"; |
211 | | - $head .= ".quiz a.input big { font-weight:bold; font-family:sans-serif; }"; |
| 209 | + $head .= ".quiz a.input span { outline:#7F9DB9 solid 1px}"; |
| 210 | + $head .= "* html .quiz a.input span { border:1px solid #7F9DB9 }"; |
| 211 | + $head .= ".quiz a.input em { color:black; background-color:#DFDFDF; margin-right:1px; }"; |
212 | 212 | $head .= ".quiz a.input input { padding-left:2px; border:0; }"; |
213 | 213 | $head .= ".quiz a.input span.correction { padding:3px; margin:0; list-style-type:none; display:none; background-color:".Quiz::getColor("correction")."; }"; |
214 | 214 | $head .= ".quiz a.input:active span.correction, .quiz a.input:focus span.correction { display:inline; position:absolute; margin:1.8em 0 0 0.1em; }"; |
— | — | @@ -367,13 +367,16 @@ |
368 | 368 | case "right": |
369 | 369 | $this->mTotal += $this->mAddedPoints * $question->mCoef; |
370 | 370 | $this->mScore += $this->mAddedPoints * $question->mCoef; |
| 371 | + $output .= "title=\" ".wfMsgHtml('quiz_colorRight')." | ".($this->mAddedPoints * $question->mCoef)." \""; |
371 | 372 | break; |
372 | 373 | case "wrong": |
373 | 374 | $this->mTotal += $this->mAddedPoints * $question->mCoef; |
374 | 375 | $this->mScore -= $this->mCutoffPoints * $question->mCoef; |
| 376 | + $output .= "title=\" ".wfMsgHtml('quiz_colorWrong')." | -".($this->mCutoffPoints * $question->mCoef)." \""; |
375 | 377 | break; |
376 | 378 | case "NA": |
377 | 379 | $this->mTotal += $this->mAddedPoints * $question->mCoef; |
| 380 | + $output .= "title=\" ".wfMsgHtml('quiz_colorNA')." | 0 \""; |
378 | 381 | break; |
379 | 382 | } |
380 | 383 | } |
— | — | @@ -424,10 +427,11 @@ |
425 | 428 | */ |
426 | 429 | function setState($pState) { |
427 | 430 | if ($pState == "error" |
428 | | - || ($pState == "wrong" && $this->mState != "error") |
429 | | - || ($pState == "right" && ($this->mState == "right" || $this->mState == "NA" || $this->mState == "na_right")) |
430 | | - || ($pState == "na_wrong" && ($this->mState == "NA" || $this->mState == "na_right")) |
431 | | - || ($pState == "na_right" && ($this->mState == "NA")) |
| 431 | + || ($pState == "wrong" && $this->mState != "error") |
| 432 | + || ($pState == "right" && ($this->mState == "NA" || $this->mState == "na_right")) |
| 433 | + || ($pState == "na_wrong" && ($this->mState == "NA" || $this->mState == "na_right")) |
| 434 | + || ($pState == "na_right" && ($this->mState == "NA")) |
| 435 | + || ($pState == "new_NA" && $this->mState == "right") |
432 | 436 | ) { |
433 | 437 | $this->mState = $pState; |
434 | 438 | } |
— | — | @@ -446,7 +450,7 @@ |
447 | 451 | function getState() { |
448 | 452 | if ($this->mState == "na_right") { |
449 | 453 | return "right"; |
450 | | - } elseif ($this->mState == "na_wrong") { |
| 454 | + } elseif ($this->mState == "na_wrong" || $this->mState == "new_NA") { |
451 | 455 | return "NA"; |
452 | 456 | } else { |
453 | 457 | return $this->mState; |
— | — | @@ -753,7 +757,7 @@ |
754 | 758 | if(array_key_exists(5, $matches)) $strlen = $size = $maxlength = ""; |
755 | 759 | elseif(array_key_exists(3, $matches)) $strlen = strlen($matches[1]) > strlen($matches[3])? strlen($matches[1]) : strlen($matches[3]); |
756 | 760 | else $strlen = strlen($matches[1]); |
757 | | - if($this->mBeingCorrected && $value != "") { |
| 761 | + if($this->mBeingCorrected && !empty($value)) { |
758 | 762 | $state = (is_numeric($value) && |
759 | 763 | ( (array_key_exists(5, $matches) && $value >= ($matches[1]-($matches[1]*$matches[4])/100) && $value <= ($matches[1]+($matches[1]*$matches[4])/100) ) |
760 | 764 | || (array_key_exists(3, $matches) && $value >= $matches[1] && $value <= $matches[3]) |
— | — | @@ -762,7 +766,7 @@ |
763 | 767 | } else { |
764 | 768 | $strlen = strlen($possibility); |
765 | 769 | $class = "class=\"words\""; |
766 | | - if($this->mBeingCorrected && $value != "") $state = ($value == $possibility)? "right" : "wrong"; |
| 770 | + if($this->mBeingCorrected && !empty($value)) $state = ($value == $possibility)? "right" : "wrong"; |
767 | 771 | } |
768 | 772 | if(array_key_exists(3, $input) && $strlen > $input[3]) { |
769 | 773 | # The textfield is too short for the answer |
— | — | @@ -772,16 +776,16 @@ |
773 | 777 | } |
774 | 778 | if($this->mBeingCorrected) $a_inputBeg.= "$possibility<br/>"; |
775 | 779 | } |
776 | | - $value = "value=\"".Sanitizer::removeHTMLtags($value)."\""; |
| 780 | + $value = empty($value)? "" : "value=\"".str_replace('"', "'", $value)."\""; |
777 | 781 | if($this->mBeingCorrected) { |
778 | 782 | $a_inputBeg.= "</span>"; |
779 | 783 | $a_inputEnd = "</a>"; |
780 | | - $big = "<big>v</big>"; |
| 784 | + $big = "<em>▼</em>"; |
781 | 785 | } |
782 | 786 | } |
783 | 787 | if($state == "error" || $this->mBeingCorrected) { |
784 | 788 | $style = "style=\"border-left:3px solid ".Quiz::getColor($state)."; \""; |
785 | | - $this->setState($state); |
| 789 | + $this->setState(empty($value)? "new_NA" : $state); |
786 | 790 | if($state == "error") { |
787 | 791 | $size = ""; |
788 | 792 | $maxlength = ""; |