From: miker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Thu, 18 Feb 2010 20:28:37 +0000 (+0000)
Subject: adding "show call numbers at can-have-vols search locations; supporing unapi format
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=52cfa4281daab8cd30407a65b007d7506eaf0b79;p=evergreen%2Ftadl.git

adding "show call numbers at can-have-vols search locations; supporing unapi format

git-svn-id: svn://svn.open-ils.org/ILS/trunk@15585 dcc99617-32d9-48b4-a31d-7c20da2025e4
---

diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
index 00ee6d51cf..00cc05e18b 100644
--- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
+++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
@@ -347,6 +347,8 @@ sub unapi {
 	<format name='opac' type='text/html'/>
 	<format name='html' type='text/html'/>
 	<format name='htmlholdings' type='text/html'/>
+	<format name='holdings_xml' type='application/xml'/>
+	<format name='holdings_xml-full' type='application/xml'/>
 	<format name='html-full' type='text/html'/>
 	<format name='htmlholdings-full' type='text/html'/>
 	<format name='marctxt' type='text/plain'/>
@@ -390,6 +392,8 @@ sub unapi {
 	<format name='opac' type='text/html'/>
 	<format name='html' type='text/html'/>
 	<format name='htmlholdings' type='text/html'/>
+	<format name='holdings_xml' type='application/xml'/>
+	<format name='holdings_xml-full' type='application/xml'/>
 	<format name='html-full' type='text/html'/>
 	<format name='htmlholdings-full' type='text/html'/>
 	<format name='marctxt' type='text/plain'/>
@@ -469,11 +473,11 @@ sub unapi {
 	}
 
 	if ( !grep
-	       { (keys(%$_))[0] eq $base_format }
-	       @{ $supercat->request("open-ils.supercat.$type.formats")->gather(1) }
-	     and !grep
-	       { $_ eq $base_format }
-	       qw/opac html htmlholdings marctxt ris/
+		   { (keys(%$_))[0] eq $base_format }
+		   @{ $supercat->request("open-ils.supercat.$type.formats")->gather(1) }
+		 and !grep
+		   { $_ eq $base_format }
+		   qw/opac html htmlholdings marctxt ris holdings_xml/
 	) {
 		print "Content-type: text/html; charset=utf-8\n\n";
 		$apache->custom_response( 406, <<"		HTML");
@@ -532,9 +536,22 @@ sub unapi {
 		return Apache2::Const::OK;
 	}
 
-	my $req = $supercat->request("open-ils.supercat.$type.$format.$command",$id);
+	my $method = "open-ils.supercat.$type.$base_format.$command";
+	my @params = ($id);
+
+	if ($base_format eq 'holdings_xml') {
+		$method .= '.atomic';
+		push @params, $lib;
+		if ($format !~ /-full$/o) {
+			push @params, 1;
+		}
+	}
+
+	my $req = $supercat->request($method,@params);
 	my $data = $req->gather(1);
 
+	$data = join('', @$data) if ($base_format eq 'holdings_xml');
+
 	if ($req->failed || !$data) {
 		print "Content-type: text/html; charset=utf-8\n\n";
 		$apache->custom_response( 404, <<"		HTML");
diff --git a/Open-ILS/web/opac/locale/en-US/opac.dtd b/Open-ILS/web/opac/locale/en-US/opac.dtd
index 8afeb49c5a..9b8e201313 100644
--- a/Open-ILS/web/opac/locale/en-US/opac.dtd
+++ b/Open-ILS/web/opac/locale/en-US/opac.dtd
@@ -576,6 +576,7 @@ We recommend that you remove this title from any bookbags it may have been added
 <!ENTITY result.table.keyword "View titles for this record">
 <!ENTITY result.table.author "Perform an Author Search">
 <!ENTITY result.googleBooks.browse "Browse in Google Books Search">
+<!ENTITY result.localCallNumbers "Local Call Numbers:">
 
 <!ENTITY common.call.number.label "Call Number:">
 <!ENTITY common.isbn.label "ISBN:">
diff --git a/Open-ILS/web/opac/skin/default/js/result_common.js b/Open-ILS/web/opac/skin/default/js/result_common.js
index 549fd0a64d..1c25714291 100644
--- a/Open-ILS/web/opac/skin/default/js/result_common.js
+++ b/Open-ILS/web/opac/skin/default/js/result_common.js
@@ -483,6 +483,23 @@ function resultDisplayRecord(rec, pos, is_mr) {
 			title_link.setAttribute("href", buildOPACLink(args));
 			title_link.appendChild(text(normalize(truncate(rec.title(), 65))));
 			
+			var here = findOrgUnit(getLocation());
+			if (findOrgType(here.ou_type()).can_have_vols()) { // show the callnumber list
+				dojo.require('openils.BibTemplate');
+				var l_cn_list = $n(r,'local_callnumber_list');
+
+				setTimeout(
+					function () {
+						unHideMe(l_cn_list);
+						new openils.BibTemplate({
+							root : l_cn_list,
+							record : onlyrec,
+							org_unit : here.shortname()
+						}).render();
+					}, 0
+				);
+			}
+
 		} else {
 			buildunAPISpan($n(r,'unapi'), 'metabib-metarecord', rec.doc_id());
 
@@ -507,6 +524,24 @@ function resultDisplayRecord(rec, pos, is_mr) {
 		unHideMe($n(r,'place_hold_span'));
 		$n(r,'place_hold_link').setAttribute(
 			'href','javascript:holdsDrawEditor({record:"'+rec.doc_id()+'",type:"T"});');
+
+		var here = findOrgUnit(getLocation());
+		if (findOrgType(here.ou_type()).can_have_vols()) { // show the callnumber list
+			dojo.require('openils.BibTemplate');
+			var l_cn_list = $n(r,'local_callnumber_list');
+			var onlyrec = rec.doc_id();
+
+			setTimeout(
+				function () {
+					unHideMe(l_cn_list);
+					new openils.BibTemplate({
+						root : l_cn_list,
+						record : onlyrec,
+						org_unit : here.shortname()
+					}).render();
+				}, 0
+			);
+		}
 	}
 
 	buildSearchLink(STYPE_AUTHOR, rec.author(), author_link);
diff --git a/Open-ILS/web/opac/skin/default/xml/result/result_table.xml b/Open-ILS/web/opac/skin/default/xml/result/result_table.xml
index 5acea4cc53..21d861e191 100644
--- a/Open-ILS/web/opac/skin/default/xml/result/result_table.xml
+++ b/Open-ILS/web/opac/skin/default/xml/result/result_table.xml
@@ -33,7 +33,7 @@
 
 							<tr style='height: 1em' name='counts_row'>
 
-								<td  rowspan='3' class='result_table_pic_header'>
+								<td  rowspan='4' class='result_table_pic_header'>
 									<a><img name='item_jacket' class='result_table_pic'/></a>
 								</td>
 
@@ -45,7 +45,7 @@
 								</td>
 
 								<!-- Copy this td for each copy count appended -->
-								<td  rowspan='3' nowrap='nowrap' name="copy_count_cell" class='copy_count_cell'> 
+								<td  rowspan='4' nowrap='nowrap' name="copy_count_cell" class='copy_count_cell'> 
 								</td>
 
 							</tr>
@@ -137,6 +137,13 @@
 
 								</td>
 							</tr>
+							<tr name="local_callnumber_list" class="result_table_title_cell hide_me">
+								<td>&result.localCallNumbers;
+									<span type='opac/slot-data+holdings_xml' query='volumes volume' join=", ">
+										<script type='opac/slot-format'><![CDATA[return '<b>'+item.getAttribute('label')+'</b>';]]></script>
+									</span>
+								</td>
+							</tr>
 
 						</tbody>
 					</table>