MDL-41030 JavaScript: Convert remaining YUI2 IO calls to YUI3
authorAndrew Nicols <andrew@nicols.co.uk>
Fri, 1 Nov 2013 07:45:00 +0000 (15:45 +0800)
committerDavid Monllao <davidm@moodle.com>
Fri, 6 Dec 2013 04:13:39 +0000 (12:13 +0800)
group/clientlib.js
mod/wiki/module.js

index 83c2c54..fef76b1 100644 (file)
@@ -91,7 +91,7 @@ function UpdatableMembersCombo(wwwRoot, courseId) {
     this.courseId = courseId;
 
     this.connectCallback = {
-        success: function(o) {
+        success: function(t, o) {
 
             if (o.responseText !== undefined) {
                 var selectEl = document.getElementById("members");
@@ -124,7 +124,7 @@ function UpdatableMembersCombo(wwwRoot, courseId) {
             removeLoaderImgs("membersloader", "memberslabel");
         },
 
-        failure: function(o) {
+        failure: function() {
             removeLoaderImgs("membersloader", "memberslabel");
         }
 
@@ -185,9 +185,13 @@ UpdatableMembersCombo.prototype.refreshMembers = function () {
 
     if(singleSelection) {
         var sUrl = this.wwwRoot+"/group/index.php?id="+this.courseId+"&group="+groupId+"&act_ajax_getmembersingroup";
-        var callback = this.connectCallback;
-        YUI().use('yui2-connection', function (Y) {
-            Y.YUI2.util.Connect.asyncRequest("GET", sUrl, callback, null);
+        var self = this;
+        YUI().use('io', function (Y) {
+            Y.io(sUrl, {
+                method: 'GET',
+                context: this,
+                on: self.connectCallback
+            });
         });
     }
 };
@@ -271,4 +275,4 @@ function init_add_remove_members_page(Y) {
 
     addselect = document.getElementById('addselect');
     addselect.onchange = updateUserSummary;
-}
\ No newline at end of file
+}
index 52773d8..cf59ef8 100644 (file)
@@ -38,21 +38,23 @@ M.mod_wiki.init = function(Y, args) {
     });
     new WikiHelper(args);
 };
-M.mod_wiki.renew_lock = function(Y, args) {
-    function renewLock() {
-        var args = {};
-        args['sesskey'] = M.cfg.sesskey;
-        args['pageid'] = wiki.pageid;
-        if (wiki.section) {
-            args['section'] = wiki.section;
-        }
-        var callback = {};
-        Y.use('yui2-connection', function(Y) {
-            Y.YUI2.util.Connect.asyncRequest('GET', 'lock.php?' + build_querystring(args), callback);
-        });
+M.mod_wiki.renew_lock = function() {
+    var args = {
+        sesskey: M.cfg.sesskey,
+        pageid: wiki.pageid
+    };
+    if (wiki.section) {
+        args.section = wiki.section;
     }
-    setInterval(renewLock, wiki.renew_lock_timeout * 1000);
-}
+    YUI().use('io', function(Y) {
+        function renewLock() {
+            Y.io('lock.php?' + build_querystring(args), {
+                method: 'POST'
+            });
+        }
+        setInterval(renewLock, wiki.renew_lock_timeout * 1000);
+    });
+};
 M.mod_wiki.history = function(Y, args) {
     var compare = false;
     var comparewith = false;