From: Kathy Lussier Date: Wed, 2 Nov 2016 15:16:14 +0000 (-0400) Subject: Digital images in the catalog X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6f61f5aa259190cec50a4871ac02688e6c263e2f;p=working%2FEvergreen.git Digital images in the catalog Custom code done by Equinox and running on the NOBLE server. Takes images from the 956 field and displays them in the record summary page of the catalog. Signed-off-by: Kathy Lussier --- diff --git a/Open-ILS/src/templates/opac/css/style.css.tt2 b/Open-ILS/src/templates/opac/css/style.css.tt2 index 8a3c4f72d0..f86b8eb2f9 100644 --- a/Open-ILS/src/templates/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates/opac/css/style.css.tt2 @@ -2148,3 +2148,31 @@ label[for*=expert_] color: [% css_colors.text_badnews %]; padding: 10px; } + +.custom_thumbnail_container { + margin: 20px auto; + text-align: center; + width: 90%; + min-height: 200px; + overflow: auto; + display: inline-block; +} + +a.custom_thumbnail { + margin: 0px 20px; + text-align: center; + display: inline-block; + text-decoration: none; + color: black; +} + +img.custom_thumbnail { + max-height: 150px; + max-width: 150px; +} + +.custom_thumbnail_caption { + text-align: center; + color: black; + font-weight: bold; +} diff --git a/Open-ILS/src/templates/opac/parts/record/summary.tt2 b/Open-ILS/src/templates/opac/parts/record/summary.tt2 index b2bd5e5849..c4a436002f 100644 --- a/Open-ILS/src/templates/opac/parts/record/summary.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/summary.tt2 @@ -124,6 +124,50 @@ [%- END %] [%- END %] [%- merged_uris = args.uris.merge(args.online_res); +file_ext_re = '\.(?i:jpe?g|png|bmp|gif|tif|psd|thm|yuv)$'; + +thumbnails = []; + +FOR uri_field IN attrs.marc_xml.findnodes('//*[@tag="956"]'); + tn = {}; + + x = uri_field.findnodes('./*[@code="t"]/text()'); + FOR i IN x; + tn.thumb = i.textContent; + END; + + x = uri_field.findnodes('./*[@code="u"]/text()'); + FOR i IN x; + tn.target = i.textContent; + END; + + x = uri_field.findnodes('./*[@code="c"]/text()'); + FOR i IN x; + tn.caption = i.textContent; + END; + + IF tn.target.length > 0; + IF !tn.caption; + tn.caption = ''; + END; + IF !tn.thumb AND tn.target.match(file_ext_re); + tn.thumb = tn.target; + END; + thumbnails.push(tn); + END; +END; + +-%] + +
+ [%- FOR tn IN thumbnails %] + + [% tn.caption | html %] +
[% tn.caption %]
+
+ [%- END %] +
num_uris = merged_uris.size; IF num_uris > 0; -%]