added format icons
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Sep 2005 21:38:58 +0000 (21:38 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 6 Sep 2005 21:38:58 +0000 (21:38 +0000)
added view marc on record detail page
added format utility functions

git-svn-id: svn://svn.open-ils.org/ILS/trunk@1807 dcc99617-32d9-48b4-a31d-7c20da2025e4

13 files changed:
Open-ILS/web/opac/common/css/mediumfont.css
Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/common/js/opac_utils.js
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/web/opac/skin/default/css/layout.css
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/js/result_common.js
Open-ILS/web/opac/skin/default/xml/altcanvas.xml
Open-ILS/web/opac/skin/default/xml/header.xml
Open-ILS/web/opac/skin/default/xml/index.xml
Open-ILS/web/opac/skin/default/xml/rdetail.xml
Open-ILS/web/opac/skin/default/xml/result_table.xml
Open-ILS/web/opac/skin/default/xml/searchbar.xml

index a7f1c6d..dc5af9f 100644 (file)
@@ -14,3 +14,4 @@ body                          { font-family: Helvetica, Arial, Tahoma, sans-serif; font-size: 95%;}
 
 #rdetail_copy_info_table { font-size: 92%; }
 .rdetail_copy_nav_link { font-weight: normal; font-size: 95%; }
+#rdetail_view_marc { font-size: 90%; }
index 00a053a..32999b0 100644 (file)
@@ -184,6 +184,7 @@ var FETCH_USER_PREFS                                = "open-ils.actor:open-ils.actor.patron.settings.retriev
 var UPDATE_USER_PREFS                  = "open-ils.actor:open-ils.actor.patron.settings.update"; 
 var FETCH_COPY_STATUSES                        = "open-ils.search:open-ils.search.config.copy_status.retrieve.all";
 var FETCH_COPY_COUNTS_SUMMARY  = "open-ils.search:open-ils.search.biblio.copy_counts.summary.retrieve";
+var FETCH_MARC_HTML                            = "open-ils.search:open-ils.search.biblio.record.html";
 /* ---------------------------------------------------------------------------- */
 
 
index 0752773..a5eb727 100644 (file)
@@ -14,8 +14,7 @@ Request.prototype.send                = function(block){this.request.send(block);}
 Request.prototype.result       = function(){return this.request.getResultObject();}
 /* ----------------------------------------------------------------------- */
 
-function showCanvas() { setTimeout(_showCanvas, 200); }
-function _showCanvas() {
+function showCanvas() {
        for( var x in G.ui.altcanvas ) {
                hideMe(G.ui.altcanvas[x]);
        }
@@ -422,8 +421,6 @@ function unHideMe(obj) { removeCSSClass(obj, config.css.hide_me); }
 /* ----------------------------------------------------------------------- */
 /* build the org tree */
 /* ----------------------------------------------------------------------- */
-
-
 function drawOrgTree() {
        G.ui.common.org_tree.innerHTML = buildOrgSelector().toString();
 }
@@ -459,8 +456,86 @@ function setFontSize(size) {
 }
 
 
+/* ----------------------------------------------------------------------- */
+/* resource icon code */
+/* ----------------------------------------------------------------------- */
+
+var resourceFormats = [
+   "text",
+   "moving image",
+   "sound recording", "software, multimedia",
+   "still images",
+   "cartographic",
+   "mixed material",
+   "notated music",
+   "three dimensional object" ];
+
+
+function modsFormatToMARC(format) {
+   switch(format) {
+      case "text":
+         return "at";
+      case "moving image":
+         return "g";
+      case "sound recording":
+         return "ij";
+      case "sound recording-nonmusical":
+         return "i";
+      case "sound recording-musical":
+         return "j";
+      case "software, multimedia":
+         return "m";
+      case "still images":
+         return "k";
+      case "cartographic":
+         return "ef";
+      case "mixed material":
+         return "op";
+      case "notated music":
+         return "cd";
+      case "three dimensional object":
+         return "r";
+   }
+   return "at";
+}
 
 
+function MARCFormatToMods(format) {
+   switch(format) {
+      case "a":
+      case "t":
+         return "text";
+      case "g":
+         return "moving image";
+      case "i":
+         return "sound recording-nonmusical";
+      case "j":
+         return "sound recording-musical";
+      case "m":
+         return "software, multimedia";
+      case "k":
+         return "still images";
+      case "e":
+      case "f":
+         return "cartographic";
+      case "o":
+      case "p":
+         return "mixed material";
+      case "c":
+      case "d":
+         return "notated music";
+      case "r":
+         return "three dimensional object";
+   }
+   return "text";
+}
+
+
+function setResourcePic( img, resource ) {
+       img.setAttribute( "src", "../../../images/tor/" + resource + ".jpg");
+       img.title = resource;
+}
+
 
 
 
index b77b69b..b842556 100644 (file)
@@ -5,10 +5,10 @@
 <!ENTITY navigate.home.title "Go to the Home page">
 <!ENTITY navigate.advanced "Advanced Search">
 <!ENTITY navigate.advanced.title "Go to the Advanced Search Page">
-<!ENTITY navigate.myopac "My OPAC">
+<!ENTITY navigate.myopac "My Account">
 <!ENTITY navigate.myopac.title "Go to My OPAC">
-<!ENTITY navigate.login "Log in for personalized features">
-<!ENTITY navigate.login.title "Log in">
+<!ENTITY navigate.login "Log in">
+<!ENTITY navigate.login.title "Log in for personalized features">
 <!ENTITY navigate.logout "Log out">
 <!ENTITY navigate.logout.title "Log out">
 
@@ -43,3 +43,5 @@
 <!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">
+<!ENTITY rdetail.detailMain.viewMarc "View MARC">
+<!ENTITY rdetail.detailMain.hideMarc "Return to title summary view">
index 0340bf0..0a5295b 100644 (file)
 
 #rdetail_detail_main { width: 100%; }
 #rdetail_details_table { padding-top: 10px; width: 100%; padding: 30px; border-collapse: collapse;}
-.rdetail_header { padding: 3px; padding-left: 10px; font-weight: 600; }
+.rdetail_header { padding: 3px; padding-left: 10px;}
 .rdetail_desc { padding: 2px; padding-left: 4px; padding-right: 4px;}
 .rdetail_item { width: 75%; padding-left: 10px; }
 #rdetail_image { padding-right: 10px; }
 #rdetail_copy_info_table { padding: 4px; width: 100%; border-collapse: collapse; }
-.rdetail_copy_info_header_cell { padding: 6px; }
+.rdetail_copy_info_header_cell { padding: 2px; }
 .rdetail_copy_count_cell { text-align: center; }
 
 
+.tor_pic { width: 20px; height: 20px; border: none;}
 
index e80b179..d9f19cc 100644 (file)
@@ -21,11 +21,26 @@ function rdetailDraw() {
 
        G.ui.rdetail.cp_info_local.onclick = rdetailShowLocalCopies;
        G.ui.rdetail.cp_info_all.onclick = rdetailShowAllCopies;
+       G.ui.rdetail.view_marc.onclick = rdetailViewMarc;
+       G.ui.rdetail.hide_marc.onclick = showCanvas;
        var req = new Request(FETCH_RMODS, getRid());
        req.callback(_rdetailDraw);
        req.send();
 }
 
+function rdetailViewMarc() {
+       if(!record) return;
+
+       if( G.ui.rdetail.view_marc_box.innerHTML.indexOf("style") == -1 ) {
+               var req = new Request( FETCH_MARC_HTML, record.doc_id() );
+               req.send(true);
+               var html = req.result();
+               G.ui.rdetail.view_marc_box.innerHTML = html;
+       }
+       swapCanvas(G.ui.rdetail.view_marc_div);
+}
+
+
 function rdetailShowLocalCopies() {
 
        var found = false;
@@ -65,7 +80,8 @@ function _rdetailDraw(r) {
        G.ui.rdetail.edition.appendChild(text(record.edition()));
        G.ui.rdetail.pubdate.appendChild(text(record.pubdate()));
        G.ui.rdetail.publisher.appendChild(text(record.publisher()));
-       G.ui.rdetail.tor.appendChild(text(record.types_of_resource()));
+       G.ui.rdetail.tor.appendChild(text(record.types_of_resource()[0]));
+       setResourcePic( G.ui.rdetail.tor_pic, record.types_of_resource()[0]);
        G.ui.rdetail.abstr.appendChild(text(record.synopsis()));
 
        G.ui.rdetail.image.setAttribute("src", buildISBNSrc(cleanISBN(record.isbn())));
@@ -86,6 +102,7 @@ function _rdetailRows(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 );
@@ -94,10 +111,12 @@ function _rdetailRows(node) {
                libtd.setAttribute("style", "padding-left: " + ((findOrgDepth(node) - 1)  * 9) + "px;");
        
                if(!findOrgType(node.ou_type()).can_have_vols()) {
-                       libtd.setAttribute("colspan", numStatuses + 2 );
-                       libtd.colSpan = numStatuses + 2;
+
                        row.removeChild(cntd);
                        row.removeChild(cpctd);
+
+                       libtd.setAttribute("colspan", numStatuses + 2 );
+                       libtd.colSpan = numStatuses + 2;
                        addCSSClass(row, config.css.color_3);
                } 
        
index 1197f91..03ca9ef 100644 (file)
@@ -91,6 +91,8 @@ function resultDisplayRecord(rec, pos, is_mr) {
        findNodeByName(r, "result_table_title_cell").width = 
                100 - (orgNodeTrail(findOrgUnit(getLocation())).length * 8) + "%";
 
+       resultBuildFormatIcons( r, rec );
+
        unHideMe(r);
        
        runEvt("result", "recordDrawn", rec.doc_id(), title_link);
@@ -99,6 +101,29 @@ function resultDisplayRecord(rec, pos, is_mr) {
                runEvt('result', 'allRecordsReceived', recordsCache);
 }
 
+function resultBuildFormatIcons( row, rec ) {
+
+       var td = findNodeByName( row, config.names.result.format_cell );
+       var linkt = td.removeChild(findNodeByName( row, config.names.result.format_link ));
+       var resources = rec.types_of_resource();
+
+       for( var i in resources ) {
+               var link = linkt.cloneNode(true);
+
+               var args = {};
+               args.page = RRESULT;
+               args[PARAM_OFFSET] = 0;
+               args[PARAM_MRID] = rec.doc_id();
+               args[PARAM_FORM] = modsFormatToMARC(resources[i]);
+               link.setAttribute("href", buildOPACLink(args));
+
+               var img = findNodeByName(link, config.names.result.format_pic);
+               setResourcePic( img, resources[i] );
+               td.appendChild(link);
+       }
+}
+
+
 function resultPageIsDone(pos) {
        return (recordsHandled == getDisplayCount() 
                || recordsHandled + getOffset() == getHitCount());
index 908dbb3..6ea6539 100644 (file)
@@ -11,6 +11,7 @@
        <!-- The org tree -->
        <xi:include href="orgtree.xml"/> 
 
+
        <!-- ============================================================================= -->
        <!-- Register the alternate canvases  -->
        <script language='javascript'>
index 6b58bcc..01da7ac 100644 (file)
@@ -1,5 +1,9 @@
 <?xml version='1.0'?>
 
+<!--
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
+-->
+
 <div xmlns:xi="http://www.w3.org/2001/XInclude">
        <xi:include href="logo.xml"/>
        <xi:include href="fonts.xml"/>
index 5efbd20..d4b6372 100644 (file)
@@ -1,6 +1,12 @@
 <?xml version='1.0'?>
 <!DOCTYPE x [ <!ENTITY % ent SYSTEM "../../../locale/en-US/lang.dtd"> %ent; ] >
 
+<!--
+<!DOCTYPE html PUBLIC 
+       "-//W3C//DTD XHTML 1.0 Transitional//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
+       -->
+
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude">
 
        <head>
index 9d897b2..1e5fddb 100644 (file)
                <script language='javascript' src='../js/rdetail.js'> </script>
        </head>
 
+       <script language='javascript'>
+               config.ids.rdetail = {};
+               config.ids.rdetail.view_marc = "rdetail_view_marc";
+       </script>
+
        <body onload="init();">
                <xi:include href="header.xml"/> 
+
+               
                <div id='canvas' class='canvas'>
+
                        <xi:include href="altcanvas.xml"/>
+                       <xi:include href="rdetail_altcanvas.xml"/>
+
                        <div id='canvas_main'>
                                <div>
                                        <div class='rdetail_header color_1'>
-                                               <span>&rdetail.detailMain.headerLabel;</span>
+                                               <table width='100%'>
+                                                       <tbody>
+                                                               <tr>
+                                                                       <td>
+                                                                               <span>&rdetail.detailMain.headerLabel;</span>
+                                                                       </td>
+                                                                       <td align='right'>
+                                                                               <a href="javascript:void(0);" id='rdetail_view_marc'>&rdetail.detailMain.viewMarc;</a>
+                                                                       </td>
+                                                               </tr>
+                                                       </tbody>
+                                               </table>
                                        </div>
                                        <xi:include href="rdetail_summary.xml"/>
                                </div> 
index 619356c..a9c13fa 100644 (file)
@@ -46,8 +46,9 @@
                                                        </tr>
 
                                                        <tr>
-                                                               <td class='result_table_format_cell'>
-                                                                       <a class='search_link'> 
+                                                               <td name='result_table_format_cell' class='result_table_format_cell'>
+                                                                       <a name='resource_link' class='search_link'> 
+                                                                               <img name='format_pic' class='tor_pic'> </img>
                                                                                <!-- Item formats go here -->
                                                                        </a>
                                                                </td>
                                                </tbody>
                                        </table>
                                </td>
-
                        </tr>
                </tbody>
        </table>
+
+       <script language='javascript'>
+               config.names.result.format_cell = 'result_table_format_cell';
+               config.names.result.format_link = 'resource_link'
+               config.names.result.format_pic = 'format_pic'
+       </script>
+
 </div>
 
 
index a3dd334..4c60e67 100644 (file)
                                        <td align='left' class='searchbar_main_td'>
                                                <span class="searchbar_item">
                                                        <select id='search_type_selector'>
-                                                               <option value='title' selected='selected'>Title</option>
+                                                               <option value='keyword' selected='selected'>Keyword</option>
+                                                               <option value='title'>Title</option>
                                                                <option value='author'>Author</option>
                                                                <option value='subject'>Subject</option>
                                                                <option value='series'>Series</option>
-                                                               <option value='keyword'>Keyword</option>
                                                        </select>
                                                </span>