From bb847f7bc0872002e38fe914c94211dc18ddc36f Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Wed, 3 Apr 2013 12:03:25 -0400 Subject: [PATCH] Small fixes for alt sub editor integration This commit applies some polish to the alt sub editor integration: - Prevent spinner from displaying continuously when adding a subscription - Hide the editor when changing subscriptions to limit confusion about what is loaded - Dynamically add a node to the tree view when adding a subscription - Make sure the 'View/Edit' tab gets populated when backing out of the stream or item view - Apply some default link styles Signed-off-by: Dan Wells Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/src/templates/serial/list_item.tt2 | 8 ++++++++ Open-ILS/src/templates/serial/list_stream.tt2 | 8 ++++++++ Open-ILS/src/templates/serial/subscription.tt2 | 13 +++++++++++-- Open-ILS/web/js/ui/default/serial/subscription.js | 6 ++++++ Open-ILS/xul/staff_client/server/serial/manage_subs.js | 7 ++++++- 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/templates/serial/list_item.tt2 b/Open-ILS/src/templates/serial/list_item.tt2 index 3b5fc30402..60569ceb4e 100644 --- a/Open-ILS/src/templates/serial/list_item.tt2 +++ b/Open-ILS/src/templates/serial/list_item.tt2 @@ -1,3 +1,4 @@ +[% USE CGI; -%] [% WRAPPER base.tt2 %] [% ctx.page_title = l("Items") %] [% BLOCK status_values %] @@ -18,6 +19,13 @@ font-weight: bold; } +[% IF CGI.param('context') == 'scv' -%] + + +[%- END %]
diff --git a/Open-ILS/src/templates/serial/list_stream.tt2 b/Open-ILS/src/templates/serial/list_stream.tt2 index 19186442ed..8b015aa460 100644 --- a/Open-ILS/src/templates/serial/list_stream.tt2 +++ b/Open-ILS/src/templates/serial/list_stream.tt2 @@ -1,3 +1,4 @@ +[% USE CGI; -%] [% WRAPPER base.tt2 %] [% ctx.page_title = l("Streams") %] +[% IF CGI.param('context') == 'scv' -%] + + +[%- END %]
diff --git a/Open-ILS/src/templates/serial/subscription.tt2 b/Open-ILS/src/templates/serial/subscription.tt2 index 5081f3294d..bc92be55c2 100644 --- a/Open-ILS/src/templates/serial/subscription.tt2 +++ b/Open-ILS/src/templates/serial/subscription.tt2 @@ -6,6 +6,8 @@ [%- END %] [%- IF CGI.param('id') != 'new' %] sub_id = [% CGI.param('id') %]; + [%- ELSE %] + sub_id = -1; [%- END %] var cap_editor; var cap_importer; @@ -19,6 +21,13 @@ +[% IF CGI.param('context') == 'scv' -%] + + +[%- END %]
[% l('Subscription Details') %]
@@ -121,11 +130,11 @@ "disabled": true, "value": sub_id }); - [%- IF CGI.param('context') == 'scv' -%] + [%- IF CGI.param('context') == 'scv' %] // attach the holding_lib selector to the record_entry selector dist_grid.overrideWidgetArgs.holding_lib = {'dijitArgs' : {'onChange' : function(value) { populate_sre_selector(dist_grid, value); } }}; - [%- END -%] + [%- END %] var _display_grouping_store = new dojo.data.ItemFileReadStore({ "data": { "identifier": "display_grouping", diff --git a/Open-ILS/web/js/ui/default/serial/subscription.js b/Open-ILS/web/js/ui/default/serial/subscription.js index 575b33d249..10c6345215 100644 --- a/Open-ILS/web/js/ui/default/serial/subscription.js +++ b/Open-ILS/web/js/ui/default/serial/subscription.js @@ -312,13 +312,19 @@ openils.Util.addOnLoad( ssub_grid.onPostCreate = function(fmObject) { sub_id = fmObject.id(); + parent.document.getElementById(window.name).refresh_command(fmObject); } ssub_grid.showCreateDialog(); } + ssub_grid.onPostUpdate = function(fmObject) { + parent.document.getElementById(window.name).refresh_command(); + } if (cgi.param("tab") in tab_dispatch) { + ssub_grid._fresh = false; // force View/Edit tab to reload (otherwise, it is blank) XXX why? tab_container.selectChild(tab_dispatch[cgi.param("tab")]); } + parent.document.getElementById(window.name).style.visibility = 'visible'; // unhide the editor pane (iframe) } } ); diff --git a/Open-ILS/xul/staff_client/server/serial/manage_subs.js b/Open-ILS/xul/staff_client/server/serial/manage_subs.js index 0f724ba0a7..a11fb820e3 100644 --- a/Open-ILS/xul/staff_client/server/serial/manage_subs.js +++ b/Open-ILS/xul/staff_client/server/serial/manage_subs.js @@ -58,10 +58,15 @@ serial.manage_subs.prototype = { iframe.setAttribute("src", src); } else if (type == "ssub") { var iframe = dojo.byId('alt_ssub_editor'); + iframe.setAttribute("src", "about:blank"); // clear in case reloading same page (XXX we might want to do this for add only) + iframe.style.visibility = "hidden"; // hide the editor while it loads (it will unhide itself when loaded) var src; if (mode == "add") { src = '/eg/serial/subscription?id=new&owning_lib='+params.owning_lib+'&record_entry='+params.record_entry+'&context=scv'; - iframe.refresh_command = function () {obj.refresh_list();}; + iframe.refresh_command = function (ssub) { + obj.map_ssub[ 'ssub_' + ssub.id() ] = ssub; + obj.append_ssub( obj.data.hash.aou[ssub.owning_lib()], ssub ); + }; } else { src = '/eg/serial/subscription?id=' + params.ssub_ids[0] + '&context=scv'; iframe.refresh_command = function () {}; //TODO: redraw tree node -- 2.11.0