From: michaelpenne Date: Sat, 11 Mar 2006 00:23:21 +0000 (+0000) Subject: [BugFix] Bug #4852 - HTML editor problems X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c5b71097bcb81ee8c3b14f24b9a53b91acd540fc;p=moodle.git [BugFix] Bug #4852 - HTML editor problems --- diff --git a/mod/lesson/action/editpage.php b/mod/lesson/action/editpage.php index c43dfa79a5..3bb6d34562 100644 --- a/mod/lesson/action/editpage.php +++ b/mod/lesson/action/editpage.php @@ -238,7 +238,7 @@ case LESSON_SHORTANSWER: case LESSON_NUMERICAL: echo "".get_string("answer", "lesson")." $nplus1:\n"; - if ($flags & LESSON_ANSWER_EDITOR) { + if ($flags & LESSON_ANSWER_EDITOR and $page->qtype != LESSON_SHORTANSWER and $page->qtype != LESSON_NUMERICAL) { echo " [".get_string("useeditor", "lesson").": ". ""; @@ -247,11 +247,16 @@ print_textarea($usehtmleditor, 20, 70, 630, 300, "answer[$n]", $answer->answer); use_html_editor("answer[$n]"); // switch on the editor } else { - echo " [".get_string("useeditor", "lesson").": ". - ""; - helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); - echo "]
\n"; - print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer); + if ($page->qtype != LESSON_SHORTANSWER and $page->qtype != LESSON_NUMERICAL) { + echo " [".get_string("useeditor", "lesson").": ". + ""; //CDC hidden label. + helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); + echo "]
\n"; + print_textarea(false, 6, 70, 630, 300, "answer[$n]", $answer->answer); + } else { + echo "
\n"; + print_textarea(false, 1, 70, 630, 300, "answer[$n]", $answer->answer); + } } echo "\n"; echo "".get_string("response", "lesson")." $nplus1:\n"; @@ -382,11 +387,16 @@ case LESSON_SHORTANSWER: case LESSON_NUMERICAL: echo "".get_string("answer", "lesson")." $iplus1:\n"; - echo " [".get_string("useeditor", "lesson").": ". - ""; - helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); - echo "]
\n"; - print_textarea(false, 10, 70, 630, 300, "answer[$i]"); + if ($page->qtype != LESSON_SHORTANSWER and $page->qtype != LESSON_NUMERICAL) { + echo " [".get_string("useeditor", "lesson").": ". + ""; + helpbutton("useeditor", get_string("useeditor", "lesson"), "lesson"); + echo "]
\n"; + print_textarea(false, 10, 70, 630, 300, "answer[$i]"); + } else { + echo "
\n"; + print_textarea(false, 1, 70, 630, 300, "answer[$i]"); + } echo "\n"; echo "".get_string("response", "lesson")." $iplus1:\n"; echo " [".get_string("useeditor", "lesson").": ". diff --git a/mod/lesson/action/updatepage.php b/mod/lesson/action/updatepage.php index 5c4ae457dc..67759217fd 100644 --- a/mod/lesson/action/updatepage.php +++ b/mod/lesson/action/updatepage.php @@ -87,8 +87,14 @@ if ($form->answerid[$i]) { $oldanswer = new stdClass; $oldanswer->id = clean_param($form->answerid[$i], PARAM_INT); - $oldanswer->flags = optional_param("answereditor[$i]", 0, PARAM_INT) * LESSON_ANSWER_EDITOR + - optional_param("responseeditor[$i]", 0, PARAM_INT) * LESSON_RESPONSE_EDITOR; + if (!isset($form->answereditor[$i])) { + $form->answereditor[$i] = 0; + } + if (!isset($form->responseeditor[$i])) { + $form->responseeditor[$i] = 0; + } + $oldanswer->flags = $form->answereditor[$i] * LESSON_ANSWER_EDITOR + + $form->responseeditor[$i] * LESSON_RESPONSE_EDITOR; $oldanswer->timemodified = $timenow; $oldanswer->answer = trim($form->answer[$i]); if (isset($form->response[$i])) { @@ -108,8 +114,14 @@ $newanswer = new stdClass; // need to clear id if more than one new answer is ben added $newanswer->lessonid = $lesson->id; $newanswer->pageid = $page->id; - $newanswer->flags = optional_param("answereditor[$i]", 0, PARAM_INT) * LESSON_ANSWER_EDITOR + - optional_param("responseeditor[$i]", 0, PARAM_INT) * LESSON_RESPONSE_EDITOR; + if (!isset($form->answereditor[$i])) { + $form->answereditor[$i] = 0; + } + if (!isset($form->responseeditor[$i])) { + $form->responseeditor[$i] = 0; + } + $newanswer->flags = $form->answereditor[$i] * LESSON_ANSWER_EDITOR + + $form->responseeditor[$i] * LESSON_RESPONSE_EDITOR; $newanswer->timecreated = $timenow; $newanswer->answer = trim($form->answer[$i]); if (isset($form->response[$i])) { @@ -134,8 +146,14 @@ } else { $oldanswer = new stdClass; $oldanswer->id = clean_param($form->answerid[$i], PARAM_INT); - $oldanswer->flags = optional_param("answereditor[$i]", 0, PARAM_INT) * LESSON_ANSWER_EDITOR + - optional_param("responseeditor[$i]", 0, PARAM_INT) * LESSON_RESPONSE_EDITOR; + if (!isset($form->answereditor[$i])) { + $form->answereditor[$i] = 0; + } + if (!isset($form->responseeditor[$i])) { + $form->responseeditor[$i] = 0; + } + $oldanswer->flags = $form->answereditor[$i] * LESSON_ANSWER_EDITOR + + $form->responseeditor[$i] * LESSON_RESPONSE_EDITOR; $oldanswer->timemodified = $timenow; $oldanswer->answer = NULL; if (!update_record("lesson_answers", $oldanswer)) {