[open-ils-commits] r17740 - in branches/rel_2_0/Open-ILS/web/opac/skin/default: js xml/rdetail (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Sep 16 12:14:30 EDT 2010


Author: senator
Date: 2010-09-16 12:14:27 -0400 (Thu, 16 Sep 2010)
New Revision: 17740

Modified:
   branches/rel_2_0/Open-ILS/web/opac/skin/default/js/rdetail.js
   branches/rel_2_0/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml
Log:
Backport r17735 from trunk, opac holds issuances expandy


Modified: branches/rel_2_0/Open-ILS/web/opac/skin/default/js/rdetail.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/opac/skin/default/js/rdetail.js	2010-09-16 16:09:16 UTC (rev 17739)
+++ branches/rel_2_0/Open-ILS/web/opac/skin/default/js/rdetail.js	2010-09-16 16:14:27 UTC (rev 17740)
@@ -1168,3 +1168,37 @@
 
 }
 
+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();
+}

Modified: branches/rel_2_0/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml
===================================================================
--- branches/rel_2_0/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml	2010-09-16 16:09:16 UTC (rev 17739)
+++ branches/rel_2_0/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml	2010-09-16 16:14:27 UTC (rev 17740)
@@ -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');



More information about the open-ils-commits mailing list