From ba3b378cc829337dab32ab86b06d7b4f60a0312c Mon Sep 17 00:00:00 2001 From: senator Date: Tue, 7 Dec 2010 22:42:03 +0000 Subject: [PATCH] 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/trunk@18931 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 | 53 +++++++---- .../skin/default/xml/rdetail/rdetail_summary.xml | 105 +++++++++++---------- 5 files changed, 113 insertions(+), 70 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm b/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm index c76004c7fd..9505fea05e 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 4369b53ad4..f5c49352f1 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -1206,18 +1206,24 @@ 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) { @@ -1225,28 +1231,43 @@ function rdetailDrawExpandedHoldings(anchor, bibid, type) { if (msg = r.recv().content()) { /* sic, assignment */ offsets[type] += msg.length; dojo.forEach( - msg, function(iss) { + msg, function(o) { + dojo.create("br", null, target); dojo.create( "span", { - "innerHTML": iss.label(), - "style": "padding-right: 1em;" + "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":"#","onclick":function() { + "href":"javascript:void(0);", + "onclick": function() { holdsDrawEditor({ - "type":"I","issuance":iss.id() + "type": "I", + "issuance": o.issuance.id() }); - }, "innerHTML":"Place hold"/*XXX i18n*/ + }, + "innerHTML": "[" + + opac_strings.PLACE_HOLD + "]" }, target ); - dojo.create("br", null, target); } ); - /* XXX i18n */ - if (r.length == limit) - dojo.create("a", {"style": "margin-top: 6px;", "innerHTML": "[More]", "onclick": _load}, target); + if (msg.length == limit) { + dojo.create("br", null, target); + dojo.create( + "a", { + "href": "javascript:void(0);", + "innerHTML": + "[" + opac_strings.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 ba243cf008..bd5f8c6277 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 @@ -139,57 +139,62 @@ ]]> - - Issues Held: ${holdingsStatement} + + &rdetail.summary.issues_held; + + ${holdingsStatement} -- 2.11.0