From a42791cb90a3d2fa5ab50ba9364f0107f5e9fde9 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 1 Nov 2013 15:45:00 +0800 Subject: [PATCH] MDL-41030 JavaScript: Convert remaining YUI2 IO calls to YUI3 --- group/clientlib.js | 16 ++++++++++------ mod/wiki/module.js | 30 ++++++++++++++++-------------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/group/clientlib.js b/group/clientlib.js index 83c2c542f6d..fef76b1edf8 100644 --- a/group/clientlib.js +++ b/group/clientlib.js @@ -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 +} diff --git a/mod/wiki/module.js b/mod/wiki/module.js index 52773d81e8b..cf59ef8cbf7 100644 --- a/mod/wiki/module.js +++ b/mod/wiki/module.js @@ -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; -- 2.17.1