From 885dfe0f752c1159e40eb7e641c12a70bdfe58cc Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 6 Sep 2005 21:38:58 +0000 Subject: [PATCH] added format icons 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 --- Open-ILS/web/opac/common/css/mediumfont.css | 1 + Open-ILS/web/opac/common/js/config.js | 1 + Open-ILS/web/opac/common/js/opac_utils.js | 83 ++++++++++++++++++- Open-ILS/web/opac/locale/en-US/lang.dtd | 8 +- Open-ILS/web/opac/skin/default/css/layout.css | 5 +- Open-ILS/web/opac/skin/default/js/rdetail.js | 25 +++++- .../web/opac/skin/default/js/result_common.js | 25 ++++++ .../web/opac/skin/default/xml/altcanvas.xml | 1 + Open-ILS/web/opac/skin/default/xml/header.xml | 4 + Open-ILS/web/opac/skin/default/xml/index.xml | 6 ++ .../web/opac/skin/default/xml/rdetail.xml | 23 ++++- .../opac/skin/default/xml/result_table.xml | 13 ++- .../web/opac/skin/default/xml/searchbar.xml | 4 +- 13 files changed, 181 insertions(+), 18 deletions(-) diff --git a/Open-ILS/web/opac/common/css/mediumfont.css b/Open-ILS/web/opac/common/css/mediumfont.css index a7f1c6ddb9..dc5af9f492 100644 --- a/Open-ILS/web/opac/common/css/mediumfont.css +++ b/Open-ILS/web/opac/common/css/mediumfont.css @@ -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%; } diff --git a/Open-ILS/web/opac/common/js/config.js b/Open-ILS/web/opac/common/js/config.js index 00a053a2d9..32999b085e 100644 --- a/Open-ILS/web/opac/common/js/config.js +++ b/Open-ILS/web/opac/common/js/config.js @@ -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"; /* ---------------------------------------------------------------------------- */ diff --git a/Open-ILS/web/opac/common/js/opac_utils.js b/Open-ILS/web/opac/common/js/opac_utils.js index 075277304d..a5eb727779 100644 --- a/Open-ILS/web/opac/common/js/opac_utils.js +++ b/Open-ILS/web/opac/common/js/opac_utils.js @@ -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; +} + diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index b77b69be9b..b842556a4c 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -5,10 +5,10 @@ - + - - + + @@ -43,3 +43,5 @@ + + diff --git a/Open-ILS/web/opac/skin/default/css/layout.css b/Open-ILS/web/opac/skin/default/css/layout.css index 0340bf0ff4..0a5295bffe 100644 --- a/Open-ILS/web/opac/skin/default/css/layout.css +++ b/Open-ILS/web/opac/skin/default/css/layout.css @@ -75,13 +75,14 @@ #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;} diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index e80b179112..d9f19cc2b1 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -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); } diff --git a/Open-ILS/web/opac/skin/default/js/result_common.js b/Open-ILS/web/opac/skin/default/js/result_common.js index 1197f91bc7..03ca9ef89b 100644 --- a/Open-ILS/web/opac/skin/default/js/result_common.js +++ b/Open-ILS/web/opac/skin/default/js/result_common.js @@ -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()); diff --git a/Open-ILS/web/opac/skin/default/xml/altcanvas.xml b/Open-ILS/web/opac/skin/default/xml/altcanvas.xml index 908dbb3a1a..6ea65393b7 100644 --- a/Open-ILS/web/opac/skin/default/xml/altcanvas.xml +++ b/Open-ILS/web/opac/skin/default/xml/altcanvas.xml @@ -11,6 +11,7 @@ + + + + +
+ + +
- &rdetail.detailMain.headerLabel; + + + + + + + +
+ &rdetail.detailMain.headerLabel; + + &rdetail.detailMain.viewMarc; +
diff --git a/Open-ILS/web/opac/skin/default/xml/result_table.xml b/Open-ILS/web/opac/skin/default/xml/result_table.xml index 619356c260..a9c13fa905 100644 --- a/Open-ILS/web/opac/skin/default/xml/result_table.xml +++ b/Open-ILS/web/opac/skin/default/xml/result_table.xml @@ -46,8 +46,9 @@ - - + + + @@ -56,10 +57,16 @@ - + + +
diff --git a/Open-ILS/web/opac/skin/default/xml/searchbar.xml b/Open-ILS/web/opac/skin/default/xml/searchbar.xml index a3dd334d17..4c60e673e8 100644 --- a/Open-ILS/web/opac/skin/default/xml/searchbar.xml +++ b/Open-ILS/web/opac/skin/default/xml/searchbar.xml @@ -46,11 +46,11 @@ -- 2.43.2