From 209b870d5edf0981cdc78d06ee480c51318b9614 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 3 Oct 2011 16:31:45 -0400 Subject: [PATCH] TPac: show non-asset.uri 856 URLs on detail page Display "global" 856 URLs in record detail page. A "global" URL in this case is one that has no ownership and has not been extracted out as an asset.uri. As of right now, this is any 856 that has no $9, $w, or $n subfield data. Links are displayed directly after asset.uri links using the same style. Signed-off-by: Bill Erickson Signed-off-by: Dan Scott --- Open-ILS/src/templates/opac/parts/misc_util.tt2 | 20 ++++++++++++++++++++ Open-ILS/src/templates/opac/parts/record/summary.tt2 | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index 308998407c..1657bd6893 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -37,6 +37,26 @@ # clean up the ISBN args.isbn_clean = args.isbns.0.replace('\ .*', ''); + # Extract the 856 URLs that are not otherwise represented by asset.uri's + args.online_res = []; + FOR node IN xml.findnodes('//*[@tag="856"]'); + IF node.findnodes('./*[@code="9" or @code="w" or @code="n"]'); NEXT; END; # asset.uri's + label = node.findnodes('./*[@code="y"]'); + notes = node.findnodes('./*[@code="z" or @code="3"]'); + FOR href IN node.findnodes('./*[@code="u"]'); + NEXT UNLESS href; + # it's possible for multiple $u's to exist within 1 856 tag. + # in that case, honor the label/notes data for the first $u, but + # leave any subsequent $u's as unadorned href's. + # use href/link/note keys to be consistent with args.uri's + args.online_res.push({ + href => href.textContent, + link => (loop.first AND label) ? label.textContent : href.textContent, + note => (loop.first) ? notes.textContent : '' + }); + END; + END; + args.holdings = []; args.uris = []; args.issns = []; diff --git a/Open-ILS/src/templates/opac/parts/record/summary.tt2 b/Open-ILS/src/templates/opac/parts/record/summary.tt2 index bbfb1c14f6..125546cec4 100644 --- a/Open-ILS/src/templates/opac/parts/record/summary.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/summary.tt2 @@ -73,7 +73,7 @@ [%- IF sfx.size && sfx.0 != '' %] [%- END %] -[%- FOR uri IN args.uris; %] +[%- FOR uri IN args.uris.merge(args.online_res); %]
[% uri.link %][% ' - ' _ uri.note IF uri.note %]
-- 2.11.0