From 1829b7c62d584ab9b33aa152c0418beab932e169 Mon Sep 17 00:00:00 2001 From: senator Date: Thu, 16 Sep 2010 15:38:48 +0000 Subject: [PATCH] Crude OPAC support for expanding serial issuances when showing fully compressed holdings git-svn-id: svn://svn.open-ils.org/ILS/trunk@17735 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/skin/default/js/rdetail.js | 34 ++++++++++++++++++++++ .../skin/default/xml/rdetail/rdetail_summary.xml | 30 ++++++++++++++++--- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index fe18c0d06e..34981fc3cd 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -1168,3 +1168,37 @@ 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]; + + function _load() { + dojo.empty(target); + fieldmapper.standardRequest( + ["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); + dojo.create("br", null, target); + } + ); + /* XXX i18n */ + if (r.length == limit) + dojo.create("a", {"style": "margin-top: 6px;", "innerHTML": "[More]", "onclick": _load}, target); + } + } + } + ); + } + _load(); +} 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 69a876c3a0..42377f7416 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 @@ -141,15 +141,37 @@ 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'], - [BT.textContent(item_list[0]), { orgid : getLocation(), depth : getDepth() }] + [bibid, { orgid : getLocation(), depth : getDepth() }] ); - var ret = dojo.create('div'); + var ret = dojo.create("div"); + var innerret = dojo.create( + "div", {"style":"clear;both;"}, ret + ); for (var i in blob) { - var br = dojo.create('br', null, ret); - var span = dojo.create('span',{class : 'holding_type_'+ i, innerHTML : blob[i].join(', ') }, ret); + if (!blob[i].length) continue; + 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); } dojo.removeClass(slot,'hide_me'); -- 2.11.0