MDL-41987 Javascript: Tidy up YUI documentation

This commit is contained in:
Andrew Nicols
2014-03-25 17:01:37 +08:00
parent 0029497ca5
commit 1f777e5c6c
87 changed files with 1748 additions and 911 deletions
@@ -9,10 +9,10 @@ YUI.add('moodle-tool_capability-search', function (Y, NAME) {
/**
* Constructs a new capability search manager.
*
* @namespace M.tool_capability.search
* @namespace M.tool_capability
* @class Search
* @constructor
* @extends Y.Base
* @extends Base
*/
var SEARCH = function() {
SEARCH.superclass.constructor.apply(this, arguments);
@@ -144,17 +144,12 @@ Y.extend(SEARCH, Y.Base, SEARCH.prototype, {
}
});
/**
* Core namespace.
* @static
* @class tool_capability
*/
M.tool_capability = M.tool_capability || {};
/**
* Initialises capability search functionality.
* @static
* @method init_capability_search
* @method M.tool_capability.init_capability_search
* @param {Object} options
*/
M.tool_capability.init_capability_search = function(options) {
@@ -9,10 +9,10 @@ YUI.add('moodle-tool_capability-search', function (Y, NAME) {
/**
* Constructs a new capability search manager.
*
* @namespace M.tool_capability.search
* @namespace M.tool_capability
* @class Search
* @constructor
* @extends Y.Base
* @extends Base
*/
var SEARCH = function() {
SEARCH.superclass.constructor.apply(this, arguments);
@@ -144,17 +144,12 @@ Y.extend(SEARCH, Y.Base, SEARCH.prototype, {
}
});
/**
* Core namespace.
* @static
* @class tool_capability
*/
M.tool_capability = M.tool_capability || {};
/**
* Initialises capability search functionality.
* @static
* @method init_capability_search
* @method M.tool_capability.init_capability_search
* @param {Object} options
*/
M.tool_capability.init_capability_search = function(options) {
+3 -8
View File
@@ -7,10 +7,10 @@
/**
* Constructs a new capability search manager.
*
* @namespace M.tool_capability.search
* @namespace M.tool_capability
* @class Search
* @constructor
* @extends Y.Base
* @extends Base
*/
var SEARCH = function() {
SEARCH.superclass.constructor.apply(this, arguments);
@@ -142,17 +142,12 @@ Y.extend(SEARCH, Y.Base, SEARCH.prototype, {
}
});
/**
* Core namespace.
* @static
* @class tool_capability
*/
M.tool_capability = M.tool_capability || {};
/**
* Initialises capability search functionality.
* @static
* @method init_capability_search
* @method M.tool_capability.init_capability_search
* @param {Object} options
*/
M.tool_capability.init_capability_search = function(options) {
@@ -1,10 +0,0 @@
{
"moodle-backup-backupselectall": {
"requires": [
"node",
"event",
"node-event-simulate",
"anim"
]
}
}
@@ -11,8 +11,7 @@ YUI.add('moodle-block_navigation-navigation', function (Y, NAME) {
/**
* This namespace will contain all of the contents of the navigation blocks
* global navigation and settings.
* @namespace M
* @class block_navigation
* @class M.block_navigation
* @static
*/
M.block_navigation = M.block_navigation || {};
@@ -22,6 +21,7 @@ M.block_navigation = M.block_navigation || {};
* @property expandablebranchcount
* @protected
* @static
* @type Number
*/
M.block_navigation.expandablebranchcount = 1;
/**
@@ -30,6 +30,7 @@ M.block_navigation.expandablebranchcount = 1;
* @property courselimit
* @protected
* @static
* @type Number
*/
M.block_navigation.courselimit = 20;
/**
@@ -199,7 +200,7 @@ var NODETYPE = {
* @namespace M.block_navigation
* @class Tree
* @constructor
* @extends Y.Base
* @extends Base
*/
var TREE = function() {
TREE.superclass.constructor.apply(this, arguments);
@@ -208,7 +209,7 @@ TREE.prototype = {
/**
* The tree's ID, normally its block instance id.
* @property id
* @type Int
* @type Number
* @protected
*/
id : null,
@@ -390,7 +391,7 @@ Y.extend(TREE, Y.Base, TREE.prototype, {
/**
* The nodes that get shown.
* @attribute expansionlimit
* @type Integer
* @type Number
*/
expansionlimit : {
value : 0,
@@ -407,6 +408,10 @@ Y.extend(TREE, Y.Base, TREE.prototype, {
},
/**
* The navigation tree block instance.
*
* @attribute instance
* @default false
* @type Number
*/
instance : {
value : false,
@@ -426,7 +431,7 @@ Y.extend(TREE, Y.Base, TREE.prototype, {
* @namespace M.block_navigation
* @class Branch
* @constructor
* @extends Y.Base
* @extends Base
*/
BRANCH = function() {
BRANCH.superclass.constructor.apply(this, arguments);
@@ -814,7 +819,7 @@ Y.extend(BRANCH, Y.Base, BRANCH.prototype, {
/**
* The type of this branch.
* @attribute type
* @type Int
* @type Number
*/
type : {
value : null,
@@ -11,8 +11,7 @@ YUI.add('moodle-block_navigation-navigation', function (Y, NAME) {
/**
* This namespace will contain all of the contents of the navigation blocks
* global navigation and settings.
* @namespace M
* @class block_navigation
* @class M.block_navigation
* @static
*/
M.block_navigation = M.block_navigation || {};
@@ -22,6 +21,7 @@ M.block_navigation = M.block_navigation || {};
* @property expandablebranchcount
* @protected
* @static
* @type Number
*/
M.block_navigation.expandablebranchcount = 1;
/**
@@ -30,6 +30,7 @@ M.block_navigation.expandablebranchcount = 1;
* @property courselimit
* @protected
* @static
* @type Number
*/
M.block_navigation.courselimit = 20;
/**
@@ -199,7 +200,7 @@ var NODETYPE = {
* @namespace M.block_navigation
* @class Tree
* @constructor
* @extends Y.Base
* @extends Base
*/
var TREE = function() {
TREE.superclass.constructor.apply(this, arguments);
@@ -208,7 +209,7 @@ TREE.prototype = {
/**
* The tree's ID, normally its block instance id.
* @property id
* @type Int
* @type Number
* @protected
*/
id : null,
@@ -389,7 +390,7 @@ Y.extend(TREE, Y.Base, TREE.prototype, {
/**
* The nodes that get shown.
* @attribute expansionlimit
* @type Integer
* @type Number
*/
expansionlimit : {
value : 0,
@@ -406,6 +407,10 @@ Y.extend(TREE, Y.Base, TREE.prototype, {
},
/**
* The navigation tree block instance.
*
* @attribute instance
* @default false
* @type Number
*/
instance : {
value : false,
@@ -425,7 +430,7 @@ Y.extend(TREE, Y.Base, TREE.prototype, {
* @namespace M.block_navigation
* @class Branch
* @constructor
* @extends Y.Base
* @extends Base
*/
BRANCH = function() {
BRANCH.superclass.constructor.apply(this, arguments);
@@ -809,7 +814,7 @@ Y.extend(BRANCH, Y.Base, BRANCH.prototype, {
/**
* The type of this branch.
* @attribute type
* @type Int
* @type Number
*/
type : {
value : null,
+12 -7
View File
@@ -9,8 +9,7 @@
/**
* This namespace will contain all of the contents of the navigation blocks
* global navigation and settings.
* @namespace M
* @class block_navigation
* @class M.block_navigation
* @static
*/
M.block_navigation = M.block_navigation || {};
@@ -20,6 +19,7 @@ M.block_navigation = M.block_navigation || {};
* @property expandablebranchcount
* @protected
* @static
* @type Number
*/
M.block_navigation.expandablebranchcount = 1;
/**
@@ -28,6 +28,7 @@ M.block_navigation.expandablebranchcount = 1;
* @property courselimit
* @protected
* @static
* @type Number
*/
M.block_navigation.courselimit = 20;
/**
@@ -197,7 +198,7 @@ var NODETYPE = {
* @namespace M.block_navigation
* @class Tree
* @constructor
* @extends Y.Base
* @extends Base
*/
var TREE = function() {
TREE.superclass.constructor.apply(this, arguments);
@@ -206,7 +207,7 @@ TREE.prototype = {
/**
* The tree's ID, normally its block instance id.
* @property id
* @type Int
* @type Number
* @protected
*/
id : null,
@@ -388,7 +389,7 @@ Y.extend(TREE, Y.Base, TREE.prototype, {
/**
* The nodes that get shown.
* @attribute expansionlimit
* @type Integer
* @type Number
*/
expansionlimit : {
value : 0,
@@ -405,6 +406,10 @@ Y.extend(TREE, Y.Base, TREE.prototype, {
},
/**
* The navigation tree block instance.
*
* @attribute instance
* @default false
* @type Number
*/
instance : {
value : false,
@@ -424,7 +429,7 @@ Y.extend(TREE, Y.Base, TREE.prototype, {
* @namespace M.block_navigation
* @class Branch
* @constructor
* @extends Y.Base
* @extends Base
*/
BRANCH = function() {
BRANCH.superclass.constructor.apply(this, arguments);
@@ -812,7 +817,7 @@ Y.extend(BRANCH, Y.Base, BRANCH.prototype, {
/**
* The type of this branch.
* @attribute type
* @type Int
* @type Number
*/
type : {
value : null,
@@ -69,6 +69,7 @@ M.course.format = M.course.format || {};
/**
* Swap section (should be defined in format.js if requred)
*
* @method M.course.format.swap_sections
* @param {YUI} Y YUI3 instance
* @param {string} node1 node to swap to
* @param {string} node2 node to swap with
@@ -83,12 +84,12 @@ M.course.format.swap_sections = M.course.format.swap_sections || function() {
* If some response is expected, we pass it over to format, as it knows better
* hot to process it.
*
* @method M.course.format.process_sections
* @param {YUI} Y YUI3 instance
* @param {NodeList} list of sections
* @param {array} response ajax response
* @param {string} sectionfrom first affected section
* @param {string} sectionto last affected section
* @return void
*/
M.course.format.process_sections = M.course.format.process_sections || function() {
return null;
@@ -98,6 +99,7 @@ M.course.format.process_sections = M.course.format.process_sections || function(
* Get sections config for this format, for examples see function definition
* in the formats.
*
* @method M.course.format.get_config
* @return {object} section list configuration
*/
M.course.format.get_config = M.course.format.get_config || function() {
@@ -114,6 +116,7 @@ M.course.format.get_config = M.course.format.get_config || function() {
/**
* Get section list for this format (usually items inside container_node.container_class selector)
*
* @method M.course.format.get_section_selector
* @param {YUI} Y YUI3 instance
* @return {string} section selector
*/
@@ -130,6 +133,7 @@ M.course.format.get_section_selector = M.course.format.get_section_selector || f
* Get section wraper for this format (only used in case when each
* container_node.container_class node is wrapped in some other element).
*
* @method M.course.format.get_section_wrapper
* @param {YUI} Y YUI3 instance
* @return {string} section wrapper selector or M.course.format.get_section_selector
* if section_wrapper_node and section_wrapper_class are not defined in the format config.
@@ -145,6 +149,7 @@ M.course.format.get_section_wrapper = M.course.format.get_section_wrapper || fun
/**
* Get the tag of container node
*
* @method M.course.format.get_containernode
* @return {string} tag of container node.
*/
M.course.format.get_containernode = M.course.format.get_containernode || function() {
@@ -159,6 +164,7 @@ M.course.format.get_containernode = M.course.format.get_containernode || functio
/**
* Get the class of container node
*
* @method M.course.format.get_containerclass
* @return {string} class of the container node.
*/
M.course.format.get_containerclass = M.course.format.get_containerclass || function() {
@@ -173,6 +179,7 @@ M.course.format.get_containerclass = M.course.format.get_containerclass || funct
/**
* Get the tag of draggable node (section wrapper if exists, otherwise section)
*
* @method M.course.format.get_sectionwrappernode
* @return {string} tag of the draggable node.
*/
M.course.format.get_sectionwrappernode = M.course.format.get_sectionwrappernode || function() {
@@ -187,6 +194,7 @@ M.course.format.get_sectionwrappernode = M.course.format.get_sectionwrappernode
/**
* Get the class of draggable node (section wrapper if exists, otherwise section)
*
* @method M.course.format.get_sectionwrapperclass
* @return {string} class of the draggable node.
*/
M.course.format.get_sectionwrapperclass = M.course.format.get_sectionwrapperclass || function() {
@@ -201,6 +209,7 @@ M.course.format.get_sectionwrapperclass = M.course.format.get_sectionwrapperclas
/**
* Get the tag of section node
*
* @method M.course.format.get_sectionnode
* @return {string} tag of section node.
*/
M.course.format.get_sectionnode = M.course.format.get_sectionnode || function() {
@@ -215,6 +224,7 @@ M.course.format.get_sectionnode = M.course.format.get_sectionnode || function()
/**
* Get the class of section node
*
* @method M.course.format.get_sectionclass
* @return {string} class of the section node.
*/
M.course.format.get_sectionclass = M.course.format.get_sectionclass || function() {
@@ -69,6 +69,7 @@ M.course.format = M.course.format || {};
/**
* Swap section (should be defined in format.js if requred)
*
* @method M.course.format.swap_sections
* @param {YUI} Y YUI3 instance
* @param {string} node1 node to swap to
* @param {string} node2 node to swap with
@@ -83,12 +84,12 @@ M.course.format.swap_sections = M.course.format.swap_sections || function() {
* If some response is expected, we pass it over to format, as it knows better
* hot to process it.
*
* @method M.course.format.process_sections
* @param {YUI} Y YUI3 instance
* @param {NodeList} list of sections
* @param {array} response ajax response
* @param {string} sectionfrom first affected section
* @param {string} sectionto last affected section
* @return void
*/
M.course.format.process_sections = M.course.format.process_sections || function() {
return null;
@@ -98,6 +99,7 @@ M.course.format.process_sections = M.course.format.process_sections || function(
* Get sections config for this format, for examples see function definition
* in the formats.
*
* @method M.course.format.get_config
* @return {object} section list configuration
*/
M.course.format.get_config = M.course.format.get_config || function() {
@@ -114,6 +116,7 @@ M.course.format.get_config = M.course.format.get_config || function() {
/**
* Get section list for this format (usually items inside container_node.container_class selector)
*
* @method M.course.format.get_section_selector
* @param {YUI} Y YUI3 instance
* @return {string} section selector
*/
@@ -129,6 +132,7 @@ M.course.format.get_section_selector = M.course.format.get_section_selector || f
* Get section wraper for this format (only used in case when each
* container_node.container_class node is wrapped in some other element).
*
* @method M.course.format.get_section_wrapper
* @param {YUI} Y YUI3 instance
* @return {string} section wrapper selector or M.course.format.get_section_selector
* if section_wrapper_node and section_wrapper_class are not defined in the format config.
@@ -144,6 +148,7 @@ M.course.format.get_section_wrapper = M.course.format.get_section_wrapper || fun
/**
* Get the tag of container node
*
* @method M.course.format.get_containernode
* @return {string} tag of container node.
*/
M.course.format.get_containernode = M.course.format.get_containernode || function() {
@@ -157,6 +162,7 @@ M.course.format.get_containernode = M.course.format.get_containernode || functio
/**
* Get the class of container node
*
* @method M.course.format.get_containerclass
* @return {string} class of the container node.
*/
M.course.format.get_containerclass = M.course.format.get_containerclass || function() {
@@ -170,6 +176,7 @@ M.course.format.get_containerclass = M.course.format.get_containerclass || funct
/**
* Get the tag of draggable node (section wrapper if exists, otherwise section)
*
* @method M.course.format.get_sectionwrappernode
* @return {string} tag of the draggable node.
*/
M.course.format.get_sectionwrappernode = M.course.format.get_sectionwrappernode || function() {
@@ -184,6 +191,7 @@ M.course.format.get_sectionwrappernode = M.course.format.get_sectionwrappernode
/**
* Get the class of draggable node (section wrapper if exists, otherwise section)
*
* @method M.course.format.get_sectionwrapperclass
* @return {string} class of the draggable node.
*/
M.course.format.get_sectionwrapperclass = M.course.format.get_sectionwrapperclass || function() {
@@ -198,6 +206,7 @@ M.course.format.get_sectionwrapperclass = M.course.format.get_sectionwrapperclas
/**
* Get the tag of section node
*
* @method M.course.format.get_sectionnode
* @return {string} tag of section node.
*/
M.course.format.get_sectionnode = M.course.format.get_sectionnode || function() {
@@ -211,6 +220,7 @@ M.course.format.get_sectionnode = M.course.format.get_sectionnode || function()
/**
* Get the class of section node
*
* @method M.course.format.get_sectionclass
* @return {string} class of the section node.
*/
M.course.format.get_sectionclass = M.course.format.get_sectionclass || function() {
@@ -14,7 +14,7 @@ YUI.add('moodle-course-management', function (Y, NAME) {
* @namespace M.course.management
* @class Console
* @constructor
* @extends Y.Base
* @extends Base
*/
function Console() {
Console.superclass.constructor.apply(this, arguments);
@@ -245,7 +245,7 @@ Console.prototype = {
* Initialises all the categories being shown.
* @method initialiseCategories
* @private
* @returns {boolean}
* @return {boolean}
*/
initialiseCategories : function(listing) {
var count = 0;
@@ -289,7 +289,7 @@ Console.prototype = {
* Initialises all the categories being shown.
* @method initialiseCourses
* @private
* @returns {boolean}
* @return {boolean}
*/
initialiseCourses : function() {
var category = this.getCategoryById(this.get('activecategoryid')),
@@ -483,7 +483,7 @@ Console.prototype = {
* Returns the category with the given ID.
* @method getCategoryById
* @param {Number} id
* @returns {Category|Boolean} The category or false if it can't be found.
* @return {Category|Boolean} The category or false if it can't be found.
*/
getCategoryById : function(id) {
var i,
@@ -505,7 +505,7 @@ Console.prototype = {
* Returns the course with the given id.
* @method getCourseById
* @param {Number} id
* @returns {Course|Boolean} The course or false if not found/
* @return {Course|Boolean} The course or false if not found/
*/
getCourseById : function(id) {
var i,
@@ -580,18 +580,21 @@ M.course.management.console = null;
/**
* Initalises the course management console.
*
* @method M.course.management.init
* @static
* @param {Object} config
*/
M.course.management.init = function(config) {
M.course.management.console = new Console(config);
};/**
};
/**
* Drag and Drop handler
*
* @namespace M.course.management
* @class DragDrop
* @constructor
* @extends Y.Base
* @extends Base
*/
function DragDrop(config) {
Console.superclass.constructor.apply(this, [config]);
@@ -853,14 +856,14 @@ DragDrop.prototype = {
}
}
};
Y.extend(DragDrop, Y.Base, DragDrop.prototype);/**
Y.extend(DragDrop, Y.Base, DragDrop.prototype);
/**
* A managed course.
*
* @namespace M.course.management
* @class Item
* @constructor
* @extends Y.Base
* @abstract
* @extends Base
*/
function Item() {
Item.superclass.constructor.apply(this, arguments);
@@ -910,7 +913,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Object|Boolean}
* @return {Object|Boolean}
*/
checkAjaxResponse : function(transactionid, response, args) {
if (response.status !== 200) {
@@ -938,7 +941,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
moveup : function(transactionid, response, args) {
var node,
@@ -1006,7 +1009,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
movedown : function(transactionid, response, args) {
var node,
@@ -1074,7 +1077,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
show : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1110,7 +1113,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
hide : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1167,7 +1170,8 @@ Item.prototype = {
}, 2500);
}
};
Y.extend(Item, Y.Base, Item.prototype);/**
Y.extend(Item, Y.Base, Item.prototype);
/**
* A managed category.
*
* @namespace M.course.management
@@ -1245,7 +1249,7 @@ Category.prototype = {
/**
* Returns the name of the category.
* @method getName
* @returns {String}
* @return {String}
*/
getName : function() {
return this.get('node').one('a.categoryname').get('innerHTML');
@@ -1268,7 +1272,7 @@ Category.prototype = {
* @method handle
* @param {String} action
* @param {EventFacade} e
* @returns {Boolean}
* @return {Boolean}
*/
handle : function(action, e) {
var catarg = {categoryid : this.get('categoryid')},
@@ -1438,7 +1442,7 @@ Category.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
completeMoveCourse : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1492,7 +1496,7 @@ Category.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
show : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1524,7 +1528,7 @@ Category.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
hide : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1608,7 +1612,8 @@ Category.prototype = {
return this;
}
};
Y.extend(Category, Item, Category.prototype);/**
Y.extend(Category, Item, Category.prototype);
/**
* A managed course.
*
* @namespace M.course.management
@@ -1687,7 +1692,7 @@ Course.prototype = {
/**
* Returns the name of the course.
* @method getName
* @returns {String}
* @return {String}
*/
getName : function() {
return this.get('node').one('a.coursename').get('innerHTML');
@@ -1698,7 +1703,7 @@ Course.prototype = {
* @method handle
* @param {String} action
* @param {EventFacade} e
* @returns {Boolean}
* @return {Boolean}
*/
handle : function(action, e) {
var managementconsole = this.get('console'),
@@ -1771,7 +1776,7 @@ Course.prototype = {
* @param {Number} transactionid The transaction ID for the request.
* @param {Object} response The response to the request.
* @param {Objects} args The arguments that were given with the request.
* @returns {Boolean}
* @return {Boolean}
*/
moveAfterResponse : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1795,6 +1800,7 @@ Course.prototype = {
};
Y.extend(Course, Item, Course.prototype);
}, '@VERSION@', {
"requires": [
"base",
@@ -14,7 +14,7 @@ YUI.add('moodle-course-management', function (Y, NAME) {
* @namespace M.course.management
* @class Console
* @constructor
* @extends Y.Base
* @extends Base
*/
function Console() {
Console.superclass.constructor.apply(this, arguments);
@@ -244,7 +244,7 @@ Console.prototype = {
* Initialises all the categories being shown.
* @method initialiseCategories
* @private
* @returns {boolean}
* @return {boolean}
*/
initialiseCategories : function(listing) {
var count = 0;
@@ -286,7 +286,7 @@ Console.prototype = {
* Initialises all the categories being shown.
* @method initialiseCourses
* @private
* @returns {boolean}
* @return {boolean}
*/
initialiseCourses : function() {
var category = this.getCategoryById(this.get('activecategoryid')),
@@ -477,7 +477,7 @@ Console.prototype = {
* Returns the category with the given ID.
* @method getCategoryById
* @param {Number} id
* @returns {Category|Boolean} The category or false if it can't be found.
* @return {Category|Boolean} The category or false if it can't be found.
*/
getCategoryById : function(id) {
var i,
@@ -499,7 +499,7 @@ Console.prototype = {
* Returns the course with the given id.
* @method getCourseById
* @param {Number} id
* @returns {Course|Boolean} The course or false if not found/
* @return {Course|Boolean} The course or false if not found/
*/
getCourseById : function(id) {
var i,
@@ -573,18 +573,21 @@ M.course.management.console = null;
/**
* Initalises the course management console.
*
* @method M.course.management.init
* @static
* @param {Object} config
*/
M.course.management.init = function(config) {
M.course.management.console = new Console(config);
};/**
};
/**
* Drag and Drop handler
*
* @namespace M.course.management
* @class DragDrop
* @constructor
* @extends Y.Base
* @extends Base
*/
function DragDrop(config) {
Console.superclass.constructor.apply(this, [config]);
@@ -843,14 +846,14 @@ DragDrop.prototype = {
}
}
};
Y.extend(DragDrop, Y.Base, DragDrop.prototype);/**
Y.extend(DragDrop, Y.Base, DragDrop.prototype);
/**
* A managed course.
*
* @namespace M.course.management
* @class Item
* @constructor
* @extends Y.Base
* @abstract
* @extends Base
*/
function Item() {
Item.superclass.constructor.apply(this, arguments);
@@ -900,7 +903,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Object|Boolean}
* @return {Object|Boolean}
*/
checkAjaxResponse : function(transactionid, response, args) {
if (response.status !== 200) {
@@ -926,7 +929,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
moveup : function(transactionid, response, args) {
var node,
@@ -991,7 +994,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
movedown : function(transactionid, response, args) {
var node,
@@ -1056,7 +1059,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
show : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1089,7 +1092,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
hide : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1143,7 +1146,8 @@ Item.prototype = {
}, 2500);
}
};
Y.extend(Item, Y.Base, Item.prototype);/**
Y.extend(Item, Y.Base, Item.prototype);
/**
* A managed category.
*
* @namespace M.course.management
@@ -1221,7 +1225,7 @@ Category.prototype = {
/**
* Returns the name of the category.
* @method getName
* @returns {String}
* @return {String}
*/
getName : function() {
return this.get('node').one('a.categoryname').get('innerHTML');
@@ -1244,7 +1248,7 @@ Category.prototype = {
* @method handle
* @param {String} action
* @param {EventFacade} e
* @returns {Boolean}
* @return {Boolean}
*/
handle : function(action, e) {
var catarg = {categoryid : this.get('categoryid')},
@@ -1411,7 +1415,7 @@ Category.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
completeMoveCourse : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1462,7 +1466,7 @@ Category.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
show : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1492,7 +1496,7 @@ Category.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
hide : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1570,7 +1574,8 @@ Category.prototype = {
return this;
}
};
Y.extend(Category, Item, Category.prototype);/**
Y.extend(Category, Item, Category.prototype);
/**
* A managed course.
*
* @namespace M.course.management
@@ -1649,7 +1654,7 @@ Course.prototype = {
/**
* Returns the name of the course.
* @method getName
* @returns {String}
* @return {String}
*/
getName : function() {
return this.get('node').one('a.coursename').get('innerHTML');
@@ -1660,7 +1665,7 @@ Course.prototype = {
* @method handle
* @param {String} action
* @param {EventFacade} e
* @returns {Boolean}
* @return {Boolean}
*/
handle : function(action, e) {
var managementconsole = this.get('console'),
@@ -1732,7 +1737,7 @@ Course.prototype = {
* @param {Number} transactionid The transaction ID for the request.
* @param {Object} response The response to the request.
* @param {Objects} args The arguments that were given with the request.
* @returns {Boolean}
* @return {Boolean}
*/
moveAfterResponse : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -1754,6 +1759,7 @@ Course.prototype = {
};
Y.extend(Course, Item, Course.prototype);
}, '@VERSION@', {
"requires": [
"base",
@@ -3,7 +3,7 @@ YUI.add('moodle-course-modchooser', function (Y, NAME) {
/**
* The activity chooser dialogue for courses.
*
* @moodle-course-modchooser
* @module moodle-course-modchooser
*/
var CSS = {
@@ -28,9 +28,21 @@ var MODCHOOSER = function() {
};
Y.extend(MODCHOOSER, M.core.chooserdialogue, {
// The current section ID
/**
* The current section ID.
*
* @property sectionid
* @private
* @type Number
* @default null
*/
sectionid : null,
/**
* Set up the activity chooser.
*
* @method initializer
*/
initializer : function() {
var dialogue = Y.one('.chooserdialoguebody');
var header = Y.one('.choosertitle');
@@ -44,12 +56,13 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
// Catch the page toggle
Y.all('.block_settings #settingsnav .type_course .modchoosertoggle a').on('click', this.toggle_mod_chooser, this);
},
/**
* Update any section areas within the scope of the specified
* selector with AJAX equivalents
*
* @method setup_for_section
* @param baseselector The selector to limit scope to
* @return void
*/
setup_for_section : function(baseselector) {
if (!baseselector) {
@@ -71,6 +84,15 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
this._setup_for_section(section);
}, this);
},
/**
* Update any section areas within the scope of the specified
* selector with AJAX equivalents
*
* @method _setup_for_section
* @private
* @param baseselector The selector to limit scope to
*/
_setup_for_section : function(section) {
var chooserspan = section.one(CSS.SECTIONMODCHOOSER);
if (!chooserspan) {
@@ -84,12 +106,11 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
chooserlink.on('click', this.display_mod_chooser, this);
},
/**
* Display the module chooser
*
* @param e Event Triggering Event
* @param secitonid integer The ID of the section triggering the dialogue
* @return void
*/
* Display the module chooser
*
* @method display_mod_chooser
* @param {EventFacade} e Triggering Event
*/
display_mod_chooser : function (e) {
// Set the section for this version of the dialogue
if (e.target.ancestor(CSS.SITETOPIC)) {
@@ -104,6 +125,13 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
}
this.display_chooser(e);
},
/**
* Toggle availability of the activity chooser.
*
* @method toggle_mod_chooser
* @param {EventFacade} e
*/
toggle_mod_chooser : function(e) {
// Get the add section link
var modchooserlinks = Y.all('div.addresourcemodchooser');
@@ -153,6 +181,15 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
// Prevent the page from reloading
e.preventDefault();
},
/**
* Helper function to set the value of a hidden radio button when a
* selection is made.
*
* @method option_selected
* @param {String} thisoption The selected option value
* @private
*/
option_selected : function(thisoption) {
// Add the sectionid to the URL.
this.hiddenRadioValue.setAttrs({
@@ -164,6 +201,13 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
{
NAME : MODCHOOSERNAME,
ATTRS : {
/**
* The maximum height (in pixels) of the activity chooser.
*
* @attribute maxheight
* @type Number
* @default 800
*/
maxheight : {
value : 800
}
@@ -3,7 +3,7 @@ YUI.add('moodle-course-modchooser', function (Y, NAME) {
/**
* The activity chooser dialogue for courses.
*
* @moodle-course-modchooser
* @module moodle-course-modchooser
*/
var CSS = {
@@ -28,9 +28,21 @@ var MODCHOOSER = function() {
};
Y.extend(MODCHOOSER, M.core.chooserdialogue, {
// The current section ID
/**
* The current section ID.
*
* @property sectionid
* @private
* @type Number
* @default null
*/
sectionid : null,
/**
* Set up the activity chooser.
*
* @method initializer
*/
initializer : function() {
var dialogue = Y.one('.chooserdialoguebody');
var header = Y.one('.choosertitle');
@@ -44,12 +56,13 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
// Catch the page toggle
Y.all('.block_settings #settingsnav .type_course .modchoosertoggle a').on('click', this.toggle_mod_chooser, this);
},
/**
* Update any section areas within the scope of the specified
* selector with AJAX equivalents
*
* @method setup_for_section
* @param baseselector The selector to limit scope to
* @return void
*/
setup_for_section : function(baseselector) {
if (!baseselector) {
@@ -71,6 +84,15 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
this._setup_for_section(section);
}, this);
},
/**
* Update any section areas within the scope of the specified
* selector with AJAX equivalents
*
* @method _setup_for_section
* @private
* @param baseselector The selector to limit scope to
*/
_setup_for_section : function(section) {
var chooserspan = section.one(CSS.SECTIONMODCHOOSER);
if (!chooserspan) {
@@ -84,12 +106,11 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
chooserlink.on('click', this.display_mod_chooser, this);
},
/**
* Display the module chooser
*
* @param e Event Triggering Event
* @param secitonid integer The ID of the section triggering the dialogue
* @return void
*/
* Display the module chooser
*
* @method display_mod_chooser
* @param {EventFacade} e Triggering Event
*/
display_mod_chooser : function (e) {
// Set the section for this version of the dialogue
if (e.target.ancestor(CSS.SITETOPIC)) {
@@ -104,6 +125,13 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
}
this.display_chooser(e);
},
/**
* Toggle availability of the activity chooser.
*
* @method toggle_mod_chooser
* @param {EventFacade} e
*/
toggle_mod_chooser : function(e) {
// Get the add section link
var modchooserlinks = Y.all('div.addresourcemodchooser');
@@ -153,6 +181,15 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
// Prevent the page from reloading
e.preventDefault();
},
/**
* Helper function to set the value of a hidden radio button when a
* selection is made.
*
* @method option_selected
* @param {String} thisoption The selected option value
* @private
*/
option_selected : function(thisoption) {
// Add the sectionid to the URL.
this.hiddenRadioValue.setAttrs({
@@ -164,6 +201,13 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
{
NAME : MODCHOOSERNAME,
ATTRS : {
/**
* The maximum height (in pixels) of the activity chooser.
*
* @attribute maxheight
* @type Number
* @default 800
*/
maxheight : {
value : 800
}
@@ -296,7 +296,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
* @protected
* @method handle_data_action
* @param {EventFacade} ev The event that was triggered.
* @returns {boolean}
* @return {boolean}
*/
handle_data_action: function(ev) {
// We need to get the anchor element that triggered this event.
@@ -587,7 +587,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
* @param {Node} button The button that triggered the action.
* @param {Node} activity The activity node that this action will be performed on.
* @param {String} action 'show' or 'hide'.
* @returns {Number} 1 if we changed to visible, 0 if we were hiding.
* @return {Number} 1 if we changed to visible, 0 if we were hiding.
*/
handle_resource_dim: function(button, activity, action) {
var toggleclass = CSS.DIMCLASS,
@@ -296,7 +296,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
* @protected
* @method handle_data_action
* @param {EventFacade} ev The event that was triggered.
* @returns {boolean}
* @return {boolean}
*/
handle_data_action: function(ev) {
// We need to get the anchor element that triggered this event.
@@ -587,7 +587,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
* @param {Node} button The button that triggered the action.
* @param {Node} activity The activity node that this action will be performed on.
* @param {String} action 'show' or 'hide'.
* @returns {Number} 1 if we changed to visible, 0 if we were hiding.
* @return {Number} 1 if we changed to visible, 0 if we were hiding.
*/
handle_resource_dim: function(button, activity, action) {
var toggleclass = CSS.DIMCLASS,
+11 -1
View File
@@ -67,6 +67,7 @@ M.course.format = M.course.format || {};
/**
* Swap section (should be defined in format.js if requred)
*
* @method M.course.format.swap_sections
* @param {YUI} Y YUI3 instance
* @param {string} node1 node to swap to
* @param {string} node2 node to swap with
@@ -81,12 +82,12 @@ M.course.format.swap_sections = M.course.format.swap_sections || function() {
* If some response is expected, we pass it over to format, as it knows better
* hot to process it.
*
* @method M.course.format.process_sections
* @param {YUI} Y YUI3 instance
* @param {NodeList} list of sections
* @param {array} response ajax response
* @param {string} sectionfrom first affected section
* @param {string} sectionto last affected section
* @return void
*/
M.course.format.process_sections = M.course.format.process_sections || function() {
return null;
@@ -96,6 +97,7 @@ M.course.format.process_sections = M.course.format.process_sections || function(
* Get sections config for this format, for examples see function definition
* in the formats.
*
* @method M.course.format.get_config
* @return {object} section list configuration
*/
M.course.format.get_config = M.course.format.get_config || function() {
@@ -112,6 +114,7 @@ M.course.format.get_config = M.course.format.get_config || function() {
/**
* Get section list for this format (usually items inside container_node.container_class selector)
*
* @method M.course.format.get_section_selector
* @param {YUI} Y YUI3 instance
* @return {string} section selector
*/
@@ -128,6 +131,7 @@ M.course.format.get_section_selector = M.course.format.get_section_selector || f
* Get section wraper for this format (only used in case when each
* container_node.container_class node is wrapped in some other element).
*
* @method M.course.format.get_section_wrapper
* @param {YUI} Y YUI3 instance
* @return {string} section wrapper selector or M.course.format.get_section_selector
* if section_wrapper_node and section_wrapper_class are not defined in the format config.
@@ -143,6 +147,7 @@ M.course.format.get_section_wrapper = M.course.format.get_section_wrapper || fun
/**
* Get the tag of container node
*
* @method M.course.format.get_containernode
* @return {string} tag of container node.
*/
M.course.format.get_containernode = M.course.format.get_containernode || function() {
@@ -157,6 +162,7 @@ M.course.format.get_containernode = M.course.format.get_containernode || functio
/**
* Get the class of container node
*
* @method M.course.format.get_containerclass
* @return {string} class of the container node.
*/
M.course.format.get_containerclass = M.course.format.get_containerclass || function() {
@@ -171,6 +177,7 @@ M.course.format.get_containerclass = M.course.format.get_containerclass || funct
/**
* Get the tag of draggable node (section wrapper if exists, otherwise section)
*
* @method M.course.format.get_sectionwrappernode
* @return {string} tag of the draggable node.
*/
M.course.format.get_sectionwrappernode = M.course.format.get_sectionwrappernode || function() {
@@ -185,6 +192,7 @@ M.course.format.get_sectionwrappernode = M.course.format.get_sectionwrappernode
/**
* Get the class of draggable node (section wrapper if exists, otherwise section)
*
* @method M.course.format.get_sectionwrapperclass
* @return {string} class of the draggable node.
*/
M.course.format.get_sectionwrapperclass = M.course.format.get_sectionwrapperclass || function() {
@@ -199,6 +207,7 @@ M.course.format.get_sectionwrapperclass = M.course.format.get_sectionwrapperclas
/**
* Get the tag of section node
*
* @method M.course.format.get_sectionnode
* @return {string} tag of section node.
*/
M.course.format.get_sectionnode = M.course.format.get_sectionnode || function() {
@@ -213,6 +222,7 @@ M.course.format.get_sectionnode = M.course.format.get_sectionnode || function()
/**
* Get the class of section node
*
* @method M.course.format.get_sectionclass
* @return {string} class of the section node.
*/
M.course.format.get_sectionclass = M.course.format.get_sectionclass || function() {
+6 -6
View File
@@ -76,7 +76,7 @@ Category.prototype = {
/**
* Returns the name of the category.
* @method getName
* @returns {String}
* @return {String}
*/
getName : function() {
return this.get('node').one('a.categoryname').get('innerHTML');
@@ -99,7 +99,7 @@ Category.prototype = {
* @method handle
* @param {String} action
* @param {EventFacade} e
* @returns {Boolean}
* @return {Boolean}
*/
handle : function(action, e) {
var catarg = {categoryid : this.get('categoryid')},
@@ -269,7 +269,7 @@ Category.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
completeMoveCourse : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -323,7 +323,7 @@ Category.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
show : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -355,7 +355,7 @@ Category.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
hide : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -439,4 +439,4 @@ Category.prototype = {
return this;
}
};
Y.extend(Category, Item, Category.prototype);
Y.extend(Category, Item, Category.prototype);
+8 -6
View File
@@ -12,7 +12,7 @@
* @namespace M.course.management
* @class Console
* @constructor
* @extends Y.Base
* @extends Base
*/
function Console() {
Console.superclass.constructor.apply(this, arguments);
@@ -243,7 +243,7 @@ Console.prototype = {
* Initialises all the categories being shown.
* @method initialiseCategories
* @private
* @returns {boolean}
* @return {boolean}
*/
initialiseCategories : function(listing) {
var count = 0;
@@ -287,7 +287,7 @@ Console.prototype = {
* Initialises all the categories being shown.
* @method initialiseCourses
* @private
* @returns {boolean}
* @return {boolean}
*/
initialiseCourses : function() {
var category = this.getCategoryById(this.get('activecategoryid')),
@@ -481,7 +481,7 @@ Console.prototype = {
* Returns the category with the given ID.
* @method getCategoryById
* @param {Number} id
* @returns {Category|Boolean} The category or false if it can't be found.
* @return {Category|Boolean} The category or false if it can't be found.
*/
getCategoryById : function(id) {
var i,
@@ -503,7 +503,7 @@ Console.prototype = {
* Returns the course with the given id.
* @method getCourseById
* @param {Number} id
* @returns {Course|Boolean} The course or false if not found/
* @return {Course|Boolean} The course or false if not found/
*/
getCourseById : function(id) {
var i,
@@ -578,9 +578,11 @@ M.course.management.console = null;
/**
* Initalises the course management console.
*
* @method M.course.management.init
* @static
* @param {Object} config
*/
M.course.management.init = function(config) {
M.course.management.console = new Console(config);
};
};
+4 -4
View File
@@ -77,7 +77,7 @@ Course.prototype = {
/**
* Returns the name of the course.
* @method getName
* @returns {String}
* @return {String}
*/
getName : function() {
return this.get('node').one('a.coursename').get('innerHTML');
@@ -88,7 +88,7 @@ Course.prototype = {
* @method handle
* @param {String} action
* @param {EventFacade} e
* @returns {Boolean}
* @return {Boolean}
*/
handle : function(action, e) {
var managementconsole = this.get('console'),
@@ -161,7 +161,7 @@ Course.prototype = {
* @param {Number} transactionid The transaction ID for the request.
* @param {Object} response The response to the request.
* @param {Objects} args The arguments that were given with the request.
* @returns {Boolean}
* @return {Boolean}
*/
moveAfterResponse : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -183,4 +183,4 @@ Course.prototype = {
this.highlight();
}
};
Y.extend(Course, Item, Course.prototype);
Y.extend(Course, Item, Course.prototype);
+2 -2
View File
@@ -4,7 +4,7 @@
* @namespace M.course.management
* @class DragDrop
* @constructor
* @extends Y.Base
* @extends Base
*/
function DragDrop(config) {
Console.superclass.constructor.apply(this, [config]);
@@ -266,4 +266,4 @@ DragDrop.prototype = {
}
}
};
Y.extend(DragDrop, Y.Base, DragDrop.prototype);
Y.extend(DragDrop, Y.Base, DragDrop.prototype);
+7 -8
View File
@@ -4,8 +4,7 @@
* @namespace M.course.management
* @class Item
* @constructor
* @extends Y.Base
* @abstract
* @extends Base
*/
function Item() {
Item.superclass.constructor.apply(this, arguments);
@@ -55,7 +54,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Object|Boolean}
* @return {Object|Boolean}
*/
checkAjaxResponse : function(transactionid, response, args) {
if (response.status !== 200) {
@@ -83,7 +82,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
moveup : function(transactionid, response, args) {
var node,
@@ -151,7 +150,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
movedown : function(transactionid, response, args) {
var node,
@@ -219,7 +218,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
show : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -255,7 +254,7 @@ Item.prototype = {
* @param {Number} transactionid The transaction ID of the AJAX request (unique)
* @param {Object} response The response from the AJAX request.
* @param {Object} args The arguments given to the request.
* @returns {Boolean}
* @return {Boolean}
*/
hide : function(transactionid, response, args) {
var outcome = this.checkAjaxResponse(transactionid, response, args),
@@ -312,4 +311,4 @@ Item.prototype = {
}, 2500);
}
};
Y.extend(Item, Y.Base, Item.prototype);
Y.extend(Item, Y.Base, Item.prototype);
+53 -9
View File
@@ -1,7 +1,7 @@
/**
* The activity chooser dialogue for courses.
*
* @moodle-course-modchooser
* @module moodle-course-modchooser
*/
var CSS = {
@@ -26,9 +26,21 @@ var MODCHOOSER = function() {
};
Y.extend(MODCHOOSER, M.core.chooserdialogue, {
// The current section ID
/**
* The current section ID.
*
* @property sectionid
* @private
* @type Number
* @default null
*/
sectionid : null,
/**
* Set up the activity chooser.
*
* @method initializer
*/
initializer : function() {
var dialogue = Y.one('.chooserdialoguebody');
var header = Y.one('.choosertitle');
@@ -42,12 +54,13 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
// Catch the page toggle
Y.all('.block_settings #settingsnav .type_course .modchoosertoggle a').on('click', this.toggle_mod_chooser, this);
},
/**
* Update any section areas within the scope of the specified
* selector with AJAX equivalents
*
* @method setup_for_section
* @param baseselector The selector to limit scope to
* @return void
*/
setup_for_section : function(baseselector) {
if (!baseselector) {
@@ -69,6 +82,15 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
this._setup_for_section(section);
}, this);
},
/**
* Update any section areas within the scope of the specified
* selector with AJAX equivalents
*
* @method _setup_for_section
* @private
* @param baseselector The selector to limit scope to
*/
_setup_for_section : function(section) {
var chooserspan = section.one(CSS.SECTIONMODCHOOSER);
if (!chooserspan) {
@@ -82,12 +104,11 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
chooserlink.on('click', this.display_mod_chooser, this);
},
/**
* Display the module chooser
*
* @param e Event Triggering Event
* @param secitonid integer The ID of the section triggering the dialogue
* @return void
*/
* Display the module chooser
*
* @method display_mod_chooser
* @param {EventFacade} e Triggering Event
*/
display_mod_chooser : function (e) {
// Set the section for this version of the dialogue
if (e.target.ancestor(CSS.SITETOPIC)) {
@@ -102,6 +123,13 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
}
this.display_chooser(e);
},
/**
* Toggle availability of the activity chooser.
*
* @method toggle_mod_chooser
* @param {EventFacade} e
*/
toggle_mod_chooser : function(e) {
// Get the add section link
var modchooserlinks = Y.all('div.addresourcemodchooser');
@@ -151,6 +179,15 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
// Prevent the page from reloading
e.preventDefault();
},
/**
* Helper function to set the value of a hidden radio button when a
* selection is made.
*
* @method option_selected
* @param {String} thisoption The selected option value
* @private
*/
option_selected : function(thisoption) {
// Add the sectionid to the URL.
this.hiddenRadioValue.setAttrs({
@@ -162,6 +199,13 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
{
NAME : MODCHOOSERNAME,
ATTRS : {
/**
* The maximum height (in pixels) of the activity chooser.
*
* @attribute maxheight
* @type Number
* @default 800
*/
maxheight : {
value : 800
}
+2 -2
View File
@@ -92,7 +92,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
* @protected
* @method handle_data_action
* @param {EventFacade} ev The event that was triggered.
* @returns {boolean}
* @return {boolean}
*/
handle_data_action: function(ev) {
// We need to get the anchor element that triggered this event.
@@ -383,7 +383,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
* @param {Node} button The button that triggered the action.
* @param {Node} activity The activity node that this action will be performed on.
* @param {String} action 'show' or 'hide'.
* @returns {Number} 1 if we changed to visible, 0 if we were hiding.
* @return {Number} 1 if we changed to visible, 0 if we were hiding.
*/
handle_resource_dim: function(button, activity, action) {
var toggleclass = CSS.DIMCLASS,
@@ -45,7 +45,7 @@ var BODY = Y.one(Y.config.doc.body),
* @namespace M.core.actionmenu
* @class ActionMenu
* @constructor
* @extends Y.Base
* @extends Base
*/
ACTIONMENU = function() {
ACTIONMENU.superclass.constructor.apply(this, arguments);
@@ -70,6 +70,10 @@ ACTIONMENU.prototype = {
/**
* The node that owns the currently displayed menu.
*
* @property owner
* @type Node
* @default null
*/
owner : null,
@@ -111,6 +115,7 @@ ACTIONMENU.prototype = {
/**
* Called during the initialisation process of the object.
*
* @method initializer
*/
initializer : function() {
@@ -131,8 +136,9 @@ ACTIONMENU.prototype = {
/**
* Enhances a menu adding aria attributes and flagging it as functional.
*
* @method enhance
* @param {Node} menu
* @returns {boolean}
* @return boolean
*/
enhance : function(menu) {
var menucontent = menu.one(SELECTOR.MENUCONTENT),
@@ -412,9 +418,11 @@ ACTIONMENU.prototype = {
/**
* Displays the menu with the given content and alignment.
*
* @method showMenu
* @param {EventFacade} e
* @param {Node} menu
* @returns {M.core.dialogue|dialogue}
* @return M.core.dialogue
*/
showMenu : function(e, menu) {
Y.log('Displaying an action menu', 'debug', ACTIONMENU.NAME);
@@ -565,32 +573,21 @@ Y.extend(ACTIONMENU, Y.Base, ACTIONMENU.prototype, {
}
});
/**
* Core namespace.
* @static
* @class core
*/
M.core = M.core || {};
/**
* Actionmenu namespace.
* @namespace M.core
* @class actionmenu
* @static
*/
M.core.actionmenu = M.core.actionmenu || {};
/**
*
* @static
* @property instance
* @property M.core.actionmenu.instance
* @type {ACTIONMENU}
*/
M.core.actionmenu.instance = null;
/**
* Init function - will only ever create one instance of the actionmenu class.
* @method init
*
* @method M.core.actionmenu.init
* @static
* @param {Object} params
*/
@@ -600,8 +597,10 @@ M.core.actionmenu.init = M.core.actionmenu.init || function(params) {
/**
* Registers a new DOM node with the action menu causing it to be enhanced if required.
*
* @method M.core.actionmenu.newDOMNode
* @param node
* @returns {boolean}
* @return {boolean}
*/
M.core.actionmenu.newDOMNode = function(node) {
if (M.core.actionmenu.instance === null) {
@@ -45,7 +45,7 @@ var BODY = Y.one(Y.config.doc.body),
* @namespace M.core.actionmenu
* @class ActionMenu
* @constructor
* @extends Y.Base
* @extends Base
*/
ACTIONMENU = function() {
ACTIONMENU.superclass.constructor.apply(this, arguments);
@@ -70,6 +70,10 @@ ACTIONMENU.prototype = {
/**
* The node that owns the currently displayed menu.
*
* @property owner
* @type Node
* @default null
*/
owner : null,
@@ -111,6 +115,7 @@ ACTIONMENU.prototype = {
/**
* Called during the initialisation process of the object.
*
* @method initializer
*/
initializer : function() {
@@ -130,8 +135,9 @@ ACTIONMENU.prototype = {
/**
* Enhances a menu adding aria attributes and flagging it as functional.
*
* @method enhance
* @param {Node} menu
* @returns {boolean}
* @return boolean
*/
enhance : function(menu) {
var menucontent = menu.one(SELECTOR.MENUCONTENT),
@@ -409,9 +415,11 @@ ACTIONMENU.prototype = {
/**
* Displays the menu with the given content and alignment.
*
* @method showMenu
* @param {EventFacade} e
* @param {Node} menu
* @returns {M.core.dialogue|dialogue}
* @return M.core.dialogue
*/
showMenu : function(e, menu) {
var ownerselector = menu.getData('owner'),
@@ -560,32 +568,21 @@ Y.extend(ACTIONMENU, Y.Base, ACTIONMENU.prototype, {
}
});
/**
* Core namespace.
* @static
* @class core
*/
M.core = M.core || {};
/**
* Actionmenu namespace.
* @namespace M.core
* @class actionmenu
* @static
*/
M.core.actionmenu = M.core.actionmenu || {};
/**
*
* @static
* @property instance
* @property M.core.actionmenu.instance
* @type {ACTIONMENU}
*/
M.core.actionmenu.instance = null;
/**
* Init function - will only ever create one instance of the actionmenu class.
* @method init
*
* @method M.core.actionmenu.init
* @static
* @param {Object} params
*/
@@ -595,8 +592,10 @@ M.core.actionmenu.init = M.core.actionmenu.init || function(params) {
/**
* Registers a new DOM node with the action menu causing it to be enhanced if required.
*
* @method M.core.actionmenu.newDOMNode
* @param node
* @returns {boolean}
* @return {boolean}
*/
M.core.actionmenu.newDOMNode = function(node) {
if (M.core.actionmenu.instance === null) {
@@ -321,26 +321,14 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
}
});
/**
* Core namespace.
* @static
* @class core
*/
M.core = M.core || {};
/**
* Block drag and drop static class.
* @namespace M.core
* @class blockdraganddrop
* @static
*/
M.core.blockdraganddrop = M.core.blockdraganddrop || {};
/**
* True if the page is using the new blocks methods.
* @private
* @static
* @property _isusingnewblocksmethod
* @property M.core.blockdraganddrop._isusingnewblocksmethod
* @type Boolean
* @default null
*/
@@ -349,7 +337,7 @@ M.core.blockdraganddrop._isusingnewblocksmethod = null;
/**
* Returns true if the page is using the new blocks methods.
* @static
* @method is_using_blocks_render_method
* @method M.core.blockdraganddrop.is_using_blocks_render_method
* @return Boolean
*/
M.core.blockdraganddrop.is_using_blocks_render_method = function() {
@@ -365,7 +353,7 @@ M.core.blockdraganddrop.is_using_blocks_render_method = function() {
* Initialises a drag and drop manager.
* This should only ever be called once for a page.
* @static
* @method init
* @method M.core.blockdraganddrop.init
* @param {Object} params
* @return Manager
*/
@@ -377,7 +365,7 @@ M.core.blockdraganddrop.init = function(params) {
}
};
/**
/*
* Legacy code to keep things working.
*/
M.core_blocks = M.core_blocks || {};
@@ -506,7 +494,7 @@ MANAGER.prototype = {
* Returns the ID of the block the given node represents.
* @method get_block_id
* @param {Node} node
* @returns {int} The blocks ID in the database.
* @return {int} The blocks ID in the database.
*/
get_block_id : function(node) {
return Number(node.get('id').replace(/inst/i, ''));
@@ -516,7 +504,7 @@ MANAGER.prototype = {
* Returns the block region that the node is part of or belonging to.
* @method get_block_region
* @param {Y.Node} node
* @returns {string} The region name.
* @return {string} The region name.
*/
get_block_region : function(node) {
if (!node.test('[data-blockregion]')) {
@@ -529,7 +517,7 @@ MANAGER.prototype = {
* Returns the BLOCKREGION instance that represents the block region the given node is part of.
* @method get_region_object
* @param {Y.Node} node
* @returns {BLOCKREGION}
* @return {BLOCKREGION}
*/
get_region_object : function(node) {
return this.regionobjects[this.get_block_region(node)];
@@ -538,7 +526,6 @@ MANAGER.prototype = {
/**
* Enables all fo the regions so that they are all visible while dragging is occuring.
* @method enable_all_regions
* @returns {undefined}
*/
enable_all_regions : function() {
var i = 0;
@@ -550,7 +537,6 @@ MANAGER.prototype = {
/**
* Disables enabled regions if they contain no blocks.
* @method disable_regions_if_required
* @returns {undefined}
*/
disable_regions_if_required : function() {
var i = 0;
@@ -563,7 +549,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drag_start when dragging starts.
* @method drag_start
* @param {Event} e
* @returns {undefined}
*/
drag_start : function(e) {
// Get our drag object
@@ -585,7 +570,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drop_over when something is dragged over a drop target.
* @method drop_over
* @param {Event} e
* @returns {undefined}
*/
drop_over : function(e) {
// Get a reference to our drag and drop nodes
@@ -602,7 +586,6 @@ MANAGER.prototype = {
/**
* Called by M.core.dragdrop.global_drop_end when a drop has been completed.
* @method drop_end
* @returns {undefined}
*/
drop_end : function() {
// Clear variables.
@@ -615,7 +598,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drag_dropmiss when something has been dropped on a node that isn't contained by a drop target.
* @method drag_dropmiss
* @param {Event} e
* @returns {undefined}
*/
drag_dropmiss : function(e) {
// Missed the target, but we assume the user intended to drop it
@@ -628,7 +610,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drag_hit when something has been dropped on a drop target.
* @method drop_hit
* @param {Event} e
* @returns {undefined}
*/
drop_hit : function(e) {
// Get a reference to our drag node
@@ -791,7 +772,7 @@ Y.extend(MANAGER, M.core.dragdrop, MANAGER.prototype, {
* @namespace M.core.blockdraganddrop
* @class BlockRegion
* @constructor
* @extends Y.Base
* @extends Base
*/
var BLOCKREGION = function() {
BLOCKREGION.superclass.constructor.apply(this, arguments);
+8 -27
View File
@@ -321,26 +321,14 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
}
});
/**
* Core namespace.
* @static
* @class core
*/
M.core = M.core || {};
/**
* Block drag and drop static class.
* @namespace M.core
* @class blockdraganddrop
* @static
*/
M.core.blockdraganddrop = M.core.blockdraganddrop || {};
/**
* True if the page is using the new blocks methods.
* @private
* @static
* @property _isusingnewblocksmethod
* @property M.core.blockdraganddrop._isusingnewblocksmethod
* @type Boolean
* @default null
*/
@@ -349,7 +337,7 @@ M.core.blockdraganddrop._isusingnewblocksmethod = null;
/**
* Returns true if the page is using the new blocks methods.
* @static
* @method is_using_blocks_render_method
* @method M.core.blockdraganddrop.is_using_blocks_render_method
* @return Boolean
*/
M.core.blockdraganddrop.is_using_blocks_render_method = function() {
@@ -365,7 +353,7 @@ M.core.blockdraganddrop.is_using_blocks_render_method = function() {
* Initialises a drag and drop manager.
* This should only ever be called once for a page.
* @static
* @method init
* @method M.core.blockdraganddrop.init
* @param {Object} params
* @return Manager
*/
@@ -377,7 +365,7 @@ M.core.blockdraganddrop.init = function(params) {
}
};
/**
/*
* Legacy code to keep things working.
*/
M.core_blocks = M.core_blocks || {};
@@ -504,7 +492,7 @@ MANAGER.prototype = {
* Returns the ID of the block the given node represents.
* @method get_block_id
* @param {Node} node
* @returns {int} The blocks ID in the database.
* @return {int} The blocks ID in the database.
*/
get_block_id : function(node) {
return Number(node.get('id').replace(/inst/i, ''));
@@ -514,7 +502,7 @@ MANAGER.prototype = {
* Returns the block region that the node is part of or belonging to.
* @method get_block_region
* @param {Y.Node} node
* @returns {string} The region name.
* @return {string} The region name.
*/
get_block_region : function(node) {
if (!node.test('[data-blockregion]')) {
@@ -527,7 +515,7 @@ MANAGER.prototype = {
* Returns the BLOCKREGION instance that represents the block region the given node is part of.
* @method get_region_object
* @param {Y.Node} node
* @returns {BLOCKREGION}
* @return {BLOCKREGION}
*/
get_region_object : function(node) {
return this.regionobjects[this.get_block_region(node)];
@@ -536,7 +524,6 @@ MANAGER.prototype = {
/**
* Enables all fo the regions so that they are all visible while dragging is occuring.
* @method enable_all_regions
* @returns {undefined}
*/
enable_all_regions : function() {
var i = 0;
@@ -548,7 +535,6 @@ MANAGER.prototype = {
/**
* Disables enabled regions if they contain no blocks.
* @method disable_regions_if_required
* @returns {undefined}
*/
disable_regions_if_required : function() {
var i = 0;
@@ -561,7 +547,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drag_start when dragging starts.
* @method drag_start
* @param {Event} e
* @returns {undefined}
*/
drag_start : function(e) {
// Get our drag object
@@ -583,7 +568,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drop_over when something is dragged over a drop target.
* @method drop_over
* @param {Event} e
* @returns {undefined}
*/
drop_over : function(e) {
// Get a reference to our drag and drop nodes
@@ -600,7 +584,6 @@ MANAGER.prototype = {
/**
* Called by M.core.dragdrop.global_drop_end when a drop has been completed.
* @method drop_end
* @returns {undefined}
*/
drop_end : function() {
// Clear variables.
@@ -613,7 +596,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drag_dropmiss when something has been dropped on a node that isn't contained by a drop target.
* @method drag_dropmiss
* @param {Event} e
* @returns {undefined}
*/
drag_dropmiss : function(e) {
// Missed the target, but we assume the user intended to drop it
@@ -626,7 +608,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drag_hit when something has been dropped on a drop target.
* @method drop_hit
* @param {Event} e
* @returns {undefined}
*/
drop_hit : function(e) {
// Get a reference to our drag node
@@ -789,7 +770,7 @@ Y.extend(MANAGER, M.core.dragdrop, MANAGER.prototype, {
* @namespace M.core.blockdraganddrop
* @class BlockRegion
* @constructor
* @extends Y.Base
* @extends Base
*/
var BLOCKREGION = function() {
BLOCKREGION.superclass.constructor.apply(this, arguments);
@@ -1,5 +1,17 @@
YUI.add('moodle-core-chooserdialogue', function (Y, NAME) {
/**
* A type of dialogue used as for choosing options.
*
* @module moodle-core-chooserdialogue
*/
/**
* A type of dialogue used as for choosing options.
*
* @constructor
* @class M.core.chooserdialogue
*/
var CHOOSERDIALOGUE = function() {
CHOOSERDIALOGUE.superclass.constructor.apply(this, arguments);
};
@@ -83,8 +95,8 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
/**
* Display the module chooser
*
* @param e Event Triggering Event
* @return void
* @method display_chooser
* @param {EventFacade} e Triggering Event
*/
display_chooser : function (e) {
var bb, dialogue, thisevent;
@@ -169,13 +181,13 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
},
/**
* Cancel any listen events in the listenevents queue
*
* Several locations add event handlers which should only be called before the form is submitted. This provides
* a way of cancelling those events.
*
* @return void
*/
* Cancel any listen events in the listenevents queue
*
* Several locations add event handlers which should only be called before the form is submitted. This provides
* a way of cancelling those events.
*
* @method cancel_listenevents
*/
cancel_listenevents : function () {
// Detach all listen events to prevent duplicate triggers
var thisevent;
@@ -191,8 +203,8 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
* This tries to set a sensible maximum and minimum to ensure that some options are always shown, and preferably
* all, whilst fitting the box within the current viewport.
*
* @param dialogue Y.Node The dialogue
* @return void
* @method center_dialogue
* @param Node {dialogue} Y.Node The dialogue
*/
center_dialogue : function(dialogue) {
var bb = this.panel.get('boundingBox'),
@@ -306,15 +318,47 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
{
NAME : 'moodle-core-chooserdialogue',
ATTRS : {
/**
* The minimum height (in pixels) before resizing is prevented and scroll
* locking disabled.
*
* @attribute minheight
* @type Number
* @default 300
*/
minheight : {
value : 300
},
/**
* The base height??
*
* @attribute baseheight
* @type Number
* @default 400
*/
baseheight: {
value : 400
},
/**
* The maximum height (in pixels) at which we stop resizing.
*
* @attribute maxheight
* @type Number
* @default 300
*/
maxheight : {
value : 660
},
/**
* The title of the close button.
*
* @attribute closeButtonTitle
* @type String
* @default 'Close'
*/
closeButtonTitle : {
validator : Y.Lang.isString,
value : 'Close'
@@ -1,5 +1,17 @@
YUI.add('moodle-core-chooserdialogue', function (Y, NAME) {
/**
* A type of dialogue used as for choosing options.
*
* @module moodle-core-chooserdialogue
*/
/**
* A type of dialogue used as for choosing options.
*
* @constructor
* @class M.core.chooserdialogue
*/
var CHOOSERDIALOGUE = function() {
CHOOSERDIALOGUE.superclass.constructor.apply(this, arguments);
};
@@ -83,8 +95,8 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
/**
* Display the module chooser
*
* @param e Event Triggering Event
* @return void
* @method display_chooser
* @param {EventFacade} e Triggering Event
*/
display_chooser : function (e) {
var bb, dialogue, thisevent;
@@ -169,13 +181,13 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
},
/**
* Cancel any listen events in the listenevents queue
*
* Several locations add event handlers which should only be called before the form is submitted. This provides
* a way of cancelling those events.
*
* @return void
*/
* Cancel any listen events in the listenevents queue
*
* Several locations add event handlers which should only be called before the form is submitted. This provides
* a way of cancelling those events.
*
* @method cancel_listenevents
*/
cancel_listenevents : function () {
// Detach all listen events to prevent duplicate triggers
var thisevent;
@@ -191,8 +203,8 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
* This tries to set a sensible maximum and minimum to ensure that some options are always shown, and preferably
* all, whilst fitting the box within the current viewport.
*
* @param dialogue Y.Node The dialogue
* @return void
* @method center_dialogue
* @param Node {dialogue} Y.Node The dialogue
*/
center_dialogue : function(dialogue) {
var bb = this.panel.get('boundingBox'),
@@ -306,15 +318,47 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
{
NAME : 'moodle-core-chooserdialogue',
ATTRS : {
/**
* The minimum height (in pixels) before resizing is prevented and scroll
* locking disabled.
*
* @attribute minheight
* @type Number
* @default 300
*/
minheight : {
value : 300
},
/**
* The base height??
*
* @attribute baseheight
* @type Number
* @default 400
*/
baseheight: {
value : 400
},
/**
* The maximum height (in pixels) at which we stop resizing.
*
* @attribute maxheight
* @type Number
* @default 300
*/
maxheight : {
value : 660
},
/**
* The title of the close button.
*
* @attribute closeButtonTitle
* @type String
* @default 'Close'
*/
closeButtonTitle : {
validator : Y.Lang.isString,
value : 'Close'
@@ -2,29 +2,14 @@ YUI.add('moodle-core-dock-loader', function (Y, NAME) {
var LOADERNAME = 'moodle-core-dock-loader';
/**
* Core namespace.
*
* @static
* @namespace M
* @class core
*/
M.core = M.core || {};
/**
* Dock namespace.
*
* @static
* @namespace M.core
* @class dock
*/
M.core.dock = M.core.dock || {};
/**
* Creates the move to dock icon for dockable blocks if it doesn't already exist.
*
* @static
* @method ensureMoveToIconExists
* @method M.core.dock.ensureMoveToIconExists
* @param {Node} blocknode The Blocks node (.block[data-instanceid])
*/
M.core.dock.ensureMoveToIconExists = function(blocknode) {
@@ -2,29 +2,14 @@ YUI.add('moodle-core-dock-loader', function (Y, NAME) {
var LOADERNAME = 'moodle-core-dock-loader';
/**
* Core namespace.
*
* @static
* @namespace M
* @class core
*/
M.core = M.core || {};
/**
* Dock namespace.
*
* @static
* @namespace M.core
* @class dock
*/
M.core.dock = M.core.dock || {};
/**
* Creates the move to dock icon for dockable blocks if it doesn't already exist.
*
* @static
* @method ensureMoveToIconExists
* @method M.core.dock.ensureMoveToIconExists
* @param {Node} blocknode The Blocks node (.block[data-instanceid])
*/
M.core.dock.ensureMoveToIconExists = function(blocknode) {
+8 -23
View File
@@ -37,22 +37,7 @@ var LOGNS = 'moodle-core-dock',
BLOCK,
DOCKEDITEM;
/**
* Core namespace.
*
* @static
* @namespace M
* @class core
*/
M.core = M.core || {};
/**
* Dock namespace.
*
* @static
* @namespace M.core
* @class dock
*/
M.core.dock = M.core.dock || {};
/**
@@ -261,8 +246,8 @@ M.core.dock.notifyBlockChange = function(instanceid) {
* @namespace M.core.dock
* @class Dock
* @constructor
* @extends Y.Base
* @uses Y.EventTarget
* @extends Base
* @uses EventTarget
*/
DOCK = function() {
DOCK.superclass.constructor.apply(this, arguments);
@@ -1132,8 +1117,8 @@ Y.augment(DOCK, Y.EventTarget);
* @namespace M.core.dock
* @class Panel
* @constructor
* @extends Y.Base
* @uses Y.EventTarget
* @extends Base
* @uses EventTarget
*/
DOCKPANEL = function() {
DOCKPANEL.superclass.constructor.apply(this, arguments);
@@ -1369,7 +1354,7 @@ Y.augment(DOCKPANEL, Y.EventTarget);
* @namespace M.core.dock
* @class TabHeightManager
* @constructor
* @extends Y.Base
* @extends Base
*/
TABHEIGHTMANAGER = function() {
TABHEIGHTMANAGER.superclass.constructor.apply(this, arguments);
@@ -1608,7 +1593,7 @@ Y.Event.define("dock:actionkey", {
* @namespace M.core.dock
* @class Block
* @constructor
* @extends Y.Base
* @extends Base
*/
BLOCK = function() {
BLOCK.superclass.constructor.apply(this, arguments);
@@ -1864,8 +1849,8 @@ Y.extend(BLOCK, Y.Base, BLOCK.prototype, {
* @namespace M.core.dock
* @class DockedItem
* @constructor
* @extends Y.Base
* @uses Y.EventTarget
* @extends Base
* @uses EventTarget
*/
DOCKEDITEM = function() {
DOCKEDITEM.superclass.constructor.apply(this, arguments);
+8 -23
View File
@@ -37,22 +37,7 @@ var LOGNS = 'moodle-core-dock',
BLOCK,
DOCKEDITEM;
/**
* Core namespace.
*
* @static
* @namespace M
* @class core
*/
M.core = M.core || {};
/**
* Dock namespace.
*
* @static
* @namespace M.core
* @class dock
*/
M.core.dock = M.core.dock || {};
/**
@@ -260,8 +245,8 @@ M.core.dock.notifyBlockChange = function(instanceid) {
* @namespace M.core.dock
* @class Dock
* @constructor
* @extends Y.Base
* @uses Y.EventTarget
* @extends Base
* @uses EventTarget
*/
DOCK = function() {
DOCK.superclass.constructor.apply(this, arguments);
@@ -1122,8 +1107,8 @@ Y.augment(DOCK, Y.EventTarget);
* @namespace M.core.dock
* @class Panel
* @constructor
* @extends Y.Base
* @uses Y.EventTarget
* @extends Base
* @uses EventTarget
*/
DOCKPANEL = function() {
DOCKPANEL.superclass.constructor.apply(this, arguments);
@@ -1358,7 +1343,7 @@ Y.augment(DOCKPANEL, Y.EventTarget);
* @namespace M.core.dock
* @class TabHeightManager
* @constructor
* @extends Y.Base
* @extends Base
*/
TABHEIGHTMANAGER = function() {
TABHEIGHTMANAGER.superclass.constructor.apply(this, arguments);
@@ -1596,7 +1581,7 @@ Y.Event.define("dock:actionkey", {
* @namespace M.core.dock
* @class Block
* @constructor
* @extends Y.Base
* @extends Base
*/
BLOCK = function() {
BLOCK.superclass.constructor.apply(this, arguments);
@@ -1849,8 +1834,8 @@ Y.extend(BLOCK, Y.Base, BLOCK.prototype, {
* @namespace M.core.dock
* @class DockedItem
* @constructor
* @extends Y.Base
* @uses Y.EventTarget
* @extends Base
* @uses EventTarget
*/
DOCKEDITEM = function() {
DOCKEDITEM.superclass.constructor.apply(this, arguments);
@@ -16,9 +16,9 @@ FORMAUTOSUBMIT = function() {
Y.extend(FORMAUTOSUBMIT, Y.Base, {
/**
* Initialize the module
*/
/*
* Initialize the module
*/
initializer : function() {
// Set up local variables
var applyto,
@@ -56,9 +56,9 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
}
},
/**
* Check whether the select element was changed
*/
/*
* Check whether the select element was changed
*/
check_changed : function(e) {
var select,
nothing,
@@ -88,9 +88,9 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
return false;
},
/**
* Process any changes
*/
/*
* Process any changes
*/
process_changes : function(e) {
var select = this.check_changed(e),
form;
@@ -16,9 +16,9 @@ FORMAUTOSUBMIT = function() {
Y.extend(FORMAUTOSUBMIT, Y.Base, {
/**
* Initialize the module
*/
/*
* Initialize the module
*/
initializer : function() {
// Set up local variables
var applyto,
@@ -55,9 +55,9 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
}
},
/**
* Check whether the select element was changed
*/
/*
* Check whether the select element was changed
*/
check_changed : function(e) {
var select,
nothing,
@@ -87,9 +87,9 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
return false;
},
/**
* Process any changes
*/
/*
* Process any changes
*/
process_changes : function(e) {
var select = this.check_changed(e),
form;
@@ -1,5 +1,18 @@
YUI.add('moodle-core-formchangechecker', function (Y, NAME) {
/**
* A utility to check for form changes before navigating away from a page.
*
* @module moodle-core-formchangechecker
*/
/**
* A utility to check for form changes before navigating away from a page.
*
* @class M.core.formchangechecker
* @constructor
*/
var FORMCHANGECHECKERNAME = 'core-formchangechecker',
FORMCHANGECHECKER = function() {
@@ -12,8 +25,10 @@ Y.extend(FORMCHANGECHECKER, Y.Base, {
initialvaluelisteners : [],
/**
* Initialize the module
*/
* Initialize the module
*
* @method initializer
*/
initializer : function() {
var formid = 'form#' + this.get('formid'),
currentform = Y.one(formid);
@@ -42,12 +57,15 @@ Y.extend(FORMCHANGECHECKER, Y.Base, {
},
/**
* Store the initial value of the currently focussed element
*
* If an element has been focussed and changed but not yet blurred, the on change
* event won't be fired. We need to store it's initial value to compare it in the
* get_form_dirty_state function later.
*/
* Store the initial value of the currently focussed element
*
* If an element has been focussed and changed but not yet blurred, the on change
* event won't be fired. We need to store it's initial value to compare it in the
* get_form_dirty_state function later.
*
* @method store_initial_value
* @param {EventFacade} e
*/
store_initial_value : function(e) {
var thisevent;
if (e.target.hasClass('ignoredirty')) {
@@ -95,9 +113,9 @@ M.core_formchangechecker.init = function(config) {
// Store state information
M.core_formchangechecker.stateinformation = [];
/**
* Set the form changed state to true
*/
/*
* Set the form changed state to true
*/
M.core_formchangechecker.set_form_changed = function(e) {
if (e && e.target && e.target.hasClass('ignoredirty')) {
// Don't warn on elements with the ignoredirty class
@@ -110,19 +128,19 @@ M.core_formchangechecker.set_form_changed = function(e) {
delete M.core_formchangechecker.stateinformation.focused_element;
};
/**
* Set the form submitted state to true
*/
/*
* Set the form submitted state to true
*/
M.core_formchangechecker.set_form_submitted = function() {
M.core_formchangechecker.stateinformation.formsubmitted = 1;
};
/**
* Attempt to determine whether the form has been modified in any way and
* is thus 'dirty'
*
* @return Integer 1 is the form is dirty; 0 if not
*/
/*
* Attempt to determine whether the form has been modified in any way and
* is thus 'dirty'
*
* @return Integer 1 is the form is dirty; 0 if not
*/
M.core_formchangechecker.get_form_dirty_state = function() {
var state = M.core_formchangechecker.stateinformation,
editor;
@@ -160,9 +178,9 @@ M.core_formchangechecker.get_form_dirty_state = function() {
return 0;
};
/**
* Return a suitable message if changes have been made to a form
*/
/*
* Return a suitable message if changes have been made to a form
*/
M.core_formchangechecker.report_form_dirty_state = function(e) {
if (!M.core_formchangechecker.get_form_dirty_state()) {
// the form is not dirty, so don't display any message
@@ -1,5 +1,18 @@
YUI.add('moodle-core-formchangechecker', function (Y, NAME) {
/**
* A utility to check for form changes before navigating away from a page.
*
* @module moodle-core-formchangechecker
*/
/**
* A utility to check for form changes before navigating away from a page.
*
* @class M.core.formchangechecker
* @constructor
*/
var FORMCHANGECHECKERNAME = 'core-formchangechecker',
FORMCHANGECHECKER = function() {
@@ -12,8 +25,10 @@ Y.extend(FORMCHANGECHECKER, Y.Base, {
initialvaluelisteners : [],
/**
* Initialize the module
*/
* Initialize the module
*
* @method initializer
*/
initializer : function() {
var formid = 'form#' + this.get('formid'),
currentform = Y.one(formid);
@@ -42,12 +57,15 @@ Y.extend(FORMCHANGECHECKER, Y.Base, {
},
/**
* Store the initial value of the currently focussed element
*
* If an element has been focussed and changed but not yet blurred, the on change
* event won't be fired. We need to store it's initial value to compare it in the
* get_form_dirty_state function later.
*/
* Store the initial value of the currently focussed element
*
* If an element has been focussed and changed but not yet blurred, the on change
* event won't be fired. We need to store it's initial value to compare it in the
* get_form_dirty_state function later.
*
* @method store_initial_value
* @param {EventFacade} e
*/
store_initial_value : function(e) {
var thisevent;
if (e.target.hasClass('ignoredirty')) {
@@ -95,9 +113,9 @@ M.core_formchangechecker.init = function(config) {
// Store state information
M.core_formchangechecker.stateinformation = [];
/**
* Set the form changed state to true
*/
/*
* Set the form changed state to true
*/
M.core_formchangechecker.set_form_changed = function(e) {
if (e && e.target && e.target.hasClass('ignoredirty')) {
// Don't warn on elements with the ignoredirty class
@@ -110,19 +128,19 @@ M.core_formchangechecker.set_form_changed = function(e) {
delete M.core_formchangechecker.stateinformation.focused_element;
};
/**
* Set the form submitted state to true
*/
/*
* Set the form submitted state to true
*/
M.core_formchangechecker.set_form_submitted = function() {
M.core_formchangechecker.stateinformation.formsubmitted = 1;
};
/**
* Attempt to determine whether the form has been modified in any way and
* is thus 'dirty'
*
* @return Integer 1 is the form is dirty; 0 if not
*/
/*
* Attempt to determine whether the form has been modified in any way and
* is thus 'dirty'
*
* @return Integer 1 is the form is dirty; 0 if not
*/
M.core_formchangechecker.get_form_dirty_state = function() {
var state = M.core_formchangechecker.stateinformation,
editor;
@@ -160,9 +178,9 @@ M.core_formchangechecker.get_form_dirty_state = function() {
return 0;
};
/**
* Return a suitable message if changes have been made to a form
*/
/*
* Return a suitable message if changes have been made to a form
*/
M.core_formchangechecker.report_form_dirty_state = function(e) {
if (!M.core_formchangechecker.get_form_dirty_state()) {
// the form is not dirty, so don't display any message
@@ -16,6 +16,7 @@ Y.extend(MAINTENANCEMODETIMER, Y.Base, {
/**
* Initialise timer if maintenancemode set.
*
* @method initializer
* @param config {Array} array with timeleftinsec set.
*/
initializer: function(config) {
@@ -28,6 +29,8 @@ Y.extend(MAINTENANCEMODETIMER, Y.Base, {
/**
* Decrement time left and update display text.
*
* @method updatetimer
*/
updatetimer: function() {
this.timeleftinsec -= 1;
@@ -16,6 +16,7 @@ Y.extend(MAINTENANCEMODETIMER, Y.Base, {
/**
* Initialise timer if maintenancemode set.
*
* @method initializer
* @param config {Array} array with timeleftinsec set.
*/
initializer: function(config) {
@@ -28,6 +29,8 @@ Y.extend(MAINTENANCEMODETIMER, Y.Base, {
/**
* Decrement time left and update display text.
*
* @method updatetimer
*/
updatetimer: function() {
this.timeleftinsec -= 1;
@@ -49,7 +49,7 @@ var DIALOGUE_NAME = 'Moodle dialogue',
* @param {Object} c Object literal specifying the dialogue configuration properties.
* @constructor
* @class M.core.dialogue
* @extends Y.Panel
* @extends Panel
*/
DIALOGUE = function(c) {
var config = Y.clone(c);
@@ -96,11 +96,11 @@ Y.extend(DIALOGUE, Y.Panel, {
// Orientation change event listener.
_orientationevent : null,
_calculatedzindex : false,
/**
* Initialise the dialogue.
*
* @method initializer
* @return void
*/
initializer : function() {
var bb;
@@ -149,8 +149,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* Either set the zindex to the supplied value, or set it to one more than the highest existing
* dialog in the page.
*
* @method visibilityChanged
* @return void
* @method applyZIndex
*/
applyZIndex : function() {
var highestzindex = 1,
@@ -182,8 +181,8 @@ Y.extend(DIALOGUE, Y.Panel, {
* Finds the zIndex of the given node or its parent.
*
* @method findZIndex
* @param Node node
* @returns int Return either the zIndex of 0 if one was not found.
* @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) {
// In most cases the zindex is set on the parent of the dialog.
@@ -198,7 +197,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* Event listener for the visibility changed event.
*
* @method visibilityChanged
* @return void
* @param {EventFacade} e
*/
visibilityChanged : function(e) {
var titlebar, bb;
@@ -240,7 +239,6 @@ Y.extend(DIALOGUE, Y.Panel, {
* smaller than the responsive width - make the dialog fullscreen.
*
* @method makeResponsive
* @return void
*/
makeResponsive : function() {
var bb = this.get('boundingBox'),
@@ -275,7 +273,6 @@ Y.extend(DIALOGUE, Y.Panel, {
* Center the dialog on the screen.
*
* @method centerDialogue
* @return void
*/
centerDialogue : function() {
var bb = this.get('boundingBox'),
@@ -299,24 +296,19 @@ Y.extend(DIALOGUE, Y.Panel, {
}
},
/**
* Return if this dialogue should be fullscreen or not.
* Return whether this dialogue should be fullscreen or not.
*
* Responsive attribute must be true and we should not be in an iframe and the screen width should
* be less than the responsive width.
*
* @method shouldResizeFullscreen
* @return Boolean
* @return {Boolean}
*/
shouldResizeFullscreen : function() {
return (window === window.parent) && this.get('responsive') &&
Math.floor(Y.one(document.body).get('winWidth')) < this.get('responsiveWidth');
},
/**
* Override the show method to set keyboard focus on the dialogue.
*
* @method show
* @return void
*/
show : function() {
var result = null,
header = this.headerNode,
@@ -373,12 +365,14 @@ Y.extend(DIALOGUE, Y.Panel, {
}
}, 'down:9', CAN_RECEIVE_FOCUS_SELECTOR, this);
},
/**
* Trap the tab focus within the open modal.
*
* @param string target the element target
* @param string direction tab key for forward and tab+shift for backward
* @returns bool
* @method trapFocus
* @param {string} target the element target
* @param {string} direction tab key for forward and tab+shift for backward
* @return {Boolean} The result of the focus action.
*/
trapFocus : function(target, direction) {
var bb = this.get('boundingBox'),
@@ -495,7 +489,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* The width that this dialogue should be resized to fullscreen.
*
* @attribute responsiveWidth
* @type Integer
* @type Number
* @default 768
*/
responsiveWidth : {
@@ -579,7 +573,7 @@ Y.Base.modifyAttrs(DIALOGUE, {
/**
* Any additional classes to add to the boundingBox.
*
* @attributes extraClasses
* @attribute extraClasses
* @type Array
* @default []
*/
@@ -49,7 +49,7 @@ var DIALOGUE_NAME = 'Moodle dialogue',
* @param {Object} c Object literal specifying the dialogue configuration properties.
* @constructor
* @class M.core.dialogue
* @extends Y.Panel
* @extends Panel
*/
DIALOGUE = function(c) {
var config = Y.clone(c);
@@ -96,11 +96,11 @@ Y.extend(DIALOGUE, Y.Panel, {
// Orientation change event listener.
_orientationevent : null,
_calculatedzindex : false,
/**
* Initialise the dialogue.
*
* @method initializer
* @return void
*/
initializer : function() {
var bb;
@@ -149,8 +149,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* Either set the zindex to the supplied value, or set it to one more than the highest existing
* dialog in the page.
*
* @method visibilityChanged
* @return void
* @method applyZIndex
*/
applyZIndex : function() {
var highestzindex = 1,
@@ -182,8 +181,8 @@ Y.extend(DIALOGUE, Y.Panel, {
* Finds the zIndex of the given node or its parent.
*
* @method findZIndex
* @param Node node
* @returns int Return either the zIndex of 0 if one was not found.
* @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) {
// In most cases the zindex is set on the parent of the dialog.
@@ -198,7 +197,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* Event listener for the visibility changed event.
*
* @method visibilityChanged
* @return void
* @param {EventFacade} e
*/
visibilityChanged : function(e) {
var titlebar, bb;
@@ -240,7 +239,6 @@ Y.extend(DIALOGUE, Y.Panel, {
* smaller than the responsive width - make the dialog fullscreen.
*
* @method makeResponsive
* @return void
*/
makeResponsive : function() {
var bb = this.get('boundingBox'),
@@ -275,7 +273,6 @@ Y.extend(DIALOGUE, Y.Panel, {
* Center the dialog on the screen.
*
* @method centerDialogue
* @return void
*/
centerDialogue : function() {
var bb = this.get('boundingBox'),
@@ -299,24 +296,19 @@ Y.extend(DIALOGUE, Y.Panel, {
}
},
/**
* Return if this dialogue should be fullscreen or not.
* Return whether this dialogue should be fullscreen or not.
*
* Responsive attribute must be true and we should not be in an iframe and the screen width should
* be less than the responsive width.
*
* @method shouldResizeFullscreen
* @return Boolean
* @return {Boolean}
*/
shouldResizeFullscreen : function() {
return (window === window.parent) && this.get('responsive') &&
Math.floor(Y.one(document.body).get('winWidth')) < this.get('responsiveWidth');
},
/**
* Override the show method to set keyboard focus on the dialogue.
*
* @method show
* @return void
*/
show : function() {
var result = null,
header = this.headerNode,
@@ -373,12 +365,14 @@ Y.extend(DIALOGUE, Y.Panel, {
}
}, 'down:9', CAN_RECEIVE_FOCUS_SELECTOR, this);
},
/**
* Trap the tab focus within the open modal.
*
* @param string target the element target
* @param string direction tab key for forward and tab+shift for backward
* @returns bool
* @method trapFocus
* @param {string} target the element target
* @param {string} direction tab key for forward and tab+shift for backward
* @return {Boolean} The result of the focus action.
*/
trapFocus : function(target, direction) {
var bb = this.get('boundingBox'),
@@ -493,7 +487,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* The width that this dialogue should be resized to fullscreen.
*
* @attribute responsiveWidth
* @type Integer
* @type Number
* @default 768
*/
responsiveWidth : {
@@ -577,7 +571,7 @@ Y.Base.modifyAttrs(DIALOGUE, {
/**
* Any additional classes to add to the boundingBox.
*
* @attributes extraClasses
* @attribute extraClasses
* @type Array
* @default []
*/
@@ -1,5 +1,18 @@
YUI.add('moodle-core-popuphelp', function (Y, NAME) {
/**
* A popup help dialogue for Moodle.
*
* @module moodle-core-popuphelp
*/
/**
* A popup help dialogue for Moodle.
*
* @class M.core.popuphelp
* @constructor
*/
function POPUPHELP() {
POPUPHELP.superclass.constructor.apply(this, arguments);
}
@@ -22,10 +35,21 @@ POPUPHELP.ATTRS = ATTRS;
Y.extend(POPUPHELP, Y.Base, {
panel: null,
/**
* Setup the popuphelp.
*
* @method initializer
*/
initializer: function() {
Y.one('body').delegate('click', this.display_panel, SELECTORS.CLICKABLELINKS, this);
},
/**
* Display the help tooltip.
*
* @method display_panel
* @param {EventFacade} e
*/
display_panel: function(e) {
if (!this.panel) {
this.panel = new M.core.tooltip({
@@ -41,10 +65,11 @@ Y.extend(POPUPHELP, Y.Base, {
},
/**
* Override the footer handler to add a 'More help' link where relevant.
*
* @param {Object} helpobject The object returned from the AJAX call.
*/
* Override the footer handler to add a 'More help' link where relevant.
*
* @method set_footer
* @param {Object} helpobject The object returned from the AJAX call.
*/
set_footer: function(helpobject) {
// Check for an optional link to documentation on moodle.org.
if (helpobject.doclink) {
@@ -1,5 +1,18 @@
YUI.add('moodle-core-popuphelp', function (Y, NAME) {
/**
* A popup help dialogue for Moodle.
*
* @module moodle-core-popuphelp
*/
/**
* A popup help dialogue for Moodle.
*
* @class M.core.popuphelp
* @constructor
*/
function POPUPHELP() {
POPUPHELP.superclass.constructor.apply(this, arguments);
}
@@ -22,10 +35,21 @@ POPUPHELP.ATTRS = ATTRS;
Y.extend(POPUPHELP, Y.Base, {
panel: null,
/**
* Setup the popuphelp.
*
* @method initializer
*/
initializer: function() {
Y.one('body').delegate('click', this.display_panel, SELECTORS.CLICKABLELINKS, this);
},
/**
* Display the help tooltip.
*
* @method display_panel
* @param {EventFacade} e
*/
display_panel: function(e) {
if (!this.panel) {
this.panel = new M.core.tooltip({
@@ -41,10 +65,11 @@ Y.extend(POPUPHELP, Y.Base, {
},
/**
* Override the footer handler to add a 'More help' link where relevant.
*
* @param {Object} helpobject The object returned from the AJAX call.
*/
* Override the footer handler to add a 'More help' link where relevant.
*
* @method set_footer
* @param {Object} helpobject The object returned from the AJAX call.
*/
set_footer: function(helpobject) {
// Check for an optional link to documentation on moodle.org.
if (helpobject.doclink) {
+17 -18
View File
@@ -43,7 +43,7 @@ var BODY = Y.one(Y.config.doc.body),
* @namespace M.core.actionmenu
* @class ActionMenu
* @constructor
* @extends Y.Base
* @extends Base
*/
ACTIONMENU = function() {
ACTIONMENU.superclass.constructor.apply(this, arguments);
@@ -68,6 +68,10 @@ ACTIONMENU.prototype = {
/**
* The node that owns the currently displayed menu.
*
* @property owner
* @type Node
* @default null
*/
owner : null,
@@ -109,6 +113,7 @@ ACTIONMENU.prototype = {
/**
* Called during the initialisation process of the object.
*
* @method initializer
*/
initializer : function() {
@@ -129,8 +134,9 @@ ACTIONMENU.prototype = {
/**
* Enhances a menu adding aria attributes and flagging it as functional.
*
* @method enhance
* @param {Node} menu
* @returns {boolean}
* @return boolean
*/
enhance : function(menu) {
var menucontent = menu.one(SELECTOR.MENUCONTENT),
@@ -410,9 +416,11 @@ ACTIONMENU.prototype = {
/**
* Displays the menu with the given content and alignment.
*
* @method showMenu
* @param {EventFacade} e
* @param {Node} menu
* @returns {M.core.dialogue|dialogue}
* @return M.core.dialogue
*/
showMenu : function(e, menu) {
Y.log('Displaying an action menu', 'debug', ACTIONMENU.NAME);
@@ -563,32 +571,21 @@ Y.extend(ACTIONMENU, Y.Base, ACTIONMENU.prototype, {
}
});
/**
* Core namespace.
* @static
* @class core
*/
M.core = M.core || {};
/**
* Actionmenu namespace.
* @namespace M.core
* @class actionmenu
* @static
*/
M.core.actionmenu = M.core.actionmenu || {};
/**
*
* @static
* @property instance
* @property M.core.actionmenu.instance
* @type {ACTIONMENU}
*/
M.core.actionmenu.instance = null;
/**
* Init function - will only ever create one instance of the actionmenu class.
* @method init
*
* @method M.core.actionmenu.init
* @static
* @param {Object} params
*/
@@ -598,8 +595,10 @@ M.core.actionmenu.init = M.core.actionmenu.init || function(params) {
/**
* Registers a new DOM node with the action menu causing it to be enhanced if required.
*
* @method M.core.actionmenu.newDOMNode
* @param node
* @returns {boolean}
* @return {boolean}
*/
M.core.actionmenu.newDOMNode = function(node) {
if (M.core.actionmenu.instance === null) {
+1 -1
View File
@@ -12,7 +12,7 @@
* @namespace M.core.blockdraganddrop
* @class BlockRegion
* @constructor
* @extends Y.Base
* @extends Base
*/
var BLOCKREGION = function() {
BLOCKREGION.superclass.constructor.apply(this, arguments);
+4 -16
View File
@@ -319,26 +319,14 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, {
}
});
/**
* Core namespace.
* @static
* @class core
*/
M.core = M.core || {};
/**
* Block drag and drop static class.
* @namespace M.core
* @class blockdraganddrop
* @static
*/
M.core.blockdraganddrop = M.core.blockdraganddrop || {};
/**
* True if the page is using the new blocks methods.
* @private
* @static
* @property _isusingnewblocksmethod
* @property M.core.blockdraganddrop._isusingnewblocksmethod
* @type Boolean
* @default null
*/
@@ -347,7 +335,7 @@ M.core.blockdraganddrop._isusingnewblocksmethod = null;
/**
* Returns true if the page is using the new blocks methods.
* @static
* @method is_using_blocks_render_method
* @method M.core.blockdraganddrop.is_using_blocks_render_method
* @return Boolean
*/
M.core.blockdraganddrop.is_using_blocks_render_method = function() {
@@ -363,7 +351,7 @@ M.core.blockdraganddrop.is_using_blocks_render_method = function() {
* Initialises a drag and drop manager.
* This should only ever be called once for a page.
* @static
* @method init
* @method M.core.blockdraganddrop.init
* @param {Object} params
* @return Manager
*/
@@ -375,7 +363,7 @@ M.core.blockdraganddrop.init = function(params) {
}
};
/**
/*
* Legacy code to keep things working.
*/
M.core_blocks = M.core_blocks || {};
+3 -10
View File
@@ -120,7 +120,7 @@ MANAGER.prototype = {
* Returns the ID of the block the given node represents.
* @method get_block_id
* @param {Node} node
* @returns {int} The blocks ID in the database.
* @return {int} The blocks ID in the database.
*/
get_block_id : function(node) {
return Number(node.get('id').replace(/inst/i, ''));
@@ -130,7 +130,7 @@ MANAGER.prototype = {
* Returns the block region that the node is part of or belonging to.
* @method get_block_region
* @param {Y.Node} node
* @returns {string} The region name.
* @return {string} The region name.
*/
get_block_region : function(node) {
if (!node.test('[data-blockregion]')) {
@@ -143,7 +143,7 @@ MANAGER.prototype = {
* Returns the BLOCKREGION instance that represents the block region the given node is part of.
* @method get_region_object
* @param {Y.Node} node
* @returns {BLOCKREGION}
* @return {BLOCKREGION}
*/
get_region_object : function(node) {
return this.regionobjects[this.get_block_region(node)];
@@ -152,7 +152,6 @@ MANAGER.prototype = {
/**
* Enables all fo the regions so that they are all visible while dragging is occuring.
* @method enable_all_regions
* @returns {undefined}
*/
enable_all_regions : function() {
var i = 0;
@@ -164,7 +163,6 @@ MANAGER.prototype = {
/**
* Disables enabled regions if they contain no blocks.
* @method disable_regions_if_required
* @returns {undefined}
*/
disable_regions_if_required : function() {
var i = 0;
@@ -177,7 +175,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drag_start when dragging starts.
* @method drag_start
* @param {Event} e
* @returns {undefined}
*/
drag_start : function(e) {
// Get our drag object
@@ -199,7 +196,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drop_over when something is dragged over a drop target.
* @method drop_over
* @param {Event} e
* @returns {undefined}
*/
drop_over : function(e) {
// Get a reference to our drag and drop nodes
@@ -216,7 +212,6 @@ MANAGER.prototype = {
/**
* Called by M.core.dragdrop.global_drop_end when a drop has been completed.
* @method drop_end
* @returns {undefined}
*/
drop_end : function() {
// Clear variables.
@@ -229,7 +224,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drag_dropmiss when something has been dropped on a node that isn't contained by a drop target.
* @method drag_dropmiss
* @param {Event} e
* @returns {undefined}
*/
drag_dropmiss : function(e) {
// Missed the target, but we assume the user intended to drop it
@@ -242,7 +236,6 @@ MANAGER.prototype = {
* Called by M.core.dragdrop.global_drag_hit when something has been dropped on a drop target.
* @method drop_hit
* @param {Event} e
* @returns {undefined}
*/
drop_hit : function(e) {
// Get a reference to our drag node
+55 -11
View File
@@ -1,3 +1,15 @@
/**
* A type of dialogue used as for choosing options.
*
* @module moodle-core-chooserdialogue
*/
/**
* A type of dialogue used as for choosing options.
*
* @constructor
* @class M.core.chooserdialogue
*/
var CHOOSERDIALOGUE = function() {
CHOOSERDIALOGUE.superclass.constructor.apply(this, arguments);
};
@@ -81,8 +93,8 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
/**
* Display the module chooser
*
* @param e Event Triggering Event
* @return void
* @method display_chooser
* @param {EventFacade} e Triggering Event
*/
display_chooser : function (e) {
var bb, dialogue, thisevent;
@@ -167,13 +179,13 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
},
/**
* Cancel any listen events in the listenevents queue
*
* Several locations add event handlers which should only be called before the form is submitted. This provides
* a way of cancelling those events.
*
* @return void
*/
* Cancel any listen events in the listenevents queue
*
* Several locations add event handlers which should only be called before the form is submitted. This provides
* a way of cancelling those events.
*
* @method cancel_listenevents
*/
cancel_listenevents : function () {
// Detach all listen events to prevent duplicate triggers
var thisevent;
@@ -189,8 +201,8 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
* This tries to set a sensible maximum and minimum to ensure that some options are always shown, and preferably
* all, whilst fitting the box within the current viewport.
*
* @param dialogue Y.Node The dialogue
* @return void
* @method center_dialogue
* @param Node {dialogue} Y.Node The dialogue
*/
center_dialogue : function(dialogue) {
var bb = this.panel.get('boundingBox'),
@@ -304,15 +316,47 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
{
NAME : 'moodle-core-chooserdialogue',
ATTRS : {
/**
* The minimum height (in pixels) before resizing is prevented and scroll
* locking disabled.
*
* @attribute minheight
* @type Number
* @default 300
*/
minheight : {
value : 300
},
/**
* The base height??
*
* @attribute baseheight
* @type Number
* @default 400
*/
baseheight: {
value : 400
},
/**
* The maximum height (in pixels) at which we stop resizing.
*
* @attribute maxheight
* @type Number
* @default 300
*/
maxheight : {
value : 660
},
/**
* The title of the close button.
*
* @attribute closeButtonTitle
* @type String
* @default 'Close'
*/
closeButtonTitle : {
validator : Y.Lang.isString,
value : 'Close'
+1 -1
View File
@@ -12,7 +12,7 @@
* @namespace M.core.dock
* @class Block
* @constructor
* @extends Y.Base
* @extends Base
*/
BLOCK = function() {
BLOCK.superclass.constructor.apply(this, arguments);
+2 -17
View File
@@ -35,22 +35,7 @@ var LOGNS = 'moodle-core-dock',
BLOCK,
DOCKEDITEM;
/**
* Core namespace.
*
* @static
* @namespace M
* @class core
*/
M.core = M.core || {};
/**
* Dock namespace.
*
* @static
* @namespace M.core
* @class dock
*/
M.core.dock = M.core.dock || {};
/**
@@ -259,8 +244,8 @@ M.core.dock.notifyBlockChange = function(instanceid) {
* @namespace M.core.dock
* @class Dock
* @constructor
* @extends Y.Base
* @uses Y.EventTarget
* @extends Base
* @uses EventTarget
*/
DOCK = function() {
DOCK.superclass.constructor.apply(this, arguments);
+2 -2
View File
@@ -12,8 +12,8 @@
* @namespace M.core.dock
* @class DockedItem
* @constructor
* @extends Y.Base
* @uses Y.EventTarget
* @extends Base
* @uses EventTarget
*/
DOCKEDITEM = function() {
DOCKEDITEM.superclass.constructor.apply(this, arguments);
+1 -16
View File
@@ -1,28 +1,13 @@
var LOADERNAME = 'moodle-core-dock-loader';
/**
* Core namespace.
*
* @static
* @namespace M
* @class core
*/
M.core = M.core || {};
/**
* Dock namespace.
*
* @static
* @namespace M.core
* @class dock
*/
M.core.dock = M.core.dock || {};
/**
* Creates the move to dock icon for dockable blocks if it doesn't already exist.
*
* @static
* @method ensureMoveToIconExists
* @method M.core.dock.ensureMoveToIconExists
* @param {Node} blocknode The Blocks node (.block[data-instanceid])
*/
M.core.dock.ensureMoveToIconExists = function(blocknode) {
+2 -2
View File
@@ -12,8 +12,8 @@
* @namespace M.core.dock
* @class Panel
* @constructor
* @extends Y.Base
* @uses Y.EventTarget
* @extends Base
* @uses EventTarget
*/
DOCKPANEL = function() {
DOCKPANEL.superclass.constructor.apply(this, arguments);
+1 -1
View File
@@ -13,7 +13,7 @@
* @namespace M.core.dock
* @class TabHeightManager
* @constructor
* @extends Y.Base
* @extends Base
*/
TABHEIGHTMANAGER = function() {
TABHEIGHTMANAGER.superclass.constructor.apply(this, arguments);
+9 -9
View File
@@ -14,9 +14,9 @@ FORMAUTOSUBMIT = function() {
Y.extend(FORMAUTOSUBMIT, Y.Base, {
/**
* Initialize the module
*/
/*
* Initialize the module
*/
initializer : function() {
// Set up local variables
var applyto,
@@ -54,9 +54,9 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
}
},
/**
* Check whether the select element was changed
*/
/*
* Check whether the select element was changed
*/
check_changed : function(e) {
var select,
nothing,
@@ -86,9 +86,9 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
return false;
},
/**
* Process any changes
*/
/*
* Process any changes
*/
process_changes : function(e) {
var select = this.check_changed(e),
form;
+41 -23
View File
@@ -1,3 +1,16 @@
/**
* A utility to check for form changes before navigating away from a page.
*
* @module moodle-core-formchangechecker
*/
/**
* A utility to check for form changes before navigating away from a page.
*
* @class M.core.formchangechecker
* @constructor
*/
var FORMCHANGECHECKERNAME = 'core-formchangechecker',
FORMCHANGECHECKER = function() {
@@ -10,8 +23,10 @@ Y.extend(FORMCHANGECHECKER, Y.Base, {
initialvaluelisteners : [],
/**
* Initialize the module
*/
* Initialize the module
*
* @method initializer
*/
initializer : function() {
var formid = 'form#' + this.get('formid'),
currentform = Y.one(formid);
@@ -40,12 +55,15 @@ Y.extend(FORMCHANGECHECKER, Y.Base, {
},
/**
* Store the initial value of the currently focussed element
*
* If an element has been focussed and changed but not yet blurred, the on change
* event won't be fired. We need to store it's initial value to compare it in the
* get_form_dirty_state function later.
*/
* Store the initial value of the currently focussed element
*
* If an element has been focussed and changed but not yet blurred, the on change
* event won't be fired. We need to store it's initial value to compare it in the
* get_form_dirty_state function later.
*
* @method store_initial_value
* @param {EventFacade} e
*/
store_initial_value : function(e) {
var thisevent;
if (e.target.hasClass('ignoredirty')) {
@@ -93,9 +111,9 @@ M.core_formchangechecker.init = function(config) {
// Store state information
M.core_formchangechecker.stateinformation = [];
/**
* Set the form changed state to true
*/
/*
* Set the form changed state to true
*/
M.core_formchangechecker.set_form_changed = function(e) {
if (e && e.target && e.target.hasClass('ignoredirty')) {
// Don't warn on elements with the ignoredirty class
@@ -108,19 +126,19 @@ M.core_formchangechecker.set_form_changed = function(e) {
delete M.core_formchangechecker.stateinformation.focused_element;
};
/**
* Set the form submitted state to true
*/
/*
* Set the form submitted state to true
*/
M.core_formchangechecker.set_form_submitted = function() {
M.core_formchangechecker.stateinformation.formsubmitted = 1;
};
/**
* Attempt to determine whether the form has been modified in any way and
* is thus 'dirty'
*
* @return Integer 1 is the form is dirty; 0 if not
*/
/*
* Attempt to determine whether the form has been modified in any way and
* is thus 'dirty'
*
* @return Integer 1 is the form is dirty; 0 if not
*/
M.core_formchangechecker.get_form_dirty_state = function() {
var state = M.core_formchangechecker.stateinformation,
editor;
@@ -158,9 +176,9 @@ M.core_formchangechecker.get_form_dirty_state = function() {
return 0;
};
/**
* Return a suitable message if changes have been made to a form
*/
/*
* Return a suitable message if changes have been made to a form
*/
M.core_formchangechecker.report_form_dirty_state = function(e) {
if (!M.core_formchangechecker.get_form_dirty_state()) {
// the form is not dirty, so don't display any message
@@ -14,6 +14,7 @@ Y.extend(MAINTENANCEMODETIMER, Y.Base, {
/**
* Initialise timer if maintenancemode set.
*
* @method initializer
* @param config {Array} array with timeleftinsec set.
*/
initializer: function(config) {
@@ -26,6 +27,8 @@ Y.extend(MAINTENANCEMODETIMER, Y.Base, {
/**
* Decrement time left and update display text.
*
* @method updatetimer
*/
updatetimer: function() {
this.timeleftinsec -= 1;
+16 -22
View File
@@ -20,7 +20,7 @@ var DIALOGUE_NAME = 'Moodle dialogue',
* @param {Object} c Object literal specifying the dialogue configuration properties.
* @constructor
* @class M.core.dialogue
* @extends Y.Panel
* @extends Panel
*/
DIALOGUE = function(c) {
var config = Y.clone(c);
@@ -67,11 +67,11 @@ Y.extend(DIALOGUE, Y.Panel, {
// Orientation change event listener.
_orientationevent : null,
_calculatedzindex : false,
/**
* Initialise the dialogue.
*
* @method initializer
* @return void
*/
initializer : function() {
var bb;
@@ -120,8 +120,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* Either set the zindex to the supplied value, or set it to one more than the highest existing
* dialog in the page.
*
* @method visibilityChanged
* @return void
* @method applyZIndex
*/
applyZIndex : function() {
var highestzindex = 1,
@@ -153,8 +152,8 @@ Y.extend(DIALOGUE, Y.Panel, {
* Finds the zIndex of the given node or its parent.
*
* @method findZIndex
* @param Node node
* @returns int Return either the zIndex of 0 if one was not found.
* @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) {
// In most cases the zindex is set on the parent of the dialog.
@@ -169,7 +168,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* Event listener for the visibility changed event.
*
* @method visibilityChanged
* @return void
* @param {EventFacade} e
*/
visibilityChanged : function(e) {
var titlebar, bb;
@@ -211,7 +210,6 @@ Y.extend(DIALOGUE, Y.Panel, {
* smaller than the responsive width - make the dialog fullscreen.
*
* @method makeResponsive
* @return void
*/
makeResponsive : function() {
var bb = this.get('boundingBox'),
@@ -246,7 +244,6 @@ Y.extend(DIALOGUE, Y.Panel, {
* Center the dialog on the screen.
*
* @method centerDialogue
* @return void
*/
centerDialogue : function() {
var bb = this.get('boundingBox'),
@@ -270,24 +267,19 @@ Y.extend(DIALOGUE, Y.Panel, {
}
},
/**
* Return if this dialogue should be fullscreen or not.
* Return whether this dialogue should be fullscreen or not.
*
* Responsive attribute must be true and we should not be in an iframe and the screen width should
* be less than the responsive width.
*
* @method shouldResizeFullscreen
* @return Boolean
* @return {Boolean}
*/
shouldResizeFullscreen : function() {
return (window === window.parent) && this.get('responsive') &&
Math.floor(Y.one(document.body).get('winWidth')) < this.get('responsiveWidth');
},
/**
* Override the show method to set keyboard focus on the dialogue.
*
* @method show
* @return void
*/
show : function() {
var result = null,
header = this.headerNode,
@@ -344,12 +336,14 @@ Y.extend(DIALOGUE, Y.Panel, {
}
}, 'down:9', CAN_RECEIVE_FOCUS_SELECTOR, this);
},
/**
* Trap the tab focus within the open modal.
*
* @param string target the element target
* @param string direction tab key for forward and tab+shift for backward
* @returns bool
* @method trapFocus
* @param {string} target the element target
* @param {string} direction tab key for forward and tab+shift for backward
* @return {Boolean} The result of the focus action.
*/
trapFocus : function(target, direction) {
var bb = this.get('boundingBox'),
@@ -466,7 +460,7 @@ Y.extend(DIALOGUE, Y.Panel, {
* The width that this dialogue should be resized to fullscreen.
*
* @attribute responsiveWidth
* @type Integer
* @type Number
* @default 768
*/
responsiveWidth : {
@@ -550,7 +544,7 @@ Y.Base.modifyAttrs(DIALOGUE, {
/**
* Any additional classes to add to the boundingBox.
*
* @attributes extraClasses
* @attribute extraClasses
* @type Array
* @default []
*/
+29 -4
View File
@@ -1,3 +1,16 @@
/**
* A popup help dialogue for Moodle.
*
* @module moodle-core-popuphelp
*/
/**
* A popup help dialogue for Moodle.
*
* @class M.core.popuphelp
* @constructor
*/
function POPUPHELP() {
POPUPHELP.superclass.constructor.apply(this, arguments);
}
@@ -20,10 +33,21 @@ POPUPHELP.ATTRS = ATTRS;
Y.extend(POPUPHELP, Y.Base, {
panel: null,
/**
* Setup the popuphelp.
*
* @method initializer
*/
initializer: function() {
Y.one('body').delegate('click', this.display_panel, SELECTORS.CLICKABLELINKS, this);
},
/**
* Display the help tooltip.
*
* @method display_panel
* @param {EventFacade} e
*/
display_panel: function(e) {
if (!this.panel) {
this.panel = new M.core.tooltip({
@@ -39,10 +63,11 @@ Y.extend(POPUPHELP, Y.Base, {
},
/**
* Override the footer handler to add a 'More help' link where relevant.
*
* @param {Object} helpobject The object returned from the AJAX call.
*/
* Override the footer handler to add a 'More help' link where relevant.
*
* @method set_footer
* @param {Object} helpobject The object returned from the AJAX call.
*/
set_footer: function(helpobject) {
// Check for an optional link to documentation on moodle.org.
if (helpobject.doclink) {
@@ -92,17 +92,17 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a 2d point.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* POINT
* Class representing a 2d point.
*
* @namespace M.assignfeedback_editpdf
* @param int x
* @param int y
* @param Number x
* @param Number y
* @class point
*/
POINT = function(x, y) {
@@ -165,13 +165,13 @@ M.assignfeedback_editpdf.point = POINT;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a 2d rect.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* RECT
* Class representing a 2d rect.
*
* @namespace M.assignfeedback_editpdf
* @param int x
@@ -308,7 +308,7 @@ M.assignfeedback_editpdf.rect = RECT;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a partially completed edit operation.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
@@ -412,14 +412,13 @@ M.assignfeedback_editpdf.edit = EDIT;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a drawable thing which contains both
* Y.Nodes, and Y.Shapes.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* DRAWABLE
* Class representing a drawable thing which contains both Y.Nodes, and Y.Shapes.
*
* @namespace M.assignfeedback_editpdf
* @param M.assignfeedback_editpdf.editor editor
@@ -489,10 +488,18 @@ M.assignfeedback_editpdf.drawable = DRAWABLE;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a list of annotations.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a highlight.
*
* @namespace M.assignfeedback_editpdf
* @class annotation
* @constructor
*/
ANNOTATION = function(config) {
ANNOTATION.superclass.constructor.apply(this, [config]);
};
@@ -819,13 +826,18 @@ M.assignfeedback_editpdf.annotation = ANNOTATION;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a line.
*
* @namespace M.assignfeedback_editpdf
* @class annotationline
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONLINE = function(config) {
ANNOTATIONLINE.superclass.constructor.apply(this, [config]);
@@ -934,13 +946,18 @@ M.assignfeedback_editpdf.annotationline = ANNOTATIONLINE;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a rectangle.
*
* @namespace M.assignfeedback_editpdf
* @class annotationrectangle
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONRECTANGLE = function(config) {
ANNOTATIONRECTANGLE.superclass.constructor.apply(this, [config]);
@@ -1042,13 +1059,18 @@ M.assignfeedback_editpdf.annotationrectangle = ANNOTATIONRECTANGLE;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a oval.
*
* @namespace M.assignfeedback_editpdf
* @class annotationoval
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONOVAL = function(config) {
ANNOTATIONOVAL.superclass.constructor.apply(this, [config]);
@@ -1150,13 +1172,18 @@ M.assignfeedback_editpdf.annotationoval = ANNOTATIONOVAL;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a pen.
*
* @namespace M.assignfeedback_editpdf
* @class annotationpen
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONPEN = function(config) {
ANNOTATIONPEN.superclass.constructor.apply(this, [config]);
@@ -1305,12 +1332,18 @@ M.assignfeedback_editpdf.annotationpen = ANNOTATIONPEN;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a highlight.
*
* @namespace M.assignfeedback_editpdf
* @class annotationhighlight
* @extends annotation
* @extends M.assignfeedback_editpdf.annotation
* @module moodle-assignfeedback_editpdf-editor
*/
ANNOTATIONHIGHLIGHT = function(config) {
@@ -1452,13 +1485,18 @@ M.assignfeedback_editpdf.annotationhighlight = ANNOTATIONHIGHLIGHT;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a stamp.
*
* @namespace M.assignfeedback_editpdf
* @class annotationstamp
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONSTAMP = function(config) {
ANNOTATIONSTAMP.superclass.constructor.apply(this, [config]);
@@ -1605,13 +1643,18 @@ var DROPDOWN_NAME = "Dropdown menu",
DROPDOWN;
/**
* DROPDOWN
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* This is a drop down list of buttons triggered (and aligned to) a button.
*
* @namespace M.assignfeedback_editpdf.widget.dropdown
* @namespace M.assignfeedback_editpdf
* @class dropdown
* @constructor
* @extends Y.Base
* @extends M.core.dialogue
*/
DROPDOWN = function(config) {
config.draggable = false;
@@ -1722,14 +1765,20 @@ M.assignfeedback_editpdf.dropdown = DROPDOWN;
var COLOURPICKER_NAME = "Colourpicker",
COLOURPICKER;
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* COLOURPICKER
* This is a drop down list of colours.
*
* @namespace M.assignfeedback_editpdf.colourpicker
* @class dropdown
* @namespace M.assignfeedback_editpdf
* @class colourpicker
* @constructor
* @extends Y.Base
* @extends M.assignfeedback_editpdf.dropdown
*/
COLOURPICKER = function(config) {
COLOURPICKER.superclass.constructor.apply(this, [config]);
@@ -1847,13 +1896,18 @@ var STAMPPICKER_NAME = "Colourpicker",
STAMPPICKER;
/**
* STAMPPICKER
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* This is a drop down list of stamps.
*
* @namespace M.assignfeedback_editpdf.stamppicker
* @class dropdown
* @namespace M.assignfeedback_editpdf
* @class stamppicker
* @constructor
* @extends Y.Base
* @extends M.assignfeedback_editpdf.dropdown
*/
STAMPPICKER = function(config) {
STAMPPICKER.superclass.constructor.apply(this, [config]);
@@ -1952,14 +2006,20 @@ M.assignfeedback_editpdf.stamppicker = STAMPPICKER;
var COMMENTMENUNAME = "Commentmenu",
COMMENTMENU;
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* COMMENTMENU
* This is a drop down list of comment context functions.
*
* @namespace M.assignfeedback_editpdf.editor
* @namespace M.assignfeedback_editpdf
* @class commentmenu
* @constructor
* @extends Y.Base
* @extends M.assignfeedback_editpdf.dropdown
*/
COMMENTMENU = function(config) {
COMMENTMENU.superclass.constructor.apply(this, [config]);
@@ -2068,13 +2128,18 @@ var COMMENTSEARCHNAME = "commentsearch",
COMMENTSEARCH;
/**
* COMMENTSEARCH
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* This is a searchable dialogue of comments.
*
* @namespace M.assignfeedback_editpdf.editor
* @namespace M.assignfeedback_editpdf
* @class commentsearch
* @constructor
* @extends Y.Base
* @extends M.core.dialogue
*/
COMMENTSEARCH = function(config) {
config.draggable = false;
@@ -2249,13 +2314,13 @@ M.assignfeedback_editpdf.commentsearch = COMMENTSEARCH;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a list of comments.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* COMMENT
* Class representing a list of comments.
*
* @namespace M.assignfeedback_editpdf
* @class comment
@@ -2690,13 +2755,13 @@ M.assignfeedback_editpdf.comment = COMMENT;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a users quick comment.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* QUICKCOMMENT
* Class representing a users quick comment.
*
* @namespace M.assignfeedback_editpdf
* @class quickcomment
@@ -2754,13 +2819,13 @@ M.assignfeedback_editpdf.quickcomment = QUICKCOMMENT;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a users list of quick comments.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* QUICKLIST
* Class representing a users list of quick comments.
*
* @namespace M.assignfeedback_editpdf
* @class quickcommentlist
@@ -2963,8 +3028,8 @@ M.assignfeedback_editpdf.quickcommentlist = QUICKCOMMENTLIST;
* EDITOR
* This is an in browser PDF editor.
*
* @namespace M.assignfeedback_editpdf.editor
* @class Editor
* @namespace M.assignfeedback_editpdf
* @class editor
* @constructor
* @extends Y.Base
*/
@@ -2973,9 +3038,9 @@ EDITOR = function() {
};
EDITOR.prototype = {
// Instance variables.
/**
* The dialogue used for all action menu displays.
*
* @property type
* @type M.core.dialogue
* @protected
@@ -2984,23 +3049,26 @@ EDITOR.prototype = {
/**
* The number of pages in the pdf.
* @property type
* @type int
*
* @property pagecount
* @type Number
* @protected
*/
pagecount : 0,
/**
* The active page in the editor.
* @property type
* @type int
*
* @property currentpage
* @type Number
* @protected
*/
currentpage : 0,
/**
* A list of page objects. Each page has a list of comments and annotations.
* @property type
*
* @property pages
* @type array
* @protected
*/
@@ -3008,15 +3076,17 @@ EDITOR.prototype = {
/**
* The yui node for the loading icon.
* @property type
* @type Y.Node
*
* @property loadingicon
* @type Node
* @protected
*/
loadingicon : null,
/**
* Image object of the current page image.
* @property type
*
* @property pageimage
* @type Image
* @protected
*/
@@ -3024,14 +3094,16 @@ EDITOR.prototype = {
/**
* YUI Graphic class for drawing shapes.
* @property type
* @type Y.Graphic
*
* @property graphic
* @type Graphic
* @protected
*/
graphic : null,
/**
* Info about the current edit operation.
*
* @property currentedit
* @type M.assignfeedback_editpdf.edit
* @protected
@@ -3040,14 +3112,16 @@ EDITOR.prototype = {
/**
* Current drawable.
*
* @property currentdrawable
* @type M.assignfeedback_editpdf.drawable (or false)
* @type M.assignfeedback_editpdf.drawable|false
* @protected
*/
currentdrawable : false,
/**
* Current drawables.
*
* @property drawables
* @type array(M.assignfeedback_editpdf.drawable)
* @protected
@@ -4020,24 +4094,12 @@ Y.extend(EDITOR, Y.Base, EDITOR.prototype, {
}
});
/**
* Assignfeedback edit pdf namespace.
* @static
* @class assignfeedback_editpdf
*/
M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
/**
* Editor namespace
* @namespace M.assignfeedback_editpdf.editor
* @class editor
* @static
*/
M.assignfeedback_editpdf.editor = M.assignfeedback_editpdf.editor || {};
/**
* Init function - will create a new instance every time.
* @method init
* @method editor.init
* @static
* @param {Object} params
*/
@@ -92,17 +92,17 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a 2d point.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* POINT
* Class representing a 2d point.
*
* @namespace M.assignfeedback_editpdf
* @param int x
* @param int y
* @param Number x
* @param Number y
* @class point
*/
POINT = function(x, y) {
@@ -165,13 +165,13 @@ M.assignfeedback_editpdf.point = POINT;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a 2d rect.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* RECT
* Class representing a 2d rect.
*
* @namespace M.assignfeedback_editpdf
* @param int x
@@ -308,7 +308,7 @@ M.assignfeedback_editpdf.rect = RECT;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a partially completed edit operation.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
@@ -412,14 +412,13 @@ M.assignfeedback_editpdf.edit = EDIT;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a drawable thing which contains both
* Y.Nodes, and Y.Shapes.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* DRAWABLE
* Class representing a drawable thing which contains both Y.Nodes, and Y.Shapes.
*
* @namespace M.assignfeedback_editpdf
* @param M.assignfeedback_editpdf.editor editor
@@ -489,10 +488,18 @@ M.assignfeedback_editpdf.drawable = DRAWABLE;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a list of annotations.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a highlight.
*
* @namespace M.assignfeedback_editpdf
* @class annotation
* @constructor
*/
ANNOTATION = function(config) {
ANNOTATION.superclass.constructor.apply(this, [config]);
};
@@ -819,13 +826,18 @@ M.assignfeedback_editpdf.annotation = ANNOTATION;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a line.
*
* @namespace M.assignfeedback_editpdf
* @class annotationline
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONLINE = function(config) {
ANNOTATIONLINE.superclass.constructor.apply(this, [config]);
@@ -934,13 +946,18 @@ M.assignfeedback_editpdf.annotationline = ANNOTATIONLINE;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a rectangle.
*
* @namespace M.assignfeedback_editpdf
* @class annotationrectangle
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONRECTANGLE = function(config) {
ANNOTATIONRECTANGLE.superclass.constructor.apply(this, [config]);
@@ -1042,13 +1059,18 @@ M.assignfeedback_editpdf.annotationrectangle = ANNOTATIONRECTANGLE;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a oval.
*
* @namespace M.assignfeedback_editpdf
* @class annotationoval
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONOVAL = function(config) {
ANNOTATIONOVAL.superclass.constructor.apply(this, [config]);
@@ -1150,13 +1172,18 @@ M.assignfeedback_editpdf.annotationoval = ANNOTATIONOVAL;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a pen.
*
* @namespace M.assignfeedback_editpdf
* @class annotationpen
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONPEN = function(config) {
ANNOTATIONPEN.superclass.constructor.apply(this, [config]);
@@ -1305,12 +1332,18 @@ M.assignfeedback_editpdf.annotationpen = ANNOTATIONPEN;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a highlight.
*
* @namespace M.assignfeedback_editpdf
* @class annotationhighlight
* @extends annotation
* @extends M.assignfeedback_editpdf.annotation
* @module moodle-assignfeedback_editpdf-editor
*/
ANNOTATIONHIGHLIGHT = function(config) {
@@ -1452,13 +1485,18 @@ M.assignfeedback_editpdf.annotationhighlight = ANNOTATIONHIGHLIGHT;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a stamp.
*
* @namespace M.assignfeedback_editpdf
* @class annotationstamp
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONSTAMP = function(config) {
ANNOTATIONSTAMP.superclass.constructor.apply(this, [config]);
@@ -1605,13 +1643,18 @@ var DROPDOWN_NAME = "Dropdown menu",
DROPDOWN;
/**
* DROPDOWN
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* This is a drop down list of buttons triggered (and aligned to) a button.
*
* @namespace M.assignfeedback_editpdf.widget.dropdown
* @namespace M.assignfeedback_editpdf
* @class dropdown
* @constructor
* @extends Y.Base
* @extends M.core.dialogue
*/
DROPDOWN = function(config) {
config.draggable = false;
@@ -1722,14 +1765,20 @@ M.assignfeedback_editpdf.dropdown = DROPDOWN;
var COLOURPICKER_NAME = "Colourpicker",
COLOURPICKER;
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* COLOURPICKER
* This is a drop down list of colours.
*
* @namespace M.assignfeedback_editpdf.colourpicker
* @class dropdown
* @namespace M.assignfeedback_editpdf
* @class colourpicker
* @constructor
* @extends Y.Base
* @extends M.assignfeedback_editpdf.dropdown
*/
COLOURPICKER = function(config) {
COLOURPICKER.superclass.constructor.apply(this, [config]);
@@ -1847,13 +1896,18 @@ var STAMPPICKER_NAME = "Colourpicker",
STAMPPICKER;
/**
* STAMPPICKER
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* This is a drop down list of stamps.
*
* @namespace M.assignfeedback_editpdf.stamppicker
* @class dropdown
* @namespace M.assignfeedback_editpdf
* @class stamppicker
* @constructor
* @extends Y.Base
* @extends M.assignfeedback_editpdf.dropdown
*/
STAMPPICKER = function(config) {
STAMPPICKER.superclass.constructor.apply(this, [config]);
@@ -1952,14 +2006,20 @@ M.assignfeedback_editpdf.stamppicker = STAMPPICKER;
var COMMENTMENUNAME = "Commentmenu",
COMMENTMENU;
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* COMMENTMENU
* This is a drop down list of comment context functions.
*
* @namespace M.assignfeedback_editpdf.editor
* @namespace M.assignfeedback_editpdf
* @class commentmenu
* @constructor
* @extends Y.Base
* @extends M.assignfeedback_editpdf.dropdown
*/
COMMENTMENU = function(config) {
COMMENTMENU.superclass.constructor.apply(this, [config]);
@@ -2068,13 +2128,18 @@ var COMMENTSEARCHNAME = "commentsearch",
COMMENTSEARCH;
/**
* COMMENTSEARCH
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* This is a searchable dialogue of comments.
*
* @namespace M.assignfeedback_editpdf.editor
* @namespace M.assignfeedback_editpdf
* @class commentsearch
* @constructor
* @extends Y.Base
* @extends M.core.dialogue
*/
COMMENTSEARCH = function(config) {
config.draggable = false;
@@ -2249,13 +2314,13 @@ M.assignfeedback_editpdf.commentsearch = COMMENTSEARCH;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a list of comments.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* COMMENT
* Class representing a list of comments.
*
* @namespace M.assignfeedback_editpdf
* @class comment
@@ -2690,13 +2755,13 @@ M.assignfeedback_editpdf.comment = COMMENT;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a users quick comment.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* QUICKCOMMENT
* Class representing a users quick comment.
*
* @namespace M.assignfeedback_editpdf
* @class quickcomment
@@ -2754,13 +2819,13 @@ M.assignfeedback_editpdf.quickcomment = QUICKCOMMENT;
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a users list of quick comments.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* QUICKLIST
* Class representing a users list of quick comments.
*
* @namespace M.assignfeedback_editpdf
* @class quickcommentlist
@@ -2963,8 +3028,8 @@ M.assignfeedback_editpdf.quickcommentlist = QUICKCOMMENTLIST;
* EDITOR
* This is an in browser PDF editor.
*
* @namespace M.assignfeedback_editpdf.editor
* @class Editor
* @namespace M.assignfeedback_editpdf
* @class editor
* @constructor
* @extends Y.Base
*/
@@ -2973,9 +3038,9 @@ EDITOR = function() {
};
EDITOR.prototype = {
// Instance variables.
/**
* The dialogue used for all action menu displays.
*
* @property type
* @type M.core.dialogue
* @protected
@@ -2984,23 +3049,26 @@ EDITOR.prototype = {
/**
* The number of pages in the pdf.
* @property type
* @type int
*
* @property pagecount
* @type Number
* @protected
*/
pagecount : 0,
/**
* The active page in the editor.
* @property type
* @type int
*
* @property currentpage
* @type Number
* @protected
*/
currentpage : 0,
/**
* A list of page objects. Each page has a list of comments and annotations.
* @property type
*
* @property pages
* @type array
* @protected
*/
@@ -3008,15 +3076,17 @@ EDITOR.prototype = {
/**
* The yui node for the loading icon.
* @property type
* @type Y.Node
*
* @property loadingicon
* @type Node
* @protected
*/
loadingicon : null,
/**
* Image object of the current page image.
* @property type
*
* @property pageimage
* @type Image
* @protected
*/
@@ -3024,14 +3094,16 @@ EDITOR.prototype = {
/**
* YUI Graphic class for drawing shapes.
* @property type
* @type Y.Graphic
*
* @property graphic
* @type Graphic
* @protected
*/
graphic : null,
/**
* Info about the current edit operation.
*
* @property currentedit
* @type M.assignfeedback_editpdf.edit
* @protected
@@ -3040,14 +3112,16 @@ EDITOR.prototype = {
/**
* Current drawable.
*
* @property currentdrawable
* @type M.assignfeedback_editpdf.drawable (or false)
* @type M.assignfeedback_editpdf.drawable|false
* @protected
*/
currentdrawable : false,
/**
* Current drawables.
*
* @property drawables
* @type array(M.assignfeedback_editpdf.drawable)
* @protected
@@ -4020,24 +4094,12 @@ Y.extend(EDITOR, Y.Base, EDITOR.prototype, {
}
});
/**
* Assignfeedback edit pdf namespace.
* @static
* @class assignfeedback_editpdf
*/
M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
/**
* Editor namespace
* @namespace M.assignfeedback_editpdf.editor
* @class editor
* @static
*/
M.assignfeedback_editpdf.editor = M.assignfeedback_editpdf.editor || {};
/**
* Init function - will create a new instance every time.
* @method init
* @method editor.init
* @static
* @param {Object} params
*/
@@ -14,10 +14,18 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a list of annotations.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a highlight.
*
* @namespace M.assignfeedback_editpdf
* @class annotation
* @constructor
*/
ANNOTATION = function(config) {
ANNOTATION.superclass.constructor.apply(this, [config]);
};
@@ -13,12 +13,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a highlight.
*
* @namespace M.assignfeedback_editpdf
* @class annotationhighlight
* @extends annotation
* @extends M.assignfeedback_editpdf.annotation
* @module moodle-assignfeedback_editpdf-editor
*/
ANNOTATIONHIGHLIGHT = function(config) {
@@ -13,13 +13,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a line.
*
* @namespace M.assignfeedback_editpdf
* @class annotationline
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONLINE = function(config) {
ANNOTATIONLINE.superclass.constructor.apply(this, [config]);
@@ -13,13 +13,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a oval.
*
* @namespace M.assignfeedback_editpdf
* @class annotationoval
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONOVAL = function(config) {
ANNOTATIONOVAL.superclass.constructor.apply(this, [config]);
@@ -13,13 +13,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a pen.
*
* @namespace M.assignfeedback_editpdf
* @class annotationpen
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONPEN = function(config) {
ANNOTATIONPEN.superclass.constructor.apply(this, [config]);
@@ -13,13 +13,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a rectangle.
*
* @namespace M.assignfeedback_editpdf
* @class annotationrectangle
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONRECTANGLE = function(config) {
ANNOTATIONRECTANGLE.superclass.constructor.apply(this, [config]);
@@ -13,13 +13,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* Class representing a stamp.
*
* @namespace M.assignfeedback_editpdf
* @class annotationstamp
* @extends annotation
* @module moodle-assignfeedback_editpdf-editor
* @extends M.assignfeedback_editpdf.annotation
*/
ANNOTATIONSTAMP = function(config) {
ANNOTATIONSTAMP.superclass.constructor.apply(this, [config]);
@@ -1,14 +1,20 @@
var COLOURPICKER_NAME = "Colourpicker",
COLOURPICKER;
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* COLOURPICKER
* This is a drop down list of colours.
*
* @namespace M.assignfeedback_editpdf.colourpicker
* @class dropdown
* @namespace M.assignfeedback_editpdf
* @class colourpicker
* @constructor
* @extends Y.Base
* @extends M.assignfeedback_editpdf.dropdown
*/
COLOURPICKER = function(config) {
COLOURPICKER.superclass.constructor.apply(this, [config]);
+2 -2
View File
@@ -14,13 +14,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a list of comments.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* COMMENT
* Class representing a list of comments.
*
* @namespace M.assignfeedback_editpdf
* @class comment
@@ -1,14 +1,20 @@
var COMMENTMENUNAME = "Commentmenu",
COMMENTMENU;
/**
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* COMMENTMENU
* This is a drop down list of comment context functions.
*
* @namespace M.assignfeedback_editpdf.editor
* @namespace M.assignfeedback_editpdf
* @class commentmenu
* @constructor
* @extends Y.Base
* @extends M.assignfeedback_editpdf.dropdown
*/
COMMENTMENU = function(config) {
COMMENTMENU.superclass.constructor.apply(this, [config]);
@@ -2,13 +2,18 @@ var COMMENTSEARCHNAME = "commentsearch",
COMMENTSEARCH;
/**
* COMMENTSEARCH
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* This is a searchable dialogue of comments.
*
* @namespace M.assignfeedback_editpdf.editor
* @namespace M.assignfeedback_editpdf
* @class commentsearch
* @constructor
* @extends Y.Base
* @extends M.core.dialogue
*/
COMMENTSEARCH = function(config) {
config.draggable = false;
+2 -3
View File
@@ -14,14 +14,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a drawable thing which contains both
* Y.Nodes, and Y.Shapes.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* DRAWABLE
* Class representing a drawable thing which contains both Y.Nodes, and Y.Shapes.
*
* @namespace M.assignfeedback_editpdf
* @param M.assignfeedback_editpdf.editor editor
+8 -3
View File
@@ -2,13 +2,18 @@ var DROPDOWN_NAME = "Dropdown menu",
DROPDOWN;
/**
* DROPDOWN
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* This is a drop down list of buttons triggered (and aligned to) a button.
*
* @namespace M.assignfeedback_editpdf.widget.dropdown
* @namespace M.assignfeedback_editpdf
* @class dropdown
* @constructor
* @extends Y.Base
* @extends M.core.dialogue
*/
DROPDOWN = function(config) {
config.draggable = false;
+1 -1
View File
@@ -14,7 +14,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a partially completed edit operation.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
+24 -27
View File
@@ -23,8 +23,8 @@
* EDITOR
* This is an in browser PDF editor.
*
* @namespace M.assignfeedback_editpdf.editor
* @class Editor
* @namespace M.assignfeedback_editpdf
* @class editor
* @constructor
* @extends Y.Base
*/
@@ -33,9 +33,9 @@ EDITOR = function() {
};
EDITOR.prototype = {
// Instance variables.
/**
* The dialogue used for all action menu displays.
*
* @property type
* @type M.core.dialogue
* @protected
@@ -44,23 +44,26 @@ EDITOR.prototype = {
/**
* The number of pages in the pdf.
* @property type
* @type int
*
* @property pagecount
* @type Number
* @protected
*/
pagecount : 0,
/**
* The active page in the editor.
* @property type
* @type int
*
* @property currentpage
* @type Number
* @protected
*/
currentpage : 0,
/**
* A list of page objects. Each page has a list of comments and annotations.
* @property type
*
* @property pages
* @type array
* @protected
*/
@@ -68,15 +71,17 @@ EDITOR.prototype = {
/**
* The yui node for the loading icon.
* @property type
* @type Y.Node
*
* @property loadingicon
* @type Node
* @protected
*/
loadingicon : null,
/**
* Image object of the current page image.
* @property type
*
* @property pageimage
* @type Image
* @protected
*/
@@ -84,14 +89,16 @@ EDITOR.prototype = {
/**
* YUI Graphic class for drawing shapes.
* @property type
* @type Y.Graphic
*
* @property graphic
* @type Graphic
* @protected
*/
graphic : null,
/**
* Info about the current edit operation.
*
* @property currentedit
* @type M.assignfeedback_editpdf.edit
* @protected
@@ -100,14 +107,16 @@ EDITOR.prototype = {
/**
* Current drawable.
*
* @property currentdrawable
* @type M.assignfeedback_editpdf.drawable (or false)
* @type M.assignfeedback_editpdf.drawable|false
* @protected
*/
currentdrawable : false,
/**
* Current drawables.
*
* @property drawables
* @type array(M.assignfeedback_editpdf.drawable)
* @protected
@@ -1080,24 +1089,12 @@ Y.extend(EDITOR, Y.Base, EDITOR.prototype, {
}
});
/**
* Assignfeedback edit pdf namespace.
* @static
* @class assignfeedback_editpdf
*/
M.assignfeedback_editpdf = M.assignfeedback_editpdf || {};
/**
* Editor namespace
* @namespace M.assignfeedback_editpdf.editor
* @class editor
* @static
*/
M.assignfeedback_editpdf.editor = M.assignfeedback_editpdf.editor || {};
/**
* Init function - will create a new instance every time.
* @method init
* @method editor.init
* @static
* @param {Object} params
*/
+4 -4
View File
@@ -14,17 +14,17 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a 2d point.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* POINT
* Class representing a 2d point.
*
* @namespace M.assignfeedback_editpdf
* @param int x
* @param int y
* @param Number x
* @param Number y
* @class point
*/
POINT = function(x, y) {
@@ -14,13 +14,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a users quick comment.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* QUICKCOMMENT
* Class representing a users quick comment.
*
* @namespace M.assignfeedback_editpdf
* @class quickcomment
@@ -14,13 +14,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a users list of quick comments.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* QUICKLIST
* Class representing a users list of quick comments.
*
* @namespace M.assignfeedback_editpdf
* @class quickcommentlist
+2 -2
View File
@@ -14,13 +14,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class representing a 2d rect.
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* RECT
* Class representing a 2d rect.
*
* @namespace M.assignfeedback_editpdf
* @param int x
@@ -2,13 +2,18 @@ var STAMPPICKER_NAME = "Colourpicker",
STAMPPICKER;
/**
* STAMPPICKER
* Provides an in browser PDF editor.
*
* @module moodle-assignfeedback_editpdf-editor
*/
/**
* This is a drop down list of stamps.
*
* @namespace M.assignfeedback_editpdf.stamppicker
* @class dropdown
* @namespace M.assignfeedback_editpdf
* @class stamppicker
* @constructor
* @extends Y.Base
* @extends M.assignfeedback_editpdf.dropdown
*/
STAMPPICKER = function(config) {
STAMPPICKER.superclass.constructor.apply(this, [config]);
@@ -19,21 +19,76 @@ YUI.add('moodle-mod_quiz-autosave', function (Y, NAME) {
/**
* Auto-save functionality for during quiz attempts.
*
* @package mod_quiz
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @module moodle-mod_quiz-autosave
*/
/**
* Auto-save functionality for during quiz attempts.
*
* @class M.mod_quiz.autosave
*/
M.mod_quiz = M.mod_quiz || {};
M.mod_quiz.autosave = {
/** Delays and repeat counts. */
/**
* The amount of time (in milliseconds) to wait between TinyMCE detections.
*
* @property TINYMCE_DETECTION_DELAY
* @type Number
* @default 500
* @private
*/
TINYMCE_DETECTION_DELAY: 500,
/**
* The number of times to try redetecting TinyMCE.
*
* @property TINYMCE_DETECTION_REPEATS
* @type Number
* @default 20
* @private
*/
TINYMCE_DETECTION_REPEATS: 20,
/**
* The delay (in milliseconds) between checking hidden input fields.
*
* @property WATCH_HIDDEN_DELAY
* @type Number
* @default 1000
* @private
*/
WATCH_HIDDEN_DELAY: 1000,
/**
* The number of failures to ignore before notifying the user.
*
* @property FAILURES_BEFORE_NOTIFY
* @type Number
* @default 1
* @private
*/
FAILURES_BEFORE_NOTIFY: 1,
/**
* The value to use when resetting the successful save counter.
*
* @property FIRST_SUCCESSFUL_SAVE
* @static
* @type Number
* @default -1
* @private
*/
FIRST_SUCCESSFUL_SAVE: -1,
/** Selectors. */
/**
* The selectors used throughout this class.
*
* @property SELECTORS
* @private
* @type Object
* @static
*/
SELECTORS: {
QUIZ_FORM: '#responseform',
VALUE_CHANGE_ELEMENTS: 'input, textarea',
@@ -43,36 +98,97 @@ M.mod_quiz.autosave = {
CONNECTION_OK: '#connection-ok'
},
/** Script that handles the auto-saves. */
/**
* The script which handles the autosaves.
*
* @property AUTOSAVE_HANDLER
* @type String
* @default M.cfg.wwwroot + '/mod/quiz/autosave.ajax.php'
* @private
*/
AUTOSAVE_HANDLER: M.cfg.wwwroot + '/mod/quiz/autosave.ajax.php',
/** The delay between a change being made, and it being auto-saved. */
/**
* The delay (in milliseconds) between a change being made, and it being auto-saved.
*
* @property delay
* @type Number
* @default 120000
* @private
*/
delay: 120000,
/** The form we are monitoring. */
/**
* A Node reference to the form we are monitoring.
*
* @property form
* @type Node
* @default null
*/
form: null,
/** Whether the form has been modified since the last save started. */
/**
* Whether the form has been modified since the last save started.
*
* @property dirty
* @type boolean
* @default false
*/
dirty: false,
/** Timer object for the delay between form modifaction and the save starting. */
/**
* Timer object for the delay between form modifaction and the save starting.
*
* @property delay_timer
* @type Object
* @default null
* @private
*/
delay_timer: null,
/** Y.io transaction for the save ajax request. */
/**
* Y.io transaction for the save ajax request.
*
* @property save_transaction
* @type object
* @default null
*/
save_transaction: null,
/** @property Failed saves count. */
/**
* Failed saves count.
*
* @property savefailures
* @type Number
* @default 0
* @private
*/
savefailures: 0,
/** Properly bound key change handler. */
/**
* Properly bound key change handler.
*
* @property editor_change_handler
* @type EventHandle
* @default null
* @private
*/
editor_change_handler: null,
/** Record of the value of all the hidden fields, last time they were checked. */
/**
* Record of the value of all the hidden fields, last time they were checked.
*
* @property hidden_field_values
* @type Object
* @default {}
*/
hidden_field_values: {},
/**
* Initialise the autosave code.
* @param delay the delay, in seconds, between a change being detected, and
*
* @method init
* @param {Number} delay the delay, in seconds, between a change being detected, and
* a save happening.
*/
init: function(delay) {
@@ -124,9 +240,16 @@ M.mod_quiz.autosave = {
},
/**
* @param repeatcount Because TinyMCE might load slowly, after us, we need
* to keep trying every 10 seconds or so, until we detect TinyMCE is there,
* or enough time has passed.
* Initialise watching of TinyMCE specifically.
*
* Because TinyMCE might load slowly, and after us, we need to keep
* trying, until we detect TinyMCE is there, or enough time has passed.
* This is based on the TINYMCE_DETECTION_DELAY and
* TINYMCE_DETECTION_REPEATS properties.
*
*
* @method init_tinymce
* @param {Number} repeatcount The number of attempts made so far.
*/
init_tinymce: function(repeatcount) {
if (typeof tinyMCE === 'undefined') {
@@ -144,11 +267,13 @@ M.mod_quiz.autosave = {
},
/**
* @param repeatcount Because TinyMCE might load slowly, after us, we need
* to keep trying every 10 seconds or so, until we detect TinyMCE is there,
* or enough time has passed.
* Initialise watching of a specific TinyMCE editor.
*
* @method init_tinymce_editor
* @param {EventFacade} e
* @param {Object} editor The TinyMCE editor object
*/
init_tinymce_editor: function(notused, editor) {
init_tinymce_editor: function(e, editor) {
Y.log('Found TinyMCE editor ' + editor.id + '.');
editor.onChange.add(this.editor_change_handler);
editor.onRedo.add(this.editor_change_handler);
@@ -19,21 +19,76 @@ YUI.add('moodle-mod_quiz-autosave', function (Y, NAME) {
/**
* Auto-save functionality for during quiz attempts.
*
* @package mod_quiz
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @module moodle-mod_quiz-autosave
*/
/**
* Auto-save functionality for during quiz attempts.
*
* @class M.mod_quiz.autosave
*/
M.mod_quiz = M.mod_quiz || {};
M.mod_quiz.autosave = {
/** Delays and repeat counts. */
/**
* The amount of time (in milliseconds) to wait between TinyMCE detections.
*
* @property TINYMCE_DETECTION_DELAY
* @type Number
* @default 500
* @private
*/
TINYMCE_DETECTION_DELAY: 500,
/**
* The number of times to try redetecting TinyMCE.
*
* @property TINYMCE_DETECTION_REPEATS
* @type Number
* @default 20
* @private
*/
TINYMCE_DETECTION_REPEATS: 20,
/**
* The delay (in milliseconds) between checking hidden input fields.
*
* @property WATCH_HIDDEN_DELAY
* @type Number
* @default 1000
* @private
*/
WATCH_HIDDEN_DELAY: 1000,
/**
* The number of failures to ignore before notifying the user.
*
* @property FAILURES_BEFORE_NOTIFY
* @type Number
* @default 1
* @private
*/
FAILURES_BEFORE_NOTIFY: 1,
/**
* The value to use when resetting the successful save counter.
*
* @property FIRST_SUCCESSFUL_SAVE
* @static
* @type Number
* @default -1
* @private
*/
FIRST_SUCCESSFUL_SAVE: -1,
/** Selectors. */
/**
* The selectors used throughout this class.
*
* @property SELECTORS
* @private
* @type Object
* @static
*/
SELECTORS: {
QUIZ_FORM: '#responseform',
VALUE_CHANGE_ELEMENTS: 'input, textarea',
@@ -43,36 +98,97 @@ M.mod_quiz.autosave = {
CONNECTION_OK: '#connection-ok'
},
/** Script that handles the auto-saves. */
/**
* The script which handles the autosaves.
*
* @property AUTOSAVE_HANDLER
* @type String
* @default M.cfg.wwwroot + '/mod/quiz/autosave.ajax.php'
* @private
*/
AUTOSAVE_HANDLER: M.cfg.wwwroot + '/mod/quiz/autosave.ajax.php',
/** The delay between a change being made, and it being auto-saved. */
/**
* The delay (in milliseconds) between a change being made, and it being auto-saved.
*
* @property delay
* @type Number
* @default 120000
* @private
*/
delay: 120000,
/** The form we are monitoring. */
/**
* A Node reference to the form we are monitoring.
*
* @property form
* @type Node
* @default null
*/
form: null,
/** Whether the form has been modified since the last save started. */
/**
* Whether the form has been modified since the last save started.
*
* @property dirty
* @type boolean
* @default false
*/
dirty: false,
/** Timer object for the delay between form modifaction and the save starting. */
/**
* Timer object for the delay between form modifaction and the save starting.
*
* @property delay_timer
* @type Object
* @default null
* @private
*/
delay_timer: null,
/** Y.io transaction for the save ajax request. */
/**
* Y.io transaction for the save ajax request.
*
* @property save_transaction
* @type object
* @default null
*/
save_transaction: null,
/** @property Failed saves count. */
/**
* Failed saves count.
*
* @property savefailures
* @type Number
* @default 0
* @private
*/
savefailures: 0,
/** Properly bound key change handler. */
/**
* Properly bound key change handler.
*
* @property editor_change_handler
* @type EventHandle
* @default null
* @private
*/
editor_change_handler: null,
/** Record of the value of all the hidden fields, last time they were checked. */
/**
* Record of the value of all the hidden fields, last time they were checked.
*
* @property hidden_field_values
* @type Object
* @default {}
*/
hidden_field_values: {},
/**
* Initialise the autosave code.
* @param delay the delay, in seconds, between a change being detected, and
*
* @method init
* @param {Number} delay the delay, in seconds, between a change being detected, and
* a save happening.
*/
init: function(delay) {
@@ -123,9 +239,16 @@ M.mod_quiz.autosave = {
},
/**
* @param repeatcount Because TinyMCE might load slowly, after us, we need
* to keep trying every 10 seconds or so, until we detect TinyMCE is there,
* or enough time has passed.
* Initialise watching of TinyMCE specifically.
*
* Because TinyMCE might load slowly, and after us, we need to keep
* trying, until we detect TinyMCE is there, or enough time has passed.
* This is based on the TINYMCE_DETECTION_DELAY and
* TINYMCE_DETECTION_REPEATS properties.
*
*
* @method init_tinymce
* @param {Number} repeatcount The number of attempts made so far.
*/
init_tinymce: function(repeatcount) {
if (typeof tinyMCE === 'undefined') {
@@ -141,11 +264,13 @@ M.mod_quiz.autosave = {
},
/**
* @param repeatcount Because TinyMCE might load slowly, after us, we need
* to keep trying every 10 seconds or so, until we detect TinyMCE is there,
* or enough time has passed.
* Initialise watching of a specific TinyMCE editor.
*
* @method init_tinymce_editor
* @param {EventFacade} e
* @param {Object} editor The TinyMCE editor object
*/
init_tinymce_editor: function(notused, editor) {
init_tinymce_editor: function(e, editor) {
editor.onChange.add(this.editor_change_handler);
editor.onRedo.add(this.editor_change_handler);
editor.onUndo.add(this.editor_change_handler);
+147 -22
View File
@@ -17,21 +17,76 @@
/**
* Auto-save functionality for during quiz attempts.
*
* @package mod_quiz
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @module moodle-mod_quiz-autosave
*/
/**
* Auto-save functionality for during quiz attempts.
*
* @class M.mod_quiz.autosave
*/
M.mod_quiz = M.mod_quiz || {};
M.mod_quiz.autosave = {
/** Delays and repeat counts. */
/**
* The amount of time (in milliseconds) to wait between TinyMCE detections.
*
* @property TINYMCE_DETECTION_DELAY
* @type Number
* @default 500
* @private
*/
TINYMCE_DETECTION_DELAY: 500,
/**
* The number of times to try redetecting TinyMCE.
*
* @property TINYMCE_DETECTION_REPEATS
* @type Number
* @default 20
* @private
*/
TINYMCE_DETECTION_REPEATS: 20,
/**
* The delay (in milliseconds) between checking hidden input fields.
*
* @property WATCH_HIDDEN_DELAY
* @type Number
* @default 1000
* @private
*/
WATCH_HIDDEN_DELAY: 1000,
/**
* The number of failures to ignore before notifying the user.
*
* @property FAILURES_BEFORE_NOTIFY
* @type Number
* @default 1
* @private
*/
FAILURES_BEFORE_NOTIFY: 1,
/**
* The value to use when resetting the successful save counter.
*
* @property FIRST_SUCCESSFUL_SAVE
* @static
* @type Number
* @default -1
* @private
*/
FIRST_SUCCESSFUL_SAVE: -1,
/** Selectors. */
/**
* The selectors used throughout this class.
*
* @property SELECTORS
* @private
* @type Object
* @static
*/
SELECTORS: {
QUIZ_FORM: '#responseform',
VALUE_CHANGE_ELEMENTS: 'input, textarea',
@@ -41,36 +96,97 @@ M.mod_quiz.autosave = {
CONNECTION_OK: '#connection-ok'
},
/** Script that handles the auto-saves. */
/**
* The script which handles the autosaves.
*
* @property AUTOSAVE_HANDLER
* @type String
* @default M.cfg.wwwroot + '/mod/quiz/autosave.ajax.php'
* @private
*/
AUTOSAVE_HANDLER: M.cfg.wwwroot + '/mod/quiz/autosave.ajax.php',
/** The delay between a change being made, and it being auto-saved. */
/**
* The delay (in milliseconds) between a change being made, and it being auto-saved.
*
* @property delay
* @type Number
* @default 120000
* @private
*/
delay: 120000,
/** The form we are monitoring. */
/**
* A Node reference to the form we are monitoring.
*
* @property form
* @type Node
* @default null
*/
form: null,
/** Whether the form has been modified since the last save started. */
/**
* Whether the form has been modified since the last save started.
*
* @property dirty
* @type boolean
* @default false
*/
dirty: false,
/** Timer object for the delay between form modifaction and the save starting. */
/**
* Timer object for the delay between form modifaction and the save starting.
*
* @property delay_timer
* @type Object
* @default null
* @private
*/
delay_timer: null,
/** Y.io transaction for the save ajax request. */
/**
* Y.io transaction for the save ajax request.
*
* @property save_transaction
* @type object
* @default null
*/
save_transaction: null,
/** @property Failed saves count. */
/**
* Failed saves count.
*
* @property savefailures
* @type Number
* @default 0
* @private
*/
savefailures: 0,
/** Properly bound key change handler. */
/**
* Properly bound key change handler.
*
* @property editor_change_handler
* @type EventHandle
* @default null
* @private
*/
editor_change_handler: null,
/** Record of the value of all the hidden fields, last time they were checked. */
/**
* Record of the value of all the hidden fields, last time they were checked.
*
* @property hidden_field_values
* @type Object
* @default {}
*/
hidden_field_values: {},
/**
* Initialise the autosave code.
* @param delay the delay, in seconds, between a change being detected, and
*
* @method init
* @param {Number} delay the delay, in seconds, between a change being detected, and
* a save happening.
*/
init: function(delay) {
@@ -122,9 +238,16 @@ M.mod_quiz.autosave = {
},
/**
* @param repeatcount Because TinyMCE might load slowly, after us, we need
* to keep trying every 10 seconds or so, until we detect TinyMCE is there,
* or enough time has passed.
* Initialise watching of TinyMCE specifically.
*
* Because TinyMCE might load slowly, and after us, we need to keep
* trying, until we detect TinyMCE is there, or enough time has passed.
* This is based on the TINYMCE_DETECTION_DELAY and
* TINYMCE_DETECTION_REPEATS properties.
*
*
* @method init_tinymce
* @param {Number} repeatcount The number of attempts made so far.
*/
init_tinymce: function(repeatcount) {
if (typeof tinyMCE === 'undefined') {
@@ -142,11 +265,13 @@ M.mod_quiz.autosave = {
},
/**
* @param repeatcount Because TinyMCE might load slowly, after us, we need
* to keep trying every 10 seconds or so, until we detect TinyMCE is there,
* or enough time has passed.
* Initialise watching of a specific TinyMCE editor.
*
* @method init_tinymce_editor
* @param {EventFacade} e
* @param {Object} editor The TinyMCE editor object
*/
init_tinymce_editor: function(notused, editor) {
init_tinymce_editor: function(e, editor) {
Y.log('Found TinyMCE editor ' + editor.id + '.');
editor.onChange.add(this.editor_change_handler);
editor.onRedo.add(this.editor_change_handler);
@@ -15,18 +15,21 @@ YUI.add('moodle-question-preview', function (Y, NAME) {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/*
* @copyright 2014 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* JavaScript required by the question preview pop-up.
*
* @module moodle-question-preview
* @copyright 2014 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
M.question = M.question || {};
M.question.preview = M.question.preview || {};
/**
/*
* Initialise JavaScript-specific parts of the question preview popup.
*/
M.question.preview.init = function() {
@@ -15,18 +15,21 @@ YUI.add('moodle-question-preview', function (Y, NAME) {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/*
* @copyright 2014 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* JavaScript required by the question preview pop-up.
*
* @module moodle-question-preview
* @copyright 2014 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
M.question = M.question || {};
M.question.preview = M.question.preview || {};
/**
/*
* Initialise JavaScript-specific parts of the question preview popup.
*/
M.question.preview.init = function() {
+6 -3
View File
@@ -13,18 +13,21 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/*
* @copyright 2014 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* JavaScript required by the question preview pop-up.
*
* @module moodle-question-preview
* @copyright 2014 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
M.question = M.question || {};
M.question.preview = M.question.preview || {};
/**
/*
* Initialise JavaScript-specific parts of the question preview popup.
*/
M.question.preview.init = function() {