[open-ils-commits] r18931 - in trunk/Open-ILS: src/perlmods/OpenILS/Application web/js/dojo/openils/opac/nls web/opac/locale/en-US web/opac/skin/default/js web/opac/skin/default/xml/rdetail (senator)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Dec 7 17:42:09 EST 2010
Author: senator
Date: 2010-12-07 17:42:03 -0500 (Tue, 07 Dec 2010)
New Revision: 18931
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm
trunk/Open-ILS/web/js/dojo/openils/opac/nls/opac.js
trunk/Open-ILS/web/opac/locale/en-US/opac.dtd
trunk/Open-ILS/web/opac/skin/default/js/rdetail.js
trunk/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml
Log:
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.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm 2010-12-07 20:01:09 UTC (rev 18930)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Serial.pm 2010-12-07 22:42:03 UTC (rev 18931)
@@ -367,7 +367,16 @@
$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 @@
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 @@
# 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;
Modified: trunk/Open-ILS/web/js/dojo/openils/opac/nls/opac.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/opac/nls/opac.js 2010-12-07 20:01:09 UTC (rev 18930)
+++ trunk/Open-ILS/web/js/dojo/openils/opac/nls/opac.js 2010-12-07 22:42:03 UTC (rev 18931)
@@ -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"
}
Modified: trunk/Open-ILS/web/opac/locale/en-US/opac.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/opac.dtd 2010-12-07 20:01:09 UTC (rev 18930)
+++ trunk/Open-ILS/web/opac/locale/en-US/opac.dtd 2010-12-07 22:42:03 UTC (rev 18931)
@@ -557,6 +557,7 @@
<!ENTITY rdetail.noneAvailable " * There are no copies in this location">
<!ENTITY rdetail.summary.online "Online Resources">
<!ENTITY rdetail.summary.subjects "Subjects">
+<!ENTITY rdetail.summary.issues_held "Issues Held">
<!ENTITY result.sort_by "Sort Results by Relevance">
<!ENTITY result.sort_by.title "Sort Results by Title">
Modified: trunk/Open-ILS/web/opac/skin/default/js/rdetail.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/rdetail.js 2010-12-07 20:01:09 UTC (rev 18930)
+++ trunk/Open-ILS/web/opac/skin/default/js/rdetail.js 2010-12-07 22:42:03 UTC (rev 18931)
@@ -1206,18 +1206,24 @@
}
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 @@
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);
Modified: trunk/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml 2010-12-07 20:01:09 UTC (rev 18930)
+++ trunk/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml 2010-12-07 22:42:03 UTC (rev 18931)
@@ -139,57 +139,62 @@
]]></script>
</td>
</tr>
- <tr templated="true"
- name="serial_holdings_label"
- class="result_table_title_cell hide_me"
- type="opac/slot-data"
- query="datafield[tag='901'] subfield[code='c']">
- <td colspan="2">Issues Held: ${holdingsStatement}
+ <tr name="serial_holdings_label"
+ class="result_table_title_cell hide_me">
+ <td class="rdetail_desc">&rdetail.summary.issues_held;</td>
+ <td templated="true" type="opac/slot-data"
+ query="datafield[tag='901'] subfield[code='c']"
+ class="rdetail_item">
+ ${holdingsStatement}
<span class="hide_me" name="holdingsStatement" type="opac/template-value"><![CDATA[
- if (fetchOrgSettingDefault(
- getLocation(), "opac.fully_compressed_serial_holdings"
- )) {
- var bibid = BT.textContent(item_list[0]);
- var blob = fieldmapper.standardRequest(
- ['open-ils.serial','open-ils.serial.bib.summary_statements'],
- [bibid, { orgid : getLocation(), depth : getDepth() }]
- );
+ if (fetchOrgSettingDefault(
+ getLocation(),
+ "opac.fully_compressed_serial_holdings"
+ )) {
+ var bibid = BT.textContent(item_list[0]);
+ var blob = fieldmapper.standardRequest(
+ ["open-ils.serial",
+ "open-ils.serial.bib.summary_statements"],
+ [bibid, {
+ "orgid": getLocation(), "depth": getDepth()
+ }]
+ );
- var ret = dojo.create("div");
- var innerret = dojo.create(
- "div", {"style":"clear;both;"}, ret
- );
+ var fake = dojo.create("td");
+ var something = false;
- var something = false;
- for (var i in blob) {
- if (!blob[i].length) continue;
- something = true;
- dojo.create(
- "div", {
- "innerHTML": blob[i].join(", "),
- "className": "holding_type_" + i,
- "style": "float:left;width:33%;"
- }, innerret
- );
- var div = dojo.create("div", {
- "style": "float:left;width:33%;"
- });
- var a = dojo.create(
- "a", {
- "innerHTML": "Show holdings",
- "href": "#",
- "onclick": "rdetailDrawExpandedHoldings(this,"+bibid+",'"+i+"');return false"
- }, div
- );
- dojo.place(div, innerret);
- dojo.create("div", {"style":"float:right;width:33%;", "expanded_holdings": i}, innerret);
- }
+ for (var i in blob) {
+ if (!blob[i].length) continue;
+ if (something) dojo.create("br", null, fake);
+ something = true;
- if (something) dojo.removeClass(slot,'hide_me');
- return ret.innerHTML;
- } else {
- return "";
- }
+ var a = dojo.create(
+ "a", {
+ "innerHTML": "[+]",
+ "href": "javascript:void(0);",
+ "onclick":
+ "rdetailDrawExpandedHoldings(this,"+
+ bibid + ",'" + i + "');",
+ "style": {"marginRight": "1.5em"}
+ }, fake
+ );
+ dojo.create(
+ "span", {
+ "innerHTML": blob[i].join(", ")
+ }, fake
+ );
+ dojo.create(
+ "span", {"id": "holding_type_" + i}, fake
+ );
+ }
+
+ if (something)
+ unHideMe(slot.parentNode);
+
+ return fake.innerHTML;
+ } else {
+ return "";
+ }
]]></span>
</td>
</tr>
More information about the open-ils-commits
mailing list