Remove copy info matrix from rdetail page
authorJeff Godin <jgodin@tadl.org>
Sun, 15 Apr 2012 03:07:12 +0000 (23:07 -0400)
committerJeff Godin <jgodin@tadl.org>
Sun, 15 Apr 2012 03:07:12 +0000 (23:07 -0400)
Removing copy info matrix.

Next up: bibtemplate-style copy information to replace
copy info matrix.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/web/opac/skin/tadlv3/js/rdetail.js
Open-ILS/web/opac/skin/tadlv3/xml/rdetail/rdetail_copyinfo.xml [deleted file]
Open-ILS/web/opac/skin/tadlv3/xml/rdetail/rdetail_extras.xml

index beb5321..db7e25a 100644 (file)
@@ -3,7 +3,6 @@
 
 detachAllEvt('common', 'run');
 attachEvt("common", "run", rdetailDraw);
-attachEvt("rdetail", "recordDrawn", rdetailBuildStatusColumns);
 attachEvt("rdetail", "recordDrawn", rdetailBuildInfoRows);
 attachEvt("rdetail", "recordDrawn", rdetailGetPageIds);
 
@@ -44,7 +43,6 @@ var rdetailStart = null;
 var rdetailEnd = null;
 
 var mfhdDetails = [];
-var orgHiding = false;
 
 if(location.href.match(/&place_hold=1/)) {
     // prevent load flicker between canvases
@@ -139,17 +137,6 @@ function rdetailDraw() {
        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());
@@ -297,25 +284,6 @@ function rdetailForeignItems(r,id) {
     }
 }
 
-
-
-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
@@ -514,7 +482,6 @@ function _rdetailDraw(r) {
             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 ) {
@@ -755,7 +722,6 @@ var rdetailMarcFetched = false;
 var rdetailForeignItemsFetched = false;
 function rdetailShowExtra(type, args) {
 
-       hideMe($('rdetail_copy_info_div'));
        hideMe($('rdetail_summary_div'));
        hideMe($('rdetail_reviews_div'));
        hideMe($('rdetail_toc_div'));
@@ -785,7 +751,6 @@ function rdetailShowExtra(type, args) {
        switch(type) {
 
                case "copyinfo": 
-                       unHideMe($('rdetail_copy_info_div')); 
                        addCSSClass($('rdetail_copy_info_link'), 'rdetail_extras_selected');
                        break;
 
@@ -904,7 +869,6 @@ function rdetailShowCNBrowse( cn, loc, depth, fromOnclick ) {
        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'));
@@ -985,100 +949,10 @@ function rdetailBuildInfoRows() {
        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;
 
@@ -1088,47 +962,6 @@ function _rdetailBuildInfoRows(r) {
                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 ) ) { 
@@ -1140,19 +973,14 @@ function _rdetailBuildInfoRows(r) {
                        }
                }
 
-               //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] : '');
@@ -1163,103 +991,6 @@ function rdetailBuildBrowseInfo(row, cn, local, orgNode, cl) {
                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());
 }
 
 /**
diff --git a/Open-ILS/web/opac/skin/tadlv3/xml/rdetail/rdetail_copyinfo.xml b/Open-ILS/web/opac/skin/tadlv3/xml/rdetail/rdetail_copyinfo.xml
deleted file mode 100644 (file)
index 01e463b..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-
-<!-- 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 -->
-
-
index 47382b6..c9f563e 100644 (file)
@@ -4,12 +4,6 @@
        <table class='rdetails_extra_links'>
                <thead>
                        <tr>
-                               <td id='rdetail_copy_info_link' class='rdetail_extras_td rdetail_extras_selected' 
-                                       style='padding-right: 15px; padding-left: 15px;' >
-                                       <a href='javascript:rdetailShowExtra("copyinfo");' 
-                                               class='classic_link'>&rdetail.extras.summary;</a>
-                               </td>
-
                                <td id='rdetail_viewcn_link' class='rdetail_extras_td'
                                        style='padding-right: 15px; padding-left: 15px;' >
                                        <a href='javascript:rdetailShowExtra("cn");' 
@@ -83,7 +77,6 @@
        <div id='rdetail_extras_div' style='width: 95%;'> 
                <div id='rdetail_extras_loading' class='hide_me' 
                        style='padding: 10px;'>&common.loading;</div>
-               <!--#include virtual="rdetail_copyinfo.xml"-->
 
                <div id='rdetail_summary_div' class='rdetail_extras_div hide_me'> </div>