Merge branch 'MDL-54939-master' of git://github.com/danpoltawski/moodle
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
'no-unreachable': 'warn',
|
||||
'no-unsafe-finally': 'error',
|
||||
'use-isnan': 'error',
|
||||
'valid-jsdoc': ['warn', { 'requireReturn': false }],
|
||||
'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
|
||||
'valid-typeof': 'error',
|
||||
|
||||
// === Best Practices ===
|
||||
@@ -115,7 +115,7 @@
|
||||
'max-params': 'off',
|
||||
'max-statements': 'off',
|
||||
'max-statements-per-line': 'off',
|
||||
'new-cap': 'warn',
|
||||
'new-cap': ['warn', { 'properties': false }],
|
||||
'new-parens': 'warn',
|
||||
'newline-after-var': 'off',
|
||||
'newline-before-return': 'off',
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -138,6 +138,7 @@ define(['jquery',
|
||||
* Find a node in the dialogue.
|
||||
*
|
||||
* @param {String} selector
|
||||
* @return {JQuery} The node
|
||||
* @method _find
|
||||
*/
|
||||
ActionSelector.prototype._find = function(selector) {
|
||||
@@ -170,8 +171,8 @@ define(['jquery',
|
||||
for (var i in self._actions) {
|
||||
choices.push(self._actions[i]);
|
||||
}
|
||||
var content = {'message': self._message, 'choices' : choices,
|
||||
'confirm' : self._confirm, 'cancel' : self._cancel};
|
||||
var content = {'message': self._message, 'choices': choices,
|
||||
'confirm': self._confirm, 'cancel': self._cancel};
|
||||
|
||||
return Templates.render('tool_lp/action_selector', content);
|
||||
};
|
||||
|
||||
@@ -35,6 +35,7 @@ define(['jquery',
|
||||
*
|
||||
* @param {Number} itemid
|
||||
* @param {String} itemtype
|
||||
* @param {Number} pagectxid
|
||||
*/
|
||||
var competencies = function(itemid, itemtype, pagectxid) {
|
||||
this.itemid = itemid;
|
||||
@@ -106,7 +107,7 @@ define(['jquery',
|
||||
}
|
||||
]);
|
||||
} else {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
requests[0].fail(notification.exception);
|
||||
@@ -276,7 +277,7 @@ define(['jquery',
|
||||
{ key: message, component: 'tool_lp', param: competency.shortname },
|
||||
{ key: 'confirm', component: 'moodle' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Unlink the competency X from the course?
|
||||
@@ -300,7 +301,7 @@ define(['jquery',
|
||||
|
||||
if (localthis.itemtype == 'course') {
|
||||
// Course completion rule handling.
|
||||
$('[data-region="coursecompetenciespage"]').on('change', 'select[data-field="ruleoutcome"]', function(e){
|
||||
$('[data-region="coursecompetenciespage"]').on('change', 'select[data-field="ruleoutcome"]', function(e) {
|
||||
var requests = [];
|
||||
var pagerender = 'tool_lp/course_competencies_page';
|
||||
var pageregion = 'coursecompetenciespage';
|
||||
|
||||
@@ -64,7 +64,7 @@ define(['jquery',
|
||||
* Get the string for an outcome.
|
||||
*
|
||||
* @param {Number} id The outcome code.
|
||||
* @return {Promise Resolved with the string.
|
||||
* @return {Promise} Resolved with the string.
|
||||
* @method getString
|
||||
*/
|
||||
getString: function(id) {
|
||||
|
||||
@@ -26,11 +26,11 @@ define(['jquery'], function($) {
|
||||
/**
|
||||
* CompetencyPlanNavigation
|
||||
*
|
||||
* @param {String} The selector of the competency element.
|
||||
* @param {String} The base url for the page (no params).
|
||||
* @param {Number} The user id
|
||||
* @param {Number} The competency id
|
||||
* @param {Number} The plan id
|
||||
* @param {String} competencySelector The selector of the competency element.
|
||||
* @param {String} baseUrl The base url for the page (no params).
|
||||
* @param {Number} userId The user id
|
||||
* @param {Number} competencyId The competency id
|
||||
* @param {Number} planId The plan id
|
||||
*/
|
||||
var CompetencyPlanNavigation = function(competencySelector, baseUrl, userId, competencyId, planId) {
|
||||
this._baseUrl = baseUrl;
|
||||
|
||||
@@ -71,6 +71,7 @@ define(['jquery'], function($) {
|
||||
return null;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line valid-jsdoc
|
||||
/**
|
||||
* Return the type of the module.
|
||||
*
|
||||
@@ -152,7 +153,7 @@ define(['jquery'], function($) {
|
||||
* Trigger an event.
|
||||
*
|
||||
* @param {String} type The type of event.
|
||||
* @param {Object} The data to pass to the listeners.
|
||||
* @param {Object} data The data to pass to the listeners.
|
||||
* @method _trigger
|
||||
* @protected
|
||||
*/
|
||||
|
||||
@@ -66,7 +66,7 @@ define(['jquery',
|
||||
var parent = $('[data-region="competencyactions"]').data('competency');
|
||||
|
||||
var params = {
|
||||
competencyframeworkid : treeModel.getCompetencyFrameworkId(),
|
||||
competencyframeworkid: treeModel.getCompetencyFrameworkId(),
|
||||
pagecontextid: pageContextId
|
||||
};
|
||||
|
||||
@@ -86,7 +86,7 @@ define(['jquery',
|
||||
{ key: 'addingcompetencywillresetparentrule', component: 'tool_lp', param: parent.shortname },
|
||||
{ key: 'yes', component: 'core' },
|
||||
{ key: 'no', component: 'core' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0],
|
||||
strings[1],
|
||||
@@ -157,7 +157,7 @@ define(['jquery',
|
||||
{ key: confirmMessage, component: 'tool_lp' },
|
||||
{ key: 'yes', component: 'moodle' },
|
||||
{ key: 'no', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Delete competency X?
|
||||
@@ -187,8 +187,13 @@ define(['jquery',
|
||||
});
|
||||
treeRoot.show();
|
||||
|
||||
body.on('click', '[data-action="move"]', function() { popup.close(); confirmMove(); });
|
||||
body.on('click', '[data-action="cancel"]', function() { popup.close(); });
|
||||
body.on('click', '[data-action="move"]', function() {
|
||||
popup.close();
|
||||
confirmMove();
|
||||
});
|
||||
body.on('click', '[data-action="cancel"]', function() {
|
||||
popup.close();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -213,6 +218,7 @@ define(['jquery',
|
||||
|
||||
/**
|
||||
* A node was chosen and "Move" was selected from the menu. Open a popup to select the target.
|
||||
* @param {Event} e
|
||||
* @method moveHandler
|
||||
*/
|
||||
var moveHandler = function(e) {
|
||||
@@ -230,7 +236,7 @@ define(['jquery',
|
||||
competencyframeworkid: competency.competencyframeworkid,
|
||||
searchtext: ''
|
||||
}
|
||||
},{
|
||||
}, {
|
||||
methodname: 'core_competency_read_competency_framework',
|
||||
args: {
|
||||
id: competency.competencyframeworkid
|
||||
@@ -257,7 +263,7 @@ define(['jquery',
|
||||
{ key: 'movecompetency', component: 'tool_lp', param: competency.shortname },
|
||||
{ key: 'move', component: 'tool_lp' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
|
||||
var context = {
|
||||
framework: framework,
|
||||
@@ -288,8 +294,8 @@ define(['jquery',
|
||||
var competency = $('[data-region="competencyactions"]').data('competency');
|
||||
|
||||
var params = {
|
||||
competencyframeworkid : treeModel.getCompetencyFrameworkId(),
|
||||
id : competency.id,
|
||||
competencyframeworkid: treeModel.getCompetencyFrameworkId(),
|
||||
id: competency.id,
|
||||
parentid: competency.parentid,
|
||||
pagecontextid: pageContextId
|
||||
};
|
||||
@@ -300,6 +306,7 @@ define(['jquery',
|
||||
|
||||
/**
|
||||
* Re-render the page with the latest data.
|
||||
* @param {Object} context
|
||||
* @method reloadPage
|
||||
*/
|
||||
var reloadPage = function(context) {
|
||||
@@ -313,6 +320,7 @@ define(['jquery',
|
||||
|
||||
/**
|
||||
* Perform a search and render the page with the new search results.
|
||||
* @param {Event} e
|
||||
* @method updateSearchHandler
|
||||
*/
|
||||
var updateSearchHandler = function(e) {
|
||||
@@ -381,7 +389,7 @@ define(['jquery',
|
||||
courses: courses
|
||||
};
|
||||
templates.render('tool_lp/linked_courses_summary', context).done(function(html) {
|
||||
str.get_string('linkedcourses', 'tool_lp').done(function (linkedcourses) {
|
||||
str.get_string('linkedcourses', 'tool_lp').done(function(linkedcourses) {
|
||||
new Dialogue(
|
||||
linkedcourses, // Title.
|
||||
html, // The linked courses.
|
||||
@@ -413,7 +421,7 @@ define(['jquery',
|
||||
});
|
||||
});
|
||||
|
||||
calls.push( {
|
||||
calls.push({
|
||||
methodname: 'tool_lp_data_for_related_competencies_section',
|
||||
args: { competencyid: relatedTarget.id }
|
||||
});
|
||||
@@ -486,7 +494,7 @@ define(['jquery',
|
||||
str.get_strings([
|
||||
{ key: 'competencycannotbedeleted', component: 'tool_lp', param: competency.shortname },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.alert(
|
||||
null,
|
||||
strings[0]
|
||||
@@ -514,7 +522,7 @@ define(['jquery',
|
||||
{ key: confirmMessage, component: 'tool_lp', param: competency.shortname },
|
||||
{ key: 'delete', component: 'moodle' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Delete competency X?
|
||||
@@ -528,6 +536,7 @@ define(['jquery',
|
||||
/**
|
||||
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
|
||||
* @method dragStart
|
||||
* @param {Event} e
|
||||
*/
|
||||
var dragStart = function(e) {
|
||||
e.originalEvent.dataTransfer.setData('text', $(e.target).parent().data('id'));
|
||||
@@ -536,6 +545,7 @@ define(['jquery',
|
||||
/**
|
||||
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
|
||||
* @method allowDrop
|
||||
* @param {Event} e
|
||||
*/
|
||||
var allowDrop = function(e) {
|
||||
e.originalEvent.dataTransfer.dropEffect = 'move';
|
||||
@@ -545,6 +555,7 @@ define(['jquery',
|
||||
/**
|
||||
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
|
||||
* @method dragEnter
|
||||
* @param {Event} e
|
||||
*/
|
||||
var dragEnter = function(e) {
|
||||
e.preventDefault();
|
||||
@@ -554,6 +565,7 @@ define(['jquery',
|
||||
/**
|
||||
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
|
||||
* @method dragLeave
|
||||
* @param {Event} e
|
||||
*/
|
||||
var dragLeave = function(e) {
|
||||
e.preventDefault();
|
||||
@@ -563,6 +575,7 @@ define(['jquery',
|
||||
/**
|
||||
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
|
||||
* @method dropOver
|
||||
* @param {Event} e
|
||||
*/
|
||||
var dropOver = function(e) {
|
||||
e.preventDefault();
|
||||
@@ -614,7 +627,7 @@ define(['jquery',
|
||||
/**
|
||||
* Log the competency viewed event.
|
||||
*
|
||||
* @param {Object} The competency.
|
||||
* @param {Object} competency The competency.
|
||||
* @method triggerCompetencyViewedEvent
|
||||
*/
|
||||
var triggerCompetencyViewedEvent = function(competency) {
|
||||
@@ -729,6 +742,7 @@ define(['jquery',
|
||||
* @method selectionChanged
|
||||
* @param {Event} evt The event that triggered the selection change.
|
||||
* @param {Object} params The parameters for the event. Contains a list of selected nodes.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
var selectionChanged = function(evt, params) {
|
||||
var node = params.selected,
|
||||
@@ -781,7 +795,7 @@ define(['jquery',
|
||||
* Return the string "Selected <taxonomy>".
|
||||
*
|
||||
* @function parseTaxonomies
|
||||
* @param {String} Comma separated list of taxonomies.
|
||||
* @param {String} taxonomiesstr Comma separated list of taxonomies.
|
||||
* @return {Array} of level => taxonomystr
|
||||
*/
|
||||
var parseTaxonomies = function(taxonomiesstr) {
|
||||
|
||||
@@ -43,12 +43,13 @@ define(['jquery',
|
||||
*
|
||||
*/
|
||||
var Competencydialogue = function() {
|
||||
// Intentionally left empty.
|
||||
};
|
||||
|
||||
/**
|
||||
* Log the competency viewed event.
|
||||
*
|
||||
* @param {Number} The competency ID.
|
||||
* @param {Number} competencyId The competency ID.
|
||||
* @method triggerCompetencyViewedEvent
|
||||
*/
|
||||
Competencydialogue.prototype.triggerCompetencyViewedEvent = function(competencyId) {
|
||||
@@ -112,7 +113,7 @@ define(['jquery',
|
||||
/**
|
||||
* The action on the click event.
|
||||
*
|
||||
* @param {Event} event click
|
||||
* @param {Event} e event click
|
||||
* @method clickEventHandler
|
||||
*/
|
||||
Competencydialogue.prototype.clickEventHandler = function(e) {
|
||||
@@ -135,6 +136,7 @@ define(['jquery',
|
||||
* Get a promise on data competency.
|
||||
*
|
||||
* @param {Number} competencyid
|
||||
* @param {Object} options
|
||||
* @return {Promise} return promise on data request
|
||||
* @method getCompetencyDataPromise
|
||||
*/
|
||||
@@ -160,8 +162,6 @@ define(['jquery',
|
||||
* Initialise the competency dialogue module.
|
||||
*
|
||||
* Only the first call matters.
|
||||
*
|
||||
* @return {Void}
|
||||
*/
|
||||
init: function() {
|
||||
if (typeof instance !== 'undefined') {
|
||||
|
||||
@@ -231,7 +231,10 @@ define(['jquery',
|
||||
competencyframeworkid: frameworkId
|
||||
}}
|
||||
])[0].done(function(competencies) {
|
||||
|
||||
/**
|
||||
* @param {Object} parent
|
||||
* @param {Array} competencies
|
||||
*/
|
||||
function addCompetencyChildren(parent, competencies) {
|
||||
for (var i = 0; i < competencies.length; i++) {
|
||||
if (competencies[i].parentid == parent.id) {
|
||||
@@ -265,6 +268,7 @@ define(['jquery',
|
||||
* Find a node in the dialogue.
|
||||
*
|
||||
* @param {String} selector
|
||||
* @return {JQuery}
|
||||
* @method _find
|
||||
*/
|
||||
Picker.prototype._find = function(selector) {
|
||||
@@ -275,6 +279,7 @@ define(['jquery',
|
||||
* Convenience method to get a framework object.
|
||||
*
|
||||
* @param {Number} fid The framework ID.
|
||||
* @return {Object}
|
||||
* @method _getFramework
|
||||
*/
|
||||
Picker.prototype._getFramework = function(fid) {
|
||||
@@ -437,7 +442,7 @@ define(['jquery',
|
||||
*
|
||||
* This needs to be set after reset/close.
|
||||
*
|
||||
* @params {Number[]} The IDs.
|
||||
* @param {Number[]} ids The IDs.
|
||||
* @method _setDisallowedCompetencyIDs
|
||||
*/
|
||||
Picker.prototype.setDisallowedCompetencyIDs = function(ids) {
|
||||
@@ -448,7 +453,7 @@ define(['jquery',
|
||||
* Trigger an event.
|
||||
*
|
||||
* @param {String} type The type of event.
|
||||
* @param {Object} The data to pass to the listeners.
|
||||
* @param {Object} data The data to pass to the listeners.
|
||||
* @method _reset
|
||||
*/
|
||||
Picker.prototype._trigger = function(type, data) {
|
||||
|
||||
@@ -39,8 +39,8 @@ define(['jquery',
|
||||
/**
|
||||
* Competency picker in plan class.
|
||||
*
|
||||
* @param {Number} userId
|
||||
* @param {Number|false} singlePlan The ID of the plan when limited to one.
|
||||
* @param {String} pageContextIncludes One of 'children', 'parents', 'self'.
|
||||
* @param {Boolean} multiSelect Support multi-select in the tree.
|
||||
*/
|
||||
var Picker = function(userId, singlePlan, multiSelect) {
|
||||
@@ -88,7 +88,7 @@ define(['jquery',
|
||||
* @param {Number} planId The planId.
|
||||
* @param {String} searchText Limit the competencies to those matching the text.
|
||||
* @method _fetchCompetencies
|
||||
* @return {Promise}
|
||||
* @return {Promise} The promise object.
|
||||
*/
|
||||
Picker.prototype._fetchCompetencies = function(planId, searchText) {
|
||||
var self = this;
|
||||
|
||||
@@ -70,7 +70,6 @@ define(['jquery',
|
||||
*
|
||||
* Triggered when a change occured.
|
||||
*
|
||||
* @return {Void}
|
||||
* @method _afterChange
|
||||
* @protected
|
||||
*/
|
||||
@@ -87,9 +86,10 @@ define(['jquery',
|
||||
*
|
||||
* Triggered when a change occured in a specific rule config.
|
||||
*
|
||||
* @return {Void}
|
||||
* @method _afterRuleConfigChange
|
||||
* @protected
|
||||
* @param {Event} e
|
||||
* @param {Rule} rule
|
||||
*/
|
||||
RuleConfig.prototype._afterRuleConfigChange = function(e, rule) {
|
||||
if (rule != this._getRule()) {
|
||||
@@ -102,7 +102,6 @@ define(['jquery',
|
||||
/**
|
||||
* After render hook.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @method _afterRender
|
||||
* @protected
|
||||
*/
|
||||
@@ -181,6 +180,7 @@ define(['jquery',
|
||||
* Find a node in the dialogue.
|
||||
*
|
||||
* @param {String} selector
|
||||
* @return {JQuery}
|
||||
* @method _find
|
||||
* @protected
|
||||
*/
|
||||
@@ -444,7 +444,6 @@ define(['jquery',
|
||||
/**
|
||||
* Set up the instance.
|
||||
*
|
||||
* @return {Void}
|
||||
* @method _setUp
|
||||
* @protected
|
||||
*/
|
||||
@@ -482,7 +481,6 @@ define(['jquery',
|
||||
/**
|
||||
* Called when the user switches outcome.
|
||||
*
|
||||
* @return {Void}
|
||||
* @method _switchedOutcome
|
||||
* @protected
|
||||
*/
|
||||
@@ -507,7 +505,6 @@ define(['jquery',
|
||||
/**
|
||||
* Called when the user switches rule.
|
||||
*
|
||||
* @return {Void}
|
||||
* @method _switchedRule
|
||||
* @protected
|
||||
*/
|
||||
@@ -535,7 +532,7 @@ define(['jquery',
|
||||
* Trigger an event.
|
||||
*
|
||||
* @param {String} type The type of event.
|
||||
* @param {Object} The data to pass to the listeners.
|
||||
* @param {Object} data The data to pass to the listeners.
|
||||
* @method _trigger
|
||||
* @protected
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ define(['jquery',
|
||||
e.preventDefault();
|
||||
|
||||
templates.render('tool_lp/course_competency_settings', context).done(function(html) {
|
||||
str.get_string('configurecoursecompetencysettings', 'tool_lp').done(function (title) {
|
||||
str.get_string('configurecoursecompetencysettings', 'tool_lp').done(function(title) {
|
||||
this._dialogue = new Dialogue(
|
||||
title,
|
||||
html,
|
||||
|
||||
@@ -43,7 +43,7 @@ define(['core/yui'], function(Y) {
|
||||
wide = false;
|
||||
}
|
||||
|
||||
Y.use('moodle-core-notification', 'timers', function () {
|
||||
Y.use('moodle-core-notification', 'timers', function() {
|
||||
var width = '480px';
|
||||
if (wide) {
|
||||
width = '800px';
|
||||
@@ -92,6 +92,7 @@ define(['core/yui'], function(Y) {
|
||||
|
||||
/**
|
||||
* Get content.
|
||||
* @return {node}
|
||||
*/
|
||||
dialogue.prototype.getContent = function() {
|
||||
return this.yuiDialogue.bodyNode.getDOMNode();
|
||||
|
||||
@@ -70,8 +70,8 @@ define(['core/str', 'core/yui'], function(str, Y) {
|
||||
{ key: 'emptydragdropregion', component: 'moodle' },
|
||||
{ key: 'movecontent', component: 'moodle' },
|
||||
{ key: 'tocontent', component: 'moodle' },
|
||||
]).done( function () {
|
||||
Y.use('moodle-tool_lp-dragdrop-reorder', function () {
|
||||
]).done(function() {
|
||||
Y.use('moodle-tool_lp-dragdrop-reorder', function() {
|
||||
|
||||
var context = {
|
||||
callback: callback
|
||||
|
||||
@@ -48,7 +48,7 @@ define(['jquery'], function($) {
|
||||
* Trigger an event.
|
||||
*
|
||||
* @param {String} type The type of event.
|
||||
* @param {Object} The data to pass to the listeners.
|
||||
* @param {Object} data The data to pass to the listeners.
|
||||
* @method _trigger
|
||||
*/
|
||||
Base.prototype._trigger = function(type, data) {
|
||||
|
||||
@@ -35,7 +35,6 @@ define(['jquery',
|
||||
*
|
||||
* @param {String} triggerSelector The node on which the click will happen.
|
||||
* @param {String} containerSelector The parent node that will be removed and contains the evidence ID.
|
||||
* @return {Void}
|
||||
*/
|
||||
var register = function(triggerSelector, containerSelector) {
|
||||
if (typeof selectors[triggerSelector] !== 'undefined') {
|
||||
@@ -62,7 +61,7 @@ define(['jquery',
|
||||
{ key: 'areyousure', component: 'moodle' },
|
||||
{ key: 'delete', component: 'moodle' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
Notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Are you sure?
|
||||
|
||||
@@ -93,17 +93,17 @@ define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str'
|
||||
}
|
||||
}
|
||||
}]);
|
||||
requests[0].done(function (success) {
|
||||
requests[0].done(function(success) {
|
||||
if (success === false) {
|
||||
var req = ajax.call([{
|
||||
methodname: 'core_competency_read_competency_framework',
|
||||
args: { id: frameworkid }
|
||||
}]);
|
||||
req[0].done(function (framework) {
|
||||
req[0].done(function(framework) {
|
||||
str.get_strings([
|
||||
{ key: 'frameworkcannotbedeleted', component: 'tool_lp', param: framework.shortname },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.alert(
|
||||
null,
|
||||
strings[0]
|
||||
@@ -136,7 +136,7 @@ define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str'
|
||||
{ key: 'deletecompetencyframework', component: 'tool_lp', param: framework.shortname },
|
||||
{ key: 'delete', component: 'moodle' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Delete competency framework X?
|
||||
|
||||
@@ -75,7 +75,6 @@ define(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notificat
|
||||
* @param {String} selector The selector of the auto complete element.
|
||||
* @param {String} query The query string.
|
||||
* @param {Function} callback A callback function receiving an array of results.
|
||||
* @return {Void}
|
||||
*/
|
||||
transport: function(selector, query, callback) {
|
||||
var el = $(selector),
|
||||
|
||||
@@ -31,6 +31,7 @@ define(['jquery',
|
||||
|
||||
/**
|
||||
* Grade dialogue class.
|
||||
* @param {Array} ratingOptions
|
||||
*/
|
||||
var Grade = function(ratingOptions) {
|
||||
EventBase.prototype.constructor.apply(this, []);
|
||||
@@ -46,7 +47,6 @@ define(['jquery',
|
||||
/**
|
||||
* After render hook.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @method _afterRender
|
||||
* @protected
|
||||
*/
|
||||
@@ -118,6 +118,7 @@ define(['jquery',
|
||||
*
|
||||
* @param {String} selector
|
||||
* @method _find
|
||||
* @returns {node} The node
|
||||
* @protected
|
||||
*/
|
||||
Grade.prototype._find = function(selector) {
|
||||
|
||||
@@ -34,12 +34,12 @@ define(['jquery',
|
||||
* InlineEditor
|
||||
*
|
||||
* @param {String} selector The selector to trigger the grading.
|
||||
* @param {Number} The id of the scale for this competency.
|
||||
* @param {Number} The id of the competency.
|
||||
* @param {Number} The id of the user.
|
||||
* @param {Number} The id of the plan.
|
||||
* @param {Number} The id of the course.
|
||||
* @param {String} Language string for choose a rating.
|
||||
* @param {Number} scaleId The id of the scale for this competency.
|
||||
* @param {Number} competencyId The id of the competency.
|
||||
* @param {Number} userId The id of the user.
|
||||
* @param {Number} planId The id of the plan.
|
||||
* @param {Number} courseId The id of the course.
|
||||
* @param {String} chooseStr Language string for choose a rating.
|
||||
*/
|
||||
var InlineEditor = function(selector, scaleId, competencyId, userId, planId, courseId, chooseStr) {
|
||||
EventBase.prototype.constructor.apply(this, []);
|
||||
|
||||
@@ -44,7 +44,7 @@ define(['jquery'], function($) {
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param {$} Jquery collection matching the root of the menu.
|
||||
* @param {$} menuRoot Jquery collection matching the root of the menu.
|
||||
* @param {Function[]} handlers, called when a menu item is chosen.
|
||||
*/
|
||||
var Menubar = function(menuRoot, handlers) {
|
||||
@@ -144,7 +144,7 @@ define(['jquery'], function($) {
|
||||
* @method handleClick
|
||||
* @param {Object} item is the jquery object of the item firing the event
|
||||
* @param {Event} e is the associated event object
|
||||
* @return boolean Returns false
|
||||
* @return {boolean} Returns false
|
||||
*/
|
||||
Menubar.prototype.handleClick = function(item, e) {
|
||||
e.stopPropagation();
|
||||
@@ -166,7 +166,7 @@ define(['jquery'], function($) {
|
||||
this.activeItem = null;
|
||||
|
||||
// Close the menu.
|
||||
this.menuRoot.find('ul').not('.root-level').attr('aria-hidden','true');
|
||||
this.menuRoot.find('ul').not('.root-level').attr('aria-hidden', 'true');
|
||||
// Follow any link, or call the click handlers.
|
||||
var anchor = item.find('a').first();
|
||||
var clickEvent = new $.Event('click');
|
||||
@@ -290,7 +290,7 @@ define(['jquery'], function($) {
|
||||
subMenuContainer.css('margin-right', '-' + marginright + 'px');
|
||||
}
|
||||
} else {
|
||||
if ( pos.left + menuRealWidth > $(window).width()) {
|
||||
if (pos.left + menuRealWidth > $(window).width()) {
|
||||
marginleft = menuRealWidth - widthmenuRoot;
|
||||
subMenuContainer.css('margin-left', '-' + marginleft + 'px');
|
||||
}
|
||||
@@ -319,7 +319,7 @@ define(['jquery'], function($) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch(e.keyCode) {
|
||||
switch (e.keyCode) {
|
||||
case this.keys.tab: {
|
||||
|
||||
// Hide all menu items and update their aria attributes.
|
||||
@@ -438,7 +438,7 @@ define(['jquery'], function($) {
|
||||
// This is the root level move to next sibling. This will require closing
|
||||
// the current child menu and opening the new one.
|
||||
|
||||
if (menuIndex < menuNum-1) {
|
||||
if (menuIndex < menuNum - 1) {
|
||||
// Not the last root menu.
|
||||
newItem = item.next();
|
||||
} else { // Wrap to first item.
|
||||
@@ -501,7 +501,7 @@ define(['jquery'], function($) {
|
||||
menuIndex = this.rootMenus.index(rootItem);
|
||||
|
||||
// If this is not the last root menu item, move to the next one.
|
||||
if (menuIndex < this.rootMenus.length-1) {
|
||||
if (menuIndex < this.rootMenus.length - 1) {
|
||||
newItem = rootItem.next();
|
||||
} else {
|
||||
// Loop.
|
||||
@@ -687,7 +687,7 @@ define(['jquery'], function($) {
|
||||
// to the next item with a title that begins with that character.
|
||||
if (startChr) {
|
||||
var match = false;
|
||||
var curNdx = menuIndex+1;
|
||||
var curNdx = menuIndex + 1;
|
||||
|
||||
// Check if the active item was the last one on the list.
|
||||
if (curNdx == menuNum) {
|
||||
@@ -696,7 +696,7 @@ define(['jquery'], function($) {
|
||||
|
||||
// Iterate through the menu items (starting from the current item and wrapping) until a match is found
|
||||
// or the loop returns to the current menu item.
|
||||
while (curNdx != menuIndex) {
|
||||
while (curNdx != menuIndex) {
|
||||
|
||||
var titleChr = menuItems.eq(curNdx).html().charAt(0);
|
||||
|
||||
@@ -705,7 +705,7 @@ define(['jquery'], function($) {
|
||||
break;
|
||||
}
|
||||
|
||||
curNdx = curNdx+1;
|
||||
curNdx = curNdx + 1;
|
||||
|
||||
if (curNdx == menuNum) {
|
||||
// Reached the end of the list, start again at the beginning.
|
||||
@@ -724,8 +724,8 @@ define(['jquery'], function($) {
|
||||
return item;
|
||||
}
|
||||
} else {
|
||||
if (menuIndex < menuNum-1) {
|
||||
newItem = menuItems.eq(menuIndex+1);
|
||||
if (menuIndex < menuNum - 1) {
|
||||
newItem = menuItems.eq(menuIndex + 1);
|
||||
} else {
|
||||
newItem = menuItems.first();
|
||||
}
|
||||
@@ -763,7 +763,7 @@ define(['jquery'], function($) {
|
||||
|
||||
// If item is not the first item in its menu, move to the previous item.
|
||||
if (menuIndex > 0) {
|
||||
newItem = menuItems.eq(menuIndex-1);
|
||||
newItem = menuItems.eq(menuIndex - 1);
|
||||
} else {
|
||||
// Loop to top of menu.
|
||||
newItem = menuItems.last();
|
||||
@@ -823,7 +823,7 @@ define(['jquery'], function($) {
|
||||
* { "[data-action='add']" : callAddFunction }
|
||||
*/
|
||||
enhance: function(selector, handler) {
|
||||
$(selector).each(function (index, element) {
|
||||
$(selector).each(function(index, element) {
|
||||
var menuRoot = $(element);
|
||||
// Don't enhance the same menu twice.
|
||||
if (menuRoot.data("menubarEnhanced") !== true) {
|
||||
|
||||
@@ -61,7 +61,7 @@ define(['jquery', 'core/ajax', 'core/str', 'tool_lp/competencypicker', 'core/tem
|
||||
/**
|
||||
* Set the parent competency in the competency form.
|
||||
*
|
||||
* @param {Object} Data containing selected cmpetency.
|
||||
* @param {Object} data Data containing selected competency.
|
||||
* @method setParent
|
||||
*/
|
||||
ParentCompetencyForm.prototype.setParent = function(data) {
|
||||
@@ -129,7 +129,7 @@ define(['jquery', 'core/ajax', 'core/str', 'tool_lp/competencypicker', 'core/tem
|
||||
/**
|
||||
* Main initialisation.
|
||||
* @param {String} buttonSelector The parent competency button selector.
|
||||
* @param {String} inputHiddenSelector The hidden input field selector.
|
||||
* @param {String} inputSelector The hidden input field selector.
|
||||
* @param {String} staticElementSelector The static element displaying the parent competency.
|
||||
* @param {Number} frameworkId The competency framework ID.
|
||||
* @param {Number} pageContextId The page context ID.
|
||||
|
||||
@@ -178,7 +178,7 @@ define(['jquery',
|
||||
{ key: 'deleteplan', component: 'tool_lp', param: plan.name },
|
||||
{ key: 'delete', component: 'moodle' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Delete plan X?
|
||||
@@ -225,7 +225,7 @@ define(['jquery',
|
||||
{ key: 'reopenplanconfirm', component: 'tool_lp', param: plan.name },
|
||||
{ key: 'reopenplan', component: 'tool_lp' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Reopen plan X?
|
||||
@@ -272,7 +272,7 @@ define(['jquery',
|
||||
{ key: 'completeplanconfirm', component: 'tool_lp', param: plan.name },
|
||||
{ key: 'completeplan', component: 'tool_lp' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Complete plan X?
|
||||
@@ -318,7 +318,7 @@ define(['jquery',
|
||||
{ key: 'unlinkplantemplateconfirm', component: 'tool_lp', param: plan.name },
|
||||
{ key: 'unlinkplantemplate', component: 'tool_lp' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Unlink plan X?
|
||||
@@ -507,7 +507,7 @@ define(['jquery',
|
||||
courses: courses
|
||||
};
|
||||
templates.render('tool_lp/linked_courses_summary', context).done(function(html) {
|
||||
str.get_string('linkedcourses', 'tool_lp').done(function (linkedcourses) {
|
||||
str.get_string('linkedcourses', 'tool_lp').done(function(linkedcourses) {
|
||||
new Dialogue(
|
||||
linkedcourses, // Title.
|
||||
html // The linked courses.
|
||||
|
||||
@@ -198,7 +198,6 @@ define(['jquery', 'core/notification', 'core/templates', 'core/ajax', 'tool_lp/d
|
||||
*
|
||||
* @name scaleChangeHandler
|
||||
* @param {Event} e
|
||||
* @return {Void}
|
||||
* @function
|
||||
*/
|
||||
ScaleConfig.prototype.scaleChangeHandler = function(e) {
|
||||
|
||||
@@ -32,7 +32,7 @@ define(['jquery', 'core/ajax'], function($, ajax) {
|
||||
* @param {Number} scaleid The scale id
|
||||
* @return [] {Promise}
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
get_values: function(scaleid) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
@@ -40,7 +40,7 @@ define(['jquery', 'core/ajax'], function($, ajax) {
|
||||
if (typeof localCache[scaleid] === 'undefined') {
|
||||
ajax.call([{
|
||||
methodname: 'core_competency_get_scale_values',
|
||||
args: {scaleid : scaleid},
|
||||
args: {scaleid: scaleid},
|
||||
done: function(scaleinfo) {
|
||||
localCache[scaleid] = scaleinfo;
|
||||
deferred.resolve(scaleinfo);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* @copyright 2015 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str','tool_lp/actionselector'],
|
||||
define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str', 'tool_lp/actionselector'],
|
||||
function($, templates, ajax, notification, str, Actionselector) {
|
||||
// Private variables and functions.
|
||||
|
||||
@@ -135,9 +135,9 @@ define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str'
|
||||
{ key: 'unlinkplanstemplate', component: 'tool_lp' },
|
||||
{ key: 'confirm', component: 'moodle' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
var actions = [{'text': strings[2], 'value' : 'delete'},
|
||||
{'text': strings[3], 'value' : 'unlink'}];
|
||||
]).done(function(strings) {
|
||||
var actions = [{'text': strings[2], 'value': 'delete'},
|
||||
{'text': strings[3], 'value': 'unlink'}];
|
||||
var actionselector = new Actionselector(
|
||||
strings[0], // Title.
|
||||
strings[1], // Message
|
||||
@@ -152,14 +152,13 @@ define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str'
|
||||
doDelete();
|
||||
});
|
||||
}).fail(notification.exception);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
str.get_strings([
|
||||
{ key: 'confirm', component: 'moodle' },
|
||||
{ key: 'deletetemplate', component: 'tool_lp', param: template.shortname },
|
||||
{ key: 'delete', component: 'moodle' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Delete learning plan template X?
|
||||
|
||||
@@ -186,12 +186,12 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
var oneItem = null;
|
||||
|
||||
while (lastIndex < currentIndex) {
|
||||
oneItem = $(this.visibleItems.get(lastIndex));
|
||||
oneItem = $(this.visibleItems.get(lastIndex));
|
||||
oneItem.attr('aria-selected', 'true');
|
||||
lastIndex++;
|
||||
}
|
||||
while (lastIndex > currentIndex) {
|
||||
oneItem = $(this.visibleItems.get(lastIndex));
|
||||
oneItem = $(this.visibleItems.get(lastIndex));
|
||||
oneItem.attr('aria-selected', 'true');
|
||||
lastIndex--;
|
||||
}
|
||||
@@ -230,7 +230,8 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
*/
|
||||
Tree.prototype.toggleItem = function(item) {
|
||||
if (!this.multiSelect) {
|
||||
return this.selectItem(item);
|
||||
this.selectItem(item);
|
||||
return;
|
||||
}
|
||||
|
||||
var current = item.attr('aria-selected');
|
||||
@@ -271,6 +272,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
* @method handleKeyDown
|
||||
* @param {Object} item is the jquery id of the parent item of the group
|
||||
* @param {Event} e The event.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Tree.prototype.handleKeyDown = function(item, e) {
|
||||
var currentIndex = this.visibleItems.index(item);
|
||||
@@ -419,6 +421,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
* @method handleKeyPress
|
||||
* @param {Object} item is the jquery id of the parent item of the group
|
||||
* @param {Event} e The event.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Tree.prototype.handleKeyPress = function(item, e) {
|
||||
if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
|
||||
@@ -454,7 +457,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
|
||||
// Iterate through the menu items (starting from the current item and wrapping) until a match is found
|
||||
// or the loop returns to the current menu item.
|
||||
while (currentIndex != itemIndex) {
|
||||
while (currentIndex != itemIndex) {
|
||||
|
||||
var currentItem = this.visibleItems.eq(currentIndex);
|
||||
var titleChr = currentItem.text().charAt(0);
|
||||
@@ -468,7 +471,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
break;
|
||||
}
|
||||
|
||||
currentIndex = currentIndex+1;
|
||||
currentIndex = currentIndex + 1;
|
||||
if (currentIndex == itemCount) {
|
||||
// Reached the end of the list, start again at the beginning.
|
||||
currentIndex = 0;
|
||||
@@ -483,6 +486,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unreachable
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -507,6 +511,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
* @method handleDblClick
|
||||
* @param {Object} item is the jquery id of the parent item of the group
|
||||
* @param {Event} e The event.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Tree.prototype.handleDblClick = function(item, e) {
|
||||
|
||||
@@ -531,6 +536,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
* @method handleExpandCollapseClick
|
||||
* @param {Object} item is the jquery id of the parent item of the group
|
||||
* @param {Event} e The event.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Tree.prototype.handleExpandCollapseClick = function(item, e) {
|
||||
|
||||
@@ -547,6 +553,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
* @method handleClick
|
||||
* @param {Object} item is the jquery id of the parent item of the group
|
||||
* @param {Event} e The event.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Tree.prototype.handleClick = function(item, e) {
|
||||
|
||||
@@ -568,6 +575,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
|
||||
* @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() {
|
||||
return true;
|
||||
@@ -579,6 +587,7 @@ 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) {
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@ define(['jquery'], function($) {
|
||||
/**
|
||||
* UserCompetencyCourseNavigation
|
||||
*
|
||||
* @param {String} The selector of the user element.
|
||||
* @param {String} The selector of the competency element.
|
||||
* @param {String} The base url for the page (no params).
|
||||
* @param {Number} The course id
|
||||
* @param {Number} The user id
|
||||
* @param {Number} The competency id
|
||||
* @param {String} userSelector The selector of the user element.
|
||||
* @param {String} competencySelector The selector of the competency element.
|
||||
* @param {String} baseUrl The base url for the page (no params).
|
||||
* @param {Number} userId The user id
|
||||
* @param {Number} competencyId The competency id
|
||||
* @param {Number} courseId The course id
|
||||
*/
|
||||
var UserCompetencyCourseNavigation = function(userSelector, competencySelector, baseUrl, userId, competencyId, courseId) {
|
||||
this._baseUrl = baseUrl;
|
||||
|
||||
@@ -26,12 +26,12 @@ define(['jquery', 'core/notification', 'core/ajax', 'core/templates'], function(
|
||||
/**
|
||||
* Info
|
||||
*
|
||||
* @param {JQuery} Selector to replace when the information needs updating.
|
||||
* @param {Number} The id of the competency.
|
||||
* @param {Number} The id of the user.
|
||||
* @param {Number} The id of the plan.
|
||||
* @param {Number} The id of the course.
|
||||
* @param {Boolean} If we should display the user info.
|
||||
* @param {JQuery} rootElement Selector to replace when the information needs updating.
|
||||
* @param {Number} competencyId The id of the competency.
|
||||
* @param {Number} userId The id of the user.
|
||||
* @param {Number} planId The id of the plan.
|
||||
* @param {Number} courseId The id of the course.
|
||||
* @param {Boolean} displayuser If we should display the user info.
|
||||
*/
|
||||
var Info = function(rootElement, competencyId, userId, planId, courseId, displayuser) {
|
||||
this._rootElement = rootElement;
|
||||
|
||||
@@ -27,9 +27,9 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/templates'
|
||||
/**
|
||||
* UserCompetencyPopup
|
||||
*
|
||||
* @param {String} The regionSelector
|
||||
* @param {String} The userCompetencySelector
|
||||
* @param {Number} The plan ID
|
||||
* @param {String} regionSelector The regionSelector
|
||||
* @param {String} userCompetencySelector The userCompetencySelector
|
||||
* @param {Number} planId The plan ID
|
||||
*/
|
||||
var UserCompetencyPopup = function(regionSelector, userCompetencySelector, planId) {
|
||||
this._regionSelector = regionSelector;
|
||||
@@ -53,14 +53,14 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/templates'
|
||||
var planId = this._planId;
|
||||
|
||||
var requests = ajax.call([{
|
||||
methodname : 'tool_lp_data_for_user_competency_summary_in_plan',
|
||||
methodname: 'tool_lp_data_for_user_competency_summary_in_plan',
|
||||
args: { competencyid: competencyId, planid: planId },
|
||||
done: this._contextLoaded.bind(this),
|
||||
fail: notification.exception
|
||||
}]);
|
||||
|
||||
// Log the user competency viewed in plan event.
|
||||
requests[0].then(function (result) {
|
||||
requests[0].then(function(result) {
|
||||
var eventMethodName = 'core_competency_user_competency_viewed_in_plan';
|
||||
// Trigger core_competency_user_competency_plan_viewed event instead if plan is already completed.
|
||||
if (result.plan.iscompleted) {
|
||||
@@ -98,7 +98,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/templates'
|
||||
var planId = this._planId;
|
||||
|
||||
ajax.call([{
|
||||
methodname : 'tool_lp_data_for_plan_page',
|
||||
methodname: 'tool_lp_data_for_plan_page',
|
||||
args: { planid: planId},
|
||||
done: this._pageContextLoaded.bind(this),
|
||||
fail: notification.exception
|
||||
|
||||
@@ -47,7 +47,6 @@ define(['jquery',
|
||||
* Cancel a review request and refresh the view.
|
||||
*
|
||||
* @param {Object} data The user competency data.
|
||||
* @return {Void}
|
||||
* @method _cancelReviewRequest
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype._cancelReviewRequest = function(data) {
|
||||
@@ -71,7 +70,6 @@ define(['jquery',
|
||||
* Cancel a review request an refresh the view.
|
||||
*
|
||||
* @param {Object} data The user competency data.
|
||||
* @return {Void}
|
||||
* @method cancelReviewRequest
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype.cancelReviewRequest = function(data) {
|
||||
@@ -82,7 +80,6 @@ define(['jquery',
|
||||
* Cancel a review request handler.
|
||||
*
|
||||
* @param {Event} e The event.
|
||||
* @return {Void}
|
||||
* @method _cancelReviewRequestHandler
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype._cancelReviewRequestHandler = function(e) {
|
||||
@@ -95,7 +92,6 @@ define(['jquery',
|
||||
* Request a review and refresh the view.
|
||||
*
|
||||
* @param {Object} data The user competency data.
|
||||
* @return {Void}
|
||||
* @method _requestReview
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype._requestReview = function(data) {
|
||||
@@ -119,7 +115,6 @@ define(['jquery',
|
||||
* Request a review.
|
||||
*
|
||||
* @param {Object} data The user competency data.
|
||||
* @return {Void}
|
||||
* @method requestReview
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype.requestReview = function(data) {
|
||||
@@ -130,7 +125,6 @@ define(['jquery',
|
||||
* Request a review handler.
|
||||
*
|
||||
* @param {Event} e The event.
|
||||
* @return {Void}
|
||||
* @method _requestReviewHandler
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype._requestReviewHandler = function(e) {
|
||||
@@ -143,7 +137,6 @@ define(['jquery',
|
||||
* Start a review and refresh the view.
|
||||
*
|
||||
* @param {Object} data The user competency data.
|
||||
* @return {Void}
|
||||
* @method _startReview
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype._startReview = function(data) {
|
||||
@@ -167,7 +160,6 @@ define(['jquery',
|
||||
* Start a review.
|
||||
*
|
||||
* @param {Object} data The user competency data.
|
||||
* @return {Void}
|
||||
* @method startReview
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype.startReview = function(data) {
|
||||
@@ -178,7 +170,6 @@ define(['jquery',
|
||||
* Start a review handler.
|
||||
*
|
||||
* @param {Event} e The event.
|
||||
* @return {Void}
|
||||
* @method _startReviewHandler
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype._startReviewHandler = function(e) {
|
||||
@@ -191,7 +182,6 @@ define(['jquery',
|
||||
* Stop a review and refresh the view.
|
||||
*
|
||||
* @param {Object} data The user competency data.
|
||||
* @return {Void}
|
||||
* @method _stopReview
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype._stopReview = function(data) {
|
||||
@@ -215,7 +205,6 @@ define(['jquery',
|
||||
* Stop a review.
|
||||
*
|
||||
* @param {Object} data The user competency data.
|
||||
* @return {Void}
|
||||
* @method stopReview
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype.stopReview = function(data) {
|
||||
@@ -226,7 +215,6 @@ define(['jquery',
|
||||
* Stop a review handler.
|
||||
*
|
||||
* @param {Event} e The event.
|
||||
* @return {Void}
|
||||
* @method _stopReviewHandler
|
||||
*/
|
||||
UserCompetencyWorkflow.prototype._stopReviewHandler = function(e) {
|
||||
|
||||
@@ -165,7 +165,7 @@ define(['jquery',
|
||||
{ key: 'deleteuserevidence', component: 'tool_lp', param: evidence.name },
|
||||
{ key: 'delete', component: 'moodle' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Delete evidence X?
|
||||
@@ -320,7 +320,7 @@ define(['jquery',
|
||||
{ key: 'sendallcompetenciestoreview', component: 'tool_lp', param: evidence.name },
|
||||
{ key: 'confirm', component: 'moodle' },
|
||||
{ key: 'cancel', component: 'moodle' }
|
||||
]).done(function (strings) {
|
||||
]).done(function(strings) {
|
||||
notification.confirm(
|
||||
strings[0], // Confirm.
|
||||
strings[1], // Send all competencies in review for X?
|
||||
|
||||
@@ -120,14 +120,14 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
|
||||
|
||||
var promises = ajax.call([{
|
||||
methodname: 'core_output_load_template',
|
||||
args:{
|
||||
args: {
|
||||
component: component,
|
||||
template: name,
|
||||
themename: config.theme
|
||||
}
|
||||
}, {
|
||||
methodname: 'tool_templatelibrary_load_canonical_template',
|
||||
args:{
|
||||
args: {
|
||||
component: component,
|
||||
template: name
|
||||
}
|
||||
@@ -136,7 +136,9 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
|
||||
// When returns a new promise that is resolved when all the passed in promises are resolved.
|
||||
// The arguments to the done become the values of each resolved promise.
|
||||
$.when.apply($, promises)
|
||||
.done( function(source, originalSource) { templateLoaded(templateName, source, originalSource); })
|
||||
.done(function(source, originalSource) {
|
||||
templateLoaded(templateName, source, originalSource);
|
||||
})
|
||||
.fail(notification.exception);
|
||||
};
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
|
||||
* The ajax call has returned with a new list of templates.
|
||||
*
|
||||
* @method reloadListTemplate
|
||||
* @param String[] templates List of template ids.
|
||||
* @param {String[]} templateList List of template ids.
|
||||
*/
|
||||
var reloadListTemplate = function(templateList) {
|
||||
templates.render('tool_templatelibrary/search_results', { templates: templateList })
|
||||
.done(function (result, js) {
|
||||
.done(function(result, js) {
|
||||
templates.replaceNode($('[data-region="searchresults"]'), result, js);
|
||||
}).fail(notification.exception);
|
||||
};
|
||||
@@ -63,8 +63,8 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
|
||||
* the function will only be executed once.
|
||||
*
|
||||
* @method queueRefresh
|
||||
* @param function callback
|
||||
* @param int delay The time in milliseconds to delay.
|
||||
* @param {function} callback
|
||||
* @param {Number} delay The time in milliseconds to delay.
|
||||
*/
|
||||
var queueRefresh = function(callback, delay) {
|
||||
if (throttle !== null) {
|
||||
|
||||
@@ -28,9 +28,9 @@ define(['jquery'], function($) {
|
||||
// Copied from lib/navigationlib.php navigation_node constants.
|
||||
var NODETYPE = {
|
||||
// @type int Activity (course module) = 40.
|
||||
ACTIVITY : 40,
|
||||
ACTIVITY: 40,
|
||||
// @type int Resource (course module = 50.
|
||||
RESOURCE : 50,
|
||||
RESOURCE: 50,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,6 @@ define(['jquery'], function($) {
|
||||
* @method buildDOM
|
||||
* @param {Object} rootElement the root element of DOM.
|
||||
* @param {object} nodes jquery object representing the nodes to be build.
|
||||
* @return
|
||||
*/
|
||||
function buildDOM(rootElement, nodes) {
|
||||
var ul = $('<ul></ul>');
|
||||
@@ -94,7 +93,7 @@ define(['jquery'], function($) {
|
||||
|
||||
if (icon) {
|
||||
link.append(icon);
|
||||
link.append('<span class="item-content-wrap">'+node.name+'</span>');
|
||||
link.append('<span class="item-content-wrap">' + node.name + '</span>');
|
||||
} else {
|
||||
link.append(node.name);
|
||||
}
|
||||
@@ -109,7 +108,7 @@ define(['jquery'], function($) {
|
||||
|
||||
if (icon) {
|
||||
span.append(icon);
|
||||
span.append('<span class="item-content-wrap">'+node.name+'</span>');
|
||||
span.append('<span class="item-content-wrap">' + node.name + '</span>');
|
||||
} else {
|
||||
span.append(node.name);
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ define(['jquery', 'core/ajax', 'core/config', 'block_navigation/ajax_response_re
|
||||
* Get the block instance id.
|
||||
*
|
||||
* @function getBlockInstanceId
|
||||
* @param element
|
||||
* @returns {*}
|
||||
* @param {Element} element
|
||||
* @returns {String} the instance id
|
||||
*/
|
||||
function getBlockInstanceId(element) {
|
||||
return element.closest('[data-block]').attr('data-instanceid');
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* @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) {
|
||||
define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function($, templates, notification) {
|
||||
|
||||
// Private variables and functions.
|
||||
|
||||
@@ -34,18 +34,18 @@ define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function (
|
||||
* Basically, it performs the binding and handling of the button click event for
|
||||
* the 'Insert frequently used comment' button.
|
||||
*
|
||||
* @param criterionId The criterion ID.
|
||||
* @param buttonId The element ID of the button which the handler will be bound to.
|
||||
* @param remarkId The element ID of the remark text area where the text of the selected comment will be copied to.
|
||||
* @param commentOptions The array of frequently used comments to be used as options.
|
||||
* @param {Integer} criterionId The criterion ID.
|
||||
* @param {String} buttonId The element ID of the button which the handler will be bound to.
|
||||
* @param {String} remarkId The element ID of the remark text area where the text of the selected comment will be copied to.
|
||||
* @param {Array} commentOptions The array of frequently used comments to be used as options.
|
||||
*/
|
||||
initialise: function (criterionId, buttonId, remarkId, commentOptions) {
|
||||
initialise: function(criterionId, buttonId, remarkId, commentOptions) {
|
||||
/**
|
||||
* Display the chooser dialog using the compiled HTML from the mustache template
|
||||
* and binds onclick events for the generated comment options.
|
||||
*
|
||||
* @param compiledSource The compiled HTML from the mustache template
|
||||
* @param comments Array containing comments.
|
||||
* @param {String} compiledSource The compiled HTML from the mustache template
|
||||
* @param {Array} comments Array containing comments.
|
||||
*/
|
||||
function displayChooserDialog(compiledSource, comments) {
|
||||
var titleLabel = '<label>' + M.util.get_string('insertcomment', 'gradingform_guide') + '</label>';
|
||||
@@ -68,11 +68,11 @@ define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function (
|
||||
});
|
||||
|
||||
// Loop over each comment item and bind click events.
|
||||
$.each(comments, function (index, comment) {
|
||||
$.each(comments, function(index, comment) {
|
||||
var commentOptionId = '#comment-option-' + criterionId + '-' + comment.id;
|
||||
|
||||
// Delegate click event for the generated option link.
|
||||
$(commentOptionId).click(function () {
|
||||
$(commentOptionId).click(function() {
|
||||
var remarkTextArea = $('#' + remarkId);
|
||||
var remarkText = remarkTextArea.val();
|
||||
|
||||
@@ -88,7 +88,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function (
|
||||
});
|
||||
|
||||
// Handle keypress on list items.
|
||||
$(document).off('keypress', commentOptionId).on('keypress', commentOptionId, function () {
|
||||
$(document).off('keypress', commentOptionId).on('keypress', commentOptionId, function() {
|
||||
var keyCode = event.which || event.keyCode;
|
||||
|
||||
// Enter or space key.
|
||||
@@ -124,14 +124,14 @@ define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function (
|
||||
|
||||
// Render the template and display the comment chooser dialog.
|
||||
templates.render('gradingform_guide/comment_chooser', context)
|
||||
.done(function (compiledSource) {
|
||||
.done(function(compiledSource) {
|
||||
displayChooserDialog(compiledSource, commentOptions);
|
||||
})
|
||||
.fail(notification.exception);
|
||||
}
|
||||
|
||||
// Bind click event for the comments chooser button.
|
||||
$("#" + buttonId).click(function (e) {
|
||||
$("#" + buttonId).click(function(e) {
|
||||
e.preventDefault();
|
||||
generateCommentsChooser();
|
||||
});
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1 +1 @@
|
||||
define(["jquery","core/config","core/notification","core/templates"],function(a,b,c,d){var e,f,g,h,i={ADDROLE:"a.allowlink, a.prohibitlink",REMOVEROLE:"a.preventlink, a.unprohibitlink",UNPROHIBIT:"a.unprohibitlink"},j=a.Event("rolesloaded"),k=null,l=function(){var d={contextid:e,getroles:1,sesskey:b.sesskey};a.post(g+"roles/ajax.php",d,function(){}).done(function(b){try{h=b,l=function(){a("body").trigger(j)},l()}catch(d){c.exception(d)}}).fail(function(a,b,d){c.exception(d)})},m=function(b,f,i){var j={contextid:e,roleid:f,sesskey:M.cfg.sesskey,action:i,capability:b.data("name")};a.post(g+"roles/ajax.php",j,function(){}).done(function(e){var i=e;try{var j={rolename:h[f],roleid:f,adminurl:g,imageurl:M.util.image_url("t/delete","moodle")};switch(i){case"allow":j.spanclass="allowed",j.linkclass="preventlink",j.action="prevent";break;case"prohibit":j.spanclass="forbidden",j.linkclass="unprohibitlink",j.action="unprohibit";break;case"prevent":return void b.find('a[data-role-id="'+f+'"]').first().closest(".allowed").remove();case"unprohibit":return void b.find('a[data-role-id="'+f+'"]').first().closest(".forbidden").remove();default:return}d.render("core/permissionmanager_role",j).done(function(c){if("allow"==i)a(c).insertBefore(b.find(".allowmore:first"));else if("prohibit"==i){a(c).insertBefore(b.find(".prohibitmore:first"));var d=b.find(".allowedroles").first().find('a[data-role-id="'+f+'"]');d&&d.first().closest(".allowed").remove()}k.hide()}).fail(c.exception)}catch(l){c.exception(l)}}).fail(function(a,b,d){c.exception(d)})},n=function(b){b.preventDefault(),a("body").one("rolesloaded",function(){var e=a(b.currentTarget),g=e.data("action"),j=e.closest("tr.rolecap"),l={cap:j.data("humanname"),context:f},n=M.util.get_string("role"+g+"info","core_role",l);null===k&&(k=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,width:"450px"})),k.set("headerContent",M.util.get_string("role"+g+"header","core_role"));var o,p,q=[];switch(g){case"allow":p=j.find(i.REMOVEROLE);break;case"prohibit":p=j.find(i.UNPROHIBIT)}for(o in h){var r="",s=p.filter("[data-role-id='"+o+"']").length;s&&(r="disabled");var t={roleid:o,rolename:h[o],disabled:r};q.push(t)}d.render("core/permissionmanager_panelcontent",{message:n,roles:q}).done(function(b){k.set("bodyContent",b),k.show(),a("div.role_buttons").delegate("input","click",function(b){var c=a(b.currentTarget).data("role-id");m(j,c,g)})}).fail(c.exception)}),l()},o=function(b){b.preventDefault(),a("body").one("rolesloaded",function(){var d=a(b.currentTarget),e=d.data("action"),g=d.data("role-id"),i=d.closest("tr.rolecap"),j={role:h[g],cap:i.data("humanname"),context:f};c.confirm(M.util.get_string("confirmunassigntitle","core_role"),M.util.get_string("confirmrole"+e,"core_role",j),M.util.get_string("confirmunassignyes","core_role"),M.util.get_string("confirmunassignno","core_role"),function(){m(i,g,e)})}),l()};return{initialize:function(b){e=b.contextid,f=b.contextname,g=b.adminurl;var c=a("body");c.delegate(i.ADDROLE,"click",n),c.delegate(i.REMOVEROLE,"click",o)}}});
|
||||
define(["jquery","core/config","core/notification","core/templates"],function(a,b,c,d){var e,f,g,h,i={ADDROLE:"a.allowlink, a.prohibitlink",REMOVEROLE:"a.preventlink, a.unprohibitlink",UNPROHIBIT:"a.unprohibitlink"},j=a.Event("rolesloaded"),k=null,l=function(){var d={contextid:e,getroles:1,sesskey:b.sesskey};a.post(g+"roles/ajax.php",d).done(function(b){try{h=b,l=function(){a("body").trigger(j)},l()}catch(d){c.exception(d)}}).fail(function(a,b,d){c.exception(d)})},m=function(b,f,i){var j={contextid:e,roleid:f,sesskey:M.cfg.sesskey,action:i,capability:b.data("name")};a.post(g+"roles/ajax.php",j).done(function(e){var i=e;try{var j={rolename:h[f],roleid:f,adminurl:g,imageurl:M.util.image_url("t/delete","moodle")};switch(i){case"allow":j.spanclass="allowed",j.linkclass="preventlink",j.action="prevent";break;case"prohibit":j.spanclass="forbidden",j.linkclass="unprohibitlink",j.action="unprohibit";break;case"prevent":return void b.find('a[data-role-id="'+f+'"]').first().closest(".allowed").remove();case"unprohibit":return void b.find('a[data-role-id="'+f+'"]').first().closest(".forbidden").remove();default:return}d.render("core/permissionmanager_role",j).done(function(c){if("allow"==i)a(c).insertBefore(b.find(".allowmore:first"));else if("prohibit"==i){a(c).insertBefore(b.find(".prohibitmore:first"));var d=b.find(".allowedroles").first().find('a[data-role-id="'+f+'"]');d&&d.first().closest(".allowed").remove()}k.hide()}).fail(c.exception)}catch(l){c.exception(l)}}).fail(function(a,b,d){c.exception(d)})},n=function(b){b.preventDefault(),a("body").one("rolesloaded",function(){var e=a(b.currentTarget),g=e.data("action"),j=e.closest("tr.rolecap"),l={cap:j.data("humanname"),context:f},n=M.util.get_string("role"+g+"info","core_role",l);null===k&&(k=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,width:"450px"})),k.set("headerContent",M.util.get_string("role"+g+"header","core_role"));var o,p,q=[];switch(g){case"allow":p=j.find(i.REMOVEROLE);break;case"prohibit":p=j.find(i.UNPROHIBIT)}for(o in h){var r="",s=p.filter("[data-role-id='"+o+"']").length;s&&(r="disabled");var t={roleid:o,rolename:h[o],disabled:r};q.push(t)}d.render("core/permissionmanager_panelcontent",{message:n,roles:q}).done(function(b){k.set("bodyContent",b),k.show(),a("div.role_buttons").delegate("input","click",function(b){var c=a(b.currentTarget).data("role-id");m(j,c,g)})}).fail(c.exception)}),l()},o=function(b){b.preventDefault(),a("body").one("rolesloaded",function(){var d=a(b.currentTarget),e=d.data("action"),g=d.data("role-id"),i=d.closest("tr.rolecap"),j={role:h[g],cap:i.data("humanname"),context:f};c.confirm(M.util.get_string("confirmunassigntitle","core_role"),M.util.get_string("confirmrole"+e,"core_role",j),M.util.get_string("confirmunassignyes","core_role"),M.util.get_string("confirmunassignno","core_role"),function(){m(i,g,e)})}),l()};return{initialize:function(b){e=b.contextid,f=b.contextname,g=b.adminurl;var c=a("body");c.delegate(i.ADDROLE,"click",n),c.delegate(i.REMOVEROLE,"click",o)}}});
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
define(["core/mustache","jquery","core/ajax","core/str","core/notification","core/url","core/config","core/localstorage","core/event","core/yui","core/log"],function(a,b,c,d,e,f,g,h,i,j,k){var l={},m=[],n=[],o=1,p="",q=function(a,d){var e=b.Deferred(),f=a.split("/"),g=f.shift(),i=f.shift(),j=p+"/"+a;if(j in l)return e.resolve(l[j]),e.promise();var k=h.get("core_template/"+j);if(k)return e.resolve(k),l[j]=k,e.promise();var m=c.call([{methodname:"core_output_load_template",args:{component:g,template:i,themename:p}}],d,!1);return m[0].done(function(a){h.set("core_template/"+j,a),l[j]=a,e.resolve(a)}).fail(function(a){e.reject(a)}),e.promise()},r=function(a){var b="";return q(a,!1).done(function(a){b=a}).fail(e.exception),b},s=function(b,c){var d,e=b.split(","),g="",h="",i="";e.length>0&&(g=e.shift().trim()),e.length>0&&(h=e.shift().trim()),e.length>0&&(i=e.join(",").trim());var j=f.imageUrl(g,h),k={attributes:[{name:"src",value:j},{name:"alt",value:c(i)},{name:"class",value:"smallicon"}]},m=l[p+"/core/pix_icon"];return d=a.render(m,k,r),d.trim()},t=function(a,b){return n.push(b(a,this)),""},u=function(a,b){var c=a.split(","),d="",e="",f="";c.length>0&&(d=c.shift().trim()),c.length>0&&(e=c.shift().trim()),c.length>0&&(f=c.join(",").trim()),""!==f&&(f=b(f,this)),0===f.indexOf("{")&&0!==f.indexOf("{{")&&(f=JSON.parse(f));var g=m.length;return m.push({key:d,component:e,param:f}),"{{_s"+g+"}}"},v=function(a,b){var c=b(a.trim(),this);return c=c.replace('"','\\"').replace(/([\{\}]{2,3})/g,"{{=<% %>=}}$1<%={{ }}=%>"),'"'+c+'"'},w=function(a,b){p=b,m=[],n=[],a.uniqid=o++,a.str=function(){return u},a.pix=function(){return s},a.js=function(){return t},a.quote=function(){return v},a.globals={config:g},a.currentTheme=b},x=function(a){var b="";return n.length>0&&(b=n.join(";\n")),y(b,a)},y=function(a,b){var c,d,e,f,g,h,i=/{{_s\d+}}/;do{for(c="",d=a.search(i);d>-1;){c+=a.substring(0,d),a=a.substr(d),e="",f=4,g=a.substr(f,1);do e+=g,f++,g=a.substr(f,1);while("}"!=g);h=b[parseInt(e,10)],"undefined"==typeof h&&(k.debug("Could not find string for pattern {{_s"+e+"}}."),h=""),c+=h,a=a.substr(6+e.length),d=a.search(i)}a=c+a,d=a.search(i)}while(d>-1);return a},z=function(c,e,f){var g=b.Deferred();p=f;var h=q("core/pix_icon",!0);return h.done(function(){w(e,f);var b="";try{b=a.render(c,e,r)}catch(h){g.reject(h)}m.length>0?d.get_strings(m).then(function(a){b=y(b,a),g.resolve(b,x(a))}).fail(g.reject):g.resolve(b.trim(),x([]))}).fail(g.reject),g.promise()},A=function(a){if(""!==a.trim()){var c=b("<script>").attr("type","text/javascript").html(a);b("head").append(c)}},B=function(a,c,d,e){var f=b(a);if(f.length){var g=b(c),h=null;e?(h=new j.NodeList(f.children().get()),h.destroy(!0),f.empty(),f.append(g)):(h=new j.NodeList(f.get()),h.destroy(!0),f.replaceWith(g)),A(d),i.notifyFilterContentUpdated(g)}};return{render:function(a,c,d){var e=b.Deferred();"undefined"==typeof d&&(d=g.theme),p=d;var f=q(a,!0);return f.done(function(a){var b=z(a,c,d);b.done(function(a,b){e.resolve(a,b)}).fail(function(a){e.reject(a)})}).fail(function(a){e.reject(a)}),e.promise()},runTemplateJS:A,replaceNodeContents:function(a,b,c){return B(a,b,c,!0)},replaceNode:function(a,b,c){return B(a,b,c,!1)}}});
|
||||
define(["core/mustache","jquery","core/ajax","core/str","core/notification","core/url","core/config","core/localstorage","core/event","core/yui","core/log"],function(a,b,c,d,e,f,g,h,i,j,k){var l={},m=[],n=[],o=1,p="",q=function(a,d){var e=b.Deferred(),f=a.split("/"),g=f.shift(),i=f.shift(),j=p+"/"+a;if(j in l)return e.resolve(l[j]),e.promise();var k=h.get("core_template/"+j);if(k)return e.resolve(k),l[j]=k,e.promise();var m=c.call([{methodname:"core_output_load_template",args:{component:g,template:i,themename:p}}],d,!1);return m[0].done(function(a){h.set("core_template/"+j,a),l[j]=a,e.resolve(a)}).fail(function(a){e.reject(a)}),e.promise()},r=function(a){var b="";return q(a,!1).done(function(a){b=a}).fail(e.exception),b},s=function(b,c){var d,e=b.split(","),g="",h="",i="";e.length>0&&(g=e.shift().trim()),e.length>0&&(h=e.shift().trim()),e.length>0&&(i=e.join(",").trim());var j=f.imageUrl(g,h),k={attributes:[{name:"src",value:j},{name:"alt",value:c(i)},{name:"class",value:"smallicon"}]},m=l[p+"/core/pix_icon"];return d=a.render(m,k,r),d.trim()},t=function(a,b){return n.push(b(a,this)),""},u=function(a,b){var c=a.split(","),d="",e="",f="";c.length>0&&(d=c.shift().trim()),c.length>0&&(e=c.shift().trim()),c.length>0&&(f=c.join(",").trim()),""!==f&&(f=b(f,this)),0===f.indexOf("{")&&0!==f.indexOf("{{")&&(f=JSON.parse(f));var g=m.length;return m.push({key:d,component:e,param:f}),"{{_s"+g+"}}"},v=function(a,b){var c=b(a.trim(),this);return c=c.replace('"','\\"').replace(/([\{\}]{2,3})/g,"{{=<% %>=}}$1<%={{ }}=%>"),'"'+c+'"'},w=function(a,b){p=b,m=[],n=[],a.uniqid=o++,a.str=function(){return u},a.pix=function(){return s},a.js=function(){return t},a.quote=function(){return v},a.globals={config:g},a.currentTheme=b},x=function(a){var b="";return n.length>0&&(b=n.join(";\n")),y(b,a)},y=function(a,b){var c,d,e,f,g,h,i=/{{_s\d+}}/;do{for(c="",d=a.search(i);d>-1;){c+=a.substring(0,d),a=a.substr(d),e="",f=4,g=a.substr(f,1);do e+=g,f++,g=a.substr(f,1);while("}"!=g);h=b[parseInt(e,10)],"undefined"==typeof h&&(k.debug("Could not find string for pattern {{_s"+e+"}}."),h=""),c+=h,a=a.substr(6+e.length),d=a.search(i)}a=c+a,d=a.search(i)}while(d>-1);return a},z=function(c,e,f){var g=b.Deferred();p=f;var h=q("core/pix_icon",!0);return h.done(function(){w(e,f);var b="";try{b=a.render(c,e,r)}catch(h){g.reject(h)}m.length>0?d.get_strings(m).then(function(a){b=y(b,a),g.resolve(b,x(a))}).fail(g.reject):g.resolve(b.trim(),x([]))}).fail(g.reject),g.promise()},A=function(a){if(""!==a.trim()){var c=b("<script>").attr("type","text/javascript").html(a);b("head").append(c)}},B=function(a,c,d,e){var f=b(a);if(f.length){var g=b(c),h=null;e?(h=new j.NodeList(f.children().get()),h.destroy(!0),f.empty(),f.append(g)):(h=new j.NodeList(f.get()),h.destroy(!0),f.replaceWith(g)),A(d),i.notifyFilterContentUpdated(g)}};return{render:function(a,c,d){var e=b.Deferred();"undefined"==typeof d&&(d=g.theme),p=d;var f=q(a,!0);return f.done(function(a){var b=z(a,c,d);b.done(function(a,b){e.resolve(a,b)}).fail(function(a){e.reject(a)})}).fail(function(a){e.reject(a)}),e.promise()},runTemplateJS:A,replaceNodeContents:function(a,b,c){B(a,b,c,!0)},replaceNode:function(a,b,c){B(a,b,c,!1)}}});
|
||||
+1
-1
@@ -99,7 +99,7 @@ define(['jquery', 'core/config'], function($, config) {
|
||||
* Make a series of ajax requests and return all the responses.
|
||||
*
|
||||
* @method call
|
||||
* @param {Object[]} Array of requests with each containing methodname and args properties.
|
||||
* @param {Object[]} requests Array of requests with each containing methodname and args properties.
|
||||
* done and fail callbacks can be set for each element in the array, or the
|
||||
* can be attached to the promises returned by this function.
|
||||
* @param {Boolean} async Optional, defaults to true.
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since 3.0
|
||||
*/
|
||||
define([ 'jquery', 'core/yui' ],
|
||||
define(['jquery', 'core/yui'],
|
||||
function($, Y) {
|
||||
|
||||
return /** @alias module:core/event */ {
|
||||
@@ -32,7 +32,7 @@ define([ 'jquery', 'core/yui' ],
|
||||
* Trigger an event using both JQuery and YUI
|
||||
*
|
||||
* @method notifyFilterContentUpdated
|
||||
* @param {string}|{JQuery} nodes - Selector or list of elements that were inserted.
|
||||
* @param {string|JQuery} nodes - Selector or list of elements that were inserted.
|
||||
*/
|
||||
notifyFilterContentUpdated: function(nodes) {
|
||||
nodes = $(nodes);
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
* @since 2.9
|
||||
*/
|
||||
define(['jquery'], function($) {
|
||||
$(document).bind("ajaxStart", function(){
|
||||
$(document).bind("ajaxStart", function() {
|
||||
M.util.js_pending('jq');
|
||||
}).bind("ajaxStop", function(){
|
||||
}).bind("ajaxStop", function() {
|
||||
M.util.js_complete('jq');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -90,7 +90,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
}
|
||||
originalSelect.children('option').each(function(index, ele) {
|
||||
if ($(ele).prop('selected')) {
|
||||
items.push( { label: $(ele).html(), value: $(ele).attr('value') } );
|
||||
items.push({ label: $(ele).html(), value: $(ele).attr('value') });
|
||||
}
|
||||
});
|
||||
var context = $.extend({ items: items }, options, state);
|
||||
@@ -115,7 +115,6 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
* Notify of a change in the selection.
|
||||
*
|
||||
* @param {jQuery} originalSelect The jQuery object matching the hidden select list.
|
||||
* @return {Void}
|
||||
*/
|
||||
var notifyChange = function(originalSelect) {
|
||||
if (typeof M.core_formchangechecker !== 'undefined') {
|
||||
@@ -131,7 +130,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
* @private
|
||||
* @param {Object} options Original options for this autocomplete element.
|
||||
* @param {Object} state State variables for this autocomplete element.
|
||||
* @param {Element} The item to be deselected.
|
||||
* @param {Element} item The item to be deselected.
|
||||
* @param {Element} originalSelect The original select list.
|
||||
*/
|
||||
var deselectItem = function(options, state, item, originalSelect) {
|
||||
@@ -215,7 +214,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
// Find it's index.
|
||||
var current = suggestionsElement.children('[aria-hidden=false]').index(element);
|
||||
// Activate the next one.
|
||||
activateItem(current+1, state);
|
||||
activateItem(current + 1, state);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -237,7 +236,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
// Find it's index.
|
||||
var current = selectionsElement.children('[aria-selected=true]').index(element);
|
||||
// Activate the next one.
|
||||
activateSelection(current-1, state);
|
||||
activateSelection(current - 1, state);
|
||||
};
|
||||
/**
|
||||
* Find the index of the current active selection, and activate the next one.
|
||||
@@ -258,7 +257,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
// Find it's index.
|
||||
var current = selectionsElement.children('[aria-selected=true]').index(element);
|
||||
// Activate the next one.
|
||||
activateSelection(current+1, state);
|
||||
activateSelection(current + 1, state);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -276,7 +275,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
// Find it's index.
|
||||
var current = suggestionsElement.children('[aria-hidden=false]').index(element);
|
||||
// Activate the next one.
|
||||
activateItem(current-1, state);
|
||||
activateItem(current - 1, state);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -690,13 +689,14 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
* Turn a boring select box into an auto-complete beast.
|
||||
*
|
||||
* @method enhance
|
||||
* @param {string} select The selector that identifies the select box.
|
||||
* @param {string} selector The selector that identifies the select box.
|
||||
* @param {boolean} tags Whether to allow support for tags (can define new entries).
|
||||
* @param {string} ajax Name of an AMD module to handle ajax requests. If specified, the AMD
|
||||
* module must expose 2 functions "transport" and "processResults".
|
||||
* These are modeled on Select2 see: https://select2.github.io/options.html#ajax
|
||||
* @param {String} placeholder - The text to display before a selection is made.
|
||||
* @param {Boolean} caseSensitive - If search has to be made case sensitive.
|
||||
* @param {Boolean} showSuggestions - If suggestions should be shown
|
||||
* @param {String} noSelectionString - Text to display when there is no selection
|
||||
*/
|
||||
enhance: function(selector, tags, ajax, placeholder, caseSensitive, showSuggestions, noSelectionString) {
|
||||
@@ -723,7 +723,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
options.showSuggestions = showSuggestions;
|
||||
}
|
||||
if (typeof noSelectionString === "undefined") {
|
||||
str.get_string('noselection', 'form').done(function (result) {
|
||||
str.get_string('noselection', 'form').done(function(result) {
|
||||
options.noSelectionString = result;
|
||||
}).fail(notification.exception);
|
||||
}
|
||||
@@ -732,7 +732,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
var originalSelect = $(selector);
|
||||
if (!originalSelect) {
|
||||
log.debug('Selector not found: ' + selector);
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide the original select.
|
||||
|
||||
@@ -50,7 +50,7 @@ define(['jquery', 'core/ajax'], function($, ajax) {
|
||||
|
||||
var promises = ajax.call([{
|
||||
methodname: 'core_get_fragment',
|
||||
args:{
|
||||
args: {
|
||||
component: component,
|
||||
callback: callback,
|
||||
contextid: contextid,
|
||||
|
||||
@@ -46,7 +46,7 @@ define(['core/config'], function(config) {
|
||||
// Disable cache if debugging.
|
||||
return false;
|
||||
}
|
||||
if (typeof(window.localStorage) === "undefined") {
|
||||
if (typeof (window.localStorage) === "undefined") {
|
||||
return false;
|
||||
}
|
||||
var testKey = 'test';
|
||||
@@ -99,8 +99,8 @@ define(['core/config'], function(config) {
|
||||
* Hash a string, used to make shorter key prefixes.
|
||||
*
|
||||
* @method hashString
|
||||
* @param string source The string to hash
|
||||
* @return int The int hash
|
||||
* @param {String} source The string to hash
|
||||
* @return {Number}
|
||||
*/
|
||||
var hashString = function(source) {
|
||||
// From http://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript-jquery.
|
||||
@@ -111,8 +111,8 @@ define(['core/config'], function(config) {
|
||||
return hash;
|
||||
}
|
||||
for (i = 0, len = source.length; i < len; i++) {
|
||||
chr = source.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash) + chr;
|
||||
chr = source.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash) + chr;
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
return hash;
|
||||
|
||||
+3
-3
@@ -25,10 +25,10 @@
|
||||
*/
|
||||
define(['core/loglevel'], function(log) {
|
||||
var originalFactory = log.methodFactory;
|
||||
log.methodFactory = function (methodName, logLevel) {
|
||||
log.methodFactory = function(methodName, logLevel) {
|
||||
var rawMethod = originalFactory(methodName, logLevel);
|
||||
|
||||
return function (message, source) {
|
||||
return function(message, source) {
|
||||
if (source) {
|
||||
rawMethod(source + ": " + message);
|
||||
} else {
|
||||
@@ -40,7 +40,7 @@ define(['core/loglevel'], function(log) {
|
||||
/**
|
||||
* Set default config settings.
|
||||
*
|
||||
* @param {String} level The level to use.
|
||||
* @param {Object} config including the level to use.
|
||||
* @method setConfig
|
||||
*/
|
||||
log.setConfig = function(config) {
|
||||
|
||||
@@ -97,7 +97,7 @@ function(Y, $, log) {
|
||||
if (notification.template) {
|
||||
template = notification.template;
|
||||
delete notification.template;
|
||||
} else if (notification.type){
|
||||
} else if (notification.type) {
|
||||
if (typeof notificationModule.types[notification.type] !== 'undefined') {
|
||||
template = notificationModule.types[notification.type];
|
||||
}
|
||||
@@ -126,10 +126,10 @@ function(Y, $, log) {
|
||||
alert: function(title, message, yesLabel) {
|
||||
// Here we are wrapping YUI. This allows us to start transitioning, but
|
||||
// wait for a good alternative without having inconsistent dialogues.
|
||||
Y.use('moodle-core-notification-alert', function () {
|
||||
Y.use('moodle-core-notification-alert', function() {
|
||||
var alert = new M.core.alert({
|
||||
title : title,
|
||||
message : message,
|
||||
title: title,
|
||||
message: message,
|
||||
yesLabel: yesLabel
|
||||
});
|
||||
|
||||
@@ -140,10 +140,10 @@ function(Y, $, log) {
|
||||
confirm: function(title, question, yesLabel, noLabel, yesCallback, noCallback) {
|
||||
// Here we are wrapping YUI. This allows us to start transitioning, but
|
||||
// wait for a good alternative without having inconsistent dialogues.
|
||||
Y.use('moodle-core-notification-confirm', function () {
|
||||
Y.use('moodle-core-notification-confirm', function() {
|
||||
var modal = new M.core.confirm({
|
||||
title : title,
|
||||
question : question,
|
||||
title: title,
|
||||
question: question,
|
||||
yesLabel: yesLabel,
|
||||
noLabel: noLabel
|
||||
});
|
||||
@@ -169,7 +169,7 @@ function(Y, $, log) {
|
||||
ex.stack = ex.debuginfo;
|
||||
ex.name = ex.errorcode;
|
||||
}
|
||||
Y.use('moodle-core-notification-exception', function () {
|
||||
Y.use('moodle-core-notification-exception', function() {
|
||||
var modal = new M.core.exception(ex);
|
||||
|
||||
modal.show();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
/**
|
||||
* @module admin/permissionmanager
|
||||
*/
|
||||
define(['jquery', 'core/config','core/notification', 'core/templates'], function($, config, notification, templates) {
|
||||
define(['jquery', 'core/config', 'core/notification', 'core/templates'], function($, config, notification, templates) {
|
||||
|
||||
/**
|
||||
* Used CSS selectors
|
||||
@@ -54,7 +54,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
sesskey: config.sesskey
|
||||
};
|
||||
|
||||
$.post(adminurl + 'roles/ajax.php', params, function() {})
|
||||
$.post(adminurl + 'roles/ajax.php', params)
|
||||
.done(function(data) {
|
||||
try {
|
||||
overideableroles = data;
|
||||
@@ -62,8 +62,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
$('body').trigger(rolesloadedevent);
|
||||
};
|
||||
loadOverideableRoles();
|
||||
}
|
||||
catch(err) {
|
||||
} catch (err) {
|
||||
notification.exception(err);
|
||||
}
|
||||
})
|
||||
@@ -77,7 +76,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
*
|
||||
* @access private
|
||||
* @method changePermissions
|
||||
* @param {jquery node} row
|
||||
* @param {JQuery} row
|
||||
* @param {int} roleid
|
||||
* @param {string} action
|
||||
*/
|
||||
@@ -89,7 +88,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
action: action,
|
||||
capability: row.data('name')
|
||||
};
|
||||
$.post(adminurl + 'roles/ajax.php', params, function() {})
|
||||
$.post(adminurl + 'roles/ajax.php', params)
|
||||
.done(function(data) {
|
||||
var action = data;
|
||||
try {
|
||||
@@ -118,11 +117,11 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
default:
|
||||
return;
|
||||
}
|
||||
templates.render('core/permissionmanager_role',templatedata)
|
||||
.done(function (content) {
|
||||
if (action == 'allow'){
|
||||
templates.render('core/permissionmanager_role', templatedata)
|
||||
.done(function(content) {
|
||||
if (action == 'allow') {
|
||||
$(content).insertBefore(row.find('.allowmore:first'));
|
||||
}else if (action == 'prohibit'){
|
||||
} else if (action == 'prohibit') {
|
||||
$(content).insertBefore(row.find('.prohibitmore:first'));
|
||||
// Remove allowed link
|
||||
var allowedLink = row.find('.allowedroles').first().find('a[data-role-id="' + roleid + '"]');
|
||||
@@ -133,8 +132,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
panel.hide();
|
||||
})
|
||||
.fail(notification.exception);
|
||||
}
|
||||
catch(err) {
|
||||
} catch (err) {
|
||||
notification.exception(err);
|
||||
}
|
||||
})
|
||||
@@ -150,7 +148,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
* @method handleAddRole
|
||||
* @param {event} e
|
||||
*/
|
||||
var handleAddRole = function(e){
|
||||
var handleAddRole = function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$('body').one('rolesloaded', function() {
|
||||
@@ -162,8 +160,8 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
context: contextname
|
||||
};
|
||||
var message = M.util.get_string('role' + action + 'info', 'core_role', confirmationDetails);
|
||||
if (panel === null){
|
||||
panel = new M.core.dialogue ({
|
||||
if (panel === null) {
|
||||
panel = new M.core.dialogue({
|
||||
draggable: true,
|
||||
modal: true,
|
||||
closeButton: true,
|
||||
@@ -175,7 +173,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
var i, existingrolelinks;
|
||||
|
||||
var roles = [];
|
||||
switch (action){
|
||||
switch (action) {
|
||||
case 'allow':
|
||||
existingrolelinks = row.find(SELECTORS.REMOVEROLE);
|
||||
break;
|
||||
@@ -186,18 +184,18 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
for (i in overideableroles) {
|
||||
var disabled = '';
|
||||
var disable = existingrolelinks.filter("[data-role-id='" + i + "']").length;
|
||||
if (disable){
|
||||
if (disable) {
|
||||
disabled = 'disabled';
|
||||
}
|
||||
var roledetails = {roleid:i, rolename: overideableroles[i], disabled:disabled};
|
||||
var roledetails = {roleid: i, rolename: overideableroles[i], disabled: disabled};
|
||||
roles.push(roledetails);
|
||||
}
|
||||
|
||||
templates.render('core/permissionmanager_panelcontent',{message:message, roles:roles})
|
||||
.done(function (content) {
|
||||
templates.render('core/permissionmanager_panelcontent', {message: message, roles: roles})
|
||||
.done(function(content) {
|
||||
panel.set('bodyContent', content);
|
||||
panel.show();
|
||||
$('div.role_buttons').delegate('input', 'click',function(e){
|
||||
$('div.role_buttons').delegate('input', 'click', function(e) {
|
||||
var roleid = $(e.currentTarget).data('role-id');
|
||||
changePermissions(row, roleid, action);
|
||||
});
|
||||
@@ -215,7 +213,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
* @method handleRemoveRole
|
||||
* @param {event} e
|
||||
*/
|
||||
var handleRemoveRole = function(e){
|
||||
var handleRemoveRole = function(e) {
|
||||
e.preventDefault();
|
||||
$('body').one('rolesloaded', function() {
|
||||
var link = $(e.currentTarget);
|
||||
@@ -229,10 +227,10 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
};
|
||||
|
||||
notification.confirm(M.util.get_string('confirmunassigntitle', 'core_role'),
|
||||
M.util.get_string('confirmrole' + action, 'core_role',questionDetails),
|
||||
M.util.get_string('confirmrole' + action, 'core_role', questionDetails),
|
||||
M.util.get_string('confirmunassignyes', 'core_role'),
|
||||
M.util.get_string('confirmunassignno', 'core_role'),
|
||||
function(){
|
||||
function() {
|
||||
changePermissions(row, roleid, action);
|
||||
}
|
||||
);
|
||||
@@ -244,11 +242,9 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
/**
|
||||
* Initialize permissionmanager
|
||||
* @access public
|
||||
* @param {int} contextid
|
||||
* @param {string} contextname
|
||||
* @param {string} adminurl
|
||||
* @param {Object} args
|
||||
*/
|
||||
initialize : function(args) {
|
||||
initialize: function(args) {
|
||||
contextid = args.contextid;
|
||||
contextname = args.contextname;
|
||||
adminurl = args.adminurl;
|
||||
@@ -257,4 +253,4 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
|
||||
body.delegate(SELECTORS.REMOVEROLE, 'click', handleRemoveRole);
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
@@ -39,6 +39,7 @@ define(['jquery', 'core/ajax', 'core/localstorage'], function($, ajax, storage)
|
||||
* @param {string} lang The users language - if not passed it is deduced.
|
||||
* @return {Promise}
|
||||
*/
|
||||
// eslint-disable-next-line camelcase
|
||||
get_string: function(key, component, param, lang) {
|
||||
var request = this.get_strings([{
|
||||
key: key,
|
||||
@@ -60,6 +61,7 @@ define(['jquery', 'core/ajax', 'core/localstorage'], function($, ajax, storage)
|
||||
* See get_string for more info on these args.
|
||||
* @return {Promise}
|
||||
*/
|
||||
// eslint-disable-next-line camelcase
|
||||
get_strings: function(requests) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
+55
-51
@@ -35,10 +35,14 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
// Click handler for changing tag type.
|
||||
$('body').delegate('.tagarea[data-ta] a[data-quickload=1]', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
var target = $( this ),
|
||||
var target = $(this),
|
||||
query = target.context.search.replace(/^\?/, ''),
|
||||
tagarea = target.closest('.tagarea[data-ta]'),
|
||||
args = query.split('&').reduce(function(s,c){var t=c.split('=');s[t[0]]=decodeURIComponent(t[1]);return s;},{});
|
||||
args = query.split('&').reduce(function(s, c) {
|
||||
var t = c.split('=');
|
||||
s[t[0]] = decodeURIComponent(t[1]);
|
||||
return s;
|
||||
}, {});
|
||||
|
||||
var promises = ajax.call([{
|
||||
methodname: 'core_tag_get_tagindex',
|
||||
@@ -46,7 +50,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
}], true);
|
||||
|
||||
$.when.apply($, promises)
|
||||
.done( function(data) {
|
||||
.done(function(data) {
|
||||
templates.render('core_tag/index', data).done(function(html) {
|
||||
tagarea.replaceWith(html);
|
||||
});
|
||||
@@ -81,10 +85,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
e.preventDefault();
|
||||
var href = $(this).attr('href');
|
||||
str.get_strings([
|
||||
{key : 'delete'},
|
||||
{key : 'confirmdeletetag', component : 'tag'},
|
||||
{key : 'yes'},
|
||||
{key : 'no'},
|
||||
{key: 'delete'},
|
||||
{key: 'confirmdeletetag', component: 'tag'},
|
||||
{key: 'yes'},
|
||||
{key: 'no'},
|
||||
]).done(function(s) {
|
||||
notification.confirm(s[0], s[1], s[2], s[3], function() {
|
||||
window.location.href = href;
|
||||
@@ -94,7 +98,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
});
|
||||
|
||||
// Confirmation for bulk tag delete button.
|
||||
$("#tag-management-delete").click(function(e){
|
||||
$("#tag-management-delete").click(function(e) {
|
||||
var form = $(this).closest('form').get(0),
|
||||
cnt = $(form).find("input[type=checkbox]:checked").length;
|
||||
if (!cnt) {
|
||||
@@ -103,10 +107,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
var tempElement = $("<input type='hidden'/>").attr('name', this.name);
|
||||
e.preventDefault();
|
||||
str.get_strings([
|
||||
{key : 'delete'},
|
||||
{key : 'confirmdeletetags', component : 'tag'},
|
||||
{key : 'yes'},
|
||||
{key : 'no'},
|
||||
{key: 'delete'},
|
||||
{key: 'confirmdeletetags', component: 'tag'},
|
||||
{key: 'yes'},
|
||||
{key: 'no'},
|
||||
]).done(function(s) {
|
||||
notification.confirm(s[0], s[1], s[2], s[3], function() {
|
||||
tempElement.appendTo(form);
|
||||
@@ -117,15 +121,15 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
});
|
||||
|
||||
// Confirmation for bulk tag combine button.
|
||||
$("#tag-management-combine").click(function(e){
|
||||
$("#tag-management-combine").click(function(e) {
|
||||
e.preventDefault();
|
||||
var form = $(this).closest('form').get(0),
|
||||
tags = $(form).find("input[type=checkbox]:checked");
|
||||
if (tags.length <= 1) {
|
||||
str.get_strings([
|
||||
{key : 'combineselected', component : 'tag'},
|
||||
{key : 'selectmultipletags', component : 'tag'},
|
||||
{key : 'ok'},
|
||||
{key: 'combineselected', component: 'tag'},
|
||||
{key: 'selectmultipletags', component: 'tag'},
|
||||
{key: 'ok'},
|
||||
]).done(function(s) {
|
||||
notification.alert(s[0], s[1], s[2]);
|
||||
}
|
||||
@@ -134,14 +138,14 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
}
|
||||
var tempElement = $("<input type='hidden'/>").attr('name', this.name);
|
||||
str.get_strings([
|
||||
{key : 'combineselected', component : 'tag'},
|
||||
{key : 'selectmaintag', component : 'tag'},
|
||||
{key : 'continue'},
|
||||
{key : 'cancel'},
|
||||
{key: 'combineselected', component: 'tag'},
|
||||
{key: 'selectmaintag', component: 'tag'},
|
||||
{key: 'continue'},
|
||||
{key: 'cancel'},
|
||||
]).done(function(s) {
|
||||
var el = $('<div><form id="combinetags_form" class="form-inline">'+
|
||||
var el = $('<div><form id="combinetags_form" class="form-inline">' +
|
||||
'<p class="description"></p><p class="options"></p>' +
|
||||
'<p class="mdl-align"><input type="submit" id="combinetags_submit"/>'+
|
||||
'<p class="mdl-align"><input type="submit" id="combinetags_submit"/>' +
|
||||
'<input type="button" id="combinetags_cancel"/></p>' +
|
||||
'</form></div>');
|
||||
el.find('.description').html(s[1]);
|
||||
@@ -150,11 +154,11 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
var fldset = el.find('.options');
|
||||
tags.each(function() {
|
||||
var tagid = $(this).val(),
|
||||
tagname = $('.inplaceeditable[data-itemtype=tagname][data-itemid='+tagid+']').attr('data-value');
|
||||
fldset.append($('<input type="radio" name="maintag" id="combinetags_maintag_'+tagid+'" value="'+tagid+
|
||||
'"/><label for="combinetags_maintag_'+tagid+'">'+tagname+'</label><br>'));
|
||||
tagname = $('.inplaceeditable[data-itemtype=tagname][data-itemid=' + tagid + ']').attr('data-value');
|
||||
fldset.append($('<input type="radio" name="maintag" id="combinetags_maintag_' + tagid + '" value="' +
|
||||
tagid + '"/><label for="combinetags_maintag_' + tagid + '">' + tagname + '</label><br>'));
|
||||
});
|
||||
var panel = new M.core.dialogue ({
|
||||
var panel = new M.core.dialogue({
|
||||
draggable: true,
|
||||
modal: true,
|
||||
closeButton: true,
|
||||
@@ -184,9 +188,9 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
if (exception.errorcode === 'namesalreadybeeingused') {
|
||||
e.preventDefault(); // This will prevent default error dialogue.
|
||||
str.get_strings([
|
||||
{key : 'nameuseddocombine', component : 'tag'},
|
||||
{key : 'yes'},
|
||||
{key : 'cancel'},
|
||||
{key: 'nameuseddocombine', component: 'tag'},
|
||||
{key: 'yes'},
|
||||
{key: 'cancel'},
|
||||
]).done(function(s) {
|
||||
notification.confirm(e.message, s[0], s[1], s[2], function() {
|
||||
window.location.href = window.location.href + "&newname=" + encodeURIComponent(newvalue) +
|
||||
@@ -201,10 +205,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
$('body').on('click', 'a[data-action=addstandardtag]', function(e) {
|
||||
e.preventDefault();
|
||||
str.get_strings([
|
||||
{key : 'addotags', component : 'tag'},
|
||||
{key : 'inputstandardtags', component : 'tag'},
|
||||
{key : 'continue'},
|
||||
{key : 'cancel'},
|
||||
{key: 'addotags', component: 'tag'},
|
||||
{key: 'inputstandardtags', component: 'tag'},
|
||||
{key: 'continue'},
|
||||
{key: 'cancel'},
|
||||
]).done(function(s) {
|
||||
var el = $('<div><form id="addtags_form" class="form-inline" method="POST">' +
|
||||
'<input type="hidden" name="action" value="addstandardtag"/>' +
|
||||
@@ -217,7 +221,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
el.find('#addtags_form').attr('action', window.location.href);
|
||||
el.find('#addtags_submit').attr('value', s[2]);
|
||||
el.find('#addtags_cancel').attr('value', s[3]);
|
||||
var panel = new M.core.dialogue ({
|
||||
var panel = new M.core.dialogue({
|
||||
draggable: true,
|
||||
modal: true,
|
||||
closeButton: true,
|
||||
@@ -244,12 +248,12 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
areaid, collid, isenabled;
|
||||
if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareaenable') {
|
||||
areaid = $(this).attr('data-itemid');
|
||||
$(".tag-collections-table ul[data-collectionid] li[data-areaid="+areaid+"]").addClass('hidden');
|
||||
$(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").addClass('hidden');
|
||||
isenabled = ajaxreturn.value;
|
||||
if (isenabled === '1') {
|
||||
$(this).closest('tr').removeClass('dimmed_text');
|
||||
collid = $(this).closest('tr').find('[data-itemtype="tagareacollection"]').attr("data-value");
|
||||
$(".tag-collections-table ul[data-collectionid="+collid+"] li[data-areaid="+areaid+"]")
|
||||
$(".tag-collections-table ul[data-collectionid=" + collid + "] li[data-areaid=" + areaid + "]")
|
||||
.removeClass('hidden');
|
||||
} else {
|
||||
$(this).closest('tr').addClass('dimmed_text');
|
||||
@@ -257,11 +261,11 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
}
|
||||
if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareacollection') {
|
||||
areaid = $(this).attr('data-itemid');
|
||||
$(".tag-collections-table ul[data-collectionid] li[data-areaid="+areaid+"]").addClass('hidden');
|
||||
$(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").addClass('hidden');
|
||||
collid = $(this).attr('data-value');
|
||||
isenabled = $(this).closest('tr').find('[data-itemtype="tagareaenable"]').attr("data-value");
|
||||
if (isenabled === "1") {
|
||||
$(".tag-collections-table ul[data-collectionid="+collid+"] li[data-areaid="+areaid+"]")
|
||||
$(".tag-collections-table ul[data-collectionid=" + collid + "] li[data-areaid=" + areaid + "]")
|
||||
.removeClass('hidden');
|
||||
}
|
||||
}
|
||||
@@ -271,25 +275,25 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
e.preventDefault();
|
||||
var href = $(this).attr('data-url') + '&sesskey=' + M.cfg.sesskey;
|
||||
str.get_strings([
|
||||
{key : 'addtagcoll', component : 'tag'},
|
||||
{key : 'name'},
|
||||
{key : 'searchable', component : 'tag'},
|
||||
{key : 'create'},
|
||||
{key : 'cancel'},
|
||||
{key: 'addtagcoll', component: 'tag'},
|
||||
{key: 'name'},
|
||||
{key: 'searchable', component: 'tag'},
|
||||
{key: 'create'},
|
||||
{key: 'cancel'},
|
||||
]).done(function(s) {
|
||||
var el = $('<div><form id="addtagcoll_form" class="form-inline">'+
|
||||
var el = $('<div><form id="addtagcoll_form" class="form-inline">' +
|
||||
'<p><label for="addtagcoll_name"></label>: ' +
|
||||
'<input id="addtagcoll_name" type="text"/></p>' +
|
||||
'<p><label for="addtagcoll_searchable"></label>: ' +
|
||||
'<input id="addtagcoll_searchable" type="checkbox" value="1" checked/></p>' +
|
||||
'<p class="mdl-align"><input type="submit" id="addtagcoll_submit"/>'+
|
||||
'<p class="mdl-align"><input type="submit" id="addtagcoll_submit"/>' +
|
||||
'<input type="button" id="addtagcoll_cancel"/></p>' +
|
||||
'</form></div>');
|
||||
el.find('label[for="addtagcoll_name"]').html(s[1]);
|
||||
el.find('label[for="addtagcoll_searchable"]').html(s[2]);
|
||||
el.find('#addtagcoll_submit').attr('value', s[3]);
|
||||
el.find('#addtagcoll_cancel').attr('value', s[4]);
|
||||
var panel = new M.core.dialogue ({
|
||||
var panel = new M.core.dialogue({
|
||||
draggable: true,
|
||||
modal: true,
|
||||
closeButton: true,
|
||||
@@ -318,10 +322,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
e.preventDefault();
|
||||
var href = $(this).attr('data-url') + '&sesskey=' + M.cfg.sesskey;
|
||||
str.get_strings([
|
||||
{key : 'delete'},
|
||||
{key : 'suredeletecoll', component : 'tag', param : $(this).attr('data-collname') },
|
||||
{key : 'yes'},
|
||||
{key : 'no'},
|
||||
{key: 'delete'},
|
||||
{key: 'suredeletecoll', component: 'tag', param: $(this).attr('data-collname') },
|
||||
{key: 'yes'},
|
||||
{key: 'no'},
|
||||
]).done(function(s) {
|
||||
notification.confirm(s[0], s[1], s[2], s[3], function() {
|
||||
window.location.href = href;
|
||||
@@ -331,4 +335,4 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
+27
-14
@@ -23,7 +23,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since 2.9
|
||||
*/
|
||||
define([ 'core/mustache',
|
||||
define(['core/mustache',
|
||||
'jquery',
|
||||
'core/ajax',
|
||||
'core/str',
|
||||
@@ -62,6 +62,7 @@ define([ 'core/mustache',
|
||||
* @param {string} templateName - should consist of the component and the name of the template like this:
|
||||
* core/menu (lib/templates/menu.mustache) or
|
||||
* tool_bananas/yellow (admin/tool/bananas/templates/yellow.mustache)
|
||||
* @param {Boolean} async If false - this function will not return until the promises are resolved.
|
||||
* @return {Promise} JQuery promise object resolved when the template has been fetched.
|
||||
*/
|
||||
var getTemplate = function(templateName, async) {
|
||||
@@ -90,7 +91,7 @@ define([ 'core/mustache',
|
||||
// Oh well - load via ajax.
|
||||
var promises = ajax.call([{
|
||||
methodname: 'core_output_load_template',
|
||||
args:{
|
||||
args: {
|
||||
component: component,
|
||||
template: name,
|
||||
themename: currentThemeName
|
||||
@@ -98,13 +99,13 @@ define([ 'core/mustache',
|
||||
}], async, false);
|
||||
|
||||
promises[0].done(
|
||||
function (templateSource) {
|
||||
function(templateSource) {
|
||||
storage.set('core_template/' + searchKey, templateSource);
|
||||
templateCache[searchKey] = templateSource;
|
||||
deferred.resolve(templateSource);
|
||||
}
|
||||
).fail(
|
||||
function (ex) {
|
||||
function(ex) {
|
||||
deferred.reject(ex);
|
||||
}
|
||||
);
|
||||
@@ -259,11 +260,19 @@ define([ 'core/mustache',
|
||||
requiredStrings = [];
|
||||
requiredJS = [];
|
||||
context.uniqid = uniqid++;
|
||||
context.str = function() { return stringHelper; };
|
||||
context.pix = function() { return pixHelper; };
|
||||
context.js = function() { return jsHelper; };
|
||||
context.quote = function() { return quoteHelper; };
|
||||
context.globals = { config : config };
|
||||
context.str = function() {
|
||||
return stringHelper;
|
||||
};
|
||||
context.pix = function() {
|
||||
return pixHelper;
|
||||
};
|
||||
context.js = function() {
|
||||
return jsHelper;
|
||||
};
|
||||
context.quote = function() {
|
||||
return quoteHelper;
|
||||
};
|
||||
context.globals = { config: config };
|
||||
context.currentTheme = themeName;
|
||||
};
|
||||
|
||||
@@ -414,7 +423,7 @@ define([ 'core/mustache',
|
||||
*/
|
||||
var runTemplateJS = function(source) {
|
||||
if (source.trim() !== '') {
|
||||
var newscript = $('<script>').attr('type','text/javascript').html(source);
|
||||
var newscript = $('<script>').attr('type', 'text/javascript').html(source);
|
||||
$('head').append(newscript);
|
||||
}
|
||||
};
|
||||
@@ -521,20 +530,24 @@ define([ 'core/mustache',
|
||||
* Replace a node in the page with some new HTML and run the JS.
|
||||
*
|
||||
* @method replaceNodeContents
|
||||
* @param {string} source - A block of javascript.
|
||||
* @param {JQuery} element - Element or selector to replace.
|
||||
* @param {String} newHTML - HTML to insert / replace.
|
||||
* @param {String} newJS - Javascript to run after the insertion.
|
||||
*/
|
||||
replaceNodeContents: function(element, newHTML, newJS) {
|
||||
return domReplace(element, newHTML, newJS, true);
|
||||
domReplace(element, newHTML, newJS, true);
|
||||
},
|
||||
|
||||
/**
|
||||
* Insert a node in the page with some new HTML and run the JS.
|
||||
*
|
||||
* @method replaceNode
|
||||
* @param {string} source - A block of javascript.
|
||||
* @param {JQuery} element - Element or selector to replace.
|
||||
* @param {String} newHTML - HTML to insert / replace.
|
||||
* @param {String} newJS - Javascript to run after the insertion.
|
||||
*/
|
||||
replaceNode: function(element, newHTML, newJS) {
|
||||
return domReplace(element, newHTML, newJS, false);
|
||||
domReplace(element, newHTML, newJS, false);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
+13
-3
@@ -83,6 +83,7 @@ define(['jquery'], function($) {
|
||||
* Get all visible tree items.
|
||||
*
|
||||
* @method getVisibleItems
|
||||
* @return {Object} visible items
|
||||
*/
|
||||
Tree.prototype.getVisibleItems = function() {
|
||||
return this.treeRoot.data('visibleItems');
|
||||
@@ -340,6 +341,7 @@ define(['jquery'], function($) {
|
||||
* @method handleKeyDown
|
||||
* @param {Object} item is the jquery id of the parent item of the group.
|
||||
* @param {Event} e The event.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Tree.prototype.handleKeyDown = function(item, e) {
|
||||
var currentIndex = this.getVisibleItems().index(item);
|
||||
@@ -459,6 +461,7 @@ define(['jquery'], function($) {
|
||||
* @method handleClick
|
||||
* @param {Object} item The jquery id of the parent item of the group.
|
||||
* @param {Event} e The event.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Tree.prototype.handleClick = function(item, e) {
|
||||
|
||||
@@ -485,6 +488,7 @@ define(['jquery'], function($) {
|
||||
* @method handleFocus
|
||||
* @param {Object} item The jquery id of the parent item of the group.
|
||||
* @param {Event} e The event.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Tree.prototype.handleFocus = function(item, e) {
|
||||
|
||||
@@ -505,9 +509,15 @@ define(['jquery'], function($) {
|
||||
// Bind event handlers to the tree items. Use event delegates to allow
|
||||
// for dynamically loaded parts of the tree.
|
||||
this.treeRoot.on({
|
||||
click: function(e) { return thisObj.handleClick($(this), e); },
|
||||
keydown: function(e) { return thisObj.handleKeyDown($(this), e); },
|
||||
focus: function(e) { return thisObj.handleFocus($(this), e); },
|
||||
click: function(e) {
|
||||
return thisObj.handleClick($(this), e);
|
||||
},
|
||||
keydown: function(e) {
|
||||
return thisObj.handleKeyDown($(this), e);
|
||||
},
|
||||
focus: function(e) {
|
||||
return thisObj.handleFocus($(this), e);
|
||||
},
|
||||
}, SELECTORS.ITEM);
|
||||
};
|
||||
|
||||
|
||||
+3
-2
@@ -29,10 +29,11 @@ define(['core/config'], function(config) {
|
||||
return /** @alias module:core/url */ {
|
||||
// Public variables and functions.
|
||||
/**
|
||||
* Generate a style tag referencing this sheet and add it to the head of the page.
|
||||
* Construct a file url
|
||||
*
|
||||
* @method fileUrl
|
||||
* @param {string} sheet The style sheet name. Must exist in the theme, or one of it's parents.
|
||||
* @param {string} relativeScript
|
||||
* @param {string} slashArg
|
||||
* @return {string}
|
||||
*/
|
||||
fileUrl: function(relativeScript, slashArg) {
|
||||
|
||||
@@ -39,7 +39,9 @@ define(['jquery'], function($) {
|
||||
|
||||
this._region.find('[name="savechanges"]').on('click', this._trigger.bind(this, 'save-changes'));
|
||||
this._region.find('[name="resetbutton"]').on('click', this._trigger.bind(this, 'reset'));
|
||||
this._region.find('form').on('submit', function(e) { e.preventDefault(); });
|
||||
this._region.find('form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
};
|
||||
|
||||
/** @type {String} Selector for the page region containing the user navigation. */
|
||||
@@ -58,7 +60,6 @@ define(['jquery'], function($) {
|
||||
* @private
|
||||
* @param {Event} event
|
||||
* @param {Integer} userid
|
||||
* @return {Deferred} promise resolved when the animations are complete.
|
||||
*/
|
||||
GradingActions.prototype._showActionsForm = function(event, userid) {
|
||||
var form = this._region.find('[data-region=grading-actions-form]');
|
||||
|
||||
@@ -69,10 +69,10 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
|
||||
|
||||
// We do not allow navigation while ajax requests are pending.
|
||||
|
||||
$(document).bind("start-loading-user", function(){
|
||||
$(document).bind("start-loading-user", function() {
|
||||
this._isLoading = true;
|
||||
}.bind(this));
|
||||
$(document).bind("finish-loading-user", function(){
|
||||
$(document).bind("finish-loading-user", function() {
|
||||
this._isLoading = false;
|
||||
}.bind(this));
|
||||
};
|
||||
@@ -136,7 +136,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
|
||||
*
|
||||
* @private
|
||||
* @method _checkClickOutsideConfigureFilters
|
||||
* @param {Event}
|
||||
* @param {Event} event
|
||||
*/
|
||||
GradingNavigation.prototype._checkClickOutsideConfigureFilters = function(event) {
|
||||
var configPanel = this._region.find('[data-region="configure-filters"]');
|
||||
@@ -156,7 +156,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
|
||||
*
|
||||
* @private
|
||||
* @method _filterChanged
|
||||
* @param {Event}
|
||||
* @param {Event} event
|
||||
*/
|
||||
GradingNavigation.prototype._filterChanged = function(event) {
|
||||
var name = $(event.target).attr('name');
|
||||
@@ -299,7 +299,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
|
||||
*
|
||||
* @private
|
||||
* @method _toggleExpandFilters
|
||||
* @param {Event}
|
||||
* @param {Event} event
|
||||
*/
|
||||
GradingNavigation.prototype._toggleExpandFilters = function(event) {
|
||||
event.preventDefault();
|
||||
@@ -436,7 +436,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
|
||||
*
|
||||
* @private
|
||||
* @method _handleChangeUser
|
||||
* @param {Event}
|
||||
* @param {Event} event
|
||||
*/
|
||||
GradingNavigation.prototype._handleChangeUser = function() {
|
||||
var select = this._region.find('[data-action=change-user]');
|
||||
|
||||
@@ -56,7 +56,7 @@ define(['jquery', 'core/notification', 'core/ajax', 'core/templates'], function(
|
||||
*
|
||||
* @private
|
||||
* @method _getAssignmentId
|
||||
* @return int assignment id
|
||||
* @return {Integer} assignment id
|
||||
*/
|
||||
UserInfo.prototype._getAssignmentId = function() {
|
||||
return this._region.attr('data-assignmentid');
|
||||
|
||||
@@ -100,6 +100,8 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
|
||||
* Make form submit via ajax.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} event
|
||||
* @param {Integer} nextUserId
|
||||
* @method _submitForm
|
||||
*/
|
||||
GradingPanel.prototype._submitForm = function(event, nextUserId) {
|
||||
@@ -180,6 +182,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
|
||||
* Open a picker to choose an older attempt.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} e
|
||||
* @method _chooseAttempt
|
||||
*/
|
||||
GradingPanel.prototype._chooseAttempt = function(e) {
|
||||
@@ -210,7 +213,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
|
||||
*
|
||||
* @private
|
||||
* @method _addPopoutButtons
|
||||
* @param {JQuery} region The region to add popout buttons to.
|
||||
* @param {JQuery} selector The region selector to add popout buttons to.
|
||||
*/
|
||||
GradingPanel.prototype._addPopoutButtons = function(selector) {
|
||||
var region = $(selector);
|
||||
@@ -250,7 +253,8 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
|
||||
* @method _refreshGradingPanel
|
||||
* @param {Event} event
|
||||
* @param {Number} userid
|
||||
* @param {String} serialised submission data.
|
||||
* @param {String} submissiondata serialised submission data.
|
||||
* @param {Integer} attemptnumber
|
||||
*/
|
||||
GradingPanel.prototype._refreshGradingPanel = function(event, userid, submissiondata, attemptnumber) {
|
||||
var contextid = this._region.attr('data-contextid');
|
||||
|
||||
@@ -43,7 +43,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
|
||||
*
|
||||
* @method getCartridgeURL
|
||||
* @private
|
||||
* @return string
|
||||
* @return {String}
|
||||
*/
|
||||
var getCartridgeURL = function() {
|
||||
return $(SELECTORS.REGISTRATION_FORM).attr('data-cartridge-url');
|
||||
@@ -54,7 +54,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
|
||||
*
|
||||
* @method getSubmitButton
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getSubmitButton = function() {
|
||||
return $(SELECTORS.REGISTRATION_SUBMIT_BUTTON);
|
||||
@@ -65,7 +65,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
|
||||
*
|
||||
* @method getCancelButton
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getCancelButton = function() {
|
||||
return $(SELECTORS.REGISTRATION_CANCEL_BUTTON);
|
||||
@@ -76,7 +76,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
|
||||
*
|
||||
* @method getConsumerKey
|
||||
* @private
|
||||
* @return string
|
||||
* @return {String} the value entered for consumer key.
|
||||
*/
|
||||
var getConsumerKey = function() {
|
||||
return $(SELECTORS.CONSUMER_KEY).val();
|
||||
@@ -87,7 +87,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
|
||||
*
|
||||
* @method getSharedSecret
|
||||
* @private
|
||||
* @return string
|
||||
* @return {String} the value entered for shared secret
|
||||
*/
|
||||
var getSharedSecret = function() {
|
||||
return $(SELECTORS.SHARED_SECRET).val();
|
||||
@@ -118,7 +118,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
|
||||
*
|
||||
* @method isLoading
|
||||
* @private
|
||||
* @return bool
|
||||
* @return {Boolean}
|
||||
*/
|
||||
var isLoading = function() {
|
||||
return getSubmitButton().hasClass('loading');
|
||||
@@ -134,7 +134,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
|
||||
*
|
||||
* @method submitCartridgeURL
|
||||
* @private
|
||||
* @return object jQuery deferred object
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var submitCartridgeURL = function() {
|
||||
if (isLoading()) {
|
||||
@@ -153,7 +153,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
|
||||
var promise = toolType.create({cartridgeurl: url, key: consumerKey, secret: sharedSecret});
|
||||
|
||||
promise.done(function() {
|
||||
str.get_string('successfullycreatedtooltype', 'mod_lti').done(function (s) {
|
||||
str.get_string('successfullycreatedtooltype', 'mod_lti').done(function(s) {
|
||||
$(document).trigger(ltiEvents.NEW_TOOL_TYPE);
|
||||
$(document).trigger(ltiEvents.STOP_CARTRIDGE_REGISTRATION);
|
||||
$(document).trigger(ltiEvents.REGISTRATION_FEEDBACK, {
|
||||
@@ -161,7 +161,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
|
||||
});
|
||||
}).fail(notification.exception);
|
||||
}).fail(function() {
|
||||
str.get_string('failedtocreatetooltype', 'mod_lti').done(function (s) {
|
||||
str.get_string('failedtocreatetooltype', 'mod_lti').done(function(s) {
|
||||
$(document).trigger(ltiEvents.NEW_TOOL_TYPE);
|
||||
$(document).trigger(ltiEvents.STOP_CARTRIDGE_REGISTRATION);
|
||||
$(document).trigger(ltiEvents.REGISTRATION_FEEDBACK, {
|
||||
@@ -169,7 +169,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
|
||||
error: true
|
||||
});
|
||||
}).fail(notification.exception);
|
||||
}).always(function() { stopLoading(); });
|
||||
}).always(function() {
|
||||
stopLoading();
|
||||
});
|
||||
|
||||
return promise;
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getExternalRegistrationCancelButton
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getExternalRegistrationCancelButton = function() {
|
||||
return $(SELECTORS.EXTERNAL_REGISTRATION_CANCEL_BUTTON);
|
||||
@@ -60,7 +60,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getExternalRegistrationContainer
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getExternalRegistrationContainer = function() {
|
||||
return $(SELECTORS.EXTERNAL_REGISTRATION_CONTAINER);
|
||||
@@ -72,7 +72,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getExternalRegistrationTemplateContainer
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getExternalRegistrationTemplateContainer = function() {
|
||||
return $(SELECTORS.EXTERNAL_REGISTRATION_TEMPLATE_CONTAINER);
|
||||
@@ -85,7 +85,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getToolTypeCapabilitiesContainer
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getToolTypeCapabilitiesContainer = function() {
|
||||
return $(SELECTORS.TOOL_TYPE_CAPABILITIES_CONTAINER);
|
||||
@@ -97,7 +97,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getToolTypeCapabilitiesTemplateContainer
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getToolTypeCapabilitiesTemplateContainer = function() {
|
||||
return $(SELECTORS.TOOL_TYPE_CAPABILITIES_TEMPLATE_CONTAINER);
|
||||
@@ -188,7 +188,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method setToolProxyId
|
||||
* @private
|
||||
* @param int Tool proxy ID
|
||||
* @param {Integer} id Tool proxy ID
|
||||
*/
|
||||
var setToolProxyId = function(id) {
|
||||
var button = getExternalRegistrationCancelButton();
|
||||
@@ -200,7 +200,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getToolProxyId
|
||||
* @private
|
||||
* @return string Tool proxy ID
|
||||
* @return {String} Tool proxy ID
|
||||
*/
|
||||
var getToolProxyId = function() {
|
||||
var button = getExternalRegistrationCancelButton();
|
||||
@@ -223,7 +223,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method hasToolProxyId
|
||||
* @private
|
||||
* @return bool
|
||||
* @return {Boolean}
|
||||
*/
|
||||
var hasToolProxyId = function() {
|
||||
return getToolProxyId() ? true : false;
|
||||
@@ -235,7 +235,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method hasCreatedToolProxy
|
||||
* @private
|
||||
* @return bool
|
||||
* @return {Boolean}
|
||||
*/
|
||||
var hasCreatedToolProxy = function() {
|
||||
var button = getExternalRegistrationCancelButton();
|
||||
@@ -247,7 +247,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method setProxyAsNew
|
||||
* @private
|
||||
* @return bool
|
||||
* @return {Boolean}
|
||||
*/
|
||||
var setProxyAsNew = function() {
|
||||
var button = getExternalRegistrationCancelButton();
|
||||
@@ -259,7 +259,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method setProxyAsOld
|
||||
* @private
|
||||
* @return bool
|
||||
* @return {Boolean}
|
||||
*/
|
||||
var setProxyAsOld = function() {
|
||||
var button = getExternalRegistrationCancelButton();
|
||||
@@ -274,8 +274,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getRegistrationRequest
|
||||
* @private
|
||||
* @param int Tool Proxy ID
|
||||
* @return object jQuery Deferred object
|
||||
* @param {Integer} id Tool Proxy ID
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var getRegistrationRequest = function(id) {
|
||||
var request = {
|
||||
@@ -294,7 +294,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method cancelRegistration
|
||||
* @private
|
||||
* @return object jQuery Deferred object
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var cancelRegistration = function() {
|
||||
startLoadingCancel();
|
||||
@@ -306,7 +306,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
var id = getToolProxyId();
|
||||
toolProxy.delete(id).done(function() {
|
||||
promise.resolve();
|
||||
}).fail(function (failure) {
|
||||
}).fail(function(failure) {
|
||||
promise.reject(failure);
|
||||
});
|
||||
} else {
|
||||
@@ -317,11 +317,11 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
// Return to the original page.
|
||||
finishExternalRegistration();
|
||||
stopLoadingCancel();
|
||||
}).fail(function (failure) {
|
||||
}).fail(function(failure) {
|
||||
notification.exception(failure);
|
||||
finishExternalRegistration();
|
||||
stopLoadingCancel();
|
||||
str.get_string('failedtodeletetoolproxy', 'mod_lti').done(function (s) {
|
||||
str.get_string('failedtodeletetoolproxy', 'mod_lti').done(function(s) {
|
||||
var feedback = {
|
||||
message: s,
|
||||
error: true
|
||||
@@ -338,7 +338,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method renderExternalRegistrationWindow
|
||||
* @private
|
||||
* @return object jQuery Deferred object
|
||||
* @param {Object} registrationRequest
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var renderExternalRegistrationWindow = function(registrationRequest) {
|
||||
var promise = templates.render('mod_lti/tool_proxy_registration_form', registrationRequest);
|
||||
@@ -361,9 +362,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method setTypeStatusActive
|
||||
* @private
|
||||
* @param object A set of data representing a type, as returned by a request to get a type
|
||||
* @param {Object} typeData A set of data representing a type, as returned by a request to get a type
|
||||
* from the Moodle server.
|
||||
* @return object jQuery Deferred object
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var setTypeStatusActive = function(typeData) {
|
||||
return toolType.update({
|
||||
@@ -380,9 +381,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method promptForToolTypeCapabilitiesAgreement
|
||||
* @private
|
||||
* @param object A set of data representing a type, as returned by a request to get a type
|
||||
* @param {Object} typeData A set of data representing a type, as returned by a request to get a type
|
||||
* from the Moodle server.
|
||||
* @return object jQuery Deferred object
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var promptForToolTypeCapabilitiesAgreement = function(typeData) {
|
||||
var promise = $.Deferred();
|
||||
@@ -436,8 +437,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method createAndRegisterToolProxy
|
||||
* @private
|
||||
* @param url Tool registration URL to register
|
||||
* @return object jQuery Deferred object
|
||||
* @param {String} url Tool registration URL to register
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var createAndRegisterToolProxy = function(url) {
|
||||
var promise = $.Deferred();
|
||||
@@ -476,8 +477,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method registerProxy
|
||||
* @private
|
||||
* @param id Proxy id to register
|
||||
* @return jQuery Deferred object to fail or resolve
|
||||
* @param {Integer} id Proxy id to register
|
||||
* @return {Promise} jQuery Deferred object to fail or resolve
|
||||
*/
|
||||
var registerProxy = function(id) {
|
||||
var promise = $.Deferred();
|
||||
@@ -569,7 +570,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
};
|
||||
|
||||
if (data.status == "success") {
|
||||
str.get_string('successfullycreatedtooltype', 'mod_lti').done(function (s) {
|
||||
str.get_string('successfullycreatedtooltype', 'mod_lti').done(function(s) {
|
||||
feedback.message = s;
|
||||
}).fail(notification.exception);
|
||||
|
||||
|
||||
@@ -35,11 +35,11 @@ define([], function() {
|
||||
* complete behaviour in the parent page and provide the params returned from
|
||||
* the external registration page.
|
||||
*
|
||||
* @param string message The registration message from the external registration page
|
||||
* @param string error The registration error message from the external registration page, if
|
||||
* @param {String} message The registration message from the external registration page
|
||||
* @param {String} error The registration error message from the external registration page, if
|
||||
* there was an error.
|
||||
* @param int id The tool proxy id for the external registration.
|
||||
* @param string status Whether the external registration was successful or not.
|
||||
* @param {Integer} id The tool proxy id for the external registration.
|
||||
* @param {String} status Whether the external registration was successful or not.
|
||||
*/
|
||||
init: function(message, error, id, status) {
|
||||
if (window.parent) {
|
||||
|
||||
@@ -46,8 +46,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method getDeleteButton
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getDeleteButton = function(element) {
|
||||
return element.find(SELECTORS.DELETE_BUTTON);
|
||||
@@ -58,8 +58,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method getNameElement
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getNameElement = function(element) {
|
||||
return element.find(SELECTORS.NAME_ELEMENT);
|
||||
@@ -70,8 +70,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method getDescriptionElement
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getDescriptionElement = function(element) {
|
||||
return element.find(SELECTORS.DESCRIPTION_ELEMENT);
|
||||
@@ -82,8 +82,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method getActivateButton
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery object
|
||||
* @param {Object} element jQuery object representing the tool card.
|
||||
* @return {Object} jQuery object
|
||||
*/
|
||||
var getActivateButton = function(element) {
|
||||
return element.find(SELECTORS.ACTIVATE_BUTTON);
|
||||
@@ -94,8 +94,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method hasActivateButton
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return bool
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {Boolean} true if has active buton
|
||||
*/
|
||||
var hasActivateButton = function(element) {
|
||||
return getActivateButton(element).length ? true : false;
|
||||
@@ -107,8 +107,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method getCapabilitiesContainer
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return bool
|
||||
* @param {Object} element jQuery object representing the tool card.
|
||||
* @return {Object} The element
|
||||
*/
|
||||
var getCapabilitiesContainer = function(element) {
|
||||
return element.find(SELECTORS.CAPABILITIES_CONTAINER);
|
||||
@@ -120,8 +120,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method hasCapabilitiesContainer
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return bool
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {Boolean} true if has capbilities.
|
||||
*/
|
||||
var hasCapabilitiesContainer = function(element) {
|
||||
return getCapabilitiesContainer(element).length ? true : false;
|
||||
@@ -132,8 +132,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method getTypeId
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return string Type ID
|
||||
* @param {Object} element jQuery object representing the tool card.
|
||||
* @return {String} Type ID
|
||||
*/
|
||||
var getTypeId = function(element) {
|
||||
return element.attr('data-type-id');
|
||||
@@ -144,7 +144,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method clearAllAnnouncements
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var clearAllAnnouncements = function(element) {
|
||||
element.removeClass('announcement loading success fail capabilities');
|
||||
@@ -155,7 +155,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method startLoading
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var startLoading = function(element) {
|
||||
clearAllAnnouncements(element);
|
||||
@@ -167,7 +167,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method stopLoading
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var stopLoading = function(element) {
|
||||
element.removeClass('announcement loading');
|
||||
@@ -179,8 +179,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method announceSuccess
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery Deferred object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var announceSuccess = function(element) {
|
||||
var promise = $.Deferred();
|
||||
@@ -201,8 +201,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method announceFailure
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery Deferred object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var announceFailure = function(element) {
|
||||
var promise = $.Deferred();
|
||||
@@ -223,8 +223,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method deleteType
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery Deferred object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var deleteType = function(element) {
|
||||
var promise = $.Deferred();
|
||||
@@ -272,7 +272,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
announceFailure(element);
|
||||
promise.reject(error);
|
||||
});
|
||||
}, function () {
|
||||
}, function() {
|
||||
stopLoading(element);
|
||||
promise.resolve();
|
||||
});
|
||||
@@ -291,8 +291,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method setValueSnapshot
|
||||
* @private
|
||||
* @param object jQuery object representing the element.
|
||||
* @param string value to be saved.
|
||||
* @param {JQuery} element jQuery object representing the element.
|
||||
* @param {String} value to be saved.
|
||||
*/
|
||||
var setValueSnapshot = function(element, value) {
|
||||
element.attr('data-val-snapshot', value);
|
||||
@@ -303,8 +303,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method getValueSnapshot
|
||||
* @private
|
||||
* @param object jQuery object representing the element.
|
||||
* @return string the saved value.
|
||||
* @param {JQuery} element jQuery object representing the element.
|
||||
* @return {String} the saved value.
|
||||
*/
|
||||
var getValueSnapshot = function(element) {
|
||||
return element.attr('data-val-snapshot');
|
||||
@@ -315,7 +315,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method snapshotDescription
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var snapshotDescription = function(element) {
|
||||
var descriptionElement = getDescriptionElement(element);
|
||||
@@ -334,8 +334,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method updateDescription
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery Deferred object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var updateDescription = function(element) {
|
||||
var typeId = getTypeId(element);
|
||||
@@ -375,7 +375,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
|
||||
// Probably need to handle failures better so that we can revert
|
||||
// the value in the input for the user.
|
||||
promise.fail(function() { descriptionElement.removeClass('loading'); });
|
||||
promise.fail(function() {
|
||||
descriptionElement.removeClass('loading');
|
||||
});
|
||||
|
||||
return promise;
|
||||
};
|
||||
@@ -385,7 +387,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method snapshotName
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var snapshotName = function(element) {
|
||||
var nameElement = getNameElement(element);
|
||||
@@ -404,8 +406,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method updateName
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery Deferred object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var updateName = function(element) {
|
||||
var typeId = getTypeId(element);
|
||||
@@ -443,7 +445,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
|
||||
// Probably need to handle failures better so that we can revert
|
||||
// the value in the input for the user.
|
||||
promise.fail(function() { nameElement.removeClass('loading'); });
|
||||
promise.fail(function() {
|
||||
nameElement.removeClass('loading');
|
||||
});
|
||||
|
||||
return promise;
|
||||
};
|
||||
@@ -455,8 +459,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method setStatusActive
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery Deferred object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var setStatusActive = function(element) {
|
||||
var id = getTypeId(element);
|
||||
@@ -501,7 +505,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method displayCapabilitiesApproval
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var displayCapabilitiesApproval = function(element) {
|
||||
element.addClass('announcement capabilities');
|
||||
@@ -512,7 +516,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method hideCapabilitiesApproval
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var hideCapabilitiesApproval = function(element) {
|
||||
element.removeClass('announcement capabilities');
|
||||
@@ -525,7 +529,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method activateToolType
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var activateToolType = function(element) {
|
||||
if (hasCapabilitiesContainer(element)) {
|
||||
@@ -540,7 +544,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method registerEventListeners
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var registerEventListeners = function(element) {
|
||||
var deleteButton = getDeleteButton(element);
|
||||
@@ -634,7 +638,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
/**
|
||||
* Initialise this module.
|
||||
*
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
init: function(element) {
|
||||
registerEventListeners(element);
|
||||
|
||||
@@ -46,7 +46,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getToolCreateButton
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {Object} jQuery object
|
||||
*/
|
||||
var getToolCreateButton = function() {
|
||||
return $(SELECTORS.TOOL_CREATE_BUTTON);
|
||||
@@ -57,7 +57,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getToolListContainer
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {Object} jQuery object
|
||||
*/
|
||||
var getToolListContainer = function() {
|
||||
return $(SELECTORS.TOOL_LIST_CONTAINER);
|
||||
@@ -68,7 +68,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getExternalRegistrationContainer
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {Object} jQuery object
|
||||
*/
|
||||
var getExternalRegistrationContainer = function() {
|
||||
return $(SELECTORS.EXTERNAL_REGISTRATION_CONTAINER);
|
||||
@@ -79,7 +79,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getCartridgeRegistrationContainer
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {Object} jQuery object
|
||||
*/
|
||||
var getCartridgeRegistrationContainer = function() {
|
||||
return $(SELECTORS.CARTRIDGE_REGISTRATION_CONTAINER);
|
||||
@@ -90,7 +90,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getRegistrationChoiceContainer
|
||||
* @private
|
||||
* @return object jQuery object
|
||||
* @return {Object} jQuery object
|
||||
*/
|
||||
var getRegistrationChoiceContainer = function() {
|
||||
return $(SELECTORS.REGISTRATION_CHOICE_CONTAINER);
|
||||
@@ -101,7 +101,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method getToolURL
|
||||
* @private
|
||||
* @return string
|
||||
* @return {String} the tool type url
|
||||
*/
|
||||
var getToolURL = function() {
|
||||
return $(SELECTORS.TOOL_URL).val();
|
||||
@@ -156,6 +156,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
* panels.
|
||||
*
|
||||
* @method showCartridgeRegistration
|
||||
* @param {String} url
|
||||
* @private
|
||||
*/
|
||||
var showCartridgeRegistration = function(url) {
|
||||
@@ -172,6 +173,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
* This function can be removed once JAWS supports visibility.
|
||||
*
|
||||
* @method screenReaderAnnounce
|
||||
* @param {Object} element
|
||||
* @private
|
||||
*/
|
||||
var screenReaderAnnounce = function(element) {
|
||||
@@ -218,6 +220,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
* Display the registration feedback alert and hide the other panels.
|
||||
*
|
||||
* @method showRegistrationFeedback
|
||||
* @param {Object} data
|
||||
* @private
|
||||
*/
|
||||
var showRegistrationFeedback = function(data) {
|
||||
@@ -233,7 +236,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method startLoading
|
||||
* @private
|
||||
* @param object jQuery object
|
||||
* @param {Object} element jQuery object
|
||||
*/
|
||||
var startLoading = function(element) {
|
||||
element.addClass("loading");
|
||||
@@ -244,7 +247,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method stopLoading
|
||||
* @private
|
||||
* @param object jQuery object
|
||||
* @param {Object} element jQuery object
|
||||
*/
|
||||
var stopLoading = function(element) {
|
||||
element.removeClass("loading");
|
||||
@@ -277,7 +280,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
.fail(promise.reject);
|
||||
|
||||
promise.fail(notification.exception)
|
||||
.always(function () {
|
||||
.always(function() {
|
||||
stopLoading(container);
|
||||
});
|
||||
};
|
||||
@@ -288,7 +291,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
*
|
||||
* @method addTool
|
||||
* @private
|
||||
* @return object jQuery deferred object
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var addTool = function() {
|
||||
var url = $.trim(getToolURL());
|
||||
@@ -302,7 +305,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
|
||||
var promise = toolType.isCartridge(url);
|
||||
|
||||
promise.always(function() { stopLoading(toolButton); });
|
||||
promise.always(function() {
|
||||
stopLoading(toolButton);
|
||||
});
|
||||
|
||||
promise.done(function(result) {
|
||||
if (result.iscartridge) {
|
||||
@@ -313,9 +318,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
|
||||
}
|
||||
});
|
||||
|
||||
promise.fail(function () {
|
||||
promise.fail(function() {
|
||||
str.get_string('errorbadurl', 'mod_lti')
|
||||
.done(function (s) {
|
||||
.done(function(s) {
|
||||
$(document).trigger(ltiEvents.REGISTRATION_FEEDBACK, {
|
||||
message: s,
|
||||
error: true
|
||||
|
||||
@@ -34,8 +34,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
|
||||
*
|
||||
* @method query
|
||||
* @public
|
||||
* @param object Search parameters
|
||||
* @return object jQuery deferred object
|
||||
* @param {Object} args Search parameters
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
query: function(args) {
|
||||
var request = {
|
||||
@@ -54,8 +54,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
|
||||
*
|
||||
* @method delete
|
||||
* @public
|
||||
* @param int Tool proxy ID
|
||||
* @return object jQuery deferred object
|
||||
* @param {Integer} id Tool proxy ID
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
delete: function(id) {
|
||||
var request = {
|
||||
@@ -81,8 +81,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
|
||||
*
|
||||
* @method create
|
||||
* @public
|
||||
* @param object Tool proxy properties
|
||||
* @return object jQuery deferred object
|
||||
* @param {Object} args Tool proxy properties
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
create: function(args) {
|
||||
var request = {
|
||||
|
||||
@@ -44,8 +44,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method getDeleteButton
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getDeleteButton = function(element) {
|
||||
return element.find(SELECTORS.DELETE_BUTTON);
|
||||
@@ -56,8 +56,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method getActivateButton
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {JQuery} jQuery object
|
||||
*/
|
||||
var getActivateButton = function(element) {
|
||||
return element.find(SELECTORS.ACTIVATE_BUTTON);
|
||||
@@ -68,8 +68,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method getTypeId
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return string Type ID
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {String} Type ID
|
||||
*/
|
||||
var getTypeId = function(element) {
|
||||
return element.attr('data-proxy-id');
|
||||
@@ -80,7 +80,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method clearAllAnnouncements
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var clearAllAnnouncements = function(element) {
|
||||
element.removeClass('announcement loading success fail capabilities');
|
||||
@@ -91,7 +91,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method startLoading
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var startLoading = function(element) {
|
||||
clearAllAnnouncements(element);
|
||||
@@ -103,7 +103,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method stopLoading
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var stopLoading = function(element) {
|
||||
element.removeClass('announcement loading');
|
||||
@@ -115,8 +115,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method announceSuccess
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery Deferred object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var announceSuccess = function(element) {
|
||||
var promise = $.Deferred();
|
||||
@@ -137,8 +137,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method announceFailure
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery Deferred object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var announceFailure = function(element) {
|
||||
var promise = $.Deferred();
|
||||
@@ -159,8 +159,8 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method deleteType
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @return object jQuery Deferred object
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
var deleteType = function(element) {
|
||||
var promise = $.Deferred();
|
||||
@@ -205,7 +205,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
announceFailure(element);
|
||||
promise.reject(error);
|
||||
});
|
||||
}, function () {
|
||||
}, function() {
|
||||
stopLoading(element);
|
||||
promise.resolve();
|
||||
});
|
||||
@@ -226,7 +226,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method activateToolType
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var activateToolType = function(element) {
|
||||
var data = {proxyid: getTypeId(element)};
|
||||
@@ -238,7 +238,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
*
|
||||
* @method registerEventListeners
|
||||
* @private
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
var registerEventListeners = function(element) {
|
||||
var deleteButton = getDeleteButton(element);
|
||||
@@ -275,7 +275,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
|
||||
/**
|
||||
* Initialise this module.
|
||||
*
|
||||
* @param object jQuery object representing the tool card.
|
||||
* @param {JQuery} element jQuery object representing the tool card.
|
||||
*/
|
||||
init: function(element) {
|
||||
registerEventListeners(element);
|
||||
|
||||
@@ -34,8 +34,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
|
||||
*
|
||||
* @method query
|
||||
* @public
|
||||
* @param object Search parameters
|
||||
* @return object jQuery deferred object
|
||||
* @param {Object} args Search parameters
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
query: function(args) {
|
||||
var request = {
|
||||
@@ -60,8 +60,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
|
||||
*
|
||||
* @method create
|
||||
* @public
|
||||
* @param object Tool type properties
|
||||
* @return object jQuery deferred object
|
||||
* @param {Object} args Tool type properties
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
create: function(args) {
|
||||
var request = {
|
||||
@@ -82,8 +82,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
|
||||
*
|
||||
* @method update
|
||||
* @public
|
||||
* @param object Tool type properties
|
||||
* @return object jQuery deferred object
|
||||
* @param {Object} args Tool type properties
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
update: function(args) {
|
||||
var request = {
|
||||
@@ -103,8 +103,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
|
||||
*
|
||||
* @method delete
|
||||
* @public
|
||||
* @param int Tool type ID
|
||||
* @return object jQuery deferred object
|
||||
* @param {Integer} id Tool type ID
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
delete: function(id) {
|
||||
var request = {
|
||||
@@ -127,8 +127,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
|
||||
*
|
||||
* @method query
|
||||
* @public
|
||||
* @param int Tool proxty id
|
||||
* @return object jQuery deferred object
|
||||
* @param {Integer} id Tool type ID
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
getFromToolProxyId: function(id) {
|
||||
return this.query({toolproxyid: id});
|
||||
@@ -141,8 +141,8 @@ define(['core/ajax', 'core/notification'], function(ajax, notification) {
|
||||
*
|
||||
* @method isCartridge
|
||||
* @public
|
||||
* @param string URL
|
||||
* @return object jQuery deferred object
|
||||
* @param {String} url
|
||||
* @return {Promise} jQuery Deferred object
|
||||
*/
|
||||
isCartridge: function(url) {
|
||||
var request = {
|
||||
|
||||
@@ -37,7 +37,7 @@ define(['jquery', 'core/yui'], function($, Y) {
|
||||
/**
|
||||
* Initialise the start attempt button.
|
||||
*
|
||||
* @param {String} startButtonId the id of the start attempt button that we will be enhancing.
|
||||
* @param {String} startButton the id of the start attempt button that we will be enhancing.
|
||||
* @param {String} confirmationTitle the title of the dialogue.
|
||||
* @param {String} confirmationForm selector for the confirmation form to show in the dialogue.
|
||||
* @param {String} popupoptions If not null, the quiz should be launced in a pop-up.
|
||||
@@ -45,7 +45,7 @@ define(['jquery', 'core/yui'], function($, Y) {
|
||||
init: function(startButton, confirmationTitle, confirmationForm, popupoptions) {
|
||||
var finalStartButton = startButton;
|
||||
|
||||
Y.use('moodle-core-notification', 'moodle-core-formchangechecker', 'io-form', function () {
|
||||
Y.use('moodle-core-notification', 'moodle-core-formchangechecker', 'io-form', function() {
|
||||
if (Y.one(confirmationForm)) {
|
||||
t.confirmDialogue = new M.core.dialogue({
|
||||
headerContent: confirmationTitle,
|
||||
@@ -94,6 +94,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
|
||||
*/
|
||||
launchQuizPopup: function(e, popupoptions) {
|
||||
e.halt();
|
||||
|
||||
@@ -27,8 +27,8 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/log', 'cor
|
||||
/**
|
||||
* GradingPopup
|
||||
*
|
||||
* @param {String} The regionSelector
|
||||
* @param {String} The userCompetencySelector
|
||||
* @param {String} regionSelector The regionSelector
|
||||
* @param {String} userCompetencySelector The userCompetencySelector
|
||||
*/
|
||||
var GradingPopup = function(regionSelector, userCompetencySelector) {
|
||||
this._regionSelector = regionSelector;
|
||||
@@ -41,7 +41,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/log', 'cor
|
||||
* Get the data from the clicked cell and open the popup.
|
||||
*
|
||||
* @method _handleClick
|
||||
* @param {Event} e
|
||||
* @param {Event} e The event
|
||||
*/
|
||||
GradingPopup.prototype._handleClick = function(e) {
|
||||
var cell = $(e.target).closest(this._userCompetencySelector);
|
||||
@@ -52,16 +52,16 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/log', 'cor
|
||||
log.debug('Clicked on cell: competencyId=' + competencyId + ', courseId=' + courseId + ', userId=' + userId);
|
||||
|
||||
var requests = ajax.call([{
|
||||
methodname : 'tool_lp_data_for_user_competency_summary_in_course',
|
||||
methodname: 'tool_lp_data_for_user_competency_summary_in_course',
|
||||
args: { userid: userId, competencyid: competencyId, courseid: courseId },
|
||||
done: this._contextLoaded.bind(this),
|
||||
fail: notification.exception
|
||||
}]);
|
||||
|
||||
// Log the user competency viewed in course event.
|
||||
requests[0].then(function(){
|
||||
requests[0].then(function() {
|
||||
ajax.call([{
|
||||
methodname : 'core_competency_user_competency_viewed_in_course',
|
||||
methodname: 'core_competency_user_competency_viewed_in_course',
|
||||
args: { userid: userId, competencyid: competencyId, courseid: courseId },
|
||||
fail: notification.exception
|
||||
}]);
|
||||
@@ -96,7 +96,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/log', 'cor
|
||||
var userId = region.data('userid');
|
||||
|
||||
ajax.call([{
|
||||
methodname : 'report_competency_data_for_report',
|
||||
methodname: 'report_competency_data_for_report',
|
||||
args: { courseid: courseId, userid: userId },
|
||||
done: this._pageContextLoaded.bind(this),
|
||||
fail: notification.exception
|
||||
|
||||
@@ -26,10 +26,10 @@ define(['jquery'], function($) {
|
||||
/**
|
||||
* UserCourseNavigation
|
||||
*
|
||||
* @param {String} The selector of the user element.
|
||||
* @param {String} The base url for the page (no params).
|
||||
* @param {Number} The course id
|
||||
* @param {Number} The user id
|
||||
* @param {String} userSelector The selector of the user element.
|
||||
* @param {String} baseUrl The base url for the page (no params).
|
||||
* @param {Number} userId The course id
|
||||
* @param {Number} courseId The user id
|
||||
*/
|
||||
var UserCourseNavigation = function(userSelector, baseUrl, userId, courseId) {
|
||||
this._baseUrl = baseUrl;
|
||||
@@ -43,7 +43,7 @@ define(['jquery'], function($) {
|
||||
* The user was changed in the select list.
|
||||
*
|
||||
* @method _userChanged
|
||||
* @param {Event} e
|
||||
* @param {Event} e the event
|
||||
*/
|
||||
UserCourseNavigation.prototype._userChanged = function(e) {
|
||||
var newUserId = $(e.target).val();
|
||||
|
||||
Reference in New Issue
Block a user