Alt serials interface tweak
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 20 Oct 2010 15:59:55 +0000 (15:59 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 20 Oct 2010 15:59:55 +0000 (15:59 +0000)
Add a shortcut for the user to jump back from the streams interface to the
distributions tab of the subscription details interface

git-svn-id: svn://svn.open-ils.org/ILS/trunk@18407 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/serial/list_stream.js
Open-ILS/web/js/ui/default/serial/list_subscription.js
Open-ILS/web/js/ui/default/serial/subscription.js
Open-ILS/web/templates/default/serial/list_stream.tt2
Open-ILS/web/templates/default/serial/list_subscription.tt2
Open-ILS/web/templates/default/serial/subscription.tt2
Open-ILS/xul/staff_client/chrome/content/cat/opac.js

index e61127a..befc46e 100644 (file)
@@ -4,8 +4,11 @@ dojo.require("dijit.form.TextBox");
 dojo.require("openils.widget.AutoGrid");
 dojo.require("openils.widget.ProgressDialog");
 dojo.require("openils.PermaCrud");
+dojo.require("openils.CGI");
 
 var pcrud;
+var dist_id;
+var cgi;
 
 function format_routing_label(routing_label) {
     return routing_label ? routing_label : "[None]";
@@ -27,7 +30,13 @@ function load_sdist_display() {
         "sdist", dist_id, {
             "onresponse": function(r) {
                 if (r = openils.Util.readResponse(r)) {
-                    dojo.byId("sdist_label_here").innerHTML = r.label();
+                    var link = dojo.byId("sdist_label_here");
+                    link.onclick = function() {
+                        location.href = oilsBasePath +
+                            "/eg/serial/subscription?id=" +
+                            r.subscription() + "&tab=distributions";
+                    }
+                    link.innerHTML = r.label();
                     load_sdist_org_unit_display(r);
                 }
             }
@@ -65,7 +74,10 @@ function create_many_streams(fields) {
 
 openils.Util.addOnLoad(
     function() {
+        cgi = new openils.CGI();
         pcrud = new openils.PermaCrud();
+
+        dist_id = cgi.param("distribution");
         load_sdist_display();
         load_sstr_grid();
     }
index 206b730..0f166fe 100644 (file)
@@ -2,9 +2,13 @@ dojo.require("dijit.form.Button");
 dojo.require("openils.widget.AutoGrid");
 dojo.require("openils.widget.OrgUnitFilteringSelect");
 dojo.require("openils.BibTemplate");
+dojo.require("openils.CGI");
+
+var terms;
+var cgi;
 
 function format_ssub_link(id) {
-    return "<a href='" + oilsBasePath + "/serial/subscription/" +
+    return "<a href='" + oilsBasePath + "/serial/subscription?id=" +
         id + "'>" + id + "</a>";
 }
 
@@ -15,6 +19,16 @@ function load_ssub_grid() {
 
 openils.Util.addOnLoad(
     function() {
+        cgi = new openils.CGI();
+
+        terms = {
+            "owning_lib": aou.orgNodeTrail(
+                aou.findOrgUnit(openils.User.user.ws_ou()),
+                true /* asId */
+            ),
+            "record_entry": cgi.param("record_entry") || _fallback_record_entry
+        };
+
         if (terms.record_entry)
             new openils.BibTemplate({"record": terms.record_entry}).render();
 
index 9c23942..9ac890d 100644 (file)
@@ -10,9 +10,12 @@ dojo.require("openils.widget.AutoGrid");
 dojo.require("openils.widget.ProgressDialog");
 dojo.require("openils.widget.HoldingCode");
 dojo.require("openils.PermaCrud");
+dojo.require("openils.CGI");
 
 var pcrud;
+var cgi;
 var sub;
+var sub_id;
 
 /* typing save: add {get,set}Value() to all HTML <select> elements */
 HTMLSelectElement.prototype.getValue = function() {
@@ -27,7 +30,7 @@ HTMLSelectElement.prototype.setValue = function(s) {
     }
 }
 
-function load_sub_grid(id) {
+function load_sub_grid(id, oncomplete) {
     if (!pcrud) return; /* first run, onLoad hasn't fired yet */
     if (!sub_grid._fresh) {
         pcrud.retrieve(
@@ -42,6 +45,9 @@ function load_sub_grid(id) {
                         );
                         sub_grid._fresh = true;
                     }
+                },
+                "oncomplete": function() {
+                    if (oncomplete) oncomplete();
                 }
             }
         );
@@ -77,8 +83,9 @@ function format_bib(bib_id) {
                 }
             }
         );
-        return "<a href='" + oilsBasePath + "/serial/list_subscription/" +
-            bib_id + "'>" + result + "</a>";
+        return "<a href='" + oilsBasePath +
+            "/serial/list_subscription?record_entry=" + bib_id + "'>" +
+            result + "</a>";
     }
 }
 
@@ -101,7 +108,7 @@ function get_sdist(rowIndex, item) {
 function format_sdist_label(blob) {
     if (!blob.id) return "";
     var link = "<a href='" +
-        oilsBasePath + "/serial/list_stream/" + blob.id +
+        oilsBasePath + "/serial/list_stream?distribution=" + blob.id +
         "'>" + (blob.label ? blob.label : "[None]") + "</a>" + /* XXX i18n */
         "<span id='dist_link_" + blob.id + "'></span>";
 
@@ -147,7 +154,15 @@ function open_batch_receive() {
 
 openils.Util.addOnLoad(
     function() {
+        cgi = new openils.CGI();
         pcrud = new openils.PermaCrud();
-        load_sub_grid(sub_id);
+
+        sub_id = cgi.param("id");
+        load_sub_grid(
+            sub_id,
+            (cgi.param("tab") == "distributions") ?
+                function() { tab_container.selectChild(distributions_tab); } :
+                null
+        );
     }
 );
index ea3f659..7cda19d 100644 (file)
@@ -4,9 +4,6 @@
     type="text/javascript"
     src="[% ctx.media_prefix %]/js/ui/default/serial/list_stream.js">
 </script>
-<script type="text/javascript">
-    var dist_id = "[% ctx.page_args.0 %]";
-</script>
 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
     <div dojoType="dijit.layout.ContentPane"
         layoutAlign="top" class="oils-header-panel">
@@ -26,7 +23,7 @@
     </div>
     <div>
         Showing streams attached to the distribution,
-        <em id="sdist_label_here"></em>
+        <em><a href="javascript:void(0);" id="sdist_label_here"></a></em>
         (<span id="sdist_org_unit_name_here"></span>).
     </div>
     <table jsId="sstr_grid"
index 7881779..f7c2dfc 100644 (file)
@@ -5,15 +5,7 @@
     src="[% ctx.media_prefix %]/js/ui/default/serial/list_subscription.js">
 </script>
 <script type="text/javascript">
-    var terms = {
-        "owning_lib": aou.orgNodeTrail(
-            aou.findOrgUnit(openils.User.user.ws_ou()),
-            true /* asId */
-        )
-    };
-
-    if (docid = "[% ctx.page_args.0 %]") /* assignment intentional */
-        terms.record_entry = docid;
+    var _fallback_record_entry = "[% ctx.page_args.0 %]";
 </script>
 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
     <div dojoType="dijit.layout.ContentPane"
index 24970ad..a8dc19c 100644 (file)
@@ -1,7 +1,6 @@
 [% WRAPPER "default/base.tt2" %]
 <script>
     var cap_editor;
-    var sub_id = "[% ctx.page_args.0 %]";
 </script>
 <script src="[% ctx.media_prefix %]/js/ui/default/serial/subscription.js">
 </script>
@@ -19,7 +18,8 @@
     </div>
 </div>
 
-<div dojoType="dijit.layout.TabContainer" class="oils-serial-tab-container">
+<div dojoType="dijit.layout.TabContainer" jsId="tab_container"
+    class="oils-serial-tab-container">
 
     <!-- Subscription Summary -->
     <div dojoType="dijit.layout.ContentPane" title="Summary" selected="true">
@@ -51,7 +51,7 @@
     </div>
 
     <!-- Distributions -->
-    <div dojoType="dijit.layout.ContentPane"
+    <div dojoType="dijit.layout.ContentPane" jsId="distributions_tab"
         title="Distributions" layoutAlign="client">
         <script type="dojo/connect" event="onShow">
             if (!dist_grid._fresh) {
index d028721..444b14d 100644 (file)
@@ -321,7 +321,8 @@ function open_alt_serial_mgmt() {
         ].forEach(function(k) { content_params[k] = xulG[k]; });
 
         var loc = urls.XUL_BROWSER + "?url=" + window.escape(
-            xulG.url_prefix("/eg/serial/list_subscription/") + docid
+            xulG.url_prefix("/eg/serial/list_subscription?record_entry=") +
+            docid
         );
         xulG.new_tab(
             loc, {