From 01994e2c48ee15d750bdbce2dec87babb11dc8cb Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 27 Aug 2015 09:49:40 +0200 Subject: [PATCH] Bug 14306: Changes for basket and detail templates MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit A simple regex is added to the basket and detail templates to select the URLs passed separately from MARC21 555$u by GetMarcNotes. Note that the regex tests if a note starts with http:// or https:// and does not contain any whitespace in order to be considered as a url. These URLs are put in an anchor tag. This touches four places: [1] opac detail, tab title notes [2] catalogue detail, tab Descriptions [3] opac basket, more details, notes [4] staff basket, more details, notes Test plan: [1] Edit a record. Add a 500$a, 555$a and a URL in 555$u. Put "http://this is not a url" in the 500$a (whitespace!). [2] Check opac-detail, tab Title Notes. Check the URL. [3] Do the same for catalogue/detail. [4] Add record to cart in OPAC. Open basket. Check More details. [5] Repeat previous step in staff. Signed-off-by: Marc Véron Signed-off-by: Katrin Fischer Signed-off-by: Brendan A Gallagher --- .../intranet-tmpl/prog/en/modules/basket/basket.tt | 10 ++++++++-- .../prog/en/modules/catalogue/detail.tt | 12 +++++++++--- .../opac-tmpl/bootstrap/en/modules/opac-basket.tt | 11 +++++++++-- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 8 +++++++- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt index ff9095c620..a6e7c57e1d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt @@ -242,8 +242,14 @@ function batchDelete(){ Notes [% FOREACH MARCNOTE IN BIBLIO_RESULT.MARCNOTES %] -

- [% MARCNOTE.marcnote %]

- [% END %] +

+ [% IF MARCNOTE.marcnote.match('^https?://\S+$') %] + - [% MARCNOTE.marcnote %] + [% ELSE %] + - [% MARCNOTE.marcnote %] + [% END %] + [% END %] + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index e46428a34c..40681f38e6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -856,11 +856,17 @@ function verify_images() { [% IF ( MARCNOTES ) %] [% FOREACH MARCNOTE IN MARCNOTES %] -

[% MARCNOTE.marcnote FILTER html_line_break %]

+

+ [% IF MARCNOTE.marcnote.match('^https?://\S+$') %] + [% MARCNOTE.marcnote %] + [% ELSE %] + [% MARCNOTE.marcnote FILTER html_line_break %] + [% END %] +

[% END %] - [% ELSE %] +[% ELSE %] [% IF ( notes ) %] -

[% notes %]

+

[% notes %]

[% END %] [% END %] 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 94d5e0b60e..25661ff1ff 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -151,8 +151,15 @@ Notes [% FOREACH MARCNOTE IN BIBLIO_RESULT.MARCNOTES %] -

- [% MARCNOTE.marcnote %]

- [% END %] +

+ [% IF MARCNOTE.marcnote.match('^https?://\S+$') %] + - [% MARCNOTE.marcnote %] + [% ELSE %] + - [% MARCNOTE.marcnote %] + [% END %] +

+ [% END %] + [% END %] 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 6c178881be..6bdcc475f8 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -717,7 +717,13 @@ [% IF ( MARCNOTES ) %]
[% FOREACH MARCNOTE IN MARCNOTES %] -

[% MARCNOTE.marcnote FILTER html_line_break %]

+

+ [% IF MARCNOTE.marcnote.match('^https?://\S+$') %] + [% MARCNOTE.marcnote %] + [% ELSE %] + [% MARCNOTE.marcnote FILTER html_line_break %] + [% END %] +

[% END %]
[% ELSE %] -- 2.39.5