369 } |
369 } |
370 |
370 |
371 /** |
371 /** |
372 * .. function:: loadRemote(url, form, reqtype='GET', sync=false) |
372 * .. function:: loadRemote(url, form, reqtype='GET', sync=false) |
373 * |
373 * |
374 * Asynchronously (unless `sync` argument is set to true) load an url or path |
374 * Asynchronously (unless `sync` argument is set to true) load a URL or path |
375 * and return a deferred whose callbacks args are decoded according to the |
375 * and return a deferred whose callbacks args are decoded according to the |
376 * Content-Type response header. `form` should be additional form params |
376 * Content-Type response header. `form` should be additional form params |
377 * dictionary, `reqtype` the HTTP request type (get 'GET' or 'POST'). |
377 * dictionary, `reqtype` the HTTP request type (get 'GET' or 'POST'). |
378 */ |
378 */ |
379 function loadRemote(url, form, reqtype, sync) { |
379 function loadRemote(url, form, reqtype, sync) { |
513 document.location.hash = '#header'; |
513 document.location.hash = '#header'; |
514 updateMessage(_("bookmark has been removed")); |
514 updateMessage(_("bookmark has been removed")); |
515 }); |
515 }); |
516 } |
516 } |
517 |
517 |
518 function userCallback(cbname) { |
518 userCallback = cw.utils.deprecatedFunction( |
|
519 '[3.19] use a plain ajaxfunc instead of user callbacks', |
|
520 function userCallback(cbname) { |
519 setProgressCursor(); |
521 setProgressCursor(); |
520 var d = loadRemote(AJAX_BASE_URL, ajaxFuncArgs('user_callback', null, cbname)); |
522 var d = loadRemote(AJAX_BASE_URL, ajaxFuncArgs('user_callback', null, cbname)); |
521 d.addCallback(resetCursor); |
523 d.addCallback(resetCursor); |
522 d.addErrback(resetCursor); |
524 d.addErrback(resetCursor); |
523 d.addErrback(remoteCallFailed); |
525 d.addErrback(remoteCallFailed); |
524 return d; |
526 return d; |
525 } |
527 }); |
526 |
528 |
527 function userCallbackThenUpdateUI(cbname, compid, rql, msg, registry, nodeid) { |
529 userCallbackThenUpdateUI = cw.utils.deprecatedFunction( |
|
530 '[3.19] use a plain ajaxfunc instead of user callbacks', |
|
531 function userCallbackThenUpdateUI(cbname, compid, rql, msg, registry, nodeid) { |
528 var d = userCallback(cbname); |
532 var d = userCallback(cbname); |
529 d.addCallback(function() { |
533 d.addCallback(function() { |
530 $('#' + nodeid).loadxhtml(AJAX_BASE_URL, ajaxFuncArgs('render', {'rql': rql}, |
534 $('#' + nodeid).loadxhtml(AJAX_BASE_URL, ajaxFuncArgs('render', {'rql': rql}, |
531 registry, compid)); |
535 registry, compid)); |
532 if (msg) { |
536 if (msg) { |
533 updateMessage(msg); |
537 updateMessage(msg); |
534 } |
538 } |
535 }); |
539 }); |
536 } |
540 }); |
537 |
541 |
538 function userCallbackThenReloadPage(cbname, msg) { |
542 userCallbackThenReloadPage = cw.utils.deprecatedFunction( |
|
543 '[3.19] use a plain ajaxfunc instead of user callbacks', |
|
544 function userCallbackThenReloadPage(cbname, msg) { |
539 var d = userCallback(cbname); |
545 var d = userCallback(cbname); |
540 d.addCallback(function() { |
546 d.addCallback(function() { |
541 window.location.reload(); |
547 window.location.reload(); |
542 if (msg) { |
548 if (msg) { |
543 updateMessage(msg); |
549 updateMessage(msg); |
544 } |
550 } |
545 }); |
551 }); |
546 } |
552 }); |
547 |
553 |
548 /** |
554 /** |
549 * .. function:: unregisterUserCallback(cbname) |
555 * .. function:: unregisterUserCallback(cbname) |
550 * |
556 * |
551 * unregisters the python function registered on the server's side |
557 * unregisters the python function registered on the server's side |
552 * while the page was generated. |
558 * while the page was generated. |
553 */ |
559 */ |
554 function unregisterUserCallback(cbname) { |
560 unregisterUserCallback = cw.utils.deprecatedFunction( |
|
561 '[3.19] use a plain ajaxfunc instead of user callbacks', |
|
562 function unregisterUserCallback(cbname) { |
555 setProgressCursor(); |
563 setProgressCursor(); |
556 var d = loadRemote(AJAX_BASE_URL, ajaxFuncArgs('unregister_user_callback', |
564 var d = loadRemote(AJAX_BASE_URL, ajaxFuncArgs('unregister_user_callback', |
557 null, cbname)); |
565 null, cbname)); |
558 d.addCallback(resetCursor); |
566 d.addCallback(resetCursor); |
559 d.addErrback(resetCursor); |
567 d.addErrback(resetCursor); |
560 d.addErrback(remoteCallFailed); |
568 d.addErrback(remoteCallFailed); |
561 } |
569 }); |
|
570 |
562 |
571 |
563 //============= XXX move those functions? ====================================// |
572 //============= XXX move those functions? ====================================// |
564 function openHash() { |
573 function openHash() { |
565 if (document.location.hash) { |
574 if (document.location.hash) { |
566 var nid = document.location.hash.replace('#', ''); |
575 var nid = document.location.hash.replace('#', ''); |