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);
};
{ 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?
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';
var parent = $('[data-region="competencyactions"]').data('competency');
var params = {
- competencyframeworkid : treeModel.getCompetencyFrameworkId(),
+ competencyframeworkid: treeModel.getCompetencyFrameworkId(),
pagecontextid: pageContextId
};
{ 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],
{ 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?
competencyframeworkid: competency.competencyframeworkid,
searchtext: ''
}
- },{
+ }, {
methodname: 'core_competency_read_competency_framework',
args: {
id: competency.competencyframeworkid
{ 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,
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
};
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.
});
});
- calls.push( {
+ calls.push({
methodname: 'tool_lp_data_for_related_competencies_section',
args: { competencyid: relatedTarget.id }
});
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]
{ 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?
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,
wide = false;
}
- Y.use('moodle-core-notification', 'timers', function () {
+ Y.use('moodle-core-notification', 'timers', function() {
var width = '480px';
if (wide) {
width = '800px';
{ 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
{ 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?
}
}
}]);
- 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]
{ 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?
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');
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');
}
return true;
}
- switch(e.keyCode) {
+ switch (e.keyCode) {
case this.keys.tab: {
// Hide all menu items and update their aria attributes.
// 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.
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.
// 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) {
// 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);
break;
}
- curNdx = curNdx+1;
+ curNdx = curNdx + 1;
if (curNdx == menuNum) {
// Reached the end of the list, start again at the beginning.
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();
}
// 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();
* { "[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) {
{ 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?
{ 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?
{ 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?
{ 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?
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.
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);
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
* @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.
{ 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
{ 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?
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--;
}
// 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);
break;
}
- currentIndex = currentIndex+1;
+ currentIndex = currentIndex + 1;
if (currentIndex == itemCount) {
// Reached the end of the list, start again at the beginning.
currentIndex = 0;
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) {
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
{ 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?
{ 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?
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
}
// 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);
};
*/
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);
};
// 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,
};
/**
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);
}
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);
}
* @copyright 2015 Jun Pataleta <jun@moodle.com>
* @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.
* @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.
*/
- 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.
});
// 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();
});
// 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.
// 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();
});
* @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 */ {
* @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');
});
});
}
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);
// 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);
};
/**
// 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.
// 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 it's index.
var current = suggestionsElement.children('[aria-hidden=false]').index(element);
// Activate the next one.
- activateItem(current-1, state);
+ activateItem(current - 1, state);
};
/**
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);
}
var promises = ajax.call([{
methodname: 'core_get_fragment',
- args:{
+ args: {
component: component,
callback: callback,
contextid: contextid,
// Disable cache if debugging.
return false;
}
- if (typeof(window.localStorage) === "undefined") {
+ if (typeof (window.localStorage) === "undefined") {
return false;
}
var testKey = 'test';
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;
*/
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 {
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];
}
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
});
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
});
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();
/**
* @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
};
loadOverideableRoles();
}
- catch(err) {
+ catch (err) {
notification.exception(err);
}
})
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 + '"]');
})
.fail(notification.exception);
}
- catch(err) {
+ catch (err) {
notification.exception(err);
}
})
* @method handleAddRole
* @param {event} e
*/
- var handleAddRole = function(e){
+ var handleAddRole = function(e) {
e.preventDefault();
$('body').one('rolesloaded', 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,
var i, existingrolelinks;
var roles = [];
- switch (action){
+ switch (action) {
case 'allow':
existingrolelinks = row.find(SELECTORS.REMOVEROLE);
break;
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);
});
* @method handleRemoveRole
* @param {event} e
*/
- var handleRemoveRole = function(e){
+ var handleRemoveRole = function(e) {
e.preventDefault();
$('body').one('rolesloaded', function() {
var link = $(e.currentTarget);
};
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);
}
);
* @param {string} contextname
* @param {string} adminurl
*/
- initialize : function(args) {
+ initialize: function(args) {
contextid = args.contextid;
contextname = args.contextname;
adminurl = args.adminurl;
// 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',
}], true);
$.when.apply($, promises)
- .done( function(data) {
+ .done(function(data) {
templates.render('core_tag/index', data).done(function(html) {
tagarea.replaceWith(html);
});
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;
});
// 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) {
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);
});
// 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]);
}
}
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]);
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,
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) +
$('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"/>' +
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,
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');
}
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');
}
}
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,
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;
* @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',
// Oh well - load via ajax.
var promises = ajax.call([{
methodname: 'core_output_load_template',
- args:{
+ args: {
component: component,
template: name,
themename: currentThemeName
}], 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);
}
);
context.pix = function() { return pixHelper; };
context.js = function() { return jsHelper; };
context.quote = function() { return quoteHelper; };
- context.globals = { config : config };
+ context.globals = { config: config };
context.currentTheme = themeName;
};
*/
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);
}
};
// 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));
};
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, {
});
}).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, {
var id = getToolProxyId();
toolProxy.delete(id).done(function() {
promise.resolve();
- }).fail(function (failure) {
+ }).fail(function(failure) {
promise.reject(failure);
});
} else {
// 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
};
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);
announceFailure(element);
promise.reject(error);
});
- }, function () {
+ }, function() {
stopLoading(element);
promise.resolve();
});
.fail(promise.reject);
promise.fail(notification.exception)
- .always(function () {
+ .always(function() {
stopLoading(container);
});
};
}
});
- 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
announceFailure(element);
promise.reject(error);
});
- }, function () {
+ }, function() {
stopLoading(element);
promise.resolve();
});
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,
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
}]);
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