MDL-54939 amd: Fix lint issues fixable with eslint --fix

This commit is contained in:
Dan Poltawski 2016-06-16 15:56:12 +01:00
parent 49619ce243
commit 35be582696
37 changed files with 188 additions and 188 deletions

View File

@ -170,8 +170,8 @@ define(['jquery',
for (var i in self._actions) { for (var i in self._actions) {
choices.push(self._actions[i]); choices.push(self._actions[i]);
} }
var content = {'message': self._message, 'choices' : choices, var content = {'message': self._message, 'choices': choices,
'confirm' : self._confirm, 'cancel' : self._cancel}; 'confirm': self._confirm, 'cancel': self._cancel};
return Templates.render('tool_lp/action_selector', content); return Templates.render('tool_lp/action_selector', content);
}; };

View File

@ -276,7 +276,7 @@ define(['jquery',
{ key: message, component: 'tool_lp', param: competency.shortname }, { key: message, component: 'tool_lp', param: competency.shortname },
{ key: 'confirm', component: 'moodle' }, { key: 'confirm', component: 'moodle' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Unlink the competency X from the course? strings[1], // Unlink the competency X from the course?
@ -300,7 +300,7 @@ define(['jquery',
if (localthis.itemtype == 'course') { if (localthis.itemtype == 'course') {
// Course completion rule handling. // 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 requests = [];
var pagerender = 'tool_lp/course_competencies_page'; var pagerender = 'tool_lp/course_competencies_page';
var pageregion = 'coursecompetenciespage'; var pageregion = 'coursecompetenciespage';

View File

@ -66,7 +66,7 @@ define(['jquery',
var parent = $('[data-region="competencyactions"]').data('competency'); var parent = $('[data-region="competencyactions"]').data('competency');
var params = { var params = {
competencyframeworkid : treeModel.getCompetencyFrameworkId(), competencyframeworkid: treeModel.getCompetencyFrameworkId(),
pagecontextid: pageContextId pagecontextid: pageContextId
}; };
@ -86,7 +86,7 @@ define(['jquery',
{ key: 'addingcompetencywillresetparentrule', component: 'tool_lp', param: parent.shortname }, { key: 'addingcompetencywillresetparentrule', component: 'tool_lp', param: parent.shortname },
{ key: 'yes', component: 'core' }, { key: 'yes', component: 'core' },
{ key: 'no', component: 'core' } { key: 'no', component: 'core' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], strings[0],
strings[1], strings[1],
@ -157,7 +157,7 @@ define(['jquery',
{ key: confirmMessage, component: 'tool_lp' }, { key: confirmMessage, component: 'tool_lp' },
{ key: 'yes', component: 'moodle' }, { key: 'yes', component: 'moodle' },
{ key: 'no', component: 'moodle' } { key: 'no', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Delete competency X? strings[1], // Delete competency X?
@ -230,7 +230,7 @@ define(['jquery',
competencyframeworkid: competency.competencyframeworkid, competencyframeworkid: competency.competencyframeworkid,
searchtext: '' searchtext: ''
} }
},{ }, {
methodname: 'core_competency_read_competency_framework', methodname: 'core_competency_read_competency_framework',
args: { args: {
id: competency.competencyframeworkid id: competency.competencyframeworkid
@ -257,7 +257,7 @@ define(['jquery',
{ key: 'movecompetency', component: 'tool_lp', param: competency.shortname }, { key: 'movecompetency', component: 'tool_lp', param: competency.shortname },
{ key: 'move', component: 'tool_lp' }, { key: 'move', component: 'tool_lp' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
var context = { var context = {
framework: framework, framework: framework,
@ -288,8 +288,8 @@ define(['jquery',
var competency = $('[data-region="competencyactions"]').data('competency'); var competency = $('[data-region="competencyactions"]').data('competency');
var params = { var params = {
competencyframeworkid : treeModel.getCompetencyFrameworkId(), competencyframeworkid: treeModel.getCompetencyFrameworkId(),
id : competency.id, id: competency.id,
parentid: competency.parentid, parentid: competency.parentid,
pagecontextid: pageContextId pagecontextid: pageContextId
}; };
@ -381,7 +381,7 @@ define(['jquery',
courses: courses courses: courses
}; };
templates.render('tool_lp/linked_courses_summary', context).done(function(html) { 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( new Dialogue(
linkedcourses, // Title. linkedcourses, // Title.
html, // The linked courses. html, // The linked courses.
@ -413,7 +413,7 @@ define(['jquery',
}); });
}); });
calls.push( { calls.push({
methodname: 'tool_lp_data_for_related_competencies_section', methodname: 'tool_lp_data_for_related_competencies_section',
args: { competencyid: relatedTarget.id } args: { competencyid: relatedTarget.id }
}); });
@ -486,7 +486,7 @@ define(['jquery',
str.get_strings([ str.get_strings([
{ key: 'competencycannotbedeleted', component: 'tool_lp', param: competency.shortname }, { key: 'competencycannotbedeleted', component: 'tool_lp', param: competency.shortname },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.alert( notification.alert(
null, null,
strings[0] strings[0]
@ -514,7 +514,7 @@ define(['jquery',
{ key: confirmMessage, component: 'tool_lp', param: competency.shortname }, { key: confirmMessage, component: 'tool_lp', param: competency.shortname },
{ key: 'delete', component: 'moodle' }, { key: 'delete', component: 'moodle' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Delete competency X? strings[1], // Delete competency X?

View File

@ -57,7 +57,7 @@ define(['jquery',
e.preventDefault(); e.preventDefault();
templates.render('tool_lp/course_competency_settings', context).done(function(html) { 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( this._dialogue = new Dialogue(
title, title,
html, html,

View File

@ -43,7 +43,7 @@ define(['core/yui'], function(Y) {
wide = false; wide = false;
} }
Y.use('moodle-core-notification', 'timers', function () { Y.use('moodle-core-notification', 'timers', function() {
var width = '480px'; var width = '480px';
if (wide) { if (wide) {
width = '800px'; width = '800px';

View File

@ -70,8 +70,8 @@ define(['core/str', 'core/yui'], function(str, Y) {
{ key: 'emptydragdropregion', component: 'moodle' }, { key: 'emptydragdropregion', component: 'moodle' },
{ key: 'movecontent', component: 'moodle' }, { key: 'movecontent', component: 'moodle' },
{ key: 'tocontent', component: 'moodle' }, { key: 'tocontent', component: 'moodle' },
]).done( function () { ]).done(function() {
Y.use('moodle-tool_lp-dragdrop-reorder', function () { Y.use('moodle-tool_lp-dragdrop-reorder', function() {
var context = { var context = {
callback: callback callback: callback

View File

@ -62,7 +62,7 @@ define(['jquery',
{ key: 'areyousure', component: 'moodle' }, { key: 'areyousure', component: 'moodle' },
{ key: 'delete', component: 'moodle' }, { key: 'delete', component: 'moodle' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
Notification.confirm( Notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Are you sure? strings[1], // Are you sure?

View File

@ -93,17 +93,17 @@ define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str'
} }
} }
}]); }]);
requests[0].done(function (success) { requests[0].done(function(success) {
if (success === false) { if (success === false) {
var req = ajax.call([{ var req = ajax.call([{
methodname: 'core_competency_read_competency_framework', methodname: 'core_competency_read_competency_framework',
args: { id: frameworkid } args: { id: frameworkid }
}]); }]);
req[0].done(function (framework) { req[0].done(function(framework) {
str.get_strings([ str.get_strings([
{ key: 'frameworkcannotbedeleted', component: 'tool_lp', param: framework.shortname }, { key: 'frameworkcannotbedeleted', component: 'tool_lp', param: framework.shortname },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.alert( notification.alert(
null, null,
strings[0] strings[0]
@ -136,7 +136,7 @@ define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str'
{ key: 'deletecompetencyframework', component: 'tool_lp', param: framework.shortname }, { key: 'deletecompetencyframework', component: 'tool_lp', param: framework.shortname },
{ key: 'delete', component: 'moodle' }, { key: 'delete', component: 'moodle' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Delete competency framework X? strings[1], // Delete competency framework X?

View File

@ -166,7 +166,7 @@ define(['jquery'], function($) {
this.activeItem = null; this.activeItem = null;
// Close the menu. // 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. // Follow any link, or call the click handlers.
var anchor = item.find('a').first(); var anchor = item.find('a').first();
var clickEvent = new $.Event('click'); var clickEvent = new $.Event('click');
@ -290,7 +290,7 @@ define(['jquery'], function($) {
subMenuContainer.css('margin-right', '-' + marginright + 'px'); subMenuContainer.css('margin-right', '-' + marginright + 'px');
} }
} else { } else {
if ( pos.left + menuRealWidth > $(window).width()) { if (pos.left + menuRealWidth > $(window).width()) {
marginleft = menuRealWidth - widthmenuRoot; marginleft = menuRealWidth - widthmenuRoot;
subMenuContainer.css('margin-left', '-' + marginleft + 'px'); subMenuContainer.css('margin-left', '-' + marginleft + 'px');
} }
@ -319,7 +319,7 @@ define(['jquery'], function($) {
return true; return true;
} }
switch(e.keyCode) { switch (e.keyCode) {
case this.keys.tab: { case this.keys.tab: {
// Hide all menu items and update their aria attributes. // Hide all menu items and update their aria attributes.
@ -438,7 +438,7 @@ define(['jquery'], function($) {
// This is the root level move to next sibling. This will require closing // This is the root level move to next sibling. This will require closing
// the current child menu and opening the new one. // the current child menu and opening the new one.
if (menuIndex < menuNum-1) { if (menuIndex < menuNum - 1) {
// Not the last root menu. // Not the last root menu.
newItem = item.next(); newItem = item.next();
} else { // Wrap to first item. } else { // Wrap to first item.
@ -501,7 +501,7 @@ define(['jquery'], function($) {
menuIndex = this.rootMenus.index(rootItem); menuIndex = this.rootMenus.index(rootItem);
// If this is not the last root menu item, move to the next one. // 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(); newItem = rootItem.next();
} else { } else {
// Loop. // Loop.
@ -687,7 +687,7 @@ define(['jquery'], function($) {
// to the next item with a title that begins with that character. // to the next item with a title that begins with that character.
if (startChr) { if (startChr) {
var match = false; var match = false;
var curNdx = menuIndex+1; var curNdx = menuIndex + 1;
// Check if the active item was the last one on the list. // Check if the active item was the last one on the list.
if (curNdx == menuNum) { if (curNdx == menuNum) {
@ -696,7 +696,7 @@ define(['jquery'], function($) {
// Iterate through the menu items (starting from the current item and wrapping) until a match is found // 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. // or the loop returns to the current menu item.
while (curNdx != menuIndex) { while (curNdx != menuIndex) {
var titleChr = menuItems.eq(curNdx).html().charAt(0); var titleChr = menuItems.eq(curNdx).html().charAt(0);
@ -705,7 +705,7 @@ define(['jquery'], function($) {
break; break;
} }
curNdx = curNdx+1; curNdx = curNdx + 1;
if (curNdx == menuNum) { if (curNdx == menuNum) {
// Reached the end of the list, start again at the beginning. // Reached the end of the list, start again at the beginning.
@ -724,8 +724,8 @@ define(['jquery'], function($) {
return item; return item;
} }
} else { } else {
if (menuIndex < menuNum-1) { if (menuIndex < menuNum - 1) {
newItem = menuItems.eq(menuIndex+1); newItem = menuItems.eq(menuIndex + 1);
} else { } else {
newItem = menuItems.first(); newItem = menuItems.first();
} }
@ -763,7 +763,7 @@ define(['jquery'], function($) {
// If item is not the first item in its menu, move to the previous item. // If item is not the first item in its menu, move to the previous item.
if (menuIndex > 0) { if (menuIndex > 0) {
newItem = menuItems.eq(menuIndex-1); newItem = menuItems.eq(menuIndex - 1);
} else { } else {
// Loop to top of menu. // Loop to top of menu.
newItem = menuItems.last(); newItem = menuItems.last();
@ -823,7 +823,7 @@ define(['jquery'], function($) {
* { "[data-action='add']" : callAddFunction } * { "[data-action='add']" : callAddFunction }
*/ */
enhance: function(selector, handler) { enhance: function(selector, handler) {
$(selector).each(function (index, element) { $(selector).each(function(index, element) {
var menuRoot = $(element); var menuRoot = $(element);
// Don't enhance the same menu twice. // Don't enhance the same menu twice.
if (menuRoot.data("menubarEnhanced") !== true) { if (menuRoot.data("menubarEnhanced") !== true) {

View File

@ -178,7 +178,7 @@ define(['jquery',
{ key: 'deleteplan', component: 'tool_lp', param: plan.name }, { key: 'deleteplan', component: 'tool_lp', param: plan.name },
{ key: 'delete', component: 'moodle' }, { key: 'delete', component: 'moodle' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Delete plan X? strings[1], // Delete plan X?
@ -225,7 +225,7 @@ define(['jquery',
{ key: 'reopenplanconfirm', component: 'tool_lp', param: plan.name }, { key: 'reopenplanconfirm', component: 'tool_lp', param: plan.name },
{ key: 'reopenplan', component: 'tool_lp' }, { key: 'reopenplan', component: 'tool_lp' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Reopen plan X? strings[1], // Reopen plan X?
@ -272,7 +272,7 @@ define(['jquery',
{ key: 'completeplanconfirm', component: 'tool_lp', param: plan.name }, { key: 'completeplanconfirm', component: 'tool_lp', param: plan.name },
{ key: 'completeplan', component: 'tool_lp' }, { key: 'completeplan', component: 'tool_lp' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Complete plan X? strings[1], // Complete plan X?
@ -318,7 +318,7 @@ define(['jquery',
{ key: 'unlinkplantemplateconfirm', component: 'tool_lp', param: plan.name }, { key: 'unlinkplantemplateconfirm', component: 'tool_lp', param: plan.name },
{ key: 'unlinkplantemplate', component: 'tool_lp' }, { key: 'unlinkplantemplate', component: 'tool_lp' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Unlink plan X? strings[1], // Unlink plan X?
@ -507,7 +507,7 @@ define(['jquery',
courses: courses courses: courses
}; };
templates.render('tool_lp/linked_courses_summary', context).done(function(html) { 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( new Dialogue(
linkedcourses, // Title. linkedcourses, // Title.
html // The linked courses. html // The linked courses.

View File

@ -40,7 +40,7 @@ define(['jquery', 'core/ajax'], function($, ajax) {
if (typeof localCache[scaleid] === 'undefined') { if (typeof localCache[scaleid] === 'undefined') {
ajax.call([{ ajax.call([{
methodname: 'core_competency_get_scale_values', methodname: 'core_competency_get_scale_values',
args: {scaleid : scaleid}, args: {scaleid: scaleid},
done: function(scaleinfo) { done: function(scaleinfo) {
localCache[scaleid] = scaleinfo; localCache[scaleid] = scaleinfo;
deferred.resolve(scaleinfo); deferred.resolve(scaleinfo);

View File

@ -21,7 +21,7 @@
* @copyright 2015 Damyon Wiese <damyon@moodle.com> * @copyright 2015 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @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) { function($, templates, ajax, notification, str, Actionselector) {
// Private variables and functions. // Private variables and functions.
@ -135,9 +135,9 @@ define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str'
{ key: 'unlinkplanstemplate', component: 'tool_lp' }, { key: 'unlinkplanstemplate', component: 'tool_lp' },
{ key: 'confirm', component: 'moodle' }, { key: 'confirm', component: 'moodle' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
var actions = [{'text': strings[2], 'value' : 'delete'}, var actions = [{'text': strings[2], 'value': 'delete'},
{'text': strings[3], 'value' : 'unlink'}]; {'text': strings[3], 'value': 'unlink'}];
var actionselector = new Actionselector( var actionselector = new Actionselector(
strings[0], // Title. strings[0], // Title.
strings[1], // Message strings[1], // Message
@ -159,7 +159,7 @@ define(['jquery', 'core/templates', 'core/ajax', 'core/notification', 'core/str'
{ key: 'deletetemplate', component: 'tool_lp', param: template.shortname }, { key: 'deletetemplate', component: 'tool_lp', param: template.shortname },
{ key: 'delete', component: 'moodle' }, { key: 'delete', component: 'moodle' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Delete learning plan template X? strings[1], // Delete learning plan template X?

View File

@ -186,12 +186,12 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
var oneItem = null; var oneItem = null;
while (lastIndex < currentIndex) { while (lastIndex < currentIndex) {
oneItem = $(this.visibleItems.get(lastIndex)); oneItem = $(this.visibleItems.get(lastIndex));
oneItem.attr('aria-selected', 'true'); oneItem.attr('aria-selected', 'true');
lastIndex++; lastIndex++;
} }
while (lastIndex > currentIndex) { while (lastIndex > currentIndex) {
oneItem = $(this.visibleItems.get(lastIndex)); oneItem = $(this.visibleItems.get(lastIndex));
oneItem.attr('aria-selected', 'true'); oneItem.attr('aria-selected', 'true');
lastIndex--; lastIndex--;
} }
@ -454,7 +454,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
// Iterate through the menu items (starting from the current item and wrapping) until a match is found // 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. // or the loop returns to the current menu item.
while (currentIndex != itemIndex) { while (currentIndex != itemIndex) {
var currentItem = this.visibleItems.eq(currentIndex); var currentItem = this.visibleItems.eq(currentIndex);
var titleChr = currentItem.text().charAt(0); var titleChr = currentItem.text().charAt(0);
@ -468,7 +468,7 @@ define(['jquery', 'core/url', 'core/log'], function($, url, log) {
break; break;
} }
currentIndex = currentIndex+1; currentIndex = currentIndex + 1;
if (currentIndex == itemCount) { if (currentIndex == itemCount) {
// Reached the end of the list, start again at the beginning. // Reached the end of the list, start again at the beginning.
currentIndex = 0; currentIndex = 0;

View File

@ -53,14 +53,14 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/templates'
var planId = this._planId; var planId = this._planId;
var requests = ajax.call([{ 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 }, args: { competencyid: competencyId, planid: planId },
done: this._contextLoaded.bind(this), done: this._contextLoaded.bind(this),
fail: notification.exception fail: notification.exception
}]); }]);
// Log the user competency viewed in plan event. // 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'; var eventMethodName = 'core_competency_user_competency_viewed_in_plan';
// Trigger core_competency_user_competency_plan_viewed event instead if plan is already completed. // Trigger core_competency_user_competency_plan_viewed event instead if plan is already completed.
if (result.plan.iscompleted) { if (result.plan.iscompleted) {
@ -98,7 +98,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/templates'
var planId = this._planId; var planId = this._planId;
ajax.call([{ ajax.call([{
methodname : 'tool_lp_data_for_plan_page', methodname: 'tool_lp_data_for_plan_page',
args: { planid: planId}, args: { planid: planId},
done: this._pageContextLoaded.bind(this), done: this._pageContextLoaded.bind(this),
fail: notification.exception fail: notification.exception

View File

@ -165,7 +165,7 @@ define(['jquery',
{ key: 'deleteuserevidence', component: 'tool_lp', param: evidence.name }, { key: 'deleteuserevidence', component: 'tool_lp', param: evidence.name },
{ key: 'delete', component: 'moodle' }, { key: 'delete', component: 'moodle' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Delete evidence X? strings[1], // Delete evidence X?
@ -320,7 +320,7 @@ define(['jquery',
{ key: 'sendallcompetenciestoreview', component: 'tool_lp', param: evidence.name }, { key: 'sendallcompetenciestoreview', component: 'tool_lp', param: evidence.name },
{ key: 'confirm', component: 'moodle' }, { key: 'confirm', component: 'moodle' },
{ key: 'cancel', component: 'moodle' } { key: 'cancel', component: 'moodle' }
]).done(function (strings) { ]).done(function(strings) {
notification.confirm( notification.confirm(
strings[0], // Confirm. strings[0], // Confirm.
strings[1], // Send all competencies in review for X? strings[1], // Send all competencies in review for X?

View File

@ -120,14 +120,14 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
var promises = ajax.call([{ var promises = ajax.call([{
methodname: 'core_output_load_template', methodname: 'core_output_load_template',
args:{ args: {
component: component, component: component,
template: name, template: name,
themename: config.theme themename: config.theme
} }
}, { }, {
methodname: 'tool_templatelibrary_load_canonical_template', methodname: 'tool_templatelibrary_load_canonical_template',
args:{ args: {
component: component, component: component,
template: name template: name
} }
@ -136,7 +136,7 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
// When returns a new promise that is resolved when all the passed in promises are resolved. // 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. // The arguments to the done become the values of each resolved promise.
$.when.apply($, promises) $.when.apply($, promises)
.done( function(source, originalSource) { templateLoaded(templateName, source, originalSource); }) .done(function(source, originalSource) { templateLoaded(templateName, source, originalSource); })
.fail(notification.exception); .fail(notification.exception);
}; };

View File

@ -32,7 +32,7 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
*/ */
var reloadListTemplate = function(templateList) { var reloadListTemplate = function(templateList) {
templates.render('tool_templatelibrary/search_results', { templates: templateList }) templates.render('tool_templatelibrary/search_results', { templates: templateList })
.done(function (result, js) { .done(function(result, js) {
templates.replaceNode($('[data-region="searchresults"]'), result, js); templates.replaceNode($('[data-region="searchresults"]'), result, js);
}).fail(notification.exception); }).fail(notification.exception);
}; };

View File

@ -28,9 +28,9 @@ define(['jquery'], function($) {
// Copied from lib/navigationlib.php navigation_node constants. // Copied from lib/navigationlib.php navigation_node constants.
var NODETYPE = { var NODETYPE = {
// @type int Activity (course module) = 40. // @type int Activity (course module) = 40.
ACTIVITY : 40, ACTIVITY: 40,
// @type int Resource (course module = 50. // @type int Resource (course module = 50.
RESOURCE : 50, RESOURCE: 50,
}; };
/** /**
@ -94,7 +94,7 @@ define(['jquery'], function($) {
if (icon) { if (icon) {
link.append(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 { } else {
link.append(node.name); link.append(node.name);
} }
@ -109,7 +109,7 @@ define(['jquery'], function($) {
if (icon) { if (icon) {
span.append(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 { } else {
span.append(node.name); span.append(node.name);
} }

View File

@ -22,7 +22,7 @@
* @copyright 2015 Jun Pataleta <jun@moodle.com> * @copyright 2015 Jun Pataleta <jun@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @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. // Private variables and functions.
@ -39,7 +39,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function (
* @param remarkId The element ID of the remark text area where the text of the selected comment will be copied 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 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 * Display the chooser dialog using the compiled HTML from the mustache template
* and binds onclick events for the generated comment options. * and binds onclick events for the generated comment options.
@ -68,11 +68,11 @@ define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function (
}); });
// Loop over each comment item and bind click events. // 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; var commentOptionId = '#comment-option-' + criterionId + '-' + comment.id;
// Delegate click event for the generated option link. // Delegate click event for the generated option link.
$(commentOptionId).click(function () { $(commentOptionId).click(function() {
var remarkTextArea = $('#' + remarkId); var remarkTextArea = $('#' + remarkId);
var remarkText = remarkTextArea.val(); var remarkText = remarkTextArea.val();
@ -88,7 +88,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function (
}); });
// Handle keypress on list items. // 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; var keyCode = event.which || event.keyCode;
// Enter or space key. // Enter or space key.
@ -124,14 +124,14 @@ define(['jquery', 'core/templates', 'core/notification', 'core/yui'], function (
// Render the template and display the comment chooser dialog. // Render the template and display the comment chooser dialog.
templates.render('gradingform_guide/comment_chooser', context) templates.render('gradingform_guide/comment_chooser', context)
.done(function (compiledSource) { .done(function(compiledSource) {
displayChooserDialog(compiledSource, commentOptions); displayChooserDialog(compiledSource, commentOptions);
}) })
.fail(notification.exception); .fail(notification.exception);
} }
// Bind click event for the comments chooser button. // Bind click event for the comments chooser button.
$("#" + buttonId).click(function (e) { $("#" + buttonId).click(function(e) {
e.preventDefault(); e.preventDefault();
generateCommentsChooser(); generateCommentsChooser();
}); });

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 3.0 * @since 3.0
*/ */
define([ 'jquery', 'core/yui' ], define(['jquery', 'core/yui'],
function($, Y) { function($, Y) {
return /** @alias module:core/event */ { return /** @alias module:core/event */ {

View File

@ -28,9 +28,9 @@
* @since 2.9 * @since 2.9
*/ */
define(['jquery'], function($) { define(['jquery'], function($) {
$(document).bind("ajaxStart", function(){ $(document).bind("ajaxStart", function() {
M.util.js_pending('jq'); M.util.js_pending('jq');
}).bind("ajaxStop", function(){ }).bind("ajaxStop", function() {
M.util.js_complete('jq'); M.util.js_complete('jq');
}); });
}); });

View File

@ -90,7 +90,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
} }
originalSelect.children('option').each(function(index, ele) { originalSelect.children('option').each(function(index, ele) {
if ($(ele).prop('selected')) { 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); var context = $.extend({ items: items }, options, state);
@ -215,7 +215,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
// Find it's index. // Find it's index.
var current = suggestionsElement.children('[aria-hidden=false]').index(element); var current = suggestionsElement.children('[aria-hidden=false]').index(element);
// Activate the next one. // Activate the next one.
activateItem(current+1, state); activateItem(current + 1, state);
}; };
/** /**
@ -237,7 +237,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
// Find it's index. // Find it's index.
var current = selectionsElement.children('[aria-selected=true]').index(element); var current = selectionsElement.children('[aria-selected=true]').index(element);
// Activate the next one. // 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 the index of the current active selection, and activate the next one.
@ -258,7 +258,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
// Find it's index. // Find it's index.
var current = selectionsElement.children('[aria-selected=true]').index(element); var current = selectionsElement.children('[aria-selected=true]').index(element);
// Activate the next one. // Activate the next one.
activateSelection(current+1, state); activateSelection(current + 1, state);
}; };
/** /**
@ -276,7 +276,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
// Find it's index. // Find it's index.
var current = suggestionsElement.children('[aria-hidden=false]').index(element); var current = suggestionsElement.children('[aria-hidden=false]').index(element);
// Activate the next one. // Activate the next one.
activateItem(current-1, state); activateItem(current - 1, state);
}; };
/** /**
@ -723,7 +723,7 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
options.showSuggestions = showSuggestions; options.showSuggestions = showSuggestions;
} }
if (typeof noSelectionString === "undefined") { if (typeof noSelectionString === "undefined") {
str.get_string('noselection', 'form').done(function (result) { str.get_string('noselection', 'form').done(function(result) {
options.noSelectionString = result; options.noSelectionString = result;
}).fail(notification.exception); }).fail(notification.exception);
} }

View File

@ -50,7 +50,7 @@ define(['jquery', 'core/ajax'], function($, ajax) {
var promises = ajax.call([{ var promises = ajax.call([{
methodname: 'core_get_fragment', methodname: 'core_get_fragment',
args:{ args: {
component: component, component: component,
callback: callback, callback: callback,
contextid: contextid, contextid: contextid,

View File

@ -46,7 +46,7 @@ define(['core/config'], function(config) {
// Disable cache if debugging. // Disable cache if debugging.
return false; return false;
} }
if (typeof(window.localStorage) === "undefined") { if (typeof (window.localStorage) === "undefined") {
return false; return false;
} }
var testKey = 'test'; var testKey = 'test';
@ -111,8 +111,8 @@ define(['core/config'], function(config) {
return hash; return hash;
} }
for (i = 0, len = source.length; i < len; i++) { for (i = 0, len = source.length; i < len; i++) {
chr = source.charCodeAt(i); chr = source.charCodeAt(i);
hash = ((hash << 5) - hash) + chr; hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer hash |= 0; // Convert to 32bit integer
} }
return hash; return hash;

View File

@ -25,10 +25,10 @@
*/ */
define(['core/loglevel'], function(log) { define(['core/loglevel'], function(log) {
var originalFactory = log.methodFactory; var originalFactory = log.methodFactory;
log.methodFactory = function (methodName, logLevel) { log.methodFactory = function(methodName, logLevel) {
var rawMethod = originalFactory(methodName, logLevel); var rawMethod = originalFactory(methodName, logLevel);
return function (message, source) { return function(message, source) {
if (source) { if (source) {
rawMethod(source + ": " + message); rawMethod(source + ": " + message);
} else { } else {

View File

@ -97,7 +97,7 @@ function(Y, $, log) {
if (notification.template) { if (notification.template) {
template = notification.template; template = notification.template;
delete notification.template; delete notification.template;
} else if (notification.type){ } else if (notification.type) {
if (typeof notificationModule.types[notification.type] !== 'undefined') { if (typeof notificationModule.types[notification.type] !== 'undefined') {
template = notificationModule.types[notification.type]; template = notificationModule.types[notification.type];
} }
@ -126,10 +126,10 @@ function(Y, $, log) {
alert: function(title, message, yesLabel) { alert: function(title, message, yesLabel) {
// Here we are wrapping YUI. This allows us to start transitioning, but // Here we are wrapping YUI. This allows us to start transitioning, but
// wait for a good alternative without having inconsistent dialogues. // 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({ var alert = new M.core.alert({
title : title, title: title,
message : message, message: message,
yesLabel: yesLabel yesLabel: yesLabel
}); });
@ -140,10 +140,10 @@ function(Y, $, log) {
confirm: function(title, question, yesLabel, noLabel, yesCallback, noCallback) { confirm: function(title, question, yesLabel, noLabel, yesCallback, noCallback) {
// Here we are wrapping YUI. This allows us to start transitioning, but // Here we are wrapping YUI. This allows us to start transitioning, but
// wait for a good alternative without having inconsistent dialogues. // 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({ var modal = new M.core.confirm({
title : title, title: title,
question : question, question: question,
yesLabel: yesLabel, yesLabel: yesLabel,
noLabel: noLabel noLabel: noLabel
}); });
@ -169,7 +169,7 @@ function(Y, $, log) {
ex.stack = ex.debuginfo; ex.stack = ex.debuginfo;
ex.name = ex.errorcode; 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); var modal = new M.core.exception(ex);
modal.show(); modal.show();

View File

@ -23,7 +23,7 @@
/** /**
* @module admin/permissionmanager * @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 * Used CSS selectors
@ -63,7 +63,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
}; };
loadOverideableRoles(); loadOverideableRoles();
} }
catch(err) { catch (err) {
notification.exception(err); notification.exception(err);
} }
}) })
@ -118,11 +118,11 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
default: default:
return; return;
} }
templates.render('core/permissionmanager_role',templatedata) templates.render('core/permissionmanager_role', templatedata)
.done(function (content) { .done(function(content) {
if (action == 'allow'){ if (action == 'allow') {
$(content).insertBefore(row.find('.allowmore:first')); $(content).insertBefore(row.find('.allowmore:first'));
}else if (action == 'prohibit'){ } else if (action == 'prohibit') {
$(content).insertBefore(row.find('.prohibitmore:first')); $(content).insertBefore(row.find('.prohibitmore:first'));
// Remove allowed link // Remove allowed link
var allowedLink = row.find('.allowedroles').first().find('a[data-role-id="' + roleid + '"]'); var allowedLink = row.find('.allowedroles').first().find('a[data-role-id="' + roleid + '"]');
@ -134,7 +134,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
}) })
.fail(notification.exception); .fail(notification.exception);
} }
catch(err) { catch (err) {
notification.exception(err); notification.exception(err);
} }
}) })
@ -150,7 +150,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
* @method handleAddRole * @method handleAddRole
* @param {event} e * @param {event} e
*/ */
var handleAddRole = function(e){ var handleAddRole = function(e) {
e.preventDefault(); e.preventDefault();
$('body').one('rolesloaded', function() { $('body').one('rolesloaded', function() {
@ -162,8 +162,8 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
context: contextname context: contextname
}; };
var message = M.util.get_string('role' + action + 'info', 'core_role', confirmationDetails); var message = M.util.get_string('role' + action + 'info', 'core_role', confirmationDetails);
if (panel === null){ if (panel === null) {
panel = new M.core.dialogue ({ panel = new M.core.dialogue({
draggable: true, draggable: true,
modal: true, modal: true,
closeButton: true, closeButton: true,
@ -175,7 +175,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
var i, existingrolelinks; var i, existingrolelinks;
var roles = []; var roles = [];
switch (action){ switch (action) {
case 'allow': case 'allow':
existingrolelinks = row.find(SELECTORS.REMOVEROLE); existingrolelinks = row.find(SELECTORS.REMOVEROLE);
break; break;
@ -186,18 +186,18 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
for (i in overideableroles) { for (i in overideableroles) {
var disabled = ''; var disabled = '';
var disable = existingrolelinks.filter("[data-role-id='" + i + "']").length; var disable = existingrolelinks.filter("[data-role-id='" + i + "']").length;
if (disable){ if (disable) {
disabled = 'disabled'; disabled = 'disabled';
} }
var roledetails = {roleid:i, rolename: overideableroles[i], disabled:disabled}; var roledetails = {roleid: i, rolename: overideableroles[i], disabled: disabled};
roles.push(roledetails); roles.push(roledetails);
} }
templates.render('core/permissionmanager_panelcontent',{message:message, roles:roles}) templates.render('core/permissionmanager_panelcontent', {message: message, roles: roles})
.done(function (content) { .done(function(content) {
panel.set('bodyContent', content); panel.set('bodyContent', content);
panel.show(); 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'); var roleid = $(e.currentTarget).data('role-id');
changePermissions(row, roleid, action); changePermissions(row, roleid, action);
}); });
@ -215,7 +215,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
* @method handleRemoveRole * @method handleRemoveRole
* @param {event} e * @param {event} e
*/ */
var handleRemoveRole = function(e){ var handleRemoveRole = function(e) {
e.preventDefault(); e.preventDefault();
$('body').one('rolesloaded', function() { $('body').one('rolesloaded', function() {
var link = $(e.currentTarget); var link = $(e.currentTarget);
@ -229,10 +229,10 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
}; };
notification.confirm(M.util.get_string('confirmunassigntitle', 'core_role'), 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('confirmunassignyes', 'core_role'),
M.util.get_string('confirmunassignno', 'core_role'), M.util.get_string('confirmunassignno', 'core_role'),
function(){ function() {
changePermissions(row, roleid, action); changePermissions(row, roleid, action);
} }
); );
@ -248,7 +248,7 @@ define(['jquery', 'core/config','core/notification', 'core/templates'], function
* @param {string} contextname * @param {string} contextname
* @param {string} adminurl * @param {string} adminurl
*/ */
initialize : function(args) { initialize: function(args) {
contextid = args.contextid; contextid = args.contextid;
contextname = args.contextname; contextname = args.contextname;
adminurl = args.adminurl; adminurl = args.adminurl;

View File

@ -35,10 +35,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
// Click handler for changing tag type. // Click handler for changing tag type.
$('body').delegate('.tagarea[data-ta] a[data-quickload=1]', 'click', function(e) { $('body').delegate('.tagarea[data-ta] a[data-quickload=1]', 'click', function(e) {
e.preventDefault(); e.preventDefault();
var target = $( this ), var target = $(this),
query = target.context.search.replace(/^\?/, ''), query = target.context.search.replace(/^\?/, ''),
tagarea = target.closest('.tagarea[data-ta]'), 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([{ var promises = ajax.call([{
methodname: 'core_tag_get_tagindex', methodname: 'core_tag_get_tagindex',
@ -46,7 +46,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
}], true); }], true);
$.when.apply($, promises) $.when.apply($, promises)
.done( function(data) { .done(function(data) {
templates.render('core_tag/index', data).done(function(html) { templates.render('core_tag/index', data).done(function(html) {
tagarea.replaceWith(html); tagarea.replaceWith(html);
}); });
@ -81,10 +81,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
e.preventDefault(); e.preventDefault();
var href = $(this).attr('href'); var href = $(this).attr('href');
str.get_strings([ str.get_strings([
{key : 'delete'}, {key: 'delete'},
{key : 'confirmdeletetag', component : 'tag'}, {key: 'confirmdeletetag', component: 'tag'},
{key : 'yes'}, {key: 'yes'},
{key : 'no'}, {key: 'no'},
]).done(function(s) { ]).done(function(s) {
notification.confirm(s[0], s[1], s[2], s[3], function() { notification.confirm(s[0], s[1], s[2], s[3], function() {
window.location.href = href; window.location.href = href;
@ -94,7 +94,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
}); });
// Confirmation for bulk tag delete button. // 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), var form = $(this).closest('form').get(0),
cnt = $(form).find("input[type=checkbox]:checked").length; cnt = $(form).find("input[type=checkbox]:checked").length;
if (!cnt) { if (!cnt) {
@ -103,10 +103,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
var tempElement = $("<input type='hidden'/>").attr('name', this.name); var tempElement = $("<input type='hidden'/>").attr('name', this.name);
e.preventDefault(); e.preventDefault();
str.get_strings([ str.get_strings([
{key : 'delete'}, {key: 'delete'},
{key : 'confirmdeletetags', component : 'tag'}, {key: 'confirmdeletetags', component: 'tag'},
{key : 'yes'}, {key: 'yes'},
{key : 'no'}, {key: 'no'},
]).done(function(s) { ]).done(function(s) {
notification.confirm(s[0], s[1], s[2], s[3], function() { notification.confirm(s[0], s[1], s[2], s[3], function() {
tempElement.appendTo(form); tempElement.appendTo(form);
@ -117,15 +117,15 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
}); });
// Confirmation for bulk tag combine button. // Confirmation for bulk tag combine button.
$("#tag-management-combine").click(function(e){ $("#tag-management-combine").click(function(e) {
e.preventDefault(); e.preventDefault();
var form = $(this).closest('form').get(0), var form = $(this).closest('form').get(0),
tags = $(form).find("input[type=checkbox]:checked"); tags = $(form).find("input[type=checkbox]:checked");
if (tags.length <= 1) { if (tags.length <= 1) {
str.get_strings([ str.get_strings([
{key : 'combineselected', component : 'tag'}, {key: 'combineselected', component: 'tag'},
{key : 'selectmultipletags', component : 'tag'}, {key: 'selectmultipletags', component: 'tag'},
{key : 'ok'}, {key: 'ok'},
]).done(function(s) { ]).done(function(s) {
notification.alert(s[0], s[1], s[2]); notification.alert(s[0], s[1], s[2]);
} }
@ -134,14 +134,14 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
} }
var tempElement = $("<input type='hidden'/>").attr('name', this.name); var tempElement = $("<input type='hidden'/>").attr('name', this.name);
str.get_strings([ str.get_strings([
{key : 'combineselected', component : 'tag'}, {key: 'combineselected', component: 'tag'},
{key : 'selectmaintag', component : 'tag'}, {key: 'selectmaintag', component: 'tag'},
{key : 'continue'}, {key: 'continue'},
{key : 'cancel'}, {key: 'cancel'},
]).done(function(s) { ]).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="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>' + '<input type="button" id="combinetags_cancel"/></p>' +
'</form></div>'); '</form></div>');
el.find('.description').html(s[1]); el.find('.description').html(s[1]);
@ -150,11 +150,11 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
var fldset = el.find('.options'); var fldset = el.find('.options');
tags.each(function() { tags.each(function() {
var tagid = $(this).val(), var tagid = $(this).val(),
tagname = $('.inplaceeditable[data-itemtype=tagname][data-itemid='+tagid+']').attr('data-value'); tagname = $('.inplaceeditable[data-itemtype=tagname][data-itemid=' + tagid + ']').attr('data-value');
fldset.append($('<input type="radio" name="maintag" id="combinetags_maintag_'+tagid+'" value="'+tagid+ fldset.append($('<input type="radio" name="maintag" id="combinetags_maintag_' + tagid + '" value="' + tagid +
'"/><label for="combinetags_maintag_'+tagid+'">'+tagname+'</label><br>')); '"/><label for="combinetags_maintag_' + tagid + '">' + tagname + '</label><br>'));
}); });
var panel = new M.core.dialogue ({ var panel = new M.core.dialogue({
draggable: true, draggable: true,
modal: true, modal: true,
closeButton: true, closeButton: true,
@ -184,9 +184,9 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
if (exception.errorcode === 'namesalreadybeeingused') { if (exception.errorcode === 'namesalreadybeeingused') {
e.preventDefault(); // This will prevent default error dialogue. e.preventDefault(); // This will prevent default error dialogue.
str.get_strings([ str.get_strings([
{key : 'nameuseddocombine', component : 'tag'}, {key: 'nameuseddocombine', component: 'tag'},
{key : 'yes'}, {key: 'yes'},
{key : 'cancel'}, {key: 'cancel'},
]).done(function(s) { ]).done(function(s) {
notification.confirm(e.message, s[0], s[1], s[2], function() { notification.confirm(e.message, s[0], s[1], s[2], function() {
window.location.href = window.location.href + "&newname=" + encodeURIComponent(newvalue) + window.location.href = window.location.href + "&newname=" + encodeURIComponent(newvalue) +
@ -201,10 +201,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
$('body').on('click', 'a[data-action=addstandardtag]', function(e) { $('body').on('click', 'a[data-action=addstandardtag]', function(e) {
e.preventDefault(); e.preventDefault();
str.get_strings([ str.get_strings([
{key : 'addotags', component : 'tag'}, {key: 'addotags', component: 'tag'},
{key : 'inputstandardtags', component : 'tag'}, {key: 'inputstandardtags', component: 'tag'},
{key : 'continue'}, {key: 'continue'},
{key : 'cancel'}, {key: 'cancel'},
]).done(function(s) { ]).done(function(s) {
var el = $('<div><form id="addtags_form" class="form-inline" method="POST">' + var el = $('<div><form id="addtags_form" class="form-inline" method="POST">' +
'<input type="hidden" name="action" value="addstandardtag"/>' + '<input type="hidden" name="action" value="addstandardtag"/>' +
@ -217,7 +217,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
el.find('#addtags_form').attr('action', window.location.href); el.find('#addtags_form').attr('action', window.location.href);
el.find('#addtags_submit').attr('value', s[2]); el.find('#addtags_submit').attr('value', s[2]);
el.find('#addtags_cancel').attr('value', s[3]); el.find('#addtags_cancel').attr('value', s[3]);
var panel = new M.core.dialogue ({ var panel = new M.core.dialogue({
draggable: true, draggable: true,
modal: true, modal: true,
closeButton: true, closeButton: true,
@ -244,12 +244,12 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
areaid, collid, isenabled; areaid, collid, isenabled;
if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareaenable') { if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareaenable') {
areaid = $(this).attr('data-itemid'); 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; isenabled = ajaxreturn.value;
if (isenabled === '1') { if (isenabled === '1') {
$(this).closest('tr').removeClass('dimmed_text'); $(this).closest('tr').removeClass('dimmed_text');
collid = $(this).closest('tr').find('[data-itemtype="tagareacollection"]').attr("data-value"); 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'); .removeClass('hidden');
} else { } else {
$(this).closest('tr').addClass('dimmed_text'); $(this).closest('tr').addClass('dimmed_text');
@ -257,11 +257,11 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
} }
if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareacollection') { if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareacollection') {
areaid = $(this).attr('data-itemid'); 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'); collid = $(this).attr('data-value');
isenabled = $(this).closest('tr').find('[data-itemtype="tagareaenable"]').attr("data-value"); isenabled = $(this).closest('tr').find('[data-itemtype="tagareaenable"]').attr("data-value");
if (isenabled === "1") { 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'); .removeClass('hidden');
} }
} }
@ -271,25 +271,25 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
e.preventDefault(); e.preventDefault();
var href = $(this).attr('data-url') + '&sesskey=' + M.cfg.sesskey; var href = $(this).attr('data-url') + '&sesskey=' + M.cfg.sesskey;
str.get_strings([ str.get_strings([
{key : 'addtagcoll', component : 'tag'}, {key: 'addtagcoll', component: 'tag'},
{key : 'name'}, {key: 'name'},
{key : 'searchable', component : 'tag'}, {key: 'searchable', component: 'tag'},
{key : 'create'}, {key: 'create'},
{key : 'cancel'}, {key: 'cancel'},
]).done(function(s) { ]).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>: ' + '<p><label for="addtagcoll_name"></label>: ' +
'<input id="addtagcoll_name" type="text"/></p>' + '<input id="addtagcoll_name" type="text"/></p>' +
'<p><label for="addtagcoll_searchable"></label>: ' + '<p><label for="addtagcoll_searchable"></label>: ' +
'<input id="addtagcoll_searchable" type="checkbox" value="1" checked/></p>' + '<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>' + '<input type="button" id="addtagcoll_cancel"/></p>' +
'</form></div>'); '</form></div>');
el.find('label[for="addtagcoll_name"]').html(s[1]); el.find('label[for="addtagcoll_name"]').html(s[1]);
el.find('label[for="addtagcoll_searchable"]').html(s[2]); el.find('label[for="addtagcoll_searchable"]').html(s[2]);
el.find('#addtagcoll_submit').attr('value', s[3]); el.find('#addtagcoll_submit').attr('value', s[3]);
el.find('#addtagcoll_cancel').attr('value', s[4]); el.find('#addtagcoll_cancel').attr('value', s[4]);
var panel = new M.core.dialogue ({ var panel = new M.core.dialogue({
draggable: true, draggable: true,
modal: true, modal: true,
closeButton: true, closeButton: true,
@ -318,10 +318,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
e.preventDefault(); e.preventDefault();
var href = $(this).attr('data-url') + '&sesskey=' + M.cfg.sesskey; var href = $(this).attr('data-url') + '&sesskey=' + M.cfg.sesskey;
str.get_strings([ str.get_strings([
{key : 'delete'}, {key: 'delete'},
{key : 'suredeletecoll', component : 'tag', param : $(this).attr('data-collname') }, {key: 'suredeletecoll', component: 'tag', param: $(this).attr('data-collname') },
{key : 'yes'}, {key: 'yes'},
{key : 'no'}, {key: 'no'},
]).done(function(s) { ]).done(function(s) {
notification.confirm(s[0], s[1], s[2], s[3], function() { notification.confirm(s[0], s[1], s[2], s[3], function() {
window.location.href = href; window.location.href = href;

View File

@ -23,7 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 2.9 * @since 2.9
*/ */
define([ 'core/mustache', define(['core/mustache',
'jquery', 'jquery',
'core/ajax', 'core/ajax',
'core/str', 'core/str',
@ -90,7 +90,7 @@ define([ 'core/mustache',
// Oh well - load via ajax. // Oh well - load via ajax.
var promises = ajax.call([{ var promises = ajax.call([{
methodname: 'core_output_load_template', methodname: 'core_output_load_template',
args:{ args: {
component: component, component: component,
template: name, template: name,
themename: currentThemeName themename: currentThemeName
@ -98,13 +98,13 @@ define([ 'core/mustache',
}], async, false); }], async, false);
promises[0].done( promises[0].done(
function (templateSource) { function(templateSource) {
storage.set('core_template/' + searchKey, templateSource); storage.set('core_template/' + searchKey, templateSource);
templateCache[searchKey] = templateSource; templateCache[searchKey] = templateSource;
deferred.resolve(templateSource); deferred.resolve(templateSource);
} }
).fail( ).fail(
function (ex) { function(ex) {
deferred.reject(ex); deferred.reject(ex);
} }
); );
@ -263,7 +263,7 @@ define([ 'core/mustache',
context.pix = function() { return pixHelper; }; context.pix = function() { return pixHelper; };
context.js = function() { return jsHelper; }; context.js = function() { return jsHelper; };
context.quote = function() { return quoteHelper; }; context.quote = function() { return quoteHelper; };
context.globals = { config : config }; context.globals = { config: config };
context.currentTheme = themeName; context.currentTheme = themeName;
}; };
@ -414,7 +414,7 @@ define([ 'core/mustache',
*/ */
var runTemplateJS = function(source) { var runTemplateJS = function(source) {
if (source.trim() !== '') { if (source.trim() !== '') {
var newscript = $('<script>').attr('type','text/javascript').html(source); var newscript = $('<script>').attr('type', 'text/javascript').html(source);
$('head').append(newscript); $('head').append(newscript);
} }
}; };

View File

@ -69,10 +69,10 @@ define(['jquery', 'core/notification', 'core/str', 'core/form-autocomplete',
// We do not allow navigation while ajax requests are pending. // 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; this._isLoading = true;
}.bind(this)); }.bind(this));
$(document).bind("finish-loading-user", function(){ $(document).bind("finish-loading-user", function() {
this._isLoading = false; this._isLoading = false;
}.bind(this)); }.bind(this));
}; };

View File

@ -153,7 +153,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
var promise = toolType.create({cartridgeurl: url, key: consumerKey, secret: sharedSecret}); var promise = toolType.create({cartridgeurl: url, key: consumerKey, secret: sharedSecret});
promise.done(function() { 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.NEW_TOOL_TYPE);
$(document).trigger(ltiEvents.STOP_CARTRIDGE_REGISTRATION); $(document).trigger(ltiEvents.STOP_CARTRIDGE_REGISTRATION);
$(document).trigger(ltiEvents.REGISTRATION_FEEDBACK, { $(document).trigger(ltiEvents.REGISTRATION_FEEDBACK, {
@ -161,7 +161,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
}); });
}).fail(notification.exception); }).fail(notification.exception);
}).fail(function() { }).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.NEW_TOOL_TYPE);
$(document).trigger(ltiEvents.STOP_CARTRIDGE_REGISTRATION); $(document).trigger(ltiEvents.STOP_CARTRIDGE_REGISTRATION);
$(document).trigger(ltiEvents.REGISTRATION_FEEDBACK, { $(document).trigger(ltiEvents.REGISTRATION_FEEDBACK, {

View File

@ -306,7 +306,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
var id = getToolProxyId(); var id = getToolProxyId();
toolProxy.delete(id).done(function() { toolProxy.delete(id).done(function() {
promise.resolve(); promise.resolve();
}).fail(function (failure) { }).fail(function(failure) {
promise.reject(failure); promise.reject(failure);
}); });
} else { } else {
@ -317,11 +317,11 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
// Return to the original page. // Return to the original page.
finishExternalRegistration(); finishExternalRegistration();
stopLoadingCancel(); stopLoadingCancel();
}).fail(function (failure) { }).fail(function(failure) {
notification.exception(failure); notification.exception(failure);
finishExternalRegistration(); finishExternalRegistration();
stopLoadingCancel(); stopLoadingCancel();
str.get_string('failedtodeletetoolproxy', 'mod_lti').done(function (s) { str.get_string('failedtodeletetoolproxy', 'mod_lti').done(function(s) {
var feedback = { var feedback = {
message: s, message: s,
error: true error: true
@ -569,7 +569,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
}; };
if (data.status == "success") { 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; feedback.message = s;
}).fail(notification.exception); }).fail(notification.exception);

View File

@ -272,7 +272,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
announceFailure(element); announceFailure(element);
promise.reject(error); promise.reject(error);
}); });
}, function () { }, function() {
stopLoading(element); stopLoading(element);
promise.resolve(); promise.resolve();
}); });

View File

@ -277,7 +277,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
.fail(promise.reject); .fail(promise.reject);
promise.fail(notification.exception) promise.fail(notification.exception)
.always(function () { .always(function() {
stopLoading(container); stopLoading(container);
}); });
}; };
@ -313,9 +313,9 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/e
} }
}); });
promise.fail(function () { promise.fail(function() {
str.get_string('errorbadurl', 'mod_lti') str.get_string('errorbadurl', 'mod_lti')
.done(function (s) { .done(function(s) {
$(document).trigger(ltiEvents.REGISTRATION_FEEDBACK, { $(document).trigger(ltiEvents.REGISTRATION_FEEDBACK, {
message: s, message: s,
error: true error: true

View File

@ -205,7 +205,7 @@ define(['jquery', 'core/ajax', 'core/notification', 'core/templates', 'mod_lti/t
announceFailure(element); announceFailure(element);
promise.reject(error); promise.reject(error);
}); });
}, function () { }, function() {
stopLoading(element); stopLoading(element);
promise.resolve(); promise.resolve();
}); });

View File

@ -45,7 +45,7 @@ define(['jquery', 'core/yui'], function($, Y) {
init: function(startButton, confirmationTitle, confirmationForm, popupoptions) { init: function(startButton, confirmationTitle, confirmationForm, popupoptions) {
var finalStartButton = startButton; 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)) { if (Y.one(confirmationForm)) {
t.confirmDialogue = new M.core.dialogue({ t.confirmDialogue = new M.core.dialogue({
headerContent: confirmationTitle, headerContent: confirmationTitle,

View File

@ -52,16 +52,16 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/log', 'cor
log.debug('Clicked on cell: competencyId=' + competencyId + ', courseId=' + courseId + ', userId=' + userId); log.debug('Clicked on cell: competencyId=' + competencyId + ', courseId=' + courseId + ', userId=' + userId);
var requests = ajax.call([{ 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 }, args: { userid: userId, competencyid: competencyId, courseid: courseId },
done: this._contextLoaded.bind(this), done: this._contextLoaded.bind(this),
fail: notification.exception fail: notification.exception
}]); }]);
// Log the user competency viewed in course event. // Log the user competency viewed in course event.
requests[0].then(function(){ requests[0].then(function() {
ajax.call([{ 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 }, args: { userid: userId, competencyid: competencyId, courseid: courseId },
fail: notification.exception fail: notification.exception
}]); }]);
@ -96,7 +96,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/log', 'cor
var userId = region.data('userid'); var userId = region.data('userid');
ajax.call([{ ajax.call([{
methodname : 'report_competency_data_for_report', methodname: 'report_competency_data_for_report',
args: { courseid: courseId, userid: userId }, args: { courseid: courseId, userid: userId },
done: this._pageContextLoaded.bind(this), done: this._pageContextLoaded.bind(this),
fail: notification.exception fail: notification.exception