Merge branch 'MDL-25874' of git://git.luns.net.uk/moodle

This commit is contained in:
Sam Hemelryk
2011-02-07 14:01:00 +08:00
+22
View File
@@ -56,8 +56,30 @@ if ($edit) {
$jumpto = lesson_page::get_jumptooptions($pageid, $lesson);
$manager = lesson_page_type_manager::get($lesson);
$editoroptions = array('noclean'=>true, 'maxfiles'=>EDITOR_UNLIMITED_FILES, 'maxbytes'=>$CFG->maxbytes);
// If the previous page was the Question type selection form, this form
// will have a different name (e.g. _qf__lesson_add_page_form_selection
// versus _qf__lesson_add_page_form_multichoice). This causes confusion
// in moodleform::_process_submission because the array key check doesn't
// tie up with the current form name, which in turn means the "submitted"
// check ends up evaluating as false, thus it's not possible to check whether
// the Question type selection was cancelled. For this reason, a dummy form
// is created here solely to check whether the selection was cancelled.
if ($qtype) {
$mformdummy = $manager->get_page_form(0, array('editoroptions'=>$editoroptions, 'jumpto'=>$jumpto, 'lesson'=>$lesson, 'edit'=>$edit, 'maxbytes'=>$PAGE->course->maxbytes));
if ($mformdummy->is_cancelled()) {
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$id");
exit;
}
}
$mform = $manager->get_page_form($qtype, array('editoroptions'=>$editoroptions, 'jumpto'=>$jumpto, 'lesson'=>$lesson, 'edit'=>$edit, 'maxbytes'=>$PAGE->course->maxbytes));
if ($mform->is_cancelled()) {
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$id");
exit;
}
if ($edit) {
$data = $editpage->properties();
$data->pageid = $editpage->id;