From 26d4b7fd5e35f784f951c4f9e9bb084a9f4612a4 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 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: Bernardo Gonzalez Kriegel Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize --- .../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 197672c124..b34c369295 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1259,37 +1259,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.39.5