Skip to content

Commit

Permalink
Merge branch 'MDL-43334-master' of git://github.com/damyon/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Aug 7, 2018
2 parents 43ae41a + 6fea9dc commit 6760a7e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 8 deletions.
6 changes: 5 additions & 1 deletion backup/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
$courseid = required_param('id', PARAM_INT);
$sectionid = optional_param('section', null, PARAM_INT);
$cmid = optional_param('cm', null, PARAM_INT);
$cancel = optional_param('cancel', '', PARAM_ALPHA);
/**
* Part of the forms in stages after initial, is POST never GET
*/
Expand Down Expand Up @@ -104,7 +105,10 @@
$PAGE->set_heading($heading);

$renderer = $PAGE->get_renderer('core','backup');
echo $OUTPUT->header();
if (empty($cancel)) {
// Do not print the header if user cancelled the process, as we are going to redirect the user.
echo $OUTPUT->header();
}

// Prepare a progress bar which can display optionally during long-running
// operations while setting up the UI.
Expand Down
2 changes: 1 addition & 1 deletion backup/util/ui/base_moodleform.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public function display() {
$config->title = get_string('confirmcancel', 'backup');
}
$config->question = get_string('confirmcancelquestion', 'backup');
$config->yesLabel = get_string('confirmcancelyes', 'backup');
$config->yesLabel = $config->title;
$config->noLabel = get_string('confirmcancelno', 'backup');
$config->closeButtonTitle = get_string('close', 'editor');
$PAGE->requires->yui_module(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,17 @@ M.core_backup.confirmcancel = {
// Detach the listeners for the confirm box so they don't fire again.
new Y.EventHandle(M.core_backup.confirmcancel.listeners).detach();

// The currentTarget is a div surrounding the form elements. Simulating a click on the div is
// not going to submit a form so we need to find the form element to click.
var element = e.currentTarget.one('input, select, button');

// Simulate the original cancel button click.
e.currentTarget.simulate('click');
if (element) {
element.simulate('click');
} else {
// Backwards compatibility only.
e.currentTarget.simulate('click');
}
}, this);


Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,17 @@ M.core_backup.confirmcancel = {
// Detach the listeners for the confirm box so they don't fire again.
new Y.EventHandle(M.core_backup.confirmcancel.listeners).detach();

// The currentTarget is a div surrounding the form elements. Simulating a click on the div is
// not going to submit a form so we need to find the form element to click.
var element = e.currentTarget.one('input, select, button');

// Simulate the original cancel button click.
e.currentTarget.simulate('click');
if (element) {
element.simulate('click');
} else {
// Backwards compatibility only.
e.currentTarget.simulate('click');
}
}, this);


Expand Down
11 changes: 10 additions & 1 deletion backup/util/ui/yui/src/confirmcancel/js/confirmcancel.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,17 @@ M.core_backup.confirmcancel = {
// Detach the listeners for the confirm box so they don't fire again.
new Y.EventHandle(M.core_backup.confirmcancel.listeners).detach();

// The currentTarget is a div surrounding the form elements. Simulating a click on the div is
// not going to submit a form so we need to find the form element to click.
var element = e.currentTarget.one('input, select, button');

// Simulate the original cancel button click.
e.currentTarget.simulate('click');
if (element) {
element.simulate('click');
} else {
// Backwards compatibility only.
e.currentTarget.simulate('click');
}
}, this);


Expand Down
4 changes: 2 additions & 2 deletions lang/en/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@
$string['confirmcancelimport'] = 'Cancel import';
$string['confirmcancelquestion'] = 'Are you sure you wish to cancel?
Any information you have entered will be lost.';
$string['confirmcancelyes'] = 'Cancel';
$string['confirmcancelno'] = 'Stay';
$string['confirmcancelyes'] = 'Cancel backup';
$string['confirmcancelno'] = 'Do not cancel';
$string['confirmnewcoursecontinue'] = 'New course warning';
$string['confirmnewcoursecontinuequestion'] = 'A temporary (hidden) course will be created by the course restoration process. To abort restoration click cancel. Do not close the browser while restoring.';
$string['coursecategory'] = 'Category the course will be restored into';
Expand Down

0 comments on commit 6760a7e

Please sign in to comment.