From f5838ec4eb32121fc8dc3ebaafd342f63f8bbd22 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Fri, 9 Mar 2012 12:10:20 -0500 Subject: [PATCH] Alt Serial Control interfaces and Batch Receive reload OPAC when possible Really, since the Alt Serial Control interfaces are built on AutoGrid, all we have to do there is teach AutoGrid (and its constituent EditPane) to try for reload_opac on write operations. This may cause more reloads of the OPAC than are truly necessary, but mainly in cases when nobody's looking because the OPAC is hidden away in another tab. That's preferable to the alternative of littering the codebase with dozens of instances of try { xulG.reload_opac(); } catch (E) { } which would just be ugly, bad and unmaintainable. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/web/js/dojo/openils/widget/AutoGrid.js | 6 ++++++ Open-ILS/web/js/dojo/openils/widget/EditPane.js | 8 ++++++++ Open-ILS/web/js/ui/default/serial/subscription.js | 4 ++++ Open-ILS/xul/staff_client/chrome/content/cat/opac.js | 5 ++++- Open-ILS/xul/staff_client/server/serial/batch_receive.js | 5 +++++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index 9210b367b1..69df9a7494 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -346,6 +346,12 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { new openils.PermaCrud()['eliminate'](fmObject, {oncomplete : function(r) { self.store.deleteItem(item) }}); } ); + + try { + xulG.reload_opac(); + } catch (E) { + (dump ? dump : console.log)(E); + } }, _formatRowSelectInput : function(rowIdx) { diff --git a/Open-ILS/web/js/dojo/openils/widget/EditPane.js b/Open-ILS/web/js/dojo/openils/widget/EditPane.js index 1fd41adb75..7587251fba 100644 --- a/Open-ILS/web/js/dojo/openils/widget/EditPane.js +++ b/Open-ILS/web/js/dojo/openils/widget/EditPane.js @@ -253,6 +253,14 @@ if(!dojo._hasResource['openils.widget.EditPane']) { } else { (new openils.PermaCrud())[this.mode](this.fmObject, opts); } + + /* If we happen to have been spawned by something that + * puts an reload_opac() function into our context, call it. */ + try { + xulG.reload_opac(); + } catch(E) { + (dump ? dump : console.log)(E); + } } } ); diff --git a/Open-ILS/web/js/ui/default/serial/subscription.js b/Open-ILS/web/js/ui/default/serial/subscription.js index 24298363aa..d3e3d4b2ea 100644 --- a/Open-ILS/web/js/ui/default/serial/subscription.js +++ b/Open-ILS/web/js/ui/default/serial/subscription.js @@ -217,6 +217,10 @@ function _clone_subscription(bre_id) { location.href = oilsBasePath + "/serial/subscription?id=" + r; } + + /* cloning doesn't clone holdings, so nothing changes at + * OPAC view just because of this, so no need to try + * reload_opac(). */ } } ); diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js index d1e0d02767..d0657a92cb 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -355,7 +355,10 @@ function open_alt_serial_mgmt() { "authtime": ses("authtime"), "show_nav_buttons": true, "no_xulG": false, - "show_print_button": false + "show_print_button": false, + "passthru_content_params": { + "reload_opac": xulG.reload_opac + } }; ["url_prefix", "new_tab", "set_tab", "close_tab", "new_patron_tab", diff --git a/Open-ILS/xul/staff_client/server/serial/batch_receive.js b/Open-ILS/xul/staff_client/server/serial/batch_receive.js index 503a2ec770..433843cc8a 100644 --- a/Open-ILS/xul/staff_client/server/serial/batch_receive.js +++ b/Open-ILS/xul/staff_client/server/serial/batch_receive.js @@ -1063,6 +1063,11 @@ function BatchReceiver() { alert(E); } busy(false); + try { + xulG.reload_opac(); + } catch(E) { + (dump ? dump : console.log)(E); + } } } ); -- 2.11.0