From: Lebbeous Fogle-Weekley Date: Tue, 13 Mar 2012 21:18:17 +0000 (-0400) Subject: Staff client: add a back-to-search-results button in the chrome that ... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d56aec84eacfbc41829bcca3b0899e26e78e8fe8;p=evergreen%2Fjoelewis.git Staff client: add a back-to-search-results button in the chrome that ... ... 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 Signed-off-by: Michael Peters Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2 index a7bc5677e2..517b2300f2 100644 --- a/Open-ILS/src/templates/opac/parts/js.tt2 +++ b/Open-ILS/src/templates/opac/parts/js.tt2 @@ -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']) %]" ); [% END %] diff --git a/Open-ILS/web/js/ui/default/opac/staff.js b/Open-ILS/web/js/ui/default/opac/staff.js index b952cef7d4..55e5612ea4 100644 --- a/Open-ILS/web/js/ui/default/opac/staff.js +++ b/Open-ILS/web/js/ui/default/opac/staff.js @@ -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(); diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 3561e30825..a20ea1f4aa 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -311,6 +311,8 @@ + + diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index c4f16163e2..55a1837b7c 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -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); } diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js index 4bd31287c1..52c84ef8fa 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -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; + } } ); diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul b/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul index 2d775d3a5f..e8bfcda7e2 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul @@ -41,6 +41,8 @@