MDL-21420 modole_cfg converted to M.cfg
authorPetr Skoda <skodak@moodle.org>
Thu, 21 Jan 2010 22:19:46 +0000 (22:19 +0000)
committerPetr Skoda <skodak@moodle.org>
Thu, 21 Jan 2010 22:19:46 +0000 (22:19 +0000)
16 files changed:
admin/report/spamcleaner/spamcleaner.js
blocks/global_navigation_tree/navigation.js
comment/admin.js
comment/comment.js
course/completion.js
enrol/authorize/authorize.js
lib/ajax/ajaxlib.php
lib/form/filemanager.js
lib/javascript-static.js
mod/chat/gui_ajax/script.js
mod/feedback/feedback.js
mod/forum/forum.js
mod/forum/rate_ajax.js
mod/scorm/player.js
repository/filepicker.js
user/selector/script.js

index 179d455..4237d13 100644 (file)
@@ -16,7 +16,7 @@ function init() {
     YAHOO.util.Event.addListener("removeall_btn", "click", function(){
         var yes = confirm(mstr.report_spamcleaner.spamdeleteallconfirm);
         if(yes){
-            var cObj = YAHOO.util.Connect.asyncRequest('POST', spamcleaner.me+'?delall=yes&sesskey='+moodle_cfg.sesskey, delall_cb);
+            var cObj = YAHOO.util.Connect.asyncRequest('POST', spamcleaner.me+'?delall=yes&sesskey='+M.cfg.sesskey, delall_cb);
         }
     });
 }
@@ -64,11 +64,11 @@ function del_user(obj, id) {
     var yes = confirm(mstr.report_spamcleaner.spamdeleteconfirm);
     if(yes){
         row = obj;
-        var cObj = YAHOO.util.Connect.asyncRequest('POST', spamcleaner.me+'?del=yes&sesskey='+moodle_cfg.sesskey+'&id='+id, del_cb);
+        var cObj = YAHOO.util.Connect.asyncRequest('POST', spamcleaner.me+'?del=yes&sesskey='+M.cfg.sesskey+'&id='+id, del_cb);
     }
 }
 function ignore_user(obj, id) {
     row = obj;
-    var cObj = YAHOO.util.Connect.asyncRequest('POST', spamcleaner.me+'?ignore=yes&sesskey='+moodle_cfg.sesskey+'&id='+id, ignore_cb);
+    var cObj = YAHOO.util.Connect.asyncRequest('POST', spamcleaner.me+'?ignore=yes&sesskey='+M.cfg.sesskey+'&id='+id, ignore_cb);
 }
 YAHOO.util.Event.onDOMReady(init);
\ No newline at end of file
index 0e6be1e..67e0dc7 100644 (file)
@@ -131,9 +131,9 @@ M.blocks.navigation.classes.tree.prototype.init_load_ajax = function(e, branch)
     if (this.instance != null) {
         cfginstance = '&instance='+this.instance
     }
-    Y.io(moodle_cfg.wwwroot+'/lib/ajax/getnavbranch.php', {
+    Y.io(M.cfg.wwwroot+'/lib/ajax/getnavbranch.php', {
         method:'POST',
-        data:'elementid='+branch.id+'&id='+branch.branchid+'&type='+branch.type+'&sesskey='+moodle_cfg.sesskey+cfginstance,
+        data:'elementid='+branch.id+'&id='+branch.branchid+'&type='+branch.type+'&sesskey='+M.cfg.sesskey+cfginstance,
         on: {
             complete:this.load_ajax,
             success:function() {Y.detach('click', this.init_load_ajax, e.target);}
index dc29ba9..4ff9c91 100644 (file)
@@ -20,7 +20,7 @@ function init() {
     }
 }
 function delete_comments() {
-    var url = moodle_cfg.wwwroot + '/comment/index.php';
+    var url = M.cfg.wwwroot + '/comment/index.php';
     var cb = {
         success:function(o) {
             if (o.responseText == 'yes') {
@@ -37,7 +37,7 @@ function delete_comments() {
     }
     var data = {
         'commentids': list,
-        'sesskey': moodle_cfg.sesskey
+        'sesskey': M.cfg.sesskey
     }
     var trans = YAHOO.util.Connect.asyncRequest('POST',
         url+'?action=delete', cb, build_querystring(data));
index 7d4feeb..dbde642 100644 (file)
@@ -12,7 +12,7 @@ function cmt_replace(client_id,list,newcmt) {
         var val = template.innerHTML;
         val = val.replace('___name___', list[i].username);
         if (list[i]['delete']||newcmt) {
-            list[i].content = '<div class="comment-delete"><a href="###" title="'+mstr.moodle.deletecomment+'" onclick="delete_comment(\''+client_id+'\',\''+list[i].id+'\')"><img src="'+moodle_cfg.wwwroot+'/pix/t/delete.gif" /></a></div>' + list[i].content;
+            list[i].content = '<div class="comment-delete"><a href="###" title="'+mstr.moodle.deletecomment+'" onclick="delete_comment(\''+client_id+'\',\''+list[i].id+'\')"><img src="'+M.cfg.wwwroot+'/pix/t/delete.gif" /></a></div>' + list[i].content;
         }
         val = val.replace('___time___', list[i].time);
         val = val.replace('___picture___', list[i].avatar);
@@ -26,10 +26,10 @@ function cmt_replace(client_id,list,newcmt) {
 }
 function cmt_load(cid) {
     var container = document.getElementById('comment-list-'+cid);
-    container.innerHTML = '<div style="text-align:center"><img src="'+moodle_cfg.wwwroot+'/pix/i/loading.gif'+'" /></div>';
+    container.innerHTML = '<div style="text-align:center"><img src="'+M.cfg.wwwroot+'/pix/i/loading.gif'+'" /></div>';
 }
 function get_comments(client_id, area, itemid, page) {
-    var url = moodle_cfg.wwwroot + '/comment/comment_ajax.php';
+    var url = M.cfg.wwwroot + '/comment/comment_ajax.php';
     var data = {
         'courseid': comment_params.courseid,
         'contextid': comment_params.contextid,
@@ -37,7 +37,7 @@ function get_comments(client_id, area, itemid, page) {
         'itemid': itemid,
         'page': page,
         'client_id': client_id,
-        'sesskey': moodle_cfg.sesskey
+        'sesskey': M.cfg.sesskey
     }
     this.cb = {
         success: function(o) {
@@ -93,7 +93,7 @@ function post_comment(cid) {
     }
     var ta = document.getElementById('dlg-content-'+cid);
     if (ta.value && ta.value != mstr.moodle.addcomment) {
-        var url = moodle_cfg.wwwroot + '/comment/comment_ajax.php';
+        var url = M.cfg.wwwroot + '/comment/comment_ajax.php';
         var formObject = document.getElementById('comment-form-'+cid);
         YAHOO.util.Connect.setForm(formObject);
         var trans = YAHOO.util.Connect.asyncRequest('POST', url+'?action=add', this.cb);
@@ -106,13 +106,13 @@ function post_comment(cid) {
     }
 }
 function delete_comment(client_id, comment_id) {
-    var url = moodle_cfg.wwwroot + '/comment/comment_ajax.php';
+    var url = M.cfg.wwwroot + '/comment/comment_ajax.php';
     var data = {
         'courseid': comment_params.courseid,
         'contextid': comment_params.contextid,
         'commentid': comment_id,
         'client_id': client_id,
-        'sesskey': moodle_cfg.sesskey
+        'sesskey': M.cfg.sesskey
     }
     this.cb = {
         success: function(o) {
@@ -146,11 +146,11 @@ function view_comments(client_id, area, itemid, page) {
         // show
         get_comments(client_id, area, itemid, page);
         container.style.display = 'block';
-        img.src=moodle_cfg.wwwroot+'/pix/t/expanded.png';
+        img.src=M.cfg.wwwroot+'/pix/t/expanded.png';
     } else {
         // hide
         container.style.display = 'none';
-        img.src=moodle_cfg.wwwroot+'/pix/t/collapsed.png';
+        img.src=M.cfg.wwwroot+'/pix/t/collapsed.png';
         ta.value = '';
     }
     toggle_textarea.apply(ta, [false]);
index 5e9f186..fe29ae2 100644 (file)
@@ -86,7 +86,7 @@ function completion_toggle(e) {
   YAHOO.util.Event.preventDefault(e);
   // By setting completion_wwwroot you can cause it to use absolute path
   // otherwise script assumes it is called from somewhere in /course
-  var target = moodle_cfg.wwwroot + '/course/togglecompletion.php';
+  var target = M.cfg.wwwroot + '/course/togglecompletion.php';
   YAHOO.util.Connect.asyncRequest('POST',target,
       {success:completion_handle_response,failure:completion_handle_failure,scope:this},
       'id='+this.cmid+'&completionstate='+this.otherState+'&fromajax=1');
index df0b03c..fe8139a 100644 (file)
@@ -1,5 +1,5 @@
 function authorize_jump_to_mypayments(e, args) {
-    var locationtogo = moodle_cfg.wwwroot + '/enrol/authorize/index.php?status=' + args.status;
+    var locationtogo = M.cfg.wwwroot + '/enrol/authorize/index.php?status=' + args.status;
     locationtogo += '&user=' + (this.checked ? args.userid : '0');
     top.location.href = locationtogo;
 }
index 27d30a8..9a3e5a3 100644 (file)
@@ -100,6 +100,8 @@ class page_requirements_manager {
     protected $yui3loader;
     /** YUI PHPLoader instance responsible for YUI3 loading from javascript */
     protected $M_yui_loader;
+    /** some config vars exposend in JS, please no secret stuff there */
+    protected $M_cfg;
 
     /**
      * Page requirements constructor.
@@ -215,7 +217,7 @@ class page_requirements_manager {
 
         //TODO: problem here is we may need this in some included JS - move this somehow to the very beginning
         //      right after the YUI loading
-        $config = array(
+        $this->M_cfg = array(
             'wwwroot'             => $CFG->httpswwwroot, // Yes, really. See above.
             'sesskey'             => sesskey(),
             'loadingicon'         => $renderer->pix_url('i/loading_small', 'moodle')->out(false),
@@ -223,9 +225,8 @@ class page_requirements_manager {
             'theme'               => $page->theme->name,
         );
         if (debugging('', DEBUG_DEVELOPER)) {
-            $config['developerdebug'] = true;
+            $this->M_cfg['developerdebug'] = true;
         }
-        $this->data_for_js('moodle_cfg', $config)->in_head();
 
         if (debugging('', DEBUG_DEVELOPER)) {
             $this->yui2_lib('logger');
@@ -785,7 +786,9 @@ class page_requirements_manager {
         // set up global YUI3 loader object - this should contain all code needed by plugins
         // note: in JavaScript just use "YUI(M.yui.loader).use('overlay', function(Y) { .... });"
         // this needs to be done before including any other script
-        $js = "var M = {}; M.yui = {}; " . js_writer::set_variable('M.yui.loader', $this->M_yui_loader, false);
+        $js = "var M = {}; M.yui = {}; ";
+        $js .= js_writer::set_variable('M.yui.loader', $this->M_yui_loader, false) . "\n";
+        $js .= js_writer::set_variable('M.cfg', $this->M_cfg, false);
         $output .= html_writer::script($js);
 
         // link our main JS file, all core stuff should be there
index 1821d49..328a883 100644 (file)
@@ -36,7 +36,7 @@ YAHOO.moodle.filemanager.mkdir_dialog  = null;
 // an object used to record filemanager instances' data,
 // we use it quite often
 var fm_cfg = {};
-fm_cfg.api = moodle_cfg.wwwroot + '/files/files_ajax.php';
+fm_cfg.api = M.cfg.wwwroot + '/files/files_ajax.php';
 
 // initialize file manager
 var filemanager = (function(){
@@ -151,7 +151,7 @@ function fm_create_folder(e, client_id, itemid) {
         var params = [];
         params['itemid'] = itemid;
         params['newdirname'] = foldername;
-        params['sesskey'] = moodle_cfg.sesskey;
+        params['sesskey'] = M.cfg.sesskey;
         params['filepath'] = fm_cfg[client_id].currentpath;
         var trans = YAHOO.util.Connect.asyncRequest('POST',
             fm_cfg.api+'?action=mkdir', mkdir_ajax_callback, build_querystring(params));
@@ -313,11 +313,11 @@ function html_compiler(client_id, options) {
 
         // add green tick to main file
         if (ismainfile) {
-            fullname = "<strong>"+list[i].fullname+"</strong> <img src='"+moodle_cfg.wwwroot+"/pix/i/tick_green_small.gif"+"' />";
+            fullname = "<strong>"+list[i].fullname+"</strong> <img src='"+M.cfg.wwwroot+"/pix/i/tick_green_small.gif"+"' />";
         }
 
         html = html.replace('___fullname___', '<a href="'+url+'" id="'+fileid+'"><img src="'+list[i].icon+'" /> ' + fullname + '</a>');
-        html = html.replace('___action___', '<a style="display:none" href="###" id="'+action+'"><img alt="▶" src="'+moodle_cfg.wwwroot+'/pix/i/settings.gif'+'" /></a>');
+        html = html.replace('___action___', '<a style="display:none" href="###" id="'+action+'"><img alt="▶" src="'+M.cfg.wwwroot+'/pix/i/settings.gif'+'" /></a>');
         html = '<li id="'+htmlid+'">'+html+'</li>';
         listhtml += html;
     }
@@ -341,7 +341,7 @@ function fm_refresh(path, args) {
     var params = [];
     params['itemid'] = args.itemid;
     params['filepath'] = path;
-    params['sesskey'] = moodle_cfg.sesskey;
+    params['sesskey'] = M.cfg.sesskey;
     this.cb = {
         success: function(o) {
             var data = json_decode(o.responseText);
@@ -379,7 +379,7 @@ function fm_mouseout_menu(ev, args) {
 function fm_click_breadcrumb(ev, args) {
     var params = [];
     params['itemid'] = args.itemid;
-    params['sesskey'] = moodle_cfg.sesskey;
+    params['sesskey'] = M.cfg.sesskey;
     params['filepath'] = args.requestpath;
     this.cb = {
         success: function(o) {
@@ -422,7 +422,7 @@ function fm_create_foldermenu(e, data) {
         params['itemid'] = obj.itemid;
         params['filepath']   = this.file.filepath;
         params['filename']   = '.';
-        params['sesskey'] = moodle_cfg.sesskey;
+        params['sesskey'] = M.cfg.sesskey;
         fm_loading('filemanager-'+obj.client_id, 'fm-prgressbar');
         var trans = YAHOO.util.Connect.asyncRequest('POST',
             fm_cfg.api+'?action=zip', this.cb, build_querystring(params));
@@ -459,7 +459,7 @@ function fm_create_zipmenu(e, data) {
         params['itemid'] = obj.itemid;
         params['filepath'] = this.file.filepath;
         params['filename'] = this.file.fullname;
-        params['sesskey'] = moodle_cfg.sesskey;
+        params['sesskey'] = M.cfg.sesskey;
         fm_loading('filemanager-'+obj.client_id, 'fm-prgressbar');
         var trans = YAHOO.util.Connect.asyncRequest('POST',
             fm_cfg.api+'?action=unzip', this.cb, build_querystring(params));
@@ -491,7 +491,7 @@ function fm_create_menu(ev, menuid, menuitems, file, options) {
                 params['filepath'] = fm_cfg[this.client_id].currentpath;
             }
             params['itemid'] = this.itemid;
-            params['sesskey'] = moodle_cfg.sesskey;
+            params['sesskey'] = M.cfg.sesskey;
             fm_loading('filemanager-'+this.client_id, 'fm-prgressbar');
             var trans = YAHOO.util.Connect.asyncRequest('POST',
                 fm_cfg.api+'?action=delete', this.cb, build_querystring(params));
@@ -559,7 +559,7 @@ function fm_create_menu(ev, menuid, menuitems, file, options) {
             }
             params['newfilename'] = newfilename;
 
-            params['sesskey'] = moodle_cfg.sesskey;
+            params['sesskey'] = M.cfg.sesskey;
             rename_cb.newfilename = newfilename;
             var trans = YAHOO.util.Connect.asyncRequest('POST',
                 fm_cfg.api+'?action='+action, rename_cb, build_querystring(params));
@@ -624,7 +624,7 @@ function fm_create_menu(ev, menuid, menuitems, file, options) {
             params['filepath'] = file.filepath;
             params['filename'] = file.fullname;
             params['itemid'] = obj.itemid;
-            params['sesskey'] = moodle_cfg.sesskey;
+            params['sesskey'] = M.cfg.sesskey;
             params['newfilepath'] = tree.targetpath;
             fm_loading('filemanager-'+obj.client_id, 'fm-prgressbar');
             var trans = YAHOO.util.Connect.asyncRequest('POST',
@@ -664,7 +664,7 @@ function fm_create_menu(ev, menuid, menuitems, file, options) {
             var params = {};
             params['itemid'] = node.data.itemid;
             params['filepath'] = node.data.path;
-            params['sesskey'] = moodle_cfg.sesskey;
+            params['sesskey'] = M.cfg.sesskey;
             var trans = YAHOO.util.Connect.asyncRequest('POST',
                 fm_cfg.api+'?action=dir', this.cb, build_querystring(params));
             this.cb.complete = onCompleteCallback;
@@ -800,7 +800,7 @@ function fm_setup_buttons(client_id, options) {
         downloaddir_callback.client_id = this.options.client_id;
         var params = [];
         params['itemid'] = this.options.itemid;
-        params['sesskey'] = moodle_cfg.sesskey;
+        params['sesskey'] = M.cfg.sesskey;
         params['filepath'] = this.options.currentpath;
         // perform downloaddir ajax request
         var trans = YAHOO.util.Connect.asyncRequest('POST',
@@ -824,7 +824,7 @@ function fm_loading(container, id) {
     }
 
     var loading = new YAHOO.widget.Module(id, {visible:false});
-    loading.setBody('<div style="text-align:center"><img alt="'+mstr.repository.loading+'" src="'+moodle_cfg.wwwroot+'/pix/i/progressbar.gif" /></div>');
+    loading.setBody('<div style="text-align:center"><img alt="'+mstr.repository.loading+'" src="'+M.cfg.wwwroot+'/pix/i/progressbar.gif" /></div>');
     loading.render();
     loading.show();
 
index 3aa46d4..6f605da 100644 (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') {
index 7885bab..18ac9e4 100644 (file)
@@ -1,5 +1,5 @@
 YAHOO.namespace('moodle.chat');
-YAHOO.moodle.chat.api = moodle_cfg.wwwroot+'/mod/chat/chat_ajax.php';
+YAHOO.moodle.chat.api = M.cfg.wwwroot+'/mod/chat/chat_ajax.php';
 YAHOO.moodle.chat.interval = null;
 YAHOO.moodle.chat.chat_input_element = null;
 YAHOO.moodle.chat.msgs = [];
index 40b348f..4dbb064 100644 (file)
@@ -6,7 +6,7 @@ function set_item_focus(itemid) {
 }
 
 function feedbackGo2delete(form) {
-    form.action = moodle_cfg.wwwroot+'/mod/feedback/delete_completed.php';
+    form.action = M.cfg.wwwroot+'/mod/feedback/delete_completed.php';
     form.submit();
 }
 
index 1eb1ac9..f441594 100644 (file)
@@ -5,7 +5,7 @@ function forum_produce_subscribe_link(forumid, backtoindex, ltext, ltitle) {
     var elementid = "subscriptionlink";
     var subs_link = document.getElementById(elementid);
     if(subs_link){
-        subs_link.innerHTML = "<a title="+ltitle+" href='"+moodle_cfg.wwwroot+"/mod/forum/subscribe.php?id="+forumid+backtoindex+"'>"+ltext+"<\/a>";
+        subs_link.innerHTML = "<a title="+ltitle+" href='"+M.cfg.wwwroot+"/mod/forum/subscribe.php?id="+forumid+backtoindex+"'>"+ltext+"<\/a>";
     }
 }
 
@@ -13,7 +13,7 @@ function forum_produce_tracking_link(forumid, ltext, ltitle) {
     var elementid = "trackinglink";
     var subs_link = document.getElementById(elementid);
     if(subs_link){
-        subs_link.innerHTML = "<a title="+ltitle+" href='"+moodle_cfg.wwwroot+"/mod/forum/settracking.php?id="+forumid+"'>"+ltext+"<\/a>";
+        subs_link.innerHTML = "<a title="+ltitle+" href='"+M.cfg.wwwroot+"/mod/forum/settracking.php?id="+forumid+"'>"+ltext+"<\/a>";
     }
 }
 
index 4581d31..f0c20d4 100644 (file)
@@ -74,7 +74,7 @@ function perform_rate(e, menu) {
     };
 
     /** Here goes the request **/
-    var url = moodle_cfg.wwwroot +  '/mod/forum/rate_ajax.php?postid=' + menu.name + '&rate=' + menu.value + '&sesskey=' + moodle_cfg.sesskey;
+    var url = M.cfg.wwwroot +  '/mod/forum/rate_ajax.php?postid=' + menu.name + '&rate=' + menu.value + '&sesskey=' + M.cfg.sesskey;
     YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
 
     /** Start animation **/
index 7efb130..85a2a33 100644 (file)
@@ -1,5 +1,5 @@
 function scorm_openpopup(url,name,options,width,height) {
-    fullurl = moodle_cfg.wwwroot + '/mod/scorm/' + url;
+    fullurl = M.cfg.wwwroot + '/mod/scorm/' + url;
     windowobj = window.open(fullurl,name,options);
     if ((width==100) && (height==100)) {
         // Fullscreen
index 399eabf..2314593 100644 (file)
@@ -60,7 +60,7 @@ YUI.add('filepicker', function(Y) {
         return obj;
     }
     Y.extend(filepicker, Y.Base, {
-        api: moodle_cfg.wwwroot+'/repository/repository_ajax.php',
+        api: M.cfg.wwwroot+'/repository/repository_ajax.php',
         initializer: function(args) {
             this.options = args;
         },
@@ -79,7 +79,7 @@ YUI.add('filepicker', function(Y) {
             params['env']=this.options.env;
             // the form element only accept certain file types
             params['accepted_types']=this.options.accepted_types;
-            params['sesskey']=moodle_cfg.sesskey;
+            params['sesskey']=M.cfg.sesskey;
             params['client_id'] = args.client_id;
             params['itemid'] = this.options.itemid?this.options.itemid:0;
             if (args['params']) {
index b4cf65a..0058ea0 100644 (file)
@@ -18,8 +18,8 @@ function user_selector(name, hash, extrafields, lastsearch, strprevselected, str
     this.strnomatchingusers = strnomatchingusers;
     this.strnone = strnone;
     this.iconloading = iconloading;
-    this.searchurl = moodle_cfg.wwwroot + '/user/selector/search.php?selectorid=' +
-            hash + '&sesskey=' + moodle_cfg.sesskey + '&search='
+    this.searchurl = M.cfg.wwwroot + '/user/selector/search.php?selectorid=' +
+            hash + '&sesskey=' + M.cfg.sesskey + '&search='
 
     // Set up the data source.
     this.datasource = new YAHOO.util.XHRDataSource(this.searchurl);
@@ -350,7 +350,7 @@ user_selector.prototype.handle_failure = function() {
     this.searchfield.className = 'error';
 
     // If we are in developer debug mode, output a link to help debug the failure.
-    if (moodle_cfg.developerdebug) {
+    if (M.cfg.developerdebug) {
         var link = document.createElement('a');
         link.href = this.searchurl + this.get_search_text() + '&debug=1';
         link.appendChild(document.createTextNode('Ajax call failed. Click here to try the search call directly.'))