From 408a4e4106b62c328c3b558d536810bd0c9b12f8 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Wed, 13 Mar 2013 17:05:43 -0400 Subject: [PATCH] Preserve serial interface context, if present If the new 'context' URL parameter is present, we need to make sure it sticks around for a couple of the "deeper" views (streams and items). Also, preserve the tab when coming out of said views in 'scv' context. Signed-off-by: Dan Wells Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/web/js/ui/default/serial/list_item.js | 11 ++++++++++- Open-ILS/web/js/ui/default/serial/list_stream.js | 11 ++++++++++- .../web/js/ui/default/serial/subscription.js | 16 ++++++++++++++-- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/ui/default/serial/list_item.js b/Open-ILS/web/js/ui/default/serial/list_item.js index c4c7654616..21fcc5948f 100644 --- a/Open-ILS/web/js/ui/default/serial/list_item.js +++ b/Open-ILS/web/js/ui/default/serial/list_item.js @@ -11,6 +11,7 @@ dojo.require("openils.CGI"); var pcrud, cgi, issuance_id; var sitem_cache = {}; +var context_url_param; function load_sitem_grid() { sitem_grid.overrideEditWidgets.status = status_selector; @@ -29,7 +30,8 @@ function load_siss_display() { link.onclick = function() { location.href = oilsBasePath + "/serial/subscription?id=" + - r.subscription() + "&tab=issuances"; + r.subscription() + "&tab=issuances" + + context_url_param; } link.innerHTML = r.label(); prepare_create_dialog(r.subscription()); @@ -167,5 +169,12 @@ openils.Util.addOnLoad( issuance_id = cgi.param("issuance"); load_siss_display(); load_sitem_grid(); + + var context = cgi.param('context'); + if (context) { + context_url_param = '&context=' + context; + } else { + context_url_param = ''; + } } ); diff --git a/Open-ILS/web/js/ui/default/serial/list_stream.js b/Open-ILS/web/js/ui/default/serial/list_stream.js index 79bf05d259..a989e96c8b 100644 --- a/Open-ILS/web/js/ui/default/serial/list_stream.js +++ b/Open-ILS/web/js/ui/default/serial/list_stream.js @@ -12,6 +12,7 @@ var pcrud; var dist_id; var rlu_editor; var cgi; +var context_url_param; function format_routing_label(routing_label) { return routing_label ? routing_label : "[None]"; @@ -37,7 +38,8 @@ function load_sdist_display() { link.onclick = function() { location.href = oilsBasePath + "/serial/subscription?id=" + - r.subscription() + "&tab=distributions"; + r.subscription() + "&tab=distributions" + + context_url_param; } link.innerHTML = r.label(); load_sdist_org_unit_display(r); @@ -296,5 +298,12 @@ openils.Util.addOnLoad( dist_id = cgi.param("distribution"); load_sdist_display(); load_sstr_grid(); + + var context = cgi.param('context'); + if (context) { + context_url_param = '&context=' + context; + } else { + context_url_param = ''; + } } ); diff --git a/Open-ILS/web/js/ui/default/serial/subscription.js b/Open-ILS/web/js/ui/default/serial/subscription.js index c1dded3431..575b33d249 100644 --- a/Open-ILS/web/js/ui/default/serial/subscription.js +++ b/Open-ILS/web/js/ui/default/serial/subscription.js @@ -18,6 +18,7 @@ var pcrud; var cgi; var sub; var sub_id; +var context_url_param; function node_by_name(name, ctx) { return dojo.query("[name='" + name + "']", ctx)[0]; @@ -118,14 +119,16 @@ function format_siss_label(blob) { if (!blob.id) return ""; return "" + (blob.label ? blob.label : "[None]") + ""; /* XXX i18n */ + context_url_param + "'>" + (blob.label ? blob.label : "[None]") + + ""; /* XXX i18n */ } function format_sdist_label(blob) { if (!blob.id) return ""; var link = "" + (blob.label ? blob.label : "[None]") + ""; /* XXX i18n */ + context_url_param + "'>" + (blob.label ? blob.label : "[None]") + + ""; /* XXX i18n */ var sstr_list = pcrud.search( "sstr",{"distribution":blob.id},{"id_list":true} @@ -268,6 +271,12 @@ openils.Util.addOnLoad( owning_lib = cgi.param("owning_lib"); record_entry = cgi.param("record_entry"); + if (context) { + context_url_param = '&context=' + context; + } else { + context_url_param = ''; + } + if (context != 'scv') { load_sub_grid( sub_id, @@ -307,6 +316,9 @@ openils.Util.addOnLoad( ssub_grid.showCreateDialog(); } + if (cgi.param("tab") in tab_dispatch) { + tab_container.selectChild(tab_dispatch[cgi.param("tab")]); + } } } ); -- 2.43.2