web/data/cubicweb.ajax.js
changeset 9785 8125ba3f4f6d
parent 9770 112c884b2d8d
child 9821 2077c8da1893
child 10028 326fbc5c92b0
equal deleted inserted replaced
9784:790956c311ef 9785:8125ba3f4f6d
     1 /* copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 /* copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2  * contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2  * contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3  *
     3  *
     4  * This file is part of CubicWeb.
     4  * This file is part of CubicWeb.
     5  *
     5  *
     6  * CubicWeb is free software: you can redistribute it and/or modify it under the
     6  * CubicWeb is free software: you can redistribute it and/or modify it under the
   515         document.location.hash = '#header';
   515         document.location.hash = '#header';
   516         updateMessage(_("bookmark has been removed"));
   516         updateMessage(_("bookmark has been removed"));
   517     });
   517     });
   518 }
   518 }
   519 
   519 
   520 function userCallback(cbname) {
   520 userCallback = cw.utils.deprecatedFunction(
       
   521     '[3.19] use a plain ajaxfunc instead of user callbacks',
       
   522     function userCallback(cbname) {
   521     setProgressCursor();
   523     setProgressCursor();
   522     var d = loadRemote(AJAX_BASE_URL, ajaxFuncArgs('user_callback', null, cbname));
   524     var d = loadRemote(AJAX_BASE_URL, ajaxFuncArgs('user_callback', null, cbname));
   523     d.addCallback(resetCursor);
   525     d.addCallback(resetCursor);
   524     d.addErrback(resetCursor);
   526     d.addErrback(resetCursor);
   525     d.addErrback(remoteCallFailed);
   527     d.addErrback(remoteCallFailed);
   526     return d;
   528     return d;
   527 }
   529 });
   528 
   530 
   529 function userCallbackThenUpdateUI(cbname, compid, rql, msg, registry, nodeid) {
   531 userCallbackThenUpdateUI = cw.utils.deprecatedFunction(
       
   532     '[3.19] use a plain ajaxfunc instead of user callbacks',
       
   533     function userCallbackThenUpdateUI(cbname, compid, rql, msg, registry, nodeid) {
   530     var d = userCallback(cbname);
   534     var d = userCallback(cbname);
   531     d.addCallback(function() {
   535     d.addCallback(function() {
   532         $('#' + nodeid).loadxhtml(AJAX_BASE_URL, ajaxFuncArgs('render', {'rql': rql},
   536         $('#' + nodeid).loadxhtml(AJAX_BASE_URL, ajaxFuncArgs('render', {'rql': rql},
   533                                                        registry, compid));
   537                                                        registry, compid));
   534         if (msg) {
   538         if (msg) {
   535             updateMessage(msg);
   539             updateMessage(msg);
   536         }
   540         }
   537     });
   541     });
   538 }
   542 });
   539 
   543 
   540 function userCallbackThenReloadPage(cbname, msg) {
   544 userCallbackThenReloadPage = cw.utils.deprecatedFunction(
       
   545     '[3.19] use a plain ajaxfunc instead of user callbacks',
       
   546     function userCallbackThenReloadPage(cbname, msg) {
   541     var d = userCallback(cbname);
   547     var d = userCallback(cbname);
   542     d.addCallback(function() {
   548     d.addCallback(function() {
   543         window.location.reload();
   549         window.location.reload();
   544         if (msg) {
   550         if (msg) {
   545             updateMessage(msg);
   551             updateMessage(msg);
   546         }
   552         }
   547     });
   553     });
   548 }
   554 });
   549 
   555 
   550 /**
   556 /**
   551  * .. function:: unregisterUserCallback(cbname)
   557  * .. function:: unregisterUserCallback(cbname)
   552  *
   558  *
   553  * unregisters the python function registered on the server's side
   559  * unregisters the python function registered on the server's side
   554  * while the page was generated.
   560  * while the page was generated.
   555  */
   561  */
   556 function unregisterUserCallback(cbname) {
   562 unregisterUserCallback = cw.utils.deprecatedFunction(
       
   563     '[3.19] use a plain ajaxfunc instead of user callbacks',
       
   564     function unregisterUserCallback(cbname) {
   557     setProgressCursor();
   565     setProgressCursor();
   558     var d = loadRemote(AJAX_BASE_URL, ajaxFuncArgs('unregister_user_callback',
   566     var d = loadRemote(AJAX_BASE_URL, ajaxFuncArgs('unregister_user_callback',
   559                                             null, cbname));
   567                                             null, cbname));
   560     d.addCallback(resetCursor);
   568     d.addCallback(resetCursor);
   561     d.addErrback(resetCursor);
   569     d.addErrback(resetCursor);
   562     d.addErrback(remoteCallFailed);
   570     d.addErrback(remoteCallFailed);
   563 }
   571 });
       
   572 
   564 
   573 
   565 //============= XXX move those functions? ====================================//
   574 //============= XXX move those functions? ====================================//
   566 function openHash() {
   575 function openHash() {
   567     if (document.location.hash) {
   576     if (document.location.hash) {
   568         var nid = document.location.hash.replace('#', '');
   577         var nid = document.location.hash.replace('#', '');