MDL-66074 mod_forum: Grader module documentation
This commit is contained in:
@@ -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":"6nBAkCe,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,SAAAC,CAAM,QAAIF,CAAAA,CAAa,CAACG,iBAAd,CAAgCT,CAAhC,CAA2CC,CAA3C,CAAoDG,CAApD,CAA8DI,CAA9D,CAAJ,CADX,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 *\n * @param {String} component The component being graded\n * @param {Number} context The contextid of the thing being graded\n * @param {String} gradingComponent The thing providing the grading type\n * @param {String} gradingSubtype The subtype fo the grading component\n * @param {String} itemName The name of the thing being graded\n * @return {Object}\n */\nexport default async(component, context, gradingComponent, gradingSubtype, itemName) => {\n let gradingMethodHandler = `${gradingComponent}/grades/grader/gradingpanel`;\n if (gradingSubtype) {\n gradingMethodHandler += `/${gradingSubtype}`;\n }\n\n const GradingMethod = await import(gradingMethodHandler);\n\n return {\n getter: userId => GradingMethod.fetchCurrentGrade(component, context, itemName, userId),\n setter: (userId, formData) => GradingMethod.storeCurrentGrade(component, context, itemName, userId, formData),\n };\n};\n\n"],"file":"gradingpanel.min.js"}
|
||||
{"version":3,"sources":["../../../../../src/local/grades/local/grader/gradingpanel.js"],"names":["component","context","gradingComponent","gradingSubtype","itemName","gradingMethodHandler","GradingMethod","getter","userId","fetchCurrentGrade","setter","formData","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"}
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/local/grades/local/grader/selectors.js"],"names":["getDataSelector","name","value","buttons","toggleFullscreen","closeGrader","saveGrade","regions","moduleReplace","pickerRegion","gradingPanel","gradingPanelErrors"],"mappings":"kKAwBMA,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,CADE,CAMXO,OAAO,CAAE,CACLC,aAAa,CAAER,CAAe,CAAC,QAAD,CAAW,gBAAX,CADzB,CAELS,YAAY,CAAET,CAAe,CAAC,QAAD,CAAW,aAAX,CAFxB,CAGLU,YAAY,CAAEV,CAAe,CAAC,QAAD,CAAW,OAAX,CAHxB,CAILW,kBAAkB,CAAEX,CAAe,CAAC,QAAD,CAAW,cAAX,CAJ9B,CANE,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\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 },\n regions: {\n moduleReplace: getDataSelector('region', 'module_content'),\n pickerRegion: getDataSelector('region', 'user_picker'),\n gradingPanel: getDataSelector('region', 'grade'),\n gradingPanelErrors: getDataSelector('region', 'grade-errors'),\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","regions","moduleReplace","pickerRegion","gradingPanel","gradingPanelErrors"],"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,CADE,CAMXO,OAAO,CAAE,CACLC,aAAa,CAAER,CAAe,CAAC,QAAD,CAAW,gBAAX,CADzB,CAELS,YAAY,CAAET,CAAe,CAAC,QAAD,CAAW,aAAX,CAFxB,CAGLU,YAAY,CAAEV,CAAe,CAAC,QAAD,CAAW,OAAX,CAHxB,CAILW,kBAAkB,CAAEX,CAAe,CAAC,QAAD,CAAW,cAAX,CAJ9B,CANE,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 },\n regions: {\n moduleReplace: getDataSelector('region', 'module_content'),\n pickerRegion: getDataSelector('region', 'user_picker'),\n gradingPanel: getDataSelector('region', 'grade'),\n gradingPanelErrors: getDataSelector('region', 'grade-errors'),\n },\n};\n\n"],"file":"selectors.min.js"}
|
||||
File diff suppressed because one or more lines are too long
@@ -24,6 +24,8 @@
|
||||
|
||||
/**
|
||||
* Get the grade panel setter and getter for the current component.
|
||||
* This function dynamically pulls the relevant gradingpanel JS file defined in the grading method.
|
||||
* 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.
|
||||
*
|
||||
* @param {String} component The component being graded
|
||||
* @param {Number} context The contextid of the thing being graded
|
||||
@@ -41,7 +43,7 @@ export default async(component, context, gradingComponent, gradingSubtype, itemN
|
||||
const GradingMethod = await import(gradingMethodHandler);
|
||||
|
||||
return {
|
||||
getter: userId => GradingMethod.fetchCurrentGrade(component, context, itemName, userId),
|
||||
getter: (userId) => GradingMethod.fetchCurrentGrade(component, context, itemName, userId),
|
||||
setter: (userId, formData) => GradingMethod.storeCurrentGrade(component, context, itemName, userId, formData),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -22,6 +22,12 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* A small helper function to build queryable data selectors.
|
||||
* @param {String} name
|
||||
* @param {String} value
|
||||
* @return {string}
|
||||
*/
|
||||
const getDataSelector = (name, value) => {
|
||||
return `[data-${name}="${value}"]`;
|
||||
};
|
||||
|
||||
@@ -118,7 +118,7 @@ class UserPicker {
|
||||
* Register the event listeners for the user picker.
|
||||
*/
|
||||
registerEventListeners() {
|
||||
this.root.addEventListener('click', async e => {
|
||||
this.root.addEventListener('click', async(e) => {
|
||||
const button = e.target.closest(Selectors.actions.changeUser);
|
||||
if (button) {
|
||||
const result = await this.preChangeUserCallback(this.currentUser);
|
||||
@@ -186,7 +186,11 @@ class UserPicker {
|
||||
* @param {Number} [currentUserID] The userid of the current user
|
||||
* @returns {UserPicker}
|
||||
*/
|
||||
export default async(users, showUserCallback, preChangeUserCallback, {
|
||||
export default async(
|
||||
users,
|
||||
showUserCallback,
|
||||
preChangeUserCallback,
|
||||
{
|
||||
initialUserId = null,
|
||||
} = {}
|
||||
) => {
|
||||
|
||||
Reference in New Issue
Block a user