Merge branch 'MDL-66360-master' of git://github.com/lameze/moodle
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
||||
define ("core_grades/grades/grader/gradingpanel/point",["exports","./repository","core_grades/grades/grader/gradingpanel/comparison","jquery","./normalise"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.storeCurrentGrade=a.fetchCurrentGrade=void 0;d=function(a){return a&&a.__esModule?a:{default:a}}(d);function f(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 g(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var i=a.apply(b,c);function g(a){f(i,d,e,g,h,"next",a)}function h(a){f(i,d,e,g,h,"throw",a)}g(void 0)})}}a.fetchCurrentGrade=function fetchCurrentGrade(){return(0,b.fetchGrade)("point").apply(void 0,arguments)};var h=function(){var a=g(regeneratorRuntime.mark(function a(f,g,h,i,j){var k,l;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:k=j.querySelector("form");l=k.querySelector("input[name=\"grade\"]");if(!(!l.checkValidity()||!l.value.trim())){a.next=4;break}return a.abrupt("return",e.invalidResult);case 4:if(!(!0===(0,c.compareData)(k))){a.next=10;break}a.next=7;return(0,b.saveGrade)("point")(f,g,h,i,(0,d.default)(k).serialize());case 7:return a.abrupt("return",a.sent);case 10:return a.abrupt("return","");case 11:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.storeCurrentGrade=h});
|
||||
define ("core_grades/grades/grader/gradingpanel/point",["exports","./repository","core_grades/grades/grader/gradingpanel/comparison","jquery","./normalise"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.storeCurrentGrade=a.fetchCurrentGrade=void 0;d=function(a){return a&&a.__esModule?a:{default:a}}(d);function f(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 g(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var i=a.apply(b,c);function g(a){f(i,d,e,g,h,"next",a)}function h(a){f(i,d,e,g,h,"throw",a)}g(void 0)})}}a.fetchCurrentGrade=function fetchCurrentGrade(){return(0,b.fetchGrade)("point").apply(void 0,arguments)};var h=function(){var a=g(regeneratorRuntime.mark(function a(f,g,h,i,j,k){var l,m;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:l=k.querySelector("form");m=l.querySelector("input[name=\"grade\"]");if(!(!m.checkValidity()||!m.value.trim())){a.next=4;break}return a.abrupt("return",e.invalidResult);case 4:if(!(!0===(0,c.compareData)(l))){a.next=10;break}a.next=7;return(0,b.saveGrade)("point")(f,g,h,i,j,(0,d.default)(l).serialize());case 7:return a.abrupt("return",a.sent);case 10:return a.abrupt("return","");case 11:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.storeCurrentGrade=h});
|
||||
//# sourceMappingURL=point.min.js.map
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/point.js"],"names":["fetchCurrentGrade","storeCurrentGrade","component","context","itemname","userId","rootNode","form","querySelector","grade","checkValidity","value","trim","invalidResult","serialize"],"mappings":"8RA2BA,uD,mVAaiC,QAApBA,CAAAA,iBAAoB,SAAa,iBAAW,OAAX,yBAAb,C,CAY1B,GAAMC,CAAAA,CAAiB,4CAAG,WAAMC,CAAN,CAAiBC,CAAjB,CAA0BC,CAA1B,CAAoCC,CAApC,CAA4CC,CAA5C,2FACvBC,CADuB,CAChBD,CAAQ,CAACE,aAAT,CAAuB,MAAvB,CADgB,CAEvBC,CAFuB,CAEfF,CAAI,CAACC,aAAL,CAAmB,uBAAnB,CAFe,MAIzB,CAACC,CAAK,CAACC,aAAN,EAAD,EAA0B,CAACD,CAAK,CAACE,KAAN,CAAYC,IAAZ,EAJF,2CAKlBC,eALkB,cAQzB,uBAAYN,CAAZ,CARyB,kCASZ,gBAAU,OAAV,EAAmBL,CAAnB,CAA8BC,CAA9B,CAAuCC,CAAvC,CAAiDC,CAAjD,CAAyD,cAAOE,CAAP,EAAaO,SAAb,EAAzD,CATY,0EAWlB,EAXkB,2CAAH,uDAAvB,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 * Grading panel for simple direct grading.\n *\n * @module core_grades/grades/grader/gradingpanel/point\n * @package core_grades\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {saveGrade, fetchGrade} from './repository';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\nimport {invalidResult} from './normalise';\n\n/**\n * Fetch the current grade for a user.\n *\n * @param {String} component\n * @param {Number} context\n * @param {String} itemname\n * @param {Number} userId\n * @param {Element} rootNode\n * @return {Object}\n */\nexport const fetchCurrentGrade = (...args) => fetchGrade('point')(...args);\n\n/**\n * Store a new grade for a user.\n *\n * @param {String} component\n * @param {Number} context\n * @param {String} itemname\n * @param {Number} userId\n * @param {Element} rootNode\n * @return {Object}\n */\nexport const storeCurrentGrade = async(component, context, itemname, userId, rootNode) => {\n const form = rootNode.querySelector('form');\n const grade = form.querySelector('input[name=\"grade\"]');\n\n if (!grade.checkValidity() || !grade.value.trim()) {\n return invalidResult;\n }\n\n if (compareData(form) === true) {\n return await saveGrade('point')(component, context, itemname, userId, jQuery(form).serialize());\n } else {\n return '';\n }\n};\n"],"file":"point.min.js"}
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/point.js"],"names":["fetchCurrentGrade","storeCurrentGrade","component","context","itemname","userId","notifyUser","rootNode","form","querySelector","grade","checkValidity","value","trim","invalidResult","serialize"],"mappings":"8RA2BA,uD,mVAaiC,QAApBA,CAAAA,iBAAoB,SAAa,iBAAW,OAAX,yBAAb,C,CAc1B,GAAMC,CAAAA,CAAiB,4CAAG,WAAMC,CAAN,CAAiBC,CAAjB,CAA0BC,CAA1B,CAAoCC,CAApC,CAA4CC,CAA5C,CAAwDC,CAAxD,2FACvBC,CADuB,CAChBD,CAAQ,CAACE,aAAT,CAAuB,MAAvB,CADgB,CAEvBC,CAFuB,CAEfF,CAAI,CAACC,aAAL,CAAmB,uBAAnB,CAFe,MAIzB,CAACC,CAAK,CAACC,aAAN,EAAD,EAA0B,CAACD,CAAK,CAACE,KAAN,CAAYC,IAAZ,EAJF,2CAKlBC,eALkB,cAQzB,uBAAYN,CAAZ,CARyB,kCASZ,gBAAU,OAAV,EAAmBN,CAAnB,CAA8BC,CAA9B,CAAuCC,CAAvC,CAAiDC,CAAjD,CAAyDC,CAAzD,CAAqE,cAAOE,CAAP,EAAaO,SAAb,EAArE,CATY,0EAWlB,EAXkB,2CAAH,uDAAvB,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 * Grading panel for simple direct grading.\n *\n * @module core_grades/grades/grader/gradingpanel/point\n * @package core_grades\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {saveGrade, fetchGrade} from './repository';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\nimport {invalidResult} from './normalise';\n\n/**\n * Fetch the current grade for a user.\n *\n * @param {String} component\n * @param {Number} context\n * @param {String} itemname\n * @param {Number} userId\n * @param {Element} rootNode\n * @return {Object}\n */\nexport const fetchCurrentGrade = (...args) => fetchGrade('point')(...args);\n\n/**\n * Store a new grade for a user.\n *\n * @param {String} component\n * @param {Number} context\n * @param {String} itemname\n * @param {Number} userId\n * @param {Boolean} notifyUser\n * @param {Element} rootNode\n *\n * @return {Object}\n */\nexport const storeCurrentGrade = async(component, context, itemname, userId, notifyUser, rootNode) => {\n const form = rootNode.querySelector('form');\n const grade = form.querySelector('input[name=\"grade\"]');\n\n if (!grade.checkValidity() || !grade.value.trim()) {\n return invalidResult;\n }\n\n if (compareData(form) === true) {\n return await saveGrade('point')(component, context, itemname, userId, notifyUser, jQuery(form).serialize());\n } else {\n return '';\n }\n};\n"],"file":"point.min.js"}
|
||||
@@ -1,2 +1,2 @@
|
||||
define ("core_grades/grades/grader/gradingpanel/repository",["exports","core/ajax","./normalise"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.saveGrade=a.fetchGrade=void 0;function d(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 e(a){return function(){var b=this,c=arguments;return new Promise(function(e,f){var i=a.apply(b,c);function g(a){d(i,e,f,g,h,"next",a)}function h(a){d(i,e,f,g,h,"throw",a)}g(void 0)})}}a.fetchGrade=function fetchGrade(a){return function(c,d,e,f){return(0,b.call)([{methodname:"core_grades_grader_gradingpanel_".concat(a,"_fetch"),args:{component:c,contextid:d,itemname:e,gradeduserid:f}}])[0]}};a.saveGrade=function saveGrade(a){return function(){var d=e(regeneratorRuntime.mark(function d(e,f,g,h,i){return regeneratorRuntime.wrap(function(d){while(1){switch(d.prev=d.next){case 0:d.t0=c.normaliseResult;d.next=3;return(0,b.call)([{methodname:"core_grades_grader_gradingpanel_".concat(a,"_store"),args:{component:e,contextid:f,itemname:g,gradeduserid:h,formdata:i}}])[0];case 3:d.t1=d.sent;return d.abrupt("return",(0,d.t0)(d.t1));case 5:case"end":return d.stop();}}},d)}));return function(){return d.apply(this,arguments)}}()}});
|
||||
define ("core_grades/grades/grader/gradingpanel/repository",["exports","core/ajax","./normalise"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.saveGrade=a.fetchGrade=void 0;function d(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 e(a){return function(){var b=this,c=arguments;return new Promise(function(e,f){var i=a.apply(b,c);function g(a){d(i,e,f,g,h,"next",a)}function h(a){d(i,e,f,g,h,"throw",a)}g(void 0)})}}a.fetchGrade=function fetchGrade(a){return function(c,d,e,f){return(0,b.call)([{methodname:"core_grades_grader_gradingpanel_".concat(a,"_fetch"),args:{component:c,contextid:d,itemname:e,gradeduserid:f}}])[0]}};a.saveGrade=function saveGrade(a){return function(){var d=e(regeneratorRuntime.mark(function d(e,f,g,h,i,j){return regeneratorRuntime.wrap(function(d){while(1){switch(d.prev=d.next){case 0:d.t0=c.normaliseResult;d.next=3;return(0,b.call)([{methodname:"core_grades_grader_gradingpanel_".concat(a,"_store"),args:{component:e,contextid:f,itemname:g,gradeduserid:h,notifyuser:i,formdata:j}}])[0];case 3:d.t1=d.sent;return d.abrupt("return",(0,d.t0)(d.t1));case 5:case"end":return d.stop();}}},d)}));return function(){return d.apply(this,arguments)}}()}});
|
||||
//# sourceMappingURL=repository.min.js.map
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/repository.js"],"names":["fetchGrade","type","component","contextid","itemname","gradeduserid","methodname","args","saveGrade","formdata","normaliseResult"],"mappings":"4hBA0B0B,QAAbA,CAAAA,UAAa,CAAAC,CAAI,QAAI,UAACC,CAAD,CAAYC,CAAZ,CAAuBC,CAAvB,CAAiCC,CAAjC,CAAkD,CAChF,MAAO,WAAU,CAAC,CACdC,UAAU,2CAAqCL,CAArC,UADI,CAEdM,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAFQ,CAAD,CAAV,EAQH,CARG,CASV,CAV6B,C,aAYL,QAAZG,CAAAA,SAAY,CAAAP,CAAI,oDAAI,WAAMC,CAAN,CAAiBC,CAAjB,CAA4BC,CAA5B,CAAsCC,CAAtC,CAAoDI,CAApD,wFACtBC,iBADsB,gBACA,WAAU,CAAC,CACpCJ,UAAU,2CAAqCL,CAArC,UAD0B,CAEpCM,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAKFI,QAAQ,CAARA,CALE,CAF8B,CAAD,CAAV,EASzB,CATyB,CADA,qGAAJ,wD","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 * Repository for simple direct grading panel.\n *\n * @module core_grades/grades/grader/gradingpanel/repository\n * @package core_grades\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {call as fetchMany} from 'core/ajax';\nimport {normaliseResult} from './normalise';\n\nexport const fetchGrade = type => (component, contextid, itemname, gradeduserid) => {\n return fetchMany([{\n methodname: `core_grades_grader_gradingpanel_${type}_fetch`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n },\n }])[0];\n};\n\nexport const saveGrade = type => async(component, contextid, itemname, gradeduserid, formdata) => {\n return normaliseResult(await fetchMany([{\n methodname: `core_grades_grader_gradingpanel_${type}_store`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n formdata,\n },\n }])[0]);\n};\n"],"file":"repository.min.js"}
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/repository.js"],"names":["fetchGrade","type","component","contextid","itemname","gradeduserid","methodname","args","saveGrade","notifyUser","formdata","normaliseResult","notifyuser"],"mappings":"4hBA0B0B,QAAbA,CAAAA,UAAa,CAAAC,CAAI,QAAI,UAACC,CAAD,CAAYC,CAAZ,CAAuBC,CAAvB,CAAiCC,CAAjC,CAAkD,CAChF,MAAO,WAAU,CAAC,CACdC,UAAU,2CAAqCL,CAArC,UADI,CAEdM,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAFQ,CAAD,CAAV,EAQH,CARG,CASV,CAV6B,C,aAYL,QAAZG,CAAAA,SAAY,CAAAP,CAAI,oDAAI,WAAMC,CAAN,CAAiBC,CAAjB,CAA4BC,CAA5B,CAAsCC,CAAtC,CAAoDI,CAApD,CAAgEC,CAAhE,wFACtBC,iBADsB,gBACA,WAAU,CAAC,CACpCL,UAAU,2CAAqCL,CAArC,UAD0B,CAEpCM,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAKFO,UAAU,CAAEH,CALV,CAMFC,QAAQ,CAARA,CANE,CAF8B,CAAD,CAAV,EAUzB,CAVyB,CADA,qGAAJ,wD","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 * Repository for simple direct grading panel.\n *\n * @module core_grades/grades/grader/gradingpanel/repository\n * @package core_grades\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {call as fetchMany} from 'core/ajax';\nimport {normaliseResult} from './normalise';\n\nexport const fetchGrade = type => (component, contextid, itemname, gradeduserid) => {\n return fetchMany([{\n methodname: `core_grades_grader_gradingpanel_${type}_fetch`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n },\n }])[0];\n};\n\nexport const saveGrade = type => async(component, contextid, itemname, gradeduserid, notifyUser, formdata) => {\n return normaliseResult(await fetchMany([{\n methodname: `core_grades_grader_gradingpanel_${type}_store`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n notifyuser: notifyUser,\n formdata,\n },\n }])[0]);\n};\n"],"file":"repository.min.js"}
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
define ("core_grades/grades/grader/gradingpanel/scale",["exports","./repository","core_grades/grades/grader/gradingpanel/comparison","jquery","./normalise"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.storeCurrentGrade=a.fetchCurrentGrade=void 0;d=function(a){return a&&a.__esModule?a:{default:a}}(d);a.fetchCurrentGrade=function fetchCurrentGrade(){return(0,b.fetchGrade)("scale").apply(void 0,arguments)};var f=function(a,f,g,h,i){var j=i.querySelector("form"),k=j.querySelector("select[name=\"grade\"]");if(!k.checkValidity()||!k.value.trim()){return e.invalidResult}if(!0===(0,c.compareData)(j)){return(0,b.saveGrade)("scale")(a,f,g,h,(0,d.default)(j).serialize())}else{return""}};a.storeCurrentGrade=f});
|
||||
define ("core_grades/grades/grader/gradingpanel/scale",["exports","./repository","core_grades/grades/grader/gradingpanel/comparison","jquery","./normalise"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.storeCurrentGrade=a.fetchCurrentGrade=void 0;d=function(a){return a&&a.__esModule?a:{default:a}}(d);a.fetchCurrentGrade=function fetchCurrentGrade(){return(0,b.fetchGrade)("scale").apply(void 0,arguments)};var f=function(a,f,g,h,i,j){var k=j.querySelector("form"),l=k.querySelector("select[name=\"grade\"]");if(!l.checkValidity()||!l.value.trim()){return e.invalidResult}if(!0===(0,c.compareData)(k)){return(0,b.saveGrade)("scale")(a,f,g,h,i,(0,d.default)(k).serialize())}else{return""}};a.storeCurrentGrade=f});
|
||||
//# sourceMappingURL=scale.min.js.map
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/scale.js"],"names":["fetchCurrentGrade","storeCurrentGrade","component","context","itemname","userId","rootNode","form","querySelector","grade","checkValidity","value","trim","invalidResult","serialize"],"mappings":"8RA2BA,uD,oBAGiC,QAApBA,CAAAA,iBAAoB,SAAa,iBAAW,OAAX,yBAAb,C,CAE1B,GAAMC,CAAAA,CAAiB,CAAG,SAACC,CAAD,CAAYC,CAAZ,CAAqBC,CAArB,CAA+BC,CAA/B,CAAuCC,CAAvC,CAAoD,IAC3EC,CAAAA,CAAI,CAAGD,CAAQ,CAACE,aAAT,CAAuB,MAAvB,CADoE,CAE3EC,CAAK,CAAGF,CAAI,CAACC,aAAL,CAAmB,wBAAnB,CAFmE,CAIjF,GAAI,CAACC,CAAK,CAACC,aAAN,EAAD,EAA0B,CAACD,CAAK,CAACE,KAAN,CAAYC,IAAZ,EAA/B,CAAmD,CAC/C,MAAOC,gBACV,CAED,GAAI,uBAAYN,CAAZ,CAAJ,CAAgC,CAC5B,MAAO,gBAAU,OAAV,EAAmBL,CAAnB,CAA8BC,CAA9B,CAAuCC,CAAvC,CAAiDC,CAAjD,CAAyD,cAAOE,CAAP,EAAaO,SAAb,EAAzD,CACV,CAFD,IAEO,CACH,MAAO,EACV,CACJ,CAbM,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 * Grading panel for simple direct grading.\n *\n * @module core_grades/grades/grader/gradingpanel/scale\n * @package core_grades\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {saveGrade, fetchGrade} from './repository';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\nimport {invalidResult} from './normalise';\n\nexport const fetchCurrentGrade = (...args) => fetchGrade('scale')(...args);\n\nexport const storeCurrentGrade = (component, context, itemname, userId, rootNode) => {\n const form = rootNode.querySelector('form');\n const grade = form.querySelector('select[name=\"grade\"]');\n\n if (!grade.checkValidity() || !grade.value.trim()) {\n return invalidResult;\n }\n\n if (compareData(form) === true) {\n return saveGrade('scale')(component, context, itemname, userId, jQuery(form).serialize());\n } else {\n return '';\n }\n};\n"],"file":"scale.min.js"}
|
||||
{"version":3,"sources":["../../../../src/grades/grader/gradingpanel/scale.js"],"names":["fetchCurrentGrade","storeCurrentGrade","component","context","itemname","userId","notifyUser","rootNode","form","querySelector","grade","checkValidity","value","trim","invalidResult","serialize"],"mappings":"8RA2BA,uD,oBAGiC,QAApBA,CAAAA,iBAAoB,SAAa,iBAAW,OAAX,yBAAb,C,CAE1B,GAAMC,CAAAA,CAAiB,CAAG,SAACC,CAAD,CAAYC,CAAZ,CAAqBC,CAArB,CAA+BC,CAA/B,CAAuCC,CAAvC,CAAmDC,CAAnD,CAAgE,IACvFC,CAAAA,CAAI,CAAGD,CAAQ,CAACE,aAAT,CAAuB,MAAvB,CADgF,CAEvFC,CAAK,CAAGF,CAAI,CAACC,aAAL,CAAmB,wBAAnB,CAF+E,CAI7F,GAAI,CAACC,CAAK,CAACC,aAAN,EAAD,EAA0B,CAACD,CAAK,CAACE,KAAN,CAAYC,IAAZ,EAA/B,CAAmD,CAC/C,MAAOC,gBACV,CAED,GAAI,uBAAYN,CAAZ,CAAJ,CAAgC,CAC5B,MAAO,gBAAU,OAAV,EAAmBN,CAAnB,CAA8BC,CAA9B,CAAuCC,CAAvC,CAAiDC,CAAjD,CAAyDC,CAAzD,CAAqE,cAAOE,CAAP,EAAaO,SAAb,EAArE,CACV,CAFD,IAEO,CACH,MAAO,EACV,CACJ,CAbM,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 * Grading panel for simple direct grading.\n *\n * @module core_grades/grades/grader/gradingpanel/scale\n * @package core_grades\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {saveGrade, fetchGrade} from './repository';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\nimport {invalidResult} from './normalise';\n\nexport const fetchCurrentGrade = (...args) => fetchGrade('scale')(...args);\n\nexport const storeCurrentGrade = (component, context, itemname, userId, notifyUser, rootNode) => {\n const form = rootNode.querySelector('form');\n const grade = form.querySelector('select[name=\"grade\"]');\n\n if (!grade.checkValidity() || !grade.value.trim()) {\n return invalidResult;\n }\n\n if (compareData(form) === true) {\n return saveGrade('scale')(component, context, itemname, userId, notifyUser, jQuery(form).serialize());\n } else {\n return '';\n }\n};\n"],"file":"scale.min.js"}
|
||||
@@ -47,10 +47,12 @@ export const fetchCurrentGrade = (...args) => fetchGrade('point')(...args);
|
||||
* @param {Number} context
|
||||
* @param {String} itemname
|
||||
* @param {Number} userId
|
||||
* @param {Boolean} notifyUser
|
||||
* @param {Element} rootNode
|
||||
*
|
||||
* @return {Object}
|
||||
*/
|
||||
export const storeCurrentGrade = async(component, context, itemname, userId, rootNode) => {
|
||||
export const storeCurrentGrade = async(component, context, itemname, userId, notifyUser, rootNode) => {
|
||||
const form = rootNode.querySelector('form');
|
||||
const grade = form.querySelector('input[name="grade"]');
|
||||
|
||||
@@ -59,7 +61,7 @@ export const storeCurrentGrade = async(component, context, itemname, userId, roo
|
||||
}
|
||||
|
||||
if (compareData(form) === true) {
|
||||
return await saveGrade('point')(component, context, itemname, userId, jQuery(form).serialize());
|
||||
return await saveGrade('point')(component, context, itemname, userId, notifyUser, jQuery(form).serialize());
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export const fetchGrade = type => (component, contextid, itemname, gradeduserid)
|
||||
}])[0];
|
||||
};
|
||||
|
||||
export const saveGrade = type => async(component, contextid, itemname, gradeduserid, formdata) => {
|
||||
export const saveGrade = type => async(component, contextid, itemname, gradeduserid, notifyUser, formdata) => {
|
||||
return normaliseResult(await fetchMany([{
|
||||
methodname: `core_grades_grader_gradingpanel_${type}_store`,
|
||||
args: {
|
||||
@@ -44,6 +44,7 @@ export const saveGrade = type => async(component, contextid, itemname, gradeduse
|
||||
contextid,
|
||||
itemname,
|
||||
gradeduserid,
|
||||
notifyuser: notifyUser,
|
||||
formdata,
|
||||
},
|
||||
}])[0]);
|
||||
|
||||
@@ -30,7 +30,7 @@ import {invalidResult} from './normalise';
|
||||
|
||||
export const fetchCurrentGrade = (...args) => fetchGrade('scale')(...args);
|
||||
|
||||
export const storeCurrentGrade = (component, context, itemname, userId, rootNode) => {
|
||||
export const storeCurrentGrade = (component, context, itemname, userId, notifyUser, rootNode) => {
|
||||
const form = rootNode.querySelector('form');
|
||||
const grade = form.querySelector('select[name="grade"]');
|
||||
|
||||
@@ -39,7 +39,7 @@ export const storeCurrentGrade = (component, context, itemname, userId, rootNode
|
||||
}
|
||||
|
||||
if (compareData(form) === true) {
|
||||
return saveGrade('scale')(component, context, itemname, userId, jQuery(form).serialize());
|
||||
return saveGrade('scale')(component, context, itemname, userId, notifyUser, jQuery(form).serialize());
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -483,4 +483,29 @@ abstract class component_gradeitem {
|
||||
|
||||
return $gradinginstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a notification about the item being graded for the student.
|
||||
*
|
||||
* @param stdClass $gradeduser The user being graded
|
||||
* @param stdClass $grader The user who is grading
|
||||
*/
|
||||
public function send_student_notification(stdClass $gradeduser, stdClass $grader): void {
|
||||
$contextname = $this->context->get_context_name();
|
||||
$eventdata = new \core\message\message();
|
||||
$eventdata->courseid = $this->context->get_course_context()->instanceid;
|
||||
$eventdata->component = 'moodle';
|
||||
$eventdata->name = 'gradenotifications';
|
||||
$eventdata->userfrom = $grader;
|
||||
$eventdata->userto = $gradeduser;
|
||||
$eventdata->subject = get_string('gradenotificationsubject', 'grades');
|
||||
$eventdata->fullmessage = get_string('gradenotificationmessage', 'grades', $contextname);
|
||||
$eventdata->contexturl = $this->context->get_url();
|
||||
$eventdata->contexturlname = $contextname;
|
||||
$eventdata->fullmessageformat = FORMAT_HTML;
|
||||
$eventdata->fullmessagehtml = '';
|
||||
$eventdata->smallmessage = '';
|
||||
$eventdata->notification = 1;
|
||||
message_send($eventdata);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,12 @@ class store extends external_api {
|
||||
'The ID of the user show',
|
||||
VALUE_REQUIRED
|
||||
),
|
||||
'notifyuser' => new external_value(
|
||||
PARAM_BOOL,
|
||||
'Wheteher to notify the user or not',
|
||||
VALUE_DEFAULT,
|
||||
false
|
||||
),
|
||||
'formdata' => new external_value(
|
||||
PARAM_RAW,
|
||||
'The serialised form data representing the grade',
|
||||
@@ -92,6 +98,7 @@ class store extends external_api {
|
||||
* @param int $contextid
|
||||
* @param string $itemname
|
||||
* @param int $gradeduserid
|
||||
* @param bool $notifyuser
|
||||
* @param string $formdata
|
||||
* @return array
|
||||
* @throws \dml_exception
|
||||
@@ -101,7 +108,8 @@ class store extends external_api {
|
||||
* @throws moodle_exception
|
||||
* @since Moodle 3.8
|
||||
*/
|
||||
public static function execute(string $component, int $contextid, string $itemname, int $gradeduserid, string $formdata): array {
|
||||
public static function execute(string $component, int $contextid, string $itemname, int $gradeduserid,
|
||||
bool $notifyuser, string $formdata): array {
|
||||
global $USER;
|
||||
|
||||
[
|
||||
@@ -151,8 +159,14 @@ class store extends external_api {
|
||||
|
||||
// Grade.
|
||||
$gradeitem->store_grade_from_formdata($gradeduser, $USER, (object) $data);
|
||||
|
||||
$hasgrade = $gradeitem->user_has_grade($gradeduser);
|
||||
|
||||
// Notify.
|
||||
if ($notifyuser) {
|
||||
// Send notification.
|
||||
$gradeitem->send_student_notification($gradeduser, $USER);
|
||||
}
|
||||
|
||||
// Fetch the updated grade back out.
|
||||
$grade = $gradeitem->get_grade_for_user($gradeduser, $USER);
|
||||
|
||||
|
||||
@@ -82,6 +82,12 @@ class store extends external_api {
|
||||
'The serialised form data representing the grade',
|
||||
VALUE_REQUIRED
|
||||
),
|
||||
'notifyuser' => new external_value(
|
||||
PARAM_BOOL,
|
||||
'Wheteher to notify the user or not',
|
||||
VALUE_DEFAULT,
|
||||
false
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -93,15 +99,14 @@ class store extends external_api {
|
||||
* @param string $itemname
|
||||
* @param int $gradeduserid
|
||||
* @param string $formdata
|
||||
* @param bool $notifyuser
|
||||
* @return array
|
||||
* @throws \dml_exception
|
||||
* @throws \invalid_parameter_exception
|
||||
* @throws \restricted_context_exception
|
||||
* @throws coding_exception
|
||||
* @throws moodle_exception
|
||||
* @since Moodle 3.8
|
||||
*/
|
||||
public static function execute(string $component, int $contextid, string $itemname, int $gradeduserid, string $formdata): array {
|
||||
public static function execute(string $component, int $contextid, string $itemname, int $gradeduserid,
|
||||
bool $notifyuser, string $formdata): array {
|
||||
global $USER;
|
||||
|
||||
[
|
||||
@@ -152,6 +157,12 @@ class store extends external_api {
|
||||
// Grade.
|
||||
$gradeitem->store_grade_from_formdata($gradeduser, $USER, (object) $data);
|
||||
|
||||
// Notify.
|
||||
if ($notifyuser) {
|
||||
// Send notification.
|
||||
$gradeitem->send_student_notification($gradeduser, $USER);
|
||||
}
|
||||
|
||||
return fetch::get_fetch_data($gradeitem, $gradeduser);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
define ("gradingform_guide/grades/grader/gradingpanel",["exports","core/ajax","core_grades/grades/grader/gradingpanel/normalise","core_grades/grades/grader/gradingpanel/comparison","jquery"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.storeCurrentGrade=a.fetchCurrentGrade=void 0;e=function(a){return a&&a.__esModule?a:{default:a}}(e);function f(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 g(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var i=a.apply(b,c);function g(a){f(i,d,e,g,h,"next",a)}function h(a){f(i,d,e,g,h,"throw",a)}g(void 0)})}}a.fetchCurrentGrade=function fetchCurrentGrade(a,c,d,e){return(0,b.call)([{methodname:"gradingform_guide_grader_gradingpanel_fetch",args:{component:a,contextid:c,itemname:d,gradeduserid:e}}])[0]};var h=function(){var a=g(regeneratorRuntime.mark(function a(f,g,h,i,j){var k;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:k=j.querySelector("form");if(!(!0===(0,d.compareData)(k))){a.next=9;break}a.t0=c.normaliseResult;a.next=5;return(0,b.call)([{methodname:"gradingform_guide_grader_gradingpanel_store",args:{component:f,contextid:g,itemname:h,gradeduserid:i,formdata:(0,e.default)(k).serialize()}}])[0];case 5:a.t1=a.sent;return a.abrupt("return",(0,a.t0)(a.t1));case 9:return a.abrupt("return","");case 10:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.storeCurrentGrade=h});
|
||||
define ("gradingform_guide/grades/grader/gradingpanel",["exports","core/ajax","core_grades/grades/grader/gradingpanel/normalise","core_grades/grades/grader/gradingpanel/comparison","jquery"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.storeCurrentGrade=a.fetchCurrentGrade=void 0;e=function(a){return a&&a.__esModule?a:{default:a}}(e);function f(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 g(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var i=a.apply(b,c);function g(a){f(i,d,e,g,h,"next",a)}function h(a){f(i,d,e,g,h,"throw",a)}g(void 0)})}}a.fetchCurrentGrade=function fetchCurrentGrade(a,c,d,e){return(0,b.call)([{methodname:"gradingform_guide_grader_gradingpanel_fetch",args:{component:a,contextid:c,itemname:d,gradeduserid:e}}])[0]};var h=function(){var a=g(regeneratorRuntime.mark(function a(f,g,h,i,j,k){var l;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:l=k.querySelector("form");if(!(!0===(0,d.compareData)(l))){a.next=9;break}a.t0=c.normaliseResult;a.next=5;return(0,b.call)([{methodname:"gradingform_guide_grader_gradingpanel_store",args:{component:f,contextid:g,itemname:h,gradeduserid:i,notifyuser:j,formdata:(0,e.default)(l).serialize()}}])[0];case 5:a.t1=a.sent;return a.abrupt("return",(0,a.t0)(a.t1));case 9:return a.abrupt("return","");case 10:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.storeCurrentGrade=h});
|
||||
//# sourceMappingURL=gradingpanel.min.js.map
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/grades/grader/gradingpanel.js"],"names":["fetchCurrentGrade","component","contextid","itemname","gradeduserid","methodname","args","storeCurrentGrade","rootNode","form","querySelector","normaliseResult","formdata","serialize"],"mappings":"gUA6BA,uD,mVAYiC,QAApBA,CAAAA,iBAAoB,CAACC,CAAD,CAAYC,CAAZ,CAAuBC,CAAvB,CAAiCC,CAAjC,CAAkD,CAC/E,MAAO,WAAU,CAAC,CACdC,UAAU,8CADI,CAEdC,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAFQ,CAAD,CAAV,EAQH,CARG,CASV,C,CAaM,GAAMG,CAAAA,CAAiB,4CAAG,WAAMN,CAAN,CAAiBC,CAAjB,CAA4BC,CAA5B,CAAsCC,CAAtC,CAAoDI,CAApD,yFACvBC,CADuB,CAChBD,CAAQ,CAACE,aAAT,CAAuB,MAAvB,CADgB,MAGzB,uBAAYD,CAAZ,CAHyB,uBAIlBE,iBAJkB,gBAII,WAAU,CAAC,CACpCN,UAAU,8CAD0B,CAEpCC,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAKFQ,QAAQ,CAAE,cAAOH,CAAP,EAAaI,SAAb,EALR,CAF8B,CAAD,CAAV,EASzB,CATyB,CAJJ,6FAelB,EAfkB,2CAAH,uDAAvB,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 * Grading panel for gradingform_guide.\n *\n * @module gradingform_guide/grades/grader/gradingpanel\n * @package gradingform_guide\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\nimport {normaliseResult} from 'core_grades/grades/grader/gradingpanel/normalise';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\n\n/**\n * For a given component, contextid, itemname & gradeduserid we can fetch the currently assigned grade.\n *\n * @param {String} component\n * @param {Number} contextid\n * @param {String} itemname\n * @param {Number} gradeduserid\n *\n * @returns {Promise}\n */\nexport const fetchCurrentGrade = (component, contextid, itemname, gradeduserid) => {\n return fetchMany([{\n methodname: `gradingform_guide_grader_gradingpanel_fetch`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n },\n }])[0];\n};\n\n/**\n * For a given component, contextid, itemname & gradeduserid we can store the currently assigned grade in a given form.\n *\n * @param {String} component\n * @param {Number} contextid\n * @param {String} itemname\n * @param {Number} gradeduserid\n * @param {HTMLElement} rootNode\n *\n * @returns {Promise}\n */\nexport const storeCurrentGrade = async(component, contextid, itemname, gradeduserid, rootNode) => {\n const form = rootNode.querySelector('form');\n\n if (compareData(form) === true) {\n return normaliseResult(await fetchMany([{\n methodname: `gradingform_guide_grader_gradingpanel_store`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n formdata: jQuery(form).serialize(),\n },\n }])[0]);\n } else {\n return '';\n }\n};\n"],"file":"gradingpanel.min.js"}
|
||||
{"version":3,"sources":["../../../src/grades/grader/gradingpanel.js"],"names":["fetchCurrentGrade","component","contextid","itemname","gradeduserid","methodname","args","storeCurrentGrade","notifyUser","rootNode","form","querySelector","normaliseResult","notifyuser","formdata","serialize"],"mappings":"gUA6BA,uD,mVAYiC,QAApBA,CAAAA,iBAAoB,CAACC,CAAD,CAAYC,CAAZ,CAAuBC,CAAvB,CAAiCC,CAAjC,CAAkD,CAC/E,MAAO,WAAU,CAAC,CACdC,UAAU,8CADI,CAEdC,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAFQ,CAAD,CAAV,EAQH,CARG,CASV,C,CAcM,GAAMG,CAAAA,CAAiB,4CAAG,WAAMN,CAAN,CAAiBC,CAAjB,CAA4BC,CAA5B,CAAsCC,CAAtC,CAAoDI,CAApD,CAAgEC,CAAhE,yFACvBC,CADuB,CAChBD,CAAQ,CAACE,aAAT,CAAuB,MAAvB,CADgB,MAGzB,uBAAYD,CAAZ,CAHyB,uBAIlBE,iBAJkB,gBAII,WAAU,CAAC,CACpCP,UAAU,8CAD0B,CAEpCC,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAKFS,UAAU,CAAEL,CALV,CAMFM,QAAQ,CAAE,cAAOJ,CAAP,EAAaK,SAAb,EANR,CAF8B,CAAD,CAAV,EAUzB,CAVyB,CAJJ,6FAgBlB,EAhBkB,2CAAH,uDAAvB,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 * Grading panel for gradingform_guide.\n *\n * @module gradingform_guide/grades/grader/gradingpanel\n * @package gradingform_guide\n * @copyright 2019 Andrew Nicols <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\nimport {normaliseResult} from 'core_grades/grades/grader/gradingpanel/normalise';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\n\n/**\n * For a given component, contextid, itemname & gradeduserid we can fetch the currently assigned grade.\n *\n * @param {String} component\n * @param {Number} contextid\n * @param {String} itemname\n * @param {Number} gradeduserid\n *\n * @returns {Promise}\n */\nexport const fetchCurrentGrade = (component, contextid, itemname, gradeduserid) => {\n return fetchMany([{\n methodname: `gradingform_guide_grader_gradingpanel_fetch`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n },\n }])[0];\n};\n\n/**\n * For a given component, contextid, itemname & gradeduserid we can store the currently assigned grade in a given form.\n *\n * @param {String} component\n * @param {Number} contextid\n * @param {String} itemname\n * @param {Number} gradeduserid\n * @param {Boolean} notifyUser\n * @param {HTMLElement} rootNode\n *\n * @returns {Promise}\n */\nexport const storeCurrentGrade = async(component, contextid, itemname, gradeduserid, notifyUser, rootNode) => {\n const form = rootNode.querySelector('form');\n\n if (compareData(form) === true) {\n return normaliseResult(await fetchMany([{\n methodname: `gradingform_guide_grader_gradingpanel_store`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n notifyuser: notifyUser,\n formdata: jQuery(form).serialize(),\n },\n }])[0]);\n } else {\n return '';\n }\n};\n"],"file":"gradingpanel.min.js"}
|
||||
@@ -58,11 +58,12 @@ export const fetchCurrentGrade = (component, contextid, itemname, gradeduserid)
|
||||
* @param {Number} contextid
|
||||
* @param {String} itemname
|
||||
* @param {Number} gradeduserid
|
||||
* @param {Boolean} notifyUser
|
||||
* @param {HTMLElement} rootNode
|
||||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export const storeCurrentGrade = async(component, contextid, itemname, gradeduserid, rootNode) => {
|
||||
export const storeCurrentGrade = async(component, contextid, itemname, gradeduserid, notifyUser, rootNode) => {
|
||||
const form = rootNode.querySelector('form');
|
||||
|
||||
if (compareData(form) === true) {
|
||||
@@ -73,6 +74,7 @@ export const storeCurrentGrade = async(component, contextid, itemname, gradeduse
|
||||
contextid,
|
||||
itemname,
|
||||
gradeduserid,
|
||||
notifyuser: notifyUser,
|
||||
formdata: jQuery(form).serialize(),
|
||||
},
|
||||
}])[0]);
|
||||
|
||||
+16
-1
@@ -77,6 +77,12 @@ class store extends external_api {
|
||||
'The ID of the user show',
|
||||
VALUE_REQUIRED
|
||||
),
|
||||
'notifyuser' => new external_value(
|
||||
PARAM_BOOL,
|
||||
'Wheteher to notify the user or not',
|
||||
VALUE_DEFAULT,
|
||||
false
|
||||
),
|
||||
'formdata' => new external_value(
|
||||
PARAM_RAW,
|
||||
'The serialised form data representing the grade',
|
||||
@@ -92,7 +98,9 @@ class store extends external_api {
|
||||
* @param int $contextid
|
||||
* @param string $itemname
|
||||
* @param int $gradeduserid
|
||||
* @param bool $notifyuser
|
||||
* @param string $formdata
|
||||
*
|
||||
* @return array
|
||||
* @throws \dml_exception
|
||||
* @throws \invalid_parameter_exception
|
||||
@@ -101,7 +109,8 @@ class store extends external_api {
|
||||
* @throws moodle_exception
|
||||
* @since Moodle 3.8
|
||||
*/
|
||||
public static function execute(string $component, int $contextid, string $itemname, int $gradeduserid, string $formdata): array {
|
||||
public static function execute(string $component, int $contextid, string $itemname, int $gradeduserid,
|
||||
bool $notifyuser, string $formdata): array {
|
||||
global $USER;
|
||||
|
||||
[
|
||||
@@ -154,6 +163,12 @@ class store extends external_api {
|
||||
// Grade.
|
||||
$gradeitem->store_grade_from_formdata($gradeduser, $USER, (object) $data);
|
||||
|
||||
// Notify.
|
||||
if ($notifyuser) {
|
||||
// Send notification.
|
||||
$gradeitem->send_student_notification($gradeduser, $USER);
|
||||
}
|
||||
|
||||
return fetch::get_fetch_data($gradeitem, $gradeduser);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -59,7 +59,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectExceptionMessage("The 'foo' item is not valid for the 'mod_invalid' component");
|
||||
store::execute('mod_invalid', 1, 'foo', 2, 'formdata');
|
||||
store::execute('mod_invalid', 1, 'foo', 2, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectExceptionMessage("The 'foo' item is not valid for the 'mod_forum' component");
|
||||
store::execute('mod_forum', 1, 'foo', 2, 'formdata');
|
||||
store::execute('mod_forum', 1, 'foo', 2, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectExceptionMessage("not configured for advanced grading with a marking guide");
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata');
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectExceptionMessage("Grading is not enabled");
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata');
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,7 +147,7 @@ class store_test extends advanced_testcase {
|
||||
'advancedgrading' => $submissiondata,
|
||||
], '', '&');
|
||||
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, $formdata);
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, $formdata, false);
|
||||
$result = external_api::clean_returnvalue(store::execute_returns(), $result);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
define ("gradingform_rubric/grades/grader/gradingpanel",["exports","core/ajax","core_grades/grades/grader/gradingpanel/normalise","core_grades/grades/grader/gradingpanel/comparison","jquery"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.storeCurrentGrade=a.fetchCurrentGrade=void 0;e=function(a){return a&&a.__esModule?a:{default:a}}(e);function f(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 g(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var i=a.apply(b,c);function g(a){f(i,d,e,g,h,"next",a)}function h(a){f(i,d,e,g,h,"throw",a)}g(void 0)})}}a.fetchCurrentGrade=function fetchCurrentGrade(a,c,d,e){return(0,b.call)([{methodname:"gradingform_rubric_grader_gradingpanel_fetch",args:{component:a,contextid:c,itemname:d,gradeduserid:e}}])[0]};var h=function(){var a=g(regeneratorRuntime.mark(function a(f,g,h,i,j){var k;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:k=j.querySelector("form");if(!(!0===(0,d.compareData)(k))){a.next=9;break}a.t0=c.normaliseResult;a.next=5;return(0,b.call)([{methodname:"gradingform_rubric_grader_gradingpanel_store",args:{component:f,contextid:g,itemname:h,gradeduserid:i,formdata:(0,e.default)(k).serialize()}}])[0];case 5:a.t1=a.sent;return a.abrupt("return",(0,a.t0)(a.t1));case 9:return a.abrupt("return","");case 10:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.storeCurrentGrade=h});
|
||||
define ("gradingform_rubric/grades/grader/gradingpanel",["exports","core/ajax","core_grades/grades/grader/gradingpanel/normalise","core_grades/grades/grader/gradingpanel/comparison","jquery"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.storeCurrentGrade=a.fetchCurrentGrade=void 0;e=function(a){return a&&a.__esModule?a:{default:a}}(e);function f(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 g(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var i=a.apply(b,c);function g(a){f(i,d,e,g,h,"next",a)}function h(a){f(i,d,e,g,h,"throw",a)}g(void 0)})}}a.fetchCurrentGrade=function fetchCurrentGrade(a,c,d,e){return(0,b.call)([{methodname:"gradingform_rubric_grader_gradingpanel_fetch",args:{component:a,contextid:c,itemname:d,gradeduserid:e}}])[0]};var h=function(){var a=g(regeneratorRuntime.mark(function a(f,g,h,i,j,k){var l;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:l=k.querySelector("form");if(!(!0===(0,d.compareData)(l))){a.next=9;break}a.t0=c.normaliseResult;a.next=5;return(0,b.call)([{methodname:"gradingform_rubric_grader_gradingpanel_store",args:{component:f,contextid:g,itemname:h,gradeduserid:i,notifyuser:j,formdata:(0,e.default)(l).serialize()}}])[0];case 5:a.t1=a.sent;return a.abrupt("return",(0,a.t0)(a.t1));case 9:return a.abrupt("return","");case 10:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.storeCurrentGrade=h});
|
||||
//# sourceMappingURL=gradingpanel.min.js.map
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/grades/grader/gradingpanel.js"],"names":["fetchCurrentGrade","component","contextid","itemname","gradeduserid","methodname","args","storeCurrentGrade","rootNode","form","querySelector","normaliseResult","formdata","serialize"],"mappings":"iUA8BA,uD,mVAYiC,QAApBA,CAAAA,iBAAoB,CAACC,CAAD,CAAYC,CAAZ,CAAuBC,CAAvB,CAAiCC,CAAjC,CAAkD,CAC/E,MAAO,WAAU,CAAC,CACdC,UAAU,+CADI,CAEdC,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAFQ,CAAD,CAAV,EAQH,CARG,CASV,C,CAaM,GAAMG,CAAAA,CAAiB,4CAAG,WAAMN,CAAN,CAAiBC,CAAjB,CAA4BC,CAA5B,CAAsCC,CAAtC,CAAoDI,CAApD,yFACvBC,CADuB,CAChBD,CAAQ,CAACE,aAAT,CAAuB,MAAvB,CADgB,MAGzB,uBAAYD,CAAZ,CAHyB,uBAIlBE,iBAJkB,gBAII,WAAU,CAAC,CACpCN,UAAU,+CAD0B,CAEpCC,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAKFQ,QAAQ,CAAE,cAAOH,CAAP,EAAaI,SAAb,EALR,CAF8B,CAAD,CAAV,EASzB,CATyB,CAJJ,6FAelB,EAfkB,2CAAH,uDAAvB,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 * Grading panel for gradingform_rubric.\n *\n * @module gradingform_rubric/grades/grader/gradingpanel\n * @package gradingform_rubric\n * @copyright 2019 Mathew May <mathew.solutions>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\nimport {normaliseResult} from 'core_grades/grades/grader/gradingpanel/normalise';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n\n\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\n\n/**\n * For a given component, contextid, itemname & gradeduserid we can fetch the currently assigned grade.\n *\n * @param {String} component\n * @param {Number} contextid\n * @param {String} itemname\n * @param {Number} gradeduserid\n *\n * @returns {Promise}\n */\nexport const fetchCurrentGrade = (component, contextid, itemname, gradeduserid) => {\n return fetchMany([{\n methodname: `gradingform_rubric_grader_gradingpanel_fetch`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n },\n }])[0];\n};\n\n/**\n * For a given component, contextid, itemname & gradeduserid we can store the currently assigned grade in a given form.\n *\n * @param {String} component\n * @param {Number} contextid\n * @param {String} itemname\n * @param {Number} gradeduserid\n * @param {HTMLElement} rootNode\n *\n * @returns {Promise}\n */\nexport const storeCurrentGrade = async(component, contextid, itemname, gradeduserid, rootNode) => {\n const form = rootNode.querySelector('form');\n\n if (compareData(form) === true) {\n return normaliseResult(await fetchMany([{\n methodname: `gradingform_rubric_grader_gradingpanel_store`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n formdata: jQuery(form).serialize(),\n },\n }])[0]);\n } else {\n return '';\n }\n};\n"],"file":"gradingpanel.min.js"}
|
||||
{"version":3,"sources":["../../../src/grades/grader/gradingpanel.js"],"names":["fetchCurrentGrade","component","contextid","itemname","gradeduserid","methodname","args","storeCurrentGrade","notifyUser","rootNode","form","querySelector","normaliseResult","notifyuser","formdata","serialize"],"mappings":"iUA6BA,uD,mVAYiC,QAApBA,CAAAA,iBAAoB,CAACC,CAAD,CAAYC,CAAZ,CAAuBC,CAAvB,CAAiCC,CAAjC,CAAkD,CAC/E,MAAO,WAAU,CAAC,CACdC,UAAU,+CADI,CAEdC,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAFQ,CAAD,CAAV,EAQH,CARG,CASV,C,CAcM,GAAMG,CAAAA,CAAiB,4CAAG,WAAMN,CAAN,CAAiBC,CAAjB,CAA4BC,CAA5B,CAAsCC,CAAtC,CAAoDI,CAApD,CAAgEC,CAAhE,yFACvBC,CADuB,CAChBD,CAAQ,CAACE,aAAT,CAAuB,MAAvB,CADgB,MAGzB,uBAAYD,CAAZ,CAHyB,uBAIlBE,iBAJkB,gBAII,WAAU,CAAC,CACpCP,UAAU,+CAD0B,CAEpCC,IAAI,CAAE,CACFL,SAAS,CAATA,CADE,CAEFC,SAAS,CAATA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFC,YAAY,CAAZA,CAJE,CAKFS,UAAU,CAAEL,CALV,CAMFM,QAAQ,CAAE,cAAOJ,CAAP,EAAaK,SAAb,EANR,CAF8B,CAAD,CAAV,EAUzB,CAVyB,CAJJ,6FAgBlB,EAhBkB,2CAAH,uDAAvB,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 * Grading panel for gradingform_rubric.\n *\n * @module gradingform_rubric/grades/grader/gradingpanel\n * @package gradingform_rubric\n * @copyright 2019 Mathew May <mathew.solutions>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\nimport {normaliseResult} from 'core_grades/grades/grader/gradingpanel/normalise';\nimport {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';\n\n// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()\nimport jQuery from 'jquery';\n\n/**\n * For a given component, contextid, itemname & gradeduserid we can fetch the currently assigned grade.\n *\n * @param {String} component\n * @param {Number} contextid\n * @param {String} itemname\n * @param {Number} gradeduserid\n *\n * @returns {Promise}\n */\nexport const fetchCurrentGrade = (component, contextid, itemname, gradeduserid) => {\n return fetchMany([{\n methodname: `gradingform_rubric_grader_gradingpanel_fetch`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n },\n }])[0];\n};\n\n/**\n * For a given component, contextid, itemname & gradeduserid we can store the currently assigned grade in a given form.\n *\n * @param {String} component\n * @param {Number} contextid\n * @param {String} itemname\n * @param {Number} gradeduserid\n * @param {Boolean} notifyUser\n * @param {HTMLElement} rootNode\n *\n * @returns {Promise}\n */\nexport const storeCurrentGrade = async(component, contextid, itemname, gradeduserid, notifyUser, rootNode) => {\n const form = rootNode.querySelector('form');\n\n if (compareData(form) === true) {\n return normaliseResult(await fetchMany([{\n methodname: `gradingform_rubric_grader_gradingpanel_store`,\n args: {\n component,\n contextid,\n itemname,\n gradeduserid,\n notifyuser: notifyUser,\n formdata: jQuery(form).serialize(),\n },\n }])[0]);\n } else {\n return '';\n }\n};\n"],"file":"gradingpanel.min.js"}
|
||||
@@ -26,7 +26,6 @@ import {call as fetchMany} from 'core/ajax';
|
||||
import {normaliseResult} from 'core_grades/grades/grader/gradingpanel/normalise';
|
||||
import {compareData} from 'core_grades/grades/grader/gradingpanel/comparison';
|
||||
|
||||
|
||||
// Note: We use jQuery.serializer here until we can rewrite Ajax to use XHR.send()
|
||||
import jQuery from 'jquery';
|
||||
|
||||
@@ -59,11 +58,12 @@ export const fetchCurrentGrade = (component, contextid, itemname, gradeduserid)
|
||||
* @param {Number} contextid
|
||||
* @param {String} itemname
|
||||
* @param {Number} gradeduserid
|
||||
* @param {Boolean} notifyUser
|
||||
* @param {HTMLElement} rootNode
|
||||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export const storeCurrentGrade = async(component, contextid, itemname, gradeduserid, rootNode) => {
|
||||
export const storeCurrentGrade = async(component, contextid, itemname, gradeduserid, notifyUser, rootNode) => {
|
||||
const form = rootNode.querySelector('form');
|
||||
|
||||
if (compareData(form) === true) {
|
||||
@@ -74,6 +74,7 @@ export const storeCurrentGrade = async(component, contextid, itemname, gradeduse
|
||||
contextid,
|
||||
itemname,
|
||||
gradeduserid,
|
||||
notifyuser: notifyUser,
|
||||
formdata: jQuery(form).serialize(),
|
||||
},
|
||||
}])[0]);
|
||||
|
||||
+17
-1
@@ -81,6 +81,12 @@ class store extends external_api {
|
||||
'The serialised form data representing the grade',
|
||||
VALUE_REQUIRED
|
||||
),
|
||||
'notifyuser' => new external_value(
|
||||
PARAM_BOOL,
|
||||
'Wheteher to notify the user or not',
|
||||
VALUE_DEFAULT,
|
||||
false
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -92,10 +98,14 @@ class store extends external_api {
|
||||
* @param string $itemname
|
||||
* @param int $gradeduserid
|
||||
* @param string $formdata
|
||||
* @param bool $notifyuser
|
||||
* @return array
|
||||
* @throws coding_exception
|
||||
* @throws moodle_exception
|
||||
* @since Moodle 3.8
|
||||
*/
|
||||
public static function execute(string $component, int $contextid, string $itemname, int $gradeduserid, string $formdata): array {
|
||||
public static function execute(string $component, int $contextid, string $itemname, int $gradeduserid, bool $notifyuser,
|
||||
string $formdata): array {
|
||||
global $USER;
|
||||
|
||||
[
|
||||
@@ -148,6 +158,12 @@ class store extends external_api {
|
||||
// Grade.
|
||||
$gradeitem->store_grade_from_formdata($gradeduser, $USER, (object) $data);
|
||||
|
||||
// Notify.
|
||||
if ($notifyuser) {
|
||||
// Send notification.
|
||||
$gradeitem->send_student_notification($gradeduser, $USER);
|
||||
}
|
||||
|
||||
// Fetch the updated grade back out.
|
||||
$grade = $gradeitem->get_grade_for_user($gradeduser, $USER);
|
||||
|
||||
|
||||
+5
-5
@@ -59,7 +59,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectExceptionMessage("The 'foo' item is not valid for the 'mod_invalid' component");
|
||||
store::execute('mod_invalid', 1, 'foo', 2, 'formdata');
|
||||
store::execute('mod_invalid', 1, 'foo', 2, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectExceptionMessage("The 'foo' item is not valid for the 'mod_forum' component");
|
||||
store::execute('mod_forum', 1, 'foo', 2, 'formdata');
|
||||
store::execute('mod_forum', 1, 'foo', 2, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ class store_test extends advanced_testcase {
|
||||
$gradeitem = component_gradeitem::instance('mod_forum', $forum->get_context(), 'forum');
|
||||
|
||||
$this->expectException(moodle_exception::class);
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata');
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +111,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectExceptionMessage("Grading is not enabled");
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata');
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +146,7 @@ class store_test extends advanced_testcase {
|
||||
'advancedgrading' => $submissiondata,
|
||||
], '', '&');
|
||||
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, $formdata);
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, $formdata, false);
|
||||
$result = external_api::clean_returnvalue(store::execute_returns(), $result);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
|
||||
@@ -61,7 +61,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectExceptionMessage("The 'foo' item is not valid for the 'mod_invalid' component");
|
||||
store::execute('mod_invalid', 1, 'foo', 2, 'formdata');
|
||||
store::execute('mod_invalid', 1, 'foo', 2, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectExceptionMessage("The 'foo' item is not valid for the 'mod_forum' component");
|
||||
store::execute('mod_forum', 1, 'foo', 2, 'formdata');
|
||||
store::execute('mod_forum', 1, 'foo', 2, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +96,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectExceptionMessage("not configured for direct grading");
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata');
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectExceptionMessage("Grading is not enabled");
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata');
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,7 +139,8 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$gradeitem = component_gradeitem::instance('mod_forum', $forum->get_context(), 'forum');
|
||||
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, http_build_query($formdata));
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum',
|
||||
(int) $student->id, http_build_query($formdata), false);
|
||||
$result = external_api::clean_returnvalue(store::execute_returns(), $result);
|
||||
|
||||
// The result should still be empty.
|
||||
@@ -199,7 +200,8 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$gradeitem = component_gradeitem::instance('mod_forum', $forum->get_context(), 'forum');
|
||||
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, http_build_query($formdata));
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum',
|
||||
(int) $student->id, http_build_query($formdata), false);
|
||||
$result = external_api::clean_returnvalue(store::execute_returns(), $result);
|
||||
|
||||
// The result should still be empty.
|
||||
@@ -264,7 +266,8 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectExceptionMessage("Invalid grade '{$suppliedvalue}' provided. Grades must be between 0 and {$maxvalue}.");
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, http_build_query($formdata));
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum',
|
||||
(int) $student->id, http_build_query($formdata), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,7 +61,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectExceptionMessage("The 'foo' item is not valid for the 'mod_invalid' component");
|
||||
store::execute('mod_invalid', 1, 'foo', 2, 'formdata');
|
||||
store::execute('mod_invalid', 1, 'foo', 2, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectExceptionMessage("The 'foo' item is not valid for the 'mod_forum' component");
|
||||
store::execute('mod_forum', 1, 'foo', 2, 'formdata');
|
||||
store::execute('mod_forum', 1, 'foo', 2, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +96,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectExceptionMessage("not configured for grading with scales");
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata');
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectExceptionMessage("Grading is not enabled");
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata');
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, 'formdata', false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +137,8 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$gradeitem = component_gradeitem::instance('mod_forum', $forum->get_context(), 'forum');
|
||||
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, http_build_query($formdata));
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum',
|
||||
(int) $student->id, http_build_query($formdata), false);
|
||||
$result = external_api::clean_returnvalue(store::execute_returns(), $result);
|
||||
|
||||
// The result should still be empty.
|
||||
@@ -208,7 +209,8 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$gradeitem = component_gradeitem::instance('mod_forum', $forum->get_context(), 'forum');
|
||||
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, http_build_query($formdata));
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum',
|
||||
(int) $student->id, http_build_query($formdata), false);
|
||||
$result = external_api::clean_returnvalue(store::execute_returns(), $result);
|
||||
|
||||
// The result should still be empty.
|
||||
@@ -282,7 +284,8 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$gradeitem = component_gradeitem::instance('mod_forum', $forum->get_context(), 'forum');
|
||||
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, http_build_query($formdata));
|
||||
$result = store::execute('mod_forum', (int) $forum->get_context()->id, 'forum',
|
||||
(int) $student->id, http_build_query($formdata), false);
|
||||
$result = external_api::clean_returnvalue(store::execute_returns(), $result);
|
||||
|
||||
// The result should still be empty.
|
||||
@@ -364,7 +367,8 @@ class store_test extends advanced_testcase {
|
||||
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectExceptionMessage("Invalid grade '{$suppliedvalue}' provided. Grades must be between 0 and 3.");
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum', (int) $student->id, http_build_query($formdata));
|
||||
store::execute('mod_forum', (int) $forum->get_context()->id, 'forum',
|
||||
(int) $student->id, http_build_query($formdata), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -318,6 +318,8 @@ $string['grademax'] = 'Maximum grade';
|
||||
$string['grademax_help'] = 'This setting determines the maximum grade when using the value grade type. The maximum grade for an activity-based grade item is set on the activity settings page.';
|
||||
$string['grademin'] = 'Minimum grade';
|
||||
$string['grademin_help'] = 'This setting determines the minimum grade when using the value grade type.';
|
||||
$string['gradenotificationmessage'] = 'You have new feedback on your work for "{$a}"';
|
||||
$string['gradenotificationsubject'] = 'You have been graded';
|
||||
$string['gradeoutcomeitem'] = 'Grade outcome item';
|
||||
$string['gradeoutcomes'] = 'Outcomes';
|
||||
$string['gradeoutcomescourses'] = 'Course outcomes';
|
||||
|
||||
@@ -1213,6 +1213,7 @@ $string['messageprovider:courserequested'] = 'Course creation request notificati
|
||||
$string['messageprovider:courserequestrejected'] = 'Course creation request rejection notification';
|
||||
$string['messageprovider:errors'] = 'Important errors with the site';
|
||||
$string['messageprovider:errors_help'] = 'These are important errors that an administrator should know about.';
|
||||
$string['messageprovider:gradenotifications'] = 'Grade notifications';
|
||||
$string['messageprovider:messagecontactrequests'] = 'Message contact requests notification';
|
||||
$string['messageprovider:notices'] = 'Notices about minor problems';
|
||||
$string['messageprovider:notices_help'] = 'These are notices that an administrator might be interested in seeing.';
|
||||
|
||||
@@ -135,4 +135,11 @@ $messageproviders = array (
|
||||
'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDOFF,
|
||||
)
|
||||
),
|
||||
|
||||
'gradenotifications' => [
|
||||
'defaults' => array(
|
||||
'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
|
||||
'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDOFF,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
define ("mod_forum/grades/grader",["exports","./grader/selectors","mod_forum/repository","core/templates","../local/grades/grader","core/notification","core_course/repository","core/url"],function(a,b,c,d,e,f,g,h){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.registerLaunchListeners=void 0;b=j(b);c=i(c);d=i(d);e=j(e);f=i(f);g=i(g);function i(a){return a&&a.__esModule?a:{default:a}}function j(a){if(a&&a.__esModule){return a}else{var b={};if(null!=a){for(var c in a){if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};if(d.get||d.set){Object.defineProperty(b,c,d)}else{b[c]=a[c]}}}}b.default=a;return b}}function k(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{},d=Object.keys(c);if("function"==typeof Object.getOwnPropertySymbols){d=d.concat(Object.getOwnPropertySymbols(c).filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}))}d.forEach(function(b){l(a,b,c[b])})}return a}function l(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}function m(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 n(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var h=a.apply(b,c);function f(a){m(h,d,e,f,g,"next",a)}function g(a){m(h,d,e,f,g,"throw",a)}f(void 0)})}}var o={contentRegion:"mod_forum/grades/grader/discussion/posts"},p=function(a,b){return function(e){return c.default.getDiscussionByUserID(e,a).then(function(a){a.discussions=a.discussions.map(s);a.experimentaldisplaymode=b?!0:!1;return d.default.render(o.contentRegion,a)}).catch(f.default.exception)}},q=function(a,b){return n(regeneratorRuntime.mark(function c(){var d;return regeneratorRuntime.wrap(function(c){while(1){switch(c.prev=c.next){case 0:c.next=2;return g.default.getUsersFromCourseModuleID(a,b);case 2:d=c.sent;return c.abrupt("return",d.users);case 4:case"end":return c.stop();}}},c)}))},r=function(a){return a.closest(b.gradableItem)},s=function(a){var b=new Map;a.posts.parentposts.forEach(function(a){return b.set(a.id,a)});var c=a.posts.userposts.map(function(a){a.readonly=!0;a.hasreplies=!1;a.replies=[];var c=a.parentid?b.get(a.parentid):null;if(c){c.hasreplies=!1;c.replies=[];c.readonly=!0;a.parentauthorname=c.author.fullname}return{parent:c,post:a}});return k({},a,{posts:c})},t=function(){var a=n(regeneratorRuntime.mark(function a(b){var c,d,f;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:c=b.dataset;a.next=3;return e.getGradingPanelFunctions("mod_forum",c.contextid,c.gradingComponent,c.gradingComponentSubtype,c.gradableItemtype);case 3:d=a.sent;f=c.group?c.group:0;a.next=7;return e.launch(q(c.cmid,f),p(c.cmid,"1"==c.experimentalDisplayMode),d.getter,d.setter,{groupid:c.groupid,initialUserId:c.initialuserid,moduleName:c.name,courseName:c.courseName,courseUrl:(0,h.relativeUrl)("/course/view.php",{id:c.courseId})});case 7:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.registerLaunchListeners=function registerLaunchListeners(){document.addEventListener("click",function(){var a=n(regeneratorRuntime.mark(function a(c){var d;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:if(!c.target.matches(b.launch)){a.next=17;break}d=r(c.target);if(d){a.next=4;break}throw Error("Unable to find a gradable item");case 4:if(!d.matches(b.gradableItems.wholeForum)){a.next=16;break}c.preventDefault();a.prev=6;a.next=9;return t(d);case 9:a.next=14;break;case 11:a.prev=11;a.t0=a["catch"](6);f.default.exception(a.t0);case 14:a.next=17;break;case 16:throw Error("Unable to find a valid gradable item");case 17:case"end":return a.stop();}}},a,null,[[6,11]])}));return function(){return a.apply(this,arguments)}}())}});
|
||||
define ("mod_forum/grades/grader",["exports","./grader/selectors","mod_forum/repository","core/templates","../local/grades/grader","core/notification","core_course/repository","core/url"],function(a,b,c,d,e,f,g,h){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.registerLaunchListeners=void 0;b=j(b);c=i(c);d=i(d);e=j(e);f=i(f);g=i(g);function i(a){return a&&a.__esModule?a:{default:a}}function j(a){if(a&&a.__esModule){return a}else{var b={};if(null!=a){for(var c in a){if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};if(d.get||d.set){Object.defineProperty(b,c,d)}else{b[c]=a[c]}}}}b.default=a;return b}}function k(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{},d=Object.keys(c);if("function"==typeof Object.getOwnPropertySymbols){d=d.concat(Object.getOwnPropertySymbols(c).filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}))}d.forEach(function(b){l(a,b,c[b])})}return a}function l(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}function m(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 n(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var h=a.apply(b,c);function f(a){m(h,d,e,f,g,"next",a)}function g(a){m(h,d,e,f,g,"throw",a)}f(void 0)})}}var o={contentRegion:"mod_forum/grades/grader/discussion/posts"},p=function(a,b){return function(e){return c.default.getDiscussionByUserID(e,a).then(function(a){a.discussions=a.discussions.map(s);a.experimentaldisplaymode=b?!0:!1;return d.default.render(o.contentRegion,a)}).catch(f.default.exception)}},q=function(a,b){return n(regeneratorRuntime.mark(function c(){var d;return regeneratorRuntime.wrap(function(c){while(1){switch(c.prev=c.next){case 0:c.next=2;return g.default.getUsersFromCourseModuleID(a,b);case 2:d=c.sent;return c.abrupt("return",d.users);case 4:case"end":return c.stop();}}},c)}))},r=function(a){return a.closest(b.gradableItem)},s=function(a){var b=new Map;a.posts.parentposts.forEach(function(a){return b.set(a.id,a)});var c=a.posts.userposts.map(function(a){a.readonly=!0;a.hasreplies=!1;a.replies=[];var c=a.parentid?b.get(a.parentid):null;if(c){c.hasreplies=!1;c.replies=[];c.readonly=!0;a.parentauthorname=c.author.fullname}return{parent:c,post:a}});return k({},a,{posts:c})},t=function(){var a=n(regeneratorRuntime.mark(function a(b){var c,d,f;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:c=b.dataset;a.next=3;return e.getGradingPanelFunctions("mod_forum",c.contextid,c.gradingComponent,c.gradingComponentSubtype,c.gradableItemtype);case 3:d=a.sent;f=c.group?c.group:0;a.next=7;return e.launch(q(c.cmid,f),p(c.cmid,"1"==c.experimentalDisplayMode),d.getter,d.setter,{groupid:c.groupid,initialUserId:c.initialuserid,moduleName:c.name,courseName:c.courseName,courseUrl:(0,h.relativeUrl)("/course/view.php",{id:c.courseId}),sendStudentNotifications:c.sendStudentNotifications});case 7:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}();a.registerLaunchListeners=function registerLaunchListeners(){document.addEventListener("click",function(){var a=n(regeneratorRuntime.mark(function a(c){var d;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:if(!c.target.matches(b.launch)){a.next=17;break}d=r(c.target);if(d){a.next=4;break}throw Error("Unable to find a gradable item");case 4:if(!d.matches(b.gradableItems.wholeForum)){a.next=16;break}c.preventDefault();a.prev=6;a.next=9;return t(d);case 9:a.next=14;break;case 11:a.prev=11;a.t0=a["catch"](6);f.default.exception(a.t0);case 14:a.next=17;break;case 16:throw Error("Unable to find a valid gradable item");case 17:case"end":return a.stop();}}},a,null,[[6,11]])}));return function(){return a.apply(this,arguments)}}())}});
|
||||
//# sourceMappingURL=grader.min.js.map
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -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
|
||||
|
||||
@@ -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 <[email protected]>\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","notifyStudent","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,CAAwBC,CAAxB,QAAqCN,CAAAA,CAAa,CAACO,iBAAd,CACzCb,CADyC,CAC9BC,CAD8B,CACrBG,CADqB,CACXI,CADW,CACHG,CADG,CACYC,CADZ,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 <[email protected]>\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, notifyStudent, formData) => GradingMethod.storeCurrentGrade(\n component, context, itemName, userId, notifyStudent, formData),\n };\n};\n\n"],"file":"gradingpanel.min.js"}
|
||||
@@ -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
|
||||
|
||||
@@ -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"}
|
||||
@@ -136,7 +136,8 @@ const launchWholeForumGrading = async(rootNode) => {
|
||||
initialUserId: data.initialuserid,
|
||||
moduleName: data.name,
|
||||
courseName: data.courseName,
|
||||
courseUrl: relativeUrl('/course/view.php', {id: data.courseId})
|
||||
courseUrl: relativeUrl('/course/view.php', {id: data.courseId}),
|
||||
sendStudentNotifications: data.sendStudentNotifications,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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.values.sendStudentNotifications).value,
|
||||
root.querySelector(Selectors.regions.gradingPanel)
|
||||
);
|
||||
if (result.success) {
|
||||
addToast(await getString('grades:gradesavedfor', 'mod_forum', user));
|
||||
}
|
||||
@@ -323,9 +327,10 @@ const displayGradingError = async(root, user, err) => {
|
||||
* @param {Function} getContentForUser A function to get the content for a specific user
|
||||
* @param {Function} getGradeForUser A function get the grade details for a specific user
|
||||
* @param {Function} setGradeForUser A function to set the grade for a specific user
|
||||
* @param
|
||||
*/
|
||||
export const launch = async(getListOfUsers, getContentForUser, getGradeForUser, setGradeForUser, {
|
||||
initialUserId = null, moduleName, courseName, courseUrl
|
||||
initialUserId = null, moduleName, courseName, courseUrl, sendStudentNotifications
|
||||
} = {}) => {
|
||||
|
||||
// We need all of these functions to be executed in series, if one step runs before another the interface
|
||||
@@ -336,11 +341,13 @@ export const launch = async(getListOfUsers, getContentForUser, getGradeForUser,
|
||||
userList,
|
||||
] = await Promise.all([
|
||||
createFullScreenWindow({fullscreen: false, showLoader: false}),
|
||||
|
||||
Templates.renderForPromise(templateNames.grader.app, {
|
||||
moduleName,
|
||||
courseName,
|
||||
courseUrl,
|
||||
drawer: {show: true}
|
||||
drawer: {show: true},
|
||||
defaultsendnotifications: sendStudentNotifications,
|
||||
}),
|
||||
getListOfUsers(),
|
||||
]);
|
||||
|
||||
@@ -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, notifyStudent, formData) => GradingMethod.storeCurrentGrade(
|
||||
component, context, itemName, userId, notifyStudent, formData),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -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',
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ class forum {
|
||||
'assesstimefinish' => $forum->get_assess_time_finish(),
|
||||
'scale' => $forum->get_scale(),
|
||||
'grade_forum' => $forum->get_grade_for_forum(),
|
||||
'sendstudentnotifications_forum' => $forum->should_notify_students_default_when_grade_for_forum(),
|
||||
'maxbytes' => $forum->get_max_bytes(),
|
||||
'maxattachments' => $forum->get_max_attachments(),
|
||||
'forcesubscribe' => $forum->get_subscription_mode(),
|
||||
|
||||
@@ -69,8 +69,10 @@ class forum {
|
||||
private $assesstimefinish;
|
||||
/** @var int $scale The rating scale */
|
||||
private $scale;
|
||||
/** @var int $gradeforum The grade for the forum when grading holistcally */
|
||||
/** @var int $gradeforum The grade for the forum when grading holistically */
|
||||
private $gradeforum;
|
||||
/** @var bool $sendstudentnotificationsforum Whether to notify students when the forum is graded holistically */
|
||||
private $sendstudentnotificationsforum;
|
||||
/** @var int $maxbytes Maximum attachment size */
|
||||
private $maxbytes;
|
||||
/** @var int $maxattachments Maximum number of attachments */
|
||||
@@ -123,7 +125,8 @@ class forum {
|
||||
* @param int $assesstimestart Timestamp to begin assessment
|
||||
* @param int $assesstimefinish Timestamp to end assessment
|
||||
* @param int $scale The rating scale
|
||||
* @param int $forum_grade The holistic grade
|
||||
* @param int $gradeforum The holistic grade
|
||||
* @param bool $sendstudentnotificationsforum Default for whether to notify students when grade holistically
|
||||
* @param int $maxbytes Maximum attachment size
|
||||
* @param int $maxattachments Maximum number of attachments
|
||||
* @param int $forcesubscribe Does the forum force users to subscribe?
|
||||
@@ -158,6 +161,7 @@ class forum {
|
||||
int $assesstimefinish,
|
||||
int $scale,
|
||||
int $gradeforum,
|
||||
bool $sendstudentnotificationsforum,
|
||||
int $maxbytes,
|
||||
int $maxattachments,
|
||||
int $forcesubscribe,
|
||||
@@ -191,6 +195,7 @@ class forum {
|
||||
$this->assesstimefinish = $assesstimefinish;
|
||||
$this->scale = $scale;
|
||||
$this->gradeforum = $gradeforum;
|
||||
$this->sendstudentnotificationsforum = $sendstudentnotificationsforum;
|
||||
$this->maxbytes = $maxbytes;
|
||||
$this->maxattachments = $maxattachments;
|
||||
$this->forcesubscribe = $forcesubscribe;
|
||||
@@ -372,6 +377,15 @@ class forum {
|
||||
return $this->get_grade_for_forum() !== 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default for whether the students should be notified when grading holistically.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function should_notify_students_default_when_grade_for_forum(): bool {
|
||||
return $this->sendstudentnotificationsforum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum bytes.
|
||||
*
|
||||
|
||||
@@ -87,6 +87,7 @@ class entity {
|
||||
$record->assesstimefinish,
|
||||
$record->scale,
|
||||
$record->grade_forum,
|
||||
$record->sendstudentnotifications_forum,
|
||||
$record->maxbytes,
|
||||
$record->maxattachments,
|
||||
$record->forcesubscribe,
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<FIELD NAME="assesstimefinish" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="scale" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="grade_forum" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="sendstudentnotifications_forum" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="maxbytes" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="maxattachments" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Number of attachments allowed per post"/>
|
||||
<FIELD NAME="forcesubscribe" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
|
||||
@@ -242,5 +242,21 @@ function xmldb_forum_upgrade($oldversion) {
|
||||
upgrade_mod_savepoint(true, 2019100100, 'forum');
|
||||
}
|
||||
|
||||
if ($oldversion < 2019100108) {
|
||||
|
||||
// Define field sendstudentnotifications_forum to be added to forum.
|
||||
$table = new xmldb_table('forum');
|
||||
$field = new xmldb_field('sendstudentnotifications_forum', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0',
|
||||
'grade_forum');
|
||||
|
||||
// Conditionally launch add field sendstudentnotifications_forum.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Forum savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2019100108, 'forum');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -639,6 +639,10 @@ $string['searchuserid'] = 'The Moodle ID of the author';
|
||||
$string['searchwhichforums'] = 'Choose which forums to search';
|
||||
$string['searchwords'] = 'These words can appear anywhere in the post';
|
||||
$string['seeallposts'] = 'See all posts made by this user';
|
||||
$string['sendstudentnotificationsno'] = 'No';
|
||||
$string['sendstudentnotificationsyes'] = 'Yes, send notification to student';
|
||||
$string['sendstudentnotificationsdefault'] = 'Default setting for "Notify students"';
|
||||
$string['sendstudentnotificationsdefault_help'] = 'Set the default value for the "Notify students" checkbox on the grading form.';
|
||||
$string['settings'] = 'Settings';
|
||||
$string['shortpost'] = 'Short post';
|
||||
$string['showingcountoftotaldiscussions'] = 'Showing {$a->count} of {$a->total} discussions';
|
||||
|
||||
@@ -235,6 +235,8 @@ class mod_forum_mod_form extends moodleform_mod {
|
||||
$gradefieldname = component_gradeitems::get_field_name_for_itemnumber($component, $itemnumber, 'grade');
|
||||
$gradecatfieldname = component_gradeitems::get_field_name_for_itemnumber($component, $itemnumber, 'gradecat');
|
||||
$gradepassfieldname = component_gradeitems::get_field_name_for_itemnumber($component, $itemnumber, 'gradepass');
|
||||
$sendstudentnotificationsfieldname = component_gradeitems::get_field_name_for_itemnumber($component, $itemnumber,
|
||||
'sendstudentnotifications');
|
||||
|
||||
// The advancedgradingmethod is different in that it is suffixed with an area name... which is not the
|
||||
// itemnumber.
|
||||
@@ -304,6 +306,14 @@ class mod_forum_mod_form extends moodleform_mod {
|
||||
$mform->setDefault($gradepassfieldname, '');
|
||||
$mform->setType($gradepassfieldname, PARAM_RAW);
|
||||
$mform->hideIf($gradepassfieldname, "{$gradefieldname}[modgrade_type]", 'eq', 'none');
|
||||
|
||||
$mform->addElement(
|
||||
'selectyesno',
|
||||
$sendstudentnotificationsfieldname,
|
||||
get_string('sendstudentnotificationsdefault', 'forum')
|
||||
);
|
||||
$mform->addHelpButton($sendstudentnotificationsfieldname, 'sendstudentnotificationsdefault', 'forum');
|
||||
$mform->hideIf($sendstudentnotificationsfieldname, "{$gradefieldname}[modgrade_type]", 'eq', 'none');
|
||||
}
|
||||
|
||||
function definition_after_data() {
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
data-grading-component="{{gradingcomponent}}"
|
||||
data-grading-component-subtype="{{gradingcomponentsubtype}}"
|
||||
data-gradable-itemtype="forum"
|
||||
{{#firstgradeduserid}}data-initialuserid="{{firstgradeduserid}}" {{/firstgradeduserid}}
|
||||
{{#sendstudentnotifications}}data-send-student-notifications="1" {{/sendstudentnotifications}}
|
||||
>
|
||||
{{#str}}gradeusers, forum{{/str}}
|
||||
</button>
|
||||
@@ -50,4 +52,4 @@
|
||||
require(['mod_forum/grades/grader'], function(Grader) {
|
||||
Grader.registerLaunchListeners();
|
||||
});
|
||||
{{/js}}
|
||||
{{/js}}
|
||||
@@ -103,5 +103,24 @@
|
||||
</div>
|
||||
<div class="hidden overflow-auto" data-region="search-results-container"></div>
|
||||
</div>
|
||||
<div data-region="grade-errors" role="alert" aria-role="assertive"></div>
|
||||
<hr/>
|
||||
<div class="col-sm-12">
|
||||
<h4 class="d-inline mb-0 fa fa-bell-o"></h4>
|
||||
<h4 class="d-inline mb-0 ">{{#str}}notifications, core{{/str}}</h4>
|
||||
<div data-region="notification" class="col-md-12 mt-3">
|
||||
<label class="form-check">
|
||||
<input class="form-check-input" type="radio" name="sendstudentnotifications" value="1"{{#defaultsendnotifications}} checked{{/defaultsendnotifications}}/>
|
||||
{{#str}}sendstudentnotificationsyes, mod_forum{{/str}}
|
||||
</label>
|
||||
<label class="form-check">
|
||||
<input class="form-check-input" type="radio" name="sendstudentnotifications" value="0"{{^defaultsendnotifications}} checked{{/defaultsendnotifications}}/>
|
||||
{{#str}}sendstudentnotificationsno, mod_forum{{/str}}
|
||||
</label>
|
||||
{{#helpicon}}
|
||||
{{>core/help_icon}}
|
||||
{{/helpicon}}
|
||||
</div>
|
||||
</div>
|
||||
{{/drawercontent}}
|
||||
{{/core/drawer}}
|
||||
{{/core/drawer}}
|
||||
@@ -96,7 +96,7 @@ class mod_forum_entities_forum_testcase extends advanced_testcase {
|
||||
$lockdiscussionafter = 0;
|
||||
$duedate = 0;
|
||||
$cutoffdate = 0;
|
||||
|
||||
$sendnotification = false;
|
||||
$forum = new forum_entity(
|
||||
$context,
|
||||
$coursemodule,
|
||||
@@ -113,6 +113,7 @@ class mod_forum_entities_forum_testcase extends advanced_testcase {
|
||||
$assesstimefinish,
|
||||
$scale,
|
||||
$gradeforum,
|
||||
$sendnotification,
|
||||
$maxbytes,
|
||||
$maxattachments,
|
||||
$forcesubscribe,
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2019100106; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2019100108; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2019051100; // Requires this Moodle version
|
||||
$plugin->component = 'mod_forum'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
+1
-3
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user