���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home3/cpr76684/public_html/gradingpanel.tar
���ѧ٧ѧ�
scale.js 0000644 00000003373 15152662016 0006203 0 ustar 00 // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Grading panel for simple direct grading. * * @module core_grades/grades/grader/gradingpanel/scale * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ import {saveGrade, fetchGrade} from './repository'; 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'; import {invalidResult} from './normalise'; export const fetchCurrentGrade = (...args) => fetchGrade('scale')(...args); export const storeCurrentGrade = (component, context, itemname, userId, notifyUser, rootNode) => { const form = rootNode.querySelector('form'); const grade = form.querySelector('select[name="grade"]'); if (!grade.checkValidity() || !grade.value.trim()) { return invalidResult; } if (compareData(form) === true) { return saveGrade('scale')(component, context, itemname, userId, notifyUser, jQuery(form).serialize()); } else { return ''; } }; repository.js 0000644 00000003344 15152662016 0007331 0 ustar 00 // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Repository for simple direct grading panel. * * @module core_grades/grades/grader/gradingpanel/repository * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ import {call as fetchMany} from 'core/ajax'; import {normaliseResult} from './normalise'; export const fetchGrade = type => (component, contextid, itemname, gradeduserid) => { return fetchMany([{ methodname: `core_grades_grader_gradingpanel_${type}_fetch`, args: { component, contextid, itemname, gradeduserid, }, }])[0]; }; export const saveGrade = type => async(component, contextid, itemname, gradeduserid, notifyUser, formdata) => { return normaliseResult(await fetchMany([{ methodname: `core_grades_grader_gradingpanel_${type}_store`, args: { component, contextid, itemname, gradeduserid, notifyuser: notifyUser, formdata, }, }])[0]); }; normalise.js 0000644 00000003373 15152662016 0007105 0 ustar 00 // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Error handling and normalisation of provided data. * * @module core_grades/grades/grader/gradingpanel/normalise * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Normalise a resultset for consumption by the grader. * * @param {Object} result The result returned from a grading web service * @return {Object} */ export const normaliseResult = result => { return { result, failed: !!result.warnings.length, success: !result.warnings.length, error: null, }; }; /** * Return the resultset used to describe an invalid result. * * @return {Object} */ export const invalidResult = () => { return { success: false, failed: false, result: {}, error: null, }; }; /** * Return the resultset used to describe a failed update. * * @param {Object} error * @return {Object} */ export const failedUpdate = error => { return { success: false, failed: true, result: {}, error, }; }; point.js 0000644 00000004363 15152662016 0006245 0 ustar 00 // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Grading panel for simple direct grading. * * @module core_grades/grades/grader/gradingpanel/point * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ import {saveGrade, fetchGrade} from './repository'; 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'; import {invalidResult} from './normalise'; /** * Fetch the current grade for a user. * * @param {object} args * @param {String} args.component * @param {Number} args.context * @param {String} args.itemname * @param {Number} args.userId * @param {Element} args.rootNode * @returns {Object} */ export const fetchCurrentGrade = (...args) => fetchGrade('point')(...args); /** * Store a new grade for a user. * * @param {String} component * @param {Number} context * @param {String} itemname * @param {Number} userId * @param {Boolean} notifyUser * @param {Element} rootNode * @returns {Object} */ export const storeCurrentGrade = async(component, context, itemname, userId, notifyUser, rootNode) => { const form = rootNode.querySelector('form'); const grade = form.querySelector('input[name="grade"]'); if (!grade.checkValidity() || !grade.value.trim()) { return invalidResult; } if (compareData(form) === true) { return await saveGrade('point')(component, context, itemname, userId, notifyUser, jQuery(form).serialize()); } else { return ''; } }; comparison.js 0000644 00000006046 15152662016 0007266 0 ustar 00 // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Compare a given form's values and its previously set data attributes. * * @module core_grades/grades/grader/gradingpanel/comparison * @copyright 2019 Mathew May <mathew.solutions> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ export const fillInitialValues = (form) => { Array.prototype.forEach.call(form.elements, (input) => { if (input.type === 'submit' || input.type === 'button') { return; } else if (input.type === 'radio' || input.type === 'checkbox') { input.dataset.initialValue = JSON.stringify(input.checked); } else if (typeof input.value !== 'undefined') { input.dataset.initialValue = JSON.stringify(input.value); } else if (input.type === 'select-one') { Array.prototype.forEach.call(input.options, (option) => { option.dataset.initialValue = JSON.stringify(option.selected); }); } }); }; /** * Compare the form data with the initial form data from when the form was set up. * * If values have changed, return a truthy value. * * @param {HTMLElement} form * @return {Boolean} */ export const compareData = (form) => { const result = Array.prototype.some.call(form.elements, (input) => { if (input.type === 'submit' || input.type === 'button') { return false; } else if (input.type === 'radio' || input.type === 'checkbox') { if (typeof input.dataset.initialValue !== 'undefined') { return input.dataset.initialValue !== JSON.stringify(input.checked); } } else if (typeof input.value !== 'undefined') { if (typeof input.dataset.initialValue !== 'undefined') { return input.dataset.initialValue !== JSON.stringify(input.value); } } else if (input.type === 'select-one') { return Array.prototype.some.call(input.options, (option) => { if (typeof option.dataset.initialValue !== 'undefined') { return option.dataset.initialValue !== JSON.stringify(option.selected); } return false; }); } // No value found to check. Assume that there were changes. return true; }); // Fill the initial values again as the form may not be reloaded. fillInitialValues(form); return result; };
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