From 46239a4141cdae73a56d8ec5370801a2289345a6 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Mon, 11 Apr 2011 21:34:07 -0400 Subject: [PATCH] Pass peer types around to be surfaced next to foreign copies --- Open-ILS/web/opac/skin/default/js/copy_details.js | 17 ++++++++++++++--- Open-ILS/web/opac/skin/default/js/rdetail.js | 4 ++++ 2 files changed, 18 insertions(+), 3 deletions(-) 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 c94d010ea2..50361b6641 100644 --- a/Open-ILS/web/opac/skin/default/js/copy_details.js +++ b/Open-ILS/web/opac/skin/default/js/copy_details.js @@ -9,7 +9,7 @@ var showDueDate = false; */ var showDueTime = false; -function cpdBuild( contextTbody, contextRow, record, callnumber, orgid, depth, copy_location, already_fetched_copies ) { +function cpdBuild( contextTbody, contextRow, record, callnumber, orgid, depth, copy_location, already_fetched_copies, peer_types ) { var i = cpdCheckExisting(contextRow); if(i) return i; @@ -51,6 +51,7 @@ function cpdBuild( contextTbody, contextRow, record, callnumber, orgid, depth, c var extrasRow = mainTbody.removeChild($n(mainTbody, 'copy_extras_row')); var request_args = { + peer_types : peer_types, /* indexed the same as already_fetched_copies */ contextTbody : contextTbody, /* tbody that holds the contextrow */ contextRow : contextRow, /* the row our new row will be inserted after */ record : record, @@ -213,6 +214,7 @@ function cpdDrawCopies(r) { for( var i = 0; i < copies.length; i++ ) { var row = copyrow.cloneNode(true); var copyid = copies[i]; + var pt; if (args.peer_types) pt = args.peer_types[i]; if (typeof copyid != 'object') { var req = new Request(FETCH_FLESHED_COPY, copyid); req.callback(cpdDrawCopy); @@ -221,15 +223,16 @@ function cpdDrawCopies(r) { req.send(); } else { setTimeout( - function(copy,row) { + function(copy,row,pt) { return function() { cpdDrawCopy({ 'getResultObject' : function() { return copy; }, 'args' : r.args, + 'peer_type' : pt, 'row' : row }); }; - }(copies[i],row), 0 + }(copies[i],row,pt), 0 ); } copytbody.appendChild(row); @@ -239,6 +242,7 @@ function cpdDrawCopies(r) { function cpdDrawCopy(r) { var copy = r.getResultObject(); var row = r.row; + var pt = r.peer_type; var trow = r.args.templateRow; if (r.args.copy_location && copy.location().name() != r.args.copy_location) { @@ -247,6 +251,12 @@ function cpdDrawCopy(r) { } var b = $n(row, 'barcode').appendChild(text(copy.barcode())); + + /* show the peer type*/ + if (pt) { + $n(row, 'barcode').appendChild(text(' :: ' + pt)); + } + $n(row, 'location').appendChild(text(copy.location().name())); $n(row, 'status').appendChild(text(copy.status().name())); @@ -275,6 +285,7 @@ function cpdDrawCopy(r) { } l.setAttribute('href',buildOPACLink(link_args)); } + if(isXUL()) { /* show the hold link */ var l = $n(row, 'copy_hold_link'); diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index 1f960fd360..8197318834 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -282,6 +282,10 @@ function rdetailForeignItems(r,id) { dojo.map( robj[idx].foreign_copy_maps(), function(x){ return x.target_copy(); } + ), + dojo.map( + robj[idx].foreign_copy_maps(), + function(x){ return x.peer_type().name(); } ) ); }; -- 2.11.0