</td>
</tr>
+ <tr name="local_callnumber_list" class="result_table_title_cell">
+ <td class='rdetail_desc'>
+ Copy Availability
+ </td>
+ <td class='rdetail_item'>
+ <span type='opac/slot-data+holdings_xml-full' query='volumes'>
+ <span class='hide_me' debug='true' type='opac/slot-format'><![CDATA[
+ var output = dojo.create('span');
+
+ var item_cnt = 0;
+ var max_items = 0;
+ var max_lines = 3;
+ var copySummaryObj = new Object();
+ var count_copies_unavail = 0;
+ var count_copies_avail = 0;
+
+ dojo.query('volume', item).forEach(function(vol) {
+ //if (item_cnt >= max_items) {
+ // return output.innerHTML;
+ //}
+ if (vol.getAttribute('deleted') == 't') {
+ return;
+ }
+ if (vol.getAttribute('opac_visible') == 'f') {
+ return;
+ }
+ dojo.query('uri', vol).forEach(function (uri) {
+ var urihref = uri.getAttribute('href');
+ var urilabel = uri.getAttribute('label');
+ if (urihref.substring(0,20) == "http://via.tadl.org/") {
+ var uri_entry = dojo.create('div', {"style":"padding-bottom: 5px;"});
+ var link = dojo.create('a', {"class":"css_button", "href": urihref}, uri_entry);
+ if (urilabel.substring(0,7) == "http://") {
+ // Provide a default label if label appears to be a URL
+ urilabel = "Connect to this resource online";
+ }
+ var link_text = dojo.doc.createTextNode(urilabel);
+ link.appendChild(link_text);
+ output.appendChild(uri_entry);
+ }
+ });
+ dojo.query('copy', vol).forEach(function (cp) {
+ var cp_status;
+ var cp_location;
+ var cp_circ_lib;
+ //if (item_cnt >= max_items) {
+ // return;
+ //}
+ if (cp.getAttribute('deleted') == 't') {
+ return;
+ }
+ if (cp.getAttribute('opac_visible') == 'f') {
+ return;
+ }
+
+ /* Ensure the status is visible */
+ var visible_status;
+ dojo.query('status', cp).forEach(function (status) {
+ visible_status = status.getAttribute('opac_visible');
+ cp_status = status;
+ });
+ if (visible_status == 'f') {
+ return;
+ }
+
+ /* Ensure the circulation library is visible */
+ var lib_vis;
+ dojo.query('circ_lib', cp).forEach(function (circ_lib) {
+ lib_vis = circ_lib.getAttribute('opac_visible');
+ cp_circ_lib = circ_lib;
+ });
+ if (lib_vis != 't') {
+ return;
+ }
+
+ var loc_visible;
+ dojo.query('location', cp).forEach(function (location) {
+ loc_visible = location.getAttribute('opac_visible');
+ cp_location = location;
+ });
+ if (loc_visible != 't') {
+ return;
+ }
+ // at this point we have vol, cp_circ_lib, cp_location, cp_status
+ var status_id = cp_status.getAttribute('ident');
+ if (!(status_id in {0:1, 7:1, 109:1})) {
+ count_copies_unavail++;
+ return;
+ } else {
+ count_copies_avail++;
+ }
+ var libkey = cp_circ_lib.getAttribute('name');
+ var lockey = BT.textContent(cp_location);
+ var cnkey = vol.getAttribute('label');
+
+ if (!copySummaryObj[libkey]) {
+ copySummaryObj[libkey] = new Object();
+ }
+ if (!copySummaryObj[libkey][lockey]) {
+ copySummaryObj[libkey][lockey] = new Object();
+ }
+ if (!copySummaryObj[libkey][lockey][cnkey]) {
+ copySummaryObj[libkey][lockey][cnkey] = new Object();
+ copySummaryObj[libkey][lockey][cnkey]['count'] = 0;
+ }
+ copySummaryObj[libkey][lockey][cnkey]['count']++;
+
+ item_cnt++;
+ //if (item_cnt >= max_items) {
+ // dojo.create('br', null, cp_entry);
+ // cp_entry.appendChild(dojo.doc.createTextNode(opac_strings.MORE_COPIES_FULL_RECORD));
+ //}
+ //output.appendChild(cp_entry);
+ });
+ });
+ var numLibs = 0;
+ for (var lib in copySummaryObj) {
+ numLibs++;
+ }
+ if (numLibs == 0) { return; }
+ if (numLibs == 1) {
+ var lines_output = 0;
+ var sumdiv = dojo.create('div', { "style": "font-weight: bold;" });
+ // output the grouped-by-location summary
+ for (var sumlib in copySummaryObj) {
+ //output the "at lib"
+ var atlib = dojo.create('div', null, sumdiv);
+ atlib.appendChild(dojo.doc.createTextNode('At ' + sumlib));
+ for (var sumloc in copySummaryObj[sumlib]) {
+ for (var sumcn in copySummaryObj[sumlib][sumloc]) {
+ // available copies in each location, by cn label
+ if (max_lines && lines_output >= max_lines) {
+ var morediv = dojo.create('div', { "style": "font-weight: bold;" }, sumdiv);
+ morediv.appendChild(dojo.doc.createTextNode("additional copies available - click title for details"));
+ } else {
+ var sumcount = copySummaryObj[sumlib][sumloc][sumcn]['count'];
+ var summary_line = sumcount + ' available in ' + sumloc + ', call number ' + sumcn;
+ var locdiv = dojo.create('div', null, sumdiv);
+ locdiv.appendChild(dojo.doc.createTextNode(summary_line));
+ lines_output++;
+ }
+ }
+ }
+ }
+ output.appendChild(sumdiv);
+ } else {
+ // output the grouped-by-library summary
+ for (var libname in copySummaryObj) {
+ var copycount = 0;
+ for (var loc in copySummaryObj[libname]) {
+ for (var cn in copySummaryObj[libname][loc]) {
+ copycount = copycount + copySummaryObj[libname][loc][cn]['count'];
+ }
+ }
+ }
+ var libdiv = dojo.create('div');
+ var libcontent = dojo.create('span', { "style": "font-weight: bold;" });
+ var libtext = dojo.doc.createTextNode(copycount + ' available at ' + libname);
+ libcontent.appendChild(libtext);
+ libdiv.appendChild(libcontent);
+ output.appendChild(libdiv);
+ }
+ // display the count of unavailable items, if any
+ if (count_copies_unavail > 0) {
+ other_or_null = (count_copies_avail > 0) ? 'other ' : ' ';
+ item_or_items = (count_copies_unavail > 1) ? 'items' : 'item';
+ output.appendChild(
+ dojo.doc.createTextNode(
+ count_copies_unavail + " " + other_or_null + item_or_items + " not currently available"
+ )
+ );
+ }
+ return output.innerHTML;
+ ]]></span>
+ </span>
+
+ </td>
+ </tr> <!-- end callnumber list -->
+
<tr id='rdetail_hold_count_row' class=''>
<td nowrap='nowrap' class='rdetail_desc'>Current Holds</td>
<td class='rdetail_item' id='rdetail_hold_count'> </td>