From 08a7fbb0271488e19146c9e50228e89964b17469 Mon Sep 17 00:00:00 2001 From: Dongsheng Cai Date: Wed, 2 Feb 2011 15:46:11 +0800 Subject: [PATCH] mod-data MDL-25671 disable editor in data list template editor will not save the changes --- mod/data/templates.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mod/data/templates.php b/mod/data/templates.php index 90cf012aa0e..9a1ee1e3ced 100755 --- a/mod/data/templates.php +++ b/mod/data/templates.php @@ -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 '
'.get_string('header'.$mode,'data').'
'; -- 2.43.0