##############################################################################
ctx.show_reservations_tab = 'false';
+##############################################################################
+# Display related resources (856 ind2=2)
+##############################################################################
+ctx.show_related_resources = 'false';
+
%]
END;
END;
+ MACRO process_856s BLOCK;
+ 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
+ uri_array.push({
+ href => href.textContent,
+ link => (loop.first AND label) ? label.textContent : href.textContent,
+ note => (loop.first) ? notes.textContent : ''
+ });
+ END;
+ END;
+
BLOCK get_ccvm_icon;
ctx.media_prefix _ '/images/format_icons/' _ ccvm.ctype _ '/' _ ccvm.code _ '.png' _ ctx.cache_key;
END;
args.online_res = [];
FOR node IN xml.findnodes('//*[@tag="856" and @ind1="4" and (@ind2="0" or @ind2="1")]');
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;
+ process_856s(node=node,uri_array=args.online_res);
+ END;
+ args.related_res = [];
+ FOR node IN xml.findnodes('//*[@tag="856" and @ind1="4" and @ind2="2"]');
+ process_856s(node=node,uri_array=args.related_res);
END;
args.holdings = [];
END;
%]
[%- END %]
+[%- num_related_uris = args.related_res.size;
+IF num_related_uris > 0 AND ctx.show_related_resources == 'true';
+-%]
+<h2 class="rdetail_uris">[% l("More information") %]</h2>
+<div class="rdetail_uris">
+ [%- IF num_related_uris > 1 %]<ul>[% END %]
+ [%- FOR related_uri IN args.related_res %]
+ [%- IF num_related_uris == 1 -%]
+ <p class="rdetail_uri">
+ [%- ELSE -%]
+ <li class="rdetail_uri">
+ [%- END -%]
+ <a href="[% related_uri.href %]" class="uri_link" property="url" target="_blank" rel="noopener">
+ [%- IF related_uri.href != related_uri.link;
+ '<span property="description">' _ related_uri.link _ '</span>';
+ ELSE;
+ related_uri.link;
+ END;
+ -%]
+ </a>
+ [%- ' - <span property="description">' _ related_uri.note _ '</span>' IF related_uri.note %]
+ [%- IF attrs.gtin13; '<meta property="gtin13" content="' _ attrs.gtin13 _ '" />'; END; %]
+ [%- IF num_related_uris == 1 %]</p>[% ELSE %]</li>[% END %]
+ [%- END %]
+ [%- IF num_related_uris > 1 %]</ul>[% END %]
+</div>
+[%- END %]
<div id="copy_hold_counts">
[%-
# Hold/copy summary