MDL-43273 JavaScript: Migrate moodle-course-coursebase to use Shifter

This commit is contained in:
Andrew Nicols 2013-12-23 16:34:36 +08:00
parent edd9bb451c
commit 80c2d36007
7 changed files with 699 additions and 224 deletions

View File

@ -0,0 +1,230 @@
YUI.add('moodle-course-coursebase', function (Y, NAME) {
/**
* The coursebase class to provide shared functionality to Modules within
* Moodle.
*
* @module moodle-course-coursebase
*/
var COURSEBASENAME = 'course-coursebase';
var COURSEBASE = function() {
COURSEBASE.superclass.constructor.apply(this, arguments);
};
/**
* The coursebase class to provide shared functionality to Modules within
* Moodle.
*
* @class M.course.coursebase
* @constructor
*/
Y.extend(COURSEBASE, Y.Base, {
// Registered Modules
registermodules : [],
/**
* Register a new Javascript Module
*
* @method register_module
* @param {Object} The instantiated module to call functions on
* @chainable
*/
register_module : function(object) {
this.registermodules.push(object);
return this;
},
/**
* Invoke the specified function in all registered modules with the given arguments
*
* @method invoke_function
* @param {String} functionname The name of the function to call
* @param {mixed} args The argument supplied to the function
* @chainable
*/
invoke_function : function(functionname, args) {
var module;
for (module in this.registermodules) {
if (functionname in this.registermodules[module]) {
this.registermodules[module][functionname](args);
}
}
return this;
}
}, {
NAME : COURSEBASENAME,
ATTRS : {}
});
// Ensure that M.course exists and that coursebase is initialised correctly
M.course = M.course || {};
M.course.coursebase = M.course.coursebase || new COURSEBASE();
// Abstract functions that needs to be defined per format (course/format/somename/format.js)
M.course.format = M.course.format || {};
/**
* Swap section (should be defined in format.js if requred)
*
* @param {YUI} Y YUI3 instance
* @param {string} node1 node to swap to
* @param {string} node2 node to swap with
* @return {NodeList} section list
*/
M.course.format.swap_sections = M.course.format.swap_sections || function() {
return null;
};
/**
* Process sections after ajax response (should be defined in format.js)
* If some response is expected, we pass it over to format, as it knows better
* hot to process it.
*
* @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;
};
/**
* Get sections config for this format, for examples see function definition
* in the formats.
*
* @return {object} section list configuration
*/
M.course.format.get_config = M.course.format.get_config || function() {
return {
container_node : null, // compulsory
container_class : null, // compulsory
section_wrapper_node : null, // optional
section_wrapper_class : null, // optional
section_node : null, // compulsory
section_class : null // compulsory
};
};
/**
* Get section list for this format (usually items inside container_node.container_class selector)
*
* @param {YUI} Y YUI3 instance
* @return {string} section selector
*/
M.course.format.get_section_selector = M.course.format.get_section_selector || function() {
var config = M.course.format.get_config();
if (config.section_node && config.section_class) {
return config.section_node + '.' + config.section_class;
}
Y.log('section_node and section_class are not defined in M.course.format.get_config', 'warn', 'moodle-course-coursebase');
return null;
};
/**
* Get section wraper for this format (only used in case when each
* container_node.container_class node is wrapped in some other element).
*
* @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.
*/
M.course.format.get_section_wrapper = M.course.format.get_section_wrapper || function(Y) {
var config = M.course.format.get_config();
if (config.section_wrapper_node && config.section_wrapper_class) {
return config.section_wrapper_node + '.' + config.section_wrapper_class;
}
return M.course.format.get_section_selector(Y);
};
/**
* Get the tag of container node
*
* @return {string} tag of container node.
*/
M.course.format.get_containernode = M.course.format.get_containernode || function() {
var config = M.course.format.get_config();
if (config.container_node) {
return config.container_node;
} else {
Y.log('container_node is not defined in M.course.format.get_config', 'warn', 'moodle-course-coursebase');
}
};
/**
* Get the class of container node
*
* @return {string} class of the container node.
*/
M.course.format.get_containerclass = M.course.format.get_containerclass || function() {
var config = M.course.format.get_config();
if (config.container_class) {
return config.container_class;
} else {
Y.log('container_class is not defined in M.course.format.get_config', 'warn', 'moodle-course-coursebase');
}
};
/**
* Get the tag of draggable node (section wrapper if exists, otherwise section)
*
* @return {string} tag of the draggable node.
*/
M.course.format.get_sectionwrappernode = M.course.format.get_sectionwrappernode || function() {
var config = M.course.format.get_config();
if (config.section_wrapper_node) {
return config.section_wrapper_node;
} else {
return config.section_node;
}
};
/**
* Get the class of draggable node (section wrapper if exists, otherwise section)
*
* @return {string} class of the draggable node.
*/
M.course.format.get_sectionwrapperclass = M.course.format.get_sectionwrapperclass || function() {
var config = M.course.format.get_config();
if (config.section_wrapper_class) {
return config.section_wrapper_class;
} else {
return config.section_class;
}
};
/**
* Get the tag of section node
*
* @return {string} tag of section node.
*/
M.course.format.get_sectionnode = M.course.format.get_sectionnode || function() {
var config = M.course.format.get_config();
if (config.section_node) {
return config.section_node;
} else {
Y.log('section_node is not defined in M.course.format.get_config', 'warn', 'moodle-course-coursebase');
}
};
/**
* Get the class of section node
*
* @return {string} class of the section node.
*/
M.course.format.get_sectionclass = M.course.format.get_sectionclass || function() {
var config = M.course.format.get_config();
if (config.section_class) {
return config.section_class;
} else {
Y.log('section_class is not defined in M.course.format.get_config', 'warn', 'moodle-course-coursebase');
}
};
}, '@VERSION@', {"requires": ["base", "node"]});

