Enable display of public notes (subfield 'z') in online resources per http://www...
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 13 Sep 2008 06:43:51 +0000 (06:43 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 13 Sep 2008 06:43:51 +0000 (06:43 +0000)
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

Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm
Open-ILS/web/opac/skin/default/js/rdetail.js

index a2b440c..dc5c1f6 100644 (file)
@@ -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 );
        }
 
index 58999e5..a6d3f00 100644 (file)
@@ -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'));
                }
        }