MDL-66360 mod_forum: Notify the student when the marker choose to notify

This commit is contained in:
Shamim Rezaie 2019-10-24 13:54:13 +11:00 committed by Simey Lameze
parent fff089e80d
commit c67a54e619
10 changed files with 17 additions and 11 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
define ("mod_forum/local/grades/local/grader/gradingpanel",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var d="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};function b(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function c(a){return function(){var c=this,d=arguments;return new Promise(function(e,f){var i=a.apply(c,d);function g(a){b(i,e,f,g,h,"next",a)}function h(a){b(i,e,f,g,h,"throw",a)}g(void 0)})}}var e=function(){var a=c(regeneratorRuntime.mark(function a(b,c,e,f,g){var h,i;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:h="".concat(e,"/grades/grader/gradingpanel");if(f){h+="/".concat(f)}a.next=4;return"function"==typeof d.define&&d.define.amd?new Promise(function(a,b){d.require([h],a,b)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&d.require&&"component"===d.require.loader?Promise.resolve(require((h))):Promise.resolve(d[h]);case 4:i=a.sent;return a.abrupt("return",{getter:function(a){return i.fetchCurrentGrade(b,c,g,a)},setter:function(a,d){return i.storeCurrentGrade(b,c,g,a,d)}});case 6:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.default=e;return a.default});
define ("mod_forum/local/grades/local/grader/gradingpanel",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var d="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};function b(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function c(a){return function(){var c=this,d=arguments;return new Promise(function(e,f){var i=a.apply(c,d);function g(a){b(i,e,f,g,h,"next",a)}function h(a){b(i,e,f,g,h,"throw",a)}g(void 0)})}}var e=function(){var a=c(regeneratorRuntime.mark(function a(b,c,e,f,g){var h,i;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:h="".concat(e,"/grades/grader/gradingpanel");if(f){h+="/".concat(f)}a.next=4;return"function"==typeof d.define&&d.define.amd?new Promise(function(a,b){d.require([h],a,b)}):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&d.require&&"component"===d.require.loader?Promise.resolve(require((h))):Promise.resolve(d[h]);case 4:i=a.sent;return a.abrupt("return",{getter:function(a){return i.fetchCurrentGrade(b,c,g,a)},setter:function(a,d,e){return i.storeCurrentGrade(b,c,g,a,d,e)}});case 6:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.default=e;return a.default});
//# sourceMappingURL=gradingpanel.min.js.map

View File

@ -1 +1 @@
{"version":3,"sources":["../../../../../src/local/grades/local/grader/gradingpanel.js"],"names":["component","context","gradingComponent","gradingSubtype","itemName","gradingMethodHandler","GradingMethod","getter","userId","fetchCurrentGrade","setter","formData","storeCurrentGrade"],"mappings":"6nBAoCe,WAAMA,CAAN,CAAiBC,CAAjB,CAA0BC,CAA1B,CAA4CC,CAA5C,CAA4DC,CAA5D,2FACPC,CADO,WACmBH,CADnB,gCAEX,GAAIC,CAAJ,CAAoB,CAChBE,CAAoB,aAAQF,CAAR,CACvB,CAJU,8FAMwBE,CANxB,mMAMwBA,CANxB,sBAMwBA,CANxB,UAMLC,CANK,iCAQJ,CACHC,MAAM,CAAE,SAACC,CAAD,QAAYF,CAAAA,CAAa,CAACG,iBAAd,CAAgCT,CAAhC,CAA2CC,CAA3C,CAAoDG,CAApD,CAA8DI,CAA9D,CAAZ,CADL,CAEHE,MAAM,CAAE,SAACF,CAAD,CAASG,CAAT,QAAsBL,CAAAA,CAAa,CAACM,iBAAd,CAAgCZ,CAAhC,CAA2CC,CAA3C,CAAoDG,CAApD,CAA8DI,CAA9D,CAAsEG,CAAtE,CAAtB,CAFL,CARI,0C","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 * Grading panel functions.\n *\n * @module mod_forum/local/grades/local/grader/gradingpnael\n * @package mod_forum\n * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * Get the grade panel setter and getter for the current component.\n * This function dynamically pulls the relevant gradingpanel JS file defined in the grading method.\n * We do this because we do not know until execution time what the grading type is and we do not want to import unused files.\n *\n * @param {String} component The component being graded\n * @param {Number} context The contextid of the thing being graded\n * @param {String} gradingComponent The thing providing the grading type\n * @param {String} gradingSubtype The subtype fo the grading component\n * @param {String} itemName The name of the thing being graded\n * @return {Object}\n */\nexport default async(component, context, gradingComponent, gradingSubtype, itemName) => {\n let gradingMethodHandler = `${gradingComponent}/grades/grader/gradingpanel`;\n if (gradingSubtype) {\n gradingMethodHandler += `/${gradingSubtype}`;\n }\n\n const GradingMethod = await import(gradingMethodHandler);\n\n return {\n getter: (userId) => GradingMethod.fetchCurrentGrade(component, context, itemName, userId),\n setter: (userId, formData) => GradingMethod.storeCurrentGrade(component, context, itemName, userId, formData),\n };\n};\n\n"],"file":"gradingpanel.min.js"}
{"version":3,"sources":["../../../../../src/local/grades/local/grader/gradingpanel.js"],"names":["component","context","gradingComponent","gradingSubtype","itemName","gradingMethodHandler","GradingMethod","getter","userId","fetchCurrentGrade","setter","formData","notifyStudent","storeCurrentGrade"],"mappings":"6nBAoCe,WAAMA,CAAN,CAAiBC,CAAjB,CAA0BC,CAA1B,CAA4CC,CAA5C,CAA4DC,CAA5D,2FACPC,CADO,WACmBH,CADnB,gCAEX,GAAIC,CAAJ,CAAoB,CAChBE,CAAoB,aAAQF,CAAR,CACvB,CAJU,8FAMwBE,CANxB,mMAMwBA,CANxB,sBAMwBA,CANxB,UAMLC,CANK,iCAQJ,CACHC,MAAM,CAAE,SAACC,CAAD,QAAYF,CAAAA,CAAa,CAACG,iBAAd,CAAgCT,CAAhC,CAA2CC,CAA3C,CAAoDG,CAApD,CAA8DI,CAA9D,CAAZ,CADL,CAEHE,MAAM,CAAE,SAACF,CAAD,CAASG,CAAT,CAAmBC,CAAnB,QAAqCN,CAAAA,CAAa,CAACO,iBAAd,CACzCb,CADyC,CAC9BC,CAD8B,CACrBG,CADqB,CACXI,CADW,CACHG,CADG,CACOC,CADP,CAArC,CAFL,CARI,0C","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 * Grading panel functions.\n *\n * @module mod_forum/local/grades/local/grader/gradingpnael\n * @package mod_forum\n * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * Get the grade panel setter and getter for the current component.\n * This function dynamically pulls the relevant gradingpanel JS file defined in the grading method.\n * We do this because we do not know until execution time what the grading type is and we do not want to import unused files.\n *\n * @param {String} component The component being graded\n * @param {Number} context The contextid of the thing being graded\n * @param {String} gradingComponent The thing providing the grading type\n * @param {String} gradingSubtype The subtype fo the grading component\n * @param {String} itemName The name of the thing being graded\n * @return {Object}\n */\nexport default async(component, context, gradingComponent, gradingSubtype, itemName) => {\n let gradingMethodHandler = `${gradingComponent}/grades/grader/gradingpanel`;\n if (gradingSubtype) {\n gradingMethodHandler += `/${gradingSubtype}`;\n }\n\n const GradingMethod = await import(gradingMethodHandler);\n\n return {\n getter: (userId) => GradingMethod.fetchCurrentGrade(component, context, itemName, userId),\n setter: (userId, formData, notifyStudent) => GradingMethod.storeCurrentGrade(\n component, context, itemName, userId, formData, notifyStudent),\n };\n};\n\n"],"file":"gradingpanel.min.js"}

View File

@ -1,2 +1,2 @@
define ("mod_forum/local/grades/local/grader/selectors",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var b=function(a,b){return"[data-".concat(a,"=\"").concat(b,"\"]")},c={buttons:{toggleFullscreen:b("action","togglefullscreen"),closeGrader:b("action","closegrader"),saveGrade:b("action","savegrade"),selectUser:b("action","select-user"),toggleSearch:b("action","toggle-search")},regions:{bodyContainer:b("region","body-container"),moduleReplace:b("region","module_content"),pickerRegion:b("region","user_picker"),gradingPanel:b("region","grade"),gradingPanelContainer:b("region","grading-panel-container"),gradingPanelErrors:b("region","grade-errors"),searchResultsContainer:b("region","search-results-container"),statusContainer:b("region","status-container"),userSearchContainer:b("region","user-search-container"),userSearchInput:b("region","user-search-input")}};a.default=c;return a.default});
define ("mod_forum/local/grades/local/grader/selectors",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var b=function(a,b){return"[data-".concat(a,"=\"").concat(b,"\"]")},c={buttons:{toggleFullscreen:b("action","togglefullscreen"),closeGrader:b("action","closegrader"),saveGrade:b("action","savegrade"),selectUser:b("action","select-user"),toggleSearch:b("action","toggle-search")},regions:{bodyContainer:b("region","body-container"),moduleReplace:b("region","module_content"),pickerRegion:b("region","user_picker"),gradingPanel:b("region","grade"),gradingPanelContainer:b("region","grading-panel-container"),gradingPanelErrors:b("region","grade-errors"),searchResultsContainer:b("region","search-results-container"),statusContainer:b("region","status-container"),userSearchContainer:b("region","user-search-container"),userSearchInput:b("region","user-search-input")},values:{sendStudentNotifications:"[data-region=\"notification\"] input[type=\"radio\"]:checked"}};a.default=c;return a.default});
//# sourceMappingURL=selectors.min.js.map

View File

@ -1 +1 @@
{"version":3,"sources":["../../../../../src/local/grades/local/grader/selectors.js"],"names":["getDataSelector","name","value","buttons","toggleFullscreen","closeGrader","saveGrade","selectUser","toggleSearch","regions","bodyContainer","moduleReplace","pickerRegion","gradingPanel","gradingPanelContainer","gradingPanelErrors","searchResultsContainer","statusContainer","userSearchContainer","userSearchInput"],"mappings":"kKA8BMA,CAAAA,CAAe,CAAG,SAACC,CAAD,CAAOC,CAAP,CAAiB,CACrC,sBAAgBD,CAAhB,eAAyBC,CAAzB,OACH,C,GAEc,CACXC,OAAO,CAAE,CACLC,gBAAgB,CAAEJ,CAAe,CAAC,QAAD,CAAW,kBAAX,CAD5B,CAELK,WAAW,CAAEL,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLM,SAAS,CAAEN,CAAe,CAAC,QAAD,CAAW,WAAX,CAHrB,CAILO,UAAU,CAAEP,CAAe,CAAC,QAAD,CAAW,aAAX,CAJtB,CAKLQ,YAAY,CAAER,CAAe,CAAC,QAAD,CAAW,eAAX,CALxB,CADE,CAQXS,OAAO,CAAE,CACLC,aAAa,CAAEV,CAAe,CAAC,QAAD,CAAW,gBAAX,CADzB,CAELW,aAAa,CAAEX,CAAe,CAAC,QAAD,CAAW,gBAAX,CAFzB,CAGLY,YAAY,CAAEZ,CAAe,CAAC,QAAD,CAAW,aAAX,CAHxB,CAILa,YAAY,CAAEb,CAAe,CAAC,QAAD,CAAW,OAAX,CAJxB,CAKLc,qBAAqB,CAAEd,CAAe,CAAC,QAAD,CAAW,yBAAX,CALjC,CAMLe,kBAAkB,CAAEf,CAAe,CAAC,QAAD,CAAW,cAAX,CAN9B,CAOLgB,sBAAsB,CAAEhB,CAAe,CAAC,QAAD,CAAW,0BAAX,CAPlC,CAQLiB,eAAe,CAAEjB,CAAe,CAAC,QAAD,CAAW,kBAAX,CAR3B,CASLkB,mBAAmB,CAAElB,CAAe,CAAC,QAAD,CAAW,uBAAX,CAT/B,CAULmB,eAAe,CAAEnB,CAAe,CAAC,QAAD,CAAW,mBAAX,CAV3B,CARE,C","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 * Define all of the selectors we will be using on the grading interface.\n *\n * @module mod_forum/local/grades/local/grader/selectors\n * @package mod_forum\n * @copyright 2019 Mathew May <mathew.solutions>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * A small helper function to build queryable data selectors.\n * @param {String} name\n * @param {String} value\n * @return {string}\n */\nconst getDataSelector = (name, value) => {\n return `[data-${name}=\"${value}\"]`;\n};\n\nexport default {\n buttons: {\n toggleFullscreen: getDataSelector('action', 'togglefullscreen'),\n closeGrader: getDataSelector('action', 'closegrader'),\n saveGrade: getDataSelector('action', 'savegrade'),\n selectUser: getDataSelector('action', 'select-user'),\n toggleSearch: getDataSelector('action', 'toggle-search')\n },\n regions: {\n bodyContainer: getDataSelector('region', 'body-container'),\n moduleReplace: getDataSelector('region', 'module_content'),\n pickerRegion: getDataSelector('region', 'user_picker'),\n gradingPanel: getDataSelector('region', 'grade'),\n gradingPanelContainer: getDataSelector('region', 'grading-panel-container'),\n gradingPanelErrors: getDataSelector('region', 'grade-errors'),\n searchResultsContainer: getDataSelector('region', 'search-results-container'),\n statusContainer: getDataSelector('region', 'status-container'),\n userSearchContainer: getDataSelector('region', 'user-search-container'),\n userSearchInput: getDataSelector('region', 'user-search-input')\n },\n};\n\n"],"file":"selectors.min.js"}
{"version":3,"sources":["../../../../../src/local/grades/local/grader/selectors.js"],"names":["getDataSelector","name","value","buttons","toggleFullscreen","closeGrader","saveGrade","selectUser","toggleSearch","regions","bodyContainer","moduleReplace","pickerRegion","gradingPanel","gradingPanelContainer","gradingPanelErrors","searchResultsContainer","statusContainer","userSearchContainer","userSearchInput","values","sendStudentNotifications"],"mappings":"kKA8BMA,CAAAA,CAAe,CAAG,SAACC,CAAD,CAAOC,CAAP,CAAiB,CACrC,sBAAgBD,CAAhB,eAAyBC,CAAzB,OACH,C,GAEc,CACXC,OAAO,CAAE,CACLC,gBAAgB,CAAEJ,CAAe,CAAC,QAAD,CAAW,kBAAX,CAD5B,CAELK,WAAW,CAAEL,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLM,SAAS,CAAEN,CAAe,CAAC,QAAD,CAAW,WAAX,CAHrB,CAILO,UAAU,CAAEP,CAAe,CAAC,QAAD,CAAW,aAAX,CAJtB,CAKLQ,YAAY,CAAER,CAAe,CAAC,QAAD,CAAW,eAAX,CALxB,CADE,CAQXS,OAAO,CAAE,CACLC,aAAa,CAAEV,CAAe,CAAC,QAAD,CAAW,gBAAX,CADzB,CAELW,aAAa,CAAEX,CAAe,CAAC,QAAD,CAAW,gBAAX,CAFzB,CAGLY,YAAY,CAAEZ,CAAe,CAAC,QAAD,CAAW,aAAX,CAHxB,CAILa,YAAY,CAAEb,CAAe,CAAC,QAAD,CAAW,OAAX,CAJxB,CAKLc,qBAAqB,CAAEd,CAAe,CAAC,QAAD,CAAW,yBAAX,CALjC,CAMLe,kBAAkB,CAAEf,CAAe,CAAC,QAAD,CAAW,cAAX,CAN9B,CAOLgB,sBAAsB,CAAEhB,CAAe,CAAC,QAAD,CAAW,0BAAX,CAPlC,CAQLiB,eAAe,CAAEjB,CAAe,CAAC,QAAD,CAAW,kBAAX,CAR3B,CASLkB,mBAAmB,CAAElB,CAAe,CAAC,QAAD,CAAW,uBAAX,CAT/B,CAULmB,eAAe,CAAEnB,CAAe,CAAC,QAAD,CAAW,mBAAX,CAV3B,CARE,CAoBXoB,MAAM,CAAE,CACJC,wBAAwB,CAAE,8DADtB,CApBG,C","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 * Define all of the selectors we will be using on the grading interface.\n *\n * @module mod_forum/local/grades/local/grader/selectors\n * @package mod_forum\n * @copyright 2019 Mathew May <mathew.solutions>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * A small helper function to build queryable data selectors.\n * @param {String} name\n * @param {String} value\n * @return {string}\n */\nconst getDataSelector = (name, value) => {\n return `[data-${name}=\"${value}\"]`;\n};\n\nexport default {\n buttons: {\n toggleFullscreen: getDataSelector('action', 'togglefullscreen'),\n closeGrader: getDataSelector('action', 'closegrader'),\n saveGrade: getDataSelector('action', 'savegrade'),\n selectUser: getDataSelector('action', 'select-user'),\n toggleSearch: getDataSelector('action', 'toggle-search')\n },\n regions: {\n bodyContainer: getDataSelector('region', 'body-container'),\n moduleReplace: getDataSelector('region', 'module_content'),\n pickerRegion: getDataSelector('region', 'user_picker'),\n gradingPanel: getDataSelector('region', 'grade'),\n gradingPanelContainer: getDataSelector('region', 'grading-panel-container'),\n gradingPanelErrors: getDataSelector('region', 'grade-errors'),\n searchResultsContainer: getDataSelector('region', 'search-results-container'),\n statusContainer: getDataSelector('region', 'status-container'),\n userSearchContainer: getDataSelector('region', 'user-search-container'),\n userSearchInput: getDataSelector('region', 'user-search-input')\n },\n values: {\n sendStudentNotifications: '[data-region=\"notification\"] input[type=\"radio\"]:checked',\n }\n};\n\n"],"file":"selectors.min.js"}

View File

@ -279,7 +279,11 @@ const getSaveUserGradeFunction = (root, setGradeForUser) => {
return async(user) => {
try {
root.querySelector(Selectors.regions.gradingPanelErrors).innerHTML = '';
const result = await setGradeForUser(user.id, root.querySelector(Selectors.regions.gradingPanel));
const result = await setGradeForUser(
user.id,
root.querySelector(Selectors.regions.gradingPanel),
root.querySelector(Selectors.values.sendStudentNotifications).value
);
if (result.success) {
addToast(await getString('grades:gradesavedfor', 'mod_forum', user));
}

View File

@ -44,7 +44,8 @@ export default async(component, context, gradingComponent, gradingSubtype, itemN
return {
getter: (userId) => GradingMethod.fetchCurrentGrade(component, context, itemName, userId),
setter: (userId, formData) => GradingMethod.storeCurrentGrade(component, context, itemName, userId, formData),
setter: (userId, formData, notifyStudent) => GradingMethod.storeCurrentGrade(
component, context, itemName, userId, formData, notifyStudent),
};
};

View File

@ -52,5 +52,8 @@ export default {
userSearchContainer: getDataSelector('region', 'user-search-container'),
userSearchInput: getDataSelector('region', 'user-search-input')
},
values: {
sendStudentNotifications: '[data-region="notification"] input[type="radio"]:checked',
}
};

View File

@ -29,11 +29,9 @@
defined('MOODLE_INTERNAL') || die();
$version = 2019110800.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2019110800.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '3.8dev+ (Build: 20191108)'; // Human-friendly version name
$branch = '38'; // This version's branch.
$maturity = MATURITY_ALPHA; // This version's maturity level.