Merge branch 'MDL-77174-master' of https://github.com/andrewnicols/moodle

This commit is contained in:
Jun Pataleta
2023-08-08 15:15:32 +08:00
38 changed files with 557 additions and 513 deletions
@@ -1441,27 +1441,25 @@ Category.prototype = {
* @param {Course} course
*/
moveCourseTo: function(course) {
var self = this;
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('confirmcoursemove', 'moodle', {
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirmation', 'admin'),
M.util.get_string('confirmcoursemove', 'moodle',
{
course: course.getName(),
category: self.getName()
category: this.getName(),
}),
yesLabel: M.util.get_string('move', 'moodle'),
noLabel: M.util.get_string('cancel', 'moodle')
});
confirm.on('complete-yes', function() {
confirm.hide();
confirm.destroy();
M.util.get_string('move', 'moodle')
).then(function() {
this.get('console').performAjaxAction('movecourseintocategory', {
courseid: course.get('courseid'),
categoryid: this.get('categoryid'),
courseid: course.get('courseid')
}, this.completeMoveCourse, this);
}, self);
confirm.show();
});
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
},
/**
File diff suppressed because one or more lines are too long
@@ -1412,27 +1412,25 @@ Category.prototype = {
* @param {Course} course
*/
moveCourseTo: function(course) {
var self = this;
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('confirmcoursemove', 'moodle', {
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirmation', 'admin'),
M.util.get_string('confirmcoursemove', 'moodle',
{
course: course.getName(),
category: self.getName()
category: this.getName(),
}),
yesLabel: M.util.get_string('move', 'moodle'),
noLabel: M.util.get_string('cancel', 'moodle')
});
confirm.on('complete-yes', function() {
confirm.hide();
confirm.destroy();
M.util.get_string('move', 'moodle')
).then(function() {
this.get('console').performAjaxAction('movecourseintocategory', {
courseid: course.get('courseid'),
categoryid: this.get('categoryid'),
courseid: course.get('courseid')
}, this.completeMoveCourse, this);
}, self);
confirm.show();
});
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
},
/**
+14 -16
View File
@@ -257,27 +257,25 @@ Category.prototype = {
* @param {Course} course
*/
moveCourseTo: function(course) {
var self = this;
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('confirmcoursemove', 'moodle', {
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirmation', 'admin'),
M.util.get_string('confirmcoursemove', 'moodle',
{
course: course.getName(),
category: self.getName()
category: this.getName(),
}),
yesLabel: M.util.get_string('move', 'moodle'),
noLabel: M.util.get_string('cancel', 'moodle')
});
confirm.on('complete-yes', function() {
confirm.hide();
confirm.destroy();
M.util.get_string('move', 'moodle')
).then(function() {
this.get('console').performAjaxAction('movecourseintocategory', {
courseid: course.get('courseid'),
categoryid: this.get('categoryid'),
courseid: course.get('courseid')
}, this.completeMoveCourse, this);
}, self);
confirm.show();
});
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
},
/**
+13 -17
View File
@@ -108,26 +108,22 @@ YUI.add('moodle-enrol-rolemanager', function(Y) {
}
});
},
removeRole : function(e, user, roleid) {
removeRole: function(e, user, roleid) {
e.halt();
var event = this.on('assignablerolesloaded', function(){
event.detach();
var confirmation = {
modal: true,
visible : false,
centered : true,
title : M.util.get_string('confirmunassigntitle', 'role'),
question : M.util.get_string('confirmunassign', 'role'),
yesLabel : M.util.get_string('confirmunassignyes', 'role'),
noLabel : M.util.get_string('confirmunassignno', 'role')
};
new M.core.confirm(confirmation)
.show()
.on('complete-yes', this.removeRoleCallback, this, user.get(USERID), roleid);
}, this);
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirmation', 'admin'),
M.util.get_string('confirmunassign', 'role'),
M.util.get_string('confirmunassignyes', 'role')
).then(function() {
return this.removeRoleCallback(user.get(USERID), roleid);
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
this._loadAssignableRoles();
},
removeRoleCallback : function(e, userid, roleid) {
removeRoleCallback: function(userid, roleid) {
Y.io(M.cfg.wwwroot+'/enrol/ajax.php', {
method:'POST',
data:'id='+this.get(COURSEID)+'&action=unassign&sesskey='+M.cfg.sesskey+'&role='+roleid+'&user='+userid,
+13 -7
View File
@@ -178,11 +178,7 @@ M.gradingform_guideeditor.buttonclick = function(e, confirmed) {
if (action == 'addcriterion' || action == 'addcomment') {
newid = M.gradingform_guideeditor.calculatenewid(elements_str);
}
var dialog_options = {
'scope' : this,
'callbackargs' : [e, true],
'callback' : M.gradingform_guideeditor.buttonclick
};
if (chunks.length == 3 && (action == 'addcriterion' || action == 'addcomment')) {
// ADD NEW CRITERION OR COMMENT
var parentel = Y.one('#'+name+'-'+section)
@@ -228,8 +224,18 @@ M.gradingform_guideeditor.buttonclick = function(e, confirmed) {
Y.one('#'+name+'-'+section+'-'+chunks[2]).remove()
M.gradingform_guideeditor.assignclasses(elements_str)
} else {
dialog_options['message'] = M.util.get_string('confirmdeletecriterion', 'gradingform_guide')
M.util.show_confirm_dialog(e, dialog_options);
require(['core/notification', 'core/str'], function(Notification, Str) {
Notification.saveCancelPromise(
Str.get_string('confirmation', 'admin'),
Str.get_string('confirmdeletecriterion', 'gradingform_guide'),
Str.get_string('yes', 'moodle')
).then(function() {
M.gradingform_guideeditor.buttonclick.apply(this, [e, true]);
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
}
} else {
// unknown action
+24 -9
View File
@@ -149,11 +149,6 @@ M.gradingform_rubriceditor.buttonclick = function(e, confirmed) {
newid = M.gradingform_rubriceditor.calculatenewid('#rubric-'+name+' .criterion');
newlevid = M.gradingform_rubriceditor.calculatenewid('#rubric-'+name+' .level');
}
var dialog_options = {
'scope' : this,
'callbackargs' : [e, true],
'callback' : M.gradingform_rubriceditor.buttonclick
};
if (chunks.length == 3 && action == 'addcriterion') {
// ADD NEW CRITERION
var levelsscores = [0], levidx = 1
@@ -215,8 +210,18 @@ M.gradingform_rubriceditor.buttonclick = function(e, confirmed) {
Y.one('#'+name+'-criteria-'+chunks[2]).remove()
M.gradingform_rubriceditor.assignclasses(elements_str)
} else {
dialog_options['message'] = M.util.get_string('confirmdeletecriterion', 'gradingform_rubric')
M.util.show_confirm_dialog(e, dialog_options);
require(['core/notification', 'core/str'], function(Notification, Str) {
Notification.saveCancelPromise(
Str.get_string('confirmation', 'admin'),
Str.get_string('confirmdeletecriterion', 'gradingform_rubric'),
Str.get_string('yes', 'moodle')
).then(function() {
M.gradingform_rubriceditor.buttonclick.apply(this, [e, true]);
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
}
} else if (chunks.length == 4 && action == 'duplicate') {
// Duplicate criterion.
@@ -259,8 +264,18 @@ M.gradingform_rubriceditor.buttonclick = function(e, confirmed) {
Y.one('#'+name+'-criteria-'+chunks[2]+'-'+chunks[3]+'-'+chunks[4]).remove()
M.gradingform_rubriceditor.assignclasses(elements_str)
} else {
dialog_options['message'] = M.util.get_string('confirmdeletelevel', 'gradingform_rubric')
M.util.show_confirm_dialog(e, dialog_options);
require(['core/notification', 'core/str'], function(Notification, Str) {
Notification.saveCancelPromise(
Str.get_string('confirmation', 'admin'),
Str.get_string('confirmdeletelevel', 'gradingform_rubric'),
Str.get_string('yes', 'moodle')
).then(function() {
M.gradingform_rubriceditor.buttonclick.apply(this, [e, true]);
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
}
} else {
// unknown action
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -5,6 +5,6 @@ define("core/normalise",["exports","jquery"],(function(_exports,_jquery){var obj
* @module core/normalise
* @copyright 2020 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.getList=_exports.getFirst=void 0,_jquery=(obj=_jquery)&&obj.__esModule?obj:{default:obj};const getList=nodes=>nodes instanceof HTMLElement?[nodes]:nodes instanceof Array?nodes:nodes instanceof NodeList?Array.from(nodes):nodes instanceof _jquery.default?nodes.get():Array.from(nodes);_exports.getList=getList;_exports.getFirst=nodes=>getList(nodes)[0]}));
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.getList=_exports.getFirst=_exports.getElement=void 0,_jquery=(obj=_jquery)&&obj.__esModule?obj:{default:obj};const getList=nodes=>nodes instanceof HTMLElement?[nodes]:nodes instanceof Array?nodes:nodes instanceof NodeList?Array.from(nodes):nodes instanceof _jquery.default?nodes.get():Array.from(nodes);_exports.getList=getList;_exports.getFirst=nodes=>getList(nodes)[0];_exports.getElement=node=>node instanceof HTMLElement?node:null!=node&&node._node?node._node:node instanceof _jquery.default&&node.length>0?node.get(0):null}));
//# sourceMappingURL=normalise.min.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"normalise.min.js","sources":["../src/normalise.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Normalisation helpers.\n *\n * @module core/normalise\n * @copyright 2020 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport jQuery from 'jquery';\n\n/**\n * Normalise a list of Nodes into an Array of Nodes.\n *\n * @method getList\n * @param {(Array|jQuery|NodeList|HTMLElement)} nodes\n * @returns {HTMLElement[]}\n */\nexport const getList = nodes => {\n if (nodes instanceof HTMLElement) {\n // A single record to conver to a NodeList.\n return [nodes];\n }\n\n if (nodes instanceof Array) {\n // A single record to conver to a NodeList.\n return nodes;\n }\n\n if (nodes instanceof NodeList) {\n // Already a NodeList.\n return Array.from(nodes);\n }\n\n if (nodes instanceof jQuery) {\n // A jQuery object to a NodeList.\n return nodes.get();\n }\n\n // Fallback to just having a go.\n return Array.from(nodes);\n};\n\n/**\n * Return the first element in a list of normalised Nodes.\n *\n * @param {Array|jQuery|NodeList|HTMLElement} nodes the unmormalised list of nodes\n * @returns {HTMLElement|undefined} the first list element\n */\nexport const getFirst = nodes => {\n const list = getList(nodes);\n return list[0];\n};\n"],"names":["getList","nodes","HTMLElement","Array","NodeList","from","jQuery","get"],"mappings":";;;;;;;qKAgCaA,QAAUC,OACfA,iBAAiBC,YAEV,CAACD,OAGRA,iBAAiBE,MAEVF,MAGPA,iBAAiBG,SAEVD,MAAME,KAAKJ,OAGlBA,iBAAiBK,gBAEVL,MAAMM,MAIVJ,MAAME,KAAKJ,kDASEA,OACPD,QAAQC,OACT"}
{"version":3,"file":"normalise.min.js","sources":["../src/normalise.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Normalisation helpers.\n *\n * @module core/normalise\n * @copyright 2020 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport jQuery from 'jquery';\n\n/**\n * Normalise a list of Nodes into an Array of Nodes.\n *\n * @method getList\n * @param {(Array|jQuery|NodeList|HTMLElement)} nodes\n * @returns {HTMLElement[]}\n */\nexport const getList = nodes => {\n if (nodes instanceof HTMLElement) {\n // A single record to conver to a NodeList.\n return [nodes];\n }\n\n if (nodes instanceof Array) {\n // A single record to conver to a NodeList.\n return nodes;\n }\n\n if (nodes instanceof NodeList) {\n // Already a NodeList.\n return Array.from(nodes);\n }\n\n if (nodes instanceof jQuery) {\n // A jQuery object to a NodeList.\n return nodes.get();\n }\n\n // Fallback to just having a go.\n return Array.from(nodes);\n};\n\n/**\n * Return the first element in a list of normalised Nodes.\n *\n * @param {Array|jQuery|NodeList|HTMLElement} nodes the unmormalised list of nodes\n * @returns {HTMLElement|undefined} the first list element\n */\nexport const getFirst = nodes => {\n const list = getList(nodes);\n return list[0];\n};\n\n/**\n * Normalise a single node into an HTMLElement.\n *\n * @param {jQuery|Y.Node|HTMLElement} node The node to normalise\n * @returns {HTMLElement}\n */\nexport const getElement = (node) => {\n if (node instanceof HTMLElement) {\n return node;\n }\n\n if (node?._node) {\n // This is likely a YUI Node.\n // We can use (node instanceof Y.Node) but we would have to load YUI to do some.\n return node._node;\n }\n\n if (node instanceof jQuery && node.length > 0) {\n return node.get(0);\n }\n\n return null;\n};\n"],"names":["getList","nodes","HTMLElement","Array","NodeList","from","jQuery","get","node","_node","length"],"mappings":";;;;;;;yLAgCaA,QAAUC,OACfA,iBAAiBC,YAEV,CAACD,OAGRA,iBAAiBE,MAEVF,MAGPA,iBAAiBG,SAEVD,MAAME,KAAKJ,OAGlBA,iBAAiBK,gBAEVL,MAAMM,MAIVJ,MAAME,KAAKJ,kDASEA,OACPD,QAAQC,OACT,uBASWO,MACnBA,gBAAgBN,YACTM,KAGPA,MAAAA,MAAAA,KAAMC,MAGCD,KAAKC,MAGZD,gBAAgBF,iBAAUE,KAAKE,OAAS,EACjCF,KAAKD,IAAI,GAGb"}
+1 -1
View File
@@ -1,3 +1,3 @@
define("core/utility",["core/str","core/pending","core/toast","core/notification"],(function(Str,_pending,_toast,_notification){var obj;Str=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(Str),_pending=(obj=_pending)&&obj.__esModule?obj:{default:obj};var _systemImportTransformerGlobalIdentifier="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}let registered=!1;const getModalString=(dataset,type,field)=>dataset["".concat(type).concat(field,"Str")]?Str.get_string.apply(null,JSON.parse(dataset["".concat(type).concat(field,"Str")])):Promise.resolve(dataset["".concat(type).concat(field)]),displayConfirmation=(source,type)=>{let confirmationPromise=null;return confirmationPromise="".concat(type,"Type")in source.dataset&&"delete"===source.dataset["".concat(type,"Type")]?(0,_notification.deleteCancelPromise)(getModalString(source.dataset,type,"Title"),getModalString(source.dataset,type,"Content"),getModalString(source.dataset,type,"YesButton")):(0,_notification.saveCancelPromise)(getModalString(source.dataset,type,"Title"),getModalString(source.dataset,type,"Content"),getModalString(source.dataset,type,"YesButton")),confirmationPromise.then((()=>{if("true"===source.dataset["".concat(type,"Toast")]){const stringForToast=getModalString(source.dataset,type,"ToastConfirmation");"string"==typeof stringForToast?(0,_toast.add)(stringForToast):stringForToast.then((str=>(0,_toast.add)(str))).catch((e=>(0,_notification.exception)(e)))}if(source.dataset["".concat(type,"Destination")])window.location.href=source.dataset["".concat(type,"Destination")];else{if(!source.closest("form"))throw new Error("No destination found for confirmation action");source.dataset.confirmation="none",source.dataset.modal="none",source.click()}})).catch((()=>{}))};registered||((()=>{document.addEventListener("click",(e=>{const confirmRequest=e.target.closest('[data-confirmation="modal"]');confirmRequest&&(e.preventDefault(),displayConfirmation(confirmRequest,"confirmation"));const modalConfirmation=e.target.closest('[data-modal="confirmation"]');modalConfirmation&&(e.preventDefault(),displayConfirmation(modalConfirmation,"modal"));const alertRequest=e.target.closest('[data-modal="alert"]');alertRequest&&(e.preventDefault(),(async(title,content)=>{const pendingPromise=new _pending.default("core/confirm:alert"),ModalFactory=await("function"==typeof _systemImportTransformerGlobalIdentifier.define&&_systemImportTransformerGlobalIdentifier.define.amd?new Promise((function(resolve,reject){_systemImportTransformerGlobalIdentifier.require(["core/modal_factory"],resolve,reject)})):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&_systemImportTransformerGlobalIdentifier.require&&"component"===_systemImportTransformerGlobalIdentifier.require.loader?Promise.resolve(require("core/modal_factory")):Promise.resolve(_systemImportTransformerGlobalIdentifier["core/modal_factory"]));ModalFactory.create({type:ModalFactory.types.ALERT,title:title,body:content,removeOnClose:!0}).then((function(modal){return modal.show(),pendingPromise.resolve(),modal}))})(getModalString(alertRequest.dataset,"modal","Title"),getModalString(alertRequest.dataset,"modal","Content")))}))})(),registered=!0)}));
define("core/utility",["core/str","core/pending","core/toast","core/notification"],(function(Str,_pending,_toast,_notification){var obj;Str=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(Str),_pending=(obj=_pending)&&obj.__esModule?obj:{default:obj};var _systemImportTransformerGlobalIdentifier="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}let registered=!1;const getModalString=function(dataset,type,field){let defaultValue=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return dataset["".concat(type).concat(field,"Str")]?Str.get_string.apply(null,JSON.parse(dataset["".concat(type).concat(field,"Str")])):dataset["".concat(type).concat(field)]?Promise.resolve(dataset["".concat(type).concat(field)]):defaultValue?Str.get_string.apply(null,defaultValue):null},displayConfirmation=(source,type)=>{let confirmationPromise=null;return confirmationPromise="".concat(type,"Type")in source.dataset&&"delete"===source.dataset["".concat(type,"Type")]?(0,_notification.deleteCancelPromise)(getModalString(source.dataset,type,"Title",["confirm","core"]),getModalString(source.dataset,type,"Content"),getModalString(source.dataset,type,"YesButton",["yes","core"])):(0,_notification.saveCancelPromise)(getModalString(source.dataset,type,"Title",["confirm","core"]),getModalString(source.dataset,type,"Content"),getModalString(source.dataset,type,"YesButton",["yes","core"])),confirmationPromise.then((()=>{if("true"===source.dataset["".concat(type,"Toast")]){const stringForToast=getModalString(source.dataset,type,"ToastConfirmation");"string"==typeof stringForToast?(0,_toast.add)(stringForToast):stringForToast.then((str=>(0,_toast.add)(str))).catch((e=>(0,_notification.exception)(e)))}if(source.dataset["".concat(type,"Destination")])return void(window.location.href=source.dataset["".concat(type,"Destination")]);if(source.closest("form"))return source.dataset.confirmation="none",source.dataset.modal="none",void source.click();const link=source.closest("a");if(link&&link.href&&"#"!==link.href)return void(window.location.href=link.href);if(source.closest('button, input[type="submit"], input[type="button"], input[type="reset"]'))return source.dataset.modalSubmitting=!0,void source.click();window.console.error("No destination found for ".concat(type," modal"))})).catch((()=>{}))};registered||((()=>{document.addEventListener("click",(e=>{if(e.target.closest("[data-modal-submitting]"))return;const confirmRequest=e.target.closest('[data-confirmation="modal"]');confirmRequest&&(e.preventDefault(),displayConfirmation(confirmRequest,"confirmation"));const modalConfirmation=e.target.closest('[data-modal="confirmation"]');modalConfirmation&&(e.preventDefault(),displayConfirmation(modalConfirmation,"modal"));const alertRequest=e.target.closest('[data-modal="alert"]');alertRequest&&(e.preventDefault(),(async(title,content)=>{const pendingPromise=new _pending.default("core/confirm:alert"),ModalFactory=await("function"==typeof _systemImportTransformerGlobalIdentifier.define&&_systemImportTransformerGlobalIdentifier.define.amd?new Promise((function(resolve,reject){_systemImportTransformerGlobalIdentifier.require(["core/modal_factory"],resolve,reject)})):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&_systemImportTransformerGlobalIdentifier.require&&"component"===_systemImportTransformerGlobalIdentifier.require.loader?Promise.resolve(require("core/modal_factory")):Promise.resolve(_systemImportTransformerGlobalIdentifier["core/modal_factory"]));ModalFactory.create({type:ModalFactory.types.ALERT,title:title,body:content,removeOnClose:!0}).then((function(modal){return modal.show(),pendingPromise.resolve(),modal}))})(getModalString(alertRequest.dataset,"modal","Title"),getModalString(alertRequest.dataset,"modal","Content")))}))})(),registered=!0)}));
//# sourceMappingURL=utility.min.js.map
File diff suppressed because one or more lines are too long
+5
View File
@@ -644,6 +644,11 @@ export default class Modal {
items.each((index, item) => {
item = $(item);
if (!item.is(':visible')) {
// Do not include items which are not visible in the z-index calculation.
// This is important because some dialogues are not removed from the DOM.
return;
}
// Note that webkit browsers won't return the z-index value from the CSS stylesheet
// if the element doesn't have a position specified. Instead it'll return "auto".
const itemZIndex = item.css('z-index') ? parseInt(item.css('z-index')) : 0;
+24
View File
@@ -65,3 +65,27 @@ export const getFirst = nodes => {
const list = getList(nodes);
return list[0];
};
/**
* Normalise a single node into an HTMLElement.
*
* @param {jQuery|Y.Node|HTMLElement} node The node to normalise
* @returns {HTMLElement}
*/
export const getElement = (node) => {
if (node instanceof HTMLElement) {
return node;
}
if (node?._node) {
// This is likely a YUI Node.
// We can use (node instanceof Y.Node) but we would have to load YUI to do some.
return node._node;
}
if (node instanceof jQuery && node.length > 0) {
return node.get(0);
}
return null;
};
+38 -9
View File
@@ -61,14 +61,23 @@ let registered = false;
* @param {HTMLElement} dataset The page element to fetch dataset items in
* @param {String} type The type of string to fetch
* @param {String} field The dataset field name to fetch the contents of
* @param {Array|null} [defaultValue=null] The default params to pass to get_string if no value is found in a dataset
* @return {Promise}
*
*/
const getModalString = (dataset, type, field) => {
const getModalString = (dataset, type, field, defaultValue = null) => {
if (dataset[`${type}${field}Str`]) {
return Str.get_string.apply(null, JSON.parse(dataset[`${type}${field}Str`]));
}
return Promise.resolve(dataset[`${type}${field}`]);
if (dataset[`${type}${field}`]) {
return Promise.resolve(dataset[`${type}${field}`]);
}
if (defaultValue) {
return Str.get_string.apply(null, defaultValue);
}
return null;
};
/**
@@ -83,15 +92,15 @@ const displayConfirmation = (source, type) => {
let confirmationPromise = null;
if (`${type}Type` in source.dataset && source.dataset[`${type}Type`] === 'delete') {
confirmationPromise = deleteCancelPromise(
getModalString(source.dataset, type, 'Title'),
getModalString(source.dataset, type, 'Title', ['confirm', 'core']),
getModalString(source.dataset, type, 'Content'),
getModalString(source.dataset, type, 'YesButton'),
getModalString(source.dataset, type, 'YesButton', ['yes', 'core'])
);
} else {
confirmationPromise = saveCancelPromise(
getModalString(source.dataset, type, 'Title'),
getModalString(source.dataset, type, 'Title', ['confirm', 'core']),
getModalString(source.dataset, type, 'Content'),
getModalString(source.dataset, type, 'YesButton'),
getModalString(source.dataset, type, 'YesButton', ['yes', 'core'])
);
}
return confirmationPromise.then(() => {
@@ -106,7 +115,10 @@ const displayConfirmation = (source, type) => {
if (source.dataset[`${type}Destination`]) {
window.location.href = source.dataset[`${type}Destination`];
} else if (source.closest('form')) {
return;
}
if (source.closest('form')) {
// Update the modal and confirmation data fields so that we don't loop.
source.dataset.confirmation = 'none';
source.dataset.modal = 'none';
@@ -114,9 +126,23 @@ const displayConfirmation = (source, type) => {
// Click on the button again.
// Note: Do not use the form.submit() because it will not work for cancel buttons.
source.click();
} else {
throw new Error("No destination found for confirmation action");
return;
}
const link = source.closest('a');
if (link && link.href && link.href !== '#') {
window.location.href = link.href;
return;
}
const button = source.closest('button, input[type="submit"], input[type="button"], input[type="reset"]');
if (button) {
source.dataset.modalSubmitting = true;
source.click();
return;
}
window.console.error(`No destination found for ${type} modal`);
return;
}).catch(() => {
return;
@@ -158,6 +184,9 @@ const displayAlert = async(title, content) => {
*/
const registerConfirmationListeners = () => {
document.addEventListener('click', e => {
if (e.target.closest('[data-modal-submitting]')) {
return;
}
const confirmRequest = e.target.closest('[data-confirmation="modal"]');
if (confirmRequest) {
e.preventDefault();
@@ -3185,7 +3185,6 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorFilepicker]);
"node-event-simulate",
"yui-throttle",
"moodle-core-notification-dialogue",
"moodle-core-notification-confirm",
"moodle-editor_atto-rangy",
"handlebars",
"timers",
File diff suppressed because one or more lines are too long
@@ -3160,7 +3160,6 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorFilepicker]);
"node-event-simulate",
"yui-throttle",
"moodle-core-notification-dialogue",
"moodle-core-notification-confirm",
"moodle-editor_atto-rangy",
"handlebars",
"timers",
@@ -13,7 +13,6 @@
"node-event-simulate",
"yui-throttle",
"moodle-core-notification-dialogue",
"moodle-core-notification-confirm",
"moodle-editor_atto-rangy",
"handlebars",
"timers",
+13 -42
View File
@@ -826,6 +826,7 @@ M.form_filemanager.init = function(Y, options) {
if (!confirmed) {
dialog_options.message = M.util.get_string('confirmrenamefolder', 'repository');
this.show_confirm_dialog(dialog_options);
this.selectui.hide();
return;
}
params = {filepath:fileinfo.filepath, newdirname:newfilename, newfilepath:targetpath};
@@ -903,49 +904,19 @@ M.form_filemanager.init = function(Y, options) {
* Displays a confirmation dialog
* Expected attributes in dialog_options: message, callback, callbackargs(optional), scope(optional)
*/
show_confirm_dialog: function(dialog_options) {
// instead of M.util.show_confirm_dialog(e, dialog_options);
if (!this.confirm_dlg) {
this.confirm_dlg_node = Y.Node.create(M.form_filemanager.templates.confirmdialog);
var node = this.confirm_dlg_node;
node.generateID();
this.confirm_dlg = new M.core.dialogue({
draggable : true,
bodyContent : node,
centered : true,
modal : true,
visible : false,
buttons : {},
show_confirm_dialog: function(dialogOptions) {
require(['core/notification', 'core/str'], function(Notification, Str) {
Notification.saveCancelPromise(
Str.get_string('confirm', 'moodle'),
dialogOptions.message,
Str.get_string('yes', 'moodle')
).then(function() {
dialogOptions.callback.apply(dialogOptions.scope, dialogOptions.callbackargs);
return;
}).catch(function() {
// User cancelled.
});
var handle_confirm = function(ev) {
var dlgopt = this.confirm_dlg.dlgopt;
ev.preventDefault();
this.confirm_dlg.hide();
if (dlgopt.callback) {
if (dlgopt.callbackargs) {
dlgopt.callback.apply(dlgopt.scope || this, dlgopt.callbackargs);
} else {
dlgopt.callback.apply(dlgopt.scope || this);
}
}
}
var handle_cancel = function(ev) {
ev.preventDefault();
this.confirm_dlg.hide();
}
node.one('.fp-dlg-butconfirm').on('click', handle_confirm, this);
node.one('.fp-dlg-butcancel').on('click', handle_cancel, this);
}
// This used to focus on before active element after confirm dialogue closed.
if (typeof dialog_options.previousActiveElement != 'undefined') {
this.confirm_dlg.set('focusAfterHide', dialog_options.previousActiveElement);
}
this.confirm_dlg.dlgopt = dialog_options;
if (typeof dialog_options.header != 'undefined') {
this.confirm_dlg.set('headerContent', dialog_options.header);
}
this.confirm_dlg_node.one('.fp-dlg-text').setContent(dialog_options.message);
this.confirm_dlg.show();
});
},
setup_select_file: function() {
var selectnode = this.selectnode;
+62 -79
View File
@@ -1,3 +1,4 @@
/* eslint-disable camelcase */
// Miscellaneous core Javascript functions for Moodle
// Global M object is initilised in inline javascript
@@ -56,13 +57,8 @@ M.util.image_url = function(imagename, component) {
return url;
};
M.util.in_array = function(item, array){
for( var i = 0; i<array.length; i++){
if(item==array[i]){
return true;
}
}
return false;
M.util.in_array = function(item, array) {
return array.indexOf(item) !== -1;
};
/**
@@ -236,91 +232,78 @@ M.util.set_user_preference = function(name, value) {
* @param {String} [args.cancellabel] The label to use on the cancel button.
* @param {String} [args.continuelabel] The label to use on the continue button.
*/
M.util.show_confirm_dialog = function(e, args) {
var target = e.target;
M.util.show_confirm_dialog = (e, {
message,
continuelabel,
callback = null,
scope = null,
callbackargs = [],
} = {}) => {
if (e.preventDefault) {
e.preventDefault();
}
require(['core_form/changechecker'], function(FormChangeChecker) {
// eslint-disable-next-line no-undef, new-cap
YUI().use('moodle-core-notification-confirm', function(Y) {
var confirmationDialogue = new M.core.confirm({
width: '300px',
center: true,
modal: true,
visible: false,
draggable: false,
title: M.util.get_string('confirmation', 'admin'),
noLabel: M.util.get_string('cancel', 'moodle'),
question: args.message
});
require(
['core/notification', 'core/str', 'core_form/changechecker', 'core/normalise'],
function(Notification, Str, FormChangeChecker, Normalise) {
// The dialogue was submitted with a positive value indication.
confirmationDialogue.on('complete-yes', function(e) {
// Handle any callbacks.
if (args.callback) {
if (!Y.Lang.isFunction(args.callback)) {
Y.log('Callbacks to show_confirm_dialog must now be functions. ' +
'Please update your code to pass in a function instead.',
'warn', 'M.util.show_confirm_dialog');
return;
}
if (scope === null && e.target) {
// Fall back to the event target if no scope provided.
scope = e.target;
}
var scope = e.target;
if (Y.Lang.isObject(args.scope)) {
scope = args.scope;
}
var callbackargs = args.callbackargs || [];
args.callback.apply(scope, callbackargs);
Notification.saveCancelPromise(
Str.get_string('confirmation', 'admin'),
message,
continuelabel || Str.get_string('yes', 'moodle'),
)
.then(() => {
if (callback) {
callback.apply(scope, callbackargs);
return;
}
var targetancestor = null,
targetform = null;
if (target.test('a')) {
window.location = target.get('href');
} else if ((targetancestor = target.ancestor('a')) !== null) {
window.location = targetancestor.get('href');
} else if (target.test('input') || target.test('button')) {
targetform = target.ancestor('form', true);
if (!targetform) {
return;
}
if (target.get('name') && target.get('value')) {
targetform.append('<input type="hidden" name="' + target.get('name') +
'" value="' + target.get('value') + '">');
FormChangeChecker.markFormAsDirty(targetform.getDOMNode());
}
targetform.submit();
} else if (target.test('form')) {
FormChangeChecker.markFormAsDirty(target.getDOMNode());
target.submit();
} else {
Y.log("Element of type " + target.get('tagName') +
" is not supported by the M.util.show_confirm_dialog function. Use A, INPUT, BUTTON or FORM",
'warn', 'javascript-static');
if (!e.target) {
window.console.error(
`M.util.show_confirm_dialog: No target found for event`,
e
);
return;
}
}, this);
if (args.cancellabel) {
confirmationDialogue.set('noLabel', args.cancellabel);
}
const target = Normalise.getElement(e.target);
if (args.continuelabel) {
confirmationDialogue.set('yesLabel', args.continuelabel);
}
if (target.closest('a')) {
window.location = target.closest('a').getAttribute('href');
return;
} else if (target.closest('input') || target.closest('button')) {
const form = target.closest('form');
const hiddenValue = document.createElement('input');
hiddenValue.setAttribute('type', 'hidden');
hiddenValue.setAttribute('name', target.getAttribute('name'));
hiddenValue.setAttribute('value', target.getAttribute('value'));
form.appendChild(hiddenValue);
FormChangeChecker.markFormAsDirty(form);
form.submit();
return;
} else if (target.closest('form')) {
const form = target.closest('form');
FormChangeChecker.markFormAsDirty(form);
form.submit();
return;
}
window.console.error(
`Element of type ${target.tagName} is not supported by M.util.show_confirm_dialog.`
);
confirmationDialogue.render()
.show();
});
});
return;
})
.catch(() => {
// User cancelled.
return;
});
}
);
};
/** Useful for full embedding of various stuff */
+5
View File
@@ -66,6 +66,11 @@ information provided here is intended especially for developers.
that need to perform processing when a question is deleted should observe the \core\event\question_deleted event instead.
* The external function core_grades_get_groups_for_selector is now relocated.
Please use it at core_group_get_groups_for_selector instead.
* The M.util.show_confirm_dialog function has been rewritten as an ESM to use the core/notification module instead.
See MDL-77174 for further information.
* The moodle-core-notification-confirm module, found under the M.core.confirm namespace, has been deprecated.
Any code using it should be rewritten as an ESM and use the core/notification module instead.
See MDL-77174 for further information.
=== 4.2 ===
@@ -87,6 +87,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
_question: null,
initializer: function() {
window.console.error(
'The module "moodle-core-notification-confirm" module has been deprecated and will be removed in Moodle 4.4.'
);
this._closeEvents = [];
this.publish('complete');
this.publish('complete-yes');
@@ -1 +1 @@
YUI.add("moodle-core-notification-confirm",function(i,t){var e;M.core=M.core||{},i.extend(e=function(t){e.superclass.constructor.apply(this,[t])},M.core.notification.info,{_closeEvents:null,_yesButton:null,_noButton:null,_question:null,initializer:function(){var t;this._closeEvents=[],this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no"),this._yesButton=i.Node.create('<input type="button" class="btn btn-primary" id="id_yuiconfirmyes-'+this.get("COUNT")+'" value="'+this.get("yesLabel")+'" />'),this._noButton=i.Node.create('<input type="button" class="btn btn-secondary" id="id_yuiconfirmno-'+this.get("COUNT")+'" value="'+this.get("noLabel")+'" />'),this._question=i.Node.create('<div class="confirmation-message">'+this.get("question")+"</div>"),t=i.Node.create('<div class="confirmation-dialogue"></div>').append(this._question).append(i.Node.create('<div class="confirmation-buttons form-inline justify-content-around"></div>').append(this._yesButton).append(this._noButton)),this.get("notificationBase").addClass("moodle-dialogue-confirm"),this.setStdModContent(i.WidgetStdMod.BODY,t,i.WidgetStdMod.REPLACE),this.setStdModContent(i.WidgetStdMod.HEADER,'<h5 id="moodle-dialogue-'+this.get("COUNT")+'-wrap-header-text">'+this.get("title")+"</h5>",i.WidgetStdMod.REPLACE),this._closeEvents.push(i.on("key",this.submit,window,"down:27",this,!1),this._yesButton.on("click",this.submit,this,!0),this._noButton.on("click",this.submit,this,!1)),(t=this.get("boundingBox").one(".closebutton"))&&this._closeEvents.push(t.on("click",this.submit,this))},submit:function(t,e){new i.EventHandle(this._closeEvents).detach(),this.fire("complete",e),e?this.fire("complete-yes"):this.fire("complete-no"),this.hide(),this.destroy()}},{NAME:"Moodle confirmation dialogue",CSS_PREFIX:"moodle-dialogue",ATTRS:{yesLabel:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("yes","moodle")},setter:function(t){return this._yesButton&&this._yesButton.set("value",t),t}},noLabel:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("no","moodle")},setter:function(t){return this._noButton&&this._noButton.set("value",t),t}},title:{validator:i.Lang.isString,value:M.util.get_string("confirm","moodle")},question:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("areyousure","moodle")},setter:function(t){return this._question&&this._question.set("value",t),t}}}}),i.augment(e,i.EventTarget),M.core.confirm=e},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
YUI.add("moodle-core-notification-confirm",function(i,t){var e;M.core=M.core||{},i.extend(e=function(t){e.superclass.constructor.apply(this,[t])},M.core.notification.info,{_closeEvents:null,_yesButton:null,_noButton:null,_question:null,initializer:function(){var t;window.console.error('The module "moodle-core-notification-confirm" module has been deprecated and will be removed in Moodle 4.4.'),this._closeEvents=[],this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no"),this._yesButton=i.Node.create('<input type="button" class="btn btn-primary" id="id_yuiconfirmyes-'+this.get("COUNT")+'" value="'+this.get("yesLabel")+'" />'),this._noButton=i.Node.create('<input type="button" class="btn btn-secondary" id="id_yuiconfirmno-'+this.get("COUNT")+'" value="'+this.get("noLabel")+'" />'),this._question=i.Node.create('<div class="confirmation-message">'+this.get("question")+"</div>"),t=i.Node.create('<div class="confirmation-dialogue"></div>').append(this._question).append(i.Node.create('<div class="confirmation-buttons form-inline justify-content-around"></div>').append(this._yesButton).append(this._noButton)),this.get("notificationBase").addClass("moodle-dialogue-confirm"),this.setStdModContent(i.WidgetStdMod.BODY,t,i.WidgetStdMod.REPLACE),this.setStdModContent(i.WidgetStdMod.HEADER,'<h5 id="moodle-dialogue-'+this.get("COUNT")+'-wrap-header-text">'+this.get("title")+"</h5>",i.WidgetStdMod.REPLACE),this._closeEvents.push(i.on("key",this.submit,window,"down:27",this,!1),this._yesButton.on("click",this.submit,this,!0),this._noButton.on("click",this.submit,this,!1)),(t=this.get("boundingBox").one(".closebutton"))&&this._closeEvents.push(t.on("click",this.submit,this))},submit:function(t,e){new i.EventHandle(this._closeEvents).detach(),this.fire("complete",e),e?this.fire("complete-yes"):this.fire("complete-no"),this.hide(),this.destroy()}},{NAME:"Moodle confirmation dialogue",CSS_PREFIX:"moodle-dialogue",ATTRS:{yesLabel:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("yes","moodle")},setter:function(t){return this._yesButton&&this._yesButton.set("value",t),t}},noLabel:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("no","moodle")},setter:function(t){return this._noButton&&this._noButton.set("value",t),t}},title:{validator:i.Lang.isString,value:M.util.get_string("confirm","moodle")},question:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("areyousure","moodle")},setter:function(t){return this._question&&this._question.set("value",t),t}}}}),i.augment(e,i.EventTarget),M.core.confirm=e},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
@@ -87,6 +87,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
_question: null,
initializer: function() {
window.console.error(
'The module "moodle-core-notification-confirm" module has been deprecated and will be removed in Moodle 4.4.'
);
this._closeEvents = [];
this.publish('complete');
this.publish('complete-yes');
+3
View File
@@ -57,6 +57,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
_question: null,
initializer: function() {
window.console.error(
'The module "moodle-core-notification-confirm" module has been deprecated and will be removed in Moodle 4.4.'
);
this._closeEvents = [];
this.publish('complete');
this.publish('complete-yes');
@@ -707,11 +707,12 @@ abstract class attempts_report_table extends \table_sql {
'data-action' => 'toggle',
'data-togglegroup' => $this->togglegroup,
'data-toggle' => 'action',
'disabled' => true
'disabled' => true,
'data-modal' => 'confirmation',
'data-modal-type' => 'delete',
'data-modal-content-str' => json_encode(['deleteattemptcheck', 'quiz']),
];
echo html_writer::empty_tag('input', $deletebuttonparams);
$PAGE->requires->event_handler('#deleteattemptsbutton', 'click', 'M.util.show_confirm_dialog',
['message' => get_string('deleteattemptcheck', 'quiz')]);
}
}
@@ -407,39 +407,42 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
ev.preventDefault();
// Get the element we're working on.
var element = activity,
// Create confirm string (different if element has or does not have name)
confirmstring = '',
qtypename = M.util.get_string('pluginname',
'qtype_' + element.getAttribute('class').match(/qtype_([^\s]*)/)[1]);
confirmstring = M.util.get_string('confirmremovequestion', 'quiz', qtypename);
var element = activity;
// Create confirm string (different if element has or does not have name)
var qtypename = M.util.get_string(
'pluginname',
'qtype_' + element.getAttribute('class').match(/qtype_([^\s]*)/)[1]
);
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: confirmstring,
modal: true
});
// If it is confirmed.
confirm.on('complete-yes', function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.mod_quiz.util.slot.getId(element)
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
// Actually remove the element.
Y.Moodle.mod_quiz.util.slot.remove(element);
this.reorganise_edit_page();
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu(ev);
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirm', 'moodle'),
M.util.get_string('confirmremovequestion', 'quiz', qtypename),
M.util.get_string('yes', 'moodle')
).then(function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.mod_quiz.util.slot.getId(element)
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
// Actually remove the element.
Y.Moodle.mod_quiz.util.slot.remove(element);
this.reorganise_edit_page();
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu(ev);
}
}
}
});
});
}, this);
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
},
/**
@@ -481,12 +484,12 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
var problemsection = this.find_sections_that_would_become_empty();
if (typeof problemsection !== 'undefined') {
var alert = new M.core.alert({
title: M.util.get_string('cannotremoveslots', 'quiz'),
message: M.util.get_string('cannotremoveallsectionslots', 'quiz', problemsection)
require(['core/notification'], function(Notification) {
Notification.alert(
M.util.get_string('cannotremoveslots', 'quiz'),
M.util.get_string('cannotremoveallsectionslots', 'quiz', problemsection)
);
});
alert.show();
} else {
this.delete_multiple_with_confirmation(ev);
}
@@ -517,37 +520,39 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
return;
}
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: M.util.get_string('areyousureremoveselected', 'quiz'),
modal: true
});
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirm', 'moodle'),
M.util.get_string('areyousureremoveselected', 'quiz'),
M.util.get_string('yes', 'moodle')
).then(function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
field: 'deletemultiple',
ids: ids
};
// Delete items on server.
this.send_request(data, spinner, function(response) {
// Delete locally if deleted on server.
if (response.deleted) {
// Actually remove the element.
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX + ':checked').each(function(node) {
Y.Moodle.mod_quiz.util.slot.remove(node.ancestor('li.activity'));
});
// Update the page numbers and sections.
this.reorganise_edit_page();
// If it is confirmed.
confirm.on('complete-yes', function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
field: 'deletemultiple',
ids: ids
};
// Delete items on server.
this.send_request(data, spinner, function(response) {
// Delete locally if deleted on server.
if (response.deleted) {
// Actually remove the element.
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX + ':checked').each(function(node) {
Y.Moodle.mod_quiz.util.slot.remove(node.ancestor('li.activity'));
});
// Update the page numbers and sections.
this.reorganise_edit_page();
// Remove the select multiple options.
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
}
});
// Remove the select multiple options.
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
}
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}, this);
}.bind(this));
},
/**
@@ -924,31 +929,30 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
* @chainable
*/
delete_section_with_confirmation: function(ev, button, activity) {
// Prevent the default button action.
ev.preventDefault();
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirm', 'moodle'),
M.util.get_string('confirmremovesectionheading', 'quiz', activity.getData('sectionname')),
M.util.get_string('yes', 'moodle')
).then(function() {
var spinner = M.util.add_spinner(Y, activity.one(SELECTOR.ACTIONAREA));
var data = {
'class': 'section',
'action': 'DELETE',
'id': activity.get('id').replace('section-', '')
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
window.location.reload(true);
}
});
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: M.util.get_string('confirmremovesectionheading', 'quiz', activity.getData('sectionname')),
modal: true
});
// If it is confirmed.
confirm.on('complete-yes', function() {
var spinner = M.util.add_spinner(Y, activity.one(SELECTOR.ACTIONAREA));
var data = {
'class': 'section',
'action': 'DELETE',
'id': activity.get('id').replace('section-', '')
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
window.location.reload(true);
}
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}, this);
}.bind(this));
},
/**
File diff suppressed because one or more lines are too long
@@ -407,39 +407,42 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
ev.preventDefault();
// Get the element we're working on.
var element = activity,
// Create confirm string (different if element has or does not have name)
confirmstring = '',
qtypename = M.util.get_string('pluginname',
'qtype_' + element.getAttribute('class').match(/qtype_([^\s]*)/)[1]);
confirmstring = M.util.get_string('confirmremovequestion', 'quiz', qtypename);
var element = activity;
// Create confirm string (different if element has or does not have name)
var qtypename = M.util.get_string(
'pluginname',
'qtype_' + element.getAttribute('class').match(/qtype_([^\s]*)/)[1]
);
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: confirmstring,
modal: true
});
// If it is confirmed.
confirm.on('complete-yes', function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.mod_quiz.util.slot.getId(element)
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
// Actually remove the element.
Y.Moodle.mod_quiz.util.slot.remove(element);
this.reorganise_edit_page();
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu(ev);
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirm', 'moodle'),
M.util.get_string('confirmremovequestion', 'quiz', qtypename),
M.util.get_string('yes', 'moodle')
).then(function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.mod_quiz.util.slot.getId(element)
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
// Actually remove the element.
Y.Moodle.mod_quiz.util.slot.remove(element);
this.reorganise_edit_page();
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu(ev);
}
}
}
});
});
}, this);
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
},
/**
@@ -481,12 +484,12 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
var problemsection = this.find_sections_that_would_become_empty();
if (typeof problemsection !== 'undefined') {
var alert = new M.core.alert({
title: M.util.get_string('cannotremoveslots', 'quiz'),
message: M.util.get_string('cannotremoveallsectionslots', 'quiz', problemsection)
require(['core/notification'], function(Notification) {
Notification.alert(
M.util.get_string('cannotremoveslots', 'quiz'),
M.util.get_string('cannotremoveallsectionslots', 'quiz', problemsection)
);
});
alert.show();
} else {
this.delete_multiple_with_confirmation(ev);
}
@@ -517,37 +520,39 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
return;
}
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: M.util.get_string('areyousureremoveselected', 'quiz'),
modal: true
});
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirm', 'moodle'),
M.util.get_string('areyousureremoveselected', 'quiz'),
M.util.get_string('yes', 'moodle')
).then(function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
field: 'deletemultiple',
ids: ids
};
// Delete items on server.
this.send_request(data, spinner, function(response) {
// Delete locally if deleted on server.
if (response.deleted) {
// Actually remove the element.
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX + ':checked').each(function(node) {
Y.Moodle.mod_quiz.util.slot.remove(node.ancestor('li.activity'));
});
// Update the page numbers and sections.
this.reorganise_edit_page();
// If it is confirmed.
confirm.on('complete-yes', function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
field: 'deletemultiple',
ids: ids
};
// Delete items on server.
this.send_request(data, spinner, function(response) {
// Delete locally if deleted on server.
if (response.deleted) {
// Actually remove the element.
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX + ':checked').each(function(node) {
Y.Moodle.mod_quiz.util.slot.remove(node.ancestor('li.activity'));
});
// Update the page numbers and sections.
this.reorganise_edit_page();
// Remove the select multiple options.
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
}
});
// Remove the select multiple options.
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
}
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}, this);
}.bind(this));
},
/**
@@ -924,31 +929,30 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
* @chainable
*/
delete_section_with_confirmation: function(ev, button, activity) {
// Prevent the default button action.
ev.preventDefault();
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirm', 'moodle'),
M.util.get_string('confirmremovesectionheading', 'quiz', activity.getData('sectionname')),
M.util.get_string('yes', 'moodle')
).then(function() {
var spinner = M.util.add_spinner(Y, activity.one(SELECTOR.ACTIONAREA));
var data = {
'class': 'section',
'action': 'DELETE',
'id': activity.get('id').replace('section-', '')
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
window.location.reload(true);
}
});
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: M.util.get_string('confirmremovesectionheading', 'quiz', activity.getData('sectionname')),
modal: true
});
// If it is confirmed.
confirm.on('complete-yes', function() {
var spinner = M.util.add_spinner(Y, activity.one(SELECTOR.ACTIONAREA));
var data = {
'class': 'section',
'action': 'DELETE',
'id': activity.get('id').replace('section-', '')
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
window.location.reload(true);
}
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}, this);
}.bind(this));
},
/**
+67 -62
View File
@@ -174,39 +174,42 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
ev.preventDefault();
// Get the element we're working on.
var element = activity,
// Create confirm string (different if element has or does not have name)
confirmstring = '',
qtypename = M.util.get_string('pluginname',
'qtype_' + element.getAttribute('class').match(/qtype_([^\s]*)/)[1]);
confirmstring = M.util.get_string('confirmremovequestion', 'quiz', qtypename);
var element = activity;
// Create confirm string (different if element has or does not have name)
var qtypename = M.util.get_string(
'pluginname',
'qtype_' + element.getAttribute('class').match(/qtype_([^\s]*)/)[1]
);
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: confirmstring,
modal: true
});
// If it is confirmed.
confirm.on('complete-yes', function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.mod_quiz.util.slot.getId(element)
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
// Actually remove the element.
Y.Moodle.mod_quiz.util.slot.remove(element);
this.reorganise_edit_page();
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu(ev);
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirm', 'moodle'),
M.util.get_string('confirmremovequestion', 'quiz', qtypename),
M.util.get_string('yes', 'moodle')
).then(function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.mod_quiz.util.slot.getId(element)
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
// Actually remove the element.
Y.Moodle.mod_quiz.util.slot.remove(element);
this.reorganise_edit_page();
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu(ev);
}
}
}
});
});
}, this);
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
},
/**
@@ -248,12 +251,12 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
var problemsection = this.find_sections_that_would_become_empty();
if (typeof problemsection !== 'undefined') {
var alert = new M.core.alert({
title: M.util.get_string('cannotremoveslots', 'quiz'),
message: M.util.get_string('cannotremoveallsectionslots', 'quiz', problemsection)
require(['core/notification'], function(Notification) {
Notification.alert(
M.util.get_string('cannotremoveslots', 'quiz'),
M.util.get_string('cannotremoveallsectionslots', 'quiz', problemsection)
);
});
alert.show();
} else {
this.delete_multiple_with_confirmation(ev);
}
@@ -284,37 +287,39 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
return;
}
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: M.util.get_string('areyousureremoveselected', 'quiz'),
modal: true
});
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirm', 'moodle'),
M.util.get_string('areyousureremoveselected', 'quiz'),
M.util.get_string('yes', 'moodle')
).then(function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
field: 'deletemultiple',
ids: ids
};
// Delete items on server.
this.send_request(data, spinner, function(response) {
// Delete locally if deleted on server.
if (response.deleted) {
// Actually remove the element.
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX + ':checked').each(function(node) {
Y.Moodle.mod_quiz.util.slot.remove(node.ancestor('li.activity'));
});
// Update the page numbers and sections.
this.reorganise_edit_page();
// If it is confirmed.
confirm.on('complete-yes', function() {
var spinner = this.add_spinner(element);
var data = {
'class': 'resource',
field: 'deletemultiple',
ids: ids
};
// Delete items on server.
this.send_request(data, spinner, function(response) {
// Delete locally if deleted on server.
if (response.deleted) {
// Actually remove the element.
Y.all(SELECTOR.SELECTMULTIPLECHECKBOX + ':checked').each(function(node) {
Y.Moodle.mod_quiz.util.slot.remove(node.ancestor('li.activity'));
});
// Update the page numbers and sections.
this.reorganise_edit_page();
// Remove the select multiple options.
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
}
});
// Remove the select multiple options.
Y.one('body').removeClass(CSS.SELECTMULTIPLE);
}
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}, this);
}.bind(this));
},
/**
+21 -22
View File
@@ -108,31 +108,30 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
* @chainable
*/
delete_section_with_confirmation: function(ev, button, activity) {
// Prevent the default button action.
ev.preventDefault();
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirm', 'moodle'),
M.util.get_string('confirmremovesectionheading', 'quiz', activity.getData('sectionname')),
M.util.get_string('yes', 'moodle')
).then(function() {
var spinner = M.util.add_spinner(Y, activity.one(SELECTOR.ACTIONAREA));
var data = {
'class': 'section',
'action': 'DELETE',
'id': activity.get('id').replace('section-', '')
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
window.location.reload(true);
}
});
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: M.util.get_string('confirmremovesectionheading', 'quiz', activity.getData('sectionname')),
modal: true
});
// If it is confirmed.
confirm.on('complete-yes', function() {
var spinner = M.util.add_spinner(Y, activity.one(SELECTOR.ACTIONAREA));
var data = {
'class': 'section',
'action': 'DELETE',
'id': activity.get('id').replace('section-', '')
};
this.send_request(data, spinner, function(response) {
if (response.deleted) {
window.location.reload(true);
}
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}, this);
}.bind(this));
},
/**
@@ -1,18 +1,18 @@
@mod @mod_workshop
Feature: File types of the submission and feedback attachments can be limitted
In order to constrain student submission and feedback attachments
As a teacher
I need to be able to specify the list of allowed file types
In order to constrain student submission and feedback attachments
As a teacher
I need to be able to specify the list of allowed file types
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| username | firstname | lastname | email |
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
| student1 | Sam1 | Student1 | student1@example.com |
| student2 | Sam2 | Student2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname |
| Course1 | c1 |
| fullname | shortname |
| Course1 | c1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | c1 | editingteacher |
@@ -44,7 +44,7 @@ Feature: File types of the submission and feedback attachments can be limitted
And I set the field "Name" to "testable.php"
And I press "Update"
And I should see "The original file extension has been modified as a part of the file name change. Changing the extension from \".png\" to \".php\" may result in a file which cannot be opened."
And I click on "OK" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
And I click on "Yes" "button" in the "Confirm" "dialogue"
When I press "Save changes"
Then I should see "Some files (testable.php) cannot be uploaded. Only file types image are allowed."
# Remove the invalid file and attach an image instead.
@@ -96,7 +96,7 @@ Feature: File types of the submission and feedback attachments can be limitted
And I set the field "Name" to "renamed.png"
And I press "Update"
And I should see "The original file extension has been modified as a part of the file name change. Changing the extension from \".php\" to \".png\" may result in a file which cannot be opened."
And I click on "OK" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
And I click on "Yes" "button" in the "Confirm" "dialogue"
When I press "Save and close"
Then I should see "Some files (renamed.png) cannot be uploaded. Only file types .php are allowed."
And I should not see "Assigned submissions to assess"
+5 -5
View File
@@ -65,8 +65,11 @@ foreach ($accounts as $account) {
$menu->add(new action_menu_link_secondary($account->get_edit_url(), null, get_string('edit')));
if (!$account->get('archived')) {
$deleteurl = $account->get_edit_url(['delete' => 1, 'sesskey' => sesskey()]);
$menu->add(new action_menu_link_secondary($deleteurl, null, get_string('deleteorarchive', 'payment'),
['data-action' => 'delete']));
$menu->add(new action_menu_link_secondary($deleteurl, null, get_string('deleteorarchive', 'payment'), [
'data-modal' => 'confirmation',
'data-modal-type' => 'delete',
'data-modal-content-str' => json_encode(['accountdeleteconfirm', 'payment']),
]));
} else {
$restoreurl = $account->get_edit_url(['restore' => 1, 'sesskey' => sesskey()]);
$menu->add(new action_menu_link_secondary($restoreurl, null, get_string('restoreaccount', 'payment')));
@@ -88,9 +91,6 @@ if (has_capability('moodle/site:config', context_system::instance())) {
echo html_writer::div(html_writer::table($table), 'position-relative');
$PAGE->requires->event_handler('[data-action=delete]', 'click', 'M.util.show_confirm_dialog',
array('message' => get_string('accountdeleteconfirm', 'payment')));
echo html_writer::div(html_writer::link(new moodle_url($PAGE->url, ['showarchived' => !$showarchived]),
$showarchived ? get_string('hidearchived', 'payment') : get_string('showarchived', 'payment')), 'mdl-right');
+4 -7
View File
@@ -16,9 +16,8 @@ Feature: Manage payment accounts
And I choose "Edit" in the open action menu
And I set the field "Account name" to "NewName"
And I press "Save changes"
And I should see "PayPal" in the "NewName" "table_row"
And I should not see "TestAccount"
And I log out
And I should see "PayPal" in the "NewName" "table_row"
@javascript
Scenario: Configuring gateways on payment accounts
@@ -37,9 +36,8 @@ Feature: Manage payment accounts
| Secret | Test |
| Enable | 1 |
And I press "Save changes"
And I should see "PayPal" in the "Account1" "table_row"
And I should not see "Not available" in the "Account1" "table_row"
And I log out
And I should see "PayPal" in the "Account1" "table_row"
@javascript
Scenario: Deleting payment accounts
@@ -51,10 +49,9 @@ Feature: Manage payment accounts
And I navigate to "Payments > Payment accounts" in site administration
And I open the action menu in "Account1" "table_row"
And I choose "Delete or archive" in the open action menu
And I click on "Yes" "button" in the "Confirmation" "dialogue"
And I click on "Yes" "button" in the "Confirm" "dialogue"
Then I should not see "Account1"
And I should see "Account2"
And I log out
@javascript
Scenario: Archiving and restoring accounts
@@ -73,7 +70,7 @@ Feature: Manage payment accounts
And I navigate to "Payments > Payment accounts" in site administration
And I open the action menu in "Account1" "table_row"
And I choose "Delete or archive" in the open action menu
And I click on "Yes" "button" in the "Confirmation" "dialogue"
And I click on "Yes" "button" in the "Confirm" "dialogue"
Then I should not see "Account1"
And I should see "Account2"
And I follow "Show archived"
+1 -1
View File
@@ -172,7 +172,7 @@ class behat_filepicker extends behat_base {
$this->perform_on_element('delete', $exception);
// Yes, we are sure.
$this->execute('behat_general::i_click_on_in_the', [get_string('ok'), 'button', get_string('confirm'), 'dialogue']);
$this->execute('behat_general::i_click_on_in_the', [get_string('yes'), 'button', get_string('confirm'), 'dialogue']);
}
/**
+10 -10
View File
@@ -1,8 +1,8 @@
@core @core_filepicker @_file_upload
Feature: Delete files and folders from the file manager
In order to clean the file manager contents
As a user
I need to delete files from file areas
In order to clean the file manager contents
As a user
I need to delete files from file areas
Background:
Given the following "blocks" exist:
@@ -38,7 +38,7 @@ Feature: Delete files and folders from the file manager
And I set the field "Select file 'empty.txt'" to "1"
When I click on "Delete" "link"
Then I should see "Are you sure you want to delete the selected 1 file(s)?"
When I click on "OK" "button" in the "Confirm" "dialogue"
When I click on "Yes" "button" in the "Confirm" "dialogue"
Then I should not see "empty.txt" in the "Manage private files" "dialogue"
But I should see "Delete me later" in the "Manage private files" "dialogue"
When I press "Save changes"
@@ -47,7 +47,7 @@ Feature: Delete files and folders from the file manager
But I should see "Delete me later" in the "Manage private files" "dialogue"
And I set the field "Select file 'Delete me later'" to "1"
And I click on "Delete" "link"
And I click on "OK" "button" in the "Confirm" "dialogue"
And I click on "Yes" "button" in the "Confirm" "dialogue"
Then I should not see "Delete me later" in the "Manage private files" "dialogue"
When I press "Save changes"
And I follow "Manage private files..."
@@ -67,7 +67,7 @@ Feature: Delete files and folders from the file manager
And I set the field "Select file 'Delete me'" to "1"
When I click on "Delete" "link"
Then I should see "Are you sure you want to delete the selected 2 file(s)?"
When I click on "OK" "button" in the "Confirm" "dialogue"
When I click on "Yes" "button" in the "Confirm" "dialogue"
Then I should not see "Delete me" in the "Manage private files" "dialogue"
And I should not see "empty.txt" in the "Manage private files" "dialogue"
But I should see "Do not delete me" in the "Manage private files" "dialogue"
@@ -92,12 +92,12 @@ Feature: Delete files and folders from the file manager
And I click on "Display folder with file details" "link"
When I click on "Select all/none" "checkbox"
Then the following fields match these values:
| Select file 'empty.txt' | 1 |
| Select file 'Delete me' | 1 |
| Select file 'empty.txt' | 1 |
| Select file 'Delete me' | 1 |
| Select file 'Delete me too' | 1 |
When I click on "Delete" "link"
Then I should see "Are you sure you want to delete the selected 3 file(s)?"
When I click on "OK" "button" in the "Confirm" "dialogue"
When I click on "Yes" "button" in the "Confirm" "dialogue"
Then I should not see "Delete me" in the "Manage private files" "dialogue"
And I should not see "empty.txt" in the "Manage private files" "dialogue"
And I should not see "Delete me too" in the "Manage private files" "dialogue"
@@ -121,7 +121,7 @@ Feature: Delete files and folders from the file manager
And I set the field "Select file 'one'" to "1"
And I click on "Delete" "link"
And I should see "Are you sure you want to delete the selected 1 file(s)?"
And I click on "OK" "button" in the "Confirm" "dialogue"
And I click on "Yes" "button" in the "Confirm" "dialogue"
And I click on "Save changes" "button"
And I am on the "System logs report" page
And I click on "Get these logs" "button"