From: miker Date: Thu, 4 Mar 2010 20:20:30 +0000 (+0000) Subject: MORE: convert from permacrud to pcrud -- not as big as it looks -- and move some... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e439f2e4eebc87dff338354ef6ec6f6806004ba5;p=contrib%2FConifer.git MORE: convert from permacrud to pcrud -- not as big as it looks -- and move some startup logic to the top (even though yslow will hate me) git-svn-id: svn://svn.open-ils.org/ILS/trunk@15702 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/conify/global/actor/org_unit_type.html b/Open-ILS/web/conify/global/actor/org_unit_type.html index 0742bb7aaa..94452282b3 100644 --- a/Open-ILS/web/conify/global/actor/org_unit_type.html +++ b/Open-ILS/web/conify/global/actor/org_unit_type.html @@ -62,6 +62,46 @@ + + @@ -69,49 +109,6 @@
-
@@ -382,27 +370,17 @@ parent : ou_type_store.getValue( current_type, 'id' ) }); var err = false; - pCRUD.request({ - method : 'open-ils.permacrud.create.aout', - timeout : 10, - params : [ ses, new_fm_obj ], + pCRUD.create(new_fm_obj, { onerror : function (r) { highlighter.editor_pane.red.play(); status_update( aout_strings.ERROR_CALLING_METHOD_AOUT ); err = true; }, - oncomplete : function (r) { - var res = r.recv(); - if ( res && res.content() ) { - ou_type_store.newItem( - res.content().toHash(), - { parent : current_type, attribute : 'children' } - ); - } else { - highlighter.editor_pane.red.play(); - status_update( aout_strings.ERROR_CREATING_CHILD_AOUT ); - err = true; - } + oncomplete : function (r, list) { + ou_type_store.newItem( + list[0].toHash(), + { parent : current_type, attribute : 'children' } + ); }, }).send(); diff --git a/Open-ILS/web/conify/global/actor/org_unit_type.js b/Open-ILS/web/conify/global/actor/org_unit_type.js index cf4a97ffb5..f3fb76033a 100644 --- a/Open-ILS/web/conify/global/actor/org_unit_type.js +++ b/Open-ILS/web/conify/global/actor/org_unit_type.js @@ -18,6 +18,7 @@ dojo.require('fieldmapper.AutoIDL'); dojo.require('fieldmapper.dojoData'); dojo.require('openils.widget.TranslatorPopup'); +dojo.require('openils.PermaCrud'); dojo.require('dojo.parser'); dojo.require('dojo.data.ItemFileWriteStore'); dojo.require('dojo.date.stamp'); @@ -40,7 +41,7 @@ dojo.requireLocalization("openils.conify", "conify"); var cgi = new CGI(); var cookieManager = new HTTP.Cookies(); var ses = cookieManager.read('ses') || cgi.param('ses'); -var pCRUD = new OpenSRF.ClientSession('open-ils.permacrud'); +var pCRUD = new openils.PermaCrud({authtoken:ses}); var current_type; var current_fm_type; @@ -63,25 +64,16 @@ function save_type () { save_out_button.disabled = false; delete_out_button.disabled = false; - pCRUD.request({ - method : 'open-ils.permacrud.update.aout', - timeout : 10, - params : [ ses, modified_aout ], + pCRUD.update(modified_aout, { onerror : function (r) { highlighter.editor_pane.red.play(); status_update( dojo.string.substitute(aout_strings.ERROR_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) ); }, oncomplete : function (r) { - var res = r.recv(); - if ( res && res.content() ) { - ou_type_store.setValue( current_type, 'ischanged', 0 ); - highlighter.editor_pane.green.play(); - status_update( dojo.string.substitute(aout_strings.SUCCESS_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) ); - } else { - highlighter.editor_pane.red.play(); - status_update( dojo.string.substitute(aout_strings.ERROR_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) ); - } - }, - }).send(); + ou_type_store.setValue( current_type, 'ischanged', 0 ); + highlighter.editor_pane.green.play(); + status_update( dojo.string.substitute(aout_strings.SUCCESS_SAVING_DATA, [ou_type_store.getValue( current_type, 'name' )] ) ); + } + }); }