From 90fdd8bd21f4d7cbf8f7269199b56c98498a8e46 Mon Sep 17 00:00:00 2001 From: dbs Date: Mon, 25 May 2009 04:51:21 +0000 Subject: [PATCH] Display an array of MFHD records per bib record Reduce some of code duplication Get ready for translation by breaking out the strings Introduce spaces between entries in flattened holdings so that we don't end up with 800-character wide displays of the Economist holdings We need to enable the MFHD editor button to invoke the correct MFHD record, probably by adding MFHD ID to the svr definition git-svn-id: svn://svn.open-ils.org/ILS/trunk@13225 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/common/js/config.js | 2 +- Open-ILS/web/opac/skin/default/js/rdetail.js | 52 ++++++++++++---------------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/Open-ILS/web/opac/common/js/config.js b/Open-ILS/web/opac/common/js/config.js index e3471f3ee1..306a7296b6 100644 --- a/Open-ILS/web/opac/common/js/config.js +++ b/Open-ILS/web/opac/common/js/config.js @@ -291,7 +291,7 @@ var SEARCH_RS = 'open-ils.search:open-ils.search.biblio.multiclass:1'; var SEARCH_MRS_QUERY = 'open-ils.search:open-ils.search.metabib.multiclass.query:1'; var SEARCH_RS_QUERY = 'open-ils.search:open-ils.search.biblio.multiclass.query:1'; var FETCH_SEARCH_RIDS = "open-ils.search:open-ils.search.biblio.record.class.search:1"; -var FETCH_MFHD_SUMMARY = "open-ils.search:open-ils.search.serial.record.bib_to_mfhd.retrieve"; +var FETCH_MFHD_SUMMARY = "open-ils.search:open-ils.search.serial.record.bib.retrieve"; var FETCH_MRMODS = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve"; var FETCH_MODS_FROM_COPY = "open-ils.search:open-ils.search.biblio.mods_from_copy"; var FETCH_MR_COPY_COUNTS = "open-ils.search:open-ils.search.biblio.metarecord.copy_count:1"; diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index 971bdb174a..42d73b8903 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -216,6 +216,11 @@ function _holdingsDraw(h) { holdings = h.getResultObject(); if (!holdings) { return null; } + dojo.forEach(holdings, _holdingsDrawMFHD); + +} + +function _holdingsDrawMFHD(holdings, entryNum) { var hh = holdings.holdings(); var hch = holdings.current_holdings(); var hs = holdings.supplements(); @@ -232,35 +237,18 @@ function _holdingsDraw(h) { ) { return null; } - - dojo.place("
Holdings summary
", "rdetail_details_table", "after"); - if (hh.length > 0) { - dojo.place(" Holdings" + hh + "", "rdetail_holdings_tbody", "last"); - } - if (hch.length > 0) { - dojo.place(" Current holdings" + hch + "", "rdetail_holdings_tbody", "last"); - } - if (hs.length > 0) { - dojo.place(" Supplements" + hs + "", "rdetail_holdings_tbody", "last"); - } - if (hcs.length > 0) { - dojo.place(" Current supplements" + hcs + "", "rdetail_holdings_tbody", "last"); - } - if (hi.length > 0) { - dojo.place(" Indexes" + hi + "", "rdetail_holdings_tbody", "last"); - } - if (hci.length > 0) { - dojo.place(" Current indexes" + hci + "", "rdetail_holdings_tbody", "last"); - } - if (ho.length > 0) { - dojo.place(" Online" + ho + "", "rdetail_holdings_tbody", "last"); - } - if (hm.length > 0) { - dojo.place(" Missing" + hm + "", "rdetail_holdings_tbody", "last"); - } - if (hinc.length > 0) { - dojo.place(" Incomplete" + hinc + "", "rdetail_holdings_tbody", "last"); - } + + dojo.place("
Holdings summary
", "rdetail_details_table", "after"); + if (hh.length > 0) { _holdingsDrawMFHDEntry(entryNum, 'Holdings', hh); } + if (hch.length > 0) { _holdingsDrawMFHDEntry(entryNum, 'Current holdings', hch); } + if (hs.length > 0) { _holdingsDrawMFHDEntry(entryNum, 'Supplements', hs); } + if (hcs.length > 0) { _holdingsDrawMFHDEntry(entryNum, 'Current supplements', hcs); } + if (hi.length > 0) { _holdingsDrawMFHDEntry(entryNum, 'Indexes', hi); } + if (hci.length > 0) { _holdingsDrawMFHDEntry(entryNum, 'Current indexes', hci); } + if (ho.length > 0) { _holdingsDrawMFHDEntry(entryNum, 'Online', ho); } + if (hm.length > 0) { _holdingsDrawMFHDEntry(entryNum, 'Missing volumes', hm); } + if (hinc.length > 0) { _holdingsDrawMFHDEntry(entryNum, 'Incomplete volumes', hm); } + if (isXUL()) { dojo.require('openils.Event'); dojo.require('openils.PermaCrud'); @@ -268,6 +256,12 @@ function _holdingsDraw(h) { } } +function _holdingsDrawMFHDEntry(entryNum, entryName, entry) { + var commaRegex = /,/; + var flatEntry = entry.toString().replace(commaRegex, ', '); + dojo.place(" " + entryName + "" + flatEntry + "", "rdetail_holdings_tbody_" + entryNum, "last"); +} + function _rdetailDraw(r) { record = r.getResultObject(); -- 2.11.0