adding "show call numbers at can-have-vols search locations; supporing unapi format
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 18 Feb 2010 20:28:37 +0000 (20:28 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 18 Feb 2010 20:28:37 +0000 (20:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15585 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Open-ILS/web/opac/locale/en-US/opac.dtd
Open-ILS/web/opac/skin/default/js/result_common.js
Open-ILS/web/opac/skin/default/xml/result/result_table.xml

index 00ee6d5..00cc05e 100644 (file)
@@ -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");
index 8afeb49..9b8e201 100644 (file)
@@ -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:">
index 549fd0a..1c25714 100644 (file)
@@ -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);
index 5acea4c..21d861e 100644 (file)
@@ -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>
 
                                                                </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>