From 7771824e3444f5d744ff3a71ed872800a2c2f759 Mon Sep 17 00:00:00 2001 From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Date: Fri, 4 Sep 2015 15:22:24 +0100 Subject: [PATCH] Bug 14575: Fix OPACURLOpenInNewWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are some type fixed with this patch. This patch creates a TT var "target" to avoid c/p links. Signed-off-by: Marc VĂ©ron <veron@veron.ch> --- .../opac-tmpl/bootstrap/en/modules/opac-basket.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 38 +++++++------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt index fb9234b..94d5e0b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -198,7 +198,7 @@ [% FOREACH MARCurl IN BIBLIO_RESULT.MARCURLS %] [% IF MARCurl.part %]<p>[% MARCurl.part %]</p>[% END %] - [% IF OPACurlOpenInNewWindow %] + [% IF OPACURLOpenInNewWindow %] <a href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]" target="_blank">[% MARCurl.linktext %]</a> [% ELSE %] <a href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]">[% MARCurl.linktext %]</a> 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 3229b8c..e533184 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -37,6 +37,10 @@ [% INCLUDE 'bodytag.inc' bodyid='opac-detail' bodyclass='scrollto' %] [% INCLUDE 'masthead.inc' %] +[% IF OPACURLOpenInNewWindow %] + [% SET target = 'target="_blank" ' %] +[% END %] + <div class="main"> <ul class="breadcrumb"> <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> @@ -53,7 +57,7 @@ <div title="[% biblionumber |url %]" class="[% biblionumber %]" id="local-thumbnail-preview"></div> [% END %] [% IF ( OPACAmazonCoverImages ) %] - [% IF ( OPACurlOpenInNewWindow ) %] + [% IF ( OPACURLOpenInNewWindow ) %] <a href="http://www.amazon[% AmazonTld %]/gp/reader/[% normalized_isbn %]/ref=sib_dp_pt/002-7879865-0184864#reader-link" target="_blank"> [% ELSE %] <a href="http://www.amazon[% AmazonTld %]/dp/[% normalized_isbn %]"> @@ -92,9 +96,9 @@ [% IF ( BakerTaylorEnabled && bt_id ) %] [% IF BakerTaylorBookstoreURL %] [% IF ( OPACurlOpenInNewWindow ) %] - <a href="https://[% BakerTaylorBookstoreURL |html %][% bt_id %]" target="_blank"><img alt="See Baker & Taylor" src="[% BakerTaylorImageURL |html %][% bt_id %]" /></a> + <a[% target %]href="https://[% BakerTaylorBookstoreURL |html %][% normalized_isbn %]" target="_blank"><img alt="See Baker & Taylor" src="[% BakerTaylorImageURL |html %][% normalized_isbn %]" /></a> [% ELSE %] - <a href="https://[% BakerTaylorBookstoreURL |html %][% bt_id %]"><img alt="See Baker & Taylor" src="[% BakerTaylorImageURL |html %][% bt_id %]" /></a> + <a[% target %]href="https://[% BakerTaylorBookstoreURL |html %][% normalized_isbn %]"><img alt="See Baker & Taylor" src="[% BakerTaylorImageURL |html %][% normalized_isbn %]" /></a> [% END %] [% ELSE %] <img alt="See Baker & Taylor" src="[% BakerTaylorImageURL |html %][% bt_id %]" /> @@ -339,18 +343,10 @@ [% FOREACH MARCurl IN MARCURLS %] <li>[% IF ( MARCurl.part ) %][% MARCurl.part %]<br />[% END %] - [% IF ( OPACurlOpenInNewWindow ) %] - [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - <a href="/cgi-bin/koha/tracklinks.pl?uri=[% MARCurl.MARCURL |url%]&biblionumber=[% biblionumber | url %]" title="[% MARCurl.MARCURL %]" target="_blank"> - [% ELSE %] - <a href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]" target="_blank"> - [% END %] + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] + <a [% target %]href="/cgi-bin/koha/tracklinks.pl?uri=[% MARCurl.MARCURL |url%]&biblionumber=[% biblionumber | url %]" title="[% MARCurl.MARCURL %]"> [% ELSE %] - [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - <a href="/cgi-bin/koha/tracklinks.pl?uri=[% MARCurl.MARCURL |url%]&biblionumber=[% biblionumber | url %]" title="[% MARCurl.MARCURL %]"> - [% ELSE %] - <a href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]"> - [% END %] + <a [% target %]href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]"> [% END %] [% MARCurl.linktext %]</a> @@ -519,7 +515,7 @@ [% IF ( BakerTaylorContentURL ) %] <span class="results_summary"> <span class="label">Enhanced content: </span> - [% IF ( OPACurlOpenInNewWindow ) %]<a href="[% BakerTaylorContentURL |html %]" target="_blank">Content Cafe</a>[% ELSE %]<a href="[% BakerTaylorContentURL |html %]">Content Cafe</a>[% END %] + <a [% target %]href="[% BakerTaylorContentURL |html %]">Content Cafe</a> </span> [% END # / IF BakerTaylorContentURL %] @@ -1277,17 +1273,9 @@ <td class="url"> [% IF ITEM_RESULT.uri %] [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - [% IF Koha.Preference("OPACURLOpenInNewWindow") %] - <a target="_blank" href="/cgi-bin/koha/tracklinks.pl?uri=[% ITEM_RESULT.uri | url %]&biblionumber=[% biblionumber |url %]&itemnumber=[% ITEM_RESULT.itemnumber | url %]" property="url"> Link to resource </a> - [% ELSE %] - <a href="/cgi-bin/koha/tracklinks.pl?uri=[% ITEM_RESULT.uri | url %]&biblionumber=[% biblionumber |url %]&itemnumber=[% ITEM_RESULT.itemnumber | url %]" property="url"> Link to resource </a> - [% END %] + <a [% target %]href="/cgi-bin/koha/tracklinks.pl?uri=[% ITEM_RESULT.uri | url %]&biblionumber=[% biblionumber |url %]&itemnumber=[% ITEM_RESULT.itemnumber | url %]" property="url"> Link to resource </a> [% ELSE %] - [% IF Koha.Preference("OPACURLOpenInNewWindow") %] - <a target="_blank" href="[% ITEM_RESULT.uri %]" property="url">[% ITEM_RESULT.uri %]</a> - [% ELSE %] - <a href="[% ITEM_RESULT.uri %]" property="url">[% ITEM_RESULT.uri %]</a> - [% END %] + <a [% target %]href="[% ITEM_RESULT.uri %]" property="url">[% ITEM_RESULT.uri %]</a> [% END %] [% END %] </td> -- 1.7.10.4