Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{"version":3,"file":"gradingpanel.min.js","sources":["../../../src/grades/grader/gradingpanel.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Grading panel for gradingform_rubric.\n *\n * @module     gradingform_rubric/grades/grader/gradingpanel\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"],"names":["component","contextid","itemname","gradeduserid","methodname","args","async","notifyUser","rootNode","form","querySelector","notifyuser","formdata","serialize"],"mappings":";;;;;;;6MAwCiC,CAACA,UAAWC,UAAWC,SAAUC,gBACvD,cAAU,CAAC,CACdC,0DACAC,KAAM,CACFL,UAAAA,UACAC,UAAAA,UACAC,SAAAA,SACAC,aAAAA,iBAEJ,8BAeyBG,MAAMN,UAAWC,UAAWC,SAAUC,aAAcI,WAAYC,kBACvFC,KAAOD,SAASE,cAAc,eAEV,KAAtB,2BAAYD,OACL,oCAAsB,cAAU,CAAC,CACpCL,0DACAC,KAAM,CACFL,UAAAA,UACAC,UAAAA,UACAC,SAAAA,SACAC,aAAAA,aACAQ,WAAYJ,WACZK,UAAU,mBAAOH,MAAMI,gBAE3B,IAEG"}