Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

mod-data MDL-25671 disable editor in data list template editor will n…

…ot save the changes
  • Loading branch information...
commit 08a7fbb0271488e19146c9e50228e89964b17469 1 parent eef3578
@dcai dcai authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 mod/data/templates.php
View
12 mod/data/templates.php
@@ -29,7 +29,8 @@
$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 @@
// 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>';
Please sign in to comment.
Something went wrong with that request. Please try again.