Merge branch 'MDL-72013-311' of git://github.com/andrewnicols/moodle into MOODLE_311_STABLE

This commit is contained in:
Eloy Lafuente (stronk7)
2021-10-21 09:23:04 +02:00
91 changed files with 355 additions and 155 deletions
+61 -3
View File
@@ -2,6 +2,7 @@
'plugins': [
'babel',
'promise',
'jsdoc',
],
'env': {
'browser': true,
@@ -191,7 +192,6 @@
'property': 'str',
'message': 'Use AMD module "core/str" or M.util.get_string()'
}],
},
overrides: [
{
@@ -200,7 +200,23 @@
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-unused-expressions': 'off'
'no-unused-expressions': 'off',
// === JSDocs ===
"jsdoc/check-access": 'off',
"jsdoc/check-alignment": 'off',
"jsdoc/check-param-names": 'off',
"jsdoc/check-property-names": 'off',
"jsdoc/empty-tags": 'off',
"jsdoc/implements-on-classes": 'off',
"jsdoc/multiline-blocks": 'off',
"jsdoc/require-jsdoc": 'off',
"jsdoc/require-param": 'off',
"jsdoc/require-param-name": 'off',
"jsdoc/require-param-type": 'off',
"jsdoc/require-property": 'off',
"jsdoc/require-property-name": 'off',
"jsdoc/require-property-type": 'off',
}
},
{
@@ -238,7 +254,49 @@
// === Promises ===
// We have Promise now that we're using ES6.
'promise/no-native': 'off',
'promise/avoid-new': 'off'
'promise/avoid-new': 'off',
// === JSDocs ===
"jsdoc/check-access": [
'error',
],
"jsdoc/check-alignment": 1, // Recommended.
"jsdoc/check-param-names": [
'error',
],
"jsdoc/check-property-names": [
'error',
],
"jsdoc/empty-tags": [
'error',
],
"jsdoc/implements-on-classes": [
'error',
],
"jsdoc/multiline-blocks": [
'error',
],
"jsdoc/require-jsdoc": [
'error',
],
"jsdoc/require-param": [
'error',
],
"jsdoc/require-param-name": [
'error',
],
"jsdoc/require-param-type": [
'error',
],
"jsdoc/require-property": [
'error',
],
"jsdoc/require-property-name": [
'error',
],
"jsdoc/require-property-type": [
'error',
],
},
parserOptions: {
'ecmaVersion': 9,
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -2
View File
@@ -98,8 +98,7 @@ define(['jquery'], function($) {
/**
* Callback to inject the template.
*
* @param {Node} container Node to inject in.
* @return {Promise} Resolved when done.
* @returns {Promise} Resolved when done.
* @method injectTemplate
*/
Rule.prototype.injectTemplate = function() {
@@ -37,9 +37,6 @@ define(['jquery',
/**
* Constructor for CompetencyDialogue.
*
* @param {Object} options
*
*/
var Competencydialogue = function() {
// Intentionally left empty.
@@ -156,9 +156,8 @@ define(['jquery',
/**
* Opens the picker.
*
* @param {Number} competencyId The competency ID of the competency to work on.
* @method display
* @return {Promise}
* @returns {Promise}
*/
RuleConfig.prototype.display = function() {
var self = this;
@@ -137,7 +137,6 @@ define(['jquery',
/**
* Refresh the course competencies page.
*
* @param {Event} e
* @method saveSettings
*/
settingsMod.prototype.refreshCourseCompetenciesPage = function() {
+1 -1
View File
@@ -26,7 +26,7 @@ define(['core/str', 'core/yui'], function(str, Y) {
/**
* Store the current instance of the core drag drop.
*
* @property dragDropInstance M.tool_lp.dragdrop_reorder
* @property {object} dragDropInstance M.tool_lp.dragdrop_reorder
*/
var dragDropInstance = null;
-1
View File
@@ -99,7 +99,6 @@ define(['jquery',
/**
* Opens the picker.
*
* @param {Number} competencyId The competency ID of the competency to work on.
* @method display
* @return {Promise}
*/
+2 -2
View File
@@ -43,8 +43,8 @@ define(['jquery'], function($) {
/**
* Constructor
*
* @param {$} menuRoot Jquery collection matching the root of the menu.
* @param {Function[]} handlers, called when a menu item is chosen.
* @param {jQuery} menuRoot Jquery collection matching the root of the menu.
* @param {Function[]} handlers called when a menu item is chosen.
*/
var Menubar = function(menuRoot, handlers) {
// Setup private class variables.
-3
View File
@@ -574,8 +574,6 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
* Handle a blur event
*
* @method handleBlur
* @param {Object} item item is the jquery id of the parent item of the group
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleBlur = function() {
@@ -587,7 +585,6 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
*
* @method handleFocus
* @param {Object} item item is the jquery id of the parent item of the group
* @param {Event} e The event.
* @return {Boolean}
*/
Tree.prototype.handleFocus = function(item) {
@@ -31,8 +31,6 @@ define(['jquery',
/**
* UserCompetencyWorkflow class.
*
* @param {String} selector The node containing the buttons to switch mode.
*/
var UserCompetencyWorkflow = function() {
EventBase.prototype.constructor.apply(this, []);
@@ -195,7 +195,6 @@ define(['jquery',
*
* @param {Object} evidenceData Evidence data from evidence node.
* @param {Number} competencyIds The competency IDs.
* @param {Boolean} requestReview Send competencies to review.
*/
UserEvidenceActions.prototype._doCreateUserEvidenceCompetency = function(evidenceData, competencyIds) {
var self = this,
File diff suppressed because one or more lines are too long
@@ -30,6 +30,8 @@ function($, Ajax, Notification, ModalFactory, ModalEvents) {
/**
* PolicyActions class.
*
* @param {jQuery} root
*/
var PolicyActions = function(root) {
this.registerEvents(root);
@@ -37,6 +39,8 @@ function($, Ajax, Notification, ModalFactory, ModalEvents) {
/**
* Register event listeners.
*
* @param {jQuery} root
*/
PolicyActions.prototype.registerEvents = function(root) {
root.on("click", function(e) {
@@ -115,6 +119,7 @@ function($, Ajax, Notification, ModalFactory, ModalEvents) {
* Initialise the actions helper.
*
* @method init
* @param {object} root
* @return {PolicyActions}
*/
'init': function(root) {
File diff suppressed because one or more lines are too long
+1 -2
View File
@@ -203,7 +203,7 @@ const toggleAccessMap = (courseId, displayFormat) => {
* @param {Object[]} sectionData The error data for course sections.
* @param {Object[]} moduleData The error data for course modules.
* @returns {Object} An object representing the extra error information.
*/
*/
const getErrorTotals = (sectionData, moduleData) => {
const totals = {
totalErrors: 0,
@@ -290,7 +290,6 @@ const fetchReviewData = (courseid, updatePreference = false) => {
* @param {number} toggled A number represnting the state of the review toggle.
* @param {string} displayFormat A string representing the display format for icons.
* @param {number} courseId The course ID.
* @param {number} userId The id of the currently logged-in user.
*/
export const init = (toggled, displayFormat, courseId) => {
// Settings consts.
File diff suppressed because one or more lines are too long
+1 -2
View File
@@ -522,7 +522,6 @@ function(
* Intialise the courses list and cards views on page load.
*
* @param {object} root The root element for the courses view.
* @param {object} content The content element for the courses view.
*/
var initializePagedContent = function(root) {
namespace = "block_myoverview_" + root.attr('id') + "_" + Math.random();
@@ -708,8 +707,8 @@ function(
};
/**
* Reset the courses views to their original
*
* state on first page load.courseOffset
*
* This is called when configuration has changed for the event lists
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -97,6 +97,8 @@ define([
/**
* This will add a visual indicator to the calendar UI to
* indicate which nav link is a valid drop zone.
*
* @param {Event} e
*/
var dragstartHandler = function(e) {
// Make sure the drag event is for a calendar event.
+2 -2
View File
@@ -137,9 +137,9 @@ define([
* The current drag target and the 2 days following it (including
* wrapping to the next week if necessary).
*
* @param {string|object} target The drag target element
* @param {string|object} dropZone The drag target element
* @param {bool} hovered If the target is hovered or not
* @param {int} count How many days to highlight (default to duration)
* @param {Number} count How many days to highlight (default to duration)
*/
var updateHoverState = function(dropZone, hovered, count) {
if (typeof count === 'undefined') {
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -228,8 +228,8 @@ const updateButtonTitle = (button, ascending) => {
* @method updateSortOrder
* @param {HTMLElement} fileArea the Dom container for the itemlist
* @param {Array} itemList Nodelist of Dom elements
* @param {String} attribute, the attribut to sort on
* @param {Bool} ascending, Sort Ascending
* @param {String} attribute the attribut to sort on
* @param {Bool} ascending Sort Ascending
*/
const updateSortOrder = (fileArea, itemList, attribute, ascending) => {
const sortList = [].slice.call(itemList).sort(function(a, b) {
@@ -1 +1 @@
{"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":"8RA0BA,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 * @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"}
{"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":"8RA0BA,uD,mVAciC,QAApBA,CAAAA,iBAAoB,SAAa,iBAAW,OAAX,yBAAb,C,CAa1B,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 * @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 {object} args\n * @param {String} args.component\n * @param {Number} args.context\n * @param {String} args.itemname\n * @param {Number} args.userId\n * @param {Element} args.rootNode\n * @returns {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 * @returns {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"}
@@ -30,12 +30,13 @@ import {invalidResult} from './normalise';
/**
* Fetch the current grade for a user.
*
* @param {String} component
* @param {Number} context
* @param {String} itemname
* @param {Number} userId
* @param {Element} rootNode
* @return {Object}
* @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);
@@ -48,8 +49,7 @@ export const fetchCurrentGrade = (...args) => fetchGrade('point')(...args);
* @param {Number} userId
* @param {Boolean} notifyUser
* @param {Element} rootNode
*
* @return {Object}
* @returns {Object}
*/
export const storeCurrentGrade = async(component, context, itemname, userId, notifyUser, rootNode) => {
const form = rootNode.querySelector('form');
File diff suppressed because one or more lines are too long
@@ -19,7 +19,7 @@
* @module gradingform_guide/comment_chooser
* @copyright 2015 Jun Pataleta <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
*/
define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function($, templates, notification) {
// Private variables and functions.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sources":["../src/utils.js"],"names":["throttle","func","wait","onCooldown","runAgain","run","args","apply","setTimeout","recurse","debounce","timeout","clearTimeout"],"mappings":"mJAoCwB,QAAXA,CAAAA,QAAW,CAACC,CAAD,CAAOC,CAAP,CAAgB,IAChCC,CAAAA,CAAU,GADsB,CAEhCC,CAAQ,CAAG,IAFqB,CAG9BC,CAAG,CAAG,UAAkB,4BAANC,CAAM,uBAANA,CAAM,iBAC1B,GAAiB,IAAb,GAAAF,CAAJ,CAAuB,CAEnBA,CAAQ,GACX,CAHD,IAGO,CAGHA,CAAQ,GACX,CAED,GAAID,CAAJ,CAAgB,CAEZ,MACH,CAEDF,CAAI,CAACM,KAAL,CAAW,IAAX,CAAiBD,CAAjB,EACAH,CAAU,GAAV,CAEAK,UAAU,CAAC,UAAM,CACb,GAAMC,CAAAA,CAAO,CAAGL,CAAhB,CACAD,CAAU,GAAV,CACAC,CAAQ,CAAG,IAAX,CAEA,GAAIK,CAAJ,CAAa,CACTJ,CAAG,CAACC,CAAD,CACN,CACJ,CARS,CAQPJ,CARO,CASb,CA9BmC,CAgCpC,MAAOG,CAAAA,CACV,C,YAYuB,QAAXK,CAAAA,QAAW,CAACT,CAAD,CAAOC,CAAP,CAAgB,CACpC,GAAIS,CAAAA,CAAO,CAAG,IAAd,CACA,MAAO,WAAkB,mCAANL,CAAM,uBAANA,CAAM,iBACrBM,YAAY,CAACD,CAAD,CAAZ,CACAA,CAAO,CAAGH,UAAU,CAAC,UAAM,CACvBP,CAAI,CAACM,KAAL,CAAW,CAAX,CAAiBD,CAAjB,CACH,CAFmB,CAEjBJ,CAFiB,CAGvB,CACJ,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 * Utility functions.\n *\n * @module core/utils\n * @copyright 2019 Ryan Wyllie <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n /**\n * Create a wrapper function to throttle the execution of the given\n * function to at most once every specified period.\n *\n * If the function is attempted to be executed while it's in cooldown\n * (during the wait period) then it'll immediately execute again as\n * soon as the cooldown is over.\n *\n * @method\n * @param {Function} func The function to throttle\n * @param {Number} wait The number of milliseconds to wait between executions\n * @return {Function}\n */\nexport const throttle = (func, wait) => {\n let onCooldown = false;\n let runAgain = null;\n const run = function(...args) {\n if (runAgain === null) {\n // This is the first time the function has been called.\n runAgain = false;\n } else {\n // This function has been called a second time during the wait period\n // so re-run it once the wait period is over.\n runAgain = true;\n }\n\n if (onCooldown) {\n // Function has already run for this wait period.\n return;\n }\n\n func.apply(this, args);\n onCooldown = true;\n\n setTimeout(() => {\n const recurse = runAgain;\n onCooldown = false;\n runAgain = null;\n\n if (recurse) {\n run(args);\n }\n }, wait);\n };\n\n return run;\n};\n\n/**\n * Create a wrapper function to debounce the execution of the given\n * function. Each attempt to execute the function will reset the cooldown\n * period.\n *\n * @method\n * @param {Function} func The function to debounce\n * @param {Number} wait The number of milliseconds to wait after the final attempt to execute\n * @return {Function}\n */\nexport const debounce = (func, wait) => {\n let timeout = null;\n return function(...args) {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n func.apply(this, args);\n }, wait);\n };\n};\n"],"file":"utils.min.js"}
{"version":3,"sources":["../src/utils.js"],"names":["throttle","func","wait","onCooldown","runAgain","run","args","apply","setTimeout","recurse","debounce","timeout","clearTimeout"],"mappings":"mJAqCwB,QAAXA,CAAAA,QAAW,CAACC,CAAD,CAAOC,CAAP,CAAgB,IAChCC,CAAAA,CAAU,GADsB,CAEhCC,CAAQ,CAAG,IAFqB,CAG9BC,CAAG,CAAG,UAAkB,4BAANC,CAAM,uBAANA,CAAM,iBAC1B,GAAiB,IAAb,GAAAF,CAAJ,CAAuB,CAEnBA,CAAQ,GACX,CAHD,IAGO,CAGHA,CAAQ,GACX,CAED,GAAID,CAAJ,CAAgB,CAEZ,MACH,CAEDF,CAAI,CAACM,KAAL,CAAW,IAAX,CAAiBD,CAAjB,EACAH,CAAU,GAAV,CAEAK,UAAU,CAAC,UAAM,CACb,GAAMC,CAAAA,CAAO,CAAGL,CAAhB,CACAD,CAAU,GAAV,CACAC,CAAQ,CAAG,IAAX,CAEA,GAAIK,CAAJ,CAAa,CACTJ,CAAG,CAACC,CAAD,CACN,CACJ,CARS,CAQPJ,CARO,CASb,CA9BmC,CAgCpC,MAAOG,CAAAA,CACV,C,YAYuB,QAAXK,CAAAA,QAAW,CAACT,CAAD,CAAOC,CAAP,CAAgB,CACpC,GAAIS,CAAAA,CAAO,CAAG,IAAd,CACA,MAAO,WAAkB,mCAANL,CAAM,uBAANA,CAAM,iBACrBM,YAAY,CAACD,CAAD,CAAZ,CACAA,CAAO,CAAGH,UAAU,CAAC,UAAM,CACvBP,CAAI,CAACM,KAAL,CAAW,CAAX,CAAiBD,CAAjB,CACH,CAFmB,CAEjBJ,CAFiB,CAGvB,CACJ,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 * Utility functions.\n *\n * @module core/utils\n * @copyright 2019 Ryan Wyllie <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n /**\n * Create a wrapper function to throttle the execution of the given\n *\n * function to at most once every specified period.\n *\n * If the function is attempted to be executed while it's in cooldown\n * (during the wait period) then it'll immediately execute again as\n * soon as the cooldown is over.\n *\n * @method\n * @param {Function} func The function to throttle\n * @param {Number} wait The number of milliseconds to wait between executions\n * @return {Function}\n */\nexport const throttle = (func, wait) => {\n let onCooldown = false;\n let runAgain = null;\n const run = function(...args) {\n if (runAgain === null) {\n // This is the first time the function has been called.\n runAgain = false;\n } else {\n // This function has been called a second time during the wait period\n // so re-run it once the wait period is over.\n runAgain = true;\n }\n\n if (onCooldown) {\n // Function has already run for this wait period.\n return;\n }\n\n func.apply(this, args);\n onCooldown = true;\n\n setTimeout(() => {\n const recurse = runAgain;\n onCooldown = false;\n runAgain = null;\n\n if (recurse) {\n run(args);\n }\n }, wait);\n };\n\n return run;\n};\n\n/**\n * Create a wrapper function to debounce the execution of the given\n * function. Each attempt to execute the function will reset the cooldown\n * period.\n *\n * @method\n * @param {Function} func The function to debounce\n * @param {Number} wait The number of milliseconds to wait after the final attempt to execute\n * @return {Function}\n */\nexport const debounce = (func, wait) => {\n let timeout = null;\n return function(...args) {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n func.apply(this, args);\n }, wait);\n };\n};\n"],"file":"utils.min.js"}
+1 -1
View File
@@ -73,7 +73,7 @@ const registerListenerEvents = (pageType, pageLayout, addBlockUrl) => {
* Method that creates the 'add block' modal.
*
* @method buildAddBlockModal
* @return {Promise} The modal promise (modal's body will be rendered later).
* @returns {Promise} The modal promise (modal's body will be rendered later).
*/
const buildAddBlockModal = () => {
return ModalFactory.create({
-1
View File
@@ -184,7 +184,6 @@ define([
* Make the config config.
*
* @protected
* @param {module:core/chart_axis} axis The axis.
* @return {Object} The axis config.
*/
Output.prototype._makeConfig = function() {
+9 -8
View File
@@ -123,7 +123,8 @@ function($, log, autoScroll, str, ModalFactory, ModalEvents, Notification) {
* Allow to create non-passive touchstart listeners and prevent page scrolling when dragging
* From: https://stackoverflow.com/a/48098097
*
* @type {Object}
* @param {string} eventname
* @returns {object}
*/
var registerNotPassiveListeners = function(eventname) {
return {
@@ -149,13 +150,13 @@ function($, log, autoScroll, str, ModalFactory, ModalEvents, Notification) {
*
* @param {(String|jQuery|Element)} root JQuery/DOM element representing sortable list (i.e. <ul>, <tbody>) or CSS selector
* @param {Object} config Parameters for the list. See defaultParameters above for examples.
* @property {(String|jQuery|Element)} config.targetListSelector target lists, by default same as root
* @property {String} config.moveHandlerSelector CSS selector for a drag handle. By default '[data-drag-type=move]'
* @property {String} config.targetListSelector CSS selector for target lists. By default the same as root
* @property {(Boolean|Function)} config.isHorizontal Set to true if the list is horizontal
* (can also be a callback with list as an argument)
* @property {Boolean} config.autoScroll Engages autoscroll module for automatic vertical scrolling of the
* whole page, by default true
* @param {(String|jQuery|Element)} config.targetListSelector target lists, by default same as root
* @param {String} config.moveHandlerSelector CSS selector for a drag handle. By default '[data-drag-type=move]'
* @param {String} config.listSelector CSS selector for target lists. By default the same as root
* @param {(Boolean|Function)} config.isHorizontal Set to true if the list is horizontal (can also be a callback
* with list as an argument)
* @param {Boolean} config.autoScroll Engages autoscroll module for automatic vertical scrolling of the whole page,
* by default true
*/
var SortableList = function(root, config) {
+13 -12
View File
@@ -22,18 +22,19 @@
*/
/**
* Create a wrapper function to throttle the execution of the given
* function to at most once every specified period.
*
* If the function is attempted to be executed while it's in cooldown
* (during the wait period) then it'll immediately execute again as
* soon as the cooldown is over.
*
* @method
* @param {Function} func The function to throttle
* @param {Number} wait The number of milliseconds to wait between executions
* @return {Function}
*/
* Create a wrapper function to throttle the execution of the given
*
* function to at most once every specified period.
*
* If the function is attempted to be executed while it's in cooldown
* (during the wait period) then it'll immediately execute again as
* soon as the cooldown is over.
*
* @method
* @param {Function} func The function to throttle
* @param {Number} wait The number of milliseconds to wait between executions
* @return {Function}
*/
export const throttle = (func, wait) => {
let onCooldown = false;
let runAgain = null;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+12 -9
View File
@@ -16,7 +16,13 @@
/**
* Display an embedded form, it is only loaded and reloaded inside its container
*
* Example:
*
* @module core_form/dynamicform
* @copyright 2019 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* See also https://docs.moodle.org/dev/Modal_and_AJAX_forms
*
* @example
* import DynamicForm from 'core_form/dynamicform';
*
* const dynamicForm = new DynamicForm(document.querySelector('#mycontainer', 'pluginname\\form\\formname');
@@ -27,11 +33,6 @@
* });
* dynamicForm.load();
*
* See also https://docs.moodle.org/dev/Modal_and_AJAX_forms
*
* @module core_form/dynamicform
* @copyright 2019 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import Ajax from 'core/ajax';
@@ -160,7 +161,8 @@ export default class DynamicForm {
/**
* Add listener for an event
*
* Example:
* @param {array} args
* @example:
* const dynamicForm = new DynamicForm(...);
* dynamicForm.addEventListener(dynamicForm.events.FORM_SUBMITTED, e => {
* e.preventDefault();
@@ -303,8 +305,9 @@ export default class DynamicForm {
/**
* Update form contents
*
* @param {string} html
* @param {string} js
* @param {object} param
* @param {string} param.html
* @param {string} param.js
*/
updateForm({html, js}) {
Templates.replaceNodeContents(this.container, html, js);
+8 -7
View File
@@ -87,13 +87,13 @@ export default class ModalForm {
* Shows the required form inside a modal dialogue
*
* @param {Object} config parameters for the form and modal dialogue:
* @property {String} config.formClass PHP class name that handles the form (should extend \core_form\modal )
* @property {Object} config.modalConfig modal config - title, type, etc.
* @paramy {String} config.formClass PHP class name that handles the form (should extend \core_form\modal )
* @paramy {Object} config.modalConfig modal config - title, type, etc.
* Default: {removeOnClose: true, type: ModalFactory.types.SAVE_CANCEL}
* @property {Object} config.args Arguments for the initial form rendering (for example, id of the edited entity)
* @property {String} config.saveButtonText the text to display on the Modal "Save" button (optional)
* @property {String} config.saveButtonClasses additional CSS classes for the Modal "Save" button
* @property {HTMLElement} config.returnFocus element to return focus to after the dialogue is closed
* @paramy {Object} config.args Arguments for the initial form rendering (for example, id of the edited entity)
* @paramy {String} config.saveButtonText the text to display on the Modal "Save" button (optional)
* @paramy {String} config.saveButtonClasses additional CSS classes for the Modal "Save" button
* @paramy {HTMLElement} config.returnFocus element to return focus to after the dialogue is closed
*/
constructor(config) {
this.modal = null;
@@ -211,7 +211,8 @@ export default class ModalForm {
/**
* Add listener for an event
*
* Example:
* @param {array} args
* @example:
* const modalForm = new ModalForm(...);
* dynamicForm.addEventListener(modalForm.events.FORM_SUBMITTED, e => {
* window.console.log(e.detail);
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
{"version":3,"sources":["../src/message_drawer_helper.js"],"names":["define","PubSub","MessageDrawerEvents","createConversationWithUser","args","publish","CREATE_CONVERSATION_WITH_USER","hide","HIDE","show","SHOW","showConversation","SHOW_CONVERSATION","showSettings","SHOW_SETTINGS"],"mappings":"AAsBAA,OAAM,sCACN,CACI,aADJ,CAEI,oCAFJ,CADM,CAKN,SACIC,CADJ,CAEIC,CAFJ,CAGE,CAyCE,MAAO,CACHC,0BAA0B,CAnCG,QAA7BA,CAAAA,0BAA6B,CAASC,CAAT,CAAe,CAC5CH,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACI,6BAAnC,CAAkEF,CAAlE,CACH,CAgCM,CAEHG,IAAI,CA7BG,QAAPA,CAAAA,IAAO,EAAW,CAClBN,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACM,IAAnC,CACH,CAyBM,CAGHC,IAAI,CAvBG,QAAPA,CAAAA,IAAO,EAAW,CAClBR,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACQ,IAAnC,CACH,CAkBM,CAIHC,gBAAgB,CAfG,QAAnBA,CAAAA,gBAAmB,CAASP,CAAT,CAAe,CAClCH,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACU,iBAAnC,CAAsDR,CAAtD,CACH,CASM,CAKHS,YAAY,CATG,QAAfA,CAAAA,YAAe,EAAW,CAC1BZ,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACY,aAAnC,CACH,CAEM,CAOV,CAxDK,CAAN","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 * Provides some helper functions to trigger actions in the message drawer.\n *\n * @module core_message/message_drawer_helper\n * @copyright 2018 Ryan Wyllie <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(\n[\n 'core/pubsub',\n 'core_message/message_drawer_events'\n],\nfunction(\n PubSub,\n MessageDrawerEvents\n) {\n\n /**\n * Trigger an event to create a new conversation in the message drawer.\n *\n * @param {Number} userId The user id to start a conversation.\n */\n var createConversationWithUser = function(args) {\n PubSub.publish(MessageDrawerEvents.CREATE_CONVERSATION_WITH_USER, args);\n };\n\n /**\n * Trigger an event to hide the message drawer.\n */\n var hide = function() {\n PubSub.publish(MessageDrawerEvents.HIDE);\n };\n\n /**\n * Trigger an event to show the message drawer.\n */\n var show = function() {\n PubSub.publish(MessageDrawerEvents.SHOW);\n };\n\n /**\n * Trigger an event to show the given conversation.\n *\n * @param {int} conversationId Id for the conversation to show.\n */\n var showConversation = function(args) {\n PubSub.publish(MessageDrawerEvents.SHOW_CONVERSATION, args);\n };\n\n /**\n * Trigger an event to show messaging settings.\n */\n var showSettings = function() {\n PubSub.publish(MessageDrawerEvents.SHOW_SETTINGS);\n };\n\n return {\n createConversationWithUser: createConversationWithUser,\n hide: hide,\n show: show,\n showConversation: showConversation,\n showSettings: showSettings\n };\n});\n"],"file":"message_drawer_helper.min.js"}
{"version":3,"sources":["../src/message_drawer_helper.js"],"names":["define","PubSub","MessageDrawerEvents","createConversationWithUser","args","publish","CREATE_CONVERSATION_WITH_USER","hide","HIDE","show","SHOW","showConversation","SHOW_CONVERSATION","showSettings","SHOW_SETTINGS"],"mappings":"AAsBAA,OAAM,sCACN,CACI,aADJ,CAEI,oCAFJ,CADM,CAKN,SACIC,CADJ,CAEIC,CAFJ,CAGE,CA2CE,MAAO,CACHC,0BAA0B,CApCG,QAA7BA,CAAAA,0BAA6B,CAASC,CAAT,CAAe,CAC5CH,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACI,6BAAnC,CAAkEF,CAAlE,CACH,CAiCM,CAEHG,IAAI,CA9BG,QAAPA,CAAAA,IAAO,EAAW,CAClBN,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACM,IAAnC,CACH,CA0BM,CAGHC,IAAI,CAxBG,QAAPA,CAAAA,IAAO,EAAW,CAClBR,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACQ,IAAnC,CACH,CAmBM,CAIHC,gBAAgB,CAfG,QAAnBA,CAAAA,gBAAmB,CAASP,CAAT,CAAe,CAClCH,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACU,iBAAnC,CAAsDR,CAAtD,CACH,CASM,CAKHS,YAAY,CATG,QAAfA,CAAAA,YAAe,EAAW,CAC1BZ,CAAM,CAACI,OAAP,CAAeH,CAAmB,CAACY,aAAnC,CACH,CAEM,CAOV,CA1DK,CAAN","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 * Provides some helper functions to trigger actions in the message drawer.\n *\n * @module core_message/message_drawer_helper\n * @copyright 2018 Ryan Wyllie <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(\n[\n 'core/pubsub',\n 'core_message/message_drawer_events'\n],\nfunction(\n PubSub,\n MessageDrawerEvents\n) {\n\n /**\n * Trigger an event to create a new conversation in the message drawer.\n *\n * @param {object} args\n * @param {Number} args.userId The user id to start a conversation.\n */\n var createConversationWithUser = function(args) {\n PubSub.publish(MessageDrawerEvents.CREATE_CONVERSATION_WITH_USER, args);\n };\n\n /**\n * Trigger an event to hide the message drawer.\n */\n var hide = function() {\n PubSub.publish(MessageDrawerEvents.HIDE);\n };\n\n /**\n * Trigger an event to show the message drawer.\n */\n var show = function() {\n PubSub.publish(MessageDrawerEvents.SHOW);\n };\n\n /**\n * Trigger an event to show the given conversation.\n *\n * @param {object} args\n * @param {int} args.conversationId Id for the conversation to show.\n */\n var showConversation = function(args) {\n PubSub.publish(MessageDrawerEvents.SHOW_CONVERSATION, args);\n };\n\n /**\n * Trigger an event to show messaging settings.\n */\n var showSettings = function() {\n PubSub.publish(MessageDrawerEvents.SHOW_SETTINGS);\n };\n\n return {\n createConversationWithUser: createConversationWithUser,\n hide: hide,\n show: show,\n showConversation: showConversation,\n showSettings: showSettings\n };\n});\n"],"file":"message_drawer_helper.min.js"}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -84,7 +84,7 @@ function(
* @param {string} selector The route container.
*
* @return {array} elements Found route container objects.
*/
*/
var getParametersForRoute = function(namespace, root, selector) {
var header = root.find(SELECTORS.HEADER_CONTAINER).find(selector);
+4 -2
View File
@@ -33,7 +33,8 @@ function(
/**
* Trigger an event to create a new conversation in the message drawer.
*
* @param {Number} userId The user id to start a conversation.
* @param {object} args
* @param {Number} args.userId The user id to start a conversation.
*/
var createConversationWithUser = function(args) {
PubSub.publish(MessageDrawerEvents.CREATE_CONVERSATION_WITH_USER, args);
@@ -56,7 +57,8 @@ function(
/**
* Trigger an event to show the given conversation.
*
* @param {int} conversationId Id for the conversation to show.
* @param {object} args
* @param {int} args.conversationId Id for the conversation to show.
*/
var showConversation = function(args) {
PubSub.publish(MessageDrawerEvents.SHOW_CONVERSATION, args);
@@ -351,9 +351,9 @@ function(
/**
* Build a patch for this conversation.
*
* @param {Object} state, The current state of this conversation.
* @param {Object} newState, The new state of this conversation.
* @return {Object} Patch with days and messsages for each day.
* @param {Object} state The current state of this conversation.
* @param {Object} newState The new state of this conversation.
* @returns {Object} Patch with days and messsages for each day.
*/
var buildConversationPatch = function(state, newState) {
var diff = diffArrays(state.messages, newState.messages, isMessageEqual);
@@ -1401,7 +1401,7 @@ function(
* @param {Object} header The header container element.
* @param {Object} body The body container element.
* @param {Object} footer The footer container element.
* @param {Bool} isFavourite is this conversation a favourite.
* @param {Bool} state is this conversation a favourite.
*/
var renderIsFavourite = function(header, body, footer, state) {
var favouriteIcon = header.find(SELECTORS.FAVOURITE_ICON_CONTAINER);
@@ -513,6 +513,7 @@ define(['jquery'], function($) {
*
* @param {Object} state Current state.
* @param {Array} messageIds Messages to delete.
* @param {string} errorMessage
* @return {Object} New state with array of pending delete message ids.
*/
var setMessagesSendFailById = function(state, messageIds, errorMessage) {
+1 -1
View File
@@ -40,7 +40,7 @@ function(
/**
* Toggle the message drawer visibility.
*
* @param {String} button The button id for the popover.
* @param {String} buttonid The button id for the popover.
*/
var toggleMessageDrawerVisibility = function(buttonid) {
PubSub.publish(MessageDrawerEvents.TOGGLE_VISIBILITY, buttonid);
+1
View File
@@ -763,6 +763,7 @@ define(
* @param {int} limit Limit for results
* @param {int} offset Offset for results
* @param {bool|null} favourites If favourites should be included or not
* @param {bool} mergeself
* @return {object} jQuery promise
*/
var getConversations = function(
@@ -92,12 +92,12 @@ define(['jquery',
};
/**
* Update the disable all notifications user property in the DOM and
* send a request to update on the server.
*
* @method toggleDisableAllStatus
* @return {Promise}
*/
* Update the disable all notifications user property in the DOM and
* send a request to update on the server.
*
* @method toggleDisableAllStatus
* @return {Promise}
*/
PreferencesController.prototype.toggleDisableAllStatus = function() {
var checkbox = $(SELECTORS.DISABLE_NOTIFICATIONS);
var container = $(SELECTORS.DISABLE_NOTIFICATIONS_CONTAINER);
@@ -132,10 +132,10 @@ define(['jquery',
};
/**
* Set up all of the event listeners for the PreferencesController.
*
* @method registerEventListeners
*/
* Set up all of the event listeners for the PreferencesController.
*
* @method registerEventListeners
*/
PreferencesController.prototype.registerEventListeners = function() {
var disabledNotificationsElement = $(SELECTORS.DISABLE_NOTIFICATIONS);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-2
View File
@@ -222,7 +222,6 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
*
* @private
* @method _filterChanged
* @param {Event} event
*/
GradingNavigation.prototype._filterChanged = function() {
// There are 3 types of filter right now.
@@ -536,7 +535,6 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
*
* @private
* @method _handleChangeUser
* @param {Event} event
*/
GradingNavigation.prototype._handleChangeUser = function() {
var select = this._region.find('[data-action=change-user]');
+1 -1
View File
@@ -143,8 +143,8 @@ define(['jquery', 'core/yui', 'core/notification', 'core/templates', 'core/fragm
* @method _handleFormSubmissionResponse
* @param {Array} formdata - submitted values
* @param {Integer} nextUserId - optional. The id of the user to load after the form is saved.
* @param {Array} response List of errors.
* @param {Boolean} nextUser - optional. If true, switch to next user in the grading list.
* @param {Array} response List of errors.
*/
GradingPanel.prototype._handleFormSubmissionResponse = function(formdata, nextUserId, nextUser, response) {
if (typeof nextUserId === "undefined") {
@@ -27,7 +27,6 @@ define(['jquery', 'mod_assign/grading_events'], function($, GradingEvents) {
* GradingReviewPanel class.
*
* @class mod_assign/grading_review_panel
* @param {String} selector The selector for the page region containing the user navigation.
*/
var GradingReviewPanel = function() {
this._region = $('[data-region="review-panel-content"]');
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -39,6 +39,8 @@ const findGradableNode = node => node.closest(ForumSelectors.expandConversation)
* Show the post in context in a modal.
*
* @param {HTMLElement} rootNode The button that has been clicked
* @param {object} param
* @param {bool} [param.focusOnClose=null]
*/
const showPostInContext = async(rootNode, {
focusOnClose = null,
+4
View File
@@ -112,6 +112,8 @@ const discussionPostMapper = (discussion) => {
* Launch the Grader.
*
* @param {HTMLElement} rootNode the root HTML element describing what is to be graded
* @param {object} param
* @param {bool} [param.focusOnClose=null]
*/
const launchWholeForumGrading = async(rootNode, {
focusOnClose = null,
@@ -148,6 +150,8 @@ const launchWholeForumGrading = async(rootNode, {
* Launch the Grader.
*
* @param {HTMLElement} rootNode the root HTML element describing what is to be graded
* @param {object} param
* @param {bool} [param.focusOnClose=null]
*/
const launchViewGrading = async(rootNode, {
focusOnClose = null,
+9 -1
View File
@@ -389,7 +389,13 @@ 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 {Object} Preferences for the launch function
* @param {Object} preferences Preferences for the launch function
* @param {Number} preferences.initialUserId
* @param {string} preferences.moduleName
* @param {string} preferences.courseName
* @param {string} preferences.courseUrl
* @param {boolean} preferences.sendStudentNotifications
* @param {null|HTMLElement} preferences.focusOnClose
*/
export const launch = async(getListOfUsers, getContentForUser, getGradeForUser, setGradeForUser, {
initialUserId = null,
@@ -475,6 +481,8 @@ export const launch = async(getListOfUsers, getContentForUser, getGradeForUser,
* @param {Function} getGradeForUser A function get the grade details for a specific user
* @param {Number} userid The ID of a specific user
* @param {String} moduleName the name of the module
* @param {object} param
* @param {null|HTMLElement} param.focusOnClose
*/
export const view = async(getGradeForUser, userid, moduleName, {
focusOnClose = null,
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -92,8 +92,8 @@ define(['jquery', 'core/yui'], function($, Y) {
/**
* Event handler for the quiz start attempt button.
* @param {Event} e the event being responded to
* @param {Object} popupoptions
* @param {Event} e the event being responded to
* @param {Object} popupoptions
*/
launchQuizPopup: function(e, popupoptions) {
e.halt();
+129
View File
@@ -2456,6 +2456,40 @@
"to-fast-properties": "^2.0.0"
}
},
"@es-joy/jsdoccomment": {
"version": "0.10.8",
"resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.10.8.tgz",
"integrity": "sha512-3P1JiGL4xaR9PoTKUHa2N/LKwa2/eUdRqGwijMWWgBqbFEqJUVpmaOi2TcjcemrsRMgFLBzQCK4ToPhrSVDiFQ==",
"dev": true,
"requires": {
"comment-parser": "1.2.4",
"esquery": "^1.4.0",
"jsdoc-type-pratt-parser": "1.1.1"
},
"dependencies": {
"esquery": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz",
"integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==",
"dev": true,
"requires": {
"estraverse": "^5.1.0"
}
},
"estraverse": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
"integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
"dev": true
},
"jsdoc-type-pratt-parser": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-1.1.1.tgz",
"integrity": "sha512-uelRmpghNwPBuZScwgBG/OzodaFk5RbO5xaivBdsAY70icWfShwZ7PCMO0x1zSkOa8T1FzHThmrdoyg/0AwV5g==",
"dev": true
}
}
},
"@nodelib/fs.scandir": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz",
@@ -3675,6 +3709,12 @@
"integrity": "sha512-JrDGPAKjMGSP1G0DUoaceEJ3DZgAfr/q6X7FVk4+U5KxUSKviYGM2k6zWkfyyBHy5rAtzgYJFa1ro2O9PtoxwQ==",
"dev": true
},
"comment-parser": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.2.4.tgz",
"integrity": "sha512-pm0b+qv+CkWNriSTMsfnjChF9kH0kxz55y44Wo5le9qLxMj5xDQAaEd9ZN1ovSuk9CsrncWaFwgpOMg7ClJwkw==",
"dev": true
},
"common-sequence": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/common-sequence/-/common-sequence-2.0.2.tgz",
@@ -4334,6 +4374,83 @@
"eslint-rule-composer": "^0.3.0"
}
},
"eslint-plugin-jsdoc": {
"version": "36.1.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-36.1.1.tgz",
"integrity": "sha512-nuLDvH1EJaKx0PCa9oeQIxH6pACIhZd1gkalTUxZbaxxwokjs7TplqY0Q8Ew3CoZaf5aowm0g/Z3JGHCatt+gQ==",
"dev": true,
"requires": {
"@es-joy/jsdoccomment": "0.10.8",
"comment-parser": "1.2.4",
"debug": "^4.3.2",
"esquery": "^1.4.0",
"jsdoc-type-pratt-parser": "^1.1.1",
"lodash": "^4.17.21",
"regextras": "^0.8.0",
"semver": "^7.3.5",
"spdx-expression-parse": "^3.0.1"
},
"dependencies": {
"debug": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
"dev": true,
"requires": {
"ms": "2.1.2"
}
},
"esquery": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz",
"integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==",
"dev": true,
"requires": {
"estraverse": "^5.1.0"
}
},
"estraverse": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
"integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
"dev": true
},
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"requires": {
"yallist": "^4.0.0"
}
},
"semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
}
},
"spdx-expression-parse": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
"integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
"dev": true,
"requires": {
"spdx-exceptions": "^2.1.0",
"spdx-license-ids": "^3.0.0"
}
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
}
}
},
"eslint-plugin-promise": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz",
@@ -6319,6 +6436,12 @@
"walk-back": "^5.0.0"
}
},
"jsdoc-type-pratt-parser": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-1.2.0.tgz",
"integrity": "sha512-4STjeF14jp4bqha44nKMY1OUI6d2/g6uclHWUCZ7B4DoLzaB5bmpTkQrpqU+vSVzMD0LsKAOskcnI3I3VfIpmg==",
"dev": true
},
"jsesc": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
@@ -8097,6 +8220,12 @@
"unicode-match-property-value-ecmascript": "^1.2.0"
}
},
"regextras": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/regextras/-/regextras-0.8.0.tgz",
"integrity": "sha512-k519uI04Z3SaY0fLX843MRXnDeG2+vHOFsyhiPZvNLe7r8rD2YNRjq4BQLZZ0oAr2NrtvZlICsXysGNFPGa3CQ==",
"dev": true
},
"regjsgen": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.1.tgz",
+1
View File
@@ -18,6 +18,7 @@
"docdash": "^1.2.0",
"eslint": "6.8.0",
"eslint-plugin-babel": "5.3.0",
"eslint-plugin-jsdoc": "^36.1.1",
"eslint-plugin-promise": "4.2.1",
"fb-watchman": "2.0.1",
"gherkin-lint": "^4.2.2",
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sources":["../src/repository.js"],"names":["define","$","Ajax","submitTagCreateUpdateForm","questionId","contextId","formdata","call","methodname","args","questionid","contextid"],"mappings":"AAsBAA,OAAM,4BAAC,CAAC,QAAD,CAAW,WAAX,CAAD,CAA0B,SAASC,CAAT,CAAYC,CAAZ,CAAkB,CAsB9C,MAAO,CACHC,yBAAyB,CAdG,QAA5BA,CAAAA,yBAA4B,CAASC,CAAT,CAAqBC,CAArB,CAAgCC,CAAhC,CAA0C,CAUtE,MAAOJ,CAAAA,CAAI,CAACK,IAAL,CAAU,CATH,CACVC,UAAU,CAAE,gCADF,CAEVC,IAAI,CAAE,CACFC,UAAU,CAAEN,CADV,CAEFO,SAAS,CAAEN,CAFT,CAGFC,QAAQ,CAAEA,CAHR,CAFI,CASG,CAAV,EAAqB,CAArB,CACV,CAEM,CAGV,CAzBK,CAAN","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 * A javascript module to handle question ajax actions.\n *\n * @module core_question/repository\n * @copyright 2017 Simey Lameze <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax'], function($, Ajax) {\n\n /**\n * Submit the form data for the question tags form.\n *\n * @method submitTagCreateUpdateForm\n * @param {string} formdata The URL encoded values from the form\n * @return {promise}\n */\n var submitTagCreateUpdateForm = function(questionId, contextId, formdata) {\n var request = {\n methodname: 'core_question_submit_tags_form',\n args: {\n questionid: questionId,\n contextid: contextId,\n formdata: formdata\n }\n };\n\n return Ajax.call([request])[0];\n };\n\n return {\n submitTagCreateUpdateForm: submitTagCreateUpdateForm\n };\n});\n"],"file":"repository.min.js"}
{"version":3,"sources":["../src/repository.js"],"names":["define","$","Ajax","submitTagCreateUpdateForm","questionId","contextId","formdata","call","methodname","args","questionid","contextid"],"mappings":"AAsBAA,OAAM,4BAAC,CAAC,QAAD,CAAW,WAAX,CAAD,CAA0B,SAASC,CAAT,CAAYC,CAAZ,CAAkB,CAwB9C,MAAO,CACHC,yBAAyB,CAdG,QAA5BA,CAAAA,yBAA4B,CAASC,CAAT,CAAqBC,CAArB,CAAgCC,CAAhC,CAA0C,CAUtE,MAAOJ,CAAAA,CAAI,CAACK,IAAL,CAAU,CATH,CACVC,UAAU,CAAE,gCADF,CAEVC,IAAI,CAAE,CACFC,UAAU,CAAEN,CADV,CAEFO,SAAS,CAAEN,CAFT,CAGFC,QAAQ,CAAEA,CAHR,CAFI,CASG,CAAV,EAAqB,CAArB,CACV,CAEM,CAGV,CA3BK,CAAN","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 * A javascript module to handle question ajax actions.\n *\n * @module core_question/repository\n * @copyright 2017 Simey Lameze <[email protected]>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax'], function($, Ajax) {\n\n /**\n * Submit the form data for the question tags form.\n *\n * @method submitTagCreateUpdateForm\n * @param {number} questionId\n * @param {number} contextId\n * @param {string} formdata The URL encoded values from the form\n * @returns {promise}\n */\n var submitTagCreateUpdateForm = function(questionId, contextId, formdata) {\n var request = {\n methodname: 'core_question_submit_tags_form',\n args: {\n questionid: questionId,\n contextid: contextId,\n formdata: formdata\n }\n };\n\n return Ajax.call([request])[0];\n };\n\n return {\n submitTagCreateUpdateForm: submitTagCreateUpdateForm\n };\n});\n"],"file":"repository.min.js"}
+3 -1
View File
@@ -26,8 +26,10 @@ define(['jquery', 'core/ajax'], function($, Ajax) {
* Submit the form data for the question tags form.
*
* @method submitTagCreateUpdateForm
* @param {number} questionId
* @param {number} contextId
* @param {string} formdata The URL encoded values from the form
* @return {promise}
* @returns {promise}
*/
var submitTagCreateUpdateForm = function(questionId, contextId, formdata) {
var request = {
File diff suppressed because one or more lines are too long
@@ -108,7 +108,7 @@ define(['jquery', 'core/custom_interaction_events'], function($, CustomEvents) {
/**
* Initialise clear choice module.
*
* @param {string} root The question outer div prefix.
* @param {string} fieldPrefix The "Clear choice" div prefix.
*/
File diff suppressed because one or more lines are too long
+3 -4
View File
@@ -94,7 +94,7 @@ define(['jquery', 'core/str', 'core/log', 'core/modal_factory', 'core/modal_even
* @method showSendMessage
* @private
* @param {Object} users Prediction id to user id mapping.
* @return {Promise}
* @returns {Promise}
*/
MessageUsers.prototype.showSendMessage = function(users) {
@@ -144,8 +144,7 @@ define(['jquery', 'core/str', 'core/log', 'core/modal_factory', 'core/modal_even
* @method submitSendMessage
* @private
* @param {Object} users Prediction id to user id mapping.
* @param {Event} e Form submission event.
* @return {Promise}
* @returns {Promise}
*/
MessageUsers.prototype.submitSendMessage = function(users) {
@@ -198,7 +197,7 @@ define(['jquery', 'core/str', 'core/log', 'core/modal_factory', 'core/modal_even
* @method init
* @param {String} rootNode
* @param {String} actionName
* @return {MessageUsers}
* @returns {MessageUsers}
*/
'init': function(rootNode, actionName) {
return new MessageUsers(rootNode, actionName);
File diff suppressed because one or more lines are too long
-2
View File
@@ -37,8 +37,6 @@ define(['jquery', 'core/custom_interaction_events', 'core/log', 'core/pubsub', '
/**
* Constructor for the Drawer.
*
* @param {object} root The root jQuery element for the modal
*/
var Drawer = function() {
File diff suppressed because one or more lines are too long
+3 -2
View File
@@ -356,8 +356,9 @@ const getBody = (contextId, ueid, formdata = null) => Fragment.loadFragment(
/**
* Initialise the statu field handler.
*
* @param {Number} contextid
* @param {Number} uniqueid
* @param {object} param
* @param {Number} param.contextid
* @param {Number} param.uniqueid
*/
export const init = ({contextid, uniqueid}) => {
registerEventListeners(contextid, uniqueid);