From 107c8d224fdec30e3b37d8e9b26760c2c2b88bfa Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 20 Mar 2006 22:58:40 +0000 Subject: [PATCH 1/1] started working on the callnumber/copy details pane in the record details page git-svn-id: svn://svn.open-ils.org/ILS/trunk@3404 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/extras/fieldmapper.pl | 4 +- .../OpenILS/Application/Search/Biblio.pm | 36 ++++++++++ Open-ILS/web/opac/common/js/config.js | 2 + Open-ILS/web/opac/skin/default/js/rdetail.js | 70 ++++++++++++++++++- .../default/xml/rdetail/rdetail_extras.xml | 7 ++ 5 files changed, 114 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/extras/fieldmapper.pl b/Open-ILS/src/extras/fieldmapper.pl index 4684ff1500..1dac298e13 100755 --- a/Open-ILS/src/extras/fieldmapper.pl +++ b/Open-ILS/src/extras/fieldmapper.pl @@ -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 /; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm index 12a4340ccf..adf03c32e6 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm @@ -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' }); +} + + diff --git a/Open-ILS/web/opac/common/js/config.js b/Open-ILS/web/opac/common/js/config.js index bf515e2556..527c362996 100644 --- a/Open-ILS/web/opac/common/js/config.js +++ b/Open-ILS/web/opac/common/js/config.js @@ -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? */ /* ---------------------------------------------------------------------------- */ diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index 4f93c1f217..5c7550e9ef 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -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); } diff --git a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml index c6071fcc87..dadafb3e70 100644 --- a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml +++ b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml @@ -45,6 +45,12 @@ class='classic_link'>MARC Record + + Call Number Details + + @@ -80,6 +86,7 @@ + -- 2.43.2