Staff client: add a back-to-search-results button in the chrome that ...
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Tue, 13 Mar 2012 21:18:17 +0000 (17:18 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 19 Mar 2012 15:37:19 +0000 (11:37 -0400)
... wraps the OPAC (whether JSPAC or TPAC).

You don't really need this when in OPAC view, because the OPAC page
itself will have a link that does the same thing.  However, if you're
browsing through records in a search result set one at a time in some
other view, say the MARC view, then this button can come in handy.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Michael Peters <mrpeters@library.in.gov>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/templates/opac/parts/js.tt2
Open-ILS/web/js/ui/default/opac/staff.js
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/xul/staff_client/chrome/content/cat/opac.js
Open-ILS/xul/staff_client/chrome/content/cat/opac.xul

index a7bc567..517b230 100644 (file)
@@ -12,7 +12,8 @@
                 "[% ctx.prev_rec_url || '' %]",
                 "[% ctx.next_rec_url || '' %]",
                 "[% mkurl(ctx.first_search_record, {page => 0}) %]",
-                "[% mkurl(ctx.last_search_record, {page => POSIX.floor(ctx.hit_count / ctx.page_size)}) %]"
+                "[% mkurl(ctx.last_search_record, {page => POSIX.floor(ctx.hit_count / ctx.page_size)}) %]",
+                "[% mkurl(ctx.opac_root _ '/results', {}, ['expand','cnoffset']) %]"
             );
         </script>
         [% END %]
index b952cef..55e5612 100644 (file)
@@ -27,10 +27,16 @@ window.onload = function() {
     }
 }
 
-function rdetail_next_prev_actions(index, count, prev, next, start, end) {
-    /*  we get the relative URL from the template:  recid?query_args...
+function rdetail_next_prev_actions(index, count, prev, next, start, end, results) {
+    /*  we mostly get the relative URL from the template:  recid?query_args...
         replace the recid and args on location.href to get the new URL  */
-    function fullurl(url) { return location.href.replace(/\/\d+\??.*/, '/' + url); }
+    function fullurl(url) {
+        if (url.match(/eg\/opac\/results/)) {
+            return location.href.replace(/eg\/opac\/.+$/, url);
+        } else {
+            return location.href.replace(/\/\d+\??.*/, '/' + url);
+        }
+    }
 
     if (index > 0) {
         if(prev) 
@@ -46,6 +52,8 @@ function rdetail_next_prev_actions(index, count, prev, next, start, end) {
             window.rdetailEnd = function() { location.href = fullurl(end); }
     }
 
+    window.rdetailBackToResults = function() { location.href = fullurl(results); };
+
     ol = window.onload;
     window.onload = function() {
         if(ol) ol(); 
index 3561e30..a20ea1f 100644 (file)
 <!ENTITY staff.cat.opac.menu.label "Actions for this Record">
 <!ENTITY staff.cat.opac.opac_view.accesskey "O">
 <!ENTITY staff.cat.opac.opac_view.label "OPAC View">
+<!ENTITY staff.cat.opac.record_back_to_results.accesskey "H">
+<!ENTITY staff.cat.opac.record_back_to_results.label "Search Results">
 <!ENTITY staff.cat.opac.record_end.accesskey "E">
 <!ENTITY staff.cat.opac.record_end.label "End">
 <!ENTITY staff.cat.opac.record_next.accesskey "N">
index c4f1616..55a1837 100644 (file)
@@ -42,6 +42,7 @@ var rdetailPrev = null;
 var rdetailNext = null;
 var rdetailStart = null;
 var rdetailEnd = null;
+var rdetailBackToResults = null;
 
 var mfhdDetails = [];
 var orgHiding = false;
@@ -108,6 +109,7 @@ function rdetailSetPaging(ids) {
                rdetailNext = function() { _rdetailNav(nextRecord); };
                rdetailEnd = function() { _rdetailNav(cachedRecords.ids[cachedRecords.ids.length-1]); };
        }
+    rdetailBackToResults = function() { location.href = prevRResults(); };
 
        runEvt('rdetail', 'nextPrevDrawn', i, cachedRecords.ids.length);
 }
index 4bd3128..52c84ef 100644 (file)
@@ -422,9 +422,12 @@ function set_opac() {
                     }
                 );
                 
-                g.f_record_start = null; g.f_record_prev = null; g.f_record_next = null; g.f_record_end = null;
+                g.f_record_start = null; g.f_record_prev = null;
+                g.f_record_next = null; g.f_record_end = null;
+                g.f_record_back_to_results = null;
                 $('record_start').disabled = true; $('record_next').disabled = true;
                 $('record_prev').disabled = true; $('record_end').disabled = true;
+                $('record_back_to_results').disabled = true;
                 $('record_pos').setAttribute('value','');
 
                 win.attachEvt("rdetail", "nextPrevDrawn",
@@ -458,6 +461,17 @@ function set_opac() {
                             }
                             $('record_end').disabled = false;
                         }
+                        if (win.rdetailBackToResults) {
+                            g.f_record_back_to_results = function() {
+                                g.view_override = g.view;
+                                win.rdetailBackToResults();
+                                if (g.view != "opac") {
+                                    set_opac();
+                                    opac_wrapper_set_help_context();
+                                }
+                            }
+                            $('record_back_to_results').disabled = false;
+                        }
                     }
                 );
 
index 2d775d3..e8bfcda 100644 (file)
@@ -41,6 +41,8 @@
             <button id="record_next" accesskey="&staff.cat.opac.record_next.accesskey;" label="&staff.cat.opac.record_next.label;" oncommand="if (g.f_record_next) g.f_record_next();"/>
             <button id="record_end" accesskey="&staff.cat.opac.record_end.accesskey;" label="&staff.cat.opac.record_end.label;" oncommand="if (g.f_record_end) g.f_record_end();"/>
             <spacer flex="1"/>
+            <button id="record_back_to_results" accesskey="&staff.cat.opac.record_back_to_results.accesskey;" label="&staff.cat.opac.record_back_to_results.label;" oncommand="if (g.f_record_back_to_results) g.f_record_back_to_results();"/>
+            <spacer flex="3"/>
             <menubar>
                 <menu label="&staff.cat.opac.menu.label;" accesskey="&staff.cat.opac.menu.accesskey;">
                 <menupopup>