MDL-46428 course: Remove confirm when duplicating
A confirm dialog is given when Javascript is off but not when it is on. This aligns the two so that they neither have a confirm when duplicating an activity.
This commit is contained in:
+6
-33
@@ -79,41 +79,16 @@ if (!empty($add)) {
|
||||
redirect("$CFG->wwwroot/course/modedit.php?update=$update&return=$returntomod&sr=$sectionreturn");
|
||||
|
||||
} else if (!empty($duplicate)) {
|
||||
$cm = get_coursemodule_from_id('', $duplicate, 0, true, MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||
$cm = get_coursemodule_from_id('', $duplicate, 0, true, MUST_EXIST);
|
||||
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
|
||||
|
||||
require_login($course, false, $cm);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
$modcontext = context_module::instance($cm->id);
|
||||
require_capability('moodle/course:manageactivities', $coursecontext);
|
||||
require_capability('moodle/course:manageactivities', $modcontext);
|
||||
|
||||
if (!$confirm or !confirm_sesskey()) {
|
||||
$PAGE->set_title(get_string('duplicate'));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->navbar->add(get_string('duplicatinga', 'core', format_string($cm->name)));
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
|
||||
$a = new stdClass();
|
||||
$a->modtype = get_string('modulename', $cm->modname);
|
||||
$a->modname = format_string($cm->name);
|
||||
$a->modid = $cm->id;
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->confirm(
|
||||
get_string('duplicateconfirm', 'core', $a),
|
||||
new single_button(
|
||||
new moodle_url('/course/modduplicate.php', array(
|
||||
'cmid' => $cm->id, 'course' => $course->id, 'sr' => $sectionreturn)),
|
||||
get_string('continue'),
|
||||
'post'),
|
||||
new single_button(
|
||||
course_get_url($course, $cm->sectionnum, array('sr' => $sectionreturn)),
|
||||
get_string('cancel'),
|
||||
'get')
|
||||
);
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
}
|
||||
// Duplicate the module.
|
||||
$newcm = duplicate_module($course, $cm);
|
||||
redirect(course_get_url($course, $cm->sectionnum, array('sr' => $sectionreturn)));
|
||||
|
||||
} else if (!empty($delete)) {
|
||||
$cm = get_coursemodule_from_id('', $delete, 0, true, MUST_EXIST);
|
||||
@@ -298,5 +273,3 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
||||
} else {
|
||||
print_error('unknowaction');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user