From cc6099543a80cc976b7ae8b74f30d2c52d7d1261 Mon Sep 17 00:00:00 2001 From: senator Date: Tue, 7 Dec 2010 22:43:55 +0000 Subject: [PATCH] Backport r18931 from trunk Serials: When the fully compressed serial holdings are active in the OPAC, you get this "issues held" display with an expand/compress toggle that will either show you individual holdings (and allow you to place holds on them) or compressed holdings statements. The functionality existed in trunk before this commit, but this cleans it up and makes it better. It's more consistent with the the result detail table, it doesn't offer you the change to place holds on issues that don't have units (copy-equivalent objects), etc etc. git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@18932 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Serial.pm | 20 +++- Open-ILS/web/js/dojo/openils/opac/nls/opac.js | 4 +- Open-ILS/web/opac/locale/en-US/opac.dtd | 1 + Open-ILS/web/opac/skin/default/js/rdetail.js | 69 +++++++++++--- .../skin/default/xml/rdetail/rdetail_summary.xml | 105 +++++++++++---------- 5 files changed, 130 insertions(+), 69 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm b/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm index 01e5dbbbf2..519bb5927f 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm @@ -367,7 +367,16 @@ sub received_siss_by_bib { $global ? { transform => "min", column => "id", aggregate => 1 } : "id", "label", "date_published" - ]}, + ], + "sitem" => [ + # We're not really interested in the minimum here. This is + # just a way to distinguish issuances whose items have units + # from issuances whose items have no units, without altogether + # excluding the latter type of issuances. + {"transform" => "min", "alias" => "has_units", + "column" => "unit", "aggregate" => 1} + ] + }, from => { ssub => { siss => { @@ -414,7 +423,11 @@ sub received_siss_by_bib { distinct => 1 }); - $client->respond($e->retrieve_serial_issuance($_->{id})) for @$issuances; + $client->respond({ + "issuance" => $e->retrieve_serial_issuance($_->{"id"}), + "has_units" => $_->{"has_units"} ? 1 : 0 + }) for @$issuances; + return undef; } __PACKAGE__->register_method( @@ -460,7 +473,8 @@ sub scoped_bib_holdings_summary { # split into issuance type sets my %type_blob = (basic => [], supplement => [], index => []); - push @{ $type_blob{ $_->holding_type } }, $_ for (@$issuances); + push @{ $type_blob{ $_->{"issuance"}->holding_type } }, $_->{"issuance"} + for (@$issuances); # generate a statement list for each type my %statement_blob; diff --git a/Open-ILS/web/js/dojo/openils/opac/nls/opac.js b/Open-ILS/web/js/dojo/openils/opac/nls/opac.js index 84784982df..7b9a353d34 100644 --- a/Open-ILS/web/js/dojo/openils/opac/nls/opac.js +++ b/Open-ILS/web/js/dojo/openils/opac/nls/opac.js @@ -32,5 +32,7 @@ "ONLINE_VOLUMES": "Online volumes", "SAVE_MFHD_LABEL": "Save MFHD", "SUPPLEMENT_HOLDINGS": "Supplements", - "SUPPLEMENT_HOLDINGS_ADD": "Additional Supplement Information" + "SUPPLEMENT_HOLDINGS_ADD": "Additional Supplement Information", + "PLACE_HOLD": "Place hold", + "MORE": "More" } diff --git a/Open-ILS/web/opac/locale/en-US/opac.dtd b/Open-ILS/web/opac/locale/en-US/opac.dtd index b215f73c9a..aef4bbb430 100644 --- a/Open-ILS/web/opac/locale/en-US/opac.dtd +++ b/Open-ILS/web/opac/locale/en-US/opac.dtd @@ -557,6 +557,7 @@ We recommend that you remove this title from any bookbags it may have been added + diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index e239098053..153fc9e9d8 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -1170,32 +1170,71 @@ function rdetailGBPViewerLoadCallback() { } function rdetailDrawExpandedHoldings(anchor, bibid, type) { - anchor.innerHTML = "Hide holdings"; /* XXX i18n */ - anchor.oldonclick = anchor.onclick; - anchor.onclick = function() { anchor.onclick = anchor.oldonclick; anchor.innerHTML = "Show holdings"; dojo.empty(target); }; - var offsets = {"basic": 0, "index": 0, "supplement": 0}; var limit = 10; /* XXX give user control over this? */ - var target = dojo.query("[expanded_holdings='" + type + "']")[0]; + var target_id = "holding_type_" + type; + var target = dojo.byId(target_id); + + anchor.innerHTML = "[-]"; + anchor.oldonclick = anchor.onclick; + anchor.onclick = function() { + anchor.onclick = anchor.oldonclick; + anchor.innerHTML = "[+]"; + dojo.empty(target); + }; function _load() { dojo.empty(target); fieldmapper.standardRequest( - ["open-ils.serial", "open-ils.serial.received_siss.retrieve.by_bib.atomic"], { + ["open-ils.serial", + "open-ils.serial.received_siss.retrieve.by_bib.atomic"], { "params": [bibid, {"offset": offsets[type], "limit": limit}], "async": true, "oncomplete": function(r) { - if (r = openils.Util.readResponse(r)) { - offsets[type] += r.length; - dojo.forEach( - r, function(sum) { - dojo.create("span", {"innerHTML": sum.label()}, target); + try { + if (msg = r.recv().content()) { /* sic, assignment */ + offsets[type] += msg.length; + dojo.forEach( + msg, function(o) { + dojo.create("br", null, target); + dojo.create( + "span", { + "innerHTML": o.issuance.label(), + "style": {"padding": "0 2em"} + }, target + ); + + if (!o.has_units) return; + /* can't place holds if no units */ + dojo.create( + "a", { + "href":"javascript:void(0);", + "onclick": function() { + holdsDrawEditor({ + "type": "I", + "issuance": o.issuance.id() + }); + }, + "innerHTML": "[" + + opac_strings.PLACE_HOLD + "]" + }, target + ); + } + ); + if (msg.length == limit) { dojo.create("br", null, target); + dojo.create( + "a", { + "href": "javascript:void(0);", + "innerHTML": + "[" + opac_strings.MORE + "]", + "onclick": _load + }, target + ); } - ); - /* XXX i18n */ - if (r.length == limit) - dojo.create("a", {"style": "margin-top: 6px;", "innerHTML": "[More]", "onclick": _load}, target); + } + } catch (E) { + void(0); } } } diff --git a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml index 5d02f5eb34..ededaba225 100644 --- a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml +++ b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml @@ -131,57 +131,62 @@ ]]> - - Issues Held: ${holdingsStatement} + + &rdetail.summary.issues_held; + + ${holdingsStatement} -- 2.11.0