mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-69613 gradereport: confirm message if override none is selected
This commit is contained in:
parent
a36870c175
commit
89ce0b387e
3 changed files with 25 additions and 1 deletions
|
@ -268,6 +268,7 @@ abstract class screen {
|
||||||
'requires' => array('base', 'dom', 'event', 'event-simulate', 'io-base')
|
'requires' => array('base', 'dom', 'event', 'event-simulate', 'io-base')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$PAGE->requires->string_for_js('overridenoneconfirm', 'gradereport_singleview');
|
||||||
$PAGE->requires->js_init_call('M.gradereport_singleview.init', array(), false, $module);
|
$PAGE->requires->js_init_call('M.gradereport_singleview.init', array(), false, $module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
M.gradereport_singleview = {};
|
M.gradereport_singleview = {};
|
||||||
|
|
||||||
M.gradereport_singleview.init = function(Y) {
|
M.gradereport_singleview.init = function(Y) {
|
||||||
|
if (this.initialised) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.initialised = true;
|
||||||
|
|
||||||
var getColumnIndex = function(cell) {
|
var getColumnIndex = function(cell) {
|
||||||
var rowNode = cell.ancestor('tr');
|
var rowNode = cell.ancestor('tr');
|
||||||
if (!rowNode || !cell) {
|
if (!rowNode || !cell) {
|
||||||
|
@ -104,7 +109,24 @@ M.gradereport_singleview.init = function(Y) {
|
||||||
|
|
||||||
link.on('click', function(e) {
|
link.on('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
var selectall = link.hasClass('all');
|
||||||
|
var self = this;
|
||||||
|
if ((type === 'override') && !selectall) {
|
||||||
|
Y.use('moodle-core-notification-confirm', function() {
|
||||||
|
var confirm = new M.core.confirm({
|
||||||
|
title: M.util.get_string('confirm', 'moodle'),
|
||||||
|
question: M.util.get_string('overridenoneconfirm', 'gradereport_singleview'),
|
||||||
|
});
|
||||||
|
confirm.on('complete-yes', function() {
|
||||||
|
confirm.hide();
|
||||||
|
confirm.destroy();
|
||||||
Y.all('input[name^=' + type + ']').each(toggle(link.hasClass('all')));
|
Y.all('input[name^=' + type + ']').each(toggle(link.hasClass('all')));
|
||||||
|
}, self);
|
||||||
|
confirm.show();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Y.all('input[name^=' + type + ']').each(toggle(link.hasClass('all')));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ $string['override'] = 'Override';
|
||||||
$string['overrideall'] = 'Override all grades';
|
$string['overrideall'] = 'Override all grades';
|
||||||
$string['overridefor'] = 'Override for {$a}';
|
$string['overridefor'] = 'Override for {$a}';
|
||||||
$string['overridenone'] = 'Do not override any grades';
|
$string['overridenone'] = 'Do not override any grades';
|
||||||
|
$string['overridenoneconfirm'] = 'You are trying to disable all grade overrides. After saving, all the previously overridden grades will be lost. Do you want to continue?';
|
||||||
$string['pluginname'] = 'Single view';
|
$string['pluginname'] = 'Single view';
|
||||||
$string['privacy:metadata'] = 'The Grade single view report only shows data stored in other locations.';
|
$string['privacy:metadata'] = 'The Grade single view report only shows data stored in other locations.';
|
||||||
$string['savegrades'] = 'Saving grades';
|
$string['savegrades'] = 'Saving grades';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue