started working on the callnumber/copy details pane in the record details page
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 20 Mar 2006 22:58:40 +0000 (22:58 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 20 Mar 2006 22:58:40 +0000 (22:58 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3404 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/extras/fieldmapper.pl
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml

index 4684ff1..1dac298 100755 (executable)
@@ -11,14 +11,14 @@ if(!$web) { $web = ""; }
 
 # List of classes needed by the opac
 my @web_hints = qw/ asv asva asvr asvq 
-               circ acp acpl acn ccs ahn  
+               circ acpl ccs ahn  
                crcd crmf crrf mbts aoc aus 
                mous mobts mb /;
 
 my @web_core = qw/ 
        aou au perm_ex ex aout 
        mvr ccs ahr aua ac actscecm cbreb 
-       cbrebi acpn acnn bren /;
+       cbrebi acpn acp acnn acn bren /;
 
 my @reports = qw/ perm_ex ex ao aou aout /;
 
index 12a4340..adf03c3 100644 (file)
@@ -950,6 +950,42 @@ sub fetch_cn {
        return $cn;
 }
 
+__PACKAGE__->register_method (
+       method          => "fetch_copy_by_cn",
+       api_name                => 'open-ils.search.copies_by_call_number.retrieve',
+       signature       => q/
+               Returns an array of copy id's by callnumber id
+               @param cnid The callnumber id
+               @return An array of copy ids
+       /
+);
+
+sub fetch_copy_by_cn {
+       my( $self, $conn, $cnid ) = @_;
+       return $U->storagereq(
+               'open-ils.storage.id_list.asset.copy.search_where.atomic', 
+               { call_number => $cnid, deleted => 'f' } );
+}
+
+__PACKAGE__->register_method (
+       method          => 'fetch_cn_by_info',
+       api_name                => 'open-ils.search.call_number.retrieve_by_info',
+       signature       => q/
+               @param label The callnumber label
+               @param record The record the cn is attached to
+               @param org The owning library of the cn
+               @return The callnumber object
+       /
+);
+
+sub fetch_cn_by_info {
+       my( $self, $conn, $label, $record, $org ) = @_;
+       return $U->storagereq(
+               'open-ils.storage.direct.asset.call_number.search_where',
+               { label => $label, record => $record, owning_lib => $org, deleted => 'f' });
+}
+               
+
 
 
 
index bf515e2..527c362 100644 (file)
@@ -288,6 +288,8 @@ var FETCH_COPY                                              = 'open-ils.search:open-ils.search.asset.copy.retrieve';
 var CHECK_HOLD_POSSIBLE                        = 'open-ils.circ:open-ils.circ.title_hold.is_possible';
 var UPDATE_HOLD                                        = 'open-ils.circ:open-ils.circ.hold.update';
 var FETCH_BIBLIO_NOTES                 = 'open-ils.circ:open-ils.circ.biblio_notes.public.batch.retrieve';
+var FETCH_COPIES_FROM_VOLUME   = 'open-ils.search:open-ils.search.copies_by_call_number.retrieve';
+var FETCH_VOLUME_BY_INFO               = 'open-ils.search:open-ils.search.call_number.retrieve_by_info'; /* XXX staff method? */
 /* ---------------------------------------------------------------------------- */
 
 
index 4f93c1f..5c7550e 100644 (file)
@@ -195,7 +195,7 @@ var rdetailTocFetched               = false;
 var rdetailReviewFetched       = false;
 var rdetailMarcFetched         = false;
 
-function rdetailShowExtra(type) {
+function rdetailShowExtra(type, args) {
 
        hideMe($('rdetail_copy_info_div'));
        hideMe($('rdetail_reviews_div'));
@@ -254,6 +254,63 @@ function rdetailShowExtra(type) {
                case 'notes':
                        unHideMe($('rdetail_notes_div'));
                        break;
+
+               case 'cn_details':
+                       unHideMe($('rdetail_cn_details_div'));
+                       unHideMe($('rdetail_cn_details_link'));
+                       rdetailShowCNDetails(args);
+                       break;
+
+
+       }
+}
+
+var rdetailCNDetailsRow;
+function rdetailShowCNDetails(args) {
+       $('rdetail_cn_details_cn').appendChild(text(args.cn));
+       $('rdetail_cn_details_owner').appendChild(text(findOrgUnit(args.org).name()));
+       var req = new Request(FETCH_VOLUME_BY_INFO, args.cn, record.doc_id(), args.org);
+       req.callback(rdetailShowCNDetails2);
+       req.send();
+}
+
+function rdetailShowCNDetails2(r) {
+       var cn = r.getResultObject();
+       var req = new Request(FETCH_COPIES_FROM_VOLUME, cn.id());
+       req.request._cn = cn;
+       req.callback(rdetailShowCNDetails3);
+       req.send();
+}
+
+function rdetailShowCNDetails3(r) {
+       var copies = r.getResultObject();
+       var cn = r._cn;
+       var tbody = $('rdetail_cn_copies_tbody');
+       if(!rdetailCNDetailsRow)
+               rdetailCNDetailsRow = tbody.removeChild($('rdetail_cn_copies_row'));
+
+       for( var i = 0; i != copies.length; i++ ) {
+               var row = rdetailCNDetailsRow.cloneNode(true);
+               var copyid = copies[i];
+               var req = new Request(FETCH_COPY, copyid);
+               req.callback(rdetailShowCNCopy);
+               req.request._cn = cn;
+               req.request._tbody = tbody;
+               req.request._row = row;
+               req.send();
+               tbody.appendChild(row);
+       }
+}
+
+function rdetailShowCNCopy(r) {
+       var copy = r.getResultObject();
+       var row = r._row;
+       $n(row, 'barcode').appendChild(text(copy.barcode()));
+
+       for( i = 0; i < cp_statuses.length; i++ ) {
+               var c = cp_statuses[i];
+               if( c.id() == copy.status() )
+                       $n(row, 'status').appendChild(text(c.name()));
        }
 }
 
@@ -428,7 +485,7 @@ function _rdetailBuildInfoRows(r) {
                        }
                }
                rdetailSetPath( thisOrg, isLocal );
-               rdetailBuildBrowseInfo( rowNode, arr[1], isLocal );
+               rdetailBuildBrowseInfo( rowNode, arr[1], isLocal, thisOrg );
 
                if( i == summary.length - 1 && !defaultCN) defaultCN = arr[1];
        }
@@ -484,7 +541,7 @@ function rdetailDrawNotes(r) {
        if(found) unHideMe($('rdetail_viewnotes_link'));
 }
 
-function rdetailBuildBrowseInfo(row, cn, local) {
+function rdetailBuildBrowseInfo(row, cn, local, orgNode) {
        /* used for building the shelf browser */
        if(local) {
                var cache = callnumberCache[cn];
@@ -494,8 +551,15 @@ function rdetailBuildBrowseInfo(row, cn, local) {
 
        var depth = getDepth();
        if( !local ) depth = findOrgDepth(globalOrgTree);
+
+       /*
        var a = elem("a", {href:'javascript:rdetailShowCNBrowse("' + cn + '", "'+depth+'");' }, cn);
+       */
+
+       var a = elem("a", {href:'javascript:rdetailShowExtra('+
+               '"cn_details", {cn :"'+cn+'", depth:"'+depth+'", org:"'+orgNode.id()+'"});' }, cn);
        addCSSClass(a, 'classic_link');
+
        findNodeByName( row, config.names.rdetail.cn_cell ).appendChild(a);
 }
 
index c6071fc..dadafb3 100644 (file)
                                                class='classic_link'>MARC Record</a>
                                </td>
 
+                               <td id='rdetail_cn_details_link' class='hide_me rdetail_extras_td'
+                                       style='padding-right: 15px; padding-left: 15px;' >
+                                       <a href='javascript:rdetailShowExtra("cn_details");' 
+                                               class='classic_link'>Call Number Details</a>
+                               </td>
+
 
                        </tr>
                </thead>
@@ -80,6 +86,7 @@
                </div>
 
                <!--#include virtual="rdetail_notes.xml"-->
+               <!--#include virtual="rdetail_cn_details.xml"-->
 
        </div>
 </div>