add copy location display based on switch
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 11 Nov 2008 03:59:03 +0000 (03:59 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 11 Nov 2008 03:59:03 +0000 (03:59 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@11128 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/locale/en-US/opac.dtd
Open-ILS/web/opac/skin/default/js/copy_details.js
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_copyinfo.xml

index 6e83b52..a51c1e3 100644 (file)
@@ -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, <status1_count>, <status2_cout>,...]
+               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");
index c77f40e..38d8886 100644 (file)
@@ -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";
index 5335f27..4c57def 100644 (file)
@@ -513,6 +513,7 @@ We recommend that you remove this title from any bookbags it may have been added
 <!ENTITY rdetail.copyInfo.headerLabel "Copy Information">
 <!ENTITY rdetail.copyInfo.library "Library">
 <!ENTITY rdetail.copyInfo.callnumber "Callnumber">
+<!ENTITY rdetail.copyInfo.copylocation "Copy Location">
 <!ENTITY rdetail.copyInfo.local "View Copy Information for this location only">
 <!ENTITY rdetail.copyInfo.all "View copy information for all libraries">
 <!ENTITY rdetail.copyInfo.actions "Actions">
index 1e400e2..762b13e 100644 (file)
@@ -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()));
index 5fba851..38a859f 100644 (file)
@@ -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+'");'; 
 
index facdf79..c2f5341 100644 (file)
@@ -23,6 +23,7 @@
                        <tr>
                                <td  class='rdetail_copy_info_header_cell'>&rdetail.copyInfo.library;</td>
                                <td  class='rdetail_copy_info_header_cell'>&rdetail.copyInfo.callnumber;</td>
+                               <td  name='rdetail_copylocation_header' class='rdetail_copy_info_header_cell hide_me'>&rdetail.copyInfo.copylocation;</td>
                                <td  class='rdetail_copy_info_header_cell'>&rdetail.copyInfo.actions;</td>
                                <td  nowrap='nowrap' class='rdetail_copy_info_header_cell' id='rdetail_copy_info_status'> 
                                        <div name='rdetail_status_cell'> </div>
@@ -38,6 +39,7 @@
                                        </a>
                                </td>
                                <td name='rdetail_callnumber_cell'> </td>
+                               <td class="hide_me" name='rdetail_copylocation_cell'> </td>
                                <td name='rdetail_actions_cell'> 
                                        <div style='padding-bottom: 1px;'>
                                                <a style='font-size: 8pt;'