$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 => {
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(
# 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;
"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"
}
<!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">
}
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 (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);
]]></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() }]
- );
-
- var ret = dojo.create("div");
- var innerret = dojo.create(
- "div", {"style":"clear;both;"}, ret
- );
-
- 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);
- }
-
- if (something) dojo.removeClass(slot,'hide_me');
- return ret.innerHTML;
- } else {
- return "";
- }
+ 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 fake = dojo.create("td");
+ var something = false;
+
+ for (var i in blob) {
+ if (!blob[i].length) continue;
+ if (something) dojo.create("br", null, fake);
+ something = true;
+
+ 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>