MDL-55244 js: fix problems with eslint --fix
eslint --fix '**/yui/src/**/*.js'
This commit is contained in:
+10
-10
@@ -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('<div id="capabilitysearchui"></div>'),
|
||||
label = Y.Node.create('<label for="capabilitysearch">'+this.get('strsearch')+'</label>');
|
||||
label = Y.Node.create('<label for="capabilitysearch">' + this.get('strsearch') + '</label>');
|
||||
this.input = Y.Node.create('<input type="text" id="capabilitysearch" />');
|
||||
|
||||
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: {}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+6
-6
@@ -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'));
|
||||
}
|
||||
}});
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
Vendored
+36
-36
@@ -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);
|
||||
|
||||
@@ -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); });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
+11
-11
@@ -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
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -185,7 +185,7 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, {
|
||||
// TODO: revert nodes location
|
||||
}
|
||||
},
|
||||
context:this
|
||||
context: this
|
||||
});
|
||||
}
|
||||
}, {
|
||||
|
||||
+3
-3
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -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) {
|
||||
|
||||
+46
-46
@@ -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;
|
||||
|
||||
+66
-66
@@ -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
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
+21
-21
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
Vendored
+21
-21
@@ -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);
|
||||
}
|
||||
|
||||
Vendored
+25
-25
@@ -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);
|
||||
}
|
||||
|
||||
+14
-14
@@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+5
-5
@@ -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;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
+14
-14
@@ -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: {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+32
-32
@@ -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,
|
||||
|
||||
Vendored
+1
-1
@@ -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',
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@ Y.namespace('Moodle.core_course.util.section');
|
||||
*/
|
||||
Y.Moodle.core_course.util.section = {
|
||||
CONSTANTS: {
|
||||
SECTIONIDPREFIX : 'section-'
|
||||
SECTIONIDPREFIX: 'section-'
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
+53
-53
@@ -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('<div id="glossaryfilteroverlayprogress">' +
|
||||
'<img src="' + M.cfg.loadingicon + '" class="spinner" />' +
|
||||
'</div>'),
|
||||
o = new Y.Overlay({
|
||||
headerContent : title,
|
||||
bodyContent : content
|
||||
headerContent: title,
|
||||
bodyContent: content
|
||||
}),
|
||||
fullurl,
|
||||
cfg;
|
||||
self.overlay = o;
|
||||
o.render(Y.one(document.body));
|
||||
|
||||
//Switch over to the ajax url and fetch the glossary item
|
||||
fullurl = this.getAttribute('href').replace('showentry.php','showentry_ajax.php');
|
||||
// Switch over to the ajax url and fetch the glossary item
|
||||
fullurl = this.getAttribute('href').replace('showentry.php', 'showentry_ajax.php');
|
||||
cfg = {
|
||||
method: 'get',
|
||||
context : self,
|
||||
context: self,
|
||||
on: {
|
||||
success: function(id, o) {
|
||||
this.display_callback(o.responseText, event);
|
||||
@@ -52,7 +52,7 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
if (M.cfg.developerdebug) {
|
||||
o.statusText += ' (' + fullurl + ')';
|
||||
}
|
||||
new M.core.exception({ message: debuginfo });
|
||||
new M.core.exception({message: debuginfo});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -66,7 +66,7 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
* @param {String} content - Content to display
|
||||
* @param {Object} event The amd event module used to fire events for jquery and yui.
|
||||
*/
|
||||
display_callback : function(content, event) {
|
||||
display_callback: function(content, event) {
|
||||
var data,
|
||||
key,
|
||||
alertpanel,
|
||||
@@ -75,13 +75,13 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
position;
|
||||
try {
|
||||
data = Y.JSON.parse(content);
|
||||
if (data.success){
|
||||
this.overlay.hide(); //hide progress indicator
|
||||
if (data.success) {
|
||||
this.overlay.hide(); // hide progress indicator
|
||||
|
||||
for (key in data.entries) {
|
||||
definition = data.entries[key].definition + data.entries[key].attachments;
|
||||
alertpanel = new M.core.alert({title:data.entries[key].concept, draggable: true,
|
||||
message:definition, modal:false, yesLabel: M.util.get_string('ok', 'moodle')});
|
||||
alertpanel = new M.core.alert({title: data.entries[key].concept, draggable: true,
|
||||
message: definition, modal: false, yesLabel: M.util.get_string('ok', 'moodle')});
|
||||
// Notify the filters about the modified nodes.
|
||||
event.notifyFilterContentUpdated(alertpanel.get('boundingBox').getDOMNode());
|
||||
Y.Node.one('#id_yuialertconfirm-' + alertpanel.get('COUNT')).focus();
|
||||
@@ -91,7 +91,7 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
alertpanel.on('complete', this._deletealertpanel, this, alertpanelid);
|
||||
|
||||
// We already have some windows opened, so set the right position...
|
||||
if (!Y.Object.isEmpty(this.alertpanels)){
|
||||
if (!Y.Object.isEmpty(this.alertpanels)) {
|
||||
position = this._getLatestWindowPosition();
|
||||
Y.Node.one(alertpanelid).setXY([position[0] + 10, position[1] + 10]);
|
||||
}
|
||||
@@ -103,63 +103,63 @@ Y.extend(AUTOLINKER, Y.Base, {
|
||||
} else if (data.error) {
|
||||
new M.core.ajaxException(data);
|
||||
}
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
new M.core.exception(e);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
_getLatestWindowPosition : function() {
|
||||
_getLatestWindowPosition: function() {
|
||||
var lastPosition = [0, 0];
|
||||
Y.Object.each(this.alertpanels, function(position) {
|
||||
if (position[0] > lastPosition[0]){
|
||||
if (position[0] > lastPosition[0]) {
|
||||
lastPosition = position;
|
||||
}
|
||||
});
|
||||
return lastPosition;
|
||||
},
|
||||
_deletealertpanel : function(ev, alertpanelid) {
|
||||
_deletealertpanel: function(ev, alertpanelid) {
|
||||
delete this.alertpanels[alertpanelid];
|
||||
}
|
||||
}, {
|
||||
NAME : AUTOLINKERNAME,
|
||||
ATTRS : {
|
||||
url : {
|
||||
validator : Y.Lang.isString,
|
||||
value : M.cfg.wwwroot+'/mod/glossary/showentry.php'
|
||||
NAME: AUTOLINKERNAME,
|
||||
ATTRS: {
|
||||
url: {
|
||||
validator: Y.Lang.isString,
|
||||
value: M.cfg.wwwroot + '/mod/glossary/showentry.php'
|
||||
},
|
||||
name : {
|
||||
validator : Y.Lang.isString,
|
||||
value : 'glossaryconcept'
|
||||
name: {
|
||||
validator: Y.Lang.isString,
|
||||
value: 'glossaryconcept'
|
||||
},
|
||||
options : {
|
||||
getter : function() {
|
||||
options: {
|
||||
getter: function() {
|
||||
return {
|
||||
width : this.get(WIDTH),
|
||||
height : this.get(HEIGHT),
|
||||
menubar : this.get(MENUBAR),
|
||||
location : this.get(LOCATION),
|
||||
scrollbars : this.get(SCROLLBARS),
|
||||
resizable : this.get(RESIZEABLE),
|
||||
toolbar : this.get(TOOLBAR),
|
||||
status : this.get(STATUS),
|
||||
directories : this.get(DIRECTORIES),
|
||||
fullscreen : this.get(FULLSCREEN),
|
||||
dependent : this.get(DEPENDENT)
|
||||
width: this.get(WIDTH),
|
||||
height: this.get(HEIGHT),
|
||||
menubar: this.get(MENUBAR),
|
||||
location: this.get(LOCATION),
|
||||
scrollbars: this.get(SCROLLBARS),
|
||||
resizable: this.get(RESIZEABLE),
|
||||
toolbar: this.get(TOOLBAR),
|
||||
status: this.get(STATUS),
|
||||
directories: this.get(DIRECTORIES),
|
||||
fullscreen: this.get(FULLSCREEN),
|
||||
dependent: this.get(DEPENDENT)
|
||||
};
|
||||
},
|
||||
readOnly : true
|
||||
readOnly: true
|
||||
},
|
||||
width : {value : 600},
|
||||
height : {value : 450},
|
||||
menubar : {value : false},
|
||||
location : {value : false},
|
||||
scrollbars : {value : true},
|
||||
resizable : {value : true},
|
||||
toolbar : {value : true},
|
||||
status : {value : true},
|
||||
directories : {value : false},
|
||||
fullscreen : {value : false},
|
||||
dependent : {value : true}
|
||||
width: {value: 600},
|
||||
height: {value: 450},
|
||||
menubar: {value: false},
|
||||
location: {value: false},
|
||||
scrollbars: {value: true},
|
||||
resizable: {value: true},
|
||||
toolbar: {value: true},
|
||||
status: {value: true},
|
||||
directories: {value: false},
|
||||
fullscreen: {value: false},
|
||||
dependent: {value: true}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -75,7 +75,7 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || {
|
||||
if (!this._configured) {
|
||||
var lang = this._lang;
|
||||
if (typeof window.MathJax !== "undefined") {
|
||||
window.MathJax.Hub.Queue(function () {
|
||||
window.MathJax.Hub.Queue(function() {
|
||||
window.MathJax.Localization.setLocale(lang);
|
||||
});
|
||||
window.MathJax.Hub.Configured();
|
||||
@@ -118,7 +118,7 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || {
|
||||
// Set the process section delay to 0 when updating the formula.
|
||||
window.MathJax.Hub.processSectionDelay = 0;
|
||||
self._setLocale();
|
||||
event.nodes.each(function (node) {
|
||||
event.nodes.each(function(node) {
|
||||
node.all('.filter_mathjaxloader_equation').each(function(node) {
|
||||
window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, node.getDOMNode()]);
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ CSS.FLOATING = 'floating';
|
||||
|
||||
function FloatingHeaders() {}
|
||||
|
||||
FloatingHeaders.ATTRS= {
|
||||
FloatingHeaders.ATTRS = {
|
||||
};
|
||||
|
||||
FloatingHeaders.prototype = {
|
||||
@@ -485,14 +485,14 @@ FloatingHeaders.prototype = {
|
||||
userColumn.each(function(node) {
|
||||
var height = node.getComputedStyle(HEIGHT);
|
||||
// Nasty hack to account for Internet Explorer
|
||||
if(Y.UA.ie !== 0) {
|
||||
if (Y.UA.ie !== 0) {
|
||||
var allHeight = node.get('offsetHeight');
|
||||
var marginHeight = parseInt(node.getComputedStyle('marginTop'),10) +
|
||||
parseInt(node.getComputedStyle('marginBottom'),10);
|
||||
var paddingHeight = parseInt(node.getComputedStyle('paddingTop'),10) +
|
||||
parseInt(node.getComputedStyle('paddingBottom'),10);
|
||||
var borderHeight = parseInt(node.getComputedStyle('borderTopWidth'),10) +
|
||||
parseInt(node.getComputedStyle('borderBottomWidth'),10);
|
||||
var marginHeight = parseInt(node.getComputedStyle('marginTop'), 10) +
|
||||
parseInt(node.getComputedStyle('marginBottom'), 10);
|
||||
var paddingHeight = parseInt(node.getComputedStyle('paddingTop'), 10) +
|
||||
parseInt(node.getComputedStyle('paddingBottom'), 10);
|
||||
var borderHeight = parseInt(node.getComputedStyle('borderTopWidth'), 10) +
|
||||
parseInt(node.getComputedStyle('borderBottomWidth'), 10);
|
||||
height = allHeight - marginHeight - paddingHeight - borderHeight;
|
||||
}
|
||||
// Create and configure the new container.
|
||||
@@ -940,17 +940,17 @@ FloatingHeaders.prototype = {
|
||||
this.userColumn.all('.cell').each(function(cell, idx) {
|
||||
var height = userCells.item(idx).getComputedStyle(HEIGHT);
|
||||
// Nasty hack to account for Internet Explorer
|
||||
if(Y.UA.ie !== 0) {
|
||||
if (Y.UA.ie !== 0) {
|
||||
var node = userCells.item(idx);
|
||||
var allHeight = node.getDOMNode ?
|
||||
node.getDOMNode().getBoundingClientRect().height :
|
||||
node.get('offsetHeight');
|
||||
var marginHeight = parseInt(node.getComputedStyle('marginTop'),10) +
|
||||
parseInt(node.getComputedStyle('marginBottom'),10);
|
||||
var paddingHeight = parseInt(node.getComputedStyle('paddingTop'),10) +
|
||||
parseInt(node.getComputedStyle('paddingBottom'),10);
|
||||
var borderHeight = parseInt(node.getComputedStyle('borderTopWidth'),10) +
|
||||
parseInt(node.getComputedStyle('borderBottomWidth'),10);
|
||||
var marginHeight = parseInt(node.getComputedStyle('marginTop'), 10) +
|
||||
parseInt(node.getComputedStyle('marginBottom'), 10);
|
||||
var paddingHeight = parseInt(node.getComputedStyle('paddingTop'), 10) +
|
||||
parseInt(node.getComputedStyle('paddingBottom'), 10);
|
||||
var borderHeight = parseInt(node.getComputedStyle('borderTopWidth'), 10) +
|
||||
parseInt(node.getComputedStyle('borderBottomWidth'), 10);
|
||||
height = allHeight - marginHeight - paddingHeight - borderHeight;
|
||||
}
|
||||
cell.setStyles({
|
||||
|
||||
@@ -258,7 +258,7 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor
|
||||
}
|
||||
var params;
|
||||
if (append) {
|
||||
this.set(USP.PAGE, this.get(USP.PAGE)+1);
|
||||
this.set(USP.PAGE, this.get(USP.PAGE) + 1);
|
||||
} else {
|
||||
this.set(USP.USERCOUNT, 0);
|
||||
this.set(USP.PAGE, 0);
|
||||
@@ -271,14 +271,14 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor
|
||||
params.perpage = this.get(USP.PERPAGE);
|
||||
|
||||
Y.io(M.cfg.wwwroot + this.get(USP.AJAXURL), {
|
||||
method:'POST',
|
||||
method: 'POST',
|
||||
data: window.build_querystring(params),
|
||||
on: {
|
||||
start: this.preSearch,
|
||||
complete: this.processSearchResults,
|
||||
end: this.postSearch
|
||||
},
|
||||
context:this,
|
||||
context: this,
|
||||
"arguments": { // Quoted because this is a reserved keyword.
|
||||
append: append
|
||||
}
|
||||
@@ -455,11 +455,11 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor
|
||||
bb.one(SELECTORS.RESULTSCOUNT).setHTML(M.util.get_string('foundnusers', COMPONENT, totalUsers));
|
||||
}
|
||||
|
||||
content = Y.Node.create('<div class="'+CSS.SEARCHRESULTS+'"></div>')
|
||||
content = Y.Node.create('<div class="' + CSS.SEARCHRESULTS + '"></div>')
|
||||
.append(users);
|
||||
if (result.response.totalusers > (this.get(USP.PAGE)+1)*this.get(USP.PERPAGE)) {
|
||||
fetchmore = Y.Node.create('<div class="'+CSS.MORERESULTS+'">' +
|
||||
'<a href="#" role="button">'+M.util.get_string('loadmoreusers', COMPONENT)+'</a></div>');
|
||||
if (result.response.totalusers > (this.get(USP.PAGE) + 1) * this.get(USP.PERPAGE)) {
|
||||
fetchmore = Y.Node.create('<div class="' + CSS.MORERESULTS + '">' +
|
||||
'<a href="#" role="button">' + M.util.get_string('loadmoreusers', COMPONENT) + '</a></div>');
|
||||
fetchmore.one('a').on('click', this.search, this, true);
|
||||
fetchmore.one('a').on('key', this.search, 'space', this, true);
|
||||
content.append(fetchmore);
|
||||
@@ -467,7 +467,7 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor
|
||||
}
|
||||
this.setContent(content);
|
||||
} else {
|
||||
if (totalUsers <= (this.get(USP.PAGE)+1)*this.get(USP.PERPAGE)) {
|
||||
if (totalUsers <= (this.get(USP.PAGE) + 1) * this.get(USP.PERPAGE)) {
|
||||
bb.one(SELECTORS.MORERESULTS).remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
|
||||
// Images with no alt text or dodgy alt text.
|
||||
problemNodes = [];
|
||||
this.editor.all('img').each(function (img) {
|
||||
this.editor.all('img').each(function(img) {
|
||||
var alt = img.getAttribute('alt');
|
||||
if (typeof alt === 'undefined' || alt === '') {
|
||||
if (img.getAttribute('role') !== 'presentation') {
|
||||
@@ -118,7 +118,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
this._addWarnings(list, M.util.get_string('imagesmissingalt', COMPONENT), problemNodes, true);
|
||||
|
||||
problemNodes = [];
|
||||
this.editor.all('*').each(function (node) {
|
||||
this.editor.all('*').each(function(node) {
|
||||
var foreground,
|
||||
background,
|
||||
ratio,
|
||||
@@ -175,7 +175,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
|
||||
// Check for tables with no captions.
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
this.editor.all('table').each(function(table) {
|
||||
var caption = table.one('caption');
|
||||
if (caption === null || caption.get('text').trim() === '') {
|
||||
problemNodes.push(table);
|
||||
@@ -185,7 +185,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
|
||||
// Check for tables with merged cells.
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
this.editor.all('table').each(function(table) {
|
||||
var caption = table.one('[colspan],[rowspan]');
|
||||
if (caption !== null) {
|
||||
problemNodes.push(table);
|
||||
@@ -195,10 +195,10 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
|
||||
// Check for tables with no row/col headers
|
||||
problemNodes = [];
|
||||
this.editor.all('table').each(function (table) {
|
||||
this.editor.all('table').each(function(table) {
|
||||
if (table.one('tr').one('td')) {
|
||||
// First row has a non-header cell, so all rows must have at least one header.
|
||||
table.all('tr').some(function (row) {
|
||||
table.all('tr').some(function(row) {
|
||||
var header = row.one('th');
|
||||
if (!header || (header.get('text').trim() === '')) {
|
||||
problemNodes.push(table);
|
||||
@@ -209,7 +209,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
} else {
|
||||
// First row must have at least one header then.
|
||||
var hasHeader = false;
|
||||
table.one('tr').all('th').some(function (header) {
|
||||
table.one('tr').all('th').some(function(header) {
|
||||
hasHeader = true;
|
||||
if (header.get('text').trim() === '') {
|
||||
problemNodes.push(table);
|
||||
@@ -294,9 +294,9 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M.
|
||||
var part1 = function(a) {
|
||||
a = parseInt(a, 10) / 255.0;
|
||||
if (a <= 0.03928) {
|
||||
a = a/12.92;
|
||||
a = a / 12.92;
|
||||
} else {
|
||||
a = Math.pow(((a + 0.055)/1.055), 2.4);
|
||||
a = Math.pow(((a + 0.055) / 1.055), 2.4);
|
||||
}
|
||||
return a;
|
||||
};
|
||||
|
||||
+263
-263
@@ -43,277 +43,277 @@ var COMPONENTNAME = 'atto_charmap',
|
||||
* @type {Array}
|
||||
*/
|
||||
CHARMAP = [
|
||||
[' ', ' ', true, 'nobreakspace'],
|
||||
['&', '&', true, 'ampersand'],
|
||||
['"', '"', true, 'quotationmark'],
|
||||
['‽', '‽', true, 'interrobang'],
|
||||
[' ', ' ', true, 'nobreakspace'],
|
||||
['&', '&', true, 'ampersand'],
|
||||
['"', '"', true, 'quotationmark'],
|
||||
['‽', '‽', true, 'interrobang'],
|
||||
// Finance.
|
||||
['¢', '¢', true, 'centsign'],
|
||||
['€', '€', true, 'eurosign'],
|
||||
['£', '£', true, 'poundsign'],
|
||||
['¥', '¥', true, 'yensign'],
|
||||
['¢', '¢', true, 'centsign'],
|
||||
['€', '€', true, 'eurosign'],
|
||||
['£', '£', true, 'poundsign'],
|
||||
['¥', '¥', true, 'yensign'],
|
||||
// Signs.
|
||||
['©', '©', true, 'copyrightsign'],
|
||||
['®', '®', true, 'registeredsign'],
|
||||
['™', '™', true, 'trademarksign'],
|
||||
['‰', '‰', true, 'permillesign'],
|
||||
['µ', 'µ', true, 'microsign'],
|
||||
['·', '·', true, 'middledot'],
|
||||
['•', '•', true, 'bullet'],
|
||||
['…', '…', true, 'threedotleader'],
|
||||
['′', '′', true, 'minutesfeet'],
|
||||
['″', '″', true, 'secondsinches'],
|
||||
['§', '§', true, 'sectionsign'],
|
||||
['¶', '¶', true, 'paragraphsign'],
|
||||
['ß', 'ß', true, 'sharpsesszed'],
|
||||
['©', '©', true, 'copyrightsign'],
|
||||
['®', '®', true, 'registeredsign'],
|
||||
['™', '™', true, 'trademarksign'],
|
||||
['‰', '‰', true, 'permillesign'],
|
||||
['µ', 'µ', true, 'microsign'],
|
||||
['·', '·', true, 'middledot'],
|
||||
['•', '•', true, 'bullet'],
|
||||
['…', '…', true, 'threedotleader'],
|
||||
['′', '′', true, 'minutesfeet'],
|
||||
['″', '″', true, 'secondsinches'],
|
||||
['§', '§', true, 'sectionsign'],
|
||||
['¶', '¶', true, 'paragraphsign'],
|
||||
['ß', 'ß', true, 'sharpsesszed'],
|
||||
// Quotations.
|
||||
['‹', '‹', true, 'singleleftpointinganglequotationmark'],
|
||||
['›', '›', true, 'singlerightpointinganglequotationmark'],
|
||||
['«', '«', true, 'leftpointingguillemet'],
|
||||
['»', '»', true, 'rightpointingguillemet'],
|
||||
['‘', '‘', true, 'leftsinglequotationmark'],
|
||||
['’', '’', true, 'rightsinglequotationmark'],
|
||||
['“', '“', true, 'leftdoublequotationmark'],
|
||||
['”', '”', true, 'rightdoublequotationmark'],
|
||||
['‚', '‚', true, 'singlelow9quotationmark'],
|
||||
['„', '„', true, 'doublelow9quotationmark'],
|
||||
['<', '<', true, 'lessthansign'],
|
||||
['>', '>', true, 'greaterthansign'],
|
||||
['≤', '≤', true, 'lessthanorequalto'],
|
||||
['≥', '≥', true, 'greaterthanorequalto'],
|
||||
['–', '–', true, 'endash'],
|
||||
['—', '—', true, 'emdash'],
|
||||
['¯', '¯', true, 'macron'],
|
||||
['‾', '‾', true, 'overline'],
|
||||
['¤', '¤', true, 'currencysign'],
|
||||
['¦', '¦', true, 'brokenbar'],
|
||||
['¨', '¨', true, 'diaeresis'],
|
||||
['¡', '¡', true, 'invertedexclamationmark'],
|
||||
['¿', '¿', true, 'turnedquestionmark'],
|
||||
['ˆ', 'ˆ', true, 'circumflexaccent'],
|
||||
['˜', '˜', true, 'smalltilde'],
|
||||
['°', '°', true, 'degreesign'],
|
||||
['−', '−', true, 'minussign'],
|
||||
['±', '±', true, 'plusminussign'],
|
||||
['÷', '÷', true, 'divisionsign'],
|
||||
['⁄', '⁄', true, 'fractionslash'],
|
||||
['×', '×', true, 'multiplicationsign'],
|
||||
['¹', '¹', true, 'superscriptone'],
|
||||
['²', '²', true, 'superscripttwo'],
|
||||
['³', '³', true, 'superscriptthree'],
|
||||
['¼', '¼', true, 'fractiononequarter'],
|
||||
['½', '½', true, 'fractiononehalf'],
|
||||
['¾', '¾', true, 'fractionthreequarters'],
|
||||
['‹', '‹', true, 'singleleftpointinganglequotationmark'],
|
||||
['›', '›', true, 'singlerightpointinganglequotationmark'],
|
||||
['«', '«', true, 'leftpointingguillemet'],
|
||||
['»', '»', true, 'rightpointingguillemet'],
|
||||
['‘', '‘', true, 'leftsinglequotationmark'],
|
||||
['’', '’', true, 'rightsinglequotationmark'],
|
||||
['“', '“', true, 'leftdoublequotationmark'],
|
||||
['”', '”', true, 'rightdoublequotationmark'],
|
||||
['‚', '‚', true, 'singlelow9quotationmark'],
|
||||
['„', '„', true, 'doublelow9quotationmark'],
|
||||
['<', '<', true, 'lessthansign'],
|
||||
['>', '>', true, 'greaterthansign'],
|
||||
['≤', '≤', true, 'lessthanorequalto'],
|
||||
['≥', '≥', true, 'greaterthanorequalto'],
|
||||
['–', '–', true, 'endash'],
|
||||
['—', '—', true, 'emdash'],
|
||||
['¯', '¯', true, 'macron'],
|
||||
['‾', '‾', true, 'overline'],
|
||||
['¤', '¤', true, 'currencysign'],
|
||||
['¦', '¦', true, 'brokenbar'],
|
||||
['¨', '¨', true, 'diaeresis'],
|
||||
['¡', '¡', true, 'invertedexclamationmark'],
|
||||
['¿', '¿', true, 'turnedquestionmark'],
|
||||
['ˆ', 'ˆ', true, 'circumflexaccent'],
|
||||
['˜', '˜', true, 'smalltilde'],
|
||||
['°', '°', true, 'degreesign'],
|
||||
['−', '−', true, 'minussign'],
|
||||
['±', '±', true, 'plusminussign'],
|
||||
['÷', '÷', true, 'divisionsign'],
|
||||
['⁄', '⁄', true, 'fractionslash'],
|
||||
['×', '×', true, 'multiplicationsign'],
|
||||
['¹', '¹', true, 'superscriptone'],
|
||||
['²', '²', true, 'superscripttwo'],
|
||||
['³', '³', true, 'superscriptthree'],
|
||||
['¼', '¼', true, 'fractiononequarter'],
|
||||
['½', '½', true, 'fractiononehalf'],
|
||||
['¾', '¾', true, 'fractionthreequarters'],
|
||||
// Math / logical.
|
||||
['ƒ', 'ƒ', true, 'functionflorin'],
|
||||
['∫', '∫', true, 'integral'],
|
||||
['∑', '∑', true, 'narysumation'],
|
||||
['∞', '∞', true, 'infinity'],
|
||||
['√', '√', true, 'squareroot'],
|
||||
['∼', '∼', false,'similarto'],
|
||||
['≅', '≅', false,'approximatelyequalto'],
|
||||
['≈', '≈', true, 'almostequalto'],
|
||||
['≠', '≠', true, 'notequalto'],
|
||||
['≡', '≡', true, 'identicalto'],
|
||||
['∈', '∈', false,'elementof'],
|
||||
['∉', '∉', false,'notanelementof'],
|
||||
['∋', '∋', false,'containsasmember'],
|
||||
['∏', '∏', true, 'naryproduct'],
|
||||
['∧', '∧', false,'logicaland'],
|
||||
['∨', '∨', false,'logicalor'],
|
||||
['¬', '¬', true, 'notsign'],
|
||||
['∩', '∩', true, 'intersection'],
|
||||
['∪', '∪', false,'union'],
|
||||
['∂', '∂', true, 'partialdifferential'],
|
||||
['∀', '∀', false,'forall'],
|
||||
['∃', '∃', false,'thereexists'],
|
||||
['∅', '∅', false,'diameter'],
|
||||
['∇', '∇', false,'backwarddifference'],
|
||||
['∗', '∗', false,'asteriskoperator'],
|
||||
['∝', '∝', false,'proportionalto'],
|
||||
['∠', '∠', false,'angle'],
|
||||
['ƒ', 'ƒ', true, 'functionflorin'],
|
||||
['∫', '∫', true, 'integral'],
|
||||
['∑', '∑', true, 'narysumation'],
|
||||
['∞', '∞', true, 'infinity'],
|
||||
['√', '√', true, 'squareroot'],
|
||||
['∼', '∼', false, 'similarto'],
|
||||
['≅', '≅', false, 'approximatelyequalto'],
|
||||
['≈', '≈', true, 'almostequalto'],
|
||||
['≠', '≠', true, 'notequalto'],
|
||||
['≡', '≡', true, 'identicalto'],
|
||||
['∈', '∈', false, 'elementof'],
|
||||
['∉', '∉', false, 'notanelementof'],
|
||||
['∋', '∋', false, 'containsasmember'],
|
||||
['∏', '∏', true, 'naryproduct'],
|
||||
['∧', '∧', false, 'logicaland'],
|
||||
['∨', '∨', false, 'logicalor'],
|
||||
['¬', '¬', true, 'notsign'],
|
||||
['∩', '∩', true, 'intersection'],
|
||||
['∪', '∪', false, 'union'],
|
||||
['∂', '∂', true, 'partialdifferential'],
|
||||
['∀', '∀', false, 'forall'],
|
||||
['∃', '∃', false, 'thereexists'],
|
||||
['∅', '∅', false, 'diameter'],
|
||||
['∇', '∇', false, 'backwarddifference'],
|
||||
['∗', '∗', false, 'asteriskoperator'],
|
||||
['∝', '∝', false, 'proportionalto'],
|
||||
['∠', '∠', false, 'angle'],
|
||||
// Undefined.
|
||||
['´', '´', true, 'acuteaccent'],
|
||||
['¸', '¸', true, 'cedilla'],
|
||||
['ª', 'ª', true, 'feminineordinalindicator'],
|
||||
['º', 'º', true, 'masculineordinalindicator'],
|
||||
['†', '†', true, 'dagger'],
|
||||
['‡', '‡', true, 'doubledagger'],
|
||||
['´', '´', true, 'acuteaccent'],
|
||||
['¸', '¸', true, 'cedilla'],
|
||||
['ª', 'ª', true, 'feminineordinalindicator'],
|
||||
['º', 'º', true, 'masculineordinalindicator'],
|
||||
['†', '†', true, 'dagger'],
|
||||
['‡', '‡', true, 'doubledagger'],
|
||||
// Alphabetical special chars.
|
||||
['À', 'À', true, 'agrave_caps'],
|
||||
['Á', 'Á', true, 'aacute_caps'],
|
||||
['Â', 'Â', true, 'acircumflex_caps'],
|
||||
['Ã', 'Ã', true, 'atilde_caps'],
|
||||
['Ä', 'Ä', true, 'adiaeresis_caps'],
|
||||
['Å', 'Å', true, 'aringabove_caps'],
|
||||
['Ā', 'Ā', true, 'amacron_caps'],
|
||||
['Æ', 'Æ', true, 'ligatureae_caps'],
|
||||
['Ç', 'Ç', true, 'ccedilla_caps'],
|
||||
['È', 'È', true, 'egrave_caps'],
|
||||
['É', 'É', true, 'eacute_caps'],
|
||||
['Ê', 'Ê', true, 'ecircumflex_caps'],
|
||||
['Ë', 'Ë', true, 'ediaeresis_caps'],
|
||||
['Ē', 'Ē', true, 'emacron_caps'],
|
||||
['Ì', 'Ì', true, 'igrave_caps'],
|
||||
['Í', 'Í', true, 'iacute_caps'],
|
||||
['Î', 'Î', true, 'icircumflex_caps'],
|
||||
['Ï', 'Ï', true, 'idiaeresis_caps'],
|
||||
['Ī', 'Ī', true, 'imacron_caps'],
|
||||
['Ð', 'Ð', true, 'eth_caps'],
|
||||
['Ñ', 'Ñ', true, 'ntilde_caps'],
|
||||
['Ò', 'Ò', true, 'ograve_caps'],
|
||||
['Ó', 'Ó', true, 'oacute_caps'],
|
||||
['Ô', 'Ô', true, 'ocircumflex_caps'],
|
||||
['Õ', 'Õ', true, 'otilde_caps'],
|
||||
['Ö', 'Ö', true, 'odiaeresis_caps'],
|
||||
['Ø', 'Ø', true, 'oslash_caps'],
|
||||
['Ō', 'Ō', true, 'omacron_caps'],
|
||||
['Œ', 'Œ', true, 'ligatureoe_caps'],
|
||||
['Š', 'Š', true, 'scaron_caps'],
|
||||
['Ù', 'Ù', true, 'ugrave_caps'],
|
||||
['Ú', 'Ú', true, 'uacute_caps'],
|
||||
['Û', 'Û', true, 'ucircumflex_caps'],
|
||||
['Ü', 'Ü', true, 'udiaeresis_caps'],
|
||||
['Ū', 'Ū', true, 'umacron_caps'],
|
||||
['Ý', 'Ý', true, 'yacute_caps'],
|
||||
['Ÿ', 'Ÿ', true, 'ydiaeresis_caps'],
|
||||
['Þ', 'Þ', true, 'thorn_caps'],
|
||||
['à', 'à', true, 'agrave'],
|
||||
['á', 'á', true, 'aacute'],
|
||||
['â', 'â', true, 'acircumflex'],
|
||||
['ã', 'ã', true, 'atilde'],
|
||||
['ä', 'ä', true, 'adiaeresis'],
|
||||
['å', 'å', true, 'aringabove'],
|
||||
['ā', 'ā', true, 'amacron'],
|
||||
['æ', 'æ', true, 'ligatureae'],
|
||||
['ç', 'ç', true, 'ccedilla'],
|
||||
['è', 'è', true, 'egrave'],
|
||||
['é', 'é', true, 'eacute'],
|
||||
['ê', 'ê', true, 'ecircumflex'],
|
||||
['ë', 'ë', true, 'ediaeresis'],
|
||||
['ē', 'ē', true, 'emacron'],
|
||||
['ì', 'ì', true, 'igrave'],
|
||||
['í', 'í', true, 'iacute'],
|
||||
['î', 'î', true, 'icircumflex'],
|
||||
['ï', 'ï', true, 'idiaeresis'],
|
||||
['ī', 'ī', true, 'imacron'],
|
||||
['ð', 'ð', true, 'eth'],
|
||||
['ñ', 'ñ', true, 'ntilde'],
|
||||
['ò', 'ò', true, 'ograve'],
|
||||
['ó', 'ó', true, 'oacute'],
|
||||
['ô', 'ô', true, 'ocircumflex'],
|
||||
['õ', 'õ', true, 'otilde'],
|
||||
['ö', 'ö', true, 'odiaeresis'],
|
||||
['ø', 'ø', true, 'oslash'],
|
||||
['ō', 'ō', true, 'omacron'],
|
||||
['œ', 'œ', true, 'ligatureoe'],
|
||||
['š', 'š', true, 'scaron'],
|
||||
['ù', 'ù', true, 'ugrave'],
|
||||
['ú', 'ú', true, 'uacute'],
|
||||
['û', 'û', true, 'ucircumflex'],
|
||||
['ü', 'ü', true, 'udiaeresis'],
|
||||
['ū', 'ū', true, 'umacron'],
|
||||
['ý', 'ý', true, 'yacute'],
|
||||
['þ', 'þ', true, 'thorn'],
|
||||
['ÿ', 'ÿ', true, 'ydiaeresis'],
|
||||
['Α', 'Α', true, 'alpha_caps'],
|
||||
['Β', 'Β', true, 'beta_caps'],
|
||||
['Γ', 'Γ', true, 'gamma_caps'],
|
||||
['Δ', 'Δ', true, 'delta_caps'],
|
||||
['Ε', 'Ε', true, 'epsilon_caps'],
|
||||
['Ζ', 'Ζ', true, 'zeta_caps'],
|
||||
['Η', 'Η', true, 'eta_caps'],
|
||||
['Θ', 'Θ', true, 'theta_caps'],
|
||||
['Ι', 'Ι', true, 'iota_caps'],
|
||||
['Κ', 'Κ', true, 'kappa_caps'],
|
||||
['Λ', 'Λ', true, 'lambda_caps'],
|
||||
['Μ', 'Μ', true, 'mu_caps'],
|
||||
['Ν', 'Ν', true, 'nu_caps'],
|
||||
['Ξ', 'Ξ', true, 'xi_caps'],
|
||||
['Ο', 'Ο', true, 'omicron_caps'],
|
||||
['Π', 'Π', true, 'pi_caps'],
|
||||
['Ρ', 'Ρ', true, 'rho_caps'],
|
||||
['Σ', 'Σ', true, 'sigma_caps'],
|
||||
['Τ', 'Τ', true, 'tau_caps'],
|
||||
['Υ', 'Υ', true, 'upsilon_caps'],
|
||||
['Φ', 'Φ', true, 'phi_caps'],
|
||||
['Χ', 'Χ', true, 'chi_caps'],
|
||||
['Ψ', 'Ψ', true, 'psi_caps'],
|
||||
['Ω', 'Ω', true, 'omega_caps'],
|
||||
['α', 'α', true, 'alpha'],
|
||||
['β', 'β', true, 'beta'],
|
||||
['γ', 'γ', true, 'gamma'],
|
||||
['δ', 'δ', true, 'delta'],
|
||||
['ε', 'ε', true, 'epsilon'],
|
||||
['ζ', 'ζ', true, 'zeta'],
|
||||
['η', 'η', true, 'eta'],
|
||||
['θ', 'θ', true, 'theta'],
|
||||
['ι', 'ι', true, 'iota'],
|
||||
['κ', 'κ', true, 'kappa'],
|
||||
['λ', 'λ', true, 'lambda'],
|
||||
['μ', 'μ', true, 'mu'],
|
||||
['ν', 'ν', true, 'nu'],
|
||||
['ξ', 'ξ', true, 'xi'],
|
||||
['ο', 'ο', true, 'omicron'],
|
||||
['π', 'π', true, 'pi'],
|
||||
['ρ', 'ρ', true, 'rho'],
|
||||
['ς', 'ς', true, 'finalsigma'],
|
||||
['σ', 'σ', true, 'sigma'],
|
||||
['τ', 'τ', true, 'tau'],
|
||||
['υ', 'υ', true, 'upsilon'],
|
||||
['φ', 'φ', true, 'phi'],
|
||||
['χ', 'χ', true, 'chi'],
|
||||
['ψ', 'ψ', true, 'psi'],
|
||||
['ω', 'ω', true, 'omega'],
|
||||
['À', 'À', true, 'agrave_caps'],
|
||||
['Á', 'Á', true, 'aacute_caps'],
|
||||
['Â', 'Â', true, 'acircumflex_caps'],
|
||||
['Ã', 'Ã', true, 'atilde_caps'],
|
||||
['Ä', 'Ä', true, 'adiaeresis_caps'],
|
||||
['Å', 'Å', true, 'aringabove_caps'],
|
||||
['Ā', 'Ā', true, 'amacron_caps'],
|
||||
['Æ', 'Æ', true, 'ligatureae_caps'],
|
||||
['Ç', 'Ç', true, 'ccedilla_caps'],
|
||||
['È', 'È', true, 'egrave_caps'],
|
||||
['É', 'É', true, 'eacute_caps'],
|
||||
['Ê', 'Ê', true, 'ecircumflex_caps'],
|
||||
['Ë', 'Ë', true, 'ediaeresis_caps'],
|
||||
['Ē', 'Ē', true, 'emacron_caps'],
|
||||
['Ì', 'Ì', true, 'igrave_caps'],
|
||||
['Í', 'Í', true, 'iacute_caps'],
|
||||
['Î', 'Î', true, 'icircumflex_caps'],
|
||||
['Ï', 'Ï', true, 'idiaeresis_caps'],
|
||||
['Ī', 'Ī', true, 'imacron_caps'],
|
||||
['Ð', 'Ð', true, 'eth_caps'],
|
||||
['Ñ', 'Ñ', true, 'ntilde_caps'],
|
||||
['Ò', 'Ò', true, 'ograve_caps'],
|
||||
['Ó', 'Ó', true, 'oacute_caps'],
|
||||
['Ô', 'Ô', true, 'ocircumflex_caps'],
|
||||
['Õ', 'Õ', true, 'otilde_caps'],
|
||||
['Ö', 'Ö', true, 'odiaeresis_caps'],
|
||||
['Ø', 'Ø', true, 'oslash_caps'],
|
||||
['Ō', 'Ō', true, 'omacron_caps'],
|
||||
['Œ', 'Œ', true, 'ligatureoe_caps'],
|
||||
['Š', 'Š', true, 'scaron_caps'],
|
||||
['Ù', 'Ù', true, 'ugrave_caps'],
|
||||
['Ú', 'Ú', true, 'uacute_caps'],
|
||||
['Û', 'Û', true, 'ucircumflex_caps'],
|
||||
['Ü', 'Ü', true, 'udiaeresis_caps'],
|
||||
['Ū', 'Ū', true, 'umacron_caps'],
|
||||
['Ý', 'Ý', true, 'yacute_caps'],
|
||||
['Ÿ', 'Ÿ', true, 'ydiaeresis_caps'],
|
||||
['Þ', 'Þ', true, 'thorn_caps'],
|
||||
['à', 'à', true, 'agrave'],
|
||||
['á', 'á', true, 'aacute'],
|
||||
['â', 'â', true, 'acircumflex'],
|
||||
['ã', 'ã', true, 'atilde'],
|
||||
['ä', 'ä', true, 'adiaeresis'],
|
||||
['å', 'å', true, 'aringabove'],
|
||||
['ā', 'ā', true, 'amacron'],
|
||||
['æ', 'æ', true, 'ligatureae'],
|
||||
['ç', 'ç', true, 'ccedilla'],
|
||||
['è', 'è', true, 'egrave'],
|
||||
['é', 'é', true, 'eacute'],
|
||||
['ê', 'ê', true, 'ecircumflex'],
|
||||
['ë', 'ë', true, 'ediaeresis'],
|
||||
['ē', 'ē', true, 'emacron'],
|
||||
['ì', 'ì', true, 'igrave'],
|
||||
['í', 'í', true, 'iacute'],
|
||||
['î', 'î', true, 'icircumflex'],
|
||||
['ï', 'ï', true, 'idiaeresis'],
|
||||
['ī', 'ī', true, 'imacron'],
|
||||
['ð', 'ð', true, 'eth'],
|
||||
['ñ', 'ñ', true, 'ntilde'],
|
||||
['ò', 'ò', true, 'ograve'],
|
||||
['ó', 'ó', true, 'oacute'],
|
||||
['ô', 'ô', true, 'ocircumflex'],
|
||||
['õ', 'õ', true, 'otilde'],
|
||||
['ö', 'ö', true, 'odiaeresis'],
|
||||
['ø', 'ø', true, 'oslash'],
|
||||
['ō', 'ō', true, 'omacron'],
|
||||
['œ', 'œ', true, 'ligatureoe'],
|
||||
['š', 'š', true, 'scaron'],
|
||||
['ù', 'ù', true, 'ugrave'],
|
||||
['ú', 'ú', true, 'uacute'],
|
||||
['û', 'û', true, 'ucircumflex'],
|
||||
['ü', 'ü', true, 'udiaeresis'],
|
||||
['ū', 'ū', true, 'umacron'],
|
||||
['ý', 'ý', true, 'yacute'],
|
||||
['þ', 'þ', true, 'thorn'],
|
||||
['ÿ', 'ÿ', true, 'ydiaeresis'],
|
||||
['Α', 'Α', true, 'alpha_caps'],
|
||||
['Β', 'Β', true, 'beta_caps'],
|
||||
['Γ', 'Γ', true, 'gamma_caps'],
|
||||
['Δ', 'Δ', true, 'delta_caps'],
|
||||
['Ε', 'Ε', true, 'epsilon_caps'],
|
||||
['Ζ', 'Ζ', true, 'zeta_caps'],
|
||||
['Η', 'Η', true, 'eta_caps'],
|
||||
['Θ', 'Θ', true, 'theta_caps'],
|
||||
['Ι', 'Ι', true, 'iota_caps'],
|
||||
['Κ', 'Κ', true, 'kappa_caps'],
|
||||
['Λ', 'Λ', true, 'lambda_caps'],
|
||||
['Μ', 'Μ', true, 'mu_caps'],
|
||||
['Ν', 'Ν', true, 'nu_caps'],
|
||||
['Ξ', 'Ξ', true, 'xi_caps'],
|
||||
['Ο', 'Ο', true, 'omicron_caps'],
|
||||
['Π', 'Π', true, 'pi_caps'],
|
||||
['Ρ', 'Ρ', true, 'rho_caps'],
|
||||
['Σ', 'Σ', true, 'sigma_caps'],
|
||||
['Τ', 'Τ', true, 'tau_caps'],
|
||||
['Υ', 'Υ', true, 'upsilon_caps'],
|
||||
['Φ', 'Φ', true, 'phi_caps'],
|
||||
['Χ', 'Χ', true, 'chi_caps'],
|
||||
['Ψ', 'Ψ', true, 'psi_caps'],
|
||||
['Ω', 'Ω', true, 'omega_caps'],
|
||||
['α', 'α', true, 'alpha'],
|
||||
['β', 'β', true, 'beta'],
|
||||
['γ', 'γ', true, 'gamma'],
|
||||
['δ', 'δ', true, 'delta'],
|
||||
['ε', 'ε', true, 'epsilon'],
|
||||
['ζ', 'ζ', true, 'zeta'],
|
||||
['η', 'η', true, 'eta'],
|
||||
['θ', 'θ', true, 'theta'],
|
||||
['ι', 'ι', true, 'iota'],
|
||||
['κ', 'κ', true, 'kappa'],
|
||||
['λ', 'λ', true, 'lambda'],
|
||||
['μ', 'μ', true, 'mu'],
|
||||
['ν', 'ν', true, 'nu'],
|
||||
['ξ', 'ξ', true, 'xi'],
|
||||
['ο', 'ο', true, 'omicron'],
|
||||
['π', 'π', true, 'pi'],
|
||||
['ρ', 'ρ', true, 'rho'],
|
||||
['ς', 'ς', true, 'finalsigma'],
|
||||
['σ', 'σ', true, 'sigma'],
|
||||
['τ', 'τ', true, 'tau'],
|
||||
['υ', 'υ', true, 'upsilon'],
|
||||
['φ', 'φ', true, 'phi'],
|
||||
['χ', 'χ', true, 'chi'],
|
||||
['ψ', 'ψ', true, 'psi'],
|
||||
['ω', 'ω', true, 'omega'],
|
||||
// Symbols.
|
||||
['ℵ', 'ℵ', false,'alefsymbol'],
|
||||
['ϖ', 'ϖ', false,'pisymbol'],
|
||||
['ℜ', 'ℜ', false,'realpartsymbol'],
|
||||
['ϑ','ϑ', false,'thetasymbol'],
|
||||
['ϒ', 'ϒ', false,'upsilonhooksymbol'],
|
||||
['℘', '℘', false,'weierstrassp'],
|
||||
['ℑ', 'ℑ', false,'imaginarypart'],
|
||||
['ℵ', 'ℵ', false, 'alefsymbol'],
|
||||
['ϖ', 'ϖ', false, 'pisymbol'],
|
||||
['ℜ', 'ℜ', false, 'realpartsymbol'],
|
||||
['ϑ', 'ϑ', false, 'thetasymbol'],
|
||||
['ϒ', 'ϒ', false, 'upsilonhooksymbol'],
|
||||
['℘', '℘', false, 'weierstrassp'],
|
||||
['ℑ', 'ℑ', false, 'imaginarypart'],
|
||||
// Arrows.
|
||||
['←', '←', true, 'leftwardsarrow'],
|
||||
['↑', '↑', true, 'upwardsarrow'],
|
||||
['→', '→', true, 'rightwardsarrow'],
|
||||
['↓', '↓', true, 'downwardsarrow'],
|
||||
['↔', '↔', true, 'leftrightarrow'],
|
||||
['↵', '↵', false,'carriagereturn'],
|
||||
['⇐', '⇐', false,'leftwardsdoublearrow'],
|
||||
['⇑', '⇑', false,'upwardsdoublearrow'],
|
||||
['⇒', '⇒', false,'rightwardsdoublearrow'],
|
||||
['⇓', '⇓', false,'downwardsdoublearrow'],
|
||||
['⇔', '⇔', false,'leftrightdoublearrow'],
|
||||
['∴', '∴', false,'therefore'],
|
||||
['⊂', '⊂', false,'subsetof'],
|
||||
['⊃', '⊃', false,'supersetof'],
|
||||
['⊄', '⊄', false,'notasubsetof'],
|
||||
['⊆', '⊆', false,'subsetoforequalto'],
|
||||
['⊇', '⊇', false,'supersetoforequalto'],
|
||||
['⊕', '⊕', false,'circledplus'],
|
||||
['⊗', '⊗', false,'circledtimes'],
|
||||
['⊥', '⊥', false,'perpendicular'],
|
||||
['⋅', '⋅', false,'dotoperator'],
|
||||
['⌈', '⌈', false,'leftceiling'],
|
||||
['⌉', '⌉', false,'rightceiling'],
|
||||
['⌊', '⌊', false,'leftfloor'],
|
||||
['⌋', '⌋', false,'rightfloor'],
|
||||
['⟨', '〈', false,'leftpointinganglebracket'],
|
||||
['⟩', '〉', false,'rightpointinganglebracket'],
|
||||
['◊', '◊', true, 'lozenge'],
|
||||
['♠', '♠', true, 'blackspadesuit'],
|
||||
['♣', '♣', true, 'blackclubsuit'],
|
||||
['♥', '♥', true, 'blackheartsuit'],
|
||||
['♦', '♦', true, 'blackdiamondsuit'],
|
||||
[' ', ' ', false,'enspace'],
|
||||
[' ', ' ', false,'emspace'],
|
||||
[' ', ' ', false,'thinspace'],
|
||||
['‌', '‌', false,'zerowidthnonjoiner'],
|
||||
['‍', '‍', false,'zerowidthjoiner'],
|
||||
['‎', '‎', false,'lefttorightmark'],
|
||||
['‏', '‏', false,'righttoleftmark'],
|
||||
['­', '­', false,'softhyphen']
|
||||
['←', '←', true, 'leftwardsarrow'],
|
||||
['↑', '↑', true, 'upwardsarrow'],
|
||||
['→', '→', true, 'rightwardsarrow'],
|
||||
['↓', '↓', true, 'downwardsarrow'],
|
||||
['↔', '↔', true, 'leftrightarrow'],
|
||||
['↵', '↵', false, 'carriagereturn'],
|
||||
['⇐', '⇐', false, 'leftwardsdoublearrow'],
|
||||
['⇑', '⇑', false, 'upwardsdoublearrow'],
|
||||
['⇒', '⇒', false, 'rightwardsdoublearrow'],
|
||||
['⇓', '⇓', false, 'downwardsdoublearrow'],
|
||||
['⇔', '⇔', false, 'leftrightdoublearrow'],
|
||||
['∴', '∴', false, 'therefore'],
|
||||
['⊂', '⊂', false, 'subsetof'],
|
||||
['⊃', '⊃', false, 'supersetof'],
|
||||
['⊄', '⊄', false, 'notasubsetof'],
|
||||
['⊆', '⊆', false, 'subsetoforequalto'],
|
||||
['⊇', '⊇', false, 'supersetoforequalto'],
|
||||
['⊕', '⊕', false, 'circledplus'],
|
||||
['⊗', '⊗', false, 'circledtimes'],
|
||||
['⊥', '⊥', false, 'perpendicular'],
|
||||
['⋅', '⋅', false, 'dotoperator'],
|
||||
['⌈', '⌈', false, 'leftceiling'],
|
||||
['⌉', '⌉', false, 'rightceiling'],
|
||||
['⌊', '⌊', false, 'leftfloor'],
|
||||
['⌋', '⌋', false, 'rightfloor'],
|
||||
['⟨', '〈', false, 'leftpointinganglebracket'],
|
||||
['⟩', '〉', false, 'rightpointinganglebracket'],
|
||||
['◊', '◊', true, 'lozenge'],
|
||||
['♠', '♠', true, 'blackspadesuit'],
|
||||
['♣', '♣', true, 'blackclubsuit'],
|
||||
['♥', '♥', true, 'blackheartsuit'],
|
||||
['♦', '♦', true, 'blackdiamondsuit'],
|
||||
[' ', ' ', false, 'enspace'],
|
||||
[' ', ' ', false, 'emspace'],
|
||||
[' ', ' ', false, 'thinspace'],
|
||||
['‌', '‌', false, 'zerowidthnonjoiner'],
|
||||
['‍', '‍', false, 'zerowidthjoiner'],
|
||||
['‎', '‎', false, 'lefttorightmark'],
|
||||
['‏', '‏', false, 'righttoleftmark'],
|
||||
['­', '­', false, 'softhyphen']
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,13 +42,13 @@ Y.namespace('M.atto_collapse').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
var toolbarGroupCount = Y.Object.size(this.get('host').get('plugins'));
|
||||
if (toolbarGroupCount <= 1 + parseInt(this.get(ATTRSHOWGROUPS), 10)) {
|
||||
Y.log("There are not enough groups to require toggling - not adding the button",
|
||||
'debug','moodle-atto_collapse');
|
||||
'debug', 'moodle-atto_collapse');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.toolbar.all(GROUPS).size() > this.get(ATTRSHOWGROUPS)) {
|
||||
Y.log("The collapse plugin is shown after it's cut-off - not adding the button",
|
||||
'debug','moodle-atto_collapse');
|
||||
'debug', 'moodle-atto_collapse');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
}, this);
|
||||
|
||||
// We need to convert these to a non dom node based format.
|
||||
this.editor.all('tex').each(function (texNode) {
|
||||
this.editor.all('tex').each(function(texNode) {
|
||||
var replacement = Y.Node.create('<span>' +
|
||||
DELIMITERS.START + ' ' + texNode.get('text') + ' ' + DELIMITERS.END +
|
||||
'</span>');
|
||||
@@ -293,7 +293,7 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
return Y.Array.find(patternMatches, function(match) {
|
||||
// Check each occurrence of this match.
|
||||
var startIndex = 0;
|
||||
while(text.indexOf(match, startIndex) !== -1) {
|
||||
while (text.indexOf(match, startIndex) !== -1) {
|
||||
// Determine whether the cursor is in the current occurrence of this string.
|
||||
// Note: We do not support a selection exceeding the bounds of an equation.
|
||||
var startOuter = text.indexOf(match, startIndex),
|
||||
@@ -378,7 +378,7 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
selectedNode = Y.one(host.getSelectionParentNode());
|
||||
text = selectedNode.get('text');
|
||||
value = ' ' + value + ' ';
|
||||
newText = text.slice(0, this.sourceEquation.startInnerPosition) +
|
||||
newText = text.slice(0, this.sourceEquation.startInnerPosition) +
|
||||
value +
|
||||
text.slice(this.sourceEquation.endInnerPosition);
|
||||
|
||||
@@ -408,10 +408,10 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
*/
|
||||
_throttle: function(fn, delay) {
|
||||
var timer = null;
|
||||
return function () {
|
||||
return function() {
|
||||
var context = this, args = arguments;
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function () {
|
||||
timer = setTimeout(function() {
|
||||
fn.apply(context, args);
|
||||
}, delay);
|
||||
};
|
||||
@@ -453,7 +453,7 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
// Now match to the end of the line.
|
||||
while (isChar.test(equation.charAt(currentPos)) &&
|
||||
currentPos < equation.length &&
|
||||
isChar.test(equation.charAt(currentPos-1))) {
|
||||
isChar.test(equation.charAt(currentPos - 1))) {
|
||||
currentPos += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,8 +219,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
||||
this.editor.on('drop', this._handleDragDrop, this);
|
||||
|
||||
// e.preventDefault needed to stop the default event from clobbering the desired behaviour in some browsers.
|
||||
this.editor.on('dragover', function(e){e.preventDefault();}, this);
|
||||
this.editor.on('dragenter', function(e){e.preventDefault();}, this);
|
||||
this.editor.on('dragover', function(e) { e.preventDefault(); }, this);
|
||||
this.editor.on('dragenter', function(e) { e.preventDefault(); }, this);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -442,8 +442,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
||||
this.height = 1;
|
||||
}
|
||||
// This is the same as comparing to 3 decimal places.
|
||||
widthRatio = Math.round(1000*parseInt(currentwidth, 10) / this.width);
|
||||
heightRatio = Math.round(1000*parseInt(currentheight, 10) / this.height);
|
||||
widthRatio = Math.round(1000 * parseInt(currentwidth, 10) / this.width);
|
||||
heightRatio = Math.round(1000 * parseInt(currentheight, 10) / this.height);
|
||||
input.set('checked', widthRatio === heightRatio);
|
||||
}
|
||||
|
||||
@@ -701,7 +701,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
||||
_getSelectedImageProperties: function() {
|
||||
var properties = {
|
||||
src: null,
|
||||
alt :null,
|
||||
alt: null,
|
||||
width: null,
|
||||
height: null,
|
||||
align: '',
|
||||
|
||||
+15
-15
@@ -104,7 +104,7 @@ var COMPONENT = 'atto_table',
|
||||
'style="background-color:transparent;color:transparent">' +
|
||||
|
||||
'<input id="{{../elementid}}_atto_table_bordercolour_-1"' +
|
||||
'type="radio" name="borderColour" value="none" checked="checked"'+
|
||||
'type="radio" name="borderColour" value="none" checked="checked"' +
|
||||
'title="{{get_string "themedefault" component}}"></input>' +
|
||||
|
||||
'{{get_string "themedefault" component}}' +
|
||||
@@ -131,7 +131,7 @@ var COMPONENT = 'atto_table',
|
||||
'style="background-color:transparent;color:transparent">' +
|
||||
|
||||
'<input id="{{../elementid}}_atto_table_backgroundcolour_-1"' +
|
||||
'type="radio" name="backgroundColour" value="none" checked="checked"'+
|
||||
'type="radio" name="backgroundColour" value="none" checked="checked"' +
|
||||
'title="{{get_string "themedefault" component}}"></input>' +
|
||||
|
||||
'{{get_string "themedefault" component}}' +
|
||||
@@ -139,7 +139,7 @@ var COMPONENT = 'atto_table',
|
||||
|
||||
'{{#each availableColours}}' +
|
||||
'<label for="{{../elementid}}_atto_table_backgroundcolour_{{@index}}"' +
|
||||
'style="background-color:{{this}};color:{{this}}">'+
|
||||
'style="background-color:{{this}};color:{{this}}">' +
|
||||
|
||||
'<input id="{{../elementid}}_atto_table_backgroundcolour_{{@index}}"' +
|
||||
'type="radio" name="backgroundColour" value="' + '{{this}}' + '" title="{{this}}">' +
|
||||
@@ -370,10 +370,10 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
||||
_updateAvailableSettings: function() {
|
||||
var tableForm = this._content,
|
||||
enableBorders = tableForm.one('[name="borders"]'),
|
||||
borderStyle = tableForm.one('[name="borderstyles"]'),
|
||||
borderSize = tableForm.one('[name="bordersize"]'),
|
||||
borderColour = tableForm.all('[name="borderColour"]'),
|
||||
disabledValue = 'removeAttribute';
|
||||
borderStyle = tableForm.one('[name="borderstyles"]'),
|
||||
borderSize = tableForm.one('[name="bordersize"]'),
|
||||
borderColour = tableForm.all('[name="borderColour"]'),
|
||||
disabledValue = 'removeAttribute';
|
||||
|
||||
if (!enableBorders) {
|
||||
return;
|
||||
@@ -410,7 +410,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
||||
var targetcell = null,
|
||||
host = this.get('host');
|
||||
|
||||
host.getSelectedNodes().some(function (node) {
|
||||
host.getSelectedNodes().some(function(node) {
|
||||
if (node.ancestor('td, th, caption', true, this._stopAtContentEditableFilter)) {
|
||||
targetcell = node;
|
||||
|
||||
@@ -514,7 +514,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
||||
|
||||
// Add the row headers.
|
||||
if (headers.get('value') === 'rows' || headers.get('value') === 'both') {
|
||||
table.all('tr').each(function (row) {
|
||||
table.all('tr').each(function(row) {
|
||||
var cells = row.all('th, td'),
|
||||
firstCell = cells.shift(),
|
||||
newCell;
|
||||
@@ -528,7 +528,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
||||
}
|
||||
|
||||
// Now make sure all other cells in the row are td.
|
||||
cells.each(function (cell) {
|
||||
cells.each(function(cell) {
|
||||
if (cell.get('tagName') === 'TH') {
|
||||
newCell = this._changeNodeType(cell, 'td');
|
||||
newCell.removeAttribute('scope');
|
||||
@@ -543,7 +543,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
||||
firstRow = rows.shift(),
|
||||
newCell;
|
||||
|
||||
firstRow.all('td, th').each(function (cell) {
|
||||
firstRow.all('td, th').each(function(cell) {
|
||||
if (cell.get('tagName') === 'TD') {
|
||||
// Cell is a td but should be a th - change it.
|
||||
newCell = this._changeNodeType(cell, 'th');
|
||||
@@ -685,8 +685,8 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
||||
rows.each(function(row) {
|
||||
var cells = row.all('td, th'),
|
||||
cell = cells.item(columnindex),
|
||||
cellprev = cells.item(columnindex-1),
|
||||
cellnext = cells.item(columnindex+1);
|
||||
cellprev = cells.item(columnindex - 1),
|
||||
cellnext = cells.item(columnindex + 1);
|
||||
currentcells.push(cell);
|
||||
if (cellprev) {
|
||||
prevcells.push(cellprev);
|
||||
@@ -1048,7 +1048,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
||||
var cells = this._findColumnCells();
|
||||
|
||||
// Check we have some tds in this column, and one exists to the right.
|
||||
if ( (cells.next.size() > 0) &&
|
||||
if ((cells.next.size() > 0) &&
|
||||
(cells.current.size() === cells.next.size()) &&
|
||||
(cells.current.filter('td').size() > 0)) {
|
||||
var i = 0;
|
||||
@@ -1329,7 +1329,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi
|
||||
return;
|
||||
}
|
||||
var newrow = firstrow.cloneNode(true);
|
||||
newrow.all('th, td').each(function (tablecell) {
|
||||
newrow.all('th, td').each(function(tablecell) {
|
||||
if (tablecell.get('tagName') === 'TH') {
|
||||
if (tablecell.getAttribute('scope') !== 'row') {
|
||||
var newcell = Y.Node.create('<td></td>');
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ var SUCCESS_MESSAGE_TIMEOUT = 5000,
|
||||
|
||||
function EditorAutosave() {}
|
||||
|
||||
EditorAutosave.ATTRS= {
|
||||
EditorAutosave.ATTRS = {
|
||||
/**
|
||||
* Enable/Disable auto save for this instance.
|
||||
*
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@
|
||||
|
||||
function EditorClean() {}
|
||||
|
||||
EditorClean.ATTRS= {
|
||||
EditorClean.ATTRS = {
|
||||
};
|
||||
|
||||
EditorClean.prototype = {
|
||||
@@ -290,9 +290,9 @@ EditorClean.prototype = {
|
||||
// Get all class attributes so we can work on them.
|
||||
{regex: /(<[^>]*?class\s*?=\s*?")([^>"]*)(")/gi, replace: function(match, group1, group2, group3) {
|
||||
// Remove MSO classes.
|
||||
group2 = group2.replace(/(?:^|[\s])[\s]*MSO[_a-zA-Z0-9\-]*/gi,"");
|
||||
group2 = group2.replace(/(?:^|[\s])[\s]*MSO[_a-zA-Z0-9\-]*/gi, "");
|
||||
// Remove Apple- classes.
|
||||
group2 = group2.replace(/(?:^|[\s])[\s]*Apple-[_a-zA-Z0-9\-]*/gi,"");
|
||||
group2 = group2.replace(/(?:^|[\s])[\s]*Apple-[_a-zA-Z0-9\-]*/gi, "");
|
||||
return group1 + group2 + group3;
|
||||
}},
|
||||
// Remove OLE_LINK# anchors that may litter the code.
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
function EditorCommand() {}
|
||||
|
||||
EditorCommand.ATTRS= {
|
||||
EditorCommand.ATTRS = {
|
||||
};
|
||||
|
||||
EditorCommand.prototype = {
|
||||
|
||||
@@ -33,7 +33,7 @@ var MENUTEMPLATE = '' +
|
||||
'tabindex="-1" ' +
|
||||
'type="button" ' +
|
||||
'title="{{title}}">' +
|
||||
'<img class="icon" aria-hidden="true" role="presentation" width="16" height="16" '+
|
||||
'<img class="icon" aria-hidden="true" role="presentation" width="16" height="16" ' +
|
||||
'style="background-color:{{config.menuColor}};" src="{{config.iconurl}}" />' +
|
||||
'<img class="icon" aria-hidden="true" role="presentation" width="16" height="16" ' +
|
||||
'src="{{image_url "t/expanded" "moodle"}}"/>' +
|
||||
@@ -48,7 +48,7 @@ var DISABLED = 'disabled',
|
||||
|
||||
function EditorPluginButtons() {}
|
||||
|
||||
EditorPluginButtons.ATTRS= {
|
||||
EditorPluginButtons.ATTRS = {
|
||||
};
|
||||
|
||||
EditorPluginButtons.prototype = {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
function EditorPluginDialogue() {}
|
||||
|
||||
EditorPluginDialogue.ATTRS= {
|
||||
EditorPluginDialogue.ATTRS = {
|
||||
};
|
||||
|
||||
EditorPluginDialogue.prototype = {
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ Y.extend(Editor, Y.Base, {
|
||||
* @property BLOCK_TAGS
|
||||
* @type {Array}
|
||||
*/
|
||||
BLOCK_TAGS : [
|
||||
BLOCK_TAGS: [
|
||||
'address',
|
||||
'article',
|
||||
'aside',
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@
|
||||
|
||||
function EditorFilepicker() {}
|
||||
|
||||
EditorFilepicker.ATTRS= {
|
||||
EditorFilepicker.ATTRS = {
|
||||
/**
|
||||
* The options for the filepicker.
|
||||
*
|
||||
@@ -66,7 +66,7 @@ EditorFilepicker.prototype = {
|
||||
*/
|
||||
showFilepicker: function(type, callback, context) {
|
||||
var self = this;
|
||||
Y.use('core_filepicker', function (Y) {
|
||||
Y.use('core_filepicker', function(Y) {
|
||||
var options = Y.clone(self.get('filepickeroptions')[type], true);
|
||||
options.formcallback = callback;
|
||||
if (context) {
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ var LOGNAME_NOTIFY = 'moodle-editor_atto-editor-notify',
|
||||
|
||||
function EditorNotify() {}
|
||||
|
||||
EditorNotify.ATTRS= {
|
||||
EditorNotify.ATTRS = {
|
||||
};
|
||||
|
||||
EditorNotify.prototype = {
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@
|
||||
|
||||
function EditorSelection() {}
|
||||
|
||||
EditorSelection.ATTRS= {
|
||||
EditorSelection.ATTRS = {
|
||||
};
|
||||
|
||||
EditorSelection.prototype = {
|
||||
@@ -253,7 +253,7 @@ EditorSelection.prototype = {
|
||||
return false;
|
||||
}
|
||||
|
||||
selectednodes.each(function(node){
|
||||
selectednodes.each(function(node) {
|
||||
// Check each node, if it doesn't match the tags AND is not within the specified tags then fail this thing.
|
||||
if (requireall) {
|
||||
// Check for at least one failure.
|
||||
|
||||
+6
-6
@@ -30,7 +30,7 @@
|
||||
|
||||
function EditorStyling() {}
|
||||
|
||||
EditorStyling.ATTRS= {
|
||||
EditorStyling.ATTRS = {
|
||||
};
|
||||
|
||||
EditorStyling.prototype = {
|
||||
@@ -107,7 +107,7 @@ EditorStyling.prototype = {
|
||||
|
||||
cssApplier.applyToSelection();
|
||||
|
||||
this.editor.all('.' + classname).each(function (node) {
|
||||
this.editor.all('.' + classname).each(function(node) {
|
||||
node.removeClass(classname).setStyles(styles);
|
||||
}, this);
|
||||
|
||||
@@ -146,7 +146,7 @@ EditorStyling.prototype = {
|
||||
// move the boundary to the table cell.
|
||||
// This is because we might have a table in a div, and we select some text in a cell,
|
||||
// want to limit the change in style to the table cell, not the entire table (via the outer div).
|
||||
cell = selectionparentnode.ancestor(function (node) {
|
||||
cell = selectionparentnode.ancestor(function(node) {
|
||||
var tagname = node.get('tagName');
|
||||
if (tagname) {
|
||||
tagname = tagname.toLowerCase();
|
||||
@@ -164,7 +164,7 @@ EditorStyling.prototype = {
|
||||
nearestblock = selectionparentnode.ancestor(this.BLOCK_TAGS.join(', '), true);
|
||||
if (nearestblock) {
|
||||
// Check that the block is contained by the boundary.
|
||||
match = nearestblock.ancestor(function (node) {
|
||||
match = nearestblock.ancestor(function(node) {
|
||||
return node === boundary;
|
||||
}, false);
|
||||
|
||||
@@ -177,7 +177,7 @@ EditorStyling.prototype = {
|
||||
if (!nearestblock) {
|
||||
// There is no block node in the content, wrap the content in a p and use that.
|
||||
newcontent = Y.Node.create('<p></p>');
|
||||
boundary.get('childNodes').each(function (child) {
|
||||
boundary.get('childNodes').each(function(child) {
|
||||
newcontent.append(child.remove());
|
||||
});
|
||||
boundary.append(newcontent);
|
||||
@@ -192,7 +192,7 @@ EditorStyling.prototype = {
|
||||
// Copy all attributes.
|
||||
replacement.setAttrs(nearestblock.getAttrs());
|
||||
// Copy all children.
|
||||
nearestblock.get('childNodes').each(function (child) {
|
||||
nearestblock.get('childNodes').each(function(child) {
|
||||
child.remove();
|
||||
replacement.append(child);
|
||||
});
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@
|
||||
|
||||
function EditorTextArea() {}
|
||||
|
||||
EditorTextArea.ATTRS= {
|
||||
EditorTextArea.ATTRS = {
|
||||
};
|
||||
|
||||
EditorTextArea.prototype = {
|
||||
@@ -81,7 +81,7 @@ EditorTextArea.prototype = {
|
||||
* @method updateOriginal
|
||||
* @chainable
|
||||
*/
|
||||
updateOriginal : function() {
|
||||
updateOriginal: function() {
|
||||
// Get the previous and current value to compare them.
|
||||
var oldValue = this.textarea.get('value'),
|
||||
newValue = this.getCleanHTML();
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
function EditorToolbarNav() {}
|
||||
|
||||
EditorToolbarNav.ATTRS= {
|
||||
EditorToolbarNav.ATTRS = {
|
||||
};
|
||||
|
||||
EditorToolbarNav.prototype = {
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
function EditorToolbar() {}
|
||||
|
||||
EditorToolbar.ATTRS= {
|
||||
EditorToolbar.ATTRS = {
|
||||
};
|
||||
|
||||
EditorToolbar.prototype = {
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ CALENDAR.prototype = {
|
||||
closepopup: true,
|
||||
initializer: function() {
|
||||
var controls = this.get('node').all('select');
|
||||
controls.each(function(node){
|
||||
controls.each(function(node) {
|
||||
if (node.get('name').match(/\[year\]/)) {
|
||||
this.yearselect = node;
|
||||
} else if (node.get('name').match(/\[month\]/)) {
|
||||
@@ -166,7 +166,7 @@ CALENDAR.prototype = {
|
||||
Y.extend(CALENDAR, Y.Base, CALENDAR.prototype, {
|
||||
NAME: 'Date Selector',
|
||||
ATTRS: {
|
||||
firstdayofweek : {
|
||||
firstdayofweek: {
|
||||
validator: Y.Lang.isString
|
||||
},
|
||||
node: {
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@ Y.mix(Y.Node.prototype, {
|
||||
if (this.get('nodeName').toLowerCase() !== 'select') {
|
||||
return false;
|
||||
}
|
||||
return this.all('option').item(this.optionSize()-1).get('value');
|
||||
return this.all('option').item(this.optionSize() - 1).get('value');
|
||||
},
|
||||
/**
|
||||
* Gets the number of options in the select box
|
||||
@@ -76,7 +76,7 @@ M.form.dateselector = {
|
||||
Y.one('#dateselector-calendar-panel').setStyle('zIndex', null);
|
||||
this.panel.on('heightChange', this.fix_position, this);
|
||||
|
||||
Y.one('#dateselector-calendar-panel').on('click', function(e){e.halt();});
|
||||
Y.one('#dateselector-calendar-panel').on('click', function(e) { e.halt(); });
|
||||
Y.one(document.body).on('click', this.document_click, this);
|
||||
|
||||
this.calendar = new MOODLECALENDAR({
|
||||
@@ -92,7 +92,7 @@ M.form.dateselector = {
|
||||
config.wed,
|
||||
config.thu,
|
||||
config.fri,
|
||||
config.sat ]
|
||||
config.sat]
|
||||
});
|
||||
},
|
||||
cancel_any_timeout: function() {
|
||||
|
||||
+8
-8
@@ -4,28 +4,28 @@ var PASSWORDUNMASK = function() {
|
||||
|
||||
Y.extend(PASSWORDUNMASK, Y.Base, {
|
||||
// Initialize checkbox if id is passed.
|
||||
initializer : function(params) {
|
||||
initializer: function(params) {
|
||||
if (params && params.formid) {
|
||||
this.add_checkbox(params.formid, params.checkboxlabel, params.checkboxname);
|
||||
}
|
||||
},
|
||||
|
||||
// Create checkbox for unmasking password.
|
||||
add_checkbox : function(elementid, checkboxlabel, checkboxname) {
|
||||
var node = Y.one('#'+elementid);
|
||||
add_checkbox: function(elementid, checkboxlabel, checkboxname) {
|
||||
var node = Y.one('#' + elementid);
|
||||
|
||||
// Retaining unmask div from previous implementation.
|
||||
var unmaskdiv = Y.Node.create('<div id="'+elementid+'unmaskdiv" class="unmask"></div>');
|
||||
var unmaskdiv = Y.Node.create('<div id="' + elementid + 'unmaskdiv" class="unmask"></div>');
|
||||
|
||||
// Add checkbox for unmasking to unmaskdiv.
|
||||
var unmaskchb = Y.Node.create('<input id="'+elementid+'unmask" type="checkbox" name="'+
|
||||
checkboxname+'unmask">');
|
||||
var unmaskchb = Y.Node.create('<input id="' + elementid + 'unmask" type="checkbox" name="' +
|
||||
checkboxname + 'unmask">');
|
||||
unmaskdiv.appendChild(unmaskchb);
|
||||
// Attach event using static javascript function for unmasking password.
|
||||
unmaskchb.on('click', function() {window.unmaskPassword(elementid);});
|
||||
unmaskchb.on('click', function() { window.unmaskPassword(elementid); });
|
||||
|
||||
// Add label for checkbox to unmaskdiv.
|
||||
var unmasklabel = Y.Node.create('<label for="'+elementid+'unmask">'+checkboxlabel+'</label>');
|
||||
var unmasklabel = Y.Node.create('<label for="' + elementid + 'unmask">' + checkboxlabel + '</label>');
|
||||
unmaskdiv.appendChild(unmasklabel);
|
||||
|
||||
// Insert unmask div in the same div as password input.
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ Y.extend(SHORTFORMS, Y.Base, {
|
||||
* @protected
|
||||
*/
|
||||
initializer: function() {
|
||||
var form = Y.one('#'+this.get('formid')),
|
||||
var form = Y.one('#' + this.get('formid')),
|
||||
fieldlist,
|
||||
btn,
|
||||
link,
|
||||
@@ -154,13 +154,13 @@ Y.extend(SHORTFORMS, Y.Base, {
|
||||
headerlink.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
}
|
||||
var statuselement = this.form.one('input[name=mform_isexpanded_'+fieldset.get('id')+']');
|
||||
var statuselement = this.form.one('input[name=mform_isexpanded_' + fieldset.get('id') + ']');
|
||||
if (!statuselement) {
|
||||
Y.log("M.form.shortforms::switch_state was called on an fieldset without a status field: '" +
|
||||
fieldset.get('id') + "'", 'debug', 'moodle-form-shortforms');
|
||||
return this;
|
||||
}
|
||||
statuselement.set('value', collapsed ? 0: 1);
|
||||
statuselement.set('value', collapsed ? 0 : 1);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ Y.extend(SHOWADVANCED, Y.Base, {
|
||||
* @protected
|
||||
*/
|
||||
initializer: function() {
|
||||
var form = Y.one('#'+this.get('formid')),
|
||||
var form = Y.one('#' + this.get('formid')),
|
||||
fieldlist = form.all(SELECTORS.FIELDSETCONTAINSADVANCED);
|
||||
|
||||
// Look through fieldset divs that contain advanced elements.
|
||||
|
||||
+25
-25
@@ -6,17 +6,17 @@
|
||||
|
||||
var BODY = Y.one(Y.config.doc.body),
|
||||
CSS = {
|
||||
MENUSHOWN : 'action-menu-shown'
|
||||
MENUSHOWN: 'action-menu-shown'
|
||||
},
|
||||
SELECTOR = {
|
||||
CAN_RECEIVE_FOCUS_SELECTOR: 'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]',
|
||||
MENU : '.moodle-actionmenu[data-enhance=moodle-core-actionmenu]',
|
||||
MENU: '.moodle-actionmenu[data-enhance=moodle-core-actionmenu]',
|
||||
MENUBAR: '[role="menubar"]',
|
||||
MENUITEM: '[role="menuitem"]',
|
||||
MENUCONTENT : '.menu[data-rel=menu-content]',
|
||||
MENUCONTENT: '.menu[data-rel=menu-content]',
|
||||
MENUCONTENTCHILD: 'li a',
|
||||
MENUCHILD: '.menu li a',
|
||||
TOGGLE : '.toggle-display',
|
||||
TOGGLE: '.toggle-display',
|
||||
KEEPOPEN: '[data-keepopen="1"]',
|
||||
MENUBARITEMS: [
|
||||
'[role="menubar"] > [role="menuitem"]',
|
||||
@@ -29,10 +29,10 @@ var BODY = Y.one(Y.config.doc.body),
|
||||
},
|
||||
ACTIONMENU,
|
||||
ALIGN = {
|
||||
TL : 'tl',
|
||||
TR : 'tr',
|
||||
BL : 'bl',
|
||||
BR : 'br'
|
||||
TL: 'tl',
|
||||
TR: 'tr',
|
||||
BL: 'bl',
|
||||
BR: 'br'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -56,7 +56,7 @@ ACTIONMENU.prototype = {
|
||||
* @type M.core.dialogue
|
||||
* @protected
|
||||
*/
|
||||
dialogue : null,
|
||||
dialogue: null,
|
||||
|
||||
/**
|
||||
* An array of events attached during the display of the dialogue.
|
||||
@@ -64,7 +64,7 @@ ACTIONMENU.prototype = {
|
||||
* @type Object
|
||||
* @protected
|
||||
*/
|
||||
events : [],
|
||||
events: [],
|
||||
|
||||
/**
|
||||
* The node that owns the currently displayed menu.
|
||||
@@ -73,7 +73,7 @@ ACTIONMENU.prototype = {
|
||||
* @type Node
|
||||
* @default null
|
||||
*/
|
||||
owner : null,
|
||||
owner: null,
|
||||
|
||||
/**
|
||||
* The menu button that toggles this open.
|
||||
@@ -116,7 +116,7 @@ ACTIONMENU.prototype = {
|
||||
*
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
Y.log('Initialising the action menu manager', 'debug', ACTIONMENU.NAME);
|
||||
Y.all(SELECTOR.MENU).each(this.enhance, this);
|
||||
BODY.delegate('key', this.moveMenuItem, 'down:37,39', SELECTOR.MENUBARITEMS.join(','), this);
|
||||
@@ -138,7 +138,7 @@ ACTIONMENU.prototype = {
|
||||
* @param {Node} menu
|
||||
* @return boolean
|
||||
*/
|
||||
enhance : function(menu) {
|
||||
enhance: function(menu) {
|
||||
var menucontent = menu.one(SELECTOR.MENUCONTENT),
|
||||
align;
|
||||
if (!menucontent) {
|
||||
@@ -147,8 +147,8 @@ ACTIONMENU.prototype = {
|
||||
align = menucontent.getData('align') || this.get('align').join('-');
|
||||
menu.one(SELECTOR.TOGGLE).set('aria-haspopup', true);
|
||||
menucontent.set('aria-hidden', true);
|
||||
if (!menucontent.hasClass('align-'+align)) {
|
||||
menucontent.addClass('align-'+align);
|
||||
if (!menucontent.hasClass('align-' + align)) {
|
||||
menucontent.addClass('align-' + align);
|
||||
}
|
||||
if (menucontent.hasChildNodes()) {
|
||||
menu.setAttribute('data-enhanced', '1');
|
||||
@@ -248,7 +248,7 @@ ACTIONMENU.prototype = {
|
||||
* @param {EventFacade} e
|
||||
* @method hideMenu
|
||||
*/
|
||||
hideMenu : function(e) {
|
||||
hideMenu: function(e) {
|
||||
if (this.dialogue) {
|
||||
Y.log('Hiding an action menu', 'debug', ACTIONMENU.NAME);
|
||||
this.dialogue.removeClass('show');
|
||||
@@ -290,7 +290,7 @@ ACTIONMENU.prototype = {
|
||||
* @method toggleMenu
|
||||
* @param {EventFacade} e
|
||||
*/
|
||||
toggleMenu : function(e) {
|
||||
toggleMenu: function(e) {
|
||||
var menu = e.target.ancestor(SELECTOR.MENU),
|
||||
menuvisible = (menu.hasClass('show'));
|
||||
|
||||
@@ -418,7 +418,7 @@ ACTIONMENU.prototype = {
|
||||
* @method hideIfOutside
|
||||
* @param {EventFacade} e
|
||||
*/
|
||||
hideIfOutside : function(e) {
|
||||
hideIfOutside: function(e) {
|
||||
if (!e.target.ancestor(SELECTOR.MENUCONTENT, true)) {
|
||||
this.hideMenu(e);
|
||||
}
|
||||
@@ -432,7 +432,7 @@ ACTIONMENU.prototype = {
|
||||
* @param {Node} menu
|
||||
* @return M.core.dialogue
|
||||
*/
|
||||
showMenu : function(e, menu) {
|
||||
showMenu: function(e, menu) {
|
||||
Y.log('Displaying an action menu', 'debug', ACTIONMENU.NAME);
|
||||
var ownerselector = menu.getData('owner'),
|
||||
menucontent = menu.one(SELECTOR.MENUCONTENT);
|
||||
@@ -450,7 +450,7 @@ ACTIONMENU.prototype = {
|
||||
this.menuChildren = this.dialogue.all(SELECTOR.MENUCHILD);
|
||||
if (this.menuChildren) {
|
||||
this.firstMenuChild = this.menuChildren.item(0);
|
||||
this.lastMenuChild = this.menuChildren.item(this.menuChildren.size() - 1);
|
||||
this.lastMenuChild = this.menuChildren.item(this.menuChildren.size() - 1);
|
||||
|
||||
this.firstMenuChild.focus();
|
||||
}
|
||||
@@ -487,7 +487,7 @@ ACTIONMENU.prototype = {
|
||||
* @method constrain
|
||||
* @param {Node} node
|
||||
*/
|
||||
constrain : function(node) {
|
||||
constrain: function(node) {
|
||||
var selector = node.getData('constraint'),
|
||||
nx = node.getX(),
|
||||
ny = node.getY(),
|
||||
@@ -573,10 +573,10 @@ ACTIONMENU.prototype = {
|
||||
};
|
||||
|
||||
Y.extend(ACTIONMENU, Y.Base, ACTIONMENU.prototype, {
|
||||
NAME : 'moodle-core-actionmenu',
|
||||
ATTRS : {
|
||||
align : {
|
||||
value : [
|
||||
NAME: 'moodle-core-actionmenu',
|
||||
ATTRS: {
|
||||
align: {
|
||||
value: [
|
||||
ALIGN.TR, // The dialogue.
|
||||
ALIGN.BR // The button
|
||||
]
|
||||
|
||||
Vendored
+32
-32
@@ -24,15 +24,15 @@ BLOCKREGION.prototype = {
|
||||
* Called during the initialisation process of the object.
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
var node = this.get('node');
|
||||
Y.log('Block region `'+this.get('region')+'` initialising', 'info');
|
||||
Y.log('Block region `' + this.get('region') + '` initialising', 'info');
|
||||
if (!node) {
|
||||
Y.log('block region known about but no HTML structure found for it. Guessing structure.', 'warn');
|
||||
node = this.create_and_add_node();
|
||||
}
|
||||
var body = Y.one('body'),
|
||||
hasblocks = node.all('.'+CSS.BLOCK).size() > 0,
|
||||
hasblocks = node.all('.' + CSS.BLOCK).size() > 0,
|
||||
hasregionclass = this.get_has_region_class();
|
||||
this.set('hasblocks', hasblocks);
|
||||
if (!body.hasClass(hasregionclass)) {
|
||||
@@ -47,10 +47,10 @@ BLOCKREGION.prototype = {
|
||||
* @method create_and_add_node
|
||||
* @return Node The newly created Node
|
||||
*/
|
||||
create_and_add_node : function() {
|
||||
create_and_add_node: function() {
|
||||
var c = Y.Node.create,
|
||||
region = this.get('region'),
|
||||
node = c('<div id="block-region-'+region+'" data-droptarget="1"></div>')
|
||||
node = c('<div id="block-region-' + region + '" data-droptarget="1"></div>')
|
||||
.addClass(CSS.BLOCKREGION)
|
||||
.setData('blockregion', region),
|
||||
regions = this.get('manager').get('regions'),
|
||||
@@ -71,13 +71,13 @@ BLOCKREGION.prototype = {
|
||||
|
||||
if (haspre !== false && haspost !== false) {
|
||||
if (region === haspre) {
|
||||
post = Y.one('#block-region-'+haspost);
|
||||
post = Y.one('#block-region-' + haspost);
|
||||
if (post) {
|
||||
post.insert(node, 'before');
|
||||
added = true;
|
||||
}
|
||||
} else {
|
||||
pre = Y.one('#block-region-'+haspre);
|
||||
pre = Y.one('#block-region-' + haspre);
|
||||
if (pre) {
|
||||
pre.insert(node, 'after');
|
||||
added = true;
|
||||
@@ -97,9 +97,9 @@ BLOCKREGION.prototype = {
|
||||
* @param M.core.dragdrop the block manager
|
||||
* @method change_block_move_icons
|
||||
*/
|
||||
change_block_move_icons : function(manager) {
|
||||
change_block_move_icons: function(manager) {
|
||||
var handle, icon;
|
||||
this.get('node').all('.'+CSS.BLOCK+' a.'+CSS.EDITINGMOVE).each(function(moveicon){
|
||||
this.get('node').all('.' + CSS.BLOCK + ' a.' + CSS.EDITINGMOVE).each(function(moveicon) {
|
||||
moveicon.setStyle('cursor', 'move');
|
||||
handle = manager.get_drag_handle(moveicon.getAttribute('title'), '', 'icon', true);
|
||||
icon = handle.one('img');
|
||||
@@ -114,8 +114,8 @@ BLOCKREGION.prototype = {
|
||||
* @method get_has_region_class
|
||||
* @return String
|
||||
*/
|
||||
get_has_region_class : function() {
|
||||
return 'has-region-'+this.get('region');
|
||||
get_has_region_class: function() {
|
||||
return 'has-region-' + this.get('region');
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -123,8 +123,8 @@ BLOCKREGION.prototype = {
|
||||
* @method get_empty_region_class
|
||||
* @return String
|
||||
*/
|
||||
get_empty_region_class : function() {
|
||||
return 'empty-region-'+this.get('region');
|
||||
get_empty_region_class: function() {
|
||||
return 'empty-region-' + this.get('region');
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -132,8 +132,8 @@ BLOCKREGION.prototype = {
|
||||
* @method get_used_region_class
|
||||
* @return String
|
||||
*/
|
||||
get_used_region_class : function() {
|
||||
return 'used-region-'+this.get('region');
|
||||
get_used_region_class: function() {
|
||||
return 'used-region-' + this.get('region');
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -141,7 +141,7 @@ BLOCKREGION.prototype = {
|
||||
* @method get_droptarget
|
||||
* @return Node
|
||||
*/
|
||||
get_droptarget : function() {
|
||||
get_droptarget: function() {
|
||||
var node = this.get('node');
|
||||
if (node.test('[data-droptarget="1"]')) {
|
||||
return node;
|
||||
@@ -154,7 +154,7 @@ BLOCKREGION.prototype = {
|
||||
* This is done even if it is empty.
|
||||
* @method enable
|
||||
*/
|
||||
enable : function() {
|
||||
enable: function() {
|
||||
Y.one('body').addClass(this.get_used_region_class()).removeClass(this.get_empty_region_class());
|
||||
},
|
||||
|
||||
@@ -162,15 +162,15 @@ BLOCKREGION.prototype = {
|
||||
* Disables the region if it contains no blocks, essentially hiding it from the user.
|
||||
* @method disable_if_required
|
||||
*/
|
||||
disable_if_required : function() {
|
||||
if (this.get('node').all('.'+CSS.BLOCK).size() === 0) {
|
||||
disable_if_required: function() {
|
||||
if (this.get('node').all('.' + CSS.BLOCK).size() === 0) {
|
||||
Y.one('body').addClass(this.get_empty_region_class()).removeClass(this.get_used_region_class());
|
||||
}
|
||||
}
|
||||
};
|
||||
Y.extend(BLOCKREGION, Y.Base, BLOCKREGION.prototype, {
|
||||
NAME : 'core-blocks-dragdrop-blockregion',
|
||||
ATTRS : {
|
||||
NAME: 'core-blocks-dragdrop-blockregion',
|
||||
ATTRS: {
|
||||
|
||||
/**
|
||||
* The drag and drop manager that created this block region instance.
|
||||
@@ -178,10 +178,10 @@ Y.extend(BLOCKREGION, Y.Base, BLOCKREGION.prototype, {
|
||||
* @type M.core.blockdraganddrop.Manager
|
||||
* @writeOnce
|
||||
*/
|
||||
manager : {
|
||||
manager: {
|
||||
// Can only be set during initialisation and must be set then.
|
||||
writeOnce : 'initOnly',
|
||||
validator : function (value) {
|
||||
writeOnce: 'initOnly',
|
||||
validator: function(value) {
|
||||
return Y.Lang.isObject(value) && value instanceof MANAGER;
|
||||
}
|
||||
},
|
||||
@@ -192,10 +192,10 @@ Y.extend(BLOCKREGION, Y.Base, BLOCKREGION.prototype, {
|
||||
* @type String
|
||||
* @writeOnce
|
||||
*/
|
||||
region : {
|
||||
region: {
|
||||
// Can only be set during initialisation and must be set then.
|
||||
writeOnce : 'initOnly',
|
||||
validator : function (value) {
|
||||
writeOnce: 'initOnly',
|
||||
validator: function(value) {
|
||||
return Y.Lang.isString(value);
|
||||
}
|
||||
},
|
||||
@@ -205,8 +205,8 @@ Y.extend(BLOCKREGION, Y.Base, BLOCKREGION.prototype, {
|
||||
* @attribute region
|
||||
* @type Y.Node
|
||||
*/
|
||||
node : {
|
||||
validator : function (value) {
|
||||
node: {
|
||||
validator: function(value) {
|
||||
return Y.Lang.isObject(value) || Y.Lang.isNull(value);
|
||||
}
|
||||
},
|
||||
@@ -217,9 +217,9 @@ Y.extend(BLOCKREGION, Y.Base, BLOCKREGION.prototype, {
|
||||
* @type Boolean
|
||||
* @default false
|
||||
*/
|
||||
hasblocks : {
|
||||
value : false,
|
||||
validator : function (value) {
|
||||
hasblocks: {
|
||||
value: false,
|
||||
validator: function(value) {
|
||||
return Y.Lang.isBoolean(value);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+73
-73
@@ -8,22 +8,22 @@
|
||||
|
||||
var AJAXURL = '/lib/ajax/blocks.php',
|
||||
CSS = {
|
||||
BLOCK : 'block',
|
||||
BLOCKREGION : 'block-region',
|
||||
BLOCKADMINBLOCK : 'block_adminblock',
|
||||
EDITINGMOVE : 'editing_move',
|
||||
HEADER : 'header',
|
||||
LIGHTBOX : 'lightbox',
|
||||
REGIONCONTENT : 'region-content',
|
||||
SKIPBLOCK : 'skip-block',
|
||||
SKIPBLOCKTO : 'skip-block-to',
|
||||
MYINDEX : 'page-my-index',
|
||||
REGIONMAIN : 'region-main',
|
||||
BLOCKSMOVING : 'blocks-moving'
|
||||
BLOCK: 'block',
|
||||
BLOCKREGION: 'block-region',
|
||||
BLOCKADMINBLOCK: 'block_adminblock',
|
||||
EDITINGMOVE: 'editing_move',
|
||||
HEADER: 'header',
|
||||
LIGHTBOX: 'lightbox',
|
||||
REGIONCONTENT: 'region-content',
|
||||
SKIPBLOCK: 'skip-block',
|
||||
SKIPBLOCKTO: 'skip-block-to',
|
||||
MYINDEX: 'page-my-index',
|
||||
REGIONMAIN: 'region-main',
|
||||
BLOCKSMOVING: 'blocks-moving'
|
||||
};
|
||||
|
||||
var SELECTOR = {
|
||||
DRAGHANDLE : '.' + CSS.HEADER + ' .commands .moodle-core-dragdrop-draghandle'
|
||||
DRAGHANDLE: '.' + CSS.HEADER + ' .commands .moodle-core-dragdrop-draghandle'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -40,17 +40,17 @@ var DRAGBLOCK = function() {
|
||||
DRAGBLOCK.superclass.constructor.apply(this, arguments);
|
||||
};
|
||||
Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
skipnodetop : null,
|
||||
skipnodebottom : null,
|
||||
dragsourceregion : null,
|
||||
initializer : function() {
|
||||
skipnodetop: null,
|
||||
skipnodebottom: null,
|
||||
dragsourceregion: null,
|
||||
initializer: function() {
|
||||
// Set group for parent class
|
||||
this.groups = ['block'];
|
||||
this.samenodeclass = CSS.BLOCK;
|
||||
this.parentnodeclass = CSS.REGIONCONTENT;
|
||||
|
||||
// Add relevant classes and ID to 'content' block region on Dashboard page.
|
||||
var myhomecontent = Y.Node.all('body#'+CSS.MYINDEX+' #'+CSS.REGIONMAIN+' > .'+CSS.REGIONCONTENT);
|
||||
var myhomecontent = Y.Node.all('body#' + CSS.MYINDEX + ' #' + CSS.REGIONMAIN + ' > .' + CSS.REGIONCONTENT);
|
||||
if (myhomecontent.size() > 0) {
|
||||
var contentregion = myhomecontent.item(0);
|
||||
contentregion.addClass(CSS.BLOCKREGION);
|
||||
@@ -60,7 +60,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
|
||||
// Initialise blocks dragging
|
||||
// Find all block regions on the page
|
||||
var blockregionlist = Y.Node.all('div.'+CSS.BLOCKREGION);
|
||||
var blockregionlist = Y.Node.all('div.' + CSS.BLOCKREGION);
|
||||
|
||||
if (blockregionlist.size() === 0) {
|
||||
return false;
|
||||
@@ -79,12 +79,12 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
|
||||
if (pre.size() === 0 && post.size() === 1) {
|
||||
// pre block is missing, instert it before post
|
||||
blockregion.setAttrs({id : 'region-pre'});
|
||||
blockregion.setAttrs({id: 'region-pre'});
|
||||
post.item(0).insert(blockregion, 'before');
|
||||
blockregionlist.unshift(blockregion);
|
||||
} else if (post.size() === 0 && pre.size() === 1) {
|
||||
// post block is missing, instert it after pre
|
||||
blockregion.setAttrs({id : 'region-post'});
|
||||
blockregion.setAttrs({id: 'region-post'});
|
||||
pre.item(0).insert(blockregion, 'after');
|
||||
blockregionlist.push(blockregion);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
// The region-post (the right one)
|
||||
// is very narrow, so add extra padding on the left to drop block on it.
|
||||
new Y.DD.Drop({
|
||||
node: blockregionnode.one('div.'+CSS.REGIONCONTENT),
|
||||
node: blockregionnode.one('div.' + CSS.REGIONCONTENT),
|
||||
groups: this.groups,
|
||||
padding: '40 240 40 240'
|
||||
});
|
||||
@@ -104,7 +104,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
// Make each div element in the list of blocks draggable
|
||||
var del = new Y.DD.Delegate({
|
||||
container: blockregionnode,
|
||||
nodes: '.'+CSS.BLOCK,
|
||||
nodes: '.' + CSS.BLOCK,
|
||||
target: true,
|
||||
handles: [SELECTOR.DRAGHANDLE],
|
||||
invalid: '.block-hider-hide, .block-hider-show, .moveto',
|
||||
@@ -116,9 +116,9 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
});
|
||||
del.dd.plug(Y.Plugin.DDWinScroll);
|
||||
|
||||
var blocklist = blockregionnode.all('.'+CSS.BLOCK);
|
||||
var blocklist = blockregionnode.all('.' + CSS.BLOCK);
|
||||
blocklist.each(function(blocknode) {
|
||||
var move = blocknode.one('a.'+CSS.EDITINGMOVE);
|
||||
var move = blocknode.one('a.' + CSS.EDITINGMOVE);
|
||||
if (move) {
|
||||
move.replace(this.get_drag_handle(move.getAttribute('title'), '', 'iconsmall', true));
|
||||
blocknode.one(SELECTOR.DRAGHANDLE).setStyle('cursor', 'move');
|
||||
@@ -127,12 +127,12 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
}, this);
|
||||
},
|
||||
|
||||
get_block_id : function(node) {
|
||||
get_block_id: function(node) {
|
||||
return Number(node.get('id').replace(/inst/i, ''));
|
||||
},
|
||||
|
||||
get_block_region : function(node) {
|
||||
var region = node.ancestor('div.'+CSS.BLOCKREGION).get('id').replace(/region-/i, '');
|
||||
get_block_region: function(node) {
|
||||
var region = node.ancestor('div.' + CSS.BLOCKREGION).get('id').replace(/region-/i, '');
|
||||
if (Y.Array.indexOf(this.get('regions'), region) === -1) {
|
||||
// Must be standard side-X
|
||||
if (window.right_to_left()) {
|
||||
@@ -148,17 +148,17 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
return region;
|
||||
},
|
||||
|
||||
get_region_id : function(node) {
|
||||
get_region_id: function(node) {
|
||||
return node.get('id').replace(/region-/i, '');
|
||||
},
|
||||
|
||||
drag_start : function(e) {
|
||||
drag_start: function(e) {
|
||||
// Get our drag object
|
||||
var drag = e.target;
|
||||
|
||||
// Store the parent node of original drag node (block)
|
||||
// we will need it later for show/hide empty regions
|
||||
this.dragsourceregion = drag.get('node').ancestor('div.'+CSS.BLOCKREGION);
|
||||
this.dragsourceregion = drag.get('node').ancestor('div.' + CSS.BLOCKREGION);
|
||||
|
||||
// Determine skipnodes and store them
|
||||
if (drag.get('node').previous() && drag.get('node').previous().hasClass(CSS.SKIPBLOCK)) {
|
||||
@@ -172,7 +172,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
Y.one('body').addClass(CSS.BLOCKSMOVING);
|
||||
},
|
||||
|
||||
drop_over : function(e) {
|
||||
drop_over: function(e) {
|
||||
// Get a reference to our drag and drop nodes
|
||||
var drag = e.drag.get('node');
|
||||
var drop = e.drop.get('node');
|
||||
@@ -180,8 +180,8 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
// We need to fix the case when parent drop over event has determined
|
||||
// 'goingup' and appended the drag node after admin-block.
|
||||
if (drop.hasClass(this.parentnodeclass) &&
|
||||
drop.one('.'+CSS.BLOCKADMINBLOCK) &&
|
||||
drop.one('.'+CSS.BLOCKADMINBLOCK).next('.'+CSS.BLOCK)) {
|
||||
drop.one('.' + CSS.BLOCKADMINBLOCK) &&
|
||||
drop.one('.' + CSS.BLOCKADMINBLOCK).next('.' + CSS.BLOCK)) {
|
||||
drop.prepend(drag);
|
||||
}
|
||||
|
||||
@@ -202,22 +202,22 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
var documentbody = Y.one('body');
|
||||
// Moving block towards hidden region-content, display it
|
||||
var regionname = this.get_region_id(this.dragsourceregion);
|
||||
if (documentbody.hasClass('side-'+regionname+'-only')) {
|
||||
documentbody.removeClass('side-'+regionname+'-only');
|
||||
if (documentbody.hasClass('side-' + regionname + '-only')) {
|
||||
documentbody.removeClass('side-' + regionname + '-only');
|
||||
}
|
||||
|
||||
// Moving from empty region-content towards the opposite one,
|
||||
// hide empty one (only for region-pre, region-post areas at the moment).
|
||||
regionname = this.get_region_id(drop.ancestor('div.'+CSS.BLOCKREGION));
|
||||
if (this.dragsourceregion.all('.'+CSS.BLOCK).size() === 0 &&
|
||||
regionname = this.get_region_id(drop.ancestor('div.' + CSS.BLOCKREGION));
|
||||
if (this.dragsourceregion.all('.' + CSS.BLOCK).size() === 0 &&
|
||||
this.dragsourceregion.get('id').match(/(region-pre|region-post)/i)) {
|
||||
if (!documentbody.hasClass('side-'+regionname+'-only')) {
|
||||
documentbody.addClass('side-'+regionname+'-only');
|
||||
if (!documentbody.hasClass('side-' + regionname + '-only')) {
|
||||
documentbody.addClass('side-' + regionname + '-only');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
drag_end : function() {
|
||||
drag_end: function() {
|
||||
// clear variables
|
||||
this.skipnodetop = null;
|
||||
this.skipnodebottom = null;
|
||||
@@ -226,14 +226,14 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
Y.one('body').removeClass(CSS.BLOCKSMOVING);
|
||||
},
|
||||
|
||||
drag_dropmiss : function(e) {
|
||||
drag_dropmiss: function(e) {
|
||||
// Missed the target, but we assume the user intended to drop it
|
||||
// on the last last ghost node location, e.drag and e.drop should be
|
||||
// prepared by global_drag_dropmiss parent so simulate drop_hit(e).
|
||||
this.drop_hit(e);
|
||||
},
|
||||
|
||||
drop_hit : function(e) {
|
||||
drop_hit: function(e) {
|
||||
var drag = e.drag;
|
||||
// Get a reference to our drag node
|
||||
var dragnode = drag.get('node');
|
||||
@@ -257,31 +257,31 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
|
||||
// Prepare request parameters
|
||||
var params = {
|
||||
sesskey : M.cfg.sesskey,
|
||||
courseid : this.get('courseid'),
|
||||
pagelayout : this.get('pagelayout'),
|
||||
pagetype : this.get('pagetype'),
|
||||
subpage : this.get('subpage'),
|
||||
contextid : this.get('contextid'),
|
||||
action : 'move',
|
||||
bui_moveid : this.get_block_id(dragnode),
|
||||
bui_newregion : this.get_block_region(dropnode)
|
||||
sesskey: M.cfg.sesskey,
|
||||
courseid: this.get('courseid'),
|
||||
pagelayout: this.get('pagelayout'),
|
||||
pagetype: this.get('pagetype'),
|
||||
subpage: this.get('subpage'),
|
||||
contextid: this.get('contextid'),
|
||||
action: 'move',
|
||||
bui_moveid: this.get_block_id(dragnode),
|
||||
bui_newregion: this.get_block_region(dropnode)
|
||||
};
|
||||
|
||||
if (this.get('cmid')) {
|
||||
params.cmid = this.get('cmid');
|
||||
}
|
||||
|
||||
if (dragnode.next('.'+this.samenodeclass) && !dragnode.next('.'+this.samenodeclass).hasClass(CSS.BLOCKADMINBLOCK)) {
|
||||
params.bui_beforeid = this.get_block_id(dragnode.next('.'+this.samenodeclass));
|
||||
if (dragnode.next('.' + this.samenodeclass) && !dragnode.next('.' + this.samenodeclass).hasClass(CSS.BLOCKADMINBLOCK)) {
|
||||
params.bui_beforeid = this.get_block_id(dragnode.next('.' + this.samenodeclass));
|
||||
}
|
||||
|
||||
// Do AJAX request
|
||||
Y.io(M.cfg.wwwroot+AJAXURL, {
|
||||
Y.io(M.cfg.wwwroot + AJAXURL, {
|
||||
method: 'POST',
|
||||
data: params,
|
||||
on: {
|
||||
start : function() {
|
||||
start: function() {
|
||||
lightbox.show();
|
||||
},
|
||||
success: function(tid, response) {
|
||||
@@ -300,32 +300,32 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
|
||||
lightbox.hide();
|
||||
}
|
||||
},
|
||||
context:this
|
||||
context: this
|
||||
});
|
||||
}
|
||||
}, {
|
||||
NAME : 'core-blocks-dragdrop',
|
||||
ATTRS : {
|
||||
courseid : {
|
||||
value : null
|
||||
NAME: 'core-blocks-dragdrop',
|
||||
ATTRS: {
|
||||
courseid: {
|
||||
value: null
|
||||
},
|
||||
cmid : {
|
||||
value : null
|
||||
cmid: {
|
||||
value: null
|
||||
},
|
||||
contextid : {
|
||||
value : null
|
||||
contextid: {
|
||||
value: null
|
||||
},
|
||||
pagelayout : {
|
||||
value : null
|
||||
pagelayout: {
|
||||
value: null
|
||||
},
|
||||
pagetype : {
|
||||
value : null
|
||||
pagetype: {
|
||||
value: null
|
||||
},
|
||||
subpage : {
|
||||
value : null
|
||||
subpage: {
|
||||
value: null
|
||||
},
|
||||
regions : {
|
||||
value : null
|
||||
regions: {
|
||||
value: null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+52
-52
@@ -29,7 +29,7 @@ MANAGER.prototype = {
|
||||
* @type Node
|
||||
* @default null
|
||||
*/
|
||||
skipnodetop : null,
|
||||
skipnodetop: null,
|
||||
|
||||
/**
|
||||
* The skip block link from below the block being dragged while a drag is in progress.
|
||||
@@ -39,7 +39,7 @@ MANAGER.prototype = {
|
||||
* @type Node
|
||||
* @default null
|
||||
*/
|
||||
skipnodebottom : null,
|
||||
skipnodebottom: null,
|
||||
|
||||
/**
|
||||
* An associative object of regions and the
|
||||
@@ -48,13 +48,13 @@ MANAGER.prototype = {
|
||||
* @type {BLOCKREGION} [regionname]* Each item uses the region name as the key with the value being
|
||||
* an instance of the BLOCKREGION class.
|
||||
*/
|
||||
regionobjects : {},
|
||||
regionobjects: {},
|
||||
|
||||
/**
|
||||
* Called during the initialisation process of the object.
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
Y.log('Initialising drag and drop for blocks.', 'info');
|
||||
var regionnames = this.get('regions'),
|
||||
i = 0,
|
||||
@@ -68,7 +68,7 @@ MANAGER.prototype = {
|
||||
this.parentnodeclass = CSS.BLOCKREGION;
|
||||
|
||||
// Add relevant classes and ID to 'content' block region on Dashboard page.
|
||||
var myhomecontent = Y.Node.all('body#'+CSS.MYINDEX+' #'+CSS.REGIONMAIN+' > .'+CSS.REGIONCONTENT);
|
||||
var myhomecontent = Y.Node.all('body#' + CSS.MYINDEX + ' #' + CSS.REGIONMAIN + ' > .' + CSS.REGIONCONTENT);
|
||||
if (myhomecontent.size() > 0) {
|
||||
var contentregion = myhomecontent.item(0);
|
||||
contentregion.addClass(CSS.BLOCKREGION);
|
||||
@@ -79,9 +79,9 @@ MANAGER.prototype = {
|
||||
for (i in regionnames) {
|
||||
regionname = regionnames[i];
|
||||
region = new BLOCKREGION({
|
||||
manager : this,
|
||||
region : regionname,
|
||||
node : Y.one('#block-region-'+regionname)
|
||||
manager: this,
|
||||
region: regionname,
|
||||
node: Y.one('#block-region-' + regionname)
|
||||
});
|
||||
this.regionobjects[regionname] = region;
|
||||
|
||||
@@ -97,7 +97,7 @@ MANAGER.prototype = {
|
||||
// Make each div element in the list of blocks draggable
|
||||
dragdelegation = new Y.DD.Delegate({
|
||||
container: region.get_droptarget(),
|
||||
nodes: '.'+CSS.BLOCK,
|
||||
nodes: '.' + CSS.BLOCK,
|
||||
target: true,
|
||||
handles: [SELECTOR.DRAGHANDLE],
|
||||
invalid: '.block-hider-hide, .block-hider-show, .moveto, .block_fake',
|
||||
@@ -124,7 +124,7 @@ MANAGER.prototype = {
|
||||
* @param {Node} node
|
||||
* @return {int} The blocks ID in the database.
|
||||
*/
|
||||
get_block_id : function(node) {
|
||||
get_block_id: function(node) {
|
||||
return Number(node.get('id').replace(/inst/i, ''));
|
||||
},
|
||||
|
||||
@@ -134,7 +134,7 @@ MANAGER.prototype = {
|
||||
* @param {Y.Node} node
|
||||
* @return {string} The region name.
|
||||
*/
|
||||
get_block_region : function(node) {
|
||||
get_block_region: function(node) {
|
||||
if (!node.test('[data-blockregion]')) {
|
||||
node = node.ancestor('[data-blockregion]');
|
||||
}
|
||||
@@ -147,7 +147,7 @@ MANAGER.prototype = {
|
||||
* @param {Y.Node} node
|
||||
* @return {BLOCKREGION}
|
||||
*/
|
||||
get_region_object : function(node) {
|
||||
get_region_object: function(node) {
|
||||
return this.regionobjects[this.get_block_region(node)];
|
||||
},
|
||||
|
||||
@@ -156,7 +156,7 @@ MANAGER.prototype = {
|
||||
*
|
||||
* @method enable_all_regions
|
||||
*/
|
||||
enable_all_regions : function() {
|
||||
enable_all_regions: function() {
|
||||
var groups = Y.DD.DDM.activeDrag.get('groups');
|
||||
|
||||
// As we're called by Y.DD.DDM, we can't be certain that the call
|
||||
@@ -179,7 +179,7 @@ MANAGER.prototype = {
|
||||
* Disables enabled regions if they contain no blocks.
|
||||
* @method disable_regions_if_required
|
||||
*/
|
||||
disable_regions_if_required : function() {
|
||||
disable_regions_if_required: function() {
|
||||
var i = 0;
|
||||
for (i in this.regionobjects) {
|
||||
this.regionobjects[i].disable_if_required();
|
||||
@@ -191,7 +191,7 @@ MANAGER.prototype = {
|
||||
* @method drag_start
|
||||
* @param {Event} e
|
||||
*/
|
||||
drag_start : function(e) {
|
||||
drag_start: function(e) {
|
||||
// Get our drag object
|
||||
var drag = e.target;
|
||||
|
||||
@@ -212,7 +212,7 @@ MANAGER.prototype = {
|
||||
* @method drop_over
|
||||
* @param {Event} e
|
||||
*/
|
||||
drop_over : function(e) {
|
||||
drop_over: function(e) {
|
||||
// Get a reference to our drag and drop nodes
|
||||
var drag = e.drag.get('node');
|
||||
var drop = e.drop.get('node');
|
||||
@@ -220,8 +220,8 @@ MANAGER.prototype = {
|
||||
// We need to fix the case when parent drop over event has determined
|
||||
// 'goingup' and appended the drag node after admin-block.
|
||||
if (drop.hasClass(CSS.REGIONCONTENT) &&
|
||||
drop.one('.'+CSS.BLOCKADMINBLOCK) &&
|
||||
drop.one('.'+CSS.BLOCKADMINBLOCK).next('.'+CSS.BLOCK)) {
|
||||
drop.one('.' + CSS.BLOCKADMINBLOCK) &&
|
||||
drop.one('.' + CSS.BLOCKADMINBLOCK).next('.' + CSS.BLOCK)) {
|
||||
drop.prepend(drag);
|
||||
}
|
||||
},
|
||||
@@ -230,7 +230,7 @@ MANAGER.prototype = {
|
||||
* Called by M.core.dragdrop.global_drop_end when a drop has been completed.
|
||||
* @method drop_end
|
||||
*/
|
||||
drop_end : function() {
|
||||
drop_end: function() {
|
||||
// Clear variables.
|
||||
this.skipnodetop = null;
|
||||
this.skipnodebottom = null;
|
||||
@@ -244,7 +244,7 @@ MANAGER.prototype = {
|
||||
* @method drag_dropmiss
|
||||
* @param {Event} e
|
||||
*/
|
||||
drag_dropmiss : function(e) {
|
||||
drag_dropmiss: function(e) {
|
||||
// Missed the target, but we assume the user intended to drop it
|
||||
// on the last ghost node location, e.drag and e.drop should be
|
||||
// prepared by global_drag_dropmiss parent so simulate drop_hit(e).
|
||||
@@ -256,7 +256,7 @@ MANAGER.prototype = {
|
||||
* @method drop_hit
|
||||
* @param {Event} e
|
||||
*/
|
||||
drop_hit : function(e) {
|
||||
drop_hit: function(e) {
|
||||
// Get a reference to our drag node
|
||||
var dragnode = e.drag.get('node');
|
||||
var dropnode = e.drop.get('node');
|
||||
@@ -279,31 +279,31 @@ MANAGER.prototype = {
|
||||
|
||||
// Prepare request parameters
|
||||
var params = {
|
||||
sesskey : M.cfg.sesskey,
|
||||
courseid : this.get('courseid'),
|
||||
pagelayout : this.get('pagelayout'),
|
||||
pagetype : this.get('pagetype'),
|
||||
subpage : this.get('subpage'),
|
||||
contextid : this.get('contextid'),
|
||||
action : 'move',
|
||||
bui_moveid : this.get_block_id(dragnode),
|
||||
bui_newregion : this.get_block_region(dropnode)
|
||||
sesskey: M.cfg.sesskey,
|
||||
courseid: this.get('courseid'),
|
||||
pagelayout: this.get('pagelayout'),
|
||||
pagetype: this.get('pagetype'),
|
||||
subpage: this.get('subpage'),
|
||||
contextid: this.get('contextid'),
|
||||
action: 'move',
|
||||
bui_moveid: this.get_block_id(dragnode),
|
||||
bui_newregion: this.get_block_region(dropnode)
|
||||
};
|
||||
|
||||
if (this.get('cmid')) {
|
||||
params.cmid = this.get('cmid');
|
||||
}
|
||||
|
||||
if (dragnode.next('.'+CSS.BLOCK) && !dragnode.next('.'+CSS.BLOCK).hasClass(CSS.BLOCKADMINBLOCK)) {
|
||||
params.bui_beforeid = this.get_block_id(dragnode.next('.'+CSS.BLOCK));
|
||||
if (dragnode.next('.' + CSS.BLOCK) && !dragnode.next('.' + CSS.BLOCK).hasClass(CSS.BLOCKADMINBLOCK)) {
|
||||
params.bui_beforeid = this.get_block_id(dragnode.next('.' + CSS.BLOCK));
|
||||
}
|
||||
|
||||
// Do AJAX request
|
||||
Y.io(M.cfg.wwwroot+AJAXURL, {
|
||||
Y.io(M.cfg.wwwroot + AJAXURL, {
|
||||
method: 'POST',
|
||||
data: params,
|
||||
on: {
|
||||
start : function() {
|
||||
start: function() {
|
||||
lightbox.show();
|
||||
},
|
||||
success: function(tid, response) {
|
||||
@@ -321,25 +321,25 @@ MANAGER.prototype = {
|
||||
this.ajax_failure(response);
|
||||
lightbox.hide();
|
||||
},
|
||||
complete : function() {
|
||||
complete: function() {
|
||||
this.disable_regions_if_required();
|
||||
}
|
||||
},
|
||||
context:this
|
||||
context: this
|
||||
});
|
||||
}
|
||||
};
|
||||
Y.extend(MANAGER, M.core.dragdrop, MANAGER.prototype, {
|
||||
NAME : 'core-blocks-dragdrop-manager',
|
||||
ATTRS : {
|
||||
NAME: 'core-blocks-dragdrop-manager',
|
||||
ATTRS: {
|
||||
/**
|
||||
* The Course ID if there is one.
|
||||
* @attribute courseid
|
||||
* @type int|null
|
||||
* @default null
|
||||
*/
|
||||
courseid : {
|
||||
value : null
|
||||
courseid: {
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -348,8 +348,8 @@ Y.extend(MANAGER, M.core.dragdrop, MANAGER.prototype, {
|
||||
* @type int|null
|
||||
* @default null
|
||||
*/
|
||||
cmid : {
|
||||
value : null
|
||||
cmid: {
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -358,8 +358,8 @@ Y.extend(MANAGER, M.core.dragdrop, MANAGER.prototype, {
|
||||
* @type int|null
|
||||
* @default null
|
||||
*/
|
||||
contextid : {
|
||||
value : null
|
||||
contextid: {
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -368,8 +368,8 @@ Y.extend(MANAGER, M.core.dragdrop, MANAGER.prototype, {
|
||||
* @type string|null
|
||||
* @default null
|
||||
*/
|
||||
pagelayout : {
|
||||
value : null
|
||||
pagelayout: {
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -378,8 +378,8 @@ Y.extend(MANAGER, M.core.dragdrop, MANAGER.prototype, {
|
||||
* @type string|null
|
||||
* @default null
|
||||
*/
|
||||
pagetype : {
|
||||
value : null
|
||||
pagetype: {
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -388,8 +388,8 @@ Y.extend(MANAGER, M.core.dragdrop, MANAGER.prototype, {
|
||||
* @type string|null
|
||||
* @default null
|
||||
*/
|
||||
subpage : {
|
||||
value : null
|
||||
subpage: {
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -398,8 +398,8 @@ Y.extend(MANAGER, M.core.dragdrop, MANAGER.prototype, {
|
||||
* @type array|null
|
||||
* @default Array[]
|
||||
*/
|
||||
regions : {
|
||||
value : []
|
||||
regions: {
|
||||
value: []
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+35
-35
@@ -19,28 +19,28 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
panel: null,
|
||||
|
||||
// The submit button - we disable this until an element is set
|
||||
submitbutton : null,
|
||||
submitbutton: null,
|
||||
|
||||
// The chooserdialogue container
|
||||
container : null,
|
||||
container: null,
|
||||
|
||||
// Any event listeners we may need to cancel later
|
||||
listenevents : [],
|
||||
listenevents: [],
|
||||
|
||||
bodycontent : null,
|
||||
headercontent : null,
|
||||
instanceconfig : null,
|
||||
bodycontent: null,
|
||||
headercontent: null,
|
||||
instanceconfig: null,
|
||||
|
||||
// The hidden field storing the disabled element values for submission.
|
||||
hiddenRadioValue: null,
|
||||
|
||||
setup_chooser_dialogue : function(bodycontent, headercontent, config) {
|
||||
setup_chooser_dialogue: function(bodycontent, headercontent, config) {
|
||||
this.bodycontent = bodycontent;
|
||||
this.headercontent = headercontent;
|
||||
this.instanceconfig = config;
|
||||
},
|
||||
|
||||
prepare_chooser : function () {
|
||||
prepare_chooser: function() {
|
||||
if (this.panel) {
|
||||
return;
|
||||
}
|
||||
@@ -51,17 +51,17 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
// Set Default options
|
||||
var paramkey,
|
||||
params = {
|
||||
bodyContent : this.bodycontent.get('innerHTML'),
|
||||
headerContent : this.headercontent.get('innerHTML'),
|
||||
width : '540px',
|
||||
draggable : true,
|
||||
visible : false, // Hide by default
|
||||
zindex : 100, // Display in front of other items
|
||||
bodyContent: this.bodycontent.get('innerHTML'),
|
||||
headerContent: this.headercontent.get('innerHTML'),
|
||||
width: '540px',
|
||||
draggable: true,
|
||||
visible: false, // Hide by default
|
||||
zindex: 100, // Display in front of other items
|
||||
modal: true, // This dialogue should be modal.
|
||||
shim : true,
|
||||
closeButtonTitle : this.get('closeButtonTitle'),
|
||||
shim: true,
|
||||
closeButtonTitle: this.get('closeButtonTitle'),
|
||||
focusOnPreviousTargetAfterHide: true,
|
||||
render : false,
|
||||
render: false,
|
||||
extraClasses: this._getClassNames()
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
* @method display_chooser
|
||||
* @param {EventFacade} e Triggering Event
|
||||
*/
|
||||
display_chooser : function (e) {
|
||||
display_chooser: function(e) {
|
||||
var bb, dialogue, thisevent;
|
||||
this.prepare_chooser();
|
||||
|
||||
@@ -190,7 +190,7 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
*
|
||||
* @method cancel_listenevents
|
||||
*/
|
||||
cancel_listenevents : function () {
|
||||
cancel_listenevents: function() {
|
||||
// Detach all listen events to prevent duplicate triggers
|
||||
var thisevent;
|
||||
while (this.listenevents.length) {
|
||||
@@ -208,7 +208,7 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
* @method center_dialogue
|
||||
* @param Node {dialogue} Y.Node The dialogue
|
||||
*/
|
||||
center_dialogue : function(dialogue) {
|
||||
center_dialogue: function(dialogue) {
|
||||
var bb = this.panel.get('boundingBox'),
|
||||
winheight = bb.get('winHeight'),
|
||||
newheight, totalheight;
|
||||
@@ -265,19 +265,19 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
this.panel.centerDialogue();
|
||||
},
|
||||
|
||||
handle_key_press : function(e) {
|
||||
handle_key_press: function(e) {
|
||||
if (e.keyCode === 27) {
|
||||
this.cancel_popup(e);
|
||||
}
|
||||
},
|
||||
|
||||
cancel_popup : function (e) {
|
||||
cancel_popup: function(e) {
|
||||
// Prevent normal form submission before hiding
|
||||
e.preventDefault();
|
||||
this.hide();
|
||||
},
|
||||
|
||||
hide : function() {
|
||||
hide: function() {
|
||||
// Cancel all listen events
|
||||
this.cancel_listenevents();
|
||||
|
||||
@@ -285,7 +285,7 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
this.panel.hide();
|
||||
},
|
||||
|
||||
check_options : function() {
|
||||
check_options: function() {
|
||||
// Check which options are set, and change the parent class
|
||||
// to show/hide help as required
|
||||
this.options.each(function(thisoption) {
|
||||
@@ -307,7 +307,7 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
}, this);
|
||||
},
|
||||
|
||||
option_selected : function(e) {
|
||||
option_selected: function(e) {
|
||||
// Set a hidden input field with the value and name of the radio button. When we submit the form, we
|
||||
// disable the radios to prevent duplicate submission. This has the result however that the value is never
|
||||
// submitted so we set this value to a hidden field instead
|
||||
@@ -350,8 +350,8 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
}
|
||||
},
|
||||
{
|
||||
NAME : 'moodle-core-chooserdialogue',
|
||||
ATTRS : {
|
||||
NAME: 'moodle-core-chooserdialogue',
|
||||
ATTRS: {
|
||||
/**
|
||||
* The minimum height (in pixels) before resizing is prevented and scroll
|
||||
* locking disabled.
|
||||
@@ -360,8 +360,8 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
* @type Number
|
||||
* @default 300
|
||||
*/
|
||||
minheight : {
|
||||
value : 300
|
||||
minheight: {
|
||||
value: 300
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -372,7 +372,7 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
* @default 400
|
||||
*/
|
||||
baseheight: {
|
||||
value : 400
|
||||
value: 400
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -382,8 +382,8 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
* @type Number
|
||||
* @default 300
|
||||
*/
|
||||
maxheight : {
|
||||
value : 660
|
||||
maxheight: {
|
||||
value: 660
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -393,9 +393,9 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
* @type String
|
||||
* @default 'Close'
|
||||
*/
|
||||
closeButtonTitle : {
|
||||
validator : Y.Lang.isString,
|
||||
value : 'Close'
|
||||
closeButtonTitle: {
|
||||
validator: Y.Lang.isString,
|
||||
value: 'Close'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+11
-11
@@ -32,10 +32,10 @@ Y.Event.define("dock:actionkey", {
|
||||
* @property _keys
|
||||
*/
|
||||
_keys: {
|
||||
//arrows
|
||||
// arrows
|
||||
'37': 'collapse',
|
||||
'39': 'expand',
|
||||
//(@todo: lrt/rtl/M.core_dock.cfg.orientation decision to assign arrow to meanings)
|
||||
// (@todo: lrt/rtl/M.core_dock.cfg.orientation decision to assign arrow to meanings)
|
||||
'32': 'toggle',
|
||||
'13': 'enter'
|
||||
},
|
||||
@@ -47,7 +47,7 @@ Y.Event.define("dock:actionkey", {
|
||||
* @param {SyntheticEvent.Notifier} notifier The notifier used to trigger the execution of subscribers
|
||||
* @param {Object} args
|
||||
*/
|
||||
_keyHandler: function (e, notifier, args) {
|
||||
_keyHandler: function(e, notifier, args) {
|
||||
var actObj;
|
||||
if (!args.actions) {
|
||||
actObj = {collapse: true, expand: true, toggle: true, enter: true};
|
||||
@@ -67,10 +67,10 @@ Y.Event.define("dock:actionkey", {
|
||||
* @param {Subscription} sub The object tracking this subscription.
|
||||
* @param {SyntheticEvent.Notifier} notifier The notifier used to trigger the execution of subscribers
|
||||
*/
|
||||
on: function (node, sub, notifier) {
|
||||
on: function(node, sub, notifier) {
|
||||
// subscribe to _event and ask keyHandler to handle with given args[0] (the desired actions).
|
||||
if (sub.args === null) {
|
||||
//no actions given
|
||||
// no actions given
|
||||
sub._detacher = node.on(this._event, this._keyHandler, this, notifier, {actions: false});
|
||||
} else {
|
||||
sub._detacher = node.on(this._event, this._keyHandler, this, notifier, sub.args[0]);
|
||||
@@ -84,8 +84,8 @@ Y.Event.define("dock:actionkey", {
|
||||
* @param {Subscription} sub The object tracking this subscription.
|
||||
* @param {SyntheticEvent.Notifier} notifier The notifier used to trigger the execution of subscribers
|
||||
*/
|
||||
detach: function (node, sub) {
|
||||
//detach our _detacher handle of the subscription made in on()
|
||||
detach: function(node, sub) {
|
||||
// detach our _detacher handle of the subscription made in on()
|
||||
sub._detacher.detach();
|
||||
},
|
||||
|
||||
@@ -97,11 +97,11 @@ Y.Event.define("dock:actionkey", {
|
||||
* @param {SyntheticEvent.Notifier} notifier The notifier used to trigger the execution of subscribers
|
||||
* @param {String|function} filter Selector string or function that accpets an event object and returns null.
|
||||
*/
|
||||
delegate: function (node, sub, notifier, filter) {
|
||||
delegate: function(node, sub, notifier, filter) {
|
||||
// subscribe to _event and ask keyHandler to handle with given args[0] (the desired actions).
|
||||
if (sub.args === null) {
|
||||
//no actions given
|
||||
sub._delegateDetacher = node.delegate(this._event, this._keyHandler, filter, this, notifier, {actions:false});
|
||||
// no actions given
|
||||
sub._delegateDetacher = node.delegate(this._event, this._keyHandler, filter, this, notifier, {actions: false});
|
||||
} else {
|
||||
sub._delegateDetacher = node.delegate(this._event, this._keyHandler, filter, this, notifier, sub.args[0]);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ Y.Event.define("dock:actionkey", {
|
||||
* @param {SyntheticEvent.Notifier} notifier The notifier used to trigger the execution of subscribers
|
||||
* @param {String|function} filter Selector string or function that accpets an event object and returns null.
|
||||
*/
|
||||
detachDelegate: function (node, sub) {
|
||||
detachDelegate: function(node, sub) {
|
||||
sub._delegateDetacher.detach();
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+36
-36
@@ -26,46 +26,46 @@ BLOCK.prototype = {
|
||||
* @protected
|
||||
* @type Node
|
||||
*/
|
||||
contentplaceholder : null,
|
||||
contentplaceholder: null,
|
||||
/**
|
||||
* The skip link associated with this block.
|
||||
* @property contentskipanchor
|
||||
* @protected
|
||||
* @type Node
|
||||
*/
|
||||
contentskipanchor : null,
|
||||
contentskipanchor: null,
|
||||
/**
|
||||
* The cached content node for the actual block
|
||||
* @property cachedcontentnode
|
||||
* @protected
|
||||
* @type Node
|
||||
*/
|
||||
cachedcontentnode : null,
|
||||
cachedcontentnode: null,
|
||||
/**
|
||||
* If true the user preference isn't updated
|
||||
* @property skipsetposition
|
||||
* @protected
|
||||
* @type Boolean
|
||||
*/
|
||||
skipsetposition : true,
|
||||
skipsetposition: true,
|
||||
/**
|
||||
* The dock item associated with this block
|
||||
* @property dockitem
|
||||
* @protected
|
||||
* @type DOCKEDITEM
|
||||
*/
|
||||
dockitem : null,
|
||||
dockitem: null,
|
||||
/**
|
||||
* Called during the initialisation process of the object.
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function() {
|
||||
var node = Y.one('#inst'+this.get('id'));
|
||||
initializer: function() {
|
||||
var node = Y.one('#inst' + this.get('id'));
|
||||
if (!node) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Y.log('Initialised block with instance id:'+this.get('id'), 'debug', LOGNS);
|
||||
Y.log('Initialised block with instance id:' + this.get('id'), 'debug', LOGNS);
|
||||
|
||||
M.core.dock.ensureMoveToIconExists(node);
|
||||
|
||||
@@ -84,7 +84,7 @@ BLOCK.prototype = {
|
||||
* @param {Node} node
|
||||
* @return String
|
||||
*/
|
||||
_getBlockClass : function(node) {
|
||||
_getBlockClass: function(node) {
|
||||
var block = node.getData('block'),
|
||||
classes,
|
||||
matches;
|
||||
@@ -104,14 +104,14 @@ BLOCK.prototype = {
|
||||
* @method moveToDock
|
||||
* @param {EventFacade} e
|
||||
*/
|
||||
moveToDock : function(e) {
|
||||
moveToDock: function(e) {
|
||||
if (e) {
|
||||
e.halt(true);
|
||||
}
|
||||
|
||||
var dock = M.core.dock.get(),
|
||||
id = this.get('id'),
|
||||
blockcontent = Y.one('#inst'+id).one('.content'),
|
||||
blockcontent = Y.one('#inst' + id).one('.content'),
|
||||
icon = (window.right_to_left()) ? 't/dock_to_block_rtl' : 't/dock_to_block',
|
||||
breakchar = (location.href.match(/\?/)) ? '&' : '?',
|
||||
blocktitle,
|
||||
@@ -123,7 +123,7 @@ BLOCK.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
Y.log('Moving block to the dock:'+this.get('id'), 'debug', LOGNS);
|
||||
Y.log('Moving block to the dock:' + this.get('id'), 'debug', LOGNS);
|
||||
|
||||
this.recordBlockState();
|
||||
|
||||
@@ -138,32 +138,32 @@ BLOCK.prototype = {
|
||||
blockcommands = Y.Node.create('<div class="commands"></div>');
|
||||
}
|
||||
movetoimg = Y.Node.create('<img />').setAttrs({
|
||||
alt : Y.Escape.html(M.util.get_string('undockitem', 'block')),
|
||||
title : Y.Escape.html(M.util.get_string('undockblock', 'block', blocktitle.get('innerHTML'))),
|
||||
src : M.util.image_url(icon, 'moodle')
|
||||
alt: Y.Escape.html(M.util.get_string('undockitem', 'block')),
|
||||
title: Y.Escape.html(M.util.get_string('undockblock', 'block', blocktitle.get('innerHTML'))),
|
||||
src: M.util.image_url(icon, 'moodle')
|
||||
});
|
||||
moveto = Y.Node.create('<a class="moveto customcommand requiresjs"></a>').setAttrs({
|
||||
href : Y.config.win.location.href + breakchar + 'dock='+id
|
||||
href: Y.config.win.location.href + breakchar + 'dock=' + id
|
||||
});
|
||||
moveto.append(movetoimg);
|
||||
blockcommands.append(moveto.append(movetoimg));
|
||||
|
||||
// Create a new dock item for the block
|
||||
this.dockitem = new DOCKEDITEM({
|
||||
block : this,
|
||||
dock : dock,
|
||||
blockinstanceid : id,
|
||||
title : blocktitle,
|
||||
contents : blockcontent,
|
||||
commands : blockcommands,
|
||||
blockclass : this._getBlockClass(Y.one('#inst'+id))
|
||||
block: this,
|
||||
dock: dock,
|
||||
blockinstanceid: id,
|
||||
title: blocktitle,
|
||||
contents: blockcontent,
|
||||
commands: blockcommands,
|
||||
blockclass: this._getBlockClass(Y.one('#inst' + id))
|
||||
});
|
||||
// Register an event so that when it is removed we can put it back as a block
|
||||
dock.add(this.dockitem);
|
||||
|
||||
if (!this.skipsetposition) {
|
||||
// save the users preference
|
||||
M.util.set_user_preference('docked_block_instance_'+id, 1);
|
||||
M.util.set_user_preference('docked_block_instance_' + id, 1);
|
||||
}
|
||||
|
||||
this.set('isDocked', true);
|
||||
@@ -172,10 +172,10 @@ BLOCK.prototype = {
|
||||
* Records the block state and adds it to the docks holding area.
|
||||
* @method recordBlockState
|
||||
*/
|
||||
recordBlockState : function() {
|
||||
recordBlockState: function() {
|
||||
var id = this.get('id'),
|
||||
dock = M.core.dock.get(),
|
||||
node = Y.one('#inst'+id),
|
||||
node = Y.one('#inst' + id),
|
||||
skipanchor = node.previous();
|
||||
// Disable the skip anchor when docking
|
||||
if (skipanchor.hasClass('skip-block')) {
|
||||
@@ -194,10 +194,10 @@ BLOCK.prototype = {
|
||||
* @method returnToPage
|
||||
* @return {Boolean}
|
||||
*/
|
||||
returnToPage : function() {
|
||||
returnToPage: function() {
|
||||
var id = this.get('id');
|
||||
|
||||
Y.log('Moving block out of the dock:'+this.get('id'), 'debug', LOGNS);
|
||||
Y.log('Moving block out of the dock:' + this.get('id'), 'debug', LOGNS);
|
||||
|
||||
// Enable the skip anchor when going back to block mode
|
||||
if (this.contentskipanchor) {
|
||||
@@ -213,23 +213,23 @@ BLOCK.prototype = {
|
||||
this.contentplaceholder.replace(this.cachedcontentnode);
|
||||
this.cachedcontentnode = null;
|
||||
|
||||
M.util.set_user_preference('docked_block_instance_'+id, 0);
|
||||
M.util.set_user_preference('docked_block_instance_' + id, 0);
|
||||
this.set('isDocked', false);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
Y.extend(BLOCK, Y.Base, BLOCK.prototype, {
|
||||
NAME : 'moodle-core-dock-block',
|
||||
ATTRS : {
|
||||
NAME: 'moodle-core-dock-block',
|
||||
ATTRS: {
|
||||
/**
|
||||
* The block instance ID
|
||||
* @attribute id
|
||||
* @writeOnce
|
||||
* @type Number
|
||||
*/
|
||||
id : {
|
||||
writeOnce : 'initOnly',
|
||||
setter : function(value) {
|
||||
id: {
|
||||
writeOnce: 'initOnly',
|
||||
setter: function(value) {
|
||||
return parseInt(value, 10);
|
||||
}
|
||||
},
|
||||
@@ -239,8 +239,8 @@ Y.extend(BLOCK, Y.Base, BLOCK.prototype, {
|
||||
* @default false
|
||||
* @type Boolean
|
||||
*/
|
||||
isDocked : {
|
||||
value : false
|
||||
isDocked: {
|
||||
value: false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+159
-159
@@ -24,7 +24,7 @@ var LOGNS = 'moodle-core-dock',
|
||||
dockableblock: '.block[data-instanceid][data-dockable]',
|
||||
blockmoveto: '.block[data-instanceid][data-dockable] .moveto',
|
||||
panelmoveto: '#dockeditempanel .commands a.moveto',
|
||||
dockonload: '.block.'+CSS.dockonload,
|
||||
dockonload: '.block.' + CSS.dockonload,
|
||||
blockregion: '[data-blockregion]'
|
||||
},
|
||||
DOCK,
|
||||
@@ -95,7 +95,7 @@ M.core.dock.registerDockableBlock = function(id) {
|
||||
if (typeof id === 'object' && typeof id.getData === 'function') {
|
||||
id = id.getData('instanceid');
|
||||
}
|
||||
M.core.dock._dockableblocks[id] = new BLOCK({id : id});
|
||||
M.core.dock._dockableblocks[id] = new BLOCK({id: id});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -113,7 +113,7 @@ M.core.dock.dockBlock = function(id) {
|
||||
if (!id.test(SELECTOR.dockableblock)) {
|
||||
id = id.ancestor(SELECTOR.dockableblock);
|
||||
}
|
||||
if (typeof id === 'object' && typeof id.getData === 'function' && !id.ancestor('.'+CSS.dock)) {
|
||||
if (typeof id === 'object' && typeof id.getData === 'function' && !id.ancestor('.' + CSS.dock)) {
|
||||
id = id.getData('instanceid');
|
||||
} else {
|
||||
Y.log('Invalid instanceid given to dockBlockByInstanceID', 'warn', LOGNS);
|
||||
@@ -190,33 +190,33 @@ M.core.dock.fixTitleOrientation = function(title, text) {
|
||||
|
||||
// Move the title into position
|
||||
title.setStyles({
|
||||
'position' : 'relative',
|
||||
'fontSize' : fontsize,
|
||||
'width' : width,
|
||||
'top' : (width - height)/2
|
||||
'position': 'relative',
|
||||
'fontSize': fontsize,
|
||||
'width': width,
|
||||
'top': (width - height) / 2
|
||||
});
|
||||
|
||||
// Positioning is different when in RTL mode.
|
||||
if (window.right_to_left()) {
|
||||
title.setStyle('left', width/2 - height);
|
||||
title.setStyle('left', width / 2 - height);
|
||||
} else {
|
||||
title.setStyle('right', width/2 - height);
|
||||
title.setStyle('right', width / 2 - height);
|
||||
}
|
||||
|
||||
// Rotate the text
|
||||
title.setStyles({
|
||||
'transform' : transform,
|
||||
'-ms-transform' : transform,
|
||||
'-moz-transform' : transform,
|
||||
'-webkit-transform' : transform,
|
||||
'-o-transform' : transform
|
||||
'transform': transform,
|
||||
'-ms-transform': transform,
|
||||
'-moz-transform': transform,
|
||||
'-webkit-transform': transform,
|
||||
'-o-transform': transform
|
||||
});
|
||||
|
||||
container = Y.Node.create('<div></div>');
|
||||
container.append(title);
|
||||
container.setStyles({
|
||||
height : width + (width / 4),
|
||||
position : 'relative'
|
||||
height: width + (width / 4),
|
||||
position: 'relative'
|
||||
});
|
||||
return container;
|
||||
};
|
||||
@@ -260,61 +260,61 @@ DOCK.prototype = {
|
||||
* @property tabheightmanager
|
||||
* @type TABHEIGHTMANAGER
|
||||
*/
|
||||
tabheightmanager : null,
|
||||
tabheightmanager: null,
|
||||
/**
|
||||
* Will be an eventtype if there is an eventype to prevent.
|
||||
* @protected
|
||||
* @property preventevent
|
||||
* @type String
|
||||
*/
|
||||
preventevent : null,
|
||||
preventevent: null,
|
||||
/**
|
||||
* Will be an object if there is a delayed event in effect.
|
||||
* @protected
|
||||
* @property delayedevent
|
||||
* @type {Object}
|
||||
*/
|
||||
delayedevent : null,
|
||||
delayedevent: null,
|
||||
/**
|
||||
* An array of currently docked items.
|
||||
* @protected
|
||||
* @property dockeditems
|
||||
* @type Array
|
||||
*/
|
||||
dockeditems : [],
|
||||
dockeditems: [],
|
||||
/**
|
||||
* Set to true once the dock has been drawn.
|
||||
* @protected
|
||||
* @property dockdrawn
|
||||
* @type Boolean
|
||||
*/
|
||||
dockdrawn : false,
|
||||
dockdrawn: false,
|
||||
/**
|
||||
* The number of blocks that are currently docked.
|
||||
* @protected
|
||||
* @property count
|
||||
* @type Number
|
||||
*/
|
||||
count : 0,
|
||||
count: 0,
|
||||
/**
|
||||
* The total number of blocks that have been docked.
|
||||
* @protected
|
||||
* @property totalcount
|
||||
* @type Number
|
||||
*/
|
||||
totalcount : 0,
|
||||
totalcount: 0,
|
||||
/**
|
||||
* A hidden node used as a holding area for DOM objects used by blocks that have been docked.
|
||||
* @protected
|
||||
* @property holdingareanode
|
||||
* @type Node
|
||||
*/
|
||||
holdingareanode : null,
|
||||
holdingareanode: null,
|
||||
/**
|
||||
* Called during the initialisation process of the object.
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
Y.log('Dock initialising', 'debug', LOGNS);
|
||||
|
||||
// Publish the events the dock has
|
||||
@@ -322,63 +322,63 @@ DOCK.prototype = {
|
||||
* Fired when the dock first starts initialising.
|
||||
* @event dock:starting
|
||||
*/
|
||||
this.publish('dock:starting', {prefix: 'dock',broadcast: 2,emitFacade: true, fireOnce:true});
|
||||
this.publish('dock:starting', {prefix: 'dock', broadcast: 2, emitFacade: true, fireOnce: true});
|
||||
/**
|
||||
* Fired after the dock is initialised for the first time.
|
||||
* @event dock:initialised
|
||||
*/
|
||||
this.publish('dock:initialised', {prefix: 'dock',broadcast: 2,emitFacade: true, fireOnce:true});
|
||||
this.publish('dock:initialised', {prefix: 'dock', broadcast: 2, emitFacade: true, fireOnce: true});
|
||||
/**
|
||||
* Fired before the dock structure and content is first created.
|
||||
* @event dock:beforedraw
|
||||
*/
|
||||
this.publish('dock:beforedraw', {prefix:'dock', fireOnce:true});
|
||||
this.publish('dock:beforedraw', {prefix: 'dock', fireOnce: true});
|
||||
/**
|
||||
* Fired before the dock is changed from hidden to visible.
|
||||
* @event dock:beforeshow
|
||||
*/
|
||||
this.publish('dock:beforeshow', {prefix:'dock'});
|
||||
this.publish('dock:beforeshow', {prefix: 'dock'});
|
||||
/**
|
||||
* Fires after the dock has been changed from hidden to visible.
|
||||
* @event dock:shown
|
||||
*/
|
||||
this.publish('dock:shown', {prefix:'dock', broadcast: 2});
|
||||
this.publish('dock:shown', {prefix: 'dock', broadcast: 2});
|
||||
/**
|
||||
* Fired after the dock has been changed from visible to hidden.
|
||||
* @event dock:hidden
|
||||
*/
|
||||
this.publish('dock:hidden', {prefix:'dock', broadcast: 2});
|
||||
this.publish('dock:hidden', {prefix: 'dock', broadcast: 2});
|
||||
/**
|
||||
* Fires when an item is added to the dock.
|
||||
* @event dock:itemadded
|
||||
*/
|
||||
this.publish('dock:itemadded', {prefix:'dock'});
|
||||
this.publish('dock:itemadded', {prefix: 'dock'});
|
||||
/**
|
||||
* Fires when an item is removed from the dock.
|
||||
* @event dock:itemremoved
|
||||
*/
|
||||
this.publish('dock:itemremoved', {prefix:'dock'});
|
||||
this.publish('dock:itemremoved', {prefix: 'dock'});
|
||||
/**
|
||||
* Fires when a block is added or removed from the dock.
|
||||
* This happens after the itemadded and itemremoved events have been called.
|
||||
* @event dock:itemschanged
|
||||
*/
|
||||
this.publish('dock:itemschanged', {prefix:'dock', broadcast: 2});
|
||||
this.publish('dock:itemschanged', {prefix: 'dock', broadcast: 2});
|
||||
/**
|
||||
* Fires once when the docks panel is first initialised.
|
||||
* @event dock:panelgenerated
|
||||
*/
|
||||
this.publish('dock:panelgenerated', {prefix:'dock', fireOnce:true});
|
||||
this.publish('dock:panelgenerated', {prefix: 'dock', fireOnce: true});
|
||||
/**
|
||||
* Fires when the dock panel is about to be resized.
|
||||
* @event dock:panelresizestart
|
||||
*/
|
||||
this.publish('dock:panelresizestart', {prefix:'dock'});
|
||||
this.publish('dock:panelresizestart', {prefix: 'dock'});
|
||||
/**
|
||||
* Fires after the dock panel has been resized.
|
||||
* @event dock:resizepanelcomplete
|
||||
*/
|
||||
this.publish('dock:resizepanelcomplete', {prefix:'dock'});
|
||||
this.publish('dock:resizepanelcomplete', {prefix: 'dock'});
|
||||
|
||||
// Apply theme customisations here before we do any real work.
|
||||
this._applyThemeCustomisation();
|
||||
@@ -394,44 +394,44 @@ DOCK.prototype = {
|
||||
* @method _ensureDockDrawn
|
||||
* @return {Boolean}
|
||||
*/
|
||||
_ensureDockDrawn : function() {
|
||||
_ensureDockDrawn: function() {
|
||||
if (this.dockdrawn === true) {
|
||||
return true;
|
||||
}
|
||||
var dock = this._initialiseDockNode(),
|
||||
clickargs = {
|
||||
cssselector:'.'+CSS.dockedtitle,
|
||||
delay:0
|
||||
cssselector: '.' + CSS.dockedtitle,
|
||||
delay: 0
|
||||
},
|
||||
mouseenterargs = {
|
||||
cssselector:'.'+CSS.dockedtitle,
|
||||
delay:0.5,
|
||||
iscontained:true,
|
||||
preventevent:'click',
|
||||
preventdelay:3
|
||||
cssselector: '.' + CSS.dockedtitle,
|
||||
delay: 0.5,
|
||||
iscontained: true,
|
||||
preventevent: 'click',
|
||||
preventdelay: 3
|
||||
};
|
||||
if (Y.UA.ie > 0 && Y.UA.ie < 7) {
|
||||
// Adjust for IE 6 (can't handle fixed pos)
|
||||
dock.setStyle('height', dock.get('winHeight')+'px');
|
||||
dock.setStyle('height', dock.get('winHeight') + 'px');
|
||||
}
|
||||
|
||||
this.fire('dock:beforedraw');
|
||||
|
||||
this._initialiseDockControls();
|
||||
|
||||
this.tabheightmanager = new TABHEIGHTMANAGER({dock:this});
|
||||
this.tabheightmanager = new TABHEIGHTMANAGER({dock: this});
|
||||
|
||||
// Attach the required event listeners
|
||||
// We use delegate here as that way a handful of events are created for the dock
|
||||
// and all items rather than the same number for the dock AND every item individually
|
||||
Y.delegate('click', this.handleEvent, this.get('dockNode'), '.'+CSS.dockedtitle, this, clickargs);
|
||||
Y.delegate('mouseenter', this.handleEvent, this.get('dockNode'), '.'+CSS.dockedtitle, this, mouseenterargs);
|
||||
this.get('dockNode').on('mouseleave', this.handleEvent, this, {cssselector:'#dock', delay:0.5, iscontained:false});
|
||||
Y.delegate('click', this.handleEvent, this.get('dockNode'), '.' + CSS.dockedtitle, this, clickargs);
|
||||
Y.delegate('mouseenter', this.handleEvent, this.get('dockNode'), '.' + CSS.dockedtitle, this, mouseenterargs);
|
||||
this.get('dockNode').on('mouseleave', this.handleEvent, this, {cssselector: '#dock', delay: 0.5, iscontained: false});
|
||||
|
||||
Y.delegate('click', this.handleReturnToBlock, this.get('dockNode'), SELECTOR.panelmoveto, this);
|
||||
Y.delegate('dock:actionkey', this.handleDockedItemEvent, this.get('dockNode'), '.'+CSS.dockeditem, this);
|
||||
Y.delegate('dock:actionkey', this.handleDockedItemEvent, this.get('dockNode'), '.' + CSS.dockeditem, this);
|
||||
|
||||
BODY.on('click', this.handleEvent, this, {cssselector:'body', delay:0});
|
||||
BODY.on('click', this.handleEvent, this, {cssselector: 'body', delay: 0});
|
||||
this.on('dock:itemschanged', this.resizeBlockSpace, this);
|
||||
this.on('dock:itemschanged', this.checkDockVisibility, this);
|
||||
this.on('dock:itemschanged', this.resetFirstItem, this);
|
||||
@@ -444,12 +444,12 @@ DOCK.prototype = {
|
||||
* @method handleDockedItemEvent
|
||||
* @return {Boolean}
|
||||
*/
|
||||
handleDockedItemEvent : function(e) {
|
||||
handleDockedItemEvent: function(e) {
|
||||
if (e.type !== 'dock:actionkey') {
|
||||
return false;
|
||||
}
|
||||
var target = e.target,
|
||||
dockeditem = '.'+CSS.dockeditem;
|
||||
dockeditem = '.' + CSS.dockeditem;
|
||||
if (!target.test(dockeditem)) {
|
||||
target = target.ancestor(dockeditem);
|
||||
}
|
||||
@@ -464,28 +464,28 @@ DOCK.prototype = {
|
||||
* @private
|
||||
* @method _applyThemeCustomisation
|
||||
*/
|
||||
_applyThemeCustomisation : function() {
|
||||
_applyThemeCustomisation: function() {
|
||||
// Check if there is a customisation function
|
||||
if (typeof(customise_dock_for_theme) === 'function') {
|
||||
if (typeof (customise_dock_for_theme) === 'function') {
|
||||
// First up pre the legacy object.
|
||||
M.core_dock = this;
|
||||
M.core_dock.cfg = {
|
||||
buffer : null,
|
||||
orientation : null,
|
||||
position : null,
|
||||
spacebeforefirstitem : null,
|
||||
removeallicon : null
|
||||
buffer: null,
|
||||
orientation: null,
|
||||
position: null,
|
||||
spacebeforefirstitem: null,
|
||||
removeallicon: null
|
||||
};
|
||||
M.core_dock.css = {
|
||||
dock : null,
|
||||
dockspacer : null,
|
||||
controls : null,
|
||||
body : null,
|
||||
buttonscontainer : null,
|
||||
dockeditem : null,
|
||||
dockeditemcontainer : null,
|
||||
dockedtitle : null,
|
||||
activeitem : null
|
||||
dock: null,
|
||||
dockspacer: null,
|
||||
controls: null,
|
||||
body: null,
|
||||
buttonscontainer: null,
|
||||
dockeditem: null,
|
||||
dockeditemcontainer: null,
|
||||
dockedtitle: null,
|
||||
activeitem: null
|
||||
};
|
||||
try {
|
||||
// Run the customisation function
|
||||
@@ -498,11 +498,11 @@ DOCK.prototype = {
|
||||
var key, value,
|
||||
warned = false,
|
||||
cfgmap = {
|
||||
buffer : 'bufferPanel',
|
||||
orientation : 'orientation',
|
||||
position : 'position',
|
||||
spacebeforefirstitem : 'bufferBeforeFirstItem',
|
||||
removeallicon : 'undockAllIconUrl'
|
||||
buffer: 'bufferPanel',
|
||||
orientation: 'orientation',
|
||||
position: 'position',
|
||||
spacebeforefirstitem: 'bufferBeforeFirstItem',
|
||||
removeallicon: 'undockAllIconUrl'
|
||||
};
|
||||
// Check for and apply any legacy configuration.
|
||||
for (key in M.core_dock.cfg) {
|
||||
@@ -548,18 +548,18 @@ DOCK.prototype = {
|
||||
* @method _initialiseDockNode
|
||||
* @return {Node} The dockNode
|
||||
*/
|
||||
_initialiseDockNode : function() {
|
||||
_initialiseDockNode: function() {
|
||||
var dock = this.get('dockNode'),
|
||||
positionorientationclass = CSS.dock+'_'+this.get('position')+'_'+this.get('orientation'),
|
||||
holdingarea = Y.Node.create('<div></div>').setStyles({display:'none'}),
|
||||
positionorientationclass = CSS.dock + '_' + this.get('position') + '_' + this.get('orientation'),
|
||||
holdingarea = Y.Node.create('<div></div>').setStyles({display: 'none'}),
|
||||
buttons = this.get('buttonsNode'),
|
||||
container = this.get('itemContainerNode');
|
||||
|
||||
if (!dock) {
|
||||
dock = Y.one('#'+CSS.dock);
|
||||
dock = Y.one('#' + CSS.dock);
|
||||
}
|
||||
if (!dock) {
|
||||
dock = Y.Node.create('<div id="'+CSS.dock+'"></div>');
|
||||
dock = Y.Node.create('<div id="' + CSS.dock + '"></div>');
|
||||
BODY.append(dock);
|
||||
}
|
||||
dock.setAttribute('role', 'menubar').addClass(positionorientationclass);
|
||||
@@ -567,23 +567,23 @@ DOCK.prototype = {
|
||||
// Nothing on the dock... hide it using CSS
|
||||
dock.addClass('nothingdocked');
|
||||
} else {
|
||||
positionorientationclass = CSS.body+'_'+this.get('position')+'_'+this.get('orientation');
|
||||
positionorientationclass = CSS.body + '_' + this.get('position') + '_' + this.get('orientation');
|
||||
BODY.addClass(CSS.body).addClass();
|
||||
}
|
||||
|
||||
if (!buttons) {
|
||||
buttons = dock.one('.'+CSS.buttonscontainer);
|
||||
buttons = dock.one('.' + CSS.buttonscontainer);
|
||||
}
|
||||
if (!buttons) {
|
||||
buttons = Y.Node.create('<div class="'+CSS.buttonscontainer+'"></div>');
|
||||
buttons = Y.Node.create('<div class="' + CSS.buttonscontainer + '"></div>');
|
||||
dock.append(buttons);
|
||||
}
|
||||
|
||||
if (!container) {
|
||||
container = dock.one('.'+CSS.dockeditemcontainer);
|
||||
container = dock.one('.' + CSS.dockeditemcontainer);
|
||||
}
|
||||
if (!container) {
|
||||
container = Y.Node.create('<div class="'+CSS.dockeditemcontainer+'"></div>');
|
||||
container = Y.Node.create('<div class="' + CSS.dockeditemcontainer + '"></div>');
|
||||
buttons.append(container);
|
||||
}
|
||||
|
||||
@@ -602,25 +602,25 @@ DOCK.prototype = {
|
||||
* @private
|
||||
* @method _initialiseDockControls
|
||||
*/
|
||||
_initialiseDockControls : function() {
|
||||
_initialiseDockControls: function() {
|
||||
// Add a removeall button
|
||||
// Must set the image src seperatly of we get an error with XML strict headers
|
||||
|
||||
var removeall = Y.Node.create('<img alt="'+M.util.get_string('undockall', 'block')+'" tabindex="0" />');
|
||||
removeall.setAttribute('src',this.get('undockAllIconUrl'));
|
||||
var removeall = Y.Node.create('<img alt="' + M.util.get_string('undockall', 'block') + '" tabindex="0" />');
|
||||
removeall.setAttribute('src', this.get('undockAllIconUrl'));
|
||||
removeall.on('removeall|click', this.removeAll, this);
|
||||
removeall.on('dock:actionkey', this.removeAll, this, {actions:{enter:true}});
|
||||
this.get('buttonsNode').append(Y.Node.create('<div class="'+CSS.controls+'"></div>').append(removeall));
|
||||
removeall.on('dock:actionkey', this.removeAll, this, {actions: {enter: true}});
|
||||
this.get('buttonsNode').append(Y.Node.create('<div class="' + CSS.controls + '"></div>').append(removeall));
|
||||
},
|
||||
/**
|
||||
* Returns the dock panel. Initialising it if it hasn't already been initialised.
|
||||
* @method getPanel
|
||||
* @return {DOCKPANEL}
|
||||
*/
|
||||
getPanel : function() {
|
||||
getPanel: function() {
|
||||
var panel = this.get('panel');
|
||||
if (!panel) {
|
||||
panel = new DOCKPANEL({dock:this});
|
||||
panel = new DOCKPANEL({dock: this});
|
||||
panel.on('panel:visiblechange', this.resize, this);
|
||||
Y.on('windowresize', this.resize, this);
|
||||
// Initialise the dockpanel .. should only happen once
|
||||
@@ -633,7 +633,7 @@ DOCK.prototype = {
|
||||
* Resizes the dock panel if required.
|
||||
* @method resizePanelIfRequired
|
||||
*/
|
||||
resizePanelIfRequired : function() {
|
||||
resizePanelIfRequired: function() {
|
||||
this.resize();
|
||||
var panel = this.get('panel');
|
||||
if (panel) {
|
||||
@@ -648,7 +648,7 @@ DOCK.prototype = {
|
||||
* @param {Object} options
|
||||
* @return {Boolean}
|
||||
*/
|
||||
handleEvent : function(e, options) {
|
||||
handleEvent: function(e, options) {
|
||||
var item = this.getActiveItem(),
|
||||
target,
|
||||
targetid,
|
||||
@@ -675,7 +675,7 @@ DOCK.prototype = {
|
||||
if (options.preventevent) {
|
||||
this.preventevent = options.preventevent;
|
||||
if (options.preventdelay) {
|
||||
setTimeout(function(){
|
||||
setTimeout(function() {
|
||||
self.preventevent = null;
|
||||
}, options.preventdelay * 1000);
|
||||
}
|
||||
@@ -711,31 +711,31 @@ DOCK.prototype = {
|
||||
* @param {Node} target
|
||||
* @return {Boolean}
|
||||
*/
|
||||
delayEvent : function(event, options, target) {
|
||||
delayEvent: function(event, options, target) {
|
||||
var self = this;
|
||||
self.delayedevent = (function(){
|
||||
self.delayedevent = (function() {
|
||||
return {
|
||||
target : target,
|
||||
event : BODY.on('mousemove', function(e){
|
||||
target: target,
|
||||
event: BODY.on('mousemove', function(e) {
|
||||
self.delayedevent.target = e.target;
|
||||
}),
|
||||
timeout : null
|
||||
timeout: null
|
||||
};
|
||||
})(self);
|
||||
self.delayedevent.timeout = setTimeout(function(){
|
||||
self.delayedevent.timeout = setTimeout(function() {
|
||||
self.delayedevent.timeout = null;
|
||||
self.delayedevent.event.detach();
|
||||
if (options.iscontained === self.get('dockNode').contains(self.delayedevent.target)) {
|
||||
self.handleEvent(event, {cssselector:options.cssselector, delay:0, iscontained:options.iscontained});
|
||||
self.handleEvent(event, {cssselector: options.cssselector, delay: 0, iscontained: options.iscontained});
|
||||
}
|
||||
}, options.delay*1000);
|
||||
}, options.delay * 1000);
|
||||
return true;
|
||||
},
|
||||
/**
|
||||
* Resizes block spaces.
|
||||
* @method resizeBlockSpace
|
||||
*/
|
||||
resizeBlockSpace : function() {
|
||||
resizeBlockSpace: function() {
|
||||
if (Y.all(SELECTOR.dockonload).size() > 0) {
|
||||
// Do not resize during initial load
|
||||
return;
|
||||
@@ -751,7 +751,7 @@ DOCK.prototype = {
|
||||
classesToRemove = [];
|
||||
|
||||
// First look for understood regions.
|
||||
Y.all(SELECTOR.blockregion).each(function(region){
|
||||
Y.all(SELECTOR.blockregion).each(function(region) {
|
||||
var regionname = region.getData('blockregion');
|
||||
if (region.all('.block').size() > 0) {
|
||||
populatedBlockRegions.push(regionname);
|
||||
@@ -762,7 +762,7 @@ DOCK.prototype = {
|
||||
});
|
||||
|
||||
// Next check for legacy regions.
|
||||
Y.all('.block-region').each(function(region){
|
||||
Y.all('.block-region').each(function(region) {
|
||||
if (region.test(SELECTOR.blockregion)) {
|
||||
// This is a new region, we've already processed it.
|
||||
return;
|
||||
@@ -866,10 +866,10 @@ DOCK.prototype = {
|
||||
* @method add
|
||||
* @param {DOCKEDITEM} item
|
||||
*/
|
||||
add : function(item) {
|
||||
add: function(item) {
|
||||
// Set the dockitem id to the total count and then increment it.
|
||||
item.set('id', this.totalcount);
|
||||
Y.log('Adding block '+item._getLogDescription()+' to the dock.', 'debug', LOGNS);
|
||||
Y.log('Adding block ' + item._getLogDescription() + ' to the dock.', 'debug', LOGNS);
|
||||
this.count++;
|
||||
this.totalcount++;
|
||||
this.dockeditems[item.get('id')] = item;
|
||||
@@ -882,7 +882,7 @@ DOCK.prototype = {
|
||||
* @method append
|
||||
* @param {Node} docknode
|
||||
*/
|
||||
append : function(docknode) {
|
||||
append: function(docknode) {
|
||||
this.get('itemContainerNode').append(docknode);
|
||||
},
|
||||
/**
|
||||
@@ -890,7 +890,7 @@ DOCK.prototype = {
|
||||
* @method handleReturnToBlock
|
||||
* @param {EventFacade} e
|
||||
*/
|
||||
handleReturnToBlock : function(e) {
|
||||
handleReturnToBlock: function(e) {
|
||||
e.halt();
|
||||
this.remove(this.getActiveItem().get('id'));
|
||||
},
|
||||
@@ -900,11 +900,11 @@ DOCK.prototype = {
|
||||
* @param {Number} id The docked item id.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
remove : function(id) {
|
||||
remove: function(id) {
|
||||
if (!this.dockeditems[id]) {
|
||||
return false;
|
||||
}
|
||||
Y.log('Removing block '+this.dockeditems[id]._getLogDescription()+' from the dock.', 'debug', LOGNS);
|
||||
Y.log('Removing block ' + this.dockeditems[id]._getLogDescription() + ' from the dock.', 'debug', LOGNS);
|
||||
this.dockeditems[id].remove();
|
||||
delete this.dockeditems[id];
|
||||
this.count--;
|
||||
@@ -916,10 +916,10 @@ DOCK.prototype = {
|
||||
* Ensures the the first item in the dock has the correct class.
|
||||
* @method resetFirstItem
|
||||
*/
|
||||
resetFirstItem : function() {
|
||||
this.get('dockNode').all('.'+CSS.dockeditem+'.firstdockitem').removeClass('firstdockitem');
|
||||
if (this.get('dockNode').one('.'+CSS.dockeditem)) {
|
||||
this.get('dockNode').one('.'+CSS.dockeditem).addClass('firstdockitem');
|
||||
resetFirstItem: function() {
|
||||
this.get('dockNode').all('.' + CSS.dockeditem + '.firstdockitem').removeClass('firstdockitem');
|
||||
if (this.get('dockNode').one('.' + CSS.dockeditem)) {
|
||||
this.get('dockNode').one('.' + CSS.dockeditem).addClass('firstdockitem');
|
||||
}
|
||||
},
|
||||
/**
|
||||
@@ -927,8 +927,8 @@ DOCK.prototype = {
|
||||
* @method removeAll
|
||||
* @return {Boolean}
|
||||
*/
|
||||
removeAll : function() {
|
||||
Y.log('Undocking all '+this.dockeditems.length+' blocks', 'debug', LOGNS);
|
||||
removeAll: function() {
|
||||
Y.log('Undocking all ' + this.dockeditems.length + ' blocks', 'debug', LOGNS);
|
||||
var i;
|
||||
for (i in this.dockeditems) {
|
||||
if (Y.Lang.isNumber(i) || Y.Lang.isString(i)) {
|
||||
@@ -941,7 +941,7 @@ DOCK.prototype = {
|
||||
* Hides the active item.
|
||||
* @method hideActive
|
||||
*/
|
||||
hideActive : function() {
|
||||
hideActive: function() {
|
||||
var item = this.getActiveItem();
|
||||
if (item) {
|
||||
item.hide();
|
||||
@@ -951,8 +951,8 @@ DOCK.prototype = {
|
||||
* Checks wether the dock should be shown or hidden
|
||||
* @method checkDockVisibility
|
||||
*/
|
||||
checkDockVisibility : function() {
|
||||
var bodyclass = CSS.body+'_'+this.get('position')+'_'+this.get('orientation');
|
||||
checkDockVisibility: function() {
|
||||
var bodyclass = CSS.body + '_' + this.get('position') + '_' + this.get('orientation');
|
||||
if (!this.count) {
|
||||
this.get('dockNode').addClass('nothingdocked');
|
||||
BODY.removeClass(CSS.body).removeClass();
|
||||
@@ -970,7 +970,7 @@ DOCK.prototype = {
|
||||
* @method resize
|
||||
* @return {Boolean}
|
||||
*/
|
||||
resize : function() {
|
||||
resize: function() {
|
||||
var panel = this.getPanel(),
|
||||
item = this.getActiveItem(),
|
||||
buffer,
|
||||
@@ -990,11 +990,11 @@ DOCK.prototype = {
|
||||
this.fire('dock:panelresizestart');
|
||||
if (this.get('orientation') === 'vertical') {
|
||||
buffer = this.get('bufferPanel');
|
||||
screenh = parseInt(BODY.get('winHeight'), 10)-(buffer*2);
|
||||
screenh = parseInt(BODY.get('winHeight'), 10) - (buffer * 2);
|
||||
docky = this.get('dockNode').getY();
|
||||
titletop = item.get('dockTitleNode').getY()-docky-buffer;
|
||||
titletop = item.get('dockTitleNode').getY() - docky - buffer;
|
||||
containery = this.get('itemContainerNode').getY();
|
||||
containerheight = containery-docky+this.get('buttonsNode').get('offsetHeight');
|
||||
containerheight = containery - docky + this.get('buttonsNode').get('offsetHeight');
|
||||
scrolltop = panel.get('bodyNode').get('scrollTop');
|
||||
panel.get('bodyNode').setStyle('height', 'auto');
|
||||
panel.get('node').removeClass('oversized_content');
|
||||
@@ -1003,13 +1003,13 @@ DOCK.prototype = {
|
||||
if (Y.UA.ie > 0 && Y.UA.ie < 7) {
|
||||
panel.setTop(item.get('dockTitleNode').getY());
|
||||
} else if (panelheight > screenh) {
|
||||
panel.setTop(buffer-containerheight);
|
||||
panel.get('bodyNode').setStyle('height', (screenh-panel.get('headerNode').get('offsetHeight'))+'px');
|
||||
panel.setTop(buffer - containerheight);
|
||||
panel.get('bodyNode').setStyle('height', (screenh - panel.get('headerNode').get('offsetHeight')) + 'px');
|
||||
panel.get('node').addClass('oversized_content');
|
||||
} else if (panelheight > (screenh-(titletop-buffer))) {
|
||||
panel.setTop(titletop-containerheight-(panelheight - (screenh-titletop))+buffer);
|
||||
} else if (panelheight > (screenh - (titletop - buffer))) {
|
||||
panel.setTop(titletop - containerheight - (panelheight - (screenh - titletop)) + buffer);
|
||||
} else {
|
||||
panel.setTop(titletop-containerheight+buffer);
|
||||
panel.setTop(titletop - containerheight + buffer);
|
||||
}
|
||||
|
||||
if (scrolltop) {
|
||||
@@ -1022,8 +1022,8 @@ DOCK.prototype = {
|
||||
|
||||
} else if (this.get('position') === 'top') {
|
||||
dockx = this.get('dockNode').getX();
|
||||
titleleft = item.get('dockTitleNode').getX()-dockx;
|
||||
panel.get('node').setStyle('left', titleleft+'px');
|
||||
titleleft = item.get('dockTitleNode').getX() - dockx;
|
||||
panel.get('node').setStyle('left', titleleft + 'px');
|
||||
}
|
||||
|
||||
this.fire('dock:resizepanelcomplete');
|
||||
@@ -1034,7 +1034,7 @@ DOCK.prototype = {
|
||||
* @method getActiveItem
|
||||
* @return {DOCKEDITEM}
|
||||
*/
|
||||
getActiveItem : function() {
|
||||
getActiveItem: function() {
|
||||
var i;
|
||||
for (i in this.dockeditems) {
|
||||
if (this.dockeditems[i].active) {
|
||||
@@ -1048,22 +1048,22 @@ DOCK.prototype = {
|
||||
* @method addToHoldingArea
|
||||
* @param {Node} node
|
||||
*/
|
||||
addToHoldingArea : function(node) {
|
||||
addToHoldingArea: function(node) {
|
||||
this.holdingareanode.append(node);
|
||||
}
|
||||
};
|
||||
|
||||
Y.extend(DOCK, Y.Base, DOCK.prototype, {
|
||||
NAME : 'moodle-core-dock',
|
||||
ATTRS : {
|
||||
NAME: 'moodle-core-dock',
|
||||
ATTRS: {
|
||||
/**
|
||||
* The dock itself. #dock.
|
||||
* @attribute dockNode
|
||||
* @type Node
|
||||
* @writeOnce
|
||||
*/
|
||||
dockNode : {
|
||||
writeOnce : true
|
||||
dockNode: {
|
||||
writeOnce: true
|
||||
},
|
||||
/**
|
||||
* The docks panel.
|
||||
@@ -1071,8 +1071,8 @@ Y.extend(DOCK, Y.Base, DOCK.prototype, {
|
||||
* @type DOCKPANEL
|
||||
* @writeOnce
|
||||
*/
|
||||
panel : {
|
||||
writeOnce : true
|
||||
panel: {
|
||||
writeOnce: true
|
||||
},
|
||||
/**
|
||||
* A container within the dock used for buttons.
|
||||
@@ -1080,8 +1080,8 @@ Y.extend(DOCK, Y.Base, DOCK.prototype, {
|
||||
* @type Node
|
||||
* @writeOnce
|
||||
*/
|
||||
buttonsNode : {
|
||||
writeOnce : true
|
||||
buttonsNode: {
|
||||
writeOnce: true
|
||||
},
|
||||
/**
|
||||
* A container within the dock used for docked blocks.
|
||||
@@ -1089,8 +1089,8 @@ Y.extend(DOCK, Y.Base, DOCK.prototype, {
|
||||
* @type Node
|
||||
* @writeOnce
|
||||
*/
|
||||
itemContainerNode : {
|
||||
writeOnce : true
|
||||
itemContainerNode: {
|
||||
writeOnce: true
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1099,9 +1099,9 @@ Y.extend(DOCK, Y.Base, DOCK.prototype, {
|
||||
* @type Number
|
||||
* @default 10
|
||||
*/
|
||||
bufferPanel : {
|
||||
value : 10,
|
||||
validator : Y.Lang.isNumber
|
||||
bufferPanel: {
|
||||
value: 10,
|
||||
validator: Y.Lang.isNumber
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1110,9 +1110,9 @@ Y.extend(DOCK, Y.Base, DOCK.prototype, {
|
||||
* @type String
|
||||
* @default left
|
||||
*/
|
||||
position : {
|
||||
value : 'left',
|
||||
validator : Y.Lang.isString
|
||||
position: {
|
||||
value: 'left',
|
||||
validator: Y.Lang.isString
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1121,10 +1121,10 @@ Y.extend(DOCK, Y.Base, DOCK.prototype, {
|
||||
* @type String
|
||||
* @default vertical
|
||||
*/
|
||||
orientation : {
|
||||
value : 'vertical',
|
||||
validator : Y.Lang.isString,
|
||||
setter : function(value) {
|
||||
orientation: {
|
||||
value: 'vertical',
|
||||
validator: Y.Lang.isString,
|
||||
setter: function(value) {
|
||||
if (value.match(/^vertical$/i)) {
|
||||
return 'vertical';
|
||||
}
|
||||
@@ -1138,9 +1138,9 @@ Y.extend(DOCK, Y.Base, DOCK.prototype, {
|
||||
* @type Number
|
||||
* @default 10
|
||||
*/
|
||||
bufferBeforeFirstItem : {
|
||||
value : 10,
|
||||
validator : Y.Lang.isNumber
|
||||
bufferBeforeFirstItem: {
|
||||
value: 10,
|
||||
validator: Y.Lang.isNumber
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -1150,8 +1150,8 @@ Y.extend(DOCK, Y.Base, DOCK.prototype, {
|
||||
* @default t/dock_to_block
|
||||
*/
|
||||
undockAllIconUrl: {
|
||||
value : M.util.image_url((window.right_to_left()) ? 't/dock_to_block_rtl' : 't/dock_to_block', 'moodle'),
|
||||
validator : Y.Lang.isString
|
||||
value: M.util.image_url((window.right_to_left()) ? 't/dock_to_block_rtl' : 't/dock_to_block', 'moodle'),
|
||||
validator: Y.Lang.isString
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+50
-50
@@ -27,12 +27,12 @@ DOCKEDITEM.prototype = {
|
||||
* @protected
|
||||
* @type Boolean
|
||||
*/
|
||||
active : false,
|
||||
active: false,
|
||||
/**
|
||||
* Called during the initialisation process of the object.
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
var title = this.get('title'),
|
||||
titlestring,
|
||||
type;
|
||||
@@ -40,53 +40,53 @@ DOCKEDITEM.prototype = {
|
||||
* Fired before the docked item has been drawn.
|
||||
* @event dockeditem:drawstart
|
||||
*/
|
||||
this.publish('dockeditem:drawstart', {prefix:'dockeditem'});
|
||||
this.publish('dockeditem:drawstart', {prefix: 'dockeditem'});
|
||||
/**
|
||||
* Fired after the docked item has been drawn.
|
||||
* @event dockeditem:drawcomplete
|
||||
*/
|
||||
this.publish('dockeditem:drawcomplete', {prefix:'dockeditem'});
|
||||
this.publish('dockeditem:drawcomplete', {prefix: 'dockeditem'});
|
||||
/**
|
||||
* Fired before the docked item is to be shown.
|
||||
* @event dockeditem:showstart
|
||||
*/
|
||||
this.publish('dockeditem:showstart', {prefix:'dockeditem'});
|
||||
this.publish('dockeditem:showstart', {prefix: 'dockeditem'});
|
||||
/**
|
||||
* Fired after the docked item has been shown.
|
||||
* @event dockeditem:showcomplete
|
||||
*/
|
||||
this.publish('dockeditem:showcomplete', {prefix:'dockeditem'});
|
||||
this.publish('dockeditem:showcomplete', {prefix: 'dockeditem'});
|
||||
/**
|
||||
* Fired before the docked item has been hidden.
|
||||
* @event dockeditem:hidestart
|
||||
*/
|
||||
this.publish('dockeditem:hidestart', {prefix:'dockeditem'});
|
||||
this.publish('dockeditem:hidestart', {prefix: 'dockeditem'});
|
||||
/**
|
||||
* Fired after the docked item has been hidden.
|
||||
* @event dockeditem:hidecomplete
|
||||
*/
|
||||
this.publish('dockeditem:hidecomplete', {prefix:'dockeditem'});
|
||||
this.publish('dockeditem:hidecomplete', {prefix: 'dockeditem'});
|
||||
/**
|
||||
* Fired when the docked item is removed from the dock.
|
||||
* @event dockeditem:itemremoved
|
||||
*/
|
||||
this.publish('dockeditem:itemremoved', {prefix:'dockeditem'});
|
||||
this.publish('dockeditem:itemremoved', {prefix: 'dockeditem'});
|
||||
if (title) {
|
||||
type = title.get('nodeName');
|
||||
titlestring = title.cloneNode(true);
|
||||
title = Y.Node.create('<'+type+'></'+type+'>');
|
||||
title = Y.Node.create('<' + type + '></' + type + '>');
|
||||
title = M.core.dock.fixTitleOrientation(title, titlestring.get('text'));
|
||||
this.set('title', title);
|
||||
this.set('titlestring', titlestring);
|
||||
}
|
||||
Y.log('Initialised dockeditem for block with title "'+this._getLogDescription(), 'debug', LOGNS);
|
||||
Y.log('Initialised dockeditem for block with title "' + this._getLogDescription(), 'debug', LOGNS);
|
||||
},
|
||||
/**
|
||||
* This function draws the item on the dock.
|
||||
* @method draw
|
||||
* @return Boolean
|
||||
*/
|
||||
draw : function() {
|
||||
draw: function() {
|
||||
var create = Y.Node.create,
|
||||
dock = this.get('dock'),
|
||||
count = dock.count,
|
||||
@@ -98,9 +98,9 @@ DOCKEDITEM.prototype = {
|
||||
|
||||
this.fire('dockeditem:drawstart');
|
||||
|
||||
docktitle = create('<div id="dock_item_'+id+'_title" role="menu" aria-haspopup="true" class="'+CSS.dockedtitle+'"></div>');
|
||||
docktitle = create('<div id="dock_item_' + id + '_title" role="menu" aria-haspopup="true" class="' + CSS.dockedtitle + '"></div>');
|
||||
docktitle.append(this.get('title'));
|
||||
dockitem = create('<div id="dock_item_'+id+'" class="'+CSS.dockeditem+'" tabindex="0" rel="'+id+'"></div>');
|
||||
dockitem = create('<div id="dock_item_' + id + '" class="' + CSS.dockeditem + '" tabindex="0" rel="' + id + '"></div>');
|
||||
if (count === 1) {
|
||||
dockitem.addClass('firstdockitem');
|
||||
}
|
||||
@@ -112,7 +112,7 @@ DOCKEDITEM.prototype = {
|
||||
closeiconimg.setAttribute('src', M.util.image_url('t/dockclose', 'moodle'));
|
||||
closeicon = create('<span class="hidepanelicon" tabindex="0"></span>').append(closeiconimg);
|
||||
closeicon.on('forceclose|click', this.hide, this);
|
||||
closeicon.on('dock:actionkey',this.hide, this, {actions:{enter:true,toggle:true}});
|
||||
closeicon.on('dock:actionkey', this.hide, this, {actions: {enter: true, toggle: true}});
|
||||
this.get('commands').append(closeicon);
|
||||
|
||||
this.set('dockTitleNode', docktitle);
|
||||
@@ -126,14 +126,14 @@ DOCKEDITEM.prototype = {
|
||||
* @method show
|
||||
* @return Boolean
|
||||
*/
|
||||
show : function() {
|
||||
show: function() {
|
||||
var dock = this.get('dock'),
|
||||
panel = dock.getPanel(),
|
||||
docktitle = this.get('dockTitleNode');
|
||||
|
||||
dock.hideActive();
|
||||
this.fire('dockeditem:showstart');
|
||||
Y.log('Showing '+this._getLogDescription(), 'debug', LOGNS);
|
||||
Y.log('Showing ' + this._getLogDescription(), 'debug', LOGNS);
|
||||
panel.setHeader(this.get('titlestring'), this.get('commands'));
|
||||
panel.setBody(Y.Node.create('<div class="block_' + this.get('blockclass') + ' block_docked"></div>')
|
||||
.append(this.get('contents')));
|
||||
@@ -156,9 +156,9 @@ DOCKEDITEM.prototype = {
|
||||
* This function hides the item and makes it inactive.
|
||||
* @method hide
|
||||
*/
|
||||
hide : function() {
|
||||
hide: function() {
|
||||
this.fire('dockeditem:hidestart');
|
||||
Y.log('Hiding "'+this._getLogDescription(), 'debug', LOGNS);
|
||||
Y.log('Hiding "' + this._getLogDescription(), 'debug', LOGNS);
|
||||
if (this.active) {
|
||||
// No longer active
|
||||
this.active = false;
|
||||
@@ -176,11 +176,11 @@ DOCKEDITEM.prototype = {
|
||||
* @method toggle
|
||||
* @param {String} action
|
||||
*/
|
||||
toggle : function(action) {
|
||||
toggle: function(action) {
|
||||
var docktitle = this.get('dockTitleNode');
|
||||
if (docktitle.hasClass(CSS.activeitem) && action !== 'expand') {
|
||||
this.hide();
|
||||
} else if (!docktitle.hasClass(CSS.activeitem) && action !== 'collapse') {
|
||||
} else if (!docktitle.hasClass(CSS.activeitem) && action !== 'collapse') {
|
||||
this.show();
|
||||
}
|
||||
},
|
||||
@@ -188,7 +188,7 @@ DOCKEDITEM.prototype = {
|
||||
* This function removes the node and destroys it's bits.
|
||||
* @method remove.
|
||||
*/
|
||||
remove : function () {
|
||||
remove: function() {
|
||||
this.hide();
|
||||
// Return the block to its original position.
|
||||
this.get('block').returnToPage();
|
||||
@@ -202,13 +202,13 @@ DOCKEDITEM.prototype = {
|
||||
* @private
|
||||
* @return {String}
|
||||
*/
|
||||
_getLogDescription : function() {
|
||||
return this.get('titlestring').get('innerHTML')+' ('+this.get('blockinstanceid')+')';
|
||||
_getLogDescription: function() {
|
||||
return this.get('titlestring').get('innerHTML') + ' (' + this.get('blockinstanceid') + ')';
|
||||
}
|
||||
};
|
||||
Y.extend(DOCKEDITEM, Y.Base, DOCKEDITEM.prototype, {
|
||||
NAME : 'moodle-core-dock-dockeditem',
|
||||
ATTRS : {
|
||||
NAME: 'moodle-core-dock-dockeditem',
|
||||
ATTRS: {
|
||||
/**
|
||||
* The block this docked item is associated with.
|
||||
* @attribute block
|
||||
@@ -216,8 +216,8 @@ Y.extend(DOCKEDITEM, Y.Base, DOCKEDITEM.prototype, {
|
||||
* @writeOnce
|
||||
* @required
|
||||
*/
|
||||
block : {
|
||||
writeOnce : 'initOnly'
|
||||
block: {
|
||||
writeOnce: 'initOnly'
|
||||
},
|
||||
/**
|
||||
* The dock itself.
|
||||
@@ -226,24 +226,24 @@ Y.extend(DOCKEDITEM, Y.Base, DOCKEDITEM.prototype, {
|
||||
* @writeOnce
|
||||
* @required
|
||||
*/
|
||||
dock : {
|
||||
writeOnce : 'initOnly'
|
||||
dock: {
|
||||
writeOnce: 'initOnly'
|
||||
},
|
||||
/**
|
||||
* The docked item ID. This will be given by the dock.
|
||||
* @attribute id
|
||||
* @type Number
|
||||
*/
|
||||
id : {},
|
||||
id: {},
|
||||
/**
|
||||
* Block instance id.Taken from the associated block.
|
||||
* @attribute blockinstanceid
|
||||
* @type Number
|
||||
* @writeOnce
|
||||
*/
|
||||
blockinstanceid : {
|
||||
writeOnce : 'initOnly',
|
||||
setter : function(value) {
|
||||
blockinstanceid: {
|
||||
writeOnce: 'initOnly',
|
||||
setter: function(value) {
|
||||
return parseInt(value, 10);
|
||||
}
|
||||
},
|
||||
@@ -253,16 +253,16 @@ Y.extend(DOCKEDITEM, Y.Base, DOCKEDITEM.prototype, {
|
||||
* @type Node
|
||||
* @default null
|
||||
*/
|
||||
title : {
|
||||
value : null
|
||||
title: {
|
||||
value: null
|
||||
},
|
||||
/**
|
||||
* The title string.
|
||||
* @attribute titlestring
|
||||
* @type String
|
||||
*/
|
||||
titlestring : {
|
||||
value : null
|
||||
titlestring: {
|
||||
value: null
|
||||
},
|
||||
/**
|
||||
* The contents of the docked item
|
||||
@@ -271,8 +271,8 @@ Y.extend(DOCKEDITEM, Y.Base, DOCKEDITEM.prototype, {
|
||||
* @writeOnce
|
||||
* @required
|
||||
*/
|
||||
contents : {
|
||||
writeOnce : 'initOnly'
|
||||
contents: {
|
||||
writeOnce: 'initOnly'
|
||||
},
|
||||
/**
|
||||
* Commands associated with the block.
|
||||
@@ -281,8 +281,8 @@ Y.extend(DOCKEDITEM, Y.Base, DOCKEDITEM.prototype, {
|
||||
* @writeOnce
|
||||
* @required
|
||||
*/
|
||||
commands : {
|
||||
writeOnce : 'initOnly'
|
||||
commands: {
|
||||
writeOnce: 'initOnly'
|
||||
},
|
||||
/**
|
||||
* The block class.
|
||||
@@ -291,32 +291,32 @@ Y.extend(DOCKEDITEM, Y.Base, DOCKEDITEM.prototype, {
|
||||
* @writeOnce
|
||||
* @required
|
||||
*/
|
||||
blockclass : {
|
||||
writeOnce : 'initOnly'
|
||||
blockclass: {
|
||||
writeOnce: 'initOnly'
|
||||
},
|
||||
/**
|
||||
* The title node for the docked block.
|
||||
* @attribute dockTitleNode
|
||||
* @type Node
|
||||
*/
|
||||
dockTitleNode : {
|
||||
value : null
|
||||
dockTitleNode: {
|
||||
value: null
|
||||
},
|
||||
/**
|
||||
* The item node for the docked block.
|
||||
* @attribute dockItemNode
|
||||
* @type Node
|
||||
*/
|
||||
dockItemNode : {
|
||||
value : null
|
||||
dockItemNode: {
|
||||
value: null
|
||||
},
|
||||
/**
|
||||
* The container for the docked item (will contain the block contents when visible)
|
||||
* @attribute dockcontainerNode
|
||||
* @type Node
|
||||
*/
|
||||
dockcontainerNode : {
|
||||
value : null
|
||||
dockcontainerNode: {
|
||||
value: null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+4
-4
@@ -81,10 +81,10 @@ M.core.dock.loader.initLoader = function() {
|
||||
callback;
|
||||
dockedblocks.each(function() {
|
||||
var id = parseInt(this.getData('instanceid'), 10);
|
||||
Y.log('Dock loader watching block with instance id: '+id, 'debug', LOADERNAME);
|
||||
Y.log('Dock loader watching block with instance id: ' + id, 'debug', LOADERNAME);
|
||||
M.core.dock.ensureMoveToIconExists(this);
|
||||
});
|
||||
if (dockedblocks.some(function(node){return node.hasClass('dock_on_load');})) {
|
||||
if (dockedblocks.some(function(node) { return node.hasClass('dock_on_load'); })) {
|
||||
Y.log('Loading dock module', 'debug', LOADERNAME);
|
||||
Y.use('moodle-core-dock', function() {
|
||||
M.core.dock.init();
|
||||
@@ -102,8 +102,8 @@ M.core.dock.loader.initLoader = function() {
|
||||
}
|
||||
block.addClass('dock_on_load');
|
||||
Y.log('Loading dock module', 'debug', LOADERNAME);
|
||||
Y.use('moodle-core-dock', function(){
|
||||
M.util.set_user_preference('docked_block_instance_'+instanceid, 1);
|
||||
Y.use('moodle-core-dock', function() {
|
||||
M.util.set_user_preference('docked_block_instance_' + instanceid, 1);
|
||||
M.core.dock.init();
|
||||
});
|
||||
};
|
||||
|
||||
Vendored
+31
-31
@@ -27,46 +27,46 @@ DOCKPANEL.prototype = {
|
||||
* @protected
|
||||
* @type {Boolean}
|
||||
*/
|
||||
created : false,
|
||||
created: false,
|
||||
/**
|
||||
* Called during the initialisation process of the object.
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
Y.log('Panel initialising', 'debug', LOGNS);
|
||||
/**
|
||||
* Fired before the panel is shown.
|
||||
* @event dockpane::beforeshow
|
||||
*/
|
||||
this.publish('dockpanel:beforeshow', {prefix:'dockpanel'});
|
||||
this.publish('dockpanel:beforeshow', {prefix: 'dockpanel'});
|
||||
/**
|
||||
* Fired after the panel is shown.
|
||||
* @event dockpanel:shown
|
||||
*/
|
||||
this.publish('dockpanel:shown', {prefix:'dockpanel'});
|
||||
this.publish('dockpanel:shown', {prefix: 'dockpanel'});
|
||||
/**
|
||||
* Fired before the panel is hidden.
|
||||
* @event dockpane::beforehide
|
||||
*/
|
||||
this.publish('dockpanel:beforehide', {prefix:'dockpanel'});
|
||||
this.publish('dockpanel:beforehide', {prefix: 'dockpanel'});
|
||||
/**
|
||||
* Fired after the panel is hidden.
|
||||
* @event dockpanel:hidden
|
||||
*/
|
||||
this.publish('dockpanel:hidden', {prefix:'dockpanel'});
|
||||
this.publish('dockpanel:hidden', {prefix: 'dockpanel'});
|
||||
/**
|
||||
* Fired when ever the dock panel is either hidden or shown.
|
||||
* Always fired after the shown or hidden events.
|
||||
* @event dockpanel:visiblechange
|
||||
*/
|
||||
this.publish('dockpanel:visiblechange', {prefix:'dockpanel'});
|
||||
this.publish('dockpanel:visiblechange', {prefix: 'dockpanel'});
|
||||
},
|
||||
/**
|
||||
* Creates the Panel if it has not already been created.
|
||||
* @method create
|
||||
* @return {Boolean}
|
||||
*/
|
||||
create : function() {
|
||||
create: function() {
|
||||
if (this.created) {
|
||||
return true;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ DOCKPANEL.prototype = {
|
||||
* Displays the panel.
|
||||
* @method show
|
||||
*/
|
||||
show : function() {
|
||||
show: function() {
|
||||
this.create();
|
||||
this.fire('dockpanel:beforeshow');
|
||||
this.set('visible', true);
|
||||
@@ -97,7 +97,7 @@ DOCKPANEL.prototype = {
|
||||
* Hides the panel
|
||||
* @method hide
|
||||
*/
|
||||
hide : function() {
|
||||
hide: function() {
|
||||
this.fire('dockpanel:beforehide');
|
||||
this.set('visible', false);
|
||||
this.get('node').addClass('dockitempanel_hidden');
|
||||
@@ -109,7 +109,7 @@ DOCKPANEL.prototype = {
|
||||
* @method setHeader
|
||||
* @param {Node|String} content
|
||||
*/
|
||||
setHeader : function(content) {
|
||||
setHeader: function(content) {
|
||||
this.create();
|
||||
var header = this.get('headerNode'),
|
||||
i;
|
||||
@@ -127,7 +127,7 @@ DOCKPANEL.prototype = {
|
||||
* @method setBody
|
||||
* @param {Node|String} content
|
||||
*/
|
||||
setBody : function(content) {
|
||||
setBody: function(content) {
|
||||
this.create();
|
||||
this.get('bodyNode').setContent(content);
|
||||
},
|
||||
@@ -137,18 +137,18 @@ DOCKPANEL.prototype = {
|
||||
* @method setTop
|
||||
* @param {Number} newtop
|
||||
*/
|
||||
setTop : function(newtop) {
|
||||
setTop: function(newtop) {
|
||||
if (Y.UA.ie > 0 && Y.UA.ie < 7) {
|
||||
this.get('node').setY(newtop);
|
||||
} else {
|
||||
this.get('node').setStyle('top', newtop.toString()+'px');
|
||||
this.get('node').setStyle('top', newtop.toString() + 'px');
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Corrects the width of the panel.
|
||||
* @method correctWidth
|
||||
*/
|
||||
correctWidth : function() {
|
||||
correctWidth: function() {
|
||||
var bodyNode = this.get('bodyNode'),
|
||||
// Width of content.
|
||||
width = bodyNode.get('clientWidth'),
|
||||
@@ -167,7 +167,7 @@ DOCKPANEL.prototype = {
|
||||
// + the difference
|
||||
// + any rendering difference (borders, padding)
|
||||
// + 10px to make it look nice.
|
||||
newWidth = width + (scroll - width) + ((offsetWidth - width)*2) + 10;
|
||||
newWidth = width + (scroll - width) + ((offsetWidth - width) * 2) + 10;
|
||||
}
|
||||
|
||||
// Make sure its not more then the maxwidth
|
||||
@@ -177,61 +177,61 @@ DOCKPANEL.prototype = {
|
||||
|
||||
// Set the new width if its more than the old width.
|
||||
if (newWidth > offsetWidth) {
|
||||
this.get('node').setStyle('width', newWidth+'px');
|
||||
this.get('node').setStyle('width', newWidth + 'px');
|
||||
}
|
||||
}
|
||||
};
|
||||
Y.extend(DOCKPANEL, Y.Base, DOCKPANEL.prototype, {
|
||||
NAME : 'moodle-core-dock-panel',
|
||||
ATTRS : {
|
||||
NAME: 'moodle-core-dock-panel',
|
||||
ATTRS: {
|
||||
/**
|
||||
* The dock itself.
|
||||
* @attribute dock
|
||||
* @type DOCK
|
||||
* @writeonce
|
||||
*/
|
||||
dock : {
|
||||
writeOnce : 'initOnly'
|
||||
dock: {
|
||||
writeOnce: 'initOnly'
|
||||
},
|
||||
/**
|
||||
* The node that contains the whole panel.
|
||||
* @attribute node
|
||||
* @type Node
|
||||
*/
|
||||
node : {
|
||||
value : null
|
||||
node: {
|
||||
value: null
|
||||
},
|
||||
/**
|
||||
* The node that contains the header, body and footer.
|
||||
* @attribute contentNode
|
||||
* @type Node
|
||||
*/
|
||||
contentNode : {
|
||||
value : null
|
||||
contentNode: {
|
||||
value: null
|
||||
},
|
||||
/**
|
||||
* The node that contains the header
|
||||
* @attribute headerNode
|
||||
* @type Node
|
||||
*/
|
||||
headerNode : {
|
||||
value : null
|
||||
headerNode: {
|
||||
value: null
|
||||
},
|
||||
/**
|
||||
* The node that contains the body
|
||||
* @attribute bodyNode
|
||||
* @type Node
|
||||
*/
|
||||
bodyNode : {
|
||||
value : null
|
||||
bodyNode: {
|
||||
value: null
|
||||
},
|
||||
/**
|
||||
* True if the panel is currently visible.
|
||||
* @attribute visible
|
||||
* @type Boolean
|
||||
*/
|
||||
visible : {
|
||||
value : false
|
||||
visible: {
|
||||
value: false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+14
-14
@@ -26,7 +26,7 @@ TABHEIGHTMANAGER.prototype = {
|
||||
* events in order to monitor the dock
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
var dock = this.get('dock');
|
||||
dock.on('dock:itemschanged', this.checkSizing, this);
|
||||
Y.on('windowresize', this.checkSizing, this);
|
||||
@@ -35,7 +35,7 @@ TABHEIGHTMANAGER.prototype = {
|
||||
* Check if the size dock items needs to be adjusted
|
||||
* @method checkSizing
|
||||
*/
|
||||
checkSizing : function() {
|
||||
checkSizing: function() {
|
||||
var dock = this.get('dock'),
|
||||
node = dock.get('dockNode'),
|
||||
items = dock.dockeditems,
|
||||
@@ -43,13 +43,13 @@ TABHEIGHTMANAGER.prototype = {
|
||||
dockheight = node.get('offsetHeight') - containermargin,
|
||||
controlheight = node.one('.controls').get('offsetHeight'),
|
||||
buffer = (dock.get('bufferPanel') * 3),
|
||||
possibleheight = dockheight - controlheight - buffer - (items.length*2),
|
||||
possibleheight = dockheight - controlheight - buffer - (items.length * 2),
|
||||
totalheight = 0,
|
||||
id, dockedtitle;
|
||||
if (items.length > 0) {
|
||||
for (id in items) {
|
||||
if (Y.Lang.isNumber(id) || Y.Lang.isString(id)) {
|
||||
dockedtitle = Y.one(items[id].get('title')).ancestor('.'+CSS.dockedtitle);
|
||||
dockedtitle = Y.one(items[id].get('title')).ancestor('.' + CSS.dockedtitle);
|
||||
if (dockedtitle) {
|
||||
if (this.get('enabled')) {
|
||||
dockedtitle.setStyle('height', 'auto');
|
||||
@@ -68,7 +68,7 @@ TABHEIGHTMANAGER.prototype = {
|
||||
* @method enable
|
||||
* @param {Number} possibleheight
|
||||
*/
|
||||
enable : function(possibleheight) {
|
||||
enable: function(possibleheight) {
|
||||
var dock = this.get('dock'),
|
||||
items = dock.dockeditems,
|
||||
count = dock.count,
|
||||
@@ -79,15 +79,15 @@ TABHEIGHTMANAGER.prototype = {
|
||||
this.set('enabled', true);
|
||||
for (id in items) {
|
||||
if (Y.Lang.isNumber(id) || Y.Lang.isString(id)) {
|
||||
itemtitle = Y.one(items[id].get('title')).ancestor('.'+CSS.dockedtitle);
|
||||
itemtitle = Y.one(items[id].get('title')).ancestor('.' + CSS.dockedtitle);
|
||||
if (!itemtitle) {
|
||||
continue;
|
||||
}
|
||||
itemheight = Math.floor((possibleheight-usedheight) / (count - runningcount));
|
||||
itemheight = Math.floor((possibleheight - usedheight) / (count - runningcount));
|
||||
offsetheight = itemtitle.get('offsetHeight');
|
||||
itemtitle.setStyle('overflow', 'hidden');
|
||||
if (offsetheight > itemheight) {
|
||||
itemtitle.setStyle('height', itemheight+'px');
|
||||
itemtitle.setStyle('height', itemheight + 'px');
|
||||
usedheight += itemheight;
|
||||
} else {
|
||||
usedheight += offsetheight;
|
||||
@@ -98,24 +98,24 @@ TABHEIGHTMANAGER.prototype = {
|
||||
}
|
||||
};
|
||||
Y.extend(TABHEIGHTMANAGER, Y.Base, TABHEIGHTMANAGER.prototype, {
|
||||
NAME : 'moodle-core-tabheightmanager',
|
||||
ATTRS : {
|
||||
NAME: 'moodle-core-tabheightmanager',
|
||||
ATTRS: {
|
||||
/**
|
||||
* The dock.
|
||||
* @attribute dock
|
||||
* @type DOCK
|
||||
* @writeOnce
|
||||
*/
|
||||
dock : {
|
||||
writeOnce : 'initOnly'
|
||||
dock: {
|
||||
writeOnce: 'initOnly'
|
||||
},
|
||||
/**
|
||||
* True if the item_sizer is being used, false otherwise.
|
||||
* @attribute enabled
|
||||
* @type Bool
|
||||
*/
|
||||
enabled : {
|
||||
value : false
|
||||
enabled: {
|
||||
value: false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+10
-10
@@ -69,7 +69,7 @@ Y.extend(DRAGDROP, Y.Base, {
|
||||
* @type Object
|
||||
* @default null
|
||||
*/
|
||||
samenodelabel : null,
|
||||
samenodelabel: null,
|
||||
|
||||
/**
|
||||
* The label to use with keyboard drag/drop to describe items of the parent Node.
|
||||
@@ -78,7 +78,7 @@ Y.extend(DRAGDROP, Y.Base, {
|
||||
* @type Object
|
||||
* @default null
|
||||
*/
|
||||
parentnodelabel : null,
|
||||
parentnodelabel: null,
|
||||
|
||||
/**
|
||||
* The groups for this instance.
|
||||
@@ -140,7 +140,7 @@ Y.extend(DRAGDROP, Y.Base, {
|
||||
|
||||
// Make the accessible drag/drop respond to a single click.
|
||||
this.listeners.push(Y.one(Y.config.doc.body).delegate('click', this.global_keydown,
|
||||
'.' + MOVEICON.cssclass , this));
|
||||
'.' + MOVEICON.cssclass, this));
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -193,17 +193,17 @@ Y.extend(DRAGDROP, Y.Base, {
|
||||
},
|
||||
|
||||
lock_drag_handle: function(drag, classname) {
|
||||
drag.removeHandle('.'+classname);
|
||||
drag.removeHandle('.' + classname);
|
||||
},
|
||||
|
||||
unlock_drag_handle: function(drag, classname) {
|
||||
drag.addHandle('.'+classname);
|
||||
drag.addHandle('.' + classname);
|
||||
drag.get('activeHandle').focus();
|
||||
},
|
||||
|
||||
ajax_failure: function(response) {
|
||||
var e = {
|
||||
name: response.status+' '+response.statusText,
|
||||
name: response.status + ' ' + response.statusText,
|
||||
message: response.responseText
|
||||
};
|
||||
return new M.core.exception(e);
|
||||
@@ -247,7 +247,7 @@ Y.extend(DRAGDROP, Y.Base, {
|
||||
if (!this.in_group(drag)) {
|
||||
return;
|
||||
}
|
||||
//Put our general styles back
|
||||
// Put our general styles back
|
||||
drag.get('node').setAttribute('style', this.originalstyle);
|
||||
this.drag_end(e);
|
||||
},
|
||||
@@ -361,7 +361,7 @@ Y.extend(DRAGDROP, Y.Base, {
|
||||
var nodes = n.all('h2, h3, h4, h5, span:not(.actions):not(.menu-action-text), p, div.no-overflow, div.dimmed_text');
|
||||
var text = '';
|
||||
|
||||
nodes.each(function () {
|
||||
nodes.each(function() {
|
||||
if (text === '') {
|
||||
if (Y.Lang.trim(this.get('text')) !== '') {
|
||||
text = this.get('text');
|
||||
@@ -402,7 +402,7 @@ Y.extend(DRAGDROP, Y.Base, {
|
||||
// Search for possible drop targets.
|
||||
var droptargets = Y.all('.' + this.samenodeclass + ', .' + this.parentnodeclass);
|
||||
|
||||
droptargets.each(function (node) {
|
||||
droptargets.each(function(node) {
|
||||
var validdrop = false, labelroot = node;
|
||||
if (node.drop && node.drop.inGroup(this.groups) && node.drop.get('node') !== dragcontainer) {
|
||||
// This is a drag and drop target with the same class as the grabbed node.
|
||||
@@ -601,7 +601,7 @@ Y.extend(DRAGDROP, Y.Base, {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.keyCode === 27 ) {
|
||||
if (e.keyCode === 27) {
|
||||
// Escape to cancel from anywhere.
|
||||
this.global_cancel_keyboard_drag();
|
||||
e.preventDefault();
|
||||
|
||||
+13
-13
@@ -5,7 +5,7 @@ var CSS,
|
||||
|
||||
// The CSS selectors we use
|
||||
CSS = {
|
||||
AUTOSUBMIT : 'autosubmit'
|
||||
AUTOSUBMIT: 'autosubmit'
|
||||
};
|
||||
|
||||
FORMAUTOSUBMIT = function() {
|
||||
@@ -17,7 +17,7 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
|
||||
/*
|
||||
* Initialize the module
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
// Set up local variables
|
||||
var applyto,
|
||||
thisselect;
|
||||
@@ -57,7 +57,7 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
|
||||
/*
|
||||
* Check whether the select element was changed
|
||||
*/
|
||||
check_changed : function(e) {
|
||||
check_changed: function(e) {
|
||||
var select,
|
||||
nothing,
|
||||
startindex,
|
||||
@@ -79,7 +79,7 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
|
||||
}
|
||||
|
||||
// Check whether the field has changed, and is not the 'nothing' value
|
||||
if ((nothing===false || select.get('value') !== nothing)
|
||||
if ((nothing === false || select.get('value') !== nothing)
|
||||
&& startindex !== select.get('selectedIndex') && currentindex !== previousindex) {
|
||||
return select;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
|
||||
/*
|
||||
* Process any changes
|
||||
*/
|
||||
process_changes : function(e) {
|
||||
process_changes: function(e) {
|
||||
var select = this.check_changed(e),
|
||||
form;
|
||||
if (select) {
|
||||
@@ -99,16 +99,16 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
|
||||
}
|
||||
},
|
||||
{
|
||||
NAME : FORMAUTOSUBMITNAME,
|
||||
ATTRS : {
|
||||
selectid : {
|
||||
'value' : ''
|
||||
NAME: FORMAUTOSUBMITNAME,
|
||||
ATTRS: {
|
||||
selectid: {
|
||||
'value': ''
|
||||
},
|
||||
nothing : {
|
||||
'value' : ''
|
||||
nothing: {
|
||||
'value': ''
|
||||
},
|
||||
ignorechangeevent : {
|
||||
'value' : false
|
||||
ignorechangeevent: {
|
||||
'value': false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+9
-9
@@ -20,14 +20,14 @@ var FORMCHANGECHECKERNAME = 'core-formchangechecker',
|
||||
Y.extend(FORMCHANGECHECKER, Y.Base, {
|
||||
|
||||
// The delegated listeners we need to detach after the initial value has been stored once
|
||||
initialvaluelisteners : [],
|
||||
initialvaluelisteners: [],
|
||||
|
||||
/**
|
||||
* Initialize the module
|
||||
*
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
var formid = 'form#' + this.get('formid'),
|
||||
currentform = Y.one(formid);
|
||||
|
||||
@@ -64,7 +64,7 @@ Y.extend(FORMCHANGECHECKER, Y.Base, {
|
||||
* @method store_initial_value
|
||||
* @param {EventFacade} e
|
||||
*/
|
||||
store_initial_value : function(e) {
|
||||
store_initial_value: function(e) {
|
||||
var thisevent;
|
||||
if (e.target.hasClass('ignoredirty')) {
|
||||
// Don't warn on elements with the ignoredirty class
|
||||
@@ -83,16 +83,16 @@ Y.extend(FORMCHANGECHECKER, Y.Base, {
|
||||
// Make a note of the current element so that it can be interrogated and
|
||||
// compared in the get_form_dirty_state function
|
||||
M.core_formchangechecker.stateinformation.focused_element = {
|
||||
element : e.target,
|
||||
initial_value : e.target.get('value')
|
||||
element: e.target,
|
||||
initial_value: e.target.get('value')
|
||||
};
|
||||
}
|
||||
},
|
||||
{
|
||||
NAME : FORMCHANGECHECKERNAME,
|
||||
ATTRS : {
|
||||
formid : {
|
||||
'value' : ''
|
||||
NAME: FORMCHANGECHECKERNAME,
|
||||
ATTRS: {
|
||||
formid: {
|
||||
'value': ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -58,27 +58,27 @@ Y.extend(Confirmation, Y.Base, {
|
||||
var selectedLangCodes = [];
|
||||
var selectedLangNames = [];
|
||||
|
||||
Y.all(SELECTORS.UNINSTALLSELECT).each(function(option){
|
||||
if (option.get('selected')){
|
||||
Y.all(SELECTORS.UNINSTALLSELECT).each(function(option) {
|
||||
if (option.get('selected')) {
|
||||
selectedLangCodes.push(option.getAttribute('value'));
|
||||
selectedLangNames.push(option.get('text'));
|
||||
}
|
||||
});
|
||||
// Nothing was selected, show warning.
|
||||
if (selectedLangCodes.length === 0){
|
||||
new M.core.alert({ message: M.util.get_string('selectlangs', 'tool_langimport') }).show();
|
||||
if (selectedLangCodes.length === 0) {
|
||||
new M.core.alert({message: M.util.get_string('selectlangs', 'tool_langimport')}).show();
|
||||
return;
|
||||
} else if (selectedLangCodes.indexOf('en')> -1) { // Don't uninstall english.
|
||||
Y.one(SELECTORS.ENGLISHOPTION).set('selected',false);
|
||||
new M.core.alert({ message: M.util.get_string('noenglishuninstall', 'tool_langimport') }).show();
|
||||
} else if (selectedLangCodes.indexOf('en') > -1) { // Don't uninstall english.
|
||||
Y.one(SELECTORS.ENGLISHOPTION).set('selected', false);
|
||||
new M.core.alert({message: M.util.get_string('noenglishuninstall', 'tool_langimport')}).show();
|
||||
return;
|
||||
}
|
||||
var confirmationConfig = {
|
||||
modal: true,
|
||||
visible : false,
|
||||
centered : true,
|
||||
title : M.util.get_string('uninstall','tool_langimport'),
|
||||
question : M.util.get_string('uninstallconfirm','tool_langimport', selectedLangNames.join(", "))
|
||||
visible: false,
|
||||
centered: true,
|
||||
title: M.util.get_string('uninstall', 'tool_langimport'),
|
||||
question: M.util.get_string('uninstallconfirm', 'tool_langimport', selectedLangNames.join(", "))
|
||||
};
|
||||
new M.core.confirm(confirmationConfig)
|
||||
.show()
|
||||
@@ -93,7 +93,7 @@ Y.extend(Confirmation, Y.Base, {
|
||||
* @param {EventFacade} e
|
||||
* @param {Array} langCodes array of lang codes to be uninstalled
|
||||
*/
|
||||
_uninstall : function(e, langCodes) {
|
||||
_uninstall: function(e, langCodes) {
|
||||
Y.config.win.location.href = this.get('uninstallUrl') + '?mode=4' +
|
||||
'&sesskey=' + M.cfg.sesskey +
|
||||
'&confirmtouninstall=' + langCodes.join('-');
|
||||
|
||||
+26
-26
@@ -25,47 +25,47 @@ AJAXEXCEPTION = function(config) {
|
||||
AJAXEXCEPTION.superclass.constructor.apply(this, [config]);
|
||||
};
|
||||
Y.extend(AJAXEXCEPTION, M.core.notification.info, {
|
||||
_keypress : null,
|
||||
initializer : function(config) {
|
||||
_keypress: null,
|
||||
initializer: function(config) {
|
||||
var content,
|
||||
self = this,
|
||||
delay = this.get('hideTimeoutDelay');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + Y.Escape.html(config.name) + '</h1>',
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + Y.Escape.html(config.name) + '</h1>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-ajaxexception"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+Y.Escape.html(this.get('error'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">' + Y.Escape.html(this.get('error')) + '</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>URL:</label> ' +
|
||||
this.get('reproductionlink')+'</div>'))
|
||||
this.get('reproductionlink') + '</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>Debug info:</label> ' +
|
||||
Y.Escape.html(this.get('debuginfo'))+'</div>'))
|
||||
Y.Escape.html(this.get('debuginfo')) + '</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-stacktrace">' +
|
||||
'<label>Stack trace:</label> <pre>' +
|
||||
Y.Escape.html(this.get('stacktrace'))+'</pre></div>'));
|
||||
Y.Escape.html(this.get('stacktrace')) + '</pre></div>'));
|
||||
if (M.cfg.developerdebug) {
|
||||
content.all('.moodle-exception-param').removeClass('hidden');
|
||||
}
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
|
||||
if (delay) {
|
||||
this._hideTimeout = setTimeout(function(){self.hide();}, delay);
|
||||
this._hideTimeout = setTimeout(function() { self.hide(); }, delay);
|
||||
}
|
||||
this.after('visibleChange', this.visibilityChanged, this);
|
||||
this._keypress = Y.on('key', this.hide, window, 'down:13, 27', this);
|
||||
this.centerDialogue();
|
||||
},
|
||||
visibilityChanged : function(e) {
|
||||
visibilityChanged: function(e) {
|
||||
if (e.attrName === 'visible' && e.prevVal && !e.newVal) {
|
||||
var self = this;
|
||||
this._keypress.detach();
|
||||
setTimeout(function(){self.destroy();}, 1000);
|
||||
setTimeout(function() { self.destroy(); }, 1000);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
NAME : AJAXEXCEPTION_NAME,
|
||||
CSS_PREFIX : DIALOGUE_PREFIX,
|
||||
ATTRS : {
|
||||
NAME: AJAXEXCEPTION_NAME,
|
||||
CSS_PREFIX: DIALOGUE_PREFIX,
|
||||
ATTRS: {
|
||||
|
||||
/**
|
||||
* The error message given in the exception.
|
||||
@@ -75,8 +75,8 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
|
||||
* @default 'Unknown error'
|
||||
* @optional
|
||||
*/
|
||||
error : {
|
||||
validator : Y.Lang.isString,
|
||||
error: {
|
||||
validator: Y.Lang.isString,
|
||||
value: M.util.get_string('unknownerror', 'moodle')
|
||||
},
|
||||
|
||||
@@ -88,8 +88,8 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
|
||||
* @default null
|
||||
* @optional
|
||||
*/
|
||||
debuginfo : {
|
||||
value : null
|
||||
debuginfo: {
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -100,8 +100,8 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
|
||||
* @default null
|
||||
* @optional
|
||||
*/
|
||||
stacktrace : {
|
||||
value : null
|
||||
stacktrace: {
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -112,15 +112,15 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
|
||||
* @default null
|
||||
* @optional
|
||||
*/
|
||||
reproductionlink : {
|
||||
setter : function(link) {
|
||||
reproductionlink: {
|
||||
setter: function(link) {
|
||||
if (link !== null) {
|
||||
link = Y.Escape.html(link);
|
||||
link = '<a href="'+link+'">'+link.replace(M.cfg.wwwroot, '')+'</a>';
|
||||
link = '<a href="' + link + '">' + link.replace(M.cfg.wwwroot, '') + '</a>';
|
||||
}
|
||||
return link;
|
||||
},
|
||||
value : null
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -131,9 +131,9 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
|
||||
* @default null
|
||||
* @optional
|
||||
*/
|
||||
hideTimeoutDelay : {
|
||||
validator : Y.Lang.isNumber,
|
||||
value : null
|
||||
hideTimeoutDelay: {
|
||||
validator: Y.Lang.isNumber,
|
||||
value: null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+3
-3
@@ -35,15 +35,15 @@ Y.extend(ALERT, M.core.notification.info, {
|
||||
this._closeEvents = [];
|
||||
this.publish('complete');
|
||||
var yes = Y.Node.create('<input type="button" id="id_yuialertconfirm-' + this.get('COUNT') + '"' +
|
||||
'value="'+this.get(CONFIRMYES)+'" />'),
|
||||
'value="' + this.get(CONFIRMYES) + '" />'),
|
||||
content = Y.Node.create('<div class="confirmation-dialogue"></div>')
|
||||
.append(Y.Node.create('<div class="confirmation-message">'+this.get('message')+'</div>'))
|
||||
.append(Y.Node.create('<div class="confirmation-message">' + this.get('message') + '</div>'))
|
||||
.append(Y.Node.create('<div class="confirmation-buttons"></div>')
|
||||
.append(yes));
|
||||
this.get(BASE).addClass('moodle-dialogue-confirm');
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
|
||||
this._closeEvents.push(
|
||||
Y.on('key', this.submit, window, 'down:13', this),
|
||||
|
||||
+3
-3
@@ -64,9 +64,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
|
||||
this.publish('complete-yes');
|
||||
this.publish('complete-no');
|
||||
this._yesButton = Y.Node.create('<input type="button" id="id_yuiconfirmyes-' +
|
||||
this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />');
|
||||
this.get('COUNT') + '" value="' + this.get(CONFIRMYES) + '" />');
|
||||
this._noButton = Y.Node.create('<input type="button" id="id_yuiconfirmno-' +
|
||||
this.get('COUNT') + '" value="'+this.get(CONFIRMNO)+'" />');
|
||||
this.get('COUNT') + '" value="' + this.get(CONFIRMNO) + '" />');
|
||||
this._question = Y.Node.create('<div class="confirmation-message">' + this.get(QUESTION) + '</div>');
|
||||
var content = Y.Node.create('<div class="confirmation-dialogue"></div>')
|
||||
.append(this._question)
|
||||
@@ -76,7 +76,7 @@ Y.extend(CONFIRM, M.core.notification.info, {
|
||||
this.get(BASE).addClass('moodle-dialogue-confirm');
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
|
||||
this._closeEvents.push(
|
||||
Y.on('key', this.submit, window, 'down:27', this, false),
|
||||
|
||||
+57
-57
@@ -11,7 +11,7 @@ var DIALOGUE_NAME = 'Moodle dialogue',
|
||||
DIALOGUE,
|
||||
DIALOGUE_FULLSCREEN_CLASS = DIALOGUE_PREFIX + '-fullscreen',
|
||||
DIALOGUE_HIDDEN_CLASS = DIALOGUE_PREFIX + '-hidden',
|
||||
DIALOGUE_SELECTOR =' [role=dialog]',
|
||||
DIALOGUE_SELECTOR = ' [role=dialog]',
|
||||
MENUBAR_SELECTOR = '[role=menubar]',
|
||||
DOT = '.',
|
||||
HAS_ZINDEX = 'moodle-has-zindex',
|
||||
@@ -30,19 +30,19 @@ DIALOGUE = function(c) {
|
||||
config.COUNT = Y.stamp(this);
|
||||
var id = 'moodle-dialogue-' + config.COUNT;
|
||||
config.notificationBase =
|
||||
Y.Node.create('<div class="'+CSS.BASE+'">')
|
||||
Y.Node.create('<div class="' + CSS.BASE + '">')
|
||||
.append(Y.Node.create('<div id="' + id + '" role="dialog" ' +
|
||||
'aria-labelledby="' + id + '-header-text" class="' + CSS.WRAP + '"></div>')
|
||||
.append(Y.Node.create('<div id="' + id + '-header-text" class="'+CSS.HEADER+' yui3-widget-hd"></div>'))
|
||||
.append(Y.Node.create('<div class="'+CSS.BODY+' yui3-widget-bd"></div>'))
|
||||
.append(Y.Node.create('<div class="'+CSS.FOOTER+' yui3-widget-ft"></div>')));
|
||||
.append(Y.Node.create('<div id="' + id + '-header-text" class="' + CSS.HEADER + ' yui3-widget-hd"></div>'))
|
||||
.append(Y.Node.create('<div class="' + CSS.BODY + ' yui3-widget-bd"></div>'))
|
||||
.append(Y.Node.create('<div class="' + CSS.FOOTER + ' yui3-widget-ft"></div>')));
|
||||
Y.one(document.body).append(config.notificationBase);
|
||||
|
||||
if (config.additionalBaseClass) {
|
||||
config.notificationBase.addClass(config.additionalBaseClass);
|
||||
}
|
||||
|
||||
config.srcNode = '#'+id;
|
||||
config.srcNode = '#' + id;
|
||||
|
||||
// closeButton param to keep the stable versions API.
|
||||
if (config.closeButton === false) {
|
||||
@@ -52,7 +52,7 @@ DIALOGUE = function(c) {
|
||||
{
|
||||
section: Y.WidgetStdMod.HEADER,
|
||||
classNames: 'closebutton',
|
||||
action: function () {
|
||||
action: function() {
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
@@ -67,10 +67,10 @@ DIALOGUE = function(c) {
|
||||
};
|
||||
Y.extend(DIALOGUE, Y.Panel, {
|
||||
// Window resize event listener.
|
||||
_resizeevent : null,
|
||||
_resizeevent: null,
|
||||
// Orientation change event listener.
|
||||
_orientationevent : null,
|
||||
_calculatedzindex : false,
|
||||
_orientationevent: null,
|
||||
_calculatedzindex: false,
|
||||
|
||||
/**
|
||||
* The original position of the dialogue before it was reposition to
|
||||
@@ -97,7 +97,7 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
*
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
var bb;
|
||||
|
||||
// Initialise the element cache.
|
||||
@@ -152,7 +152,7 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
}, this);
|
||||
|
||||
// Remove the dialogue from the DOM when it is destroyed.
|
||||
this.after('destroyedChange', function(){
|
||||
this.after('destroyedChange', function() {
|
||||
this.get(BASE).remove(true);
|
||||
}, this);
|
||||
},
|
||||
@@ -163,7 +163,7 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
*
|
||||
* @method applyZIndex
|
||||
*/
|
||||
applyZIndex : function() {
|
||||
applyZIndex: function() {
|
||||
var highestzindex = 1,
|
||||
zindexvalue = 1,
|
||||
bb = this.get('boundingBox'),
|
||||
@@ -174,7 +174,7 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
bb.setStyle('zIndex', zindex);
|
||||
} else {
|
||||
// Determine the correct zindex by looking at all existing dialogs and menubars in the page.
|
||||
Y.all(DIALOGUE_SELECTOR + ', ' + MENUBAR_SELECTOR + ', ' + DOT + HAS_ZINDEX).each(function (node) {
|
||||
Y.all(DIALOGUE_SELECTOR + ', ' + MENUBAR_SELECTOR + ', ' + DOT + HAS_ZINDEX).each(function(node) {
|
||||
var zindex = this.findZIndex(node);
|
||||
if (zindex > highestzindex) {
|
||||
highestzindex = zindex;
|
||||
@@ -210,7 +210,7 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
* @param {Node} node The Node to apply the zIndex to.
|
||||
* @return {Number} Either the zIndex, or 0 if one was not found.
|
||||
*/
|
||||
findZIndex : function(node) {
|
||||
findZIndex: function(node) {
|
||||
// In most cases the zindex is set on the parent of the dialog.
|
||||
var zindex = node.getStyle('zIndex') || node.ancestor().getStyle('zIndex');
|
||||
if (zindex) {
|
||||
@@ -225,7 +225,7 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
* @method visibilityChanged
|
||||
* @param {EventFacade} e
|
||||
*/
|
||||
visibilityChanged : function(e) {
|
||||
visibilityChanged: function(e) {
|
||||
var titlebar, bb;
|
||||
if (e.attrName === 'visible') {
|
||||
this.get('maskNode').addClass(CSS.LIGHTBOX);
|
||||
@@ -256,7 +256,7 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
if (!this.shouldResizeFullscreen()) {
|
||||
if (this.get('draggable')) {
|
||||
titlebar = '#' + this.get('id') + ' .' + CSS.HEADER;
|
||||
this.plug(Y.Plugin.Drag, {handles : [titlebar]});
|
||||
this.plug(Y.Plugin.Drag, {handles: [titlebar]});
|
||||
Y.one(titlebar).setStyle('cursor', 'move');
|
||||
}
|
||||
}
|
||||
@@ -280,7 +280,7 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
*
|
||||
* @method makeResponsive
|
||||
*/
|
||||
makeResponsive : function() {
|
||||
makeResponsive: function() {
|
||||
var bb = this.get('boundingBox');
|
||||
|
||||
if (this.shouldResizeFullscreen()) {
|
||||
@@ -290,18 +290,18 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
// Size and position the fullscreen dialog.
|
||||
|
||||
bb.addClass(DIALOGUE_FULLSCREEN_CLASS);
|
||||
bb.setStyles({'left' : null,
|
||||
'top' : null,
|
||||
'width' : null,
|
||||
'height' : null,
|
||||
'right' : null,
|
||||
'bottom' : null});
|
||||
bb.setStyles({'left': null,
|
||||
'top': null,
|
||||
'width': null,
|
||||
'height': null,
|
||||
'right': null,
|
||||
'bottom': null});
|
||||
} else {
|
||||
if (this.get('responsive')) {
|
||||
// We must reset any of the fullscreen changes.
|
||||
bb.removeClass(DIALOGUE_FULLSCREEN_CLASS)
|
||||
.setStyles({'width' : this.get('width'),
|
||||
'height' : this.get('height')});
|
||||
.setStyles({'width': this.get('width'),
|
||||
'height': this.get('height')});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
*
|
||||
* @method centerDialogue
|
||||
*/
|
||||
centerDialogue : function() {
|
||||
centerDialogue: function() {
|
||||
var bb = this.get('boundingBox'),
|
||||
hidden = bb.hasClass(DIALOGUE_HIDDEN_CLASS),
|
||||
x,
|
||||
@@ -328,9 +328,9 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
if (hidden) {
|
||||
bb.setStyle('top', '-1000px').removeClass(DIALOGUE_HIDDEN_CLASS);
|
||||
}
|
||||
x = Math.max(Math.round((bb.get('winWidth') - bb.get('offsetWidth'))/2), 15);
|
||||
y = Math.max(Math.round((bb.get('winHeight') - bb.get('offsetHeight'))/2), 15) + Y.one(window).get('scrollTop');
|
||||
bb.setStyles({ 'left' : x, 'top' : y});
|
||||
x = Math.max(Math.round((bb.get('winWidth') - bb.get('offsetWidth')) / 2), 15);
|
||||
y = Math.max(Math.round((bb.get('winHeight') - bb.get('offsetHeight')) / 2), 15) + Y.one(window).get('scrollTop');
|
||||
bb.setStyles({'left': x, 'top': y});
|
||||
|
||||
if (hidden) {
|
||||
bb.addClass(DIALOGUE_HIDDEN_CLASS);
|
||||
@@ -346,7 +346,7 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
* @method shouldResizeFullscreen
|
||||
* @return {Boolean}
|
||||
*/
|
||||
shouldResizeFullscreen : function() {
|
||||
shouldResizeFullscreen: function() {
|
||||
return (window === window.parent) && this.get('responsive') &&
|
||||
Math.floor(Y.one(document.body).get('winWidth')) < this.get('responsiveWidth');
|
||||
},
|
||||
@@ -404,9 +404,9 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
*
|
||||
* @method keyDelegation
|
||||
*/
|
||||
keyDelegation : function() {
|
||||
keyDelegation: function() {
|
||||
var bb = this.get('boundingBox');
|
||||
bb.delegate('key', function(e){
|
||||
bb.delegate('key', function(e) {
|
||||
var target = e.target;
|
||||
var direction = 'forward';
|
||||
if (e.shiftKey) {
|
||||
@@ -426,7 +426,7 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
* @param {string} direction tab key for forward and tab+shift for backward
|
||||
* @return {Boolean} The result of the focus action.
|
||||
*/
|
||||
trapFocus : function(target, direction) {
|
||||
trapFocus: function(target, direction) {
|
||||
var bb = this.get('boundingBox'),
|
||||
firstitem = bb.one(CAN_RECEIVE_FOCUS_SELECTOR),
|
||||
lastitem = bb.all(CAN_RECEIVE_FOCUS_SELECTOR).pop();
|
||||
@@ -503,10 +503,10 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
this._hiddenSiblings = [];
|
||||
}
|
||||
}, {
|
||||
NAME : DIALOGUE_NAME,
|
||||
CSS_PREFIX : DIALOGUE_PREFIX,
|
||||
ATTRS : {
|
||||
notificationBase : {
|
||||
NAME: DIALOGUE_NAME,
|
||||
CSS_PREFIX: DIALOGUE_PREFIX,
|
||||
ATTRS: {
|
||||
notificationBase: {
|
||||
|
||||
},
|
||||
|
||||
@@ -539,9 +539,9 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
* @type Boolean
|
||||
* @default true
|
||||
*/
|
||||
closeButton : {
|
||||
validator : Y.Lang.isBoolean,
|
||||
value : true
|
||||
closeButton: {
|
||||
validator: Y.Lang.isBoolean,
|
||||
value: true
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -551,8 +551,8 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
* @type String
|
||||
* @default 'Close'
|
||||
*/
|
||||
closeButtonTitle : {
|
||||
validator : Y.Lang.isString,
|
||||
closeButtonTitle: {
|
||||
validator: Y.Lang.isString,
|
||||
value: M.util.get_string('closebuttontitle', 'moodle')
|
||||
},
|
||||
|
||||
@@ -563,9 +563,9 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
* @type Boolean
|
||||
* @default true
|
||||
*/
|
||||
center : {
|
||||
validator : Y.Lang.isBoolean,
|
||||
value : true
|
||||
center: {
|
||||
validator: Y.Lang.isBoolean,
|
||||
value: true
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -575,9 +575,9 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
* @type Boolean
|
||||
* @default false
|
||||
*/
|
||||
draggable : {
|
||||
validator : Y.Lang.isBoolean,
|
||||
value : false
|
||||
draggable: {
|
||||
validator: Y.Lang.isBoolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -598,9 +598,9 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
* @type Boolean
|
||||
* @default true
|
||||
*/
|
||||
responsive : {
|
||||
validator : Y.Lang.isBoolean,
|
||||
value : true
|
||||
responsive: {
|
||||
validator: Y.Lang.isBoolean,
|
||||
value: true
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -610,8 +610,8 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
* @type Number
|
||||
* @default 768
|
||||
*/
|
||||
responsiveWidth : {
|
||||
value : 768
|
||||
responsiveWidth: {
|
||||
value: 768
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -697,9 +697,9 @@ Y.Base.modifyAttrs(DIALOGUE, {
|
||||
* @type Boolean
|
||||
* @default true
|
||||
*/
|
||||
render : {
|
||||
value : true,
|
||||
writeOnce : true
|
||||
render: {
|
||||
value: true,
|
||||
writeOnce: true
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
+30
-30
@@ -21,7 +21,7 @@ var EXCEPTION_NAME = 'Moodle exception',
|
||||
*/
|
||||
EXCEPTION = function(c) {
|
||||
var config = Y.mix({}, c);
|
||||
config.width = config.width || (M.cfg.developerdebug)?Math.floor(Y.one(document.body).get('winWidth')/3)+'px':null;
|
||||
config.width = config.width || (M.cfg.developerdebug) ? Math.floor(Y.one(document.body).get('winWidth') / 3) + 'px' : null;
|
||||
config.closeButton = true;
|
||||
|
||||
// We need to whitelist some properties which are part of the exception
|
||||
@@ -40,50 +40,50 @@ EXCEPTION = function(c) {
|
||||
EXCEPTION.superclass.constructor.apply(this, [config]);
|
||||
};
|
||||
Y.extend(EXCEPTION, M.core.notification.info, {
|
||||
_hideTimeout : null,
|
||||
_keypress : null,
|
||||
initializer : function(config) {
|
||||
_hideTimeout: null,
|
||||
_keypress: null,
|
||||
initializer: function(config) {
|
||||
var content,
|
||||
self = this,
|
||||
delay = this.get('hideTimeoutDelay');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-'+config.COUNT+'-header-text">' + Y.Escape.html(config.name) + '</h1>',
|
||||
'<h1 id="moodle-dialogue-' + config.COUNT + '-header-text">' + Y.Escape.html(config.name) + '</h1>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-exception"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+Y.Escape.html(this.get('message'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">' + Y.Escape.html(this.get('message')) + '</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-filename"><label>File:</label> ' +
|
||||
Y.Escape.html(this.get('fileName'))+'</div>'))
|
||||
Y.Escape.html(this.get('fileName')) + '</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-linenumber"><label>Line:</label> ' +
|
||||
Y.Escape.html(this.get('lineNumber'))+'</div>'))
|
||||
Y.Escape.html(this.get('lineNumber')) + '</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-stacktrace">' +
|
||||
'<label>Stack trace:</label> <pre>' +
|
||||
this.get('stack')+'</pre></div>'));
|
||||
this.get('stack') + '</pre></div>'));
|
||||
if (M.cfg.developerdebug) {
|
||||
content.all('.moodle-exception-param').removeClass('hidden');
|
||||
}
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
|
||||
if (delay) {
|
||||
this._hideTimeout = setTimeout(function(){self.hide();}, delay);
|
||||
this._hideTimeout = setTimeout(function() { self.hide(); }, delay);
|
||||
}
|
||||
this.after('visibleChange', this.visibilityChanged, this);
|
||||
this._keypress = Y.on('key', this.hide, window, 'down:13,27', this);
|
||||
this.centerDialogue();
|
||||
},
|
||||
visibilityChanged : function(e) {
|
||||
visibilityChanged: function(e) {
|
||||
if (e.attrName === 'visible' && e.prevVal && !e.newVal) {
|
||||
if (this._keypress) {
|
||||
this._keypress.detach();
|
||||
}
|
||||
var self = this;
|
||||
setTimeout(function(){self.destroy();}, 1000);
|
||||
setTimeout(function() { self.destroy(); }, 1000);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
NAME : EXCEPTION_NAME,
|
||||
CSS_PREFIX : DIALOGUE_PREFIX,
|
||||
ATTRS : {
|
||||
NAME: EXCEPTION_NAME,
|
||||
CSS_PREFIX: DIALOGUE_PREFIX,
|
||||
ATTRS: {
|
||||
/**
|
||||
* The message of the alert.
|
||||
*
|
||||
@@ -91,8 +91,8 @@ Y.extend(EXCEPTION, M.core.notification.info, {
|
||||
* @type String
|
||||
* @default ''
|
||||
*/
|
||||
message : {
|
||||
value : ''
|
||||
message: {
|
||||
value: ''
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -102,8 +102,8 @@ Y.extend(EXCEPTION, M.core.notification.info, {
|
||||
* @type String
|
||||
* @default ''
|
||||
*/
|
||||
name : {
|
||||
value : ''
|
||||
name: {
|
||||
value: ''
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -113,8 +113,8 @@ Y.extend(EXCEPTION, M.core.notification.info, {
|
||||
* @type String
|
||||
* @default ''
|
||||
*/
|
||||
fileName : {
|
||||
value : ''
|
||||
fileName: {
|
||||
value: ''
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -124,8 +124,8 @@ Y.extend(EXCEPTION, M.core.notification.info, {
|
||||
* @type String
|
||||
* @default ''
|
||||
*/
|
||||
lineNumber : {
|
||||
value : ''
|
||||
lineNumber: {
|
||||
value: ''
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -135,10 +135,10 @@ Y.extend(EXCEPTION, M.core.notification.info, {
|
||||
* @type String
|
||||
* @default ''
|
||||
*/
|
||||
stack : {
|
||||
setter : function(str) {
|
||||
stack: {
|
||||
setter: function(str) {
|
||||
var lines = Y.Escape.html(str).split("\n"),
|
||||
pattern = new RegExp('^(.+)@('+M.cfg.wwwroot+')?(.{0,75}).*:(\\d+)$'),
|
||||
pattern = new RegExp('^(.+)@(' + M.cfg.wwwroot + ')?(.{0,75}).*:(\\d+)$'),
|
||||
i;
|
||||
for (i in lines) {
|
||||
lines[i] = lines[i].replace(pattern,
|
||||
@@ -148,7 +148,7 @@ Y.extend(EXCEPTION, M.core.notification.info, {
|
||||
}
|
||||
return lines.join('');
|
||||
},
|
||||
value : ''
|
||||
value: ''
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -159,9 +159,9 @@ Y.extend(EXCEPTION, M.core.notification.info, {
|
||||
* @default null
|
||||
* @optional
|
||||
*/
|
||||
hideTimeoutDelay : {
|
||||
validator : Y.Lang.isNumber,
|
||||
value : null
|
||||
hideTimeoutDelay: {
|
||||
validator: Y.Lang.isNumber,
|
||||
value: null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+8
-8
@@ -14,14 +14,14 @@ CONFIRMNO = 'noLabel',
|
||||
TITLE = 'title',
|
||||
QUESTION = 'question',
|
||||
CSS = {
|
||||
BASE : 'moodle-dialogue-base',
|
||||
WRAP : 'moodle-dialogue-wrap',
|
||||
HEADER : 'moodle-dialogue-hd',
|
||||
BODY : 'moodle-dialogue-bd',
|
||||
CONTENT : 'moodle-dialogue-content',
|
||||
FOOTER : 'moodle-dialogue-ft',
|
||||
HIDDEN : 'hidden',
|
||||
LIGHTBOX : 'moodle-dialogue-lightbox'
|
||||
BASE: 'moodle-dialogue-base',
|
||||
WRAP: 'moodle-dialogue-wrap',
|
||||
HEADER: 'moodle-dialogue-hd',
|
||||
BODY: 'moodle-dialogue-bd',
|
||||
CONTENT: 'moodle-dialogue-content',
|
||||
FOOTER: 'moodle-dialogue-ft',
|
||||
HIDDEN: 'hidden',
|
||||
LIGHTBOX: 'moodle-dialogue-lightbox'
|
||||
};
|
||||
|
||||
// Set up the namespace once.
|
||||
|
||||
+29
-29
@@ -6,12 +6,12 @@
|
||||
|
||||
// The CSS selectors we use.
|
||||
var CSS = {
|
||||
AIRNOTIFIERCONTENT : 'fieldset#messageprocessor_airnotifier',
|
||||
HIDEDEVICE : 'a.hidedevice',
|
||||
DEVICELI : 'li.airnotifierdevice',
|
||||
DIMCLASS : 'dimmed',
|
||||
DIMMEDTEXT : 'dimmed_text',
|
||||
DEVICEIDPREFIX : 'deviceid-'
|
||||
AIRNOTIFIERCONTENT: 'fieldset#messageprocessor_airnotifier',
|
||||
HIDEDEVICE: 'a.hidedevice',
|
||||
DEVICELI: 'li.airnotifierdevice',
|
||||
DIMCLASS: 'dimmed',
|
||||
DIMMEDTEXT: 'dimmed_text',
|
||||
DEVICEIDPREFIX: 'deviceid-'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ Y.extend(TOOLBOX, Y.Base, {
|
||||
* @param callback The callback to apply
|
||||
* @param cursor An optional cursor style to apply
|
||||
*/
|
||||
replace_button : function(toolboxtarget, selector, callback, cursor) {
|
||||
replace_button: function(toolboxtarget, selector, callback, cursor) {
|
||||
if (!cursor) {
|
||||
// Set the default cursor type to pointer to match the anchor.
|
||||
cursor = 'pointer';
|
||||
@@ -51,7 +51,7 @@ Y.extend(TOOLBOX, Y.Base, {
|
||||
* Toggle the visibility and availability for the specified
|
||||
* device show/hide button
|
||||
*/
|
||||
toggle_hide_device_ui : function(button) {
|
||||
toggle_hide_device_ui: function(button) {
|
||||
|
||||
var element = button.ancestor(CSS.DEVICELI);
|
||||
var hideicon = button.one('img');
|
||||
@@ -70,9 +70,9 @@ Y.extend(TOOLBOX, Y.Base, {
|
||||
// We need to toggle dimming on the description too element.all(CSS.CONTENTAFTERLINK).toggleClass(CSS.DIMMEDTEXT);.
|
||||
var newstring = M.util.get_string(status, 'moodle');
|
||||
hideicon.setAttrs({
|
||||
'alt' : newstring,
|
||||
'title' : newstring,
|
||||
'src' : M.util.image_url('t/' + status)
|
||||
'alt': newstring,
|
||||
'title': newstring,
|
||||
'src': M.util.image_url('t/' + status)
|
||||
});
|
||||
button.set('title', newstring);
|
||||
button.set('className', 'editing_' + status);
|
||||
@@ -85,7 +85,7 @@ Y.extend(TOOLBOX, Y.Base, {
|
||||
* @param callbacksuccess Call back on success
|
||||
* @return response responseText field from responce
|
||||
*/
|
||||
send_request : function(data, statusspinner, callbacksuccess) {
|
||||
send_request: function(data, statusspinner, callbacksuccess) {
|
||||
// Default data structure
|
||||
if (!data) {
|
||||
data = {};
|
||||
@@ -126,7 +126,7 @@ Y.extend(TOOLBOX, Y.Base, {
|
||||
statusspinner.hide();
|
||||
}
|
||||
},
|
||||
failure : function(tid, response) {
|
||||
failure: function(tid, response) {
|
||||
if (statusspinner) {
|
||||
statusspinner.hide();
|
||||
}
|
||||
@@ -149,18 +149,18 @@ Y.extend(TOOLBOX, Y.Base, {
|
||||
* @param element The <li> element to determine a module-id number for
|
||||
* @return string The module ID
|
||||
*/
|
||||
get_element_id : function(element) {
|
||||
get_element_id: function(element) {
|
||||
return element.get('id').replace(CSS.DEVICEIDPREFIX, '');
|
||||
}
|
||||
},
|
||||
{
|
||||
NAME : 'device-toolbox',
|
||||
ATTRS : {
|
||||
ajaxurl : {
|
||||
'value' : 0
|
||||
NAME: 'device-toolbox',
|
||||
ATTRS: {
|
||||
ajaxurl: {
|
||||
'value': 0
|
||||
},
|
||||
config : {
|
||||
'value' : 0
|
||||
config: {
|
||||
'value': 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ Y.extend(DEVICETOOLBOX, TOOLBOX, {
|
||||
*
|
||||
* Updates all span.commands with relevant handlers and other required changes
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
this.setup_for_device();
|
||||
},
|
||||
/**
|
||||
@@ -187,19 +187,19 @@ Y.extend(DEVICETOOLBOX, TOOLBOX, {
|
||||
* @param baseselector The selector to limit scope to
|
||||
* @return void
|
||||
*/
|
||||
setup_for_device : function(baseselector) {
|
||||
setup_for_device: function(baseselector) {
|
||||
if (!baseselector) {
|
||||
baseselector = CSS.AIRNOTIFIERCONTENT;
|
||||
}
|
||||
|
||||
Y.all(baseselector).each(this._setup_for_device, this);
|
||||
},
|
||||
_setup_for_device : function(toolboxtarget) {
|
||||
_setup_for_device: function(toolboxtarget) {
|
||||
|
||||
// Show/Hide.
|
||||
this.replace_button(toolboxtarget, CSS.HIDEDEVICE, this.toggle_hide_device);
|
||||
},
|
||||
toggle_hide_device : function(e) {
|
||||
toggle_hide_device: function(e) {
|
||||
// Prevent the default button action.
|
||||
e.preventDefault();
|
||||
|
||||
@@ -218,9 +218,9 @@ Y.extend(DEVICETOOLBOX, TOOLBOX, {
|
||||
|
||||
// Send the request.
|
||||
var data = {
|
||||
'field' : 'enable',
|
||||
'enable' : value,
|
||||
'id' : this.get_element_id(element)
|
||||
'field': 'enable',
|
||||
'enable': value,
|
||||
'id': this.get_element_id(element)
|
||||
};
|
||||
var spinner = M.util.add_spinner(Y, element);
|
||||
|
||||
@@ -231,8 +231,8 @@ Y.extend(DEVICETOOLBOX, TOOLBOX, {
|
||||
this.send_request(data, spinner, callback);
|
||||
}
|
||||
}, {
|
||||
NAME : 'message-device-toolbox',
|
||||
ATTRS : {
|
||||
NAME: 'message-device-toolbox',
|
||||
ATTRS: {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+5
-5
@@ -224,10 +224,10 @@ Y.namespace('M.core_message.messenger').sendMessage = Y.extend(SENDMSGDIALOG, M.
|
||||
|
||||
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('changesmadereallygoaway', 'moodle'),
|
||||
yesLabel : M.util.get_string('confirm', 'moodle'),
|
||||
noLabel : M.util.get_string('cancel', 'moodle')
|
||||
title: M.util.get_string('confirm', 'moodle'),
|
||||
question: M.util.get_string('changesmadereallygoaway', 'moodle'),
|
||||
yesLabel: M.util.get_string('confirm', 'moodle'),
|
||||
noLabel: M.util.get_string('cancel', 'moodle')
|
||||
});
|
||||
confirm.on('complete-yes', function() {
|
||||
M.core_formchangechecker.reset_form_dirty_state();
|
||||
@@ -430,7 +430,7 @@ Y.Base.modifyAttrs(Y.namespace('M.core_message.messenger.sendMessage'), {
|
||||
* @default false
|
||||
*/
|
||||
center: {
|
||||
value : true
|
||||
value: true
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
+29
-29
@@ -41,7 +41,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @type M.assignfeedback_editpdf.editor
|
||||
* @public
|
||||
*/
|
||||
editor : null,
|
||||
editor: null,
|
||||
|
||||
/**
|
||||
* Grade id
|
||||
@@ -49,7 +49,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @type Int
|
||||
* @public
|
||||
*/
|
||||
gradeid : 0,
|
||||
gradeid: 0,
|
||||
|
||||
/**
|
||||
* Comment page number
|
||||
@@ -57,7 +57,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @type Int
|
||||
* @public
|
||||
*/
|
||||
pageno : 0,
|
||||
pageno: 0,
|
||||
|
||||
/**
|
||||
* X position
|
||||
@@ -65,7 +65,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @type Int
|
||||
* @public
|
||||
*/
|
||||
x : 0,
|
||||
x: 0,
|
||||
|
||||
/**
|
||||
* Y position
|
||||
@@ -73,7 +73,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @type Int
|
||||
* @public
|
||||
*/
|
||||
y : 0,
|
||||
y: 0,
|
||||
|
||||
/**
|
||||
* Ending x position
|
||||
@@ -81,7 +81,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @type Int
|
||||
* @public
|
||||
*/
|
||||
endx : 0,
|
||||
endx: 0,
|
||||
|
||||
/**
|
||||
* Ending y position
|
||||
@@ -89,7 +89,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @type Int
|
||||
* @public
|
||||
*/
|
||||
endy : 0,
|
||||
endy: 0,
|
||||
|
||||
/**
|
||||
* Path
|
||||
@@ -97,7 +97,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @type String - list of points like x1,y1:x2,y2
|
||||
* @public
|
||||
*/
|
||||
path : '',
|
||||
path: '',
|
||||
|
||||
/**
|
||||
* Tool.
|
||||
@@ -105,7 +105,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @type String
|
||||
* @public
|
||||
*/
|
||||
type : 'rect',
|
||||
type: 'rect',
|
||||
|
||||
/**
|
||||
* Annotation colour.
|
||||
@@ -113,7 +113,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @type String
|
||||
* @public
|
||||
*/
|
||||
colour : 'red',
|
||||
colour: 'red',
|
||||
|
||||
/**
|
||||
* Reference to M.assignfeedback_editpdf.drawable
|
||||
@@ -121,7 +121,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @type M.assignfeedback_editpdf.drawable
|
||||
* @public
|
||||
*/
|
||||
drawable : false,
|
||||
drawable: false,
|
||||
|
||||
/**
|
||||
* Initialise the annotation.
|
||||
@@ -129,7 +129,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @method initializer
|
||||
* @return void
|
||||
*/
|
||||
initializer : function(config) {
|
||||
initializer: function(config) {
|
||||
this.editor = config.editor || null;
|
||||
this.gradeid = parseInt(config.gradeid, 10) || 0;
|
||||
this.pageno = parseInt(config.pageno, 10) || 0;
|
||||
@@ -149,17 +149,17 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @method clean
|
||||
* @return {}
|
||||
*/
|
||||
clean : function() {
|
||||
clean: function() {
|
||||
return {
|
||||
gradeid : this.gradeid,
|
||||
x : parseInt(this.x, 10),
|
||||
y : parseInt(this.y, 10),
|
||||
endx : parseInt(this.endx, 10),
|
||||
endy : parseInt(this.endy, 10),
|
||||
type : this.type,
|
||||
path : this.path,
|
||||
pageno : this.pageno,
|
||||
colour : this.colour
|
||||
gradeid: this.gradeid,
|
||||
x: parseInt(this.x, 10),
|
||||
y: parseInt(this.y, 10),
|
||||
endx: parseInt(this.endx, 10),
|
||||
endy: parseInt(this.endy, 10),
|
||||
type: this.type,
|
||||
path: this.path,
|
||||
pageno: this.pageno,
|
||||
colour: this.colour
|
||||
};
|
||||
},
|
||||
|
||||
@@ -169,7 +169,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @method draw_highlight
|
||||
* @return M.assignfeedback_editpdf.drawable
|
||||
*/
|
||||
draw_highlight : function() {
|
||||
draw_highlight: function() {
|
||||
var bounds,
|
||||
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
|
||||
offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY(),
|
||||
@@ -205,7 +205,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
'alt': M.util.get_string('deleteannotation', 'assignfeedback_editpdf')
|
||||
});
|
||||
deleteicon.setStyles({
|
||||
'backgroundColor' : 'white'
|
||||
'backgroundColor': 'white'
|
||||
});
|
||||
deletelink.addClass('deleteannotationbutton');
|
||||
deletelink.append(deleteicon);
|
||||
@@ -230,7 +230,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @method draw
|
||||
* @return M.assignfeedback_editpdf.drawable|false
|
||||
*/
|
||||
draw : function() {
|
||||
draw: function() {
|
||||
// Should be overridden by the subclass.
|
||||
this.draw_highlight();
|
||||
return this.drawable;
|
||||
@@ -242,7 +242,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @method remove
|
||||
* @param event
|
||||
*/
|
||||
remove : function(e) {
|
||||
remove: function(e) {
|
||||
var annotations,
|
||||
i;
|
||||
|
||||
@@ -269,7 +269,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @param int newy
|
||||
* @method move_annotation
|
||||
*/
|
||||
move : function(newx, newy) {
|
||||
move: function(newx, newy) {
|
||||
var diffx = newx - this.x,
|
||||
diffy = newy - this.y,
|
||||
newpath, oldpath, xy,
|
||||
@@ -306,7 +306,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @method draw_current_edit
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
*/
|
||||
draw_current_edit : function(edit) {
|
||||
draw_current_edit: function(edit) {
|
||||
var noop = edit && false;
|
||||
// Override me please.
|
||||
return noop;
|
||||
@@ -320,7 +320,7 @@ Y.extend(ANNOTATION, Y.Base, {
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
* @return bool if width/height is more than min. required.
|
||||
*/
|
||||
init_from_edit : function(edit) {
|
||||
init_from_edit: function(edit) {
|
||||
var bounds = new M.assignfeedback_editpdf.rect();
|
||||
bounds.bound([edit.start, edit.end]);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ Y.extend(ANNOTATIONHIGHLIGHT, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw
|
||||
* @return M.assignfeedback_editpdf.drawable
|
||||
*/
|
||||
draw : function() {
|
||||
draw: function() {
|
||||
var drawable,
|
||||
shape,
|
||||
bounds,
|
||||
@@ -85,7 +85,7 @@ Y.extend(ANNOTATIONHIGHLIGHT, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw_current_edit
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
*/
|
||||
draw_current_edit : function(edit) {
|
||||
draw_current_edit: function(edit) {
|
||||
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
|
||||
shape,
|
||||
bounds,
|
||||
@@ -132,7 +132,7 @@ Y.extend(ANNOTATIONHIGHLIGHT, M.assignfeedback_editpdf.annotation, {
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
* @return bool true if highlight bound is more than min width/height, else false.
|
||||
*/
|
||||
init_from_edit : function(edit) {
|
||||
init_from_edit: function(edit) {
|
||||
var bounds = new M.assignfeedback_editpdf.rect();
|
||||
bounds.bound([edit.start, edit.end]);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ Y.extend(ANNOTATIONLINE, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw
|
||||
* @return M.assignfeedback_editpdf.drawable
|
||||
*/
|
||||
draw : function() {
|
||||
draw: function() {
|
||||
var drawable,
|
||||
shape;
|
||||
|
||||
@@ -72,7 +72,7 @@ Y.extend(ANNOTATIONLINE, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw_current_edit
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
*/
|
||||
draw_current_edit : function(edit) {
|
||||
draw_current_edit: function(edit) {
|
||||
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
|
||||
shape;
|
||||
|
||||
@@ -102,7 +102,7 @@ Y.extend(ANNOTATIONLINE, M.assignfeedback_editpdf.annotation, {
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
* @return bool true if line bound is more than min width/height, else false.
|
||||
*/
|
||||
init_from_edit : function(edit) {
|
||||
init_from_edit: function(edit) {
|
||||
this.gradeid = this.editor.get('gradeid');
|
||||
this.pageno = this.editor.currentpage;
|
||||
this.x = edit.start.x;
|
||||
|
||||
@@ -41,7 +41,7 @@ Y.extend(ANNOTATIONOVAL, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw
|
||||
* @return M.assignfeedback_editpdf.drawable
|
||||
*/
|
||||
draw : function() {
|
||||
draw: function() {
|
||||
var drawable,
|
||||
bounds,
|
||||
shape;
|
||||
@@ -76,7 +76,7 @@ Y.extend(ANNOTATIONOVAL, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw_current_edit
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
*/
|
||||
draw_current_edit : function(edit) {
|
||||
draw_current_edit: function(edit) {
|
||||
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
|
||||
shape,
|
||||
bounds;
|
||||
|
||||
@@ -41,7 +41,7 @@ Y.extend(ANNOTATIONPEN, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw
|
||||
* @return M.assignfeedback_editpdf.drawable
|
||||
*/
|
||||
draw : function() {
|
||||
draw: function() {
|
||||
var drawable,
|
||||
shape,
|
||||
first,
|
||||
@@ -88,7 +88,7 @@ Y.extend(ANNOTATIONPEN, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw_current_edit
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
*/
|
||||
draw_current_edit : function(edit) {
|
||||
draw_current_edit: function(edit) {
|
||||
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
|
||||
shape,
|
||||
first;
|
||||
@@ -130,7 +130,7 @@ Y.extend(ANNOTATIONPEN, M.assignfeedback_editpdf.annotation, {
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
* @return bool true if pen bound is more than min width/height, else false.
|
||||
*/
|
||||
init_from_edit : function(edit) {
|
||||
init_from_edit: function(edit) {
|
||||
var bounds = new M.assignfeedback_editpdf.rect(),
|
||||
pathlist = [],
|
||||
i = 0;
|
||||
|
||||
@@ -41,7 +41,7 @@ Y.extend(ANNOTATIONRECTANGLE, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw
|
||||
* @return M.assignfeedback_editpdf.drawable
|
||||
*/
|
||||
draw : function() {
|
||||
draw: function() {
|
||||
var drawable,
|
||||
bounds,
|
||||
shape;
|
||||
@@ -76,7 +76,7 @@ Y.extend(ANNOTATIONRECTANGLE, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw_current_edit
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
*/
|
||||
draw_current_edit : function(edit) {
|
||||
draw_current_edit: function(edit) {
|
||||
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
|
||||
shape,
|
||||
bounds;
|
||||
|
||||
@@ -41,7 +41,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw
|
||||
* @return M.assignfeedback_editpdf.drawable
|
||||
*/
|
||||
draw : function() {
|
||||
draw: function() {
|
||||
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
|
||||
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
|
||||
node,
|
||||
@@ -85,7 +85,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
|
||||
* @method draw_current_edit
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
*/
|
||||
draw_current_edit : function(edit) {
|
||||
draw_current_edit: function(edit) {
|
||||
var bounds = new M.assignfeedback_editpdf.rect(),
|
||||
drawable = new M.assignfeedback_editpdf.drawable(this.editor),
|
||||
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
|
||||
@@ -124,7 +124,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
|
||||
* @param M.assignfeedback_editpdf.edit edit
|
||||
* @return bool if width/height is more than min. required.
|
||||
*/
|
||||
init_from_edit : function(edit) {
|
||||
init_from_edit: function(edit) {
|
||||
var bounds = new M.assignfeedback_editpdf.rect();
|
||||
bounds.bound([edit.start, edit.end]);
|
||||
|
||||
@@ -154,7 +154,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
|
||||
* @param int newy
|
||||
* @method move_annotation
|
||||
*/
|
||||
move : function(newx, newy) {
|
||||
move: function(newx, newy) {
|
||||
var diffx = newx - this.x,
|
||||
diffy = newy - this.y;
|
||||
|
||||
|
||||
+12
-12
@@ -28,7 +28,7 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
* @method initializer
|
||||
* @return void
|
||||
*/
|
||||
initializer : function(config) {
|
||||
initializer: function(config) {
|
||||
var colourlist = Y.Node.create('<ul role="menu" class="assignfeedback_editpdf_menu"/>'),
|
||||
body;
|
||||
|
||||
@@ -63,7 +63,7 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
|
||||
COLOURPICKER.superclass.initializer.call(this, config);
|
||||
},
|
||||
callback_handler : function(e) {
|
||||
callback_handler: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var callback = this.get('callback'),
|
||||
@@ -78,8 +78,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
bind();
|
||||
}
|
||||
}, {
|
||||
NAME : COLOURPICKER_NAME,
|
||||
ATTRS : {
|
||||
NAME: COLOURPICKER_NAME,
|
||||
ATTRS: {
|
||||
/**
|
||||
* The list of colours this colour picker supports.
|
||||
*
|
||||
@@ -87,8 +87,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
* @type {String: String} (The keys of the array are the colour names and the values are localized strings)
|
||||
* @default {}
|
||||
*/
|
||||
colours : {
|
||||
value : {}
|
||||
colours: {
|
||||
value: {}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -98,8 +98,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
* @type function
|
||||
* @default null
|
||||
*/
|
||||
callback : {
|
||||
value : null
|
||||
callback: {
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -109,8 +109,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
* @type Y.Node
|
||||
* @default null
|
||||
*/
|
||||
context : {
|
||||
value : null
|
||||
context: {
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -120,8 +120,8 @@ Y.extend(COLOURPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
* @type String
|
||||
* @default 'colour_'
|
||||
*/
|
||||
iconprefix : {
|
||||
value : 'colour_'
|
||||
iconprefix: {
|
||||
value: 'colour_'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -140,13 +140,13 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
|
||||
*/
|
||||
this.clean = function() {
|
||||
return {
|
||||
gradeid : this.gradeid,
|
||||
x : parseInt(this.x, 10),
|
||||
y : parseInt(this.y, 10),
|
||||
width : parseInt(this.width, 10),
|
||||
rawtext : this.rawtext,
|
||||
pageno : this.currentpage,
|
||||
colour : this.colour
|
||||
gradeid: this.gradeid,
|
||||
x: parseInt(this.x, 10),
|
||||
y: parseInt(this.y, 10),
|
||||
width: parseInt(this.width, 10),
|
||||
rawtext: this.rawtext,
|
||||
pageno: this.currentpage,
|
||||
colour: this.colour
|
||||
};
|
||||
};
|
||||
|
||||
@@ -199,7 +199,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
|
||||
node.set('value', this.rawtext);
|
||||
scrollheight = node.get('scrollHeight');
|
||||
node.setStyles({
|
||||
'height' : scrollheight + 'px',
|
||||
'height': scrollheight + 'px',
|
||||
'overflow': 'hidden'
|
||||
});
|
||||
if (!this.editor.get('readonly')) {
|
||||
|
||||
@@ -28,7 +28,7 @@ Y.extend(COMMENTMENU, M.assignfeedback_editpdf.dropdown, {
|
||||
* @method initializer
|
||||
* @return void
|
||||
*/
|
||||
initializer : function(config) {
|
||||
initializer: function(config) {
|
||||
var commentlinks,
|
||||
link,
|
||||
body,
|
||||
@@ -75,7 +75,7 @@ Y.extend(COMMENTMENU, M.assignfeedback_editpdf.dropdown, {
|
||||
* @method show
|
||||
* @return void
|
||||
*/
|
||||
show : function() {
|
||||
show: function() {
|
||||
var commentlinks = this.get('boundingBox').one('ul');
|
||||
commentlinks.all('.quicklist_comment').remove(true);
|
||||
var comment = this.get('comment');
|
||||
@@ -105,8 +105,8 @@ Y.extend(COMMENTMENU, M.assignfeedback_editpdf.dropdown, {
|
||||
COMMENTMENU.superclass.show.call(this);
|
||||
}
|
||||
}, {
|
||||
NAME : COMMENTMENUNAME,
|
||||
ATTRS : {
|
||||
NAME: COMMENTMENUNAME,
|
||||
ATTRS: {
|
||||
/**
|
||||
* The comment this menu is attached to.
|
||||
*
|
||||
@@ -114,8 +114,8 @@ Y.extend(COMMENTMENU, M.assignfeedback_editpdf.dropdown, {
|
||||
* @type M.assignfeedback_editpdf.comment
|
||||
* @default null
|
||||
*/
|
||||
comment : {
|
||||
value : null
|
||||
comment: {
|
||||
value: null
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
|
||||
* @method initializer
|
||||
* @return void
|
||||
*/
|
||||
initializer : function(config) {
|
||||
initializer: function(config) {
|
||||
var editor,
|
||||
container,
|
||||
placeholder,
|
||||
@@ -70,7 +70,7 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
|
||||
* @protected
|
||||
* @method filter_search_comments
|
||||
*/
|
||||
filter_search_comments : function() {
|
||||
filter_search_comments: function() {
|
||||
var filternode,
|
||||
commentslist,
|
||||
filtertext,
|
||||
@@ -82,7 +82,7 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
|
||||
|
||||
filtertext = filternode.get('value');
|
||||
|
||||
commentslist.all('li').each(function (node) {
|
||||
commentslist.all('li').each(function(node) {
|
||||
if (node.get('text').indexOf(filtertext) !== -1) {
|
||||
node.show();
|
||||
} else {
|
||||
@@ -98,7 +98,7 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
|
||||
* @protected
|
||||
* @method focus_on_comment
|
||||
*/
|
||||
focus_on_comment : function(e) {
|
||||
focus_on_comment: function(e) {
|
||||
e.preventDefault();
|
||||
var target = e.target.ancestor('li'),
|
||||
comment = target.getData('comment'),
|
||||
@@ -122,7 +122,7 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
|
||||
* @method show
|
||||
* @return void
|
||||
*/
|
||||
show : function() {
|
||||
show: function() {
|
||||
var commentlist = this.get('boundingBox').one('ul'),
|
||||
editor = this.get('editor');
|
||||
|
||||
@@ -141,8 +141,8 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
|
||||
COMMENTSEARCH.superclass.show.call(this);
|
||||
}
|
||||
}, {
|
||||
NAME : COMMENTSEARCHNAME,
|
||||
ATTRS : {
|
||||
NAME: COMMENTSEARCHNAME,
|
||||
ATTRS: {
|
||||
/**
|
||||
* The editor this search window is attached to.
|
||||
*
|
||||
@@ -150,8 +150,8 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
|
||||
* @type M.assignfeedback_editpdf.editor
|
||||
* @default null
|
||||
*/
|
||||
editor : {
|
||||
value : null
|
||||
editor: {
|
||||
value: null
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ Y.extend(DROPDOWN, M.core.dialogue, {
|
||||
* @method initializer
|
||||
* @return void
|
||||
*/
|
||||
initializer : function(config) {
|
||||
initializer: function(config) {
|
||||
var button, body, headertext, bb;
|
||||
DROPDOWN.superclass.initializer.call(this, config);
|
||||
|
||||
@@ -59,7 +59,7 @@ Y.extend(DROPDOWN, M.core.dialogue, {
|
||||
}
|
||||
}, this);
|
||||
|
||||
button.on('click', function(e) {e.preventDefault(); this.show();}, this);
|
||||
button.on('click', function(e) { e.preventDefault(); this.show(); }, this);
|
||||
button.on('key', this.show, 'enter,space', this);
|
||||
},
|
||||
|
||||
@@ -69,7 +69,7 @@ Y.extend(DROPDOWN, M.core.dialogue, {
|
||||
* @method show
|
||||
* @return void
|
||||
*/
|
||||
show : function() {
|
||||
show: function() {
|
||||
var button = this.get('buttonNode'),
|
||||
result = DROPDOWN.superclass.show.call(this);
|
||||
this.align(button, [Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BL]);
|
||||
@@ -77,8 +77,8 @@ Y.extend(DROPDOWN, M.core.dialogue, {
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
NAME : DROPDOWN_NAME,
|
||||
ATTRS : {
|
||||
NAME: DROPDOWN_NAME,
|
||||
ATTRS: {
|
||||
/**
|
||||
* The header for the drop down (only accessible to screen readers).
|
||||
*
|
||||
@@ -86,8 +86,8 @@ Y.extend(DROPDOWN, M.core.dialogue, {
|
||||
* @type String
|
||||
* @default ''
|
||||
*/
|
||||
headerText : {
|
||||
value : ''
|
||||
headerText: {
|
||||
value: ''
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -97,8 +97,8 @@ Y.extend(DROPDOWN, M.core.dialogue, {
|
||||
* @type Y.Node
|
||||
* @default null
|
||||
*/
|
||||
buttonNode : {
|
||||
value : null
|
||||
buttonNode: {
|
||||
value: null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+123
-123
@@ -42,7 +42,7 @@ EDITOR.prototype = {
|
||||
* @type M.core.dialogue
|
||||
* @protected
|
||||
*/
|
||||
dialogue : null,
|
||||
dialogue: null,
|
||||
|
||||
/**
|
||||
* The panel used for all action menu displays.
|
||||
@@ -51,7 +51,7 @@ EDITOR.prototype = {
|
||||
* @type Y.Node
|
||||
* @protected
|
||||
*/
|
||||
panel : null,
|
||||
panel: null,
|
||||
|
||||
/**
|
||||
* The number of pages in the pdf.
|
||||
@@ -60,7 +60,7 @@ EDITOR.prototype = {
|
||||
* @type Number
|
||||
* @protected
|
||||
*/
|
||||
pagecount : 0,
|
||||
pagecount: 0,
|
||||
|
||||
/**
|
||||
* The active page in the editor.
|
||||
@@ -69,7 +69,7 @@ EDITOR.prototype = {
|
||||
* @type Number
|
||||
* @protected
|
||||
*/
|
||||
currentpage : 0,
|
||||
currentpage: 0,
|
||||
|
||||
/**
|
||||
* A list of page objects. Each page has a list of comments and annotations.
|
||||
@@ -78,7 +78,7 @@ EDITOR.prototype = {
|
||||
* @type array
|
||||
* @protected
|
||||
*/
|
||||
pages : [],
|
||||
pages: [],
|
||||
|
||||
/**
|
||||
* The yui node for the loading icon.
|
||||
@@ -87,7 +87,7 @@ EDITOR.prototype = {
|
||||
* @type Node
|
||||
* @protected
|
||||
*/
|
||||
loadingicon : null,
|
||||
loadingicon: null,
|
||||
|
||||
/**
|
||||
* Image object of the current page image.
|
||||
@@ -96,7 +96,7 @@ EDITOR.prototype = {
|
||||
* @type Image
|
||||
* @protected
|
||||
*/
|
||||
pageimage : null,
|
||||
pageimage: null,
|
||||
|
||||
/**
|
||||
* YUI Graphic class for drawing shapes.
|
||||
@@ -105,7 +105,7 @@ EDITOR.prototype = {
|
||||
* @type Graphic
|
||||
* @protected
|
||||
*/
|
||||
graphic : null,
|
||||
graphic: null,
|
||||
|
||||
/**
|
||||
* Info about the current edit operation.
|
||||
@@ -114,7 +114,7 @@ EDITOR.prototype = {
|
||||
* @type M.assignfeedback_editpdf.edit
|
||||
* @protected
|
||||
*/
|
||||
currentedit : new M.assignfeedback_editpdf.edit(),
|
||||
currentedit: new M.assignfeedback_editpdf.edit(),
|
||||
|
||||
/**
|
||||
* Current drawable.
|
||||
@@ -123,7 +123,7 @@ EDITOR.prototype = {
|
||||
* @type M.assignfeedback_editpdf.drawable|false
|
||||
* @protected
|
||||
*/
|
||||
currentdrawable : false,
|
||||
currentdrawable: false,
|
||||
|
||||
/**
|
||||
* Current drawables.
|
||||
@@ -132,7 +132,7 @@ EDITOR.prototype = {
|
||||
* @type array(M.assignfeedback_editpdf.drawable)
|
||||
* @protected
|
||||
*/
|
||||
drawables : [],
|
||||
drawables: [],
|
||||
|
||||
/**
|
||||
* Current comment when the comment menu is open.
|
||||
@@ -140,7 +140,7 @@ EDITOR.prototype = {
|
||||
* @type M.assignfeedback_editpdf.comment
|
||||
* @protected
|
||||
*/
|
||||
currentcomment : null,
|
||||
currentcomment: null,
|
||||
|
||||
/**
|
||||
* Current annotation when the select tool is used.
|
||||
@@ -148,7 +148,7 @@ EDITOR.prototype = {
|
||||
* @type M.assignfeedback_editpdf.annotation
|
||||
* @protected
|
||||
*/
|
||||
currentannotation : null,
|
||||
currentannotation: null,
|
||||
|
||||
/**
|
||||
* Last selected annotation tool
|
||||
@@ -156,7 +156,7 @@ EDITOR.prototype = {
|
||||
* @type String
|
||||
* @protected
|
||||
*/
|
||||
lastanntationtool : "pen",
|
||||
lastanntationtool: "pen",
|
||||
|
||||
/**
|
||||
* The users comments quick list
|
||||
@@ -164,7 +164,7 @@ EDITOR.prototype = {
|
||||
* @type M.assignfeedback_editpdf.quickcommentlist
|
||||
* @protected
|
||||
*/
|
||||
quicklist : null,
|
||||
quicklist: null,
|
||||
|
||||
/**
|
||||
* The search comments window.
|
||||
@@ -172,7 +172,7 @@ EDITOR.prototype = {
|
||||
* @type M.core.dialogue
|
||||
* @protected
|
||||
*/
|
||||
searchcommentswindow : null,
|
||||
searchcommentswindow: null,
|
||||
|
||||
|
||||
/**
|
||||
@@ -181,7 +181,7 @@ EDITOR.prototype = {
|
||||
* @type String
|
||||
* @protected
|
||||
*/
|
||||
currentstamp : null,
|
||||
currentstamp: null,
|
||||
|
||||
/**
|
||||
* The stamps.
|
||||
@@ -189,7 +189,7 @@ EDITOR.prototype = {
|
||||
* @type Array
|
||||
* @protected
|
||||
*/
|
||||
stamps : [],
|
||||
stamps: [],
|
||||
|
||||
/**
|
||||
* Prevent new comments from appearing
|
||||
@@ -199,13 +199,13 @@ EDITOR.prototype = {
|
||||
* @type Boolean
|
||||
* @public
|
||||
*/
|
||||
editingcomment : false,
|
||||
editingcomment: false,
|
||||
|
||||
/**
|
||||
* Called during the initialisation process of the object.
|
||||
* @method initializer
|
||||
*/
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
var link;
|
||||
|
||||
link = Y.one('#' + this.get('linkid'));
|
||||
@@ -239,7 +239,7 @@ EDITOR.prototype = {
|
||||
* Called to show/hide buttons and set the current colours/stamps.
|
||||
* @method refresh_button_state
|
||||
*/
|
||||
refresh_button_state : function() {
|
||||
refresh_button_state: function() {
|
||||
var button, currenttoolnode, imgurl, drawingregion;
|
||||
|
||||
// Initalise the colour buttons.
|
||||
@@ -274,7 +274,7 @@ EDITOR.prototype = {
|
||||
* Called to get the bounds of the drawing region.
|
||||
* @method get_canvas_bounds
|
||||
*/
|
||||
get_canvas_bounds : function() {
|
||||
get_canvas_bounds: function() {
|
||||
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
|
||||
offsetcanvas = canvas.getXY(),
|
||||
offsetleft = offsetcanvas[0],
|
||||
@@ -290,7 +290,7 @@ EDITOR.prototype = {
|
||||
* @method get_canvas_coordinates
|
||||
* @param M.assignfeedback_editpdf.point point in window coordinats.
|
||||
*/
|
||||
get_canvas_coordinates : function(point) {
|
||||
get_canvas_coordinates: function(point) {
|
||||
var bounds = this.get_canvas_bounds(),
|
||||
newpoint = new M.assignfeedback_editpdf.point(point.x - bounds.x, point.y - bounds.y);
|
||||
|
||||
@@ -305,7 +305,7 @@ EDITOR.prototype = {
|
||||
* @method get_window_coordinates
|
||||
* @param M.assignfeedback_editpdf.point point in window coordinats.
|
||||
*/
|
||||
get_window_coordinates : function(point) {
|
||||
get_window_coordinates: function(point) {
|
||||
var bounds = this.get_canvas_bounds(),
|
||||
newpoint = new M.assignfeedback_editpdf.point(point.x + bounds.x, point.y + bounds.y);
|
||||
|
||||
@@ -316,7 +316,7 @@ EDITOR.prototype = {
|
||||
* Open the edit-pdf editor in the panel in the page instead of a popup.
|
||||
* @method open_in_panel
|
||||
*/
|
||||
open_in_panel : function(panel) {
|
||||
open_in_panel: function(panel) {
|
||||
var drawingcanvas, drawingregion;
|
||||
|
||||
this.panel = panel;
|
||||
@@ -326,7 +326,7 @@ EDITOR.prototype = {
|
||||
this.loadingicon = this.get_dialogue_element(SELECTOR.LOADINGICON);
|
||||
|
||||
drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
|
||||
this.graphic = new Y.Graphic({render : drawingcanvas});
|
||||
this.graphic = new Y.Graphic({render: drawingcanvas});
|
||||
|
||||
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
|
||||
drawingregion.on('scroll', this.move_canvas, this);
|
||||
@@ -346,7 +346,7 @@ EDITOR.prototype = {
|
||||
* Called to open the pdf editing dialogue.
|
||||
* @method link_handler
|
||||
*/
|
||||
link_handler : function(e) {
|
||||
link_handler: function(e) {
|
||||
var drawingcanvas, drawingregion, resize = true;
|
||||
e.preventDefault();
|
||||
|
||||
@@ -367,7 +367,7 @@ EDITOR.prototype = {
|
||||
this.loadingicon = this.get_dialogue_element(SELECTOR.LOADINGICON);
|
||||
|
||||
drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
|
||||
this.graphic = new Y.Graphic({render : drawingcanvas});
|
||||
this.graphic = new Y.Graphic({render: drawingcanvas});
|
||||
|
||||
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
|
||||
drawingregion.on('scroll', this.move_canvas, this);
|
||||
@@ -399,7 +399,7 @@ EDITOR.prototype = {
|
||||
* Called to load the information and annotations for all pages.
|
||||
* @method load_all_pages
|
||||
*/
|
||||
load_all_pages : function() {
|
||||
load_all_pages: function() {
|
||||
var ajaxurl = AJAXBASE,
|
||||
config,
|
||||
checkconversionstatus,
|
||||
@@ -409,13 +409,13 @@ EDITOR.prototype = {
|
||||
method: 'get',
|
||||
context: this,
|
||||
sync: false,
|
||||
data : {
|
||||
sesskey : M.cfg.sesskey,
|
||||
action : 'loadallpages',
|
||||
userid : this.get('userid'),
|
||||
attemptnumber : this.get('attemptnumber'),
|
||||
assignmentid : this.get('assignmentid'),
|
||||
readonly : this.get('readonly') ? 1 : 0
|
||||
data: {
|
||||
sesskey: M.cfg.sesskey,
|
||||
action: 'loadallpages',
|
||||
userid: this.get('userid'),
|
||||
attemptnumber: this.get('attemptnumber'),
|
||||
assignmentid: this.get('assignmentid'),
|
||||
readonly: this.get('readonly') ? 1 : 0
|
||||
},
|
||||
on: {
|
||||
success: function(tid, response) {
|
||||
@@ -435,12 +435,12 @@ EDITOR.prototype = {
|
||||
method: 'get',
|
||||
context: this,
|
||||
sync: false,
|
||||
data : {
|
||||
sesskey : M.cfg.sesskey,
|
||||
action : 'conversionstatus',
|
||||
userid : this.get('userid'),
|
||||
attemptnumber : this.get('attemptnumber'),
|
||||
assignmentid : this.get('assignmentid')
|
||||
data: {
|
||||
sesskey: M.cfg.sesskey,
|
||||
action: 'conversionstatus',
|
||||
userid: this.get('userid'),
|
||||
attemptnumber: this.get('attemptnumber'),
|
||||
assignmentid: this.get('assignmentid')
|
||||
},
|
||||
on: {
|
||||
success: function(tid, response) {
|
||||
@@ -459,7 +459,7 @@ EDITOR.prototype = {
|
||||
}
|
||||
|
||||
// New ajax request delayed of a second.
|
||||
Y.later(1000, this, function () {
|
||||
Y.later(1000, this, function() {
|
||||
Y.io(AJAXBASEPROGRESS, checkconversionstatus);
|
||||
});
|
||||
}
|
||||
@@ -469,7 +469,7 @@ EDITOR.prototype = {
|
||||
// We only continue on error if the all pages were not generated,
|
||||
// and if the ajax call did not produce 5 errors in the row.
|
||||
if (this.pagecount === 0 && ajax_error_total < 5) {
|
||||
Y.later(1000, this, function () {
|
||||
Y.later(1000, this, function() {
|
||||
Y.io(AJAXBASEPROGRESS, checkconversionstatus);
|
||||
});
|
||||
}
|
||||
@@ -479,7 +479,7 @@ EDITOR.prototype = {
|
||||
};
|
||||
// We start the AJAX "generated page total number" call a second later to give a chance to
|
||||
// the AJAX "combined pdf generation" call to clean the previous submission images.
|
||||
Y.later(1000, this, function () {
|
||||
Y.later(1000, this, function() {
|
||||
ajax_error_total = 0;
|
||||
Y.io(AJAXBASEPROGRESS, checkconversionstatus);
|
||||
});
|
||||
@@ -492,7 +492,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method all_pages_loaded
|
||||
*/
|
||||
all_pages_loaded : function(responsetext) {
|
||||
all_pages_loaded: function(responsetext) {
|
||||
var data, i, j, comment, error;
|
||||
try {
|
||||
data = Y.JSON.parse(responsetext);
|
||||
@@ -501,7 +501,7 @@ EDITOR.prototype = {
|
||||
this.dialogue.hide();
|
||||
}
|
||||
// Display alert dialogue.
|
||||
error = new M.core.alert({ message: M.util.get_string('cannotopenpdf', 'assignfeedback_editpdf') });
|
||||
error = new M.core.alert({message: M.util.get_string('cannotopenpdf', 'assignfeedback_editpdf')});
|
||||
error.show();
|
||||
return;
|
||||
}
|
||||
@@ -510,7 +510,7 @@ EDITOR.prototype = {
|
||||
this.dialogue.hide();
|
||||
}
|
||||
// Display alert dialogue.
|
||||
error = new M.core.alert({ title: M.util.get_string('cannotopenpdf', 'assignfeedback_editpdf')});
|
||||
error = new M.core.alert({title: M.util.get_string('cannotopenpdf', 'assignfeedback_editpdf')});
|
||||
error.show();
|
||||
return;
|
||||
}
|
||||
@@ -552,7 +552,7 @@ EDITOR.prototype = {
|
||||
* @method get_stamp_image_url
|
||||
* @param string filename
|
||||
*/
|
||||
get_stamp_image_url : function(filename) {
|
||||
get_stamp_image_url: function(filename) {
|
||||
var urls = this.get('stampfiles'),
|
||||
fullurl = '';
|
||||
|
||||
@@ -570,7 +570,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method setup_toolbar
|
||||
*/
|
||||
setup_toolbar : function() {
|
||||
setup_toolbar: function() {
|
||||
var toolnode,
|
||||
commentcolourbutton,
|
||||
annotationcolourbutton,
|
||||
@@ -602,7 +602,7 @@ EDITOR.prototype = {
|
||||
buttonNode: commentcolourbutton,
|
||||
colours: COMMENTCOLOUR,
|
||||
iconprefix: 'background_colour_',
|
||||
callback: function (e) {
|
||||
callback: function(e) {
|
||||
var colour = e.target.getAttribute('data-colour');
|
||||
if (!colour) {
|
||||
colour = e.target.ancestor().getAttribute('data-colour');
|
||||
@@ -618,7 +618,7 @@ EDITOR.prototype = {
|
||||
buttonNode: annotationcolourbutton,
|
||||
iconprefix: 'colour_',
|
||||
colours: ANNOTATIONCOLOUR,
|
||||
callback: function (e) {
|
||||
callback: function(e) {
|
||||
var colour = e.target.getAttribute('data-colour');
|
||||
if (!colour) {
|
||||
colour = e.target.ancestor().getAttribute('data-colour');
|
||||
@@ -666,7 +666,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method handle_tool_button
|
||||
*/
|
||||
handle_tool_button : function(e, tool) {
|
||||
handle_tool_button: function(e, tool) {
|
||||
var currenttoolnode;
|
||||
|
||||
e.preventDefault();
|
||||
@@ -689,7 +689,7 @@ EDITOR.prototype = {
|
||||
* @method stringify_current_page
|
||||
* @return string
|
||||
*/
|
||||
stringify_current_page : function() {
|
||||
stringify_current_page: function() {
|
||||
var comments = [],
|
||||
annotations = [],
|
||||
page,
|
||||
@@ -702,7 +702,7 @@ EDITOR.prototype = {
|
||||
annotations[i] = this.pages[this.currentpage].annotations[i].clean();
|
||||
}
|
||||
|
||||
page = { comments : comments, annotations : annotations };
|
||||
page = {comments: comments, annotations: annotations};
|
||||
|
||||
return Y.JSON.stringify(page);
|
||||
},
|
||||
@@ -712,7 +712,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method get_current_drawable
|
||||
*/
|
||||
get_current_drawable : function() {
|
||||
get_current_drawable: function() {
|
||||
var comment,
|
||||
annotation,
|
||||
drawable = false;
|
||||
@@ -739,7 +739,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method get_dialogue_element
|
||||
*/
|
||||
get_dialogue_element : function(selector) {
|
||||
get_dialogue_element: function(selector) {
|
||||
if (this.panel) {
|
||||
return this.panel.one(selector);
|
||||
} else {
|
||||
@@ -752,7 +752,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method redraw_active_edit
|
||||
*/
|
||||
redraw_current_edit : function() {
|
||||
redraw_current_edit: function() {
|
||||
if (this.currentdrawable) {
|
||||
this.currentdrawable.erase();
|
||||
}
|
||||
@@ -765,14 +765,14 @@ EDITOR.prototype = {
|
||||
* @param Event
|
||||
* @method edit_start
|
||||
*/
|
||||
edit_start : function(e) {
|
||||
edit_start: function(e) {
|
||||
e.preventDefault();
|
||||
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
|
||||
offset = canvas.getXY(),
|
||||
scrolltop = canvas.get('docScrollY'),
|
||||
scrollleft = canvas.get('docScrollX'),
|
||||
point = {x : e.clientX - offset[0] + scrollleft,
|
||||
y : e.clientY - offset[1] + scrolltop},
|
||||
point = {x: e.clientX - offset[0] + scrollleft,
|
||||
y: e.clientY - offset[1] + scrolltop},
|
||||
selected = false,
|
||||
lastannotation;
|
||||
|
||||
@@ -791,7 +791,7 @@ EDITOR.prototype = {
|
||||
|
||||
this.currentedit.starttime = new Date().getTime();
|
||||
this.currentedit.start = point;
|
||||
this.currentedit.end = {x : point.x, y : point.y};
|
||||
this.currentedit.end = {x: point.x, y: point.y};
|
||||
|
||||
if (this.currentedit.tool === 'select') {
|
||||
var x = this.currentedit.end.x,
|
||||
@@ -824,8 +824,8 @@ EDITOR.prototype = {
|
||||
}
|
||||
if (this.currentannotation) {
|
||||
// Used to calculate drag offset.
|
||||
this.currentedit.annotationstart = { x : this.currentannotation.x,
|
||||
y : this.currentannotation.y };
|
||||
this.currentedit.annotationstart = {x: this.currentannotation.x,
|
||||
y: this.currentannotation.y};
|
||||
}
|
||||
},
|
||||
|
||||
@@ -835,7 +835,7 @@ EDITOR.prototype = {
|
||||
* @param Event
|
||||
* @method edit_move
|
||||
*/
|
||||
edit_move : function(e) {
|
||||
edit_move: function(e) {
|
||||
e.preventDefault();
|
||||
var bounds = this.get_canvas_bounds(),
|
||||
canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
|
||||
@@ -857,7 +857,7 @@ EDITOR.prototype = {
|
||||
|
||||
if (this.currentedit.tool === 'select') {
|
||||
if (this.currentannotation && this.currentedit) {
|
||||
this.currentannotation.move( this.currentedit.annotationstart.x + point.x - this.currentedit.start.x,
|
||||
this.currentannotation.move(this.currentedit.annotationstart.x + point.x - this.currentedit.start.x,
|
||||
this.currentedit.annotationstart.y + point.y - this.currentedit.start.y);
|
||||
}
|
||||
} else if (this.currentedit.tool === 'drag') {
|
||||
@@ -881,7 +881,7 @@ EDITOR.prototype = {
|
||||
* @param Event
|
||||
* @method edit_end
|
||||
*/
|
||||
edit_end : function() {
|
||||
edit_end: function() {
|
||||
var duration,
|
||||
comment,
|
||||
annotation;
|
||||
@@ -932,7 +932,7 @@ EDITOR.prototype = {
|
||||
* @public
|
||||
* @method resize
|
||||
*/
|
||||
resize : function() {
|
||||
resize: function() {
|
||||
var drawingregion, drawregionheight;
|
||||
|
||||
if (this.dialogue) {
|
||||
@@ -949,7 +949,7 @@ EDITOR.prototype = {
|
||||
}
|
||||
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
|
||||
if (this.dialogue) {
|
||||
drawingregion.setStyle('maxHeight', drawregionheight +'px');
|
||||
drawingregion.setStyle('maxHeight', drawregionheight + 'px');
|
||||
}
|
||||
this.redraw();
|
||||
return true;
|
||||
@@ -960,7 +960,7 @@ EDITOR.prototype = {
|
||||
* @public
|
||||
* @method create_annotation
|
||||
*/
|
||||
create_annotation : function(type, data) {
|
||||
create_annotation: function(type, data) {
|
||||
data.type = type;
|
||||
data.editor = this;
|
||||
if (type === "line") {
|
||||
@@ -984,7 +984,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method save_current_page
|
||||
*/
|
||||
save_current_page : function() {
|
||||
save_current_page: function() {
|
||||
var ajaxurl = AJAXBASE,
|
||||
config;
|
||||
|
||||
@@ -992,14 +992,14 @@ EDITOR.prototype = {
|
||||
method: 'post',
|
||||
context: this,
|
||||
sync: false,
|
||||
data : {
|
||||
'sesskey' : M.cfg.sesskey,
|
||||
'action' : 'savepage',
|
||||
'index' : this.currentpage,
|
||||
'userid' : this.get('userid'),
|
||||
'attemptnumber' : this.get('attemptnumber'),
|
||||
'assignmentid' : this.get('assignmentid'),
|
||||
'page' : this.stringify_current_page()
|
||||
data: {
|
||||
'sesskey': M.cfg.sesskey,
|
||||
'action': 'savepage',
|
||||
'index': this.currentpage,
|
||||
'userid': this.get('userid'),
|
||||
'attemptnumber': this.get('attemptnumber'),
|
||||
'assignmentid': this.get('assignmentid'),
|
||||
'page': this.stringify_current_page()
|
||||
},
|
||||
on: {
|
||||
success: function(tid, response) {
|
||||
@@ -1040,10 +1040,10 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method open_search_comments
|
||||
*/
|
||||
open_search_comments : function(e) {
|
||||
open_search_comments: function(e) {
|
||||
if (!this.searchcommentswindow) {
|
||||
this.searchcommentswindow = new M.assignfeedback_editpdf.commentsearch({
|
||||
editor : this
|
||||
editor: this
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1056,7 +1056,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method redraw
|
||||
*/
|
||||
redraw : function() {
|
||||
redraw: function() {
|
||||
var i,
|
||||
page;
|
||||
|
||||
@@ -1081,7 +1081,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method change_page
|
||||
*/
|
||||
change_page : function() {
|
||||
change_page: function() {
|
||||
var drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
|
||||
page,
|
||||
previousbutton,
|
||||
@@ -1119,7 +1119,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method setup_navigation
|
||||
*/
|
||||
setup_navigation : function() {
|
||||
setup_navigation: function() {
|
||||
var pageselect,
|
||||
i,
|
||||
strinfo,
|
||||
@@ -1134,7 +1134,7 @@ EDITOR.prototype = {
|
||||
for (i = 0; i < this.pages.length; i++) {
|
||||
option = Y.Node.create('<option/>');
|
||||
option.setAttribute('value', i);
|
||||
strinfo = {page: i+1, total: this.pages.length};
|
||||
strinfo = {page: i + 1, total: this.pages.length};
|
||||
option.setHTML(M.util.get_string('pagexofy', 'assignfeedback_editpdf', strinfo));
|
||||
pageselect.append(option);
|
||||
}
|
||||
@@ -1159,7 +1159,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method previous_page
|
||||
*/
|
||||
previous_page : function(e) {
|
||||
previous_page: function(e) {
|
||||
e.preventDefault();
|
||||
this.currentpage--;
|
||||
if (this.currentpage < 0) {
|
||||
@@ -1173,7 +1173,7 @@ EDITOR.prototype = {
|
||||
* @protected
|
||||
* @method next_page
|
||||
*/
|
||||
next_page : function(e) {
|
||||
next_page: function(e) {
|
||||
e.preventDefault();
|
||||
this.currentpage++;
|
||||
if (this.currentpage >= this.pages.length) {
|
||||
@@ -1202,51 +1202,51 @@ EDITOR.prototype = {
|
||||
};
|
||||
|
||||
Y.extend(EDITOR, Y.Base, EDITOR.prototype, {
|
||||
NAME : 'moodle-assignfeedback_editpdf-editor',
|
||||
ATTRS : {
|
||||
userid : {
|
||||
validator : Y.Lang.isInteger,
|
||||
value : 0
|
||||
NAME: 'moodle-assignfeedback_editpdf-editor',
|
||||
ATTRS: {
|
||||
userid: {
|
||||
validator: Y.Lang.isInteger,
|
||||
value: 0
|
||||
},
|
||||
assignmentid : {
|
||||
validator : Y.Lang.isInteger,
|
||||
value : 0
|
||||
assignmentid: {
|
||||
validator: Y.Lang.isInteger,
|
||||
value: 0
|
||||
},
|
||||
attemptnumber : {
|
||||
validator : Y.Lang.isInteger,
|
||||
value : 0
|
||||
attemptnumber: {
|
||||
validator: Y.Lang.isInteger,
|
||||
value: 0
|
||||
},
|
||||
header : {
|
||||
validator : Y.Lang.isString,
|
||||
value : ''
|
||||
header: {
|
||||
validator: Y.Lang.isString,
|
||||
value: ''
|
||||
},
|
||||
body : {
|
||||
validator : Y.Lang.isString,
|
||||
value : ''
|
||||
body: {
|
||||
validator: Y.Lang.isString,
|
||||
value: ''
|
||||
},
|
||||
footer : {
|
||||
validator : Y.Lang.isString,
|
||||
value : ''
|
||||
footer: {
|
||||
validator: Y.Lang.isString,
|
||||
value: ''
|
||||
},
|
||||
linkid : {
|
||||
validator : Y.Lang.isString,
|
||||
value : ''
|
||||
linkid: {
|
||||
validator: Y.Lang.isString,
|
||||
value: ''
|
||||
},
|
||||
deletelinkid : {
|
||||
validator : Y.Lang.isString,
|
||||
value : ''
|
||||
deletelinkid: {
|
||||
validator: Y.Lang.isString,
|
||||
value: ''
|
||||
},
|
||||
readonly : {
|
||||
validator : Y.Lang.isBoolean,
|
||||
value : true
|
||||
readonly: {
|
||||
validator: Y.Lang.isBoolean,
|
||||
value: true
|
||||
},
|
||||
stampfiles : {
|
||||
validator : Y.Lang.isArray,
|
||||
value : ''
|
||||
stampfiles: {
|
||||
validator: Y.Lang.isArray,
|
||||
value: ''
|
||||
},
|
||||
pagetotal : {
|
||||
validator : Y.Lang.isInteger,
|
||||
value : 0
|
||||
pagetotal: {
|
||||
validator: Y.Lang.isInteger,
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1261,6 +1261,6 @@ M.assignfeedback_editpdf.editor = M.assignfeedback_editpdf.editor || {};
|
||||
* @param {Object} params
|
||||
*/
|
||||
M.assignfeedback_editpdf.editor.init = M.assignfeedback_editpdf.editor.init || function(params) {
|
||||
M.assignfeedback_editpdf.instance = new EDITOR(params);
|
||||
M.assignfeedback_editpdf.instance = new EDITOR(params);
|
||||
return M.assignfeedback_editpdf.instance;
|
||||
};
|
||||
|
||||
+32
-32
@@ -22,47 +22,47 @@
|
||||
var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
|
||||
AJAXBASEPROGRESS = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax_progress.php',
|
||||
CSS = {
|
||||
DIALOGUE : 'assignfeedback_editpdf_widget'
|
||||
DIALOGUE: 'assignfeedback_editpdf_widget'
|
||||
},
|
||||
SELECTOR = {
|
||||
PREVIOUSBUTTON : '.navigate-previous-button',
|
||||
NEXTBUTTON : ' .navigate-next-button',
|
||||
SEARCHCOMMENTSBUTTON : '.searchcommentsbutton',
|
||||
SEARCHFILTER : '.assignfeedback_editpdf_commentsearch input',
|
||||
SEARCHCOMMENTSLIST : '.assignfeedback_editpdf_commentsearch ul',
|
||||
PAGESELECT : '.navigate-page-select',
|
||||
LOADINGICON : '.loading',
|
||||
PROGRESSBARCONTAINER : '.progress-info.progress-striped',
|
||||
DRAWINGREGION : '.drawingregion',
|
||||
DRAWINGCANVAS : '.drawingcanvas',
|
||||
SAVE : '.savebutton',
|
||||
COMMENTCOLOURBUTTON : '.commentcolourbutton',
|
||||
COMMENTMENU : '.commentdrawable a',
|
||||
ANNOTATIONCOLOURBUTTON : '.annotationcolourbutton',
|
||||
DELETEANNOTATIONBUTTON : '.deleteannotationbutton',
|
||||
UNSAVEDCHANGESDIV : '.assignfeedback_editpdf_unsavedchanges',
|
||||
UNSAVEDCHANGESINPUT : 'input[name="assignfeedback_editpdf_haschanges"]',
|
||||
STAMPSBUTTON : '.currentstampbutton',
|
||||
DIALOGUE : '.' + CSS.DIALOGUE
|
||||
PREVIOUSBUTTON: '.navigate-previous-button',
|
||||
NEXTBUTTON: ' .navigate-next-button',
|
||||
SEARCHCOMMENTSBUTTON: '.searchcommentsbutton',
|
||||
SEARCHFILTER: '.assignfeedback_editpdf_commentsearch input',
|
||||
SEARCHCOMMENTSLIST: '.assignfeedback_editpdf_commentsearch ul',
|
||||
PAGESELECT: '.navigate-page-select',
|
||||
LOADINGICON: '.loading',
|
||||
PROGRESSBARCONTAINER: '.progress-info.progress-striped',
|
||||
DRAWINGREGION: '.drawingregion',
|
||||
DRAWINGCANVAS: '.drawingcanvas',
|
||||
SAVE: '.savebutton',
|
||||
COMMENTCOLOURBUTTON: '.commentcolourbutton',
|
||||
COMMENTMENU: '.commentdrawable a',
|
||||
ANNOTATIONCOLOURBUTTON: '.annotationcolourbutton',
|
||||
DELETEANNOTATIONBUTTON: '.deleteannotationbutton',
|
||||
UNSAVEDCHANGESDIV: '.assignfeedback_editpdf_unsavedchanges',
|
||||
UNSAVEDCHANGESINPUT: 'input[name="assignfeedback_editpdf_haschanges"]',
|
||||
STAMPSBUTTON: '.currentstampbutton',
|
||||
DIALOGUE: '.' + CSS.DIALOGUE
|
||||
},
|
||||
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
|
||||
SELECTEDFILLCOLOUR = 'rgba(200, 200, 255, 0.5)',
|
||||
COMMENTTEXTCOLOUR = 'rgb(51, 51, 51)',
|
||||
COMMENTCOLOUR = {
|
||||
'white' : 'rgb(255,255,255)',
|
||||
'yellow' : 'rgb(255,236,174)',
|
||||
'red' : 'rgb(249,181,179)',
|
||||
'green' : 'rgb(214,234,178)',
|
||||
'blue' : 'rgb(203,217,237)',
|
||||
'clear' : 'rgba(255,255,255, 0)'
|
||||
'white': 'rgb(255,255,255)',
|
||||
'yellow': 'rgb(255,236,174)',
|
||||
'red': 'rgb(249,181,179)',
|
||||
'green': 'rgb(214,234,178)',
|
||||
'blue': 'rgb(203,217,237)',
|
||||
'clear': 'rgba(255,255,255, 0)'
|
||||
},
|
||||
ANNOTATIONCOLOUR = {
|
||||
'white' : 'rgb(255,255,255)',
|
||||
'yellow' : 'rgb(255,207,53)',
|
||||
'red' : 'rgb(239,69,64)',
|
||||
'green' : 'rgb(152,202,62)',
|
||||
'blue' : 'rgb(125,159,211)',
|
||||
'black' : 'rgb(51,51,51)'
|
||||
'white': 'rgb(255,255,255)',
|
||||
'yellow': 'rgb(255,207,53)',
|
||||
'red': 'rgb(239,69,64)',
|
||||
'green': 'rgb(152,202,62)',
|
||||
'blue': 'rgb(125,159,211)',
|
||||
'black': 'rgb(51,51,51)'
|
||||
},
|
||||
CLICKTIMEOUT = 300,
|
||||
TOOLSELECTOR = {
|
||||
|
||||
@@ -63,15 +63,15 @@ var QUICKCOMMENTLIST = function(editor) {
|
||||
method: 'post',
|
||||
context: this,
|
||||
sync: false,
|
||||
data : {
|
||||
'sesskey' : M.cfg.sesskey,
|
||||
'action' : 'addtoquicklist',
|
||||
'userid' : this.editor.get('userid'),
|
||||
'commenttext' : comment.rawtext,
|
||||
'width' : comment.width,
|
||||
'colour' : comment.colour,
|
||||
'attemptnumber' : this.editor.get('attemptnumber'),
|
||||
'assignmentid' : this.editor.get('assignmentid')
|
||||
data: {
|
||||
'sesskey': M.cfg.sesskey,
|
||||
'action': 'addtoquicklist',
|
||||
'userid': this.editor.get('userid'),
|
||||
'commenttext': comment.rawtext,
|
||||
'width': comment.width,
|
||||
'colour': comment.colour,
|
||||
'attemptnumber': this.editor.get('attemptnumber'),
|
||||
'assignmentid': this.editor.get('assignmentid')
|
||||
},
|
||||
on: {
|
||||
success: function(tid, response) {
|
||||
@@ -119,13 +119,13 @@ var QUICKCOMMENTLIST = function(editor) {
|
||||
method: 'post',
|
||||
context: this,
|
||||
sync: false,
|
||||
data : {
|
||||
'sesskey' : M.cfg.sesskey,
|
||||
'action' : 'removefromquicklist',
|
||||
'userid' : this.editor.get('userid'),
|
||||
'commentid' : comment.id,
|
||||
'attemptnumber' : this.editor.get('attemptnumber'),
|
||||
'assignmentid' : this.editor.get('assignmentid')
|
||||
data: {
|
||||
'sesskey': M.cfg.sesskey,
|
||||
'action': 'removefromquicklist',
|
||||
'userid': this.editor.get('userid'),
|
||||
'commentid': comment.id,
|
||||
'attemptnumber': this.editor.get('attemptnumber'),
|
||||
'assignmentid': this.editor.get('assignmentid')
|
||||
},
|
||||
on: {
|
||||
success: function() {
|
||||
@@ -160,12 +160,12 @@ var QUICKCOMMENTLIST = function(editor) {
|
||||
method: 'get',
|
||||
context: this,
|
||||
sync: false,
|
||||
data : {
|
||||
'sesskey' : M.cfg.sesskey,
|
||||
'action' : 'loadquicklist',
|
||||
'userid' : this.editor.get('userid'),
|
||||
'attemptnumber' : this.editor.get('attemptnumber'),
|
||||
'assignmentid' : this.editor.get('assignmentid')
|
||||
data: {
|
||||
'sesskey': M.cfg.sesskey,
|
||||
'action': 'loadquicklist',
|
||||
'userid': this.editor.get('userid'),
|
||||
'attemptnumber': this.editor.get('attemptnumber'),
|
||||
'assignmentid': this.editor.get('assignmentid')
|
||||
},
|
||||
on: {
|
||||
success: function(tid, response) {
|
||||
|
||||
+10
-10
@@ -27,7 +27,7 @@ Y.extend(STAMPPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
* @method initializer
|
||||
* @return void
|
||||
*/
|
||||
initializer : function(config) {
|
||||
initializer: function(config) {
|
||||
var stamplist = Y.Node.create('<ul role="menu" class="assignfeedback_editpdf_menu"/>');
|
||||
|
||||
// Build a list of stamped buttons.
|
||||
@@ -56,7 +56,7 @@ Y.extend(STAMPPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
|
||||
STAMPPICKER.superclass.initializer.call(this, config);
|
||||
},
|
||||
callback_handler : function(e) {
|
||||
callback_handler: function(e) {
|
||||
e.preventDefault();
|
||||
var callback = this.get('callback'),
|
||||
callbackcontext = this.get('context'),
|
||||
@@ -70,8 +70,8 @@ Y.extend(STAMPPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
bind();
|
||||
}
|
||||
}, {
|
||||
NAME : STAMPPICKER_NAME,
|
||||
ATTRS : {
|
||||
NAME: STAMPPICKER_NAME,
|
||||
ATTRS: {
|
||||
/**
|
||||
* The list of stamps this stamp picker supports.
|
||||
*
|
||||
@@ -79,8 +79,8 @@ Y.extend(STAMPPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
* @type String[] - the stamp filenames.
|
||||
* @default {}
|
||||
*/
|
||||
stamps : {
|
||||
value : []
|
||||
stamps: {
|
||||
value: []
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -90,8 +90,8 @@ Y.extend(STAMPPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
* @type function
|
||||
* @default null
|
||||
*/
|
||||
callback : {
|
||||
value : null
|
||||
callback: {
|
||||
value: null
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -101,8 +101,8 @@ Y.extend(STAMPPICKER, M.assignfeedback_editpdf.dropdown, {
|
||||
* @type Y.Node
|
||||
* @default null
|
||||
*/
|
||||
context : {
|
||||
value : null
|
||||
context: {
|
||||
value: null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ var CSS = {
|
||||
|
||||
// Loop through all the children of this container and turn
|
||||
// every odd node to a link to open/close the following panel.
|
||||
this.get('children').each(function () {
|
||||
this.get('children').each(function() {
|
||||
if (link) {
|
||||
COUNT++;
|
||||
// First convert the link to an anchor.
|
||||
|
||||
+4
-4
@@ -199,7 +199,7 @@ M.mod_quiz.autosave = {
|
||||
this.delay = delay * 1000;
|
||||
|
||||
this.form.delegate('valuechange', this.value_changed, this.SELECTORS.VALUE_CHANGE_ELEMENTS, this);
|
||||
this.form.delegate('change', this.value_changed, this.SELECTORS.CHANGE_ELEMENTS, this);
|
||||
this.form.delegate('change', this.value_changed, this.SELECTORS.CHANGE_ELEMENTS, this);
|
||||
this.form.on('submit', this.stop_autosaving, this);
|
||||
|
||||
this.init_tinymce(this.TINYMCE_DETECTION_REPEATS);
|
||||
@@ -210,7 +210,7 @@ M.mod_quiz.autosave = {
|
||||
|
||||
save_hidden_field_values: function() {
|
||||
this.form.all(this.SELECTORS.HIDDEN_INPUTS).each(function(hidden) {
|
||||
var name = hidden.get('name');
|
||||
var name = hidden.get('name');
|
||||
if (!name) {
|
||||
return;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ M.mod_quiz.autosave = {
|
||||
|
||||
detect_hidden_field_changes: function() {
|
||||
this.form.all(this.SELECTORS.HIDDEN_INPUTS).each(function(hidden) {
|
||||
var name = hidden.get('name'),
|
||||
var name = hidden.get('name'),
|
||||
value = hidden.get('value');
|
||||
if (!name) {
|
||||
return;
|
||||
@@ -386,7 +386,7 @@ M.mod_quiz.autosave = {
|
||||
|
||||
is_time_nearly_over: function() {
|
||||
return M.mod_quiz.timer && M.mod_quiz.timer.endtime &&
|
||||
(new Date().getTime() + 2*this.delay) > M.mod_quiz.timer.endtime;
|
||||
(new Date().getTime() + 2 * this.delay) > M.mod_quiz.timer.endtime;
|
||||
},
|
||||
|
||||
stop_autosaving: function() {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ var CSS = {
|
||||
LIGHTBOX: 'lightbox',
|
||||
MOVEDOWN: 'movedown',
|
||||
MOVEUP: 'moveup',
|
||||
PAGE : 'page',
|
||||
PAGE: 'page',
|
||||
PAGECONTENT: 'page-content',
|
||||
RIGHT: 'right',
|
||||
SECTION: 'slots',
|
||||
|
||||
+2
-2
@@ -170,12 +170,12 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, {
|
||||
window.location.reload(true);
|
||||
}
|
||||
},
|
||||
context:this
|
||||
context: this
|
||||
});
|
||||
},
|
||||
|
||||
global_drop_over: function(e) {
|
||||
//Overriding parent method so we can stop the slots being dragged before the first page node.
|
||||
// Overriding parent method so we can stop the slots being dragged before the first page node.
|
||||
|
||||
// Check that drop object belong to correct group.
|
||||
if (!e.drop || !e.drop.inGroup(this.groups)) {
|
||||
|
||||
+2
-2
@@ -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 = 'section';
|
||||
this.parentnodeclass = 'slots';
|
||||
|
||||
@@ -234,7 +234,7 @@ Y.extend(DRAGSECTION, M.core.dragdrop, {
|
||||
lightbox.hide();
|
||||
}
|
||||
},
|
||||
context:this
|
||||
context: this
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ Y.extend(MODFORM, Y.Base, {
|
||||
qppSelect: null,
|
||||
qppInitialValue: 0,
|
||||
|
||||
initializer: function () {
|
||||
initializer: function() {
|
||||
this.repaginateCheckbox = Y.one('#id_repaginatenow');
|
||||
if (!this.repaginateCheckbox) {
|
||||
// The checkbox only appears when editing an existing quiz.
|
||||
|
||||
+9
-9
@@ -18,7 +18,7 @@ var QUIZBASE = function() {
|
||||
*/
|
||||
Y.extend(QUIZBASE, Y.Base, {
|
||||
// Registered Modules
|
||||
registermodules : [],
|
||||
registermodules: [],
|
||||
|
||||
/**
|
||||
* Register a new Javascript Module
|
||||
@@ -27,7 +27,7 @@ Y.extend(QUIZBASE, 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;
|
||||
@@ -41,7 +41,7 @@ Y.extend(QUIZBASE, 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]) {
|
||||
@@ -52,8 +52,8 @@ Y.extend(QUIZBASE, Y.Base, {
|
||||
return this;
|
||||
}
|
||||
}, {
|
||||
NAME : QUIZBASENAME,
|
||||
ATTRS : {}
|
||||
NAME: QUIZBASENAME,
|
||||
ATTRS: {}
|
||||
});
|
||||
|
||||
// Ensure that M.course exists and that coursebase is initialised correctly
|
||||
@@ -73,8 +73,8 @@ M.mod_quiz.edit = M.mod_quiz.edit || {};
|
||||
*/
|
||||
M.mod_quiz.edit.swap_sections = function(Y, node1, node2) {
|
||||
var CSS = {
|
||||
COURSECONTENT : 'mod-quiz-edit-content',
|
||||
SECTIONADDMENUS : 'section_add_menus'
|
||||
COURSECONTENT: 'mod-quiz-edit-content',
|
||||
SECTIONADDMENUS: 'section_add_menus'
|
||||
};
|
||||
|
||||
var sectionlist = Y.Node.all('.' + CSS.COURSECONTENT + ' li.section');
|
||||
@@ -96,10 +96,10 @@ M.mod_quiz.edit.swap_sections = function(Y, node1, node2) {
|
||||
*/
|
||||
M.mod_quiz.edit.process_sections = function(Y, sectionlist, response, sectionfrom, sectionto) {
|
||||
var CSS = {
|
||||
SECTIONNAME : 'sectionname'
|
||||
SECTIONNAME: 'sectionname'
|
||||
},
|
||||
SELECTORS = {
|
||||
SECTIONLEFTSIDE : '.left .section-handle img'
|
||||
SECTIONLEFTSIDE: '.left .section-handle img'
|
||||
};
|
||||
|
||||
if (response.action === 'move') {
|
||||
|
||||
@@ -48,10 +48,10 @@ Y.extend(POPUP, Y.Base, {
|
||||
create_dialogue: function() {
|
||||
// Create a dialogue on the page and hide it.
|
||||
var config = {
|
||||
headerContent : '',
|
||||
bodyContent : Y.one(CSS.QBANKLOADING),
|
||||
draggable : true,
|
||||
modal : true,
|
||||
headerContent: '',
|
||||
bodyContent: Y.one(CSS.QBANKLOADING),
|
||||
draggable: true,
|
||||
modal: true,
|
||||
centered: true,
|
||||
width: null,
|
||||
visible: false,
|
||||
@@ -65,10 +65,10 @@ Y.extend(POPUP, Y.Base, {
|
||||
|
||||
this.loadingDiv = this.dialogue.bodyNode.getHTML();
|
||||
|
||||
Y.later(100, this, function() {this.load_content(window.location.search);});
|
||||
Y.later(100, this, function() { this.load_content(window.location.search); });
|
||||
},
|
||||
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
if (!Y.one(CSS.QBANKLOADING)) {
|
||||
return;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ Y.extend(POPUP, Y.Base, {
|
||||
Y.one('body').delegate('click', this.display_dialogue, CSS.ADDQUESTIONLINKS, this);
|
||||
},
|
||||
|
||||
display_dialogue : function (e) {
|
||||
display_dialogue: function(e) {
|
||||
e.preventDefault();
|
||||
this.dialogue.set('headerContent', e.currentTarget.getData(PARAMS.HEADER));
|
||||
|
||||
@@ -94,7 +94,7 @@ Y.extend(POPUP, Y.Base, {
|
||||
this.dialogue.show();
|
||||
},
|
||||
|
||||
load_content : function(queryString) {
|
||||
load_content: function(queryString) {
|
||||
Y.log('Starting load.', 'debug', 'moodle-mod_quiz-quizquestionbank');
|
||||
this.dialogue.bodyNode.append(this.loadingDiv);
|
||||
|
||||
@@ -127,7 +127,7 @@ Y.extend(POPUP, Y.Base, {
|
||||
Y.log('Load completed.', 'debug', 'moodle-mod_quiz-quizquestionbank');
|
||||
|
||||
this.dialogue.bodyNode.setHTML(result.contents);
|
||||
Y.use('moodle-question-chooser', function() {M.question.init_chooser({});});
|
||||
Y.use('moodle-question-chooser', function() { M.question.init_chooser({}); });
|
||||
this.dialogue.bodyNode.one('form').delegate('change', this.options_changed, '.searchoptions', this);
|
||||
|
||||
if (this.dialogue.visible) {
|
||||
|
||||
+8
-8
@@ -43,27 +43,27 @@ Y.extend(POPUP, Y.Base, {
|
||||
dialogue: function(header) {
|
||||
// Create a dialogue on the page and hide it.
|
||||
var config = {
|
||||
headerContent : header,
|
||||
bodyContent : Y.one(CSS.RANDOMQUESTIONFORM),
|
||||
draggable : true,
|
||||
modal : true,
|
||||
zIndex : 1000,
|
||||
headerContent: header,
|
||||
bodyContent: Y.one(CSS.RANDOMQUESTIONFORM),
|
||||
draggable: true,
|
||||
modal: true,
|
||||
zIndex: 1000,
|
||||
centered: false,
|
||||
width: 'auto',
|
||||
visible: false,
|
||||
postmethod: 'form',
|
||||
footerContent: null
|
||||
};
|
||||
var popup = { dialog: null };
|
||||
var popup = {dialog: null};
|
||||
popup.dialog = new M.core.dialogue(config);
|
||||
popup.dialog.show();
|
||||
},
|
||||
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
Y.one('body').delegate('click', this.display_dialogue, CSS.RANDOMQUESTIONLINKS, this);
|
||||
},
|
||||
|
||||
display_dialogue : function (e) {
|
||||
display_dialogue: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
Y.one(CSS.RANDOMQUESTIONFORM + ' ' + CSS.PAGEHIDDENINPUT).set('value',
|
||||
|
||||
+8
-8
@@ -41,7 +41,7 @@ Y.extend(POPUP, Y.Base, {
|
||||
header: null,
|
||||
body: null,
|
||||
|
||||
initializer : function() {
|
||||
initializer: function() {
|
||||
var rpcontainerclass = Y.one(CSS.REPAGINATECONTAINERCLASS);
|
||||
|
||||
// Set popup header and body.
|
||||
@@ -50,16 +50,16 @@ Y.extend(POPUP, Y.Base, {
|
||||
Y.one(CSS.REPAGINATECOMMAND).on('click', this.display_dialog, this);
|
||||
},
|
||||
|
||||
display_dialog : function (e) {
|
||||
display_dialog: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Configure the popup.
|
||||
var config = {
|
||||
headerContent : this.header,
|
||||
bodyContent : this.body,
|
||||
draggable : true,
|
||||
modal : true,
|
||||
zIndex : 1000,
|
||||
headerContent: this.header,
|
||||
bodyContent: this.body,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
zIndex: 1000,
|
||||
context: [CSS.REPAGINATECOMMAND, 'tr', 'br', ['beforeShow']],
|
||||
centered: false,
|
||||
width: '30em',
|
||||
@@ -68,7 +68,7 @@ Y.extend(POPUP, Y.Base, {
|
||||
footerContent: null
|
||||
};
|
||||
|
||||
var popup = { dialog: null };
|
||||
var popup = {dialog: null};
|
||||
popup.dialog = new M.core.dialogue(config);
|
||||
popup.dialog.show();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user