mod-data MDL-25671 disable editor in data list template editor will not save the changes

This commit is contained in:
Dongsheng Cai
2011-02-02 22:17:15 +08:00
parent eef3578af0
commit 08a7fbb027
+8 -4
View File
@@ -29,7 +29,8 @@ require_once('lib.php');
$id = optional_param('id', 0, PARAM_INT); // course module id
$d = optional_param('d', 0, PARAM_INT); // database id
$mode = optional_param('mode', 'singletemplate', PARAM_ALPHA);
$disableeditor = optional_param('switcheditor', false, PARAM_ALPHA);
$disableeditor = optional_param('switcheditor', false, PARAM_RAW);
$enableeditor = optional_param('useeditor', false, PARAM_RAW);
$url = new moodle_url('/mod/data/templates.php');
if ($mode !== 'singletemplate') {
@@ -130,10 +131,13 @@ if (($mytemplate = data_submitted()) && confirm_sesskey()) {
// Check for multiple tags, only need to check for add template.
if ($mode != 'addtemplate' or data_tags_check($data->id, $newtemplate->{$mode})) {
$DB->update_record('data', $newtemplate);
echo $OUTPUT->notification(get_string('templatesaved', 'data'), 'notifysuccess');
// if disableeditor or enableeditor buttons click, don't save instance
if (empty($disableeditor) && empty($enableeditor)) {
$DB->update_record('data', $newtemplate);
echo $OUTPUT->notification(get_string('templatesaved', 'data'), 'notifysuccess');
add_to_log($course->id, 'data', 'templates saved', "templates.php?id=$cm->id&d=$data->id", $data->id, $cm->id);
}
}
add_to_log($course->id, 'data', 'templates saved', "templates.php?id=$cm->id&d=$data->id", $data->id, $cm->id);
}
} else {
echo '<div class="littleintro" style="text-align:center">'.get_string('header'.$mode,'data').'</div>';