[open-ils-commits] SPAM: r10587 - in trunk/Open-ILS:
src/perlmods/OpenILS/Utils web/opac/skin/default/js
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Sep 13 02:43:55 EDT 2008
Author: dbs
Date: 2008-09-13 02:43:51 -0400 (Sat, 13 Sep 2008)
New Revision: 10587
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm
trunk/Open-ILS/web/opac/skin/default/js/rdetail.js
Log:
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
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm 2008-09-13 05:37:15 UTC (rev 10586)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm 2008-09-13 06:43:51 UTC (rev 10587)
@@ -25,7 +25,7 @@
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 @@
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 );
}
Modified: trunk/Open-ILS/web/opac/skin/default/js/rdetail.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/rdetail.js 2008-09-13 05:37:15 UTC (rev 10586)
+++ trunk/Open-ILS/web/opac/skin/default/js/rdetail.js 2008-09-13 06:43:51 UTC (rev 10587)
@@ -207,14 +207,34 @@
// 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'));
}
}
More information about the open-ils-commits
mailing list