From: Mike Rylander Date: Thu, 13 Oct 2022 16:12:42 +0000 (-0400) Subject: LP#1992827: Improve OPAC URI display X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fmiker%2Flp-1992827-improved-opac-uri-display;p=working%2FEvergreen.git LP#1992827: Improve OPAC URI display Currently, the web staff client displays URIs in a slightly different (and arguably better/more complete) way than the OPAC. In particular, the staff client includes any 856 with an ind2 value of 0, 1, or 2, and provides a label indicating the purpose of the URI based on the ind2 value. The OPAC, on the other hand, only displays 856s with an ind2 of 0 or 1, and does not distinguish the purpose. This commit both implements the "purpose" labeling and allows ind2=2 URIs to be displayed. Both BooPAC and TPAC templates are adjusted. This does not change the way Located URIs are excluded from OPAC display, they are still filtered out based on the existence of subfield 9. Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/misc_util.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/misc_util.tt2 index 7e976fd347..b6a3a4cf7d 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/misc_util.tt2 @@ -468,8 +468,13 @@ # Extract the 856 URLs that are not otherwise represented by asset.uri's args.online_res = []; - FOR node IN xml.findnodes('//*[@tag="856" and @ind1="4" and (@ind2="0" or @ind2="1")]'); + FOR node IN xml.findnodes('//*[@tag="856" and @ind1="4" and (@ind2="0" or @ind2="1" or @ind2="2")]'); IF node.findnodes('./*[@code="9" or @code="w" or @code="n"]'); NEXT; END; # asset.uri's + lind2 = node.getAttribute('ind2') || ''; + ltype = ''; + IF lind2 == '0'; ltype = l('Electronic Resource:'); END; + IF lind2 == '1'; ltype = l('Version of Resource:'); END; + IF lind2 == '2'; ltype = l('Related Resource:'); END; label = node.findnodes('./*[@code="y"]'); notes = node.findnodes('./*[@code="z" or @code="3"]'); FOR href IN node.findnodes('./*[@code="u"]'); @@ -481,7 +486,8 @@ args.online_res.push({ href => href.textContent, link => (loop.first AND label) ? label.textContent : href.textContent, - note => (loop.first) ? notes.textContent : '' + note => (loop.first) ? notes.textContent : '', + type => ltype }); END; END; diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/record/summary.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/record/summary.tt2 index 94ae7f5344..ee5d355204 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/record/summary.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/record/summary.tt2 @@ -530,12 +530,16 @@ ctx.metalinks.push(' filtered_href = uri.href | html; filtered_link = uri.link ? uri.link : '' | html; filtered_note = uri.note ? uri.note : '' | html; + filtered_type = uri.type ? uri.type : '' | html; -%] [%- IF num_uris == 1 -%]

[%- ELSE -%]

  • [%- END -%] + [%- IF filtered_type.length > 0 -%] + [% filtered_type %] + [%- END -%] [%- IF filtered_href != filtered_link; '' _ filtered_link _ ''; diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index 283bcb098c..d54cdbbe8f 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -468,8 +468,13 @@ # Extract the 856 URLs that are not otherwise represented by asset.uri's args.online_res = []; - FOR node IN xml.findnodes('//*[@tag="856" and @ind1="4" and (@ind2="0" or @ind2="1")]'); + FOR node IN xml.findnodes('//*[@tag="856" and @ind1="4" and (@ind2="0" or @ind2="1" or @ind2="2")]'); IF node.findnodes('./*[@code="9" or @code="w" or @code="n"]'); NEXT; END; # asset.uri's + lind2 = node.getAttribute('ind2') || ''; + ltype = ''; + IF lind2 == '0'; ltype = l('Electronic Resource:'); END; + IF lind2 == '1'; ltype = l('Version of Resource:'); END; + IF lind2 == '2'; ltype = l('Related Resource:'); END; label = node.findnodes('./*[@code="y"]'); notes = node.findnodes('./*[@code="z" or @code="3"]'); FOR href IN node.findnodes('./*[@code="u"]'); @@ -481,7 +486,8 @@ args.online_res.push({ href => href.textContent, link => (loop.first AND label) ? label.textContent : href.textContent, - note => (loop.first) ? notes.textContent : '' + note => (loop.first) ? notes.textContent : '', + type => ltype }); END; END; diff --git a/Open-ILS/src/templates/opac/parts/record/summary.tt2 b/Open-ILS/src/templates/opac/parts/record/summary.tt2 index b6e4f25de0..88ed699934 100644 --- a/Open-ILS/src/templates/opac/parts/record/summary.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/summary.tt2 @@ -218,12 +218,16 @@ IF num_uris > 0; filtered_href = uri.href | html; filtered_link = uri.link ? uri.link : '' | html; filtered_note = uri.note ? uri.note : '' | html; + filtered_type = uri.type ? uri.type : '' | html; -%] [%- IF num_uris == 1 -%]

    [%- ELSE -%]

  • [%- END -%] + [%- IF filtered_type.length > 0 -%] + [% filtered_type %] + [%- END -%] [%- IF filtered_href != filtered_link; '' _ filtered_link _ '';