detachAllEvt('common', 'run');
attachEvt("common", "run", rdetailDraw);
-attachEvt("rdetail", "recordDrawn", rdetailBuildStatusColumns);
attachEvt("rdetail", "recordDrawn", rdetailBuildInfoRows);
attachEvt("rdetail", "recordDrawn", rdetailGetPageIds);
var rdetailEnd = null;
var mfhdDetails = [];
-var orgHiding = false;
if(location.href.match(/&place_hold=1/)) {
// prevent load flicker between canvases
attachEvt('common','holdUpdated', rdetailReload);
attachEvt('common','holdUpdateCanceled', rdetailReload);
- copyRowParent = G.ui.rdetail.cp_info_row.parentNode;
- copyRow = copyRowParent.removeChild(G.ui.rdetail.cp_info_row);
- statusRow = G.ui.rdetail.cp_status.parentNode;
- statusRow.id = '__rdsrow';
-
- G.ui.rdetail.cp_info_local.onclick = rdetailShowLocalCopies;
- G.ui.rdetail.cp_info_all.onclick = rdetailShowAllCopies;
-
- if(getLocation() == globalOrgTree.id())
- hideMe(G.ui.rdetail.cp_info_all);
-
if(getRid()) {
var req = new Request(FETCH_RMODS, getRid());
}
}
-
-
-function rdetailShowLocalCopies() {
- rdetailShowLocal = true;
- rdetailBuildInfoRows();
- hideMe(G.ui.rdetail.cp_info_local);
- unHideMe(G.ui.rdetail.cp_info_all);
- hideMe(G.ui.rdetail.cp_info_none);
-}
-
-function rdetailShowAllCopies() {
-
- rdetailShowLocal = false;
- rdetailBuildInfoRows();
- hideMe(G.ui.rdetail.cp_info_all);
- unHideMe(G.ui.rdetail.cp_info_local);
- hideMe(G.ui.rdetail.cp_info_none);
-}
-
function OpenMarcEditWindow(pcrud, rec) {
/*
To run in Firefox directly, must set signed.applets.codebase_principal_support
hideMe($('rdetail_place_hold'));
hideMe($('rdetail_copy_info_link'));
hideMe($('rdetail_viewcn_link'));
- hideMe($('rdetail_copy_info_div'));
}
}
for( var i = 0; links && links.length > 0 && i < links.length; i = i + 3 ) {
var rdetailForeignItemsFetched = false;
function rdetailShowExtra(type, args) {
- hideMe($('rdetail_copy_info_div'));
hideMe($('rdetail_summary_div'));
hideMe($('rdetail_reviews_div'));
hideMe($('rdetail_toc_div'));
switch(type) {
case "copyinfo":
- unHideMe($('rdetail_copy_info_div'));
addCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected');
break;
unHideMe($('rdetail_cn_browse_select_div'));
rdetailBuildCNList();
setSelector( $('cn_browse_selector'), js2JSON(cn) );
- hideMe($('rdetail_copy_info_div'));
hideMe($('rdetail_reviews_div'));
hideMe($('rdetail_summary_div'));
hideMe($('rdetail_toc_div'));
req.send();
}
-function _rdetailRows(node) {
-
- if( rdetailShowLocal && getLocation() != globalOrgTree.id() ) {
- var loc = findOrgUnit(getLocation());
- if( node ) {
- if( !orgIsMine(node, loc) && !orgIsMine(loc,node) ) return;
- } else {
- var kids = globalOrgTree.children();
- if (kids) {
- for( var i = 0; i < kids.length; i++ ) {
- var org = findOrgUnit(kids[i]);
- if( orgIsMine(org, loc) ) {
- node = org;
- break;
- }
- }
- }
- }
- }
-
- if(!node && findOrgType(globalOrgTree.ou_type()).can_have_vols())
- node = globalOrgTree;
-
-
- /* don't show hidden orgs */
-
- if(node) {
-
- if(!isXUL() && !isTrue(node.opac_visible())) return;
-
- if (orgHiding) {
- if (isTrue( findOrgType(node.ou_type()).can_have_vols() )) {
- if ( ! orgIsMine( orgHiding.org, node, orgHiding.depth ) ) {
- return;
- }
- }
- }
-
- var row = copyRow.cloneNode(true);
- row.id = "cp_info_" + node.id();
-
- var libtd = findNodeByName( row, config.names.rdetail.lib_cell );
- var cntd = findNodeByName( row, config.names.rdetail.cn_cell );
- var cpctd = findNodeByName( row, config.names.rdetail.cp_count_cell );
- var actions = $n(row, 'rdetail_actions_cell');
-
- var p = libtd.getElementsByTagName('a')[0];
- libtd.insertBefore(text(node.name()), p);
- libtd.setAttribute("style", "padding-left: " + ((findOrgDepth(node) - 1) * 9) + "px;");
-
- if(!findOrgType(node.ou_type()).can_have_vols()) {
-
- row.removeChild(cntd);
- row.removeChild(cpctd);
- row.removeChild(actions);
- row.setAttribute('novols', '1');
-
- libtd.setAttribute("colspan", numStatuses + 3 );
- libtd.colSpan = numStatuses + 3;
- addCSSClass(row, 'copy_info_region_row');
- }
-
- copyRowParent.appendChild(row);
-
- } else { node = globalOrgTree; }
-
- var kids = node.children();
- if (kids) {
- for( var c = 0; c < kids.length; c++ )
- _rdetailRows(kids[c]);
- }
-}
-
-function rdetailCNPrint(orgid, cn) {
- var div = cpdBuildPrintWindow( record, orgid);
- var template = div.removeChild($n(div, 'cnrow'));
- var rowNode = $("cp_info_" + orgid);
- cpdStylePopupWindow(div);
- openWindow(div.innerHTML);
-}
-
var localCNFound = false;
var ctr = 0;
function _rdetailBuildInfoRows(r) {
- if (rdetailShowCopyLocation)
- unHideMe( $n( $('rdetail_copy_info_table'), 'rdetail_copylocation_header' ) );
-
- removeChildren(copyRowParent);
-
- orgHiding = checkOrgHiding();
-
- _rdetailRows();
-
var summary = r.getResultObject();
if(!summary) return;
var arr = summary[i];
globalCNCache[js2JSON([arr[1],arr[2],arr[3]])] = 1; // prefix, label, suffix. FIXME - Am I used anywhere?
var thisOrg = findOrgUnit(arr[0]);
- var rowNode = $("cp_info_" + thisOrg.id());
- if(!rowNode) continue;
-
- if(rowNode.getAttribute("used")) {
-
- if( rowNode.nextSibling ) {
- sib = rowNode.nextSibling;
- o ='cp_info_'+thisOrg.id()+'_';
- /* push the new row on as the last row for this org unit */
- while( sib && sib.id.match(o) ) {
- sib = sib.nextSibling;
- }
- if(sib)
- rowNode = copyRowParent.insertBefore(copyRow.cloneNode(true), sib);
- else
- rowNode = copyRowParent.appendChild(copyRow.cloneNode(true));
- } else {
- rowNode = copyRowParent.appendChild(copyRow.cloneNode(true));
- }
-
- var n = findNodeByName( rowNode, config.names.rdetail.lib_cell );
- n.appendChild(text(thisOrg.name()));
- n.setAttribute("style", "padding-left: " + ((findOrgDepth(thisOrg) - 1) * 9) + "px;");
- rowNode.id = "cp_info_" + thisOrg.id() + '_' + (++ctr);
-
- } else {
- rowNode.setAttribute("used", "1");
- }
-
- var cpc_temp = rowNode.removeChild(
- findNodeByName(rowNode, config.names.rdetail.cp_count_cell));
-
- var statuses = arr[4];
- var cl = '';
- if (rdetailShowCopyLocation) {
- cl = arr[4];
- statuses = arr[5];
- }
-
-
- rdetailApplyStatuses(rowNode, cpc_temp, statuses);
var isLocal = false;
if( orgIsMine( findOrgUnit(getLocation()), thisOrg ) ) {
}
}
- //if(isLocal) unHideMe(rowNode);
- unHideMe(rowNode);
-
- rdetailSetPath( thisOrg, isLocal );
- rdetailBuildBrowseInfo( rowNode, [arr[1],arr[2],arr[3]], isLocal, thisOrg, cl );
+ rdetailBuildBrowseInfo( [arr[1],arr[2],arr[3]], isLocal, thisOrg, cl );
if( i == summary.length - 1 && !defaultCN) defaultCN = [arr[1],arr[2],arr[3]]; // prefix, label, suffix
}
- if(!found) unHideMe(G.ui.rdetail.cp_info_none);
}
-function rdetailBuildBrowseInfo(row, cn, local, orgNode, cl) {
+function rdetailBuildBrowseInfo(cn, local, orgNode, cl) {
var whole_cn_json = js2JSON(cn);
var whole_cn_text = (cn[0] ? cn[0] + ' ' : '') + cn[1] + (cn[2] ? ' ' + cn[2] : '');
else callnumberCache[whole_cn_json] = { count : 1 };
}
- var depth = getDepth();
- if( !local ) depth = findOrgDepth(globalOrgTree);
-
- $n(row, 'rdetail_callnumber_cell').appendChild(text(whole_cn_text));
-
- if (rdetailShowCopyLocation) {
- var cl_cell = $n(row, 'rdetail_copylocation_cell');
- cl_cell.appendChild(text(cl));
- unHideMe(cl_cell);
- }
-
- _debug('setting action clicks for cn ' + whole_cn_text);
-
- var dHref = 'javascript:rdetailVolumeDetails('+
- '{copy_location : "'+cl.replace(/\"/g, '\\"')+'", rowid : "'+row.id+'", cn_prefix :"'+cn[0].replace(/\"/g, '\\"')+'",cn :"'+cn[1].replace(/\"/g, '\\"')+'",cn_suffix :"'+cn[2].replace(/\"/g, '\\"')+'", depth:"'+depth+'", org:"'+orgNode.id()+'", local: '+local+'});';
-
- var bHref = 'javascript:rdetailShowCNBrowse("'+cn[1].replace(/\"/g, '\\"') + '", '+orgNode.id()+', "'+depth+'");';
-
- unHideMe( $n(row, 'details') )
- $n(row, 'details').setAttribute('href', dHref);
- unHideMe( $n(row, 'browse') )
- $n(row, 'browse').setAttribute('href', bHref);
-
- if(isXUL()) {
- unHideMe($n(row, 'hold_div'));
- $n(row, 'hold').onclick = function() {
- var req = new Request(FETCH_VOLUME_BY_INFO, cn, record.doc_id(), orgNode.id());
- req.callback(
- function(r) {
- var vol = r.getResultObject();
- holdsDrawEditor({type: 'V', volumeObject : vol});
- }
- );
- req.send();
- };
- }
-}
-
-// sets the path to org as 'active' and displays the path if it's local
-function rdetailSetPath(org, local) {
- if( findOrgDepth(org) == 0 ) return;
- var row = $("cp_info_" + org.id());
- row.setAttribute("hasinfo", "1");
- unHideMe(row);
- rdetailSetPath(findOrgUnit(org.parent_ou()), local);
-}
-
-//Append all the statuses for a given summary to the
-//copy summary table
-function rdetailApplyStatuses( row, template, statuses ) {
- for( var j in _statusPositions ) {
- var stat = _statusPositions[j];
- var val = statuses[stat.id()];
- var nn = template.cloneNode(true);
- if(val) nn.appendChild(text(val));
- else nn.appendChild(text(0));
- row.appendChild(nn);
- }
-}
-
-//Add one td (creating a new column) to the copy summary
-//table for each opac_visible copy status
-function rdetailBuildStatusColumns() {
-
- rdetailGrabCopyStatuses();
- var parent = statusRow;
- var template = parent.removeChild(G.ui.rdetail.cp_status);
-
- var i = 0;
- for( i = 0; i < cp_statuses.length; i++ ) {
-
- var c = cp_statuses[i];
- if( c && isTrue(c.opac_visible()) ) {
- var name = c.name();
- _statusPositions[i] = c;
- var node = template.cloneNode(true);
- var data = findNodeByName( node, config.names.rdetail.cp_status);
-
- data.appendChild(text(name));
- parent.appendChild(node);
- }
- }
-
- numStatuses = 0;
- for(x in _statusPositions) numStatuses++;
-}
-
-function rdetailGrabCopyStatuses() {
- if(cp_statuses) return cp_statuses;
- var req = new Request(FETCH_COPY_STATUSES);
- req.send(true);
- cp_statuses = req.result();
- cp_statuses = cp_statuses.sort(_rdetailSortStatuses);
-}
-
-function _rdetailSortStatuses(a, b) {
- return parseInt(a.id()) - parseInt(b.id());
}
/**
+++ /dev/null
-
-<!-- This holds information for copies attached to this record -->
-<div id='rdetail_copy_info_div' class='rdetail_extras_div'>
-
- <div style='width: 100%; text-align: center; padding-bottom: 5px;'>
- <span>
- <a href='javascript:void(0);' id='copy_info_local_link'
- class='rdetail_copy_nav_link hide_me classic_link'><b>&rdetail.copyInfo.local;</b></a>
- </span>
- <span width=''>
- <a href='javascript:void(0);' id='copy_info_all_link'
- class='rdetail_copy_nav_link classic_link'><b>&rdetail.copyInfo.all;</b></a>
- </span>
- </div>
-
- <table id='rdetail_copy_info_table' class='data_grid'>
- <thead>
-
- <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>
- </td>
- </tr>
-
- </thead>
- <tbody id='rdetail_copy_info_tbody'>
- <tr id='rdetail_copy_info_row' class='hide_me'>
- <td name='rdetail_library_cell'>
- <a name='lib_print_link' class='hide_me classic_link' style='font-size: 8pt; padding-left: 20px;'>
- &rdetail.copyInfo.print;
- </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;'
- name='details' class='hide_me classic_link'>&rdetail.copyInfo.details;</a>
- </div>
- <div style='margin-top: 2px;'>
- <a name='browse' style='font-size: 8pt;'
- class='hide_me classic_link'>&rdetail.copyInfo.browse;</a>
- </div>
- <div style='margin-top: 2px;' name='hold_div' class='hide_me'>
- <a name='hold' style='font-size: 8pt;' href='javascript:void(0);'
- class='classic_link'>&rdetail.copyInfo.hold;</a>
- </div>
- </td>
- <td nowrap='nowrap' class='rdetail_copy_count_cell vertical'
- name='rdetail_copy_count_cell'> </td>
- </tr>
-
- <tr id='rdetail_copy_info_loading'><td>&rdetail.loading;</td></tr>
-
- </tbody>
- </table>
-
- <!--
- <table class='hide_me'>
- <tbody>
- <tr style='border: 3px solid #E0E0E0;' id='rdetail_volume_details_row'><td colspan='10'></td></tr>
- </tbody>
- </table>
- -->
-
- <br/><br/>
-
- <div id='rdetail_copy_info_none' class='hide_me'>&rdetail.noneAvailable;</div>
-
- <script language='javascript' type='text/javascript'>
- config.ids.rdetail.cp_status = "rdetail_copy_info_status";
- config.ids.rdetail.cp_info_row = "rdetail_copy_info_row";
- config.ids.rdetail.cp_info_loading = "rdetail_copy_info_loading";
- config.ids.rdetail.cp_info_local = "copy_info_local_link";
- config.ids.rdetail.cp_info_all = "copy_info_all_link";
- config.ids.rdetail.cp_info_none = "rdetail_copy_info_none";
- config.names.rdetail.lib_cell = "rdetail_library_cell";
- config.names.rdetail.cn_cell = "rdetail_callnumber_cell";
- config.names.rdetail.cp_count_cell = "rdetail_copy_count_cell";
- config.names.rdetail.cp_status = 'rdetail_status_cell';
- </script>
-
-</div> <!-- copy info -->
-
-