From 210a4378e6c692d73a32312f4a1d83111ba8e06f Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 20 Feb 2020 14:43:43 +0000 Subject: [PATCH] Bug 24699: Split items.uri in OPAC detail view Content-Type: text/plain; charset=utf-8 Same change as in bug 24697 for staff. If there are more URIs in 952u, we split them and show the real URL instead of Link to resource or the value of pref URLLinkText. I introduced a few template variables here to make the code a bit more compact and readable. Signed-off-by: Marcel de Rooy --- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 43 +++++++--------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index f0e06a78a9..bc1214ed9e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1351,37 +1351,22 @@ [% END %] [% IF ( itemdata_uri ) %] - [% IF ITEM_RESULT.uri %] - [% IF Koha.Preference('URLLinkText') %] - [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - [% IF Koha.Preference("OPACURLOpenInNewWindow") %] - [% Koha.Preference('URLLinkText') | html %] - [% ELSIF ITEM_RESULT.uri %] - [% Koha.Preference('URLLinkText') | html %] - [% END %] - [% ELSE %] - [% IF Koha.Preference("OPACURLOpenInNewWindow") %] - [% Koha.Preference('URLLinkText') | html %] - [% ELSIF ITEM_RESULT.uri %] - [% Koha.Preference('URLLinkText') | html %] - [% END %] - [% END %] - [% ELSE %] - [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - [% IF Koha.Preference("OPACURLOpenInNewWindow") %] - Link to resource - [% ELSIF ITEM_RESULT.uri %] - Link to resource - [% END %] - [% ELSE %] - [% IF Koha.Preference("OPACURLOpenInNewWindow") %] - Link to resource - [% ELSIF ITEM_RESULT.uri %] - Link to resource - [% END %] - [% END %] + [% IF ITEM_RESULT.uri %] + [%# Initialize three helper vars %] + [% SET target_attr = ''; SET rel_attr = ''; SET href_attr = '' %] + [% IF Koha.Preference('OPACURLOpenInNewWindow') %][% SET target_attr = '_blank'; SET rel_attr = 'noreferrer' %][% END %] + + [%# Check if there are multiple URIs; in the single case we only use pref URLLinkText or Link to resource %] + [% IF ITEM_RESULT.uri.split(' \| ').size > 1 %] + [% FOREACH uri IN ITEM_RESULT.uri.split(' \| ') %] + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %][% SET href_attr = "/cgi-bin/koha/tracklinks.pl?uri=" _ uri _ "&biblionumber=" _ biblio.biblionumber _ "&itemnumber=" _ ITEM_RESULT.itemnumber %] [% ELSE %][% SET href_attr = uri %][% END %] + [% uri | html %]
[% END %] + [% ELSE %] + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %][% SET href_attr = "/cgi-bin/koha/tracklinks.pl?uri=" _ ITEM_RESULT.uri _ "&biblionumber=" _ biblio.biblionumber _ "&itemnumber=" _ ITEM_RESULT.itemnumber %] [% ELSE %][% SET href_attr = ITEM_RESULT.uri %][% END %] + [% IF Koha.Preference('URLLinkText') %][% Koha.Preference('URLLinkText') | html %][% ELSE %]Link to resource[% END %] [% END %] + [% END %] [% END %] [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber | html %][% END %] -- 2.11.0