From 40d7d659dd6f613b9754fdade15f70bd9ffaea62 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 3 Jan 2006 23:41:02 +0000 Subject: [PATCH] callnumber browse is closer it now has it's own link on the details page TODO: sort on number of times a given cn is shown, when a user clicks on a callnumber that is not in this "depth", expand the callnumber retrieval depth. git-svn-id: svn://svn.open-ils.org/ILS/trunk@2596 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/opac/skin/default/js/cn_browse.js | 15 ++---- Open-ILS/web/opac/skin/default/js/rdetail.js | 49 +++++++++++++++++-- .../default/xml/rdetail/rdetail_extras.xml | 17 ++++++- 3 files changed, 63 insertions(+), 18 deletions(-) diff --git a/Open-ILS/web/opac/skin/default/js/cn_browse.js b/Open-ILS/web/opac/skin/default/js/cn_browse.js index 856a92d48f..aaa33768f0 100644 --- a/Open-ILS/web/opac/skin/default/js/cn_browse.js +++ b/Open-ILS/web/opac/skin/default/js/cn_browse.js @@ -7,7 +7,6 @@ var MAX_CN = 9; function cnBrowseGo(cn) { cnBrowseCurrent = cn; - //unHideMe($('cn_browse_loading')); var req = new Request( FETCH_CNBROWSE_TARGET, 'org_unit', getLocation(), 'depth', getDepth(), @@ -18,7 +17,6 @@ function cnBrowseGo(cn) { } function cnBrowseNext() { - //unHideMe($('cn_browse_loading')); var req = new Request( FETCH_CNBROWSE_NEXT, 'org_unit', getLocation(), 'depth', getDepth(), @@ -30,7 +28,6 @@ function cnBrowseNext() { } function cnBrowsePrev() { - //unHideMe($('cn_browse_loading')); var req = new Request( FETCH_CNBROWSE_PREV, 'org_unit', getLocation(), 'depth', getDepth(), @@ -79,15 +76,9 @@ function cnBrowseDraw( r ) { } */ - if( idx == 0 ) { - cnBrowseTopCn = label; - cnBrowseTopId = id; - //alert('top cn: ' + cnBrowseTopCn + ' : top id : ' + cnBrowseTopId ); - } else { - cnBrowseBottomCn = label; - cnBrowseBottomId = id; - //alert('bottom cn: ' + cnBrowseBottomCn + ' : bottom id : ' + cnBrowseBottomId ); - } + if( idx == 0 ) { cnBrowseTopCn = label; cnBrowseTopId = id; } + cnBrowseBottomCn = label; + cnBrowseBottomId = id; var cn_td = $n(currentTd, 'cn_browse_cn'); var lib_td = $n(currentTd, 'cn_browse_lib'); diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index 9a49d895d9..027b2224b0 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -12,6 +12,8 @@ var copyRowParent = null; var copyRow = null; var statusRow = null; var numStatuses = null; +var defaultCN; +var callnumberCache = {}; function rdetailDraw() { @@ -114,7 +116,7 @@ function rdetailShowExtra(type) { hideMe($('rdetail_toc_div')); hideMe($('rdetail_marc_div')); hideMe($('cn_browse')); - hideMe($('rdetail_viewcn_link')); + hideMe($('rdetail_cn_browse_div')); var req; switch(type) { @@ -151,10 +153,33 @@ function rdetailShowExtra(type) { req.callback(rdetailViewMarc); req.send(); break; + + case 'cn': + unHideMe($('rdetail_cn_browse_div')); + rdetailShowCNBrowse(defaultCN); + break; } } +function rdetailBuildCNList() { + var select = $('cn_browse_selector'); + var index = 0; + for( var cn in callnumberCache ) { + var opt = new Option(cn); + opt.onclick = rdetailGatherCN; + select.options[index++] = opt; + } +} + +function rdetailGatherCN() { + var cn = getSelectorVal($('cn_browse_selector')); + rdetailShowCNBrowse( cn ); +} + + function rdetailShowCNBrowse( cn ) { + if(!cn) return; + rdetailBuildCNList(); hideMe($('rdetail_copy_info_div')); hideMe($('rdetail_reviews_div')); hideMe($('rdetail_toc_div')); @@ -240,6 +265,7 @@ function _rdetailRows(node) { } /* walk through the copy info and build rows where necessary */ +var localCNFound = false; function _rdetailBuildInfoRows(r) { _rdetailRows(); @@ -269,22 +295,35 @@ function _rdetailBuildInfoRows(r) { } else rowNode.setAttribute("used", "1"); - //var a = elem("a", {href:'javascript:cnBrowseGo("' + arr[1] + '");' }, arr[1]); var a = elem("a", {href:'javascript:rdetailShowCNBrowse("' + arr[1] + '");' }, arr[1]); addCSSClass(a, 'classic_link'); findNodeByName( rowNode, config.names.rdetail.cn_cell ).appendChild(a); - //findNodeByName( rowNode, config.names.rdetail.cn_cell ).appendChild(text(arr[1])); - var cpc_temp = rowNode.removeChild( findNodeByName(rowNode, config.names.rdetail.cp_count_cell)); rdetailApplyStatuses(rowNode, cpc_temp, arr[2]); var isLocal = false; - if( orgIsMine( findOrgUnit(getLocation()), thisOrg ) ) { found = true; isLocal = true; } + if( orgIsMine( findOrgUnit(getLocation()), thisOrg ) ) { + found = true; + isLocal = true; + if(!localCNFound) { + localCNFound = true; + defaultCN = arr[1]; + } + } rdetailSetPath( thisOrg, isLocal ); + /* used for building the shelf browser */ + var cache = callnumberCache[arr[1]]; + if( cache ) { + cache.count++; + if(isLocal) cache.local = true; + } else { callnumberCache[arr[1]] = { count : 1, local : false };} + + if( i == summary.length - 1 && !defaultCN) defaultCN = arr[1]; + } if(!found) unHideMe(G.ui.rdetail.cp_info_none); diff --git a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml index 0dc97747c5..5122a23805 100644 --- a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml +++ b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml @@ -33,10 +33,18 @@ class='classic_link'>MARC Record + + + + Shelf Browser + @@ -60,7 +68,14 @@
- +
+
+ +
+ + +
-- 2.43.2