MDL-21420 modole_cfg converted to M.cfg

This commit is contained in:
Petr Skoda
2010-01-21 22:19:46 +00:00
parent 7b42e81a76
commit 9598d578bb
16 changed files with 63 additions and 59 deletions

View File

@@ -1,7 +1,8 @@
// Miscellaneous core Javascript functions for Moodle
// Global M object is initilised in inline javascript
// Global Y instance, inilialised much later in page footer
// Global Y instance, inilialised much later in page footer,
// it is usually better to initialise own Y by: "YUI(M.yui.loader).use('......', function(Y) { .... });
var Y = null;
/**
@@ -853,7 +854,7 @@ function openpopup(event, args) {
var fullurl = args.url;
if (!args.url.match(/https?:\/\//)) {
fullurl = moodle_cfg.wwwroot + args.url;
fullurl = M.cfg.wwwroot + args.url;
}
var windowobj = window.open(fullurl,args.name,args.options);
if (!windowobj) {
@@ -912,13 +913,13 @@ emoticons_help = {
function set_user_preference(name, value) {
// Don't generate a script error if the library has not been loaded,
// unless we are a Developer, in which case we want the error.
if (YAHOO && YAHOO.util && YAHOO.util.Connect || moodle_cfg.developerdebug) {
var url = moodle_cfg.wwwroot + '/lib/ajax/setuserpref.php?sesskey=' +
moodle_cfg.sesskey + '&pref=' + encodeURI(name) + '&value=' + encodeURI(value);
if (YAHOO && YAHOO.util && YAHOO.util.Connect || M.cfg.developerdebug) {
var url = M.cfg.wwwroot + '/lib/ajax/setuserpref.php?sesskey=' +
M.cfg.sesskey + '&pref=' + encodeURI(name) + '&value=' + encodeURI(value);
// If we are a developer, ensure that failures are reported.
var callback = {};
if (moodle_cfg.developerdebug) {
if (M.cfg.developerdebug) {
callback.failure = function() {
var a = document.createElement('a');
a.href = url;
@@ -1261,7 +1262,7 @@ function init_help_icons() {
// Fetch help page contents asynchronously
// Load spinner icon while content is loading
var spinner = document.createElement('img');
spinner.src = moodle_cfg.loadingicon;
spinner.src = M.cfg.loadingicon;
this.cfg.setProperty('text', spinner);
@@ -1279,7 +1280,7 @@ function init_help_icons() {
},
failure: function(o) {
var debuginfo = o.statusText;
if (moodle_cfg.developerdebug) {
if (M.cfg.developerdebug) {
o.statusText += ' (' + ajaxurl + ')';
}
thistooltip.cfg.setProperty('text', debuginfo);
@@ -1349,7 +1350,7 @@ function confirm_dialog(event, args) {
if (parentelement.tagName.toLowerCase() == 'form') {
parentelement.submit();
}
} else if(moodle_cfg.developerdebug) {
} else if(M.cfg.developerdebug) {
alert("Element of type " + target.tagName + " is not supported by the confirm_dialog function. Use A or INPUT");
}
};
@@ -1402,10 +1403,10 @@ function frame_breakout(e, properties) {
}
function get_image_url(imagename, component) {
var url = moodle_cfg.wwwroot + '/theme/image.php?theme=' + moodle_cfg.theme + '&image=' + imagename;
var url = M.cfg.wwwroot + '/theme/image.php?theme=' + M.cfg.theme + '&image=' + imagename;
if (moodle_cfg.themerev > 0) {
url = url + '&rev=' + moodle_cfg.themerev;
if (M.cfg.themerev > 0) {
url = url + '&rev=' + M.cfg.themerev;
}
if (component != '' && component != 'moodle' && component != 'core') {