View File

@ -0,0 +1 @@
YUI.add("moodle-course-coursebase",function(e,t){var n="course-coursebase",r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{registermodules:[],register_module:function(e){return this.registermodules.push(e),this},invoke_function:function(e,t){var n;for(n in this.registermodules)e in this.registermodules[n]&&this.registermodules[n][e](t);return this}},{NAME:n,ATTRS:{}}),M.course=M.course||{},M.course.coursebase=M.course.coursebase||new r,M.course.format=M.course.format||{},M.course.format.swap_sections=M.course.format.swap_sections||function(){return null},M.course.format.process_sections=M.course.format.process_sections||function(){return null},M.course.format.get_config=M.course.format.get_config||function(){return{container_node:null,container_class:null,section_wrapper_node:null,section_wrapper_class:null,section_node:null,section_class:null}},M.course.format.get_section_selector=M.course.format.get_section_selector||function(){var e=M.course.format.get_config();return e.section_node&&e.section_class?e.section_node+"."+e.section_class:null},M.course.format.get_section_wrapper=M.course.format.get_section_wrapper||function(e){var t=M.course.format.get_config();return t.section_wrapper_node&&t.section_wrapper_class?t.section_wrapper_node+"."+t.section_wrapper_class:M.course.format.get_section_selector(e)},M.course.format.get_containernode=M.course.format.get_containernode||function(){var e=M.course.format.get_config();if(e.container_node)return e.container_node},M.course.format.get_containerclass=M.course.format.get_containerclass||function(){var e=M.course.format.get_config();if(e.container_class)return e.container_class},M.course.format.get_sectionwrappernode=M.course.format.get_sectionwrappernode||function(){var e=M.course.format.get_config();return e.section_wrapper_node?e.section_wrapper_node:e.section_node},M.course.format.get_sectionwrapperclass=M.course.format.get_sectionwrapperclass||function(){var e=M.course.format.get_config();return e.section_wrapper_class?e.section_wrapper_class:e.section_class},M.course.format.get_sectionnode=M.course.format.get_sectionnode||function(){var e=M.course.format.get_config();if(e.section_node)return e.section_node},M.course.format.get_sectionclass=M.course.format.get_sectionclass||function(){var e=M.course.format.get_config();if(e.section_class)return e.section_class}},"@VERSION@",{requires:["base","node"]});

View File

@ -0,0 +1,225 @@
YUI.add('moodle-course-coursebase', function (Y, NAME) {
/**
* The coursebase class to provide shared functionality to Modules within
* Moodle.
*
* @module moodle-course-coursebase
*/
var COURSEBASENAME = 'course-coursebase';
var COURSEBASE = function() {
COURSEBASE.superclass.constructor.apply(this, arguments);
};
/**
* The coursebase class to provide shared functionality to Modules within
* Moodle.
*
* @class M.course.coursebase
* @constructor
*/
Y.extend(COURSEBASE, Y.Base, {
// Registered Modules
registermodules : [],
/**
* Register a new Javascript Module
*
* @method register_module
* @param {Object} The instantiated module to call functions on
* @chainable
*/
register_module : function(object) {
this.registermodules.push(object);
return this;
},
/**
* Invoke the specified function in all registered modules with the given arguments
*
* @method invoke_function
* @param {String} functionname The name of the function to call
* @param {mixed} args The argument supplied to the function
* @chainable
*/
invoke_function : function(functionname, args) {
var module;
for (module in this.registermodules) {
if (functionname in this.registermodules[module]) {
this.registermodules[module][functionname](args);
}
}
return this;
}
}, {
NAME : COURSEBASENAME,
ATTRS : {}
});
// Ensure that M.course exists and that coursebase is initialised correctly
M.course = M.course || {};
M.course.coursebase = M.course.coursebase || new COURSEBASE();
// Abstract functions that needs to be defined per format (course/format/somename/format.js)
M.course.format = M.course.format || {};
/**
* Swap section (should be defined in format.js if requred)
*
* @param {YUI} Y YUI3 instance
* @param {string} node1 node to swap to
* @param {string} node2 node to swap with
* @return {NodeList} section list
*/
M.course.format.swap_sections = M.course.format.swap_sections || function() {
return null;
};
/**
* Process sections after ajax response (should be defined in format.js)
* If some response is expected, we pass it over to format, as it knows better
* hot to process it.
*
* @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;
};
/**
* Get sections config for this format, for examples see function definition
* in the formats.
*
* @return {object} section list configuration
*/
M.course.format.get_config = M.course.format.get_config || function() {
return {
container_node : null, // compulsory
container_class : null, // compulsory
section_wrapper_node : null, // optional
section_wrapper_class : null, // optional
section_node : null, // compulsory
section_class : null // compulsory
};
};
/**
* Get section list for this format (usually items inside container_node.container_class selector)
*
* @param {YUI} Y YUI3 instance
* @return {string} section selector
*/
M.course.format.get_section_selector = M.course.format.get_section_selector || function() {
var config = M.course.format.get_config();
if (config.section_node && config.section_class) {
return config.section_node + '.' + config.section_class;
}
return null;
};
/**
* Get section wraper for this format (only used in case when each
* container_node.container_class node is wrapped in some other element).
*
* @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.
*/
M.course.format.get_section_wrapper = M.course.format.get_section_wrapper || function(Y) {
var config = M.course.format.get_config();
if (config.section_wrapper_node && config.section_wrapper_class) {
return config.section_wrapper_node + '.' + config.section_wrapper_class;
}
return M.course.format.get_section_selector(Y);
};
/**
* Get the tag of container node
*
* @return {string} tag of container node.
*/
M.course.format.get_containernode = M.course.format.get_containernode || function() {
var config = M.course.format.get_config();
if (config.container_node) {
return config.container_node;
} else {
}
};
/**
* Get the class of container node
*
* @return {string} class of the container node.
*/
M.course.format.get_containerclass = M.course.format.get_containerclass || function() {
var config = M.course.format.get_config();
if (config.container_class) {
return config.container_class;
} else {
}
};
/**
* Get the tag of draggable node (section wrapper if exists, otherwise section)
*
* @return {string} tag of the draggable node.
*/
M.course.format.get_sectionwrappernode = M.course.format.get_sectionwrappernode || function() {
var config = M.course.format.get_config();
if (config.section_wrapper_node) {
return config.section_wrapper_node;
} else {
return config.section_node;
}
};
/**
* Get the class of draggable node (section wrapper if exists, otherwise section)
*
* @return {string} class of the draggable node.
*/
M.course.format.get_sectionwrapperclass = M.course.format.get_sectionwrapperclass || function() {
var config = M.course.format.get_config();
if (config.section_wrapper_class) {
return config.section_wrapper_class;
} else {
return config.section_class;
}
};
/**
* Get the tag of section node
*
* @return {string} tag of section node.
*/
M.course.format.get_sectionnode = M.course.format.get_sectionnode || function() {
var config = M.course.format.get_config();
if (config.section_node) {
return config.section_node;
} else {
}
};
/**
* Get the class of section node
*
* @return {string} class of the section node.
*/
M.course.format.get_sectionclass = M.course.format.get_sectionclass || function() {
var config = M.course.format.get_config();
if (config.section_class) {
return config.section_class;
} else {
}
};
}, '@VERSION@', {"requires": ["base", "node"]});

View File

@ -1,224 +0,0 @@
YUI.add('moodle-course-coursebase', function(Y) {
/**
* The coursebase class
*/
var COURSEBASENAME = 'course-coursebase';
var COURSEBASE = function() {
COURSEBASE.superclass.constructor.apply(this, arguments);
}
Y.extend(COURSEBASE, Y.Base, {
// Registered Modules
registermodules : [],
/**
* Initialize the coursebase module
*/
initializer : function(config) {
// We don't actually perform any work here
},
/**
* Register a new Javascript Module
*
* @param object The instantiated module to call functions on
*/
register_module : function(object) {
this.registermodules.push(object);
},
/**
* Invoke the specified function in all registered modules with the given arguments
*
* @param functionname The name of the function to call
* @param args The argument supplied to the function
*/
invoke_function : function(functionname, args) {
for (module in this.registermodules) {
if (functionname in this.registermodules[module]) {
this.registermodules[module][functionname](args);
}
}
}
},
{
NAME : COURSEBASENAME,
ATTRS : {}
}
);
// Ensure that M.course exists and that coursebase is initialised correctly
M.course = M.course || {};
M.course.coursebase = M.course.coursebase || new COURSEBASE();
// Abstract functions that needs to be defined per format (course/format/somename/format.js)
M.course.format = M.course.format || {}
/**
* Swap section (should be defined in format.js if requred)
*
* @param {YUI} Y YUI3 instance
* @param {string} node1 node to swap to
* @param {string} node2 node to swap with
* @return {NodeList} section list
*/
M.course.format.swap_sections = M.course.format.swap_sections || function(Y, node1, node2) {
return null;
}
/**
* Process sections after ajax response (should be defined in format.js)
* If some response is expected, we pass it over to format, as it knows better
* hot to process it.
*
* @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(Y, sectionlist, response, sectionfrom, sectionto) {
return null;
}
/**
* Get sections config for this format, for examples see function definition
* in the formats.
*
* @return {object} section list configuration
*/
M.course.format.get_config = M.course.format.get_config || function() {
return {
container_node : null, // compulsory
container_class : null, // compulsory
section_wrapper_node : null, // optional
section_wrapper_class : null, // optional
section_node : null, // compulsory
section_class : null // compulsory
}
}
/**
* Get section list for this format (usually items inside container_node.container_class selector)
*
* @param {YUI} Y YUI3 instance
* @return {string} section selector
*/
M.course.format.get_section_selector = M.course.format.get_section_selector || function(Y) {
var config = M.course.format.get_config();
if (config.section_node && config.section_class) {
return config.section_node + '.' + config.section_class;
}
console.log('section_node and section_class are not defined in M.course.format.get_config');
return null;
}
/**
* Get section wraper for this format (only used in case when each
* container_node.container_class node is wrapped in some other element).
*
* @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.
*/
M.course.format.get_section_wrapper = M.course.format.get_section_wrapper || function(Y) {
var config = M.course.format.get_config();
if (config.section_wrapper_node && config.section_wrapper_class) {
return config.section_wrapper_node + '.' + config.section_wrapper_class;
}
return M.course.format.get_section_selector(Y);
}
/**
* Get the tag of container node
*
* @return {string} tag of container node.
*/
M.course.format.get_containernode = M.course.format.get_containernode || function() {
var config = M.course.format.get_config();
if (config.container_node) {
return config.container_node;
} else {
console.log('container_node is not defined in M.course.format.get_config');
}
}
/**
* Get the class of container node
*
* @return {string} class of the container node.
*/
M.course.format.get_containerclass = M.course.format.get_containerclass || function() {
var config = M.course.format.get_config();
if (config.container_class) {
return config.container_class;
} else {
console.log('container_class is not defined in M.course.format.get_config');
}
}
/**
* Get the tag of draggable node (section wrapper if exists, otherwise section)
*
* @return {string} tag of the draggable node.
*/
M.course.format.get_sectionwrappernode = M.course.format.get_sectionwrappernode || function() {
var config = M.course.format.get_config();
if (config.section_wrapper_node) {
return config.section_wrapper_node;
} else {
return config.section_node;
}
}
/**
* Get the class of draggable node (section wrapper if exists, otherwise section)
*
* @return {string} class of the draggable node.
*/
M.course.format.get_sectionwrapperclass = M.course.format.get_sectionwrapperclass || function() {
var config = M.course.format.get_config();
if (config.section_wrapper_class) {
return config.section_wrapper_class;
} else {
return config.section_class;
}
}
/**
* Get the tag of section node
*
* @return {string} tag of section node.
*/
M.course.format.get_sectionnode = M.course.format.get_sectionnode || function() {
var config = M.course.format.get_config();
if (config.section_node) {
return config.section_node;
} else {
console.log('section_node is not defined in M.course.format.get_config');
}
}
/**
* Get the class of section node
*
* @return {string} class of the section node.
*/
M.course.format.get_sectionclass = M.course.format.get_sectionclass || function() {
var config = M.course.format.get_config();
if (config.section_class) {
return config.section_class;
} else {
console.log('section_class is not defined in M.course.format.get_config');
}
}
},
'@VERSION@', {
requires : ['base', 'node']
}
);

View File

@ -0,0 +1,10 @@
{
"name": "moodle-course-coursebase",
"builds": {
"moodle-course-coursebase": {
"jsfiles": [
"coursebase.js"
]
}
}
}

View File

@ -0,0 +1,225 @@
/**
* The coursebase class to provide shared functionality to Modules within
* Moodle.
*
* @module moodle-course-coursebase
*/
var COURSEBASENAME = 'course-coursebase';
var COURSEBASE = function() {
COURSEBASE.superclass.constructor.apply(this, arguments);
};
/**
* The coursebase class to provide shared functionality to Modules within
* Moodle.
*
* @class M.course.coursebase
* @constructor
*/
Y.extend(COURSEBASE, Y.Base, {
// Registered Modules
registermodules : [],
/**
* Register a new Javascript Module
*
* @method register_module
* @param {Object} The instantiated module to call functions on
* @chainable
*/
register_module : function(object) {
this.registermodules.push(object);
return this;
},
/**
* Invoke the specified function in all registered modules with the given arguments
*
* @method invoke_function
* @param {String} functionname The name of the function to call
* @param {mixed} args The argument supplied to the function
* @chainable
*/
invoke_function : function(functionname, args) {
var module;
for (module in this.registermodules) {
if (functionname in this.registermodules[module]) {
this.registermodules[module][functionname](args);
}
}
return this;
}
}, {
NAME : COURSEBASENAME,
ATTRS : {}
});
// Ensure that M.course exists and that coursebase is initialised correctly
M.course = M.course || {};
M.course.coursebase = M.course.coursebase || new COURSEBASE();
// Abstract functions that needs to be defined per format (course/format/somename/format.js)
M.course.format = M.course.format || {};
/**
* Swap section (should be defined in format.js if requred)
*
* @param {YUI} Y YUI3 instance
* @param {string} node1 node to swap to
* @param {string} node2 node to swap with
* @return {NodeList} section list
*/
M.course.format.swap_sections = M.course.format.swap_sections || function() {
return null;
};
/**
* Process sections after ajax response (should be defined in format.js)
* If some response is expected, we pass it over to format, as it knows better
* hot to process it.
*
* @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;
};
/**
* Get sections config for this format, for examples see function definition
* in the formats.
*
* @return {object} section list configuration
*/
M.course.format.get_config = M.course.format.get_config || function() {
return {
container_node : null, // compulsory
container_class : null, // compulsory
section_wrapper_node : null, // optional
section_wrapper_class : null, // optional
section_node : null, // compulsory
section_class : null // compulsory
};
};
/**
* Get section list for this format (usually items inside container_node.container_class selector)
*
* @param {YUI} Y YUI3 instance
* @return {string} section selector
*/
M.course.format.get_section_selector = M.course.format.get_section_selector || function() {
var config = M.course.format.get_config();
if (config.section_node && config.section_class) {
return config.section_node + '.' + config.section_class;
}
Y.log('section_node and section_class are not defined in M.course.format.get_config', 'warn', 'moodle-course-coursebase');
return null;
};
/**
* Get section wraper for this format (only used in case when each
* container_node.container_class node is wrapped in some other element).
*
* @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.
*/
M.course.format.get_section_wrapper = M.course.format.get_section_wrapper || function(Y) {
var config = M.course.format.get_config();
if (config.section_wrapper_node && config.section_wrapper_class) {
return config.section_wrapper_node + '.' + config.section_wrapper_class;
}
return M.course.format.get_section_selector(Y);
};
/**
* Get the tag of container node
*
* @return {string} tag of container node.
*/
M.course.format.get_containernode = M.course.format.get_containernode || function() {
var config = M.course.format.get_config();
if (config.container_node) {
return config.container_node;
} else {
Y.log('container_node is not defined in M.course.format.get_config', 'warn', 'moodle-course-coursebase');
}
};
/**
* Get the class of container node
*
* @return {string} class of the container node.
*/
M.course.format.get_containerclass = M.course.format.get_containerclass || function() {
var config = M.course.format.get_config();
if (config.container_class) {
return config.container_class;
} else {
Y.log('container_class is not defined in M.course.format.get_config', 'warn', 'moodle-course-coursebase');
}
};
/**
* Get the tag of draggable node (section wrapper if exists, otherwise section)
*
* @return {string} tag of the draggable node.
*/
M.course.format.get_sectionwrappernode = M.course.format.get_sectionwrappernode || function() {
var config = M.course.format.get_config();
if (config.section_wrapper_node) {
return config.section_wrapper_node;
} else {
return config.section_node;
}
};
/**
* Get the class of draggable node (section wrapper if exists, otherwise section)
*
* @return {string} class of the draggable node.
*/
M.course.format.get_sectionwrapperclass = M.course.format.get_sectionwrapperclass || function() {
var config = M.course.format.get_config();
if (config.section_wrapper_class) {
return config.section_wrapper_class;
} else {
return config.section_class;
}
};
/**
* Get the tag of section node
*
* @return {string} tag of section node.
*/
M.course.format.get_sectionnode = M.course.format.get_sectionnode || function() {
var config = M.course.format.get_config();
if (config.section_node) {
return config.section_node;
} else {
Y.log('section_node is not defined in M.course.format.get_config', 'warn', 'moodle-course-coursebase');
}
};
/**
* Get the class of section node
*
* @return {string} class of the section node.
*/
M.course.format.get_sectionclass = M.course.format.get_sectionclass || function() {
var config = M.course.format.get_config();
if (config.section_class) {
return config.section_class;
} else {
Y.log('section_class is not defined in M.course.format.get_config', 'warn', 'moodle-course-coursebase');
}
};

View File

@ -0,0 +1,8 @@
{
"moodle-course-coursebase": {
"requires": [
"base",
"node"
]
}
}