From 57460bd6560e3def5e35d9b81c3fa98aedf6d0f4 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 11 Nov 2008 03:59:03 +0000 Subject: [PATCH] add copy location display based on switch git-svn-id: svn://svn.open-ils.org/ILS/trunk@11128 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Search/Biblio.pm | 20 +++++++++++++++++ Open-ILS/web/opac/common/js/config.js | 1 + Open-ILS/web/opac/locale/en-US/opac.dtd | 1 + Open-ILS/web/opac/skin/default/js/copy_details.js | 8 ++++++- Open-ILS/web/opac/skin/default/js/rdetail.js | 26 +++++++++++++++++----- .../skin/default/xml/rdetail/rdetail_copyinfo.xml | 2 ++ 6 files changed, 51 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm index 6e83b52c90..a51c1e361b 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm @@ -1330,6 +1330,26 @@ sub copy_count_summary { } __PACKAGE__->register_method( + method => "copy_location_count_summary", + api_name => "open-ils.search.biblio.copy_location_counts.summary.retrieve", + notes => <<" NOTES"); + returns an array of these: + [ org_id, callnumber_label, copy_location, , ,...] + where statusx is a copy status name. the statuses are sorted + by id. + NOTES + +sub copy_location_count_summary { + my( $self, $client, $rid, $org, $depth ) = @_; + $org ||= 1; + $depth ||= 0; + my $data = $U->storagereq( + 'open-ils.storage.biblio.record_entry.status_copy_location_count.atomic', $rid, $org, $depth ); + + return [ sort { $a->[1] cmp $b->[1] || $a->[2] cmp $b->[2] } @$data ]; +} + +__PACKAGE__->register_method( method => "copy_count_location_summary", api_name => "open-ils.search.biblio.copy_counts.location.summary.retrieve", notes => <<" NOTES"); diff --git a/Open-ILS/web/opac/common/js/config.js b/Open-ILS/web/opac/common/js/config.js index c77f40e2c0..38d8886f2f 100644 --- a/Open-ILS/web/opac/common/js/config.js +++ b/Open-ILS/web/opac/common/js/config.js @@ -305,6 +305,7 @@ var LOGIN_DELETE = "open-ils.auth:open-ils.auth.session.delete"; var FETCH_USER_PREFS = "open-ils.actor:open-ils.actor.patron.settings.retrieve"; var UPDATE_USER_PREFS = "open-ils.actor:open-ils.actor.patron.settings.update"; var FETCH_COPY_STATUSES = "open-ils.search:open-ils.search.config.copy_status.retrieve.all"; +var FETCH_COPY_LOCATION_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_location_counts.summary.retrieve"; var FETCH_COPY_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_counts.summary.retrieve"; //var FETCH_COPY_COUNTS_SUMMARY = "open-ils.search:open-ils.search.biblio.copy_counts.location.summary.retrieve"; var FETCH_MARC_HTML = "open-ils.search:open-ils.search.biblio.record.html"; diff --git a/Open-ILS/web/opac/locale/en-US/opac.dtd b/Open-ILS/web/opac/locale/en-US/opac.dtd index 5335f273c4..4c57defb6f 100644 --- a/Open-ILS/web/opac/locale/en-US/opac.dtd +++ b/Open-ILS/web/opac/locale/en-US/opac.dtd @@ -513,6 +513,7 @@ We recommend that you remove this title from any bookbags it may have been added + diff --git a/Open-ILS/web/opac/skin/default/js/copy_details.js b/Open-ILS/web/opac/skin/default/js/copy_details.js index 1e400e25e2..762b13ee18 100644 --- a/Open-ILS/web/opac/skin/default/js/copy_details.js +++ b/Open-ILS/web/opac/skin/default/js/copy_details.js @@ -2,7 +2,7 @@ var cpdTemplate; var cpdCounter = 0; var cpdNodes = {}; -function cpdBuild( contextTbody, contextRow, record, callnumber, orgid, depth ) { +function cpdBuild( contextTbody, contextRow, record, callnumber, orgid, depth, copy_location ) { var i = cpdCheckExisting(contextRow); if(i) return i; @@ -48,6 +48,7 @@ var i = cpdCheckExisting(contextRow); orgid : orgid, depth : depth, templateRow : templateRow, /* contains everything */ + copy_location : copy_location, mainTbody : mainTbody, /* holds the copy rows */ extrasRow : extrasRow, /* wrapper row for all extras */ counter : counter @@ -195,6 +196,11 @@ function cpdDrawCopy(r) { var copy = r.getResultObject(); var row = r.row; + if (r.args.copy_location && copy.location().name() != r.args.copy_location) { + hideMe(row); + return; + } + $n(row, 'barcode').appendChild(text(copy.barcode())); $n(row, 'location').appendChild(text(copy.location().name())); $n(row, 'status').appendChild(text(copy.status().name())); diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index 5fba8515ae..38a859f07f 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -23,6 +23,7 @@ var localTOC; var cachedRecords; var rdetailShowLocal = true; +var rdetailShowCopyLocation = true; @@ -412,7 +413,7 @@ function rdetailShowExtra(type, args) { function rdetailVolumeDetails(args) { var row = $(args.rowid); var tbody = row.parentNode; - cpdBuild( tbody, row, record, args.cn, args.org, args.depth ); + cpdBuild( tbody, row, record, args.cn, args.org, args.depth, args.copy_location ); return; } @@ -521,10 +522,14 @@ function rdetailShowTOC(r) { function rdetailBuildInfoRows() { var req; + var method = FETCH_COPY_COUNTS_SUMMARY; + if (rdetailShowCopyLocation) + method = FETCH_COPY_LOCATION_COUNTS_SUMMARY; + if( rdetailShowLocal ) - req = new Request(FETCH_COPY_COUNTS_SUMMARY, record.doc_id(), getLocation(), getDepth()) + req = new Request(method, record.doc_id(), getLocation(), getDepth()) else - req = new Request(FETCH_COPY_COUNTS_SUMMARY, record.doc_id()); + req = new Request(method, record.doc_id()); req.callback(_rdetailBuildInfoRows); req.send(); } @@ -664,8 +669,11 @@ function _rdetailBuildInfoRows(r) { //if(isLocal) unHideMe(rowNode); unHideMe(rowNode); + if (rdetailShowCopyLocation) + unHideMe( $n( $('rdetail_copy_info_table'), 'rdetail_copylocation_header') ); + rdetailSetPath( thisOrg, isLocal ); - rdetailBuildBrowseInfo( rowNode, arr[1], isLocal, thisOrg ); + rdetailBuildBrowseInfo( rowNode, arr[1], isLocal, thisOrg, arr[2] ); if( i == summary.length - 1 && !defaultCN) defaultCN = arr[1]; } @@ -674,7 +682,7 @@ function _rdetailBuildInfoRows(r) { } -function rdetailBuildBrowseInfo(row, cn, local, orgNode) { +function rdetailBuildBrowseInfo(row, cn, local, orgNode, cl) { if(local) { var cache = callnumberCache[cn]; @@ -687,10 +695,16 @@ function rdetailBuildBrowseInfo(row, cn, local, orgNode) { $n(row, 'rdetail_callnumber_cell').appendChild(text(cn)); + if (rdetailShowCopyLocation) { + var cl_cell = $n(row, 'rdetail_copylocation_cell'); + cl_cell.appendChild(text(cl)); + unHideMe(cl_cell); + } + _debug('setting action clicks for cn ' + cn); var dHref = 'javascript:rdetailVolumeDetails('+ - '{rowid : "'+row.id+'", cn :"'+cn+'", depth:"'+depth+'", org:"'+orgNode.id()+'", local: '+local+'});'; + '{copy_location : "'+cl+'", rowid : "'+row.id+'", cn :"'+cn+'", depth:"'+depth+'", org:"'+orgNode.id()+'", local: '+local+'});'; var bHref = 'javascript:rdetailShowCNBrowse("' + cn + '", '+orgNode.id()+', "'+depth+'");'; diff --git a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_copyinfo.xml b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_copyinfo.xml index facdf79e54..c2f5341b52 100644 --- a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_copyinfo.xml +++ b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_copyinfo.xml @@ -23,6 +23,7 @@ &rdetail.copyInfo.library; &rdetail.copyInfo.callnumber; + &rdetail.copyInfo.copylocation; &rdetail.copyInfo.actions;
@@ -38,6 +39,7 @@ +