changed copy details layout, still some tweaks to be done
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Aug 2005 22:14:14 +0000 (22:14 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Aug 2005 22:14:14 +0000 (22:14 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1776 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Open-ILS/web/opac/common/js/opac_utils.js
Open-ILS/web/opac/common/js/org_utils.js
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/xml/rdetail.xml

index 8b928f4..aee8c67 100644 (file)
@@ -792,7 +792,7 @@ sub biblio_mrid_to_modsbatch {
                return $m;
        }
 
-       return biblio_mrid_make_modsbatch( $client, $mr ); 
+       return $self->biblio_mrid_make_modsbatch( $client, $mr ); 
 }
 
 # converts a metarecord to an mvr
@@ -858,6 +858,7 @@ sub biblio_mrid_make_modsbatch {
        my $mr; 
        if(ref($mrid)) { $mr = $mrid; }
        else { $mr = _grab_metarecord($mrid); }
+       $mrid = $mr->id;
 
        warn "Forcing mvr creation for mr " . $mr->id . "\n";
        my $master_id = $mr->master_record;
index 9fb22ee..0752773 100644 (file)
@@ -129,8 +129,8 @@ function findBasePath() {
 function findBaseURL(ssl) {
        var path = findBasePath();
        var proto = location.protocol;
-       if(ssl) proto = "https";
-       return location.protocol + "//" + location.host + path;
+       if(ssl) proto = "https:";
+       return proto + "//" + location.host + path;
 }
 
 function buildImageLink(name, ssl) {
index a4a6107..fd7753a 100644 (file)
@@ -41,6 +41,16 @@ function orgNodeTrail(node) {
 
 function findSiblingOrgs(node) { return findOrgUnit(node.parent_ou()).children(); }
 
+/* true if 'org' is 'me' or a child of mine */
+function orgIsMine(me, org) {
+       if(me.id() == org.id()) return true;
+       for( var i in me.children() ) {
+               if(orgIsMine(me.children()[i], org))
+                       return true;
+       }
+       return false;
+}
+
 
 
 var orgArraySearcher = {};
index d03adb5..b77b69b 100644 (file)
@@ -39,7 +39,7 @@
 <!ENTITY rdetail.copyInfo.headerLabel "Copy Information">
 <!ENTITY rdetail.copyInfo.library "Library">
 <!ENTITY rdetail.copyInfo.callnumber "Callnumber">
-<!ENTITY rdetail.copyInfo.local "View Copy Information for this library only">
+<!ENTITY rdetail.copyInfo.local "View Copy Information for this location only">
 <!ENTITY rdetail.copyInfo.all "View copy information for all libraries">
 <!ENTITY rdetail.loading "Loading copy infomation...">
 <!ENTITY rdetail.noneAvailable " * There are no copies in this library">
index f939317..97ab3aa 100644 (file)
@@ -6,8 +6,17 @@ attachEvt("rdetail", "recordDrawn", rdetailBuildInfoRows);
 var record = null;
 var cp_statuses = null;
 
+var copyRowParent = null;
+var copyRow = null;
+var statusRow = null;
+
 function rdetailDraw() {
 
+       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;
        var req = new Request(FETCH_RMODS, getRid());
@@ -16,25 +25,29 @@ function rdetailDraw() {
 }
 
 function rdetailShowLocalCopies() {
-       var rows = getId("first_copy_info_row").parentNode.getElementsByTagName("tr");
+
        var found = false;
+       var rows = copyRowParent.getElementsByTagName("tr");
        for( var r in rows ) {
-               if(r == 0) continue;
+               if(rows[r].id == "__rdsrow") continue;
                hideMe(rows[r]);
-               if(!isNull(rows[r]) && rows[r].getAttribute && 
-                       rows[r].getAttribute("local")) {
+               if(rows[r].getAttribute && rows[r].getAttribute("local")) {
                        unHideMe(rows[r]);
                        found = true;
                }
        }
+
        if(!found) unHideMe(G.ui.rdetail.cp_info_none);
        hideMe(G.ui.rdetail.cp_info_local);
        unHideMe(G.ui.rdetail.cp_info_all);
 }
 
 function rdetailShowAllCopies() {
-       var rows = getId("first_copy_info_row").parentNode.getElementsByTagName("tr");
-       for( var r in rows ) unHideMe(rows[r]);
+       var rows = copyRowParent.getElementsByTagName("tr");
+       for( var r in rows ) 
+               if(rows[r].getAttribute && rows[r].getAttribute("hasinfo"))
+                       unHideMe(rows[r]);
+
        hideMe(G.ui.rdetail.cp_info_all);
        unHideMe(G.ui.rdetail.cp_info_local);
        hideMe(G.ui.rdetail.cp_info_none);
@@ -57,24 +70,7 @@ function _rdetailDraw(r) {
        runEvt("rdetail", "recordDrawn");
 }
 
-var _statusPositions = {};
-function rdetailBuildStatusColumns() {
-
-       rdetailGrabCopyStatuses();
-       var parent = G.ui.rdetail.cp_status.parentNode;
-       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 && c.holdable()) {
-                       _statusPositions[i] = c;
-                       var node = template.cloneNode(true);
-                       node.appendChild(text("#" + c.name()));
-                       parent.appendChild(node);
-               }       
-       }       
-}
 
 function rdetailBuildInfoRows() {
        var req = new Request(FETCH_COPY_COUNTS_SUMMARY, record.doc_id())
@@ -82,64 +78,131 @@ function rdetailBuildInfoRows() {
        req.send();
 }
 
-function _rdetailSortSummary(a,b) {
-       a = findOrgUnit(a[0]).name().toLowerCase();
-       b = findOrgUnit(b[0]).name().toLowerCase();
-       if(a<b) return -1;
-       if(a>b) return 1;
-       return 0;
+/* pre-allocate the copy info table with all org units */
+function _rdetailRows(node) {
+
+       if(node) {
+
+               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 );
+       
+               libtd.appendChild(text(node.name()));
+               libtd.setAttribute("style", "padding-left: " + ((findOrgDepth(node) - 1)  * 9) + "px;");
+       
+               if(!findOrgType(node.ou_type()).can_have_vols()) {
+                       var c = 2;
+                       for(x in _statusPositions) c++;
+                       libtd.setAttribute("colspan", c );
+                       libtd.colSpan = c;
+                       row.removeChild(cntd);
+                       row.removeChild(cpctd);
+                       addCSSClass(row, config.css.color_3);
+               } 
+       
+               copyRowParent.appendChild(row);
+
+       } else { node = globalOrgTree; }
+
+       for( var c in node.children() ) 
+               _rdetailRows(node.children()[c]);
 }
 
+/* walk through the copy info and build rows where necessary */
 function _rdetailBuildInfoRows(r) {
 
-       var summary = r.getResultObject();
+       _rdetailRows();
 
+       var summary = r.getResultObject();
        var curLoc = getLocation();
 
-       summary = summary.sort(_rdetailSortSummary);
-
        /* remove the 'now loading' thingy */
        G.ui.rdetail.cp_info_loading.parentNode.removeChild(
                G.ui.rdetail.cp_info_loading);
 
-       var parent = G.ui.rdetail.cp_info_row.parentNode;
-       var template = parent.removeChild(G.ui.rdetail.cp_info_row);
+       var curLoc = getLocation();
 
-       var found = false;
-       for( var i = 0; i != summary.length; i++ ) {
+       for( var i = 0; i < summary.length; i++ ) {
 
                var arr = summary[i];
-               var node = template.cloneNode(true);
-               if(i == 0) node.id = "first_copy_info_row";
-               if(parseInt(arr[0]) != curLoc)  hideMe(node); 
-               else {found = true; node.setAttribute("local", "1");}
+               var rowNode = copyRow.cloneNode(true);
+               var rowNode = getId("cp_info_" + arr[0]);
+
+
+               if(rowNode.getAttribute("used")) {
+
+                       if( rowNode.nextSibling )
+                               rowNode = copyRowParent.insertBefore(copyRow.cloneNode(true), rowNode.nextSibling);
+                       else
+                               rowNode = copyRowParent.appendChild(copyRow.cloneNode(true));
+                       var n = findNodeByName( rowNode, config.names.rdetail.lib_cell );
+                       n.appendChild(text(findOrgUnit(arr[0]).name()));
+                       n.setAttribute("style", "padding-left: " + ((findOrgDepth(arr[0]) - 1)  * 9) + "px;");
+
+               } else {
+                       rowNode.setAttribute("used", "1");
+               }
 
-               if(i%2) addCSSClass(node, config.css.color_3);
-               var lib = findNodeByName(node, config.names.rdetail.lib_cell);
-               var cn = findNodeByName(node, config.names.rdetail.cn_cell);
-               var tdtemplate = node.removeChild(findNodeByName(node, config.names.rdetail.cp_count_cell));
+               rowNode.setAttribute("hasinfo", "1");
+               var p = getId("cp_info_" + findOrgUnit(arr[0]).parent_ou());
+               if(p) p.setAttribute("hasinfo", "1");
 
-               lib.appendChild(text(findOrgUnit(arr[0]).name()));
-               cn.appendChild(text(arr[1]));
-               parent.appendChild(node);
+               if( orgIsMine( findOrgUnit(curLoc), findOrgUnit(arr[0]) ) ) {
+                       unHideMe(rowNode);
+                       unHideMe(getId("cp_info_" + findOrgUnit(arr[0]).parent_ou()));
+                       rowNode.setAttribute("local", "1");
+               }
+
+               var cntd = findNodeByName( rowNode, config.names.rdetail.cn_cell );
+               cntd.appendChild(text(arr[1]));
+               var cpc_temp = rowNode.removeChild(findNodeByName(rowNode, config.names.rdetail.cp_count_cell));
 
                for( var j in _statusPositions ) {
                        var stat = _statusPositions[j];
                        var val = arr[2][stat.id()];
-                       var nn = tdtemplate.cloneNode(true);
+                       var nn = cpc_temp.cloneNode(true);
                        if(val) nn.appendChild(text(val));
                        else nn.appendChild(text(0));
-                       node.appendChild(nn);   
+                       rowNode.appendChild(nn);        
+               }
+
+       }
+
+       /* unhide the path to me */
+       var nodeTrail = orgNodeTrail(findOrgUnit(curLoc));
+       for( var i = 0; i != nodeTrail.length; i++ ) {
+               var n = getId("cp_info_" + nodeTrail[i].id());
+               if(n) {
+                       unHideMe(n);
+                       n.setAttribute("local", "1");
                }
        }
-       if(!found) unHideMe(G.ui.rdetail.cp_info_none);
 }
 
 
-function _rdetailSortStatuses(a, b) {
-       return parseInt(a.id()) - parseInt(b.id());
-}
 
+/* --------------------------------------------------------------------- */
+var _statusPositions = {};
+
+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 && c.holdable()) {
+                       _statusPositions[i] = c;
+                       var node = template.cloneNode(true);
+                       node.appendChild(text("#" + c.name()));
+                       parent.appendChild(node);
+               }       
+       }       
+}
 
 function rdetailGrabCopyStatuses() {
        if(cp_statuses) return cp_statuses;
@@ -149,6 +212,8 @@ function rdetailGrabCopyStatuses() {
        cp_statuses = cp_statuses.sort(_rdetailSortStatuses);
 }
 
-
+function _rdetailSortStatuses(a, b) {
+       return parseInt(a.id()) - parseInt(b.id());
+}
 
 
index d7c100c..9d897b2 100644 (file)
                <xi:include href="header.xml"/> 
                <div id='canvas' class='canvas'>
                        <xi:include href="altcanvas.xml"/>
-
                        <div id='canvas_main'>
-
                                <div>
                                        <div class='rdetail_header color_1'>
                                                <span>&rdetail.detailMain.headerLabel;</span>
                                        </div>
-
-                                       <!-- This holds the basic user friendly record information, e.g. title, author, etc. -->
-                                       <div>
-                                               <table id='rdetail_details_table'>
-                                                       <tbody id='rdetail_details_tbody'>
-
-                                                               <tr>
-                                                                       <td id='rdetail_image_cell' rowspan='8'><img id='rdetail_image'> </img></td>
-                                                                       <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.title;</td>                
-                                                                       <td class='rdetail_item' id='rdetail_title'> </td>
-                                                               </tr>
-
-                                                               <tr>
-                                                                       <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.author;</td>               
-                                                                       <td class='rdetail_item' id='rdetail_author'> </td>
-                                                               </tr>
-
-                                                               <tr>
-                                                                       <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.isbn;</td>                 
-                                                                       <td class='rdetail_item' id='rdetail_isbn'> </td>
-                                                               </tr>
-
-                                                               <tr>
-                                                                       <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.edition;</td>              
-                                                                       <td class='rdetail_item' id='rdetail_edition'> </td>
-                                                               </tr>
-
-                                                               <tr>
-                                                                       <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.pubdate;</td>              
-                                                                       <td class='rdetail_item' id='rdetail_pubdate'> </td>
-                                                               </tr>
-
-                                                               <tr>
-                                                                       <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.publisher;</td>            
-                                                                       <td class='rdetail_item' id='rdetail_publisher'> </td>
-                                                               </tr>
-
-                                                               <tr>
-                                                                       <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.tor;</td>                  
-                                                                       <td class='rdetail_item' id='rdetail_tor'> </td>
-                                                               </tr>
-
-                                                               <tr>
-                                                                       <td nowrap='nowrap' class='rdetail_desc'>&rdetail.detailMain.abstract;</td>     
-                                                                       <td class='rdetail_item' id='rdetail_abstract'> </td>
-                                                               </tr>
-
-                                                       </tbody>
-                                               </table>
-                                       </div> <!-- details_body -->
-                               </div> <!-- details_main -->
-
+                                       <xi:include href="rdetail_summary.xml"/>
+                               </div> 
                                <br/><br/>
-
-                               <!-- This holds information for copies attached to this record -->
-                               <div>
-
-
-                                       <!-- header bar for the copy info table.  this allows you to select local
-                                                       or global copy information -->
-                                       <table class='color_1 rdetail_header' width='100%' >
-                                               <tbody>
-                                                       <tr>
-                                                               <td align='left'>&rdetail.copyInfo.headerLabel;</td>
-                                                               <td align='right'>
-                                                                       <a href='javascript:void(0);' id='copy_info_local_link' 
-                                                                               class='rdetail_copy_nav_link hide_me'>&rdetail.copyInfo.local;</a>
-                                                               </td>
-                                                               <td align='right'>
-                                                                       <a href='javascript:void(0);' id='copy_info_all_link' 
-                                                                               class='rdetail_copy_nav_link'>&rdetail.copyInfo.all;</a>
-                                                               </td>
-                                                       </tr>
-                                               </tbody>
-                                       </table>
-                                       <table id='rdetail_copy_info_table'>
-                                               <tbody>
-                                                       <tr>
-                                                               <td  class='rdetail_copy_info_header_cell'>&rdetail.copyInfo.library;</td>
-                                                               <td  class='rdetail_copy_info_header_cell'>&rdetail.copyInfo.callnumber;</td>
-                                                               <td  nowrap='nowrap' class='rdetail_copy_info_header_cell' id='rdetail_copy_info_status'> </td>
-                                                       </tr>
-                                                       <tr id='rdetail_copy_info_row'>
-                                                               <td name='rdetail_library_cell'> </td>
-                                                               <td name='rdetail_callnumber_cell'> </td>
-                                                               <td nowrap='nowrap' class='rdetail_copy_count_cell' name='rdetail_copy_count_cell'> </td>
-                                                       </tr>
-                                                       <tr id='rdetail_copy_info_loading'>
-                                                               <td>&rdetail.loading;</td>
-                                                       </tr>
-                                                                                                       </tbody>
-                                       </table>
-                                       <div id='rdetail_copy_info_none' class='hide_me'>&rdetail.noneAvailable;</div>
-                               </div> <!-- copy info -->
+                               <xi:include href="rdetail_copyinfo.xml"/>
                        </div>
-
-                       <script language='javascript'>
-                               config.ids.rdetail = {};
-                               config.ids.rdetail.details_body         = 'rdetail_details_body'; 
-                               config.ids.rdetail.title                                = 'rdetail_title';
-                               config.ids.rdetail.author                               = 'rdetail_author';
-                               config.ids.rdetail.isbn                                 = 'rdetail_isbn';
-                               config.ids.rdetail.edition                              = 'rdetail_edition';
-                               config.ids.rdetail.pubdate                              = 'rdetail_pubdate';
-                               config.ids.rdetail.publisher                    = 'rdetail_publisher';
-                               config.ids.rdetail.tor                                  = 'rdetail_tor';
-                               config.ids.rdetail.abstr                                = 'rdetail_abstract';
-                               config.ids.rdetail.image                                = 'rdetail_image';
-                               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";
-                       </script>
-
                </div>
        </body>
 </html>