diff -r dc319ece0bd6 -r cc3987eb793c web/data/cubicweb.ajax.js --- a/web/data/cubicweb.ajax.js Mon May 16 16:24:00 2011 +0200 +++ b/web/data/cubicweb.ajax.js Wed Jul 20 18:21:47 2011 +0200 @@ -1,4 +1,4 @@ -/* copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +/* copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. * contact http://www.logilab.fr/ -- mailto:contact@logilab.fr * * This file is part of CubicWeb. @@ -215,7 +215,7 @@ } /** - * .. function:: loadxhtml(url, form, reqtype='get', mode='replace', cursor=true) + * .. function:: loadxhtml(url, form, reqtype='get', mode='replace', cursor=false) * * build url given by absolute or relative `url` and `form` parameters * (dictionary), fetch it using `reqtype` method, then evaluate the @@ -231,7 +231,9 @@ */ jQuery.fn.loadxhtml = function(url, form, reqtype, mode, cursor) { if (this.size() > 1) { - cw.log('loadxhtml was called with more than one element'); + cw.log('loadxhtml called with more than one element'); + } else if (this.size() < 1) { + cw.log('loadxhtml called without an element'); } var callback = null; if (form && form.callback) { @@ -605,7 +607,7 @@ var ajaxArgs = ['render', formparams, registry, compid]; ajaxArgs = ajaxArgs.concat(cw.utils.sliceList(arguments, 4)); var params = ajaxFuncArgs.apply(null, ajaxArgs); - $('#'+domid).loadxhtml('json', params, null, 'swap'); + return $('#'+domid).loadxhtml('json', params, null, 'swap'); } /* ajax tabs ******************************************************************/ @@ -700,43 +702,37 @@ } ); -remoteExec = cw.utils.deprecatedFunction( - '[3.9] remoteExec() is deprecated, use loadRemote instead', - function(fname /* ... */) { - setProgressCursor(); - var props = { - fname: fname, - pageid: pageid, - arg: $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON) - }; - var result = jQuery.ajax({ - url: JSON_BASE_URL, - data: props, - async: false, - traditional: true - }).responseText; - if (result) { - result = cw.evalJSON(result); - } - resetCursor(); - return result; +function remoteExec(fname /* ... */) { + setProgressCursor(); + var props = { + fname: fname, + pageid: pageid, + arg: $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON) + }; + var result = jQuery.ajax({ + url: JSON_BASE_URL, + data: props, + async: false, + traditional: true + }).responseText; + if (result) { + result = cw.evalJSON(result); } -); + resetCursor(); + return result; +} -asyncRemoteExec = cw.utils.deprecatedFunction( - '[3.9] asyncRemoteExec() is deprecated, use loadRemote instead', - function(fname /* ... */) { - setProgressCursor(); - var props = { - fname: fname, - pageid: pageid, - arg: $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON) - }; - // XXX we should inline the content of loadRemote here - var deferred = loadRemote(JSON_BASE_URL, props, 'POST'); - deferred = deferred.addErrback(remoteCallFailed); - deferred = deferred.addErrback(resetCursor); - deferred = deferred.addCallback(resetCursor); - return deferred; - } -); +function asyncRemoteExec(fname /* ... */) { + setProgressCursor(); + var props = { + fname: fname, + pageid: pageid, + arg: $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON) + }; + // XXX we should inline the content of loadRemote here + var deferred = loadRemote(JSON_BASE_URL, props, 'POST'); + deferred = deferred.addErrback(remoteCallFailed); + deferred = deferred.addErrback(resetCursor); + deferred = deferred.addCallback(resetCursor); + return deferred; +}