Preserve serial interface context, if present
authorDan Wells <dbw2@calvin.edu>
Wed, 13 Mar 2013 21:05:43 +0000 (17:05 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 13 Mar 2013 21:27:53 +0000 (17:27 -0400)
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 <dbw2@calvin.edu>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/web/js/ui/default/serial/list_item.js
Open-ILS/web/js/ui/default/serial/list_stream.js
Open-ILS/web/js/ui/default/serial/subscription.js

index c4c7654..21fcc59 100644 (file)
@@ -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 = '';
+        }
     }
 );
index 79bf05d..a989e96 100644 (file)
@@ -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 = '';
+        }
     }
 );
index c1dded3..575b33d 100644 (file)
@@ -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 "<a href='" +
         oilsBasePath + "/serial/list_item?issuance=" + blob.id +
-        "'>" + (blob.label ? blob.label : "[None]") + "</a>"; /* XXX i18n */
+        context_url_param + "'>" + (blob.label ? blob.label : "[None]") +
+        "</a>"; /* XXX i18n */
 }
 
 function format_sdist_label(blob) {
     if (!blob.id) return "";
     var link = "<a href='" +
         oilsBasePath + "/serial/list_stream?distribution=" + blob.id +
-        "'>" + (blob.label ? blob.label : "[None]") + "</a>"; /* XXX i18n */
+        context_url_param + "'>" + (blob.label ? blob.label : "[None]") +
+        "</a>"; /* 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")]);
+            }
         }
     }
 );