callnumber browse is closer
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 3 Jan 2006 23:41:02 +0000 (23:41 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 3 Jan 2006 23:41:02 +0000 (23:41 +0000)
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

Open-ILS/web/opac/skin/default/js/cn_browse.js
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_extras.xml

index 856a92d..aaa3376 100644 (file)
@@ -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');
index 9a49d89..027b222 100644 (file)
@@ -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);
index 0dc9774..5122a23 100644 (file)
                                                class='classic_link'>MARC Record</a>
                                </td>
 
+                               <!--
                                <td id='rdetail_viewcn_link' class='rdetail_extras_td hide_me'
                                        style='padding-right: 15px; padding-left: 15px;' >
                                        <span>Shelf Browser</span>
                                </td>
+                               -->
+
+                               <td id='rdetail_viewcn_link' class='rdetail_extras_td'
+                                       style='padding-right: 15px; padding-left: 15px;' >
+                                       <a href='javascript:rdetailShowExtra("cn");' 
+                                               class='classic_link'>Shelf Browser</a>
+                               </td>
 
                        </tr>
                </thead>
                        <div id='rdetail_view_marc_box'> </div>
                </div>
 
-               <!--#include virtual="../common/cn_browse.xml"-->
+               <div id='rdetail_cn_browse_div' style='text-align: center;' class='hide_me'>
+                       <div style='width: 100%; border: 1px solid black; padding: 10px; margin-top: 5px;'>
+                               <select id='cn_browse_selector'>
+                               </select>
+                       </div>
+                       
+                       <!--#include virtual="../common/cn_browse.xml"-->
+               </div>
 
        </div>
 </div>