* Find a node in the dialogue.
*
* @param {String} selector
+ * @return {JQuery} The node
* @method _find
*/
ActionSelector.prototype._find = function(selector) {
*
* @param {Number} itemid
* @param {String} itemtype
+ * @param {Number} pagectxid
*/
var competencies = function(itemid, itemtype, pagectxid) {
this.itemid = itemid;
}
]);
} else {
- return null;
+ return;
}
requests[0].fail(notification.exception);
* 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) {
/**
* 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;
return null;
};
+ // eslint-disable-next-line valid-jsdoc
/**
* Return the type of the module.
*
* 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
*/
});
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();
+ });
};
/**
/**
* 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) {
/**
* Re-render the page with the latest data.
+ * @param {Object} context
* @method reloadPage
*/
var reloadPage = function(context) {
/**
* Perform a search and render the page with the new search results.
+ * @param {Event} e
* @method updateSearchHandler
*/
var updateSearchHandler = function(e) {
/**
* 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'));
/**
* 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';
/**
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
* @method dragEnter
+ * @param {Event} e
*/
var dragEnter = function(e) {
e.preventDefault();
/**
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
* @method dragLeave
+ * @param {Event} e
*/
var dragLeave = function(e) {
e.preventDefault();
/**
* HTML5 implementation of drag/drop (there is an accesible alternative in the menus).
* @method dropOver
+ * @param {Event} e
*/
var dropOver = function(e) {
e.preventDefault();
/**
* Log the competency viewed event.
*
- * @param {Object} The competency.
+ * @param {Object} competency The competency.
* @method triggerCompetencyViewedEvent
*/
var triggerCompetencyViewedEvent = function(competency) {
* @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,
* 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) {
*
*/
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) {
/**
* The action on the click event.
*
- * @param {Event} event click
+ * @param {Event} e event click
* @method clickEventHandler
*/
Competencydialogue.prototype.clickEventHandler = function(e) {
* Get a promise on data competency.
*
* @param {Number} competencyid
+ * @param {Object} options
* @return {Promise} return promise on data request
* @method getCompetencyDataPromise
*/
* Initialise the competency dialogue module.
*
* Only the first call matters.
- *
- * @return {Void}
*/
init: function() {
if (typeof instance !== 'undefined') {
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) {
* Find a node in the dialogue.
*
* @param {String} selector
+ * @return {JQuery}
* @method _find
*/
Picker.prototype._find = function(selector) {
* Convenience method to get a framework object.
*
* @param {Number} fid The framework ID.
+ * @return {Object}
* @method _getFramework
*/
Picker.prototype._getFramework = function(fid) {
*
* This needs to be set after reset/close.
*
- * @params {Number[]} The IDs.
+ * @param {Number[]} ids The IDs.
* @method _setDisallowedCompetencyIDs
*/
Picker.prototype.setDisallowedCompetencyIDs = function(ids) {
* 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) {
/**
* 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) {
* @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;
*
* Triggered when a change occured.
*
- * @return {Void}
* @method _afterChange
* @protected
*/
*
* 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()) {
/**
* After render hook.
*
- * @return {Promise}
* @method _afterRender
* @protected
*/
* Find a node in the dialogue.
*
* @param {String} selector
+ * @return {JQuery}
* @method _find
* @protected
*/
/**
* Set up the instance.
*
- * @return {Void}
* @method _setUp
* @protected
*/
/**
* Called when the user switches outcome.
*
- * @return {Void}
* @method _switchedOutcome
* @protected
*/
/**
* Called when the user switches rule.
*
- * @return {Void}
* @method _switchedRule
* @protected
*/
* 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
*/
/**
* Get content.
+ * @return {node}
*/
dialogue.prototype.getContent = function() {
return this.yuiDialogue.bodyNode.getDOMNode();
* 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) {
*
* @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') {
* @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),
/**
* Grade dialogue class.
+ * @param {Array} ratingOptions
*/
var Grade = function(ratingOptions) {
EventBase.prototype.constructor.apply(this, []);
/**
* After render hook.
*
- * @return {Promise}
* @method _afterRender
* @protected
*/
*
* @param {String} selector
* @method _find
+ * @returns {node} The node
* @protected
*/
Grade.prototype._find = function(selector) {
* 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, []);
/**
* 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) {
* @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();
/**
* 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) {
/**
* 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.
*
* @name scaleChangeHandler
* @param {Event} e
- * @return {Void}
* @function
*/
ScaleConfig.prototype.scaleChangeHandler = function(e) {
* @param {Number} scaleid The scale id
* @return [] {Promise}
*/
-
+ // eslint-disable-next-line camelcase
get_values: function(scaleid) {
var deferred = $.Deferred();
doDelete();
});
}).fail(notification.exception);
- }
- else {
+ } else {
str.get_strings([
{ key: 'confirm', component: 'moodle' },
{ key: 'deletetemplate', component: 'tool_lp', param: template.shortname },
*/
Tree.prototype.toggleItem = function(item) {
if (!this.multiSelect) {
- return this.selectItem(item);
+ this.selectItem(item);
+ return;
}
var current = item.attr('aria-selected');
* @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);
* @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) {
}
}
+ // eslint-disable-next-line no-unreachable
return true;
};
* @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) {
* @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) {
* @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) {
* @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;
* @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) {
/**
* 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;
/**
* 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;
/**
* 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;
* Cancel a review request and refresh the view.
*
* @param {Object} data The user competency data.
- * @return {Void}
* @method _cancelReviewRequest
*/
UserCompetencyWorkflow.prototype._cancelReviewRequest = function(data) {
* Cancel a review request an refresh the view.
*
* @param {Object} data The user competency data.
- * @return {Void}
* @method cancelReviewRequest
*/
UserCompetencyWorkflow.prototype.cancelReviewRequest = function(data) {
* Cancel a review request handler.
*
* @param {Event} e The event.
- * @return {Void}
* @method _cancelReviewRequestHandler
*/
UserCompetencyWorkflow.prototype._cancelReviewRequestHandler = function(e) {
* Request a review and refresh the view.
*
* @param {Object} data The user competency data.
- * @return {Void}
* @method _requestReview
*/
UserCompetencyWorkflow.prototype._requestReview = function(data) {
* Request a review.
*
* @param {Object} data The user competency data.
- * @return {Void}
* @method requestReview
*/
UserCompetencyWorkflow.prototype.requestReview = function(data) {
* Request a review handler.
*
* @param {Event} e The event.
- * @return {Void}
* @method _requestReviewHandler
*/
UserCompetencyWorkflow.prototype._requestReviewHandler = function(e) {
* Start a review and refresh the view.
*
* @param {Object} data The user competency data.
- * @return {Void}
* @method _startReview
*/
UserCompetencyWorkflow.prototype._startReview = function(data) {
* Start a review.
*
* @param {Object} data The user competency data.
- * @return {Void}
* @method startReview
*/
UserCompetencyWorkflow.prototype.startReview = function(data) {
* Start a review handler.
*
* @param {Event} e The event.
- * @return {Void}
* @method _startReviewHandler
*/
UserCompetencyWorkflow.prototype._startReviewHandler = function(e) {
* Stop a review and refresh the view.
*
* @param {Object} data The user competency data.
- * @return {Void}
* @method _stopReview
*/
UserCompetencyWorkflow.prototype._stopReview = function(data) {
* Stop a review.
*
* @param {Object} data The user competency data.
- * @return {Void}
* @method stopReview
*/
UserCompetencyWorkflow.prototype.stopReview = function(data) {
* Stop a review handler.
*
* @param {Event} e The event.
- * @return {Void}
* @method _stopReviewHandler
*/
UserCompetencyWorkflow.prototype._stopReviewHandler = function(e) {
// 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);
};
* 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 })
* 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) {
* @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>');
* 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');
* 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) {
/**
* 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>';
* 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.
* 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);
* 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') {
* @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) {
* 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) {
var originalSelect = $(selector);
if (!originalSelect) {
log.debug('Selector not found: ' + selector);
- return false;
+ return;
}
// Hide the original select.
* 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.
/**
* 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) {
sesskey: config.sesskey
};
- $.post(adminurl + 'roles/ajax.php', params, function() {})
+ $.post(adminurl + 'roles/ajax.php', params)
.done(function(data) {
try {
overideableroles = data;
$('body').trigger(rolesloadedevent);
};
loadOverideableRoles();
- }
- catch (err) {
+ } catch (err) {
notification.exception(err);
}
})
*
* @access private
* @method changePermissions
- * @param {jquery node} row
+ * @param {JQuery} row
* @param {int} roleid
* @param {string} action
*/
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 {
panel.hide();
})
.fail(notification.exception);
- }
- catch (err) {
+ } catch (err) {
notification.exception(err);
}
})
/**
* Initialize permissionmanager
* @access public
- * @param {int} contextid
- * @param {string} contextname
- * @param {string} adminurl
+ * @param {Object} args
*/
initialize: function(args) {
contextid = args.contextid;
body.delegate(SELECTORS.REMOVEROLE, 'click', handleRemoveRole);
}
};
-});
\ No newline at end of file
+});
* @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,
* See get_string for more info on these args.
* @return {Promise}
*/
+ // eslint-disable-next-line camelcase
get_strings: function(requests) {
var deferred = $.Deferred();
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',
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>'));
+ 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({
draggable: true,
});
}
};
-});
\ No newline at end of file
+});
* @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) {
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.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;
};
* 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);
}
};
});
* Get all visible tree items.
*
* @method getVisibleItems
+ * @return {Object} visible items
*/
Tree.prototype.getVisibleItems = function() {
return this.treeRoot.data('visibleItems');
* @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);
* @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) {
* @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) {
// 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);
};
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) {
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. */
* @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]');
*
* @private
* @method _checkClickOutsideConfigureFilters
- * @param {Event}
+ * @param {Event} event
*/
GradingNavigation.prototype._checkClickOutsideConfigureFilters = function(event) {
var configPanel = this._region.find('[data-region="configure-filters"]');
*
* @private
* @method _filterChanged
- * @param {Event}
+ * @param {Event} event
*/
GradingNavigation.prototype._filterChanged = function(event) {
var name = $(event.target).attr('name');
*
* @private
* @method _toggleExpandFilters
- * @param {Event}
+ * @param {Event} event
*/
GradingNavigation.prototype._toggleExpandFilters = function(event) {
event.preventDefault();
*
* @private
* @method _handleChangeUser
- * @param {Event}
+ * @param {Event} event
*/
GradingNavigation.prototype._handleChangeUser = function() {
var select = this._region.find('[data-action=change-user]');
*
* @private
* @method _getAssignmentId
- * @return int assignment id
+ * @return {Integer} assignment id
*/
UserInfo.prototype._getAssignmentId = function() {
return this._region.attr('data-assignmentid');
* Make form submit via ajax.
*
* @private
+ * @param {Object} event
+ * @param {Integer} nextUserId
* @method _submitForm
*/
GradingPanel.prototype._submitForm = function(event, nextUserId) {
* Open a picker to choose an older attempt.
*
* @private
+ * @param {Object} e
* @method _chooseAttempt
*/
GradingPanel.prototype._chooseAttempt = function(e) {
*
* @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);
* @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');
*
* @method getCartridgeURL
* @private
- * @return string
+ * @return {String}
*/
var getCartridgeURL = function() {
return $(SELECTORS.REGISTRATION_FORM).attr('data-cartridge-url');
*
* @method getSubmitButton
* @private
- * @return object jQuery object
+ * @return {JQuery} jQuery object
*/
var getSubmitButton = function() {
return $(SELECTORS.REGISTRATION_SUBMIT_BUTTON);
*
* @method getCancelButton
* @private
- * @return object jQuery object
+ * @return {JQuery} jQuery object
*/
var getCancelButton = function() {
return $(SELECTORS.REGISTRATION_CANCEL_BUTTON);
*
* @method getConsumerKey
* @private
- * @return string
+ * @return {String} the value entered for consumer key.
*/
var getConsumerKey = function() {
return $(SELECTORS.CONSUMER_KEY).val();
*
* @method getSharedSecret
* @private
- * @return string
+ * @return {String} the value entered for shared secret
*/
var getSharedSecret = function() {
return $(SELECTORS.SHARED_SECRET).val();
*
* @method isLoading
* @private
- * @return bool
+ * @return {Boolean}
*/
var isLoading = function() {
return getSubmitButton().hasClass('loading');
*
* @method submitCartridgeURL
* @private
- * @return object jQuery deferred object
+ * @return {Promise} jQuery Deferred object
*/
var submitCartridgeURL = function() {
if (isLoading()) {
error: true
});
}).fail(notification.exception);
- }).always(function() { stopLoading(); });
+ }).always(function() {
+ stopLoading();
+ });
return promise;
};
*
* @method getExternalRegistrationCancelButton
* @private
- * @return object jQuery object
+ * @return {JQuery} jQuery object
*/
var getExternalRegistrationCancelButton = function() {
return $(SELECTORS.EXTERNAL_REGISTRATION_CANCEL_BUTTON);
*
* @method getExternalRegistrationContainer
* @private
- * @return object jQuery object
+ * @return {JQuery} jQuery object
*/
var getExternalRegistrationContainer = function() {
return $(SELECTORS.EXTERNAL_REGISTRATION_CONTAINER);
*
* @method getExternalRegistrationTemplateContainer
* @private
- * @return object jQuery object
+ * @return {JQuery} jQuery object
*/
var getExternalRegistrationTemplateContainer = function() {
return $(SELECTORS.EXTERNAL_REGISTRATION_TEMPLATE_CONTAINER);
*
* @method getToolTypeCapabilitiesContainer
* @private
- * @return object jQuery object
+ * @return {JQuery} jQuery object
*/
var getToolTypeCapabilitiesContainer = function() {
return $(SELECTORS.TOOL_TYPE_CAPABILITIES_CONTAINER);
*
* @method getToolTypeCapabilitiesTemplateContainer
* @private
- * @return object jQuery object
+ * @return {JQuery} jQuery object
*/
var getToolTypeCapabilitiesTemplateContainer = function() {
return $(SELECTORS.TOOL_TYPE_CAPABILITIES_TEMPLATE_CONTAINER);
*
* @method setToolProxyId
* @private
- * @param int Tool proxy ID
+ * @param {Integer} id Tool proxy ID
*/
var setToolProxyId = function(id) {
var button = getExternalRegistrationCancelButton();
*
* @method getToolProxyId
* @private
- * @return string Tool proxy ID
+ * @return {String} Tool proxy ID
*/
var getToolProxyId = function() {
var button = getExternalRegistrationCancelButton();
*
* @method hasToolProxyId
* @private
- * @return bool
+ * @return {Boolean}
*/
var hasToolProxyId = function() {
return getToolProxyId() ? true : false;
*
* @method hasCreatedToolProxy
* @private
- * @return bool
+ * @return {Boolean}
*/
var hasCreatedToolProxy = function() {
var button = getExternalRegistrationCancelButton();
*
* @method setProxyAsNew
* @private
- * @return bool
+ * @return {Boolean}
*/
var setProxyAsNew = function() {
var button = getExternalRegistrationCancelButton();
*
* @method setProxyAsOld
* @private
- * @return bool
+ * @return {Boolean}
*/
var setProxyAsOld = function() {
var button = getExternalRegistrationCancelButton();
*
* @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 = {
*
* @method cancelRegistration
* @private
- * @return object jQuery Deferred object
+ * @return {Promise} jQuery Deferred object
*/
var cancelRegistration = function() {
startLoadingCancel();
*
* @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);
*
* @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({
*
* @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();
*
* @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();
*
* @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();
* 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) {
*
* @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);
*
* @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);
*
* @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);
*
* @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);
*
* @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;
*
* @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);
*
* @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;
*
* @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');
*
* @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');
*
* @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);
*
* @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');
*
* @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();
*
* @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();
*
* @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();
*
* @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);
*
* @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');
*
* @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);
*
* @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);
// 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;
};
*
* @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);
*
* @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);
// 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;
};
*
* @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);
*
* @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');
*
* @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');
*
* @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)) {
*
* @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);
/**
* 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);
*
* @method getToolCreateButton
* @private
- * @return object jQuery object
+ * @return {Object} jQuery object
*/
var getToolCreateButton = function() {
return $(SELECTORS.TOOL_CREATE_BUTTON);
*
* @method getToolListContainer
* @private
- * @return object jQuery object
+ * @return {Object} jQuery object
*/
var getToolListContainer = function() {
return $(SELECTORS.TOOL_LIST_CONTAINER);
*
* @method getExternalRegistrationContainer
* @private
- * @return object jQuery object
+ * @return {Object} jQuery object
*/
var getExternalRegistrationContainer = function() {
return $(SELECTORS.EXTERNAL_REGISTRATION_CONTAINER);
*
* @method getCartridgeRegistrationContainer
* @private
- * @return object jQuery object
+ * @return {Object} jQuery object
*/
var getCartridgeRegistrationContainer = function() {
return $(SELECTORS.CARTRIDGE_REGISTRATION_CONTAINER);
*
* @method getRegistrationChoiceContainer
* @private
- * @return object jQuery object
+ * @return {Object} jQuery object
*/
var getRegistrationChoiceContainer = function() {
return $(SELECTORS.REGISTRATION_CHOICE_CONTAINER);
*
* @method getToolURL
* @private
- * @return string
+ * @return {String} the tool type url
*/
var getToolURL = function() {
return $(SELECTORS.TOOL_URL).val();
* panels.
*
* @method showCartridgeRegistration
+ * @param {String} url
* @private
*/
var showCartridgeRegistration = function(url) {
* This function can be removed once JAWS supports visibility.
*
* @method screenReaderAnnounce
+ * @param {Object} element
* @private
*/
var screenReaderAnnounce = function(element) {
* Display the registration feedback alert and hide the other panels.
*
* @method showRegistrationFeedback
+ * @param {Object} data
* @private
*/
var showRegistrationFeedback = function(data) {
*
* @method startLoading
* @private
- * @param object jQuery object
+ * @param {Object} element jQuery object
*/
var startLoading = function(element) {
element.addClass("loading");
*
* @method stopLoading
* @private
- * @param object jQuery object
+ * @param {Object} element jQuery object
*/
var stopLoading = function(element) {
element.removeClass("loading");
*
* @method addTool
* @private
- * @return object jQuery deferred object
+ * @return {Promise} jQuery Deferred object
*/
var addTool = function() {
var url = $.trim(getToolURL());
var promise = toolType.isCartridge(url);
- promise.always(function() { stopLoading(toolButton); });
+ promise.always(function() {
+ stopLoading(toolButton);
+ });
promise.done(function(result) {
if (result.iscartridge) {
*
* @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 = {
*
* @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 = {
*
* @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 = {
*
* @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);
*
* @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);
*
* @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');
*
* @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');
*
* @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);
*
* @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');
*
* @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();
*
* @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();
*
* @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();
*
* @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)};
*
* @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);
/**
* 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);
*
* @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 = {
*
* @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 = {
*
* @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 = {
*
* @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 = {
*
* @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});
*
* @method isCartridge
* @public
- * @param string URL
- * @return object jQuery deferred object
+ * @param {String} url
+ * @return {Promise} jQuery Deferred object
*/
isCartridge: function(url) {
var request = {
/**
* 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.
/**
* 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();
/**
* 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;
* 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);
/**
* 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;
* 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();