From 3b4b9bbda8f73489488f41578077918f01ba6505 Mon Sep 17 00:00:00 2001 From: dbs Date: Sat, 13 Sep 2008 06:43:51 +0000 Subject: [PATCH 1/1] Enable display of public notes (subfield 'z') in online resources per http://www.loc.gov/marc/856guide.html This requires a version bump from MARC21slim2MODS.xsl to MARC21slim2MODS32.xsl git-svn-id: svn://svn.open-ils.org/ILS/trunk@10587 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Utils/ModsParser.pm | 4 +-- Open-ILS/web/opac/skin/default/js/rdetail.js | 28 ++++++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm b/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm index a2b440cc33..dc5c1f6c9f 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm @@ -25,7 +25,7 @@ my $publisher_xpath = "//mods:mods/mods:originInfo//mods:publisher[1]"; my $edition_xpath = "//mods:mods/mods:originInfo//mods:edition[1]"; my $abstract_xpath = "//mods:mods/mods:abstract"; my $related_xpath = ""; -my $online_loc_xpath = "(//mods:location/mods:url|//mods:location/mods:url/\@displayLabel)"; +my $online_loc_xpath = "(//mods:location/mods:url|//mods:location/mods:url/\@displayLabel|//mods:location/mods:url/\@note)"; my $physical_desc = "(//mods:physicalDescription/mods:form|//mods:physicalDescription/mods:extent|". "//mods:physicalDescription/mods:reformattingQuality|//mods:physicalDescription/mods:internetMediaType|". "//mods:physicalDescription/mods:digitalOrigin)"; @@ -321,7 +321,7 @@ sub start_mods_batch { if(!$mods_sheet) { my $xslt_doc = $parser->parse_file( - OpenSRF::Utils::SettingsClient->new->config_value(dirs => 'xsl') . "/MARC21slim2MODS3.xsl"); + OpenSRF::Utils::SettingsClient->new->config_value(dirs => 'xsl') . "/MARC21slim2MODS32.xsl"); $mods_sheet = $xslt->parse_stylesheet( $xslt_doc ); } diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index 58999e5065..a6d3f00486 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -207,14 +207,34 @@ function _rdetailDraw(r) { // see if the record has any external links var links = record.online_loc(); - for( var i = 0; links && links.length > 0 && i < links.length; i = i + 2 ) { + for( var i = 0; links && links.length > 0 && i < links.length; i = i + 3 ) { var href = links[i]; // avoid matching "HTTP: The Complete Reference" if( href.match(/https?:\/|ftps?:\/|mailto:/i) ) { unHideMe($('rdetail_online_row')); - var name = '' + links[i+1]; - if(!name || name.match(/https?:\/|ftps?:\/|mailto:/i)) name = href; - $('rdetail_online').appendChild(elem('a', {href:href,'class':'classic_link'}, name)); + // MODS can contain a display label (used for the text of the link) + // as well as a note about the URL; many legacy systems conflate the + // two and generate MARC records that expect the note to be used as + // the text of the link, with no display label; here's the canonical + // format: + // + // 856 40 $uhttp://localhost$yDisplay label$zPublic note + // + // Note that the MARC21slim2MODS XSL concatenates $3 and $y together + // (as $y was defined later in MARC21's life as the display label) + var displayLabel = '' + links[i+1]; + var note = '' + links[i+2]; + if(!displayLabel || displayLabel.match(/https?:\/|ftps?:\/|mailto:/i)) { + if(!note || note.match(/https?:\/|ftps?:\/|mailto:/i)) { + displayLabel = href; + } else { + displayLabel = note; + } + } + $('rdetail_online').appendChild(elem('a', {href:href,'class':'classic_link'}, displayLabel)); + if (note && note != displayLabel) { + $('rdetail_online').appendChild(elem('span', {'class':'url_note'}, ' - ' + note)); + } $('rdetail_online').appendChild(elem('br')); } } -- 2.43.2