diff --git a/admin/tool/capability/yui/src/search/js/search.js b/admin/tool/capability/yui/src/search/js/search.js index 785263ad387ce..b3b152721fbc1 100644 --- a/admin/tool/capability/yui/src/search/js/search.js +++ b/admin/tool/capability/yui/src/search/js/search.js @@ -22,7 +22,7 @@ SEARCH.prototype = { * @type Node * @protected */ - form : null, + form: null, /** * The capability select node. * @property select @@ -36,7 +36,7 @@ SEARCH.prototype = { * @type Object * @protected */ - selectoptions : {}, + selectoptions: {}, /** * The search input field. * @property input @@ -58,12 +58,12 @@ SEARCH.prototype = { * @type Node * @protected */ - lastsearch : null, + lastsearch: null, /** * Constructs the search manager. * @method initializer */ - initializer : function() { + initializer: function() { this.form = Y.one('#capability-overview-form'); this.select = this.form.one('select[data-search=capability]'); this.select.setStyle('minWidth', this.select.get('offsetWidth')); @@ -75,7 +75,7 @@ SEARCH.prototype = { this.lastsearch = this.form.one('input[name=search]'); var div = Y.Node.create('
'), - label = Y.Node.create(''); + label = Y.Node.create(''); this.input = Y.Node.create(''); div.append(label).append(this.input); @@ -99,7 +99,7 @@ SEARCH.prototype = { * Disables the submit button if there are no capabilities selected. * @method validate */ - validate : function() { + validate: function() { this.button.set('disabled', (this.select.get('value') === '')); }, /** @@ -107,7 +107,7 @@ SEARCH.prototype = { * This method hides any capabilities that don't match the search term. * @method typed */ - typed : function() { + typed: function() { var search = this.input.get('value'), matching = 0, last = null, @@ -135,9 +135,9 @@ SEARCH.prototype = { } }; Y.extend(SEARCH, Y.Base, SEARCH.prototype, { - NAME : 'tool_capability-search', - ATTRS : { - strsearch : {} + NAME: 'tool_capability-search', + ATTRS: { + strsearch: {} } }); diff --git a/admin/tool/lp/yui/src/dragdrop-reorder/js/dragdropreorder.js b/admin/tool/lp/yui/src/dragdrop-reorder/js/dragdropreorder.js index 3624631762187..c422595e9bea2 100644 --- a/admin/tool/lp/yui/src/dragdrop-reorder/js/dragdropreorder.js +++ b/admin/tool/lp/yui/src/dragdrop-reorder/js/dragdropreorder.js @@ -46,9 +46,9 @@ Y.extend(DRAGREORDER, M.core.dragdrop, { Y.one('.' + args.parentNodeClass) .all('.' + args.dragHandleInsertClass) .each( - function (node) { + function(node) { node.insert(this.draghandle.cloneNode(true)); - } , this); + }, this); }, drop_hit: function(e) { diff --git a/availability/condition/date/yui/src/form/js/form.js b/availability/condition/date/yui/src/form/js/form.js index ca45ffc6e8cd5..2c5df1e523f86 100644 --- a/availability/condition/date/yui/src/form/js/form.js +++ b/availability/condition/date/yui/src/form/js/form.js @@ -45,8 +45,8 @@ M.availability_date.form.getNode = function(json) { var url = M.cfg.wwwroot + '/availability/condition/date/ajax.php?action=fromtime' + '&time=' + json.t; - Y.io(url, { on : { - success : function(id, response) { + Y.io(url, {on: { + success: function(id, response) { var fields = Y.JSON.parse(response.responseText); for (var field in fields) { var select = node.one('select[name=x\\[' + field + '\\]]'); @@ -54,7 +54,7 @@ M.availability_date.form.getNode = function(json) { select.set('disabled', false); } }, - failure : function() { + failure: function() { window.alert(M.util.get_string('ajaxerror', 'availability_date')); } }}); @@ -123,12 +123,12 @@ M.availability_date.form.updateTime = function(node) { '&day=' + node.one('select[name=x\\[day\\]]').get('value') + '&hour=' + node.one('select[name=x\\[hour\\]]').get('value') + '&minute=' + node.one('select[name=x\\[minute\\]]').get('value'); - Y.io(url, { on : { - success : function(id, response) { + Y.io(url, {on: { + success: function(id, response) { node.setData('time', response.responseText); M.core_availability.form.update(); }, - failure : function() { + failure: function() { window.alert(M.util.get_string('ajaxerror', 'availability_date')); } }}); diff --git a/availability/condition/grade/yui/src/form/js/form.js b/availability/condition/grade/yui/src/form/js/form.js index b8717b168c725..7a51507e37c5d 100644 --- a/availability/condition/grade/yui/src/form/js/form.js +++ b/availability/condition/grade/yui/src/form/js/form.js @@ -149,8 +149,8 @@ M.availability_grade.form.fillErrors = function(errors, node) { } // Check numeric values. - if ((value.min !== undefined && typeof(value.min) === 'string') || - (value.max !== undefined && typeof(value.max) === 'string')) { + if ((value.min !== undefined && typeof (value.min) === 'string') || + (value.max !== undefined && typeof (value.max) === 'string')) { errors.push('availability_grade:error_invalidnumber'); } else if (value.min !== undefined && value.max !== undefined && value.min >= value.max) { diff --git a/availability/yui/src/form/js/form.js b/availability/yui/src/form/js/form.js index 4edbbca1c47a6..0ccb859569841 100644 --- a/availability/yui/src/form/js/form.js +++ b/availability/yui/src/form/js/form.js @@ -30,7 +30,7 @@ M.core_availability.form = { * @property plugins * @type Object */ - plugins : {}, + plugins: {}, /** * Availability field (textarea). @@ -38,7 +38,7 @@ M.core_availability.form = { * @property field * @type Y.Node */ - field : null, + field: null, /** * Main div that replaces the availability field. @@ -46,7 +46,7 @@ M.core_availability.form = { * @property mainDiv * @type Y.Node */ - mainDiv : null, + mainDiv: null, /** * Object that represents the root of the tree. @@ -54,7 +54,7 @@ M.core_availability.form = { * @property rootList * @type M.core_availability.List */ - rootList : null, + rootList: null, /** * Counter used when creating anything that needs an id. @@ -62,7 +62,7 @@ M.core_availability.form = { * @property idCounter * @type Number */ - idCounter : 0, + idCounter: 0, /** * The 'Restrict by group' button if present. @@ -70,7 +70,7 @@ M.core_availability.form = { * @property restrictByGroup * @type Y.Node */ - restrictByGroup : null, + restrictByGroup: null, /** * Called to initialise the system when the page loads. This method will @@ -78,9 +78,9 @@ M.core_availability.form = { * * @method init */ - init : function(pluginParams) { + init: function(pluginParams) { // Init all plugins. - for(var plugin in pluginParams) { + for (var plugin in pluginParams) { var params = pluginParams[plugin]; var pluginClass = M[params[0]].form; pluginClass.init.apply(pluginClass, params); @@ -106,7 +106,7 @@ M.core_availability.form = { if (value !== '') { try { data = Y.JSON.parse(value); - } catch(x) { + } catch (x) { // If the JSON data is not valid, treat it as empty. this.field.set('value', ''); } @@ -152,7 +152,7 @@ M.core_availability.form = { * * @method update */ - update : function() { + update: function() { // Convert tree to value. var jsValue = this.rootList.getValue(); @@ -174,7 +174,7 @@ M.core_availability.form = { * Updates the status of the 'restrict by group' button (enables or disables * it) based on current availability restrictions and group/grouping settings. */ - updateRestrictByGroup : function() { + updateRestrictByGroup: function() { if (!this.restrictByGroup) { return; } @@ -213,7 +213,7 @@ M.core_availability.form = { * * @param e Button click event */ - addRestrictByGroup : function(e) { + addRestrictByGroup: function(e) { // If you don't prevent default, it submits the form for some reason. e.preventDefault(); @@ -223,10 +223,10 @@ M.core_availability.form = { if (groupingid && Number(groupingid.get('value')) !== 0) { // Add a grouping restriction if one is specified. newChild = new M.core_availability.Item( - {type : 'grouping', id : Number(groupingid.get('value'))}, true); + {type: 'grouping', id: Number(groupingid.get('value'))}, true); } else { // Otherwise just add a group restriction. - newChild = new M.core_availability.Item({type : 'group'}, true); + newChild = new M.core_availability.Item({type: 'group'}, true); } // Refresh HTML. @@ -251,7 +251,7 @@ M.core_availability.plugin = { * @property allowAdd * @type Boolean */ - allowAdd : false, + allowAdd: false, /** * Called (from PHP) to initialise the plugin. Should usually not be @@ -260,7 +260,7 @@ M.core_availability.plugin = { * @method init * @param {String} component Component name e.g. 'availability_date' */ - init : function(component, allowAdd, params) { + init: function(component, allowAdd, params) { var name = component.replace(/^availability_/, ''); this.allowAdd = allowAdd; M.core_availability.form.plugins[name] = this; @@ -276,7 +276,7 @@ M.core_availability.plugin = { * @method initInner * @protected */ - initInner : function() { + initInner: function() { }, /** @@ -287,7 +287,7 @@ M.core_availability.plugin = { * @method getNode * @return {Y.Node} YUI node */ - getNode : function() { + getNode: function() { throw 'getNode not implemented'; }, @@ -301,7 +301,7 @@ M.core_availability.plugin = { * @param {Object} value Value object (to be written to) * @param {Y.Node} node YUI node (same one returned from getNode) */ - fillValue : function() { + fillValue: function() { throw 'fillValue not implemented'; }, @@ -318,7 +318,7 @@ M.core_availability.plugin = { * @param {Array} errors Array of errors (push new errors here) * @param {Y.Node} node YUI node (same one returned from getNode) */ - fillErrors : function() { + fillErrors: function() { }, /** @@ -327,7 +327,7 @@ M.core_availability.plugin = { * The default implementation uses a simple algorithm to identify the * first focusable input/select and then focuses it. */ - focusAfterAdd : function(node) { + focusAfterAdd: function(node) { var target = node.one('input:not([disabled]),select:not([disabled])'); target.focus(); } @@ -530,7 +530,7 @@ M.core_availability.List.prototype.isIndividualShowIcons = function() { */ M.core_availability.List.prototype.renumber = function(parentNumber) { // Update heading for list. - var headingParams = { count: this.children.length }; + var headingParams = {count: this.children.length}; var prefix; if (parentNumber === undefined) { headingParams.number = ''; @@ -668,7 +668,7 @@ M.core_availability.List.prototype.clickAdd = function() { var cancel = content.one('button'); // Make a list of all the dialog options. - var dialogRef = { dialog: null }; + var dialogRef = {dialog: null}; var ul = content.one('ul'); var li, id, button, label; for (var type in M.core_availability.form.plugins) { @@ -701,13 +701,13 @@ M.core_availability.List.prototype.clickAdd = function() { ul.appendChild(li); var config = { - headerContent : M.util.get_string('addrestriction', 'availability'), - bodyContent : content, - additionalBaseClass : 'availability-dialogue', - draggable : true, - modal : true, - closeButton : false, - width : '450px' + headerContent: M.util.get_string('addrestriction', 'availability'), + bodyContent: content, + additionalBaseClass: 'availability-dialogue', + draggable: true, + modal: true, + closeButton: false, + width: '450px' }; dialogRef.dialog = new M.core.dialogue(config); dialogRef.dialog.show(); @@ -732,10 +732,10 @@ M.core_availability.List.prototype.getAddHandler = function(type, dialogRef) { var newItem; if (type) { // Create an Item object to represent the child. - newItem = new M.core_availability.Item({ type: type, creating: true }, this.root); + newItem = new M.core_availability.Item({type: type, creating: true}, this.root); } else { // Create a new List object to represent the child. - newItem = new M.core_availability.List({ c: [], showc: true }, false, this.root); + newItem = new M.core_availability.List({c: [], showc: true}, false, this.root); } // Add to list. this.addChild(newItem); @@ -897,7 +897,7 @@ M.core_availability.Item = function(json, root) { // hidden depending on the selected list operator. if (root) { var shown = true; - if(json.showc !== undefined) { + if (json.showc !== undefined) { shown = json.showc; } this.eyeIcon = new M.core_availability.EyeIcon(true, shown); @@ -925,7 +925,7 @@ M.core_availability.Item = function(json, root) { * @return {Object} JavaScript object containing value of this item */ M.core_availability.Item.prototype.getValue = function() { - var value = { 'type' : this.pluginType }; + var value = {'type': this.pluginType}; if (this.plugin) { this.plugin.fillValue(value, this.pluginNode); } @@ -966,7 +966,7 @@ M.core_availability.Item.prototype.fillErrors = function(errors) { */ M.core_availability.Item.prototype.renumber = function(number) { // Update heading for item. - var headingParams = { number: number }; + var headingParams = {number: number}; if (this.plugin) { headingParams.type = M.util.get_string('title', 'availability_' + this.pluginType); } else { @@ -1062,7 +1062,7 @@ M.core_availability.EyeIcon = function(individual, shown) { this.span.set('title', shownStr + ' \u2022 ' + M.util.get_string('hide_verb', 'availability')); }; - if(shown) { + if (shown) { setShown.call(this); } else { setHidden.call(this); diff --git a/backup/util/ui/yui/src/backupselectall/js/backupselectall.js b/backup/util/ui/yui/src/backupselectall/js/backupselectall.js index 040ef6a51415a..fae42eed84b76 100644 --- a/backup/util/ui/yui/src/backupselectall/js/backupselectall.js +++ b/backup/util/ui/yui/src/backupselectall/js/backupselectall.js @@ -133,19 +133,19 @@ M.core_backup.backupselectall = function(modnames) { modlist.currentlyshown = !modlist.currentlyshown; // Either hide or show the links. - var animcfg = { node: modlist, duration: 0.2 }, + var animcfg = {node: modlist, duration: 0.2}, anim; if (modlist.currentlyshown) { // Animate reveal of the module links. modlist.show(); - animcfg.to = { maxHeight: modlist.get('clientHeight') + 'px' }; + animcfg.to = {maxHeight: modlist.get('clientHeight') + 'px'}; modlist.setStyle('maxHeight', '0px'); anim = new Y.Anim(animcfg); anim.on('end', function() { modlist.setStyle('maxHeight', 'none'); }); anim.run(); } else { // Animate hide of the module links. - animcfg.to = { maxHeight: '0px' }; + animcfg.to = {maxHeight: '0px'}; modlist.setStyle('maxHeight', modlist.get('clientHeight') + 'px'); anim = new Y.Anim(animcfg); anim.on('end', function() { modlist.hide(); modlist.setStyle('maxHeight', 'none'); }); @@ -155,10 +155,10 @@ M.core_backup.backupselectall = function(modnames) { }; Y.one('#backup-bytype').on('click', function() { toggletypes(); }); - Y.one('#backup-all-included').on('click', function(e) { helper(e, true, '_included'); }); + Y.one('#backup-all-included').on('click', function(e) { helper(e, true, '_included'); }); Y.one('#backup-none-included').on('click', function(e) { helper(e, false, '_included'); }); if (withuserdata) { - Y.one('#backup-all-userdata').on('click', function(e) { helper(e, true, withuserdata); }); + Y.one('#backup-all-userdata').on('click', function(e) { helper(e, true, withuserdata); }); Y.one('#backup-none-userdata').on('click', function(e) { helper(e, false, withuserdata); }); } }; diff --git a/backup/util/ui/yui/src/confirmcancel/js/confirmcancel.js b/backup/util/ui/yui/src/confirmcancel/js/confirmcancel.js index 5128d2d605375..488fe3aae5b91 100644 --- a/backup/util/ui/yui/src/confirmcancel/js/confirmcancel.js +++ b/backup/util/ui/yui/src/confirmcancel/js/confirmcancel.js @@ -62,7 +62,7 @@ M.core_backup.confirmcancel = { var confirm = new M.core.confirm(this.config); // If the user clicks yes. - confirm.on('complete-yes', function(){ + confirm.on('complete-yes', function() { // Detach the listeners for the confirm box so they don't fire again. new Y.EventHandle(M.core_backup.confirmcancel.listeners).detach(); diff --git a/course/yui/src/coursebase/js/coursebase.js b/course/yui/src/coursebase/js/coursebase.js index 604fdae7599c4..02f668f64c6f8 100644 --- a/course/yui/src/coursebase/js/coursebase.js +++ b/course/yui/src/coursebase/js/coursebase.js @@ -19,7 +19,7 @@ var COURSEBASE = function() { */ Y.extend(COURSEBASE, Y.Base, { // Registered Modules - registermodules : [], + registermodules: [], /** * Register a new Javascript Module @@ -28,7 +28,7 @@ Y.extend(COURSEBASE, Y.Base, { * @param {Object} The instantiated module to call functions on * @chainable */ - register_module : function(object) { + register_module: function(object) { this.registermodules.push(object); return this; @@ -42,7 +42,7 @@ Y.extend(COURSEBASE, Y.Base, { * @param {mixed} args The argument supplied to the function * @chainable */ - invoke_function : function(functionname, args) { + invoke_function: function(functionname, args) { var module; for (module in this.registermodules) { if (functionname in this.registermodules[module]) { @@ -53,8 +53,8 @@ Y.extend(COURSEBASE, Y.Base, { return this; } }, { - NAME : COURSEBASENAME, - ATTRS : {} + NAME: COURSEBASENAME, + ATTRS: {} }); // Ensure that M.course exists and that coursebase is initialised correctly @@ -102,12 +102,12 @@ M.course.format.process_sections = M.course.format.process_sections || function( */ M.course.format.get_config = M.course.format.get_config || function() { return { - container_node : null, // compulsory - container_class : null, // compulsory - section_wrapper_node : null, // optional - section_wrapper_class : null, // optional - section_node : null, // compulsory - section_class : null // compulsory + container_node: null, // compulsory + container_class: null, // compulsory + section_wrapper_node: null, // optional + section_wrapper_class: null, // optional + section_node: null, // compulsory + section_class: null // compulsory }; }; diff --git a/course/yui/src/dragdrop/js/resource.js b/course/yui/src/dragdrop/js/resource.js index db57c73678d1b..1b0be26364a25 100644 --- a/course/yui/src/dragdrop/js/resource.js +++ b/course/yui/src/dragdrop/js/resource.js @@ -185,7 +185,7 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, { // TODO: revert nodes location } }, - context:this + context: this }); } }, { diff --git a/course/yui/src/dragdrop/js/section.js b/course/yui/src/dragdrop/js/section.js index b58500488fe7e..e160f15131ce9 100644 --- a/course/yui/src/dragdrop/js/section.js +++ b/course/yui/src/dragdrop/js/section.js @@ -13,7 +13,7 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { initializer: function() { // Set group for parent class - this.groups = [ CSS.SECTIONDRAGGABLE ]; + this.groups = [CSS.SECTIONDRAGGABLE]; this.samenodeclass = M.course.format.get_sectionwrapperclass(); this.parentnodeclass = M.course.format.get_containerclass(); @@ -120,7 +120,7 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { containernode.addClass(M.course.format.get_containerclass()); var sectionnode = Y.Node.create('<' + M.course.format.get_sectionwrappernode() + '>' + M.course.format.get_sectionwrappernode() + '>'); - sectionnode.addClass( M.course.format.get_sectionwrapperclass()); + sectionnode.addClass(M.course.format.get_sectionwrapperclass()); sectionnode.setStyle('margin', 0); sectionnode.setContent(drag.get('node').get('innerHTML')); containernode.appendChild(sectionnode); @@ -255,7 +255,7 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { lightbox.hide(); } }, - context:this + context: this }); } diff --git a/course/yui/src/formatchooser/js/formatchooser.js b/course/yui/src/formatchooser/js/formatchooser.js index 7133ed1dd67d6..c74b66ae744c9 100644 --- a/course/yui/src/formatchooser/js/formatchooser.js +++ b/course/yui/src/formatchooser/js/formatchooser.js @@ -3,10 +3,10 @@ var FORMATCHOOSER = function() { }; Y.extend(FORMATCHOOSER, Y.Base, { - initializer : function(params) { + initializer: function(params) { if (params && params.formid) { - var updatebut = Y.one('#'+params.formid+' #id_updatecourseformat'); - var formatselect = Y.one('#'+params.formid+' #id_format'); + var updatebut = Y.one('#' + params.formid + ' #id_updatecourseformat'); + var formatselect = Y.one('#' + params.formid + ' #id_format'); var ancestor = updatebut.ancestor('fieldset'); var action = Y.one('form.mform').get('action'); if (updatebut && formatselect) { diff --git a/course/yui/src/management/js/category.js b/course/yui/src/management/js/category.js index 889ccec1eea61..371b3c5ecc680 100644 --- a/course/yui/src/management/js/category.js +++ b/course/yui/src/management/js/category.js @@ -21,16 +21,16 @@ Category.ATTRS = { * @writeOnce * @default null */ - categoryid : { - getter : function (value, name) { + categoryid: { + getter: function(value, name) { if (value === null) { value = this.get('node').getData('id'); this.set(name, value); } return value; }, - value : null, - writeOnce : true + value: null, + writeOnce: true }, /** @@ -39,8 +39,8 @@ Category.ATTRS = { * @type Boolean * @default null */ - selected : { - getter : function(value, name) { + selected: { + getter: function(value, name) { if (value === null) { value = this.get('node').getData(name); if (value === null) { @@ -50,7 +50,7 @@ Category.ATTRS = { } return value; }, - value : null + value: null }, /** @@ -59,11 +59,11 @@ Category.ATTRS = { * @type Course[] * @default Array */ - courses : { - validator : function(val) { + courses: { + validator: function(val) { return Y.Lang.isArray(val); }, - value : [] + value: [] } }; Category.prototype = { @@ -71,7 +71,7 @@ Category.prototype = { * Initialises an instance of a Category. * @method initializer */ - initializer : function() { + initializer: function() { this.set('itemname', 'category'); }, @@ -80,7 +80,7 @@ Category.prototype = { * @method getName * @return {String} */ - getName : function() { + getName: function() { return this.get('node').one('a.categoryname').get('innerHTML'); }, @@ -89,7 +89,7 @@ Category.prototype = { * @method registerCourse * @param {Course} course */ - registerCourse : function(course) { + registerCourse: function(course) { var courses = this.get('courses'); courses.push(course); this.set('courses', courses); @@ -103,8 +103,8 @@ Category.prototype = { * @param {EventFacade} e * @return {Boolean} */ - handle : function(action, e) { - var catarg = {categoryid : this.get('categoryid')}, + handle: function(action, e) { + var catarg = {categoryid: this.get('categoryid')}, selected = this.get('console').get('activecategoryid'); if (selected && selected !== catarg.categoryid) { catarg.selectedcategory = selected; @@ -162,42 +162,42 @@ Category.prototype = { * Expands the category making its sub categories visible. * @method expand */ - expand : function() { + expand: function() { var node = this.get('node'), action = node.one('a[data-action=expand]'), ul = node.one('ul[role=group]'); node.removeClass('collapsed').setAttribute('aria-expanded', 'true'); action.setAttribute('data-action', 'collapse').setAttrs({ - title : M.util.get_string('collapsecategory', 'moodle', this.getName()) + title: M.util.get_string('collapsecategory', 'moodle', this.getName()) }).one('img').setAttrs({ - src : M.util.image_url('t/switch_minus', 'moodle'), - alt : M.util.get_string('collapse', 'moodle') + src: M.util.image_url('t/switch_minus', 'moodle'), + alt: M.util.get_string('collapse', 'moodle') }); if (ul) { ul.setAttribute('aria-hidden', 'false'); } - this.get('console').performAjaxAction('expandcategory', {categoryid : this.get('categoryid')}, null, this); + this.get('console').performAjaxAction('expandcategory', {categoryid: this.get('categoryid')}, null, this); }, /** * Collapses the category making its sub categories hidden. * @method collapse */ - collapse : function() { + collapse: function() { var node = this.get('node'), action = node.one('a[data-action=collapse]'), ul = node.one('ul[role=group]'); node.addClass('collapsed').setAttribute('aria-expanded', 'false'); action.setAttribute('data-action', 'expand').setAttrs({ - title : M.util.get_string('expandcategory', 'moodle', this.getName()) + title: M.util.get_string('expandcategory', 'moodle', this.getName()) }).one('img').setAttrs({ - src : M.util.image_url('t/switch_plus', 'moodle'), - alt : M.util.get_string('expand', 'moodle') + src: M.util.image_url('t/switch_plus', 'moodle'), + alt: M.util.get_string('expand', 'moodle') }); if (ul) { ul.setAttribute('aria-hidden', 'true'); } - this.get('console').performAjaxAction('collapsecategory', {categoryid : this.get('categoryid')}, null, this); + this.get('console').performAjaxAction('collapsecategory', {categoryid: this.get('categoryid')}, null, this); }, /** @@ -210,17 +210,17 @@ Category.prototype = { * @param {Object} args The arguments given to the request. * @return {Boolean} Returns true on success - false otherwise. */ - loadSubcategories : function(transactionid, response, args) { + loadSubcategories: function(transactionid, response, args) { var outcome = this.checkAjaxResponse(transactionid, response, args), node = this.get('node'), managementconsole = this.get('console'), ul, actionnode; if (outcome === false) { - Y.log('AJAX failed to load sub categories for '+this.get('itemname'), 'warn', 'moodle-course-management'); + Y.log('AJAX failed to load sub categories for ' + this.get('itemname'), 'warn', 'moodle-course-management'); return false; } - Y.log('AJAX loaded subcategories for '+this.get('itemname'), 'info', 'moodle-course-management'); + Y.log('AJAX loaded subcategories for ' + this.get('itemname'), 'info', 'moodle-course-management'); node.append(outcome.html); managementconsole.initialiseCategories(node); if (M.core && M.core.actionmenu && M.core.actionmenu.newDOMNode) { @@ -240,24 +240,24 @@ Category.prototype = { * @method moveCourseTo * @param {Course} course */ - moveCourseTo : function(course) { + moveCourseTo: function(course) { var self = this; Y.use('moodle-core-notification-confirm', function() { var confirm = new M.core.confirm({ - title : M.util.get_string('confirm', 'moodle'), - question : M.util.get_string('confirmcoursemove', 'moodle', { - course : course.getName(), - category : self.getName() + title: M.util.get_string('confirm', 'moodle'), + question: M.util.get_string('confirmcoursemove', 'moodle', { + course: course.getName(), + category: self.getName() }), - yesLabel : M.util.get_string('move', 'moodle'), - noLabel : M.util.get_string('cancel', 'moodle') + yesLabel: M.util.get_string('move', 'moodle'), + noLabel: M.util.get_string('cancel', 'moodle') }); confirm.on('complete-yes', function() { confirm.hide(); confirm.destroy(); this.get('console').performAjaxAction('movecourseintocategory', { - categoryid : this.get('categoryid'), - courseid : course.get('courseid') + categoryid: this.get('categoryid'), + courseid: course.get('courseid') }, this.completeMoveCourse, this); }, self); confirm.show(); @@ -273,14 +273,14 @@ Category.prototype = { * @param {Object} args The arguments given to the request. * @return {Boolean} */ - completeMoveCourse : function(transactionid, response, args) { + completeMoveCourse: function(transactionid, response, args) { var outcome = this.checkAjaxResponse(transactionid, response, args), managementconsole = this.get('console'), category, course, totals; if (outcome === false) { - Y.log('AJAX failed to move courses into this category: '+this.get('itemname'), 'warn', 'moodle-course-management'); + Y.log('AJAX failed to move courses into this category: ' + this.get('itemname'), 'warn', 'moodle-course-management'); return false; } course = managementconsole.getCourseById(args.courseid); @@ -328,11 +328,11 @@ Category.prototype = { * @param {Object} args The arguments given to the request. * @return {Boolean} */ - show : function(transactionid, response, args) { + show: function(transactionid, response, args) { var outcome = this.checkAjaxResponse(transactionid, response, args), hidebtn; if (outcome === false) { - Y.log('AJAX request to show '+this.get('itemname')+' by outcome.', 'warn', 'moodle-course-management'); + Y.log('AJAX request to show ' + this.get('itemname') + ' by outcome.', 'warn', 'moodle-course-management'); return false; } @@ -360,11 +360,11 @@ Category.prototype = { * @param {Object} args The arguments given to the request. * @return {Boolean} */ - hide : function(transactionid, response, args) { + hide: function(transactionid, response, args) { var outcome = this.checkAjaxResponse(transactionid, response, args), showbtn; if (outcome === false) { - Y.log('AJAX request to hide '+this.get('itemname')+' by outcome.', 'warn', 'moodle-course-management'); + Y.log('AJAX request to hide ' + this.get('itemname') + ' by outcome.', 'warn', 'moodle-course-management'); return false; } this.markHidden(); @@ -379,7 +379,7 @@ Category.prototype = { this.updateCourseVisiblity(outcome.coursevisibility); } this.updated(); - Y.log('Success: '+this.get('itemname')+' made hidden by AJAX.', 'info', 'moodle-course-management'); + Y.log('Success: ' + this.get('itemname') + ' made hidden by AJAX.', 'info', 'moodle-course-management'); }, /** @@ -388,7 +388,7 @@ Category.prototype = { * @chainable * @param courses */ - updateCourseVisiblity : function(courses) { + updateCourseVisiblity: function(courses) { var managementconsole = this.get('console'), key, course; @@ -418,7 +418,7 @@ Category.prototype = { * @chainable * @param categories */ - updateChildVisibility : function(categories) { + updateChildVisibility: function(categories) { var managementconsole = this.get('console'), key, category; diff --git a/course/yui/src/management/js/console.js b/course/yui/src/management/js/console.js index 12ca9be57f244..633fd47f19151 100644 --- a/course/yui/src/management/js/console.js +++ b/course/yui/src/management/js/console.js @@ -27,10 +27,10 @@ Console.ATTRS = { * @attribute element * @type Node */ - element : { - setter : function(node) { + element: { + setter: function(node) { if (typeof node === 'string') { - node = Y.one('#'+node); + node = Y.one('#' + node); } return node; } @@ -42,8 +42,8 @@ Console.ATTRS = { * @type Node * @default null */ - categorylisting : { - value : null + categorylisting: { + value: null }, /** @@ -52,8 +52,8 @@ Console.ATTRS = { * @type Node * @default null */ - courselisting : { - value : null + courselisting: { + value: null }, /** @@ -62,8 +62,8 @@ Console.ATTRS = { * @type Node|null * @default null */ - coursedetails : { - value : null + coursedetails: { + value: null }, /** @@ -72,8 +72,8 @@ Console.ATTRS = { * @type Number * @default null */ - activecategoryid : { - value : null + activecategoryid: { + value: null }, /** @@ -82,8 +82,8 @@ Console.ATTRS = { * @type Number * @default Null */ - activecourseid : { - value : null + activecourseid: { + value: null }, /** @@ -92,8 +92,8 @@ Console.ATTRS = { * @type Array * @default [] */ - categories : { - setter : function(item, name) { + categories: { + setter: function(item, name) { if (Y.Lang.isArray(item)) { return item; } @@ -101,7 +101,7 @@ Console.ATTRS = { items.push(item); return items; }, - value : [] + value: [] }, /** @@ -110,11 +110,11 @@ Console.ATTRS = { * @type Course[] * @default Array */ - courses : { - validator : function(val) { + courses: { + validator: function(val) { return Y.Lang.isArray(val); }, - value : [] + value: [] }, /** @@ -123,15 +123,15 @@ Console.ATTRS = { * @type Number * @default null */ - page : { - getter : function(value, name) { + page: { + getter: function(value, name) { if (value === null) { value = this.get('element').getData(name); this.set(name, value); } return value; }, - value : null + value: null }, /** @@ -140,15 +140,15 @@ Console.ATTRS = { * @type Number * @default null */ - totalpages : { - getter : function(value, name) { + totalpages: { + getter: function(value, name) { if (value === null) { value = this.get('element').getData(name); this.set(name, value); } return value; }, - value : null + value: null }, /** @@ -157,15 +157,15 @@ Console.ATTRS = { * @type Number * @default null */ - totalcourses : { - getter : function(value, name) { + totalcourses: { + getter: function(value, name) { if (value === null) { value = this.get('element').getData(name); this.set(name, value); } return value; }, - value : null + value: null }, /** @@ -174,14 +174,14 @@ Console.ATTRS = { * @type String * @default /course/ajax/management.php */ - ajaxurl : { - getter : function(value) { + ajaxurl: { + getter: function(value) { if (value === null) { value = M.cfg.wwwroot + '/course/ajax/management.php'; } return value; }, - value : null + value: null }, /** @@ -190,8 +190,8 @@ Console.ATTRS = { * @type DragDrop * @default null */ - dragdrop : { - value : null + dragdrop: { + value: null } }; Console.prototype = { @@ -202,13 +202,13 @@ Console.prototype = { * @private * @type {boolean} */ - categoriesinit : false, + categoriesinit: false, /** * Initialises a new instance of the Console. * @method initializer */ - initializer : function() { + initializer: function() { Y.log('Initialising course category management console', 'info', 'moodle-course-management'); this.set('element', 'coursecat-management'); var element = this.get('element'), @@ -237,7 +237,7 @@ Console.prototype = { if (courselisting) { // No need for dragdrop if we don't have a course listing. - this.set('dragdrop', new DragDrop({console:this})); + this.set('dragdrop', new DragDrop({console: this})); } }, @@ -247,7 +247,7 @@ Console.prototype = { * @private * @return {boolean} */ - initialiseCategories : function(listing) { + initialiseCategories: function(listing) { var count = 0; if (!listing) { return false; @@ -267,10 +267,10 @@ Console.prototype = { menuresortcoursesby.setAttribute('disabled', true); } - listing.all('.listitem[data-id]').each(function(node){ + listing.all('.listitem[data-id]').each(function(node) { this.set('categories', new Category({ - node : node, - console : this + node: node, + console: this })); count++; }, this); @@ -279,9 +279,9 @@ Console.prototype = { this.get('categorylisting').delegate('click', this.handleCategoryDelegation, 'input[name="bcat[]"]', this); this.get('categorylisting').delegate('click', this.handleBulkSortByaction, '#menuselectsortby', this); this.categoriesinit = true; - Y.log(count+' categories being managed', 'info', 'moodle-course-management'); + Y.log(count + ' categories being managed', 'info', 'moodle-course-management'); } else { - Y.log(count+' new categories being managed', 'info', 'moodle-course-management'); + Y.log(count + ' new categories being managed', 'info', 'moodle-course-management'); } }, @@ -291,7 +291,7 @@ Console.prototype = { * @private * @return {boolean} */ - initialiseCourses : function() { + initialiseCourses: function() { var category = this.getCategoryById(this.get('activecategoryid')), listing = this.get('courselisting'), count = 0; @@ -305,17 +305,17 @@ Console.prototype = { menumovecoursesto.setAttribute('disabled', true); } - listing.all('.listitem[data-id]').each(function(node){ + listing.all('.listitem[data-id]').each(function(node) { this.registerCourse(new Course({ - node : node, - console : this, - category : category + node: node, + console: this, + category: category })); count++; }, this); listing.delegate('click', this.handleCourseDelegation, 'a[data-action]', this); listing.delegate('click', this.handleCourseDelegation, 'input[name="bc[]"]', this); - Y.log(count+' courses being managed', 'info', 'moodle-course-management'); + Y.log(count + ' courses being managed', 'info', 'moodle-course-management'); }, /** @@ -323,7 +323,7 @@ Console.prototype = { * @method registerCourse * @param {Course} course */ - registerCourse : function(course) { + registerCourse: function(course) { var courses = this.get('courses'); courses.push(course); this.set('courses', courses); @@ -336,7 +336,7 @@ Console.prototype = { * @protected * @param {EventFacade} e */ - handleCourseDelegation : function(e) { + handleCourseDelegation: function(e) { var target = e.currentTarget, action = target.getData('action'), courseid = target.ancestor('.listitem').getData('id'), @@ -344,7 +344,7 @@ Console.prototype = { if (course) { course.handle(action, e); } else { - Y.log('Course with ID '+courseid+' could not be found for delegation', 'error', 'moodle-course-management'); + Y.log('Course with ID ' + courseid + ' could not be found for delegation', 'error', 'moodle-course-management'); } }, @@ -355,7 +355,7 @@ Console.prototype = { * @protected * @param {EventFacade} e */ - handleCategoryDelegation : function(e) { + handleCategoryDelegation: function(e) { var target = e.currentTarget, action = target.getData('action'), categoryid = target.ancestor('.listitem').getData('id'), @@ -374,7 +374,7 @@ Console.prototype = { * @param {Node} checkboxnode Checkbox node on which action happened. * @return bool */ - isCourseSelected : function(checkboxnode) { + isCourseSelected: function(checkboxnode) { var selected = false; // If any course selected then show move to category select box. @@ -405,7 +405,7 @@ Console.prototype = { * @param {Node} checkboxnode Checkbox node on which action happened. * @return bool */ - isCategorySelected : function(checkboxnode) { + isCategorySelected: function(checkboxnode) { var selected = false; // If any category selected then show move to category select box. @@ -436,7 +436,7 @@ Console.prototype = { * @protected * @param {EventFacade} e */ - handleBulkSortByaction : function(e) { + handleBulkSortByaction: function(e) { var sortcategoryby = this.get('categorylisting').one('#menuresortcategoriesby'), sortcourseby = this.get('categorylisting').one('#menuresortcoursesby'), sortbybutton = this.get('categorylisting').one('input[name="bulksort"]'), @@ -485,7 +485,7 @@ Console.prototype = { * @param {Number} id * @return {Category|Boolean} The category or false if it can't be found. */ - getCategoryById : function(id) { + getCategoryById: function(id) { var i, category, categories = this.get('categories'), @@ -507,7 +507,7 @@ Console.prototype = { * @param {Number} id * @return {Course|Boolean} The course or false if not found/ */ - getCourseById : function(id) { + getCourseById: function(id) { var i, course, courses = this.get('courses'), @@ -528,7 +528,7 @@ Console.prototype = { * @method removeCourseById * @param {Number} id */ - removeCourseById : function(id) { + removeCourseById: function(id) { var courses = this.get('courses'), length = courses.length, course, @@ -551,24 +551,24 @@ Console.prototype = { * @param {Function} callback The function to call when all is done. * @param {Object} context The object to use as the context for the callback. */ - performAjaxAction : function(action, args, callback, context) { + performAjaxAction: function(action, args, callback, context) { var io = new Y.IO(); args.action = action; args.ajax = '1'; args.sesskey = M.cfg.sesskey; if (callback === null) { callback = function() { - Y.log("'Action '"+action+"' completed", 'debug', 'moodle-course-management'); + Y.log("'Action '" + action + "' completed", 'debug', 'moodle-course-management'); }; } io.send(this.get('ajaxurl'), { - method : 'POST', - on : { - complete : callback + method: 'POST', + on: { + complete: callback }, - context : context, - data : args, - 'arguments' : args + context: context, + data: args, + 'arguments': args }); } }; diff --git a/course/yui/src/management/js/course.js b/course/yui/src/management/js/course.js index 893b21c7fe727..60ee26f561981 100644 --- a/course/yui/src/management/js/course.js +++ b/course/yui/src/management/js/course.js @@ -20,7 +20,7 @@ Course.ATTRS = { * @attribute courseid * @type Number */ - courseid : {}, + courseid: {}, /** * True if this is the selected course. @@ -28,17 +28,17 @@ Course.ATTRS = { * @type Boolean * @default null */ - selected : { - getter : function(value, name) { + selected: { + getter: function(value, name) { if (value === null) { value = this.get('node').getData(name); this.set(name, value); } return value; }, - value : null + value: null }, - node : { + node: { }, /** @@ -47,8 +47,8 @@ Course.ATTRS = { * @type Console * @writeOnce */ - console : { - writeOnce : 'initOnly' + console: { + writeOnce: 'initOnly' }, /** @@ -57,8 +57,8 @@ Course.ATTRS = { * @type Category * @writeOnce */ - category : { - writeOnce : 'initOnly' + category: { + writeOnce: 'initOnly' } }; Course.prototype = { @@ -66,7 +66,7 @@ Course.prototype = { * Initialises the new course instance. * @method initializer */ - initializer : function() { + initializer: function() { var node = this.get('node'), category = this.get('category'); this.set('courseid', node.getData('id')); @@ -81,7 +81,7 @@ Course.prototype = { * @method getName * @return {String} */ - getName : function() { + getName: function() { return this.get('node').one('a.coursename').get('innerHTML'); }, @@ -92,9 +92,9 @@ Course.prototype = { * @param {EventFacade} e * @return {Boolean} */ - handle : function(action, e) { + handle: function(action, e) { var managementconsole = this.get('console'), - args = {courseid : this.get('courseid')}; + args = {courseid: this.get('courseid')}; switch (action) { case 'moveup': e.halt(); @@ -133,7 +133,7 @@ Course.prototype = { * Removes this course. * @method remove */ - remove : function() { + remove: function() { this.get('console').removeCourseById(this.get('courseid')); this.get('node').remove(); }, @@ -145,12 +145,12 @@ Course.prototype = { * @param {Number} moveaftercourse The course to move after or 0 to put it at the top. * @param {Number} previousid the course it was previously after in case we need to revert. */ - moveAfter : function(moveaftercourse, previousid) { + moveAfter: function(moveaftercourse, previousid) { var managementconsole = this.get('console'), args = { - courseid : this.get('courseid'), - moveafter : moveaftercourse, - previous : previousid + courseid: this.get('courseid'), + moveafter: moveaftercourse, + previous: previousid }; managementconsole.performAjaxAction('movecourseafter', args, this.moveAfterResponse, this); }, @@ -165,12 +165,12 @@ Course.prototype = { * @param {Objects} args The arguments that were given with the request. * @return {Boolean} */ - moveAfterResponse : function(transactionid, response, args) { + moveAfterResponse: function(transactionid, response, args) { var outcome = this.checkAjaxResponse(transactionid, response, args), node = this.get('node'), previous; if (outcome === false) { - previous = node.ancestor('ul').one('li[data-id='+args.previous+']'); + previous = node.ancestor('ul').one('li[data-id=' + args.previous + ']'); Y.log('AJAX failed to move this course after the requested course', 'warn', 'moodle-course-management'); if (previous) { // After the last previous. @@ -181,7 +181,7 @@ Course.prototype = { } return false; } - Y.log('AJAX successfully moved course ('+this.getName()+')', 'info', 'moodle-course-management'); + Y.log('AJAX successfully moved course (' + this.getName() + ')', 'info', 'moodle-course-management'); this.highlight(); } }; diff --git a/course/yui/src/management/js/dd.js b/course/yui/src/management/js/dd.js index f622d29fec7f8..f6119c18a6704 100644 --- a/course/yui/src/management/js/dd.js +++ b/course/yui/src/management/js/dd.js @@ -20,8 +20,8 @@ DragDrop.ATTRS = { * @type Console * @writeOnce */ - console : { - writeOnce : 'initOnly' + console: { + writeOnce: 'initOnly' } }; DragDrop.prototype = { @@ -31,7 +31,7 @@ DragDrop.prototype = { * @protected * @default false */ - goingup : false, + goingup: false, /** * The last Y position of the course being dragged @@ -39,7 +39,7 @@ DragDrop.prototype = { * @protected * @default null */ - lasty : null, + lasty: null, /** * The sibling above the course being dragged currently (tracking its original position). @@ -48,13 +48,13 @@ DragDrop.prototype = { * @protected * @default false */ - previoussibling : null, + previoussibling: null, /** * Initialises the DragDrop instance. * @method initializer */ - initializer : function() { + initializer: function() { var managementconsole = this.get('console'), container = managementconsole.get('element'), categorylisting = container.one('#category-listing'), @@ -69,7 +69,7 @@ DragDrop.prototype = { return false; } - courseul.all('> li').each(function(li){ + courseul.all('> li').each(function(li) { this.initCourseListing(li, contstraint); }, this); courseul.setData('dd', new Y.DD.Drop({ @@ -77,7 +77,7 @@ DragDrop.prototype = { })); if (canmoveoutof && categoryul) { // Category UL may not be there if viewmode is just courses. - categoryul.all('li > div').each(function(div){ + categoryul.all('li > div').each(function(div) { this.initCategoryListitem(div); }, this); } @@ -96,10 +96,10 @@ DragDrop.prototype = { * @method initCourseListing * @param Node */ - initCourseListing : function(node, contstraint) { + initCourseListing: function(node, contstraint) { node.setData('dd', new Y.DD.Drag({ - node : node, - target : { + node: node, + target: { padding: '0 0 0 20' } }).addHandle( @@ -117,7 +117,7 @@ DragDrop.prototype = { * @method initCategoryListitem * @param Node */ - initCategoryListitem : function(node) { + initCategoryListitem: function(node) { node.setData('dd', new Y.DD.Drop({ node: node })); @@ -129,7 +129,7 @@ DragDrop.prototype = { * @private * @param {EventFacade} e */ - dragStart : function(e) { + dragStart: function(e) { var drag = e.target, node = drag.get('node'), dragnode = drag.get('dragNode'); @@ -144,7 +144,7 @@ DragDrop.prototype = { * @private * @param {EventFacade} e */ - dragEnd : function(e) { + dragEnd: function(e) { var drag = e.target, node = drag.get('node'); node.removeClass('course-being-dragged'); @@ -157,7 +157,7 @@ DragDrop.prototype = { * @private * @param {EventFacade} e */ - dragDrag : function(e) { + dragDrag: function(e) { var y = e.target.lastXY[1]; if (y < this.lasty) { this.goingup = true; @@ -173,8 +173,8 @@ DragDrop.prototype = { * @private * @param {EventFacade} e */ - dropOver : function(e) { - //Get a reference to our drag and drop nodes + dropOver: function(e) { + // Get a reference to our drag and drop nodes var drag = e.drag.get('node'), drop = e.drop.get('node'), tag = drop.get('tagName').toLowerCase(); @@ -198,7 +198,7 @@ DragDrop.prototype = { * @private * @param {EventFacade} e */ - dropEnter : function(e) { + dropEnter: function(e) { var drop = e.drop.get('node'), tag = drop.get('tagName').toLowerCase(); if (tag === 'div') { @@ -212,7 +212,7 @@ DragDrop.prototype = { * @private * @param {EventFacade} e */ - dropExit : function(e) { + dropExit: function(e) { var drop = e.drop.get('node'), tag = drop.get('tagName').toLowerCase(); if (tag === 'div') { @@ -226,7 +226,7 @@ DragDrop.prototype = { * @private * @param {EventFacade} e */ - dropHit : function(e) { + dropHit: function(e) { var drag = e.drag.get('node'), drop = e.drop.get('node'), iscategory = (drop.ancestor('.listitem-category') !== null), @@ -259,7 +259,7 @@ DragDrop.prototype = { course = managementconsole.getCourseById(courseid); previoussibling = drag.get('previousSibling'); aftercourseid = (previoussibling) ? previoussibling.getData('id') || 0 : 0; - previousid = (this.previoussibling) ? this.previoussibling.getData('id') : 0; + previousid = (this.previoussibling) ? this.previoussibling.getData('id') : 0; if (aftercourseid !== previousid) { course.moveAfter(aftercourseid, previousid); } diff --git a/course/yui/src/management/js/item.js b/course/yui/src/management/js/item.js index 998baab01614c..590bbf360f9a6 100644 --- a/course/yui/src/management/js/item.js +++ b/course/yui/src/management/js/item.js @@ -17,14 +17,14 @@ Item.ATTRS = { * @attribute node * @type Node */ - node : {}, + node: {}, /** * The management console. * @attribute console * @type Console */ - console : {}, + console: {}, /** * Describes the type of this item. Should be set by the extending class. @@ -32,8 +32,8 @@ Item.ATTRS = { * @type {String} * @default item */ - itemname : { - value : 'item' + itemname: { + value: 'item' } }; Item.prototype = { @@ -44,7 +44,7 @@ Item.prototype = { * @type Timeout * @default null */ - highlighttimeout : null, + highlighttimeout: null, /** * Checks and parses an AJAX response for an item. @@ -56,7 +56,7 @@ Item.prototype = { * @param {Object} args The arguments given to the request. * @return {Object|Boolean} */ - checkAjaxResponse : function(transactionid, response, args) { + checkAjaxResponse: function(transactionid, response, args) { if (response.status !== 200) { Y.log('Error: AJAX response resulted in non 200 status.', 'error', 'Item.checkAjaxResponse'); return false; @@ -84,7 +84,7 @@ Item.prototype = { * @param {Object} args The arguments given to the request. * @return {Boolean} */ - moveup : function(transactionid, response, args) { + moveup: function(transactionid, response, args) { var node, nodeup, nodedown, @@ -94,7 +94,7 @@ Item.prototype = { tmpnode, outcome = this.checkAjaxResponse(transactionid, response, args); if (outcome === false) { - Y.log('AJAX request to move '+this.get('itemname')+' up failed by outcome.', 'warn', 'moodle-course-management'); + Y.log('AJAX request to move ' + this.get('itemname') + ' up failed by outcome.', 'warn', 'moodle-course-management'); return false; } node = this.get('node'); @@ -134,7 +134,7 @@ Item.prototype = { } } this.updated(true); - Y.log('Success: '+this.get('itemname')+' moved up by AJAX.', 'info', 'moodle-course-management'); + Y.log('Success: ' + this.get('itemname') + ' moved up by AJAX.', 'info', 'moodle-course-management'); } else { // Aha it succeeded but this is the top item in the list. Pagination is in play! // Refresh to update the state of things. @@ -153,7 +153,7 @@ Item.prototype = { * @param {Object} args The arguments given to the request. * @return {Boolean} */ - movedown : function(transactionid, response, args) { + movedown: function(transactionid, response, args) { var node, next, nodeup, @@ -163,7 +163,7 @@ Item.prototype = { tmpnode, outcome = this.checkAjaxResponse(transactionid, response, args); if (outcome === false) { - Y.log('AJAX request to move '+this.get('itemname')+' down failed by outcome.', 'warn', 'moodle-course-management'); + Y.log('AJAX request to move ' + this.get('itemname') + ' down failed by outcome.', 'warn', 'moodle-course-management'); return false; } node = this.get('node'); @@ -203,7 +203,7 @@ Item.prototype = { } } this.updated(true); - Y.log('Success: '+this.get('itemname')+' moved down by AJAX.', 'info', 'moodle-course-management'); + Y.log('Success: ' + this.get('itemname') + ' moved down by AJAX.', 'info', 'moodle-course-management'); } else { // Aha it succeeded but this is the bottom item in the list. Pagination is in play! // Refresh to update the state of things. @@ -222,11 +222,11 @@ Item.prototype = { * @param {Object} args The arguments given to the request. * @return {Boolean} */ - show : function(transactionid, response, args) { + show: function(transactionid, response, args) { var outcome = this.checkAjaxResponse(transactionid, response, args), hidebtn; if (outcome === false) { - Y.log('AJAX request to show '+this.get('itemname')+' by outcome.', 'warn', 'moodle-course-management'); + Y.log('AJAX request to show ' + this.get('itemname') + ' by outcome.', 'warn', 'moodle-course-management'); return false; } @@ -236,16 +236,16 @@ Item.prototype = { hidebtn.focus(); } this.updated(); - Y.log('Success: '+this.get('itemname')+' made visible by AJAX.', 'info', 'moodle-course-management'); + Y.log('Success: ' + this.get('itemname') + ' made visible by AJAX.', 'info', 'moodle-course-management'); }, /** * Marks the item as visible * @method markVisible */ - markVisible : function() { + markVisible: function() { this.get('node').setAttribute('data-visible', '1'); - Y.log('Marked '+this.get('itemname')+' as visible', 'info', 'moodle-course-management'); + Y.log('Marked ' + this.get('itemname') + ' as visible', 'info', 'moodle-course-management'); return true; }, @@ -258,11 +258,11 @@ Item.prototype = { * @param {Object} args The arguments given to the request. * @return {Boolean} */ - hide : function(transactionid, response, args) { + hide: function(transactionid, response, args) { var outcome = this.checkAjaxResponse(transactionid, response, args), showbtn; if (outcome === false) { - Y.log('AJAX request to hide '+this.get('itemname')+' by outcome.', 'warn', 'moodle-course-management'); + Y.log('AJAX request to hide ' + this.get('itemname') + ' by outcome.', 'warn', 'moodle-course-management'); return false; } this.markHidden(); @@ -271,16 +271,16 @@ Item.prototype = { showbtn.focus(); } this.updated(); - Y.log('Success: '+this.get('itemname')+' made hidden by AJAX.', 'info', 'moodle-course-management'); + Y.log('Success: ' + this.get('itemname') + ' made hidden by AJAX.', 'info', 'moodle-course-management'); }, /** * Marks the item as hidden. * @method makeHidden */ - markHidden : function() { + markHidden: function() { this.get('node').setAttribute('data-visible', '0'); - Y.log('Marked '+this.get('itemname')+' as hidden', 'info', 'moodle-course-management'); + Y.log('Marked ' + this.get('itemname') + ' as hidden', 'info', 'moodle-course-management'); return true; }, @@ -290,7 +290,7 @@ Item.prototype = { * @method updated * @param {Boolean} moved True if this item was moved. */ - updated : function(moved) { + updated: function(moved) { if (moved) { this.highlight(); } @@ -301,14 +301,14 @@ Item.prototype = { * * @method highlight */ - highlight : function() { + highlight: function() { var node = this.get('node'); node.siblings('.highlight').removeClass('highlight'); node.addClass('highlight'); if (this.highlighttimeout) { window.clearTimeout(this.highlighttimeout); } - this.highlighttimeout = window.setTimeout(function(){ + this.highlighttimeout = window.setTimeout(function() { node.removeClass('highlight'); }, 2500); } diff --git a/course/yui/src/modchooser/js/modchooser.js b/course/yui/src/modchooser/js/modchooser.js index 8adbac4253a09..4ea2619a0195d 100644 --- a/course/yui/src/modchooser/js/modchooser.js +++ b/course/yui/src/modchooser/js/modchooser.js @@ -5,11 +5,11 @@ */ var CSS = { - PAGECONTENT : 'body', + PAGECONTENT: 'body', SECTION: null, - SECTIONMODCHOOSER : 'span.section-modchooser-link', - SITEMENU : 'div.block_site_main_menu', - SITETOPIC : 'div.sitetopic' + SECTIONMODCHOOSER: 'span.section-modchooser-link', + SITEMENU: 'div.block_site_main_menu', + SITETOPIC: 'div.sitetopic' }; var MODCHOOSERNAME = 'course-modchooser'; @@ -34,14 +34,14 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, { * @type Number * @default null */ - sectionid : null, + sectionid: null, /** * Set up the activity chooser. * * @method initializer */ - initializer : function() { + initializer: function() { var sectionclass = M.course.format.get_sectionwrapperclass(); if (sectionclass) { CSS.SECTION = '.' + sectionclass; @@ -63,7 +63,7 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, { * @method setup_for_section * @param baseselector The selector to limit scope to */ - setup_for_section : function(baseselector) { + setup_for_section: function(baseselector) { if (!baseselector) { baseselector = CSS.PAGECONTENT; } @@ -94,7 +94,7 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, { * @private * @param baseselector The selector to limit scope to */ - _setup_for_section : function(section) { + _setup_for_section: function(section) { var chooserspan = section.one(CSS.SECTIONMODCHOOSER); if (!chooserspan) { return; @@ -112,7 +112,7 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, { * @method display_mod_chooser * @param {EventFacade} e Triggering Event */ - display_mod_chooser : function (e) { + display_mod_chooser: function(e) { // Set the section for this version of the dialogue if (e.target.ancestor(CSS.SITETOPIC)) { // The site topic has a sectionid of 1 @@ -135,7 +135,7 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, { * @param {String} thisoption The selected option value * @private */ - option_selected : function(thisoption) { + option_selected: function(thisoption) { // Add the sectionid to the URL. this.hiddenRadioValue.setAttrs({ name: 'jump', @@ -144,8 +144,8 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, { } }, { - NAME : MODCHOOSERNAME, - ATTRS : { + NAME: MODCHOOSERNAME, + ATTRS: { /** * The maximum height (in pixels) of the activity chooser. * @@ -153,8 +153,8 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, { * @type Number * @default 800 */ - maxheight : { - value : 800 + maxheight: { + value: 800 } } }); diff --git a/course/yui/src/toolboxes/js/resource.js b/course/yui/src/toolboxes/js/resource.js index 4d87574f04cef..677836fb2dbee 100644 --- a/course/yui/src/toolboxes/js/resource.js +++ b/course/yui/src/toolboxes/js/resource.js @@ -169,7 +169,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { // Prevent the default button action ev.preventDefault(); - var direction = (action === 'moveleft') ? -1: 1; + var direction = (action === 'moveleft') ? -1 : 1; // And we need to determine the current and new indent level var indentdiv = activity.one(SELECTOR.MODINDENTDIV), @@ -246,7 +246,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { ev.preventDefault(); // Get the element we're working on - var element = activity, + var element = activity, // Create confirm string (different if element has or does not have name) confirmstring = '', plugindata = { @@ -379,7 +379,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { SELECTOR.CONTENTWITHOUTLINK ].join(', ')), availabilityinfo = activity.one(CSS.AVAILABILITYINFODIV), - nextaction = (action === 'hide') ? 'show': 'hide', + nextaction = (action === 'hide') ? 'show' : 'hide', buttontext = button.one('span'), newstring = M.util.get_string(nextaction, 'moodle'), buttonimg = button.one('img'); @@ -397,7 +397,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { buttonimg.setAttribute('alt', newstring); } - button.replaceClass('editing_'+action, 'editing_'+nextaction); + button.replaceClass('editing_' + action, 'editing_' + nextaction); button.setData('action', nextaction); if (buttontext) { buttontext.set('text', newstring); @@ -428,7 +428,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { if (availabilityinfo) { availabilityinfo.toggleClass(CSS.HIDE); } - return (action === 'hide') ? 0: 1; + return (action === 'hide') ? 0 : 1; }, /** diff --git a/course/yui/src/toolboxes/js/section.js b/course/yui/src/toolboxes/js/section.js index a28ca9ae65925..dab7a4455fbf8 100644 --- a/course/yui/src/toolboxes/js/section.js +++ b/course/yui/src/toolboxes/js/section.js @@ -33,7 +33,7 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, { * @method initializer * @protected */ - initializer : function() { + initializer: function() { M.course.coursebase.register_module(this); // Section Highlighting. @@ -43,7 +43,7 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, { Y.delegate('click', this.toggle_hide_section, SELECTOR.PAGECONTENT, SELECTOR.SECTIONLI + ' ' + SELECTOR.SHOWHIDE, this); }, - toggle_hide_section : function(e) { + toggle_hide_section: function(e) { // Prevent the default button action. e.preventDefault(); @@ -74,8 +74,8 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, { var newstring = M.util.get_string(nextaction + 'fromothers', 'format_' + this.get('format')); hideicon.setAttrs({ - 'alt' : newstring, - 'src' : M.util.image_url('i/' + nextaction) + 'alt': newstring, + 'src': M.util.image_url('i/' + nextaction) }); button.set('title', newstring); if (buttontext) { @@ -84,10 +84,10 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, { // Change the show/hide status var data = { - 'class' : 'section', - 'field' : 'visible', - 'id' : Y.Moodle.core_course.util.section.getId(section.ancestor(M.course.format.get_section_wrapper(Y), true)), - 'value' : value + 'class': 'section', + 'field': 'visible', + 'id': Y.Moodle.core_course.util.section.getId(section.ancestor(M.course.format.get_section_wrapper(Y), true)), + 'value': value }; var lightbox = M.util.add_lightbox(Y, section); @@ -119,7 +119,7 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, { * @method toggle_highlight * @param {EventFacade} e */ - toggle_highlight : function(e) { + toggle_highlight: function(e) { // Prevent the default button action. e.preventDefault(); @@ -170,17 +170,17 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, { // Change the highlight status. var data = { - 'class' : 'course', - 'field' : 'marker', - 'value' : value + 'class': 'course', + 'field': 'marker', + 'value': value }; var lightbox = M.util.add_lightbox(Y, section); lightbox.show(); this.send_request(data, lightbox); } }, { - NAME : 'course-section-toolbox', - ATTRS : { + NAME: 'course-section-toolbox', + ATTRS: { } }); diff --git a/course/yui/src/toolboxes/js/toolbox.js b/course/yui/src/toolboxes/js/toolbox.js index 019b359576757..b881d119cfefc 100644 --- a/course/yui/src/toolboxes/js/toolbox.js +++ b/course/yui/src/toolboxes/js/toolbox.js @@ -11,44 +11,44 @@ // The CSS classes we use. var CSS = { - ACTIVITYINSTANCE : 'activityinstance', - AVAILABILITYINFODIV : 'div.availabilityinfo', - CONTENTWITHOUTLINK : 'contentwithoutlink', - CONDITIONALHIDDEN : 'conditionalhidden', - DIMCLASS : 'dimmed', - DIMMEDTEXT : 'dimmed_text', - EDITINSTRUCTIONS : 'editinstructions', - HIDE : 'hide', - MODINDENTCOUNT : 'mod-indent-', - MODINDENTHUGE : 'mod-indent-huge', - MODULEIDPREFIX : 'module-', - SECTIONHIDDENCLASS : 'hidden', - SECTIONIDPREFIX : 'section-', - SHOW : 'editing_show' + ACTIVITYINSTANCE: 'activityinstance', + AVAILABILITYINFODIV: 'div.availabilityinfo', + CONTENTWITHOUTLINK: 'contentwithoutlink', + CONDITIONALHIDDEN: 'conditionalhidden', + DIMCLASS: 'dimmed', + DIMMEDTEXT: 'dimmed_text', + EDITINSTRUCTIONS: 'editinstructions', + HIDE: 'hide', + MODINDENTCOUNT: 'mod-indent-', + MODINDENTHUGE: 'mod-indent-huge', + MODULEIDPREFIX: 'module-', + SECTIONHIDDENCLASS: 'hidden', + SECTIONIDPREFIX: 'section-', + SHOW: 'editing_show' }, // The CSS selectors we use. SELECTOR = { ACTIONAREA: '.actions', - ACTIONLINKTEXT : '.actionlinktext', - ACTIVITYACTION : 'a.cm-edit-action[data-action]', - ACTIVITYICON : 'img.activityicon', - ACTIVITYINSTANCE : '.' + CSS.ACTIVITYINSTANCE, - ACTIVITYLINK: '.' + CSS.ACTIVITYINSTANCE + ' > a, .'+ CSS.ACTIVITYINSTANCE + + ACTIONLINKTEXT: '.actionlinktext', + ACTIVITYACTION: 'a.cm-edit-action[data-action]', + ACTIVITYICON: 'img.activityicon', + ACTIVITYINSTANCE: '.' + CSS.ACTIVITYINSTANCE, + ACTIVITYLINK: '.' + CSS.ACTIVITYINSTANCE + ' > a, .' + CSS.ACTIVITYINSTANCE + ' > span[data-inplaceeditable] > a:not([data-inplaceeditablelink])', - ACTIVITYLI : 'li.activity', - COMMANDSPAN : '.commands', - CONTENTAFTERLINK : 'div.contentafterlink', - CONTENTWITHOUTLINK : 'div.contentwithoutlink', + ACTIVITYLI: 'li.activity', + COMMANDSPAN: '.commands', + CONTENTAFTERLINK: 'div.contentafterlink', + CONTENTWITHOUTLINK: 'div.contentwithoutlink', GROUPINGLABEL: '.' + CSS.ACTIVITYINSTANCE + ' .groupinglabel', - HIDE : 'a.editing_hide', - HIGHLIGHT : 'a.editing_highlight', - INSTANCENAME : 'span.instancename', - MODINDENTDIV : '.mod-indent', - MODINDENTOUTER : '.mod-indent-outer', - PAGECONTENT : 'body', - SECTIONLI : 'li.section', - SHOW : 'a.'+CSS.SHOW, - SHOWHIDE : 'a.editing_showhide' + HIDE: 'a.editing_hide', + HIGHLIGHT: 'a.editing_highlight', + INSTANCENAME: 'span.instancename', + MODINDENTDIV: '.mod-indent', + MODINDENTOUTER: '.mod-indent-outer', + PAGECONTENT: 'body', + SECTIONLI: 'li.section', + SHOW: 'a.' + CSS.SHOW, + SHOWHIDE: 'a.editing_showhide' }, INDENTLIMITS = { MIN: 0, diff --git a/course/yui/src/util/js/cm.js b/course/yui/src/util/js/cm.js index a6884fab3af8f..a348eaeb9b899 100644 --- a/course/yui/src/util/js/cm.js +++ b/course/yui/src/util/js/cm.js @@ -15,7 +15,7 @@ Y.namespace('Moodle.core_course.util.cm'); */ Y.Moodle.core_course.util.cm = { CONSTANTS: { - MODULEIDPREFIX : 'module-' + MODULEIDPREFIX: 'module-' }, SELECTORS: { COURSEMODULE: '.activity', diff --git a/course/yui/src/util/js/section.js b/course/yui/src/util/js/section.js index 1c02f7556b79e..730a5d3f95fa2 100644 --- a/course/yui/src/util/js/section.js +++ b/course/yui/src/util/js/section.js @@ -15,7 +15,7 @@ Y.namespace('Moodle.core_course.util.section'); */ Y.Moodle.core_course.util.section = { CONSTANTS: { - SECTIONIDPREFIX : 'section-' + SECTIONIDPREFIX: 'section-' }, /** diff --git a/filter/glossary/yui/src/autolinker/js/autolinker.js b/filter/glossary/yui/src/autolinker/js/autolinker.js index 2d0471ecff4d7..564c6ee3b43c4 100644 --- a/filter/glossary/yui/src/autolinker/js/autolinker.js +++ b/filter/glossary/yui/src/autolinker/js/autolinker.js @@ -16,33 +16,33 @@ AUTOLINKER = function() { AUTOLINKER.superclass.constructor.apply(this, arguments); }; Y.extend(AUTOLINKER, Y.Base, { - overlay : null, + overlay: null, alertpanels: {}, - initializer : function() { + initializer: function() { var self = this; require(['core/event'], function(event) { - Y.delegate('click', function(e){ + Y.delegate('click', function(e) { e.preventDefault(); - //display a progress indicator + // display a progress indicator var title = '', content = Y.Node.create('