Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

WebCT import can now deal with escaped colons in the text bug 1182

  • Loading branch information...
commit 9421aca0cd1f5a124c2d7fa0026bd98ab646736d 1 parent b4ac978
moodler authored
Showing with 7 additions and 16 deletions.
  1. +7 −16 mod/quiz/format/webct/format.php
View
23 mod/quiz/format/webct/format.php
@@ -85,50 +85,41 @@ function readquestions ($lines) {
unset($questiontext);
}
else {
- $questiontext .= $line;
+ $questiontext .= str_replace('\:', ':', $line);
continue;
}
}
if (is_string($answertext)) {
if (ereg("^:",$line)) {
- if ($bIsHTMLText) {
- $answertext = unhtmlentities($answertext); // answer as HTML text not supported by Moddle
- }
$answertext = addslashes(trim($answertext));
$question->answer[$currentchoice] = $answertext;
unset($answertext);
}
else {
- $answertext .= $line;
+ $answertext .= str_replace('\:', ':', $line);
continue;
}
}
if (is_string($responstext)) {
if (ereg("^:",$line)) {
- if ($bIsHTMLText) {
- $responstext = unhtmlentities($responstext); // answer as HTML text not supported by Moddle
- }
$question->subquestions[$currentchoice] = addslashes(trim($responstext));
unset($responstext);
}
else {
- $responstext .= $line;
+ $responstext .= str_replace('\:', ':', $line);
continue;
}
}
if (is_string($feedbacktext)) {
if (ereg("^:",$line)) {
- if ($bIsHTMLText) {
- $feedbacktext = unhtmlentities($feedbacktext); // feedback as HTML text not supported by Moddle
- }
$question->feedback[$currentchoice] = addslashes(trim($feedbacktext));
unset($feedbacktext);
}
else {
- $feedbacktext .= $line;
+ $feedbacktext .= str_replace('\:', ':', $line);
continue;
}
}
@@ -160,9 +151,9 @@ function readquestions ($lines) {
$errors[] = get_string("missingquestion", "quiz", $nQuestionStartLine);
$QuestionOK = FALSE;
}
- if (sizeof($question->answer) <= 1) { // a question must have at last 2 answers
- $errors[] = get_string("missinganswer", "quiz", $nQuestionStartLine);
- $QuestionOK = FALSE;
+ if (empty($question->answer)) { // a question must have at least 1 answer
+ $errors[] = get_string("missinganswer", "quiz", $nQuestionStartLine);
+ $QuestionOK = FALSE;
}
else {
// Perform string length check
Please sign in to comment.
Something went wrong with that request. Please try again.