Bug 14306: Changes for basket and detail templates
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 27 Aug 2015 07:49:40 +0000 (09:49 +0200)
committerBrendan A Gallagher <brendan@bywatersolutions.com>
Mon, 7 Mar 2016 17:58:33 +0000 (17:58 +0000)
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 <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt

index ff9095c..a6e7c57 100644 (file)
@@ -242,8 +242,14 @@ function batchDelete(){
             <th scope="row">Notes</th>
             <td>
             [% FOREACH MARCNOTE IN BIBLIO_RESULT.MARCNOTES %]
-                <p>- [% MARCNOTE.marcnote %]</p>
-            [% END %]</td>
+                <p>
+                [% IF MARCNOTE.marcnote.match('^https?://\S+$') %]
+                    - <a target="_blank" href="[% MARCNOTE.marcnote %]">[% MARCNOTE.marcnote %]</a>
+                [% ELSE %]
+                    - [% MARCNOTE.marcnote %]
+                [% END %]
+            [% END %]
+            </td>
         </tr>
         [% END %]
 
index e46428a..40681f3 100644 (file)
@@ -856,11 +856,17 @@ function verify_images() {
 
 [% IF ( MARCNOTES ) %]
     [% FOREACH MARCNOTE IN MARCNOTES %]
-    <p>[% MARCNOTE.marcnote FILTER html_line_break %]</p>
+        <p>
+        [% IF MARCNOTE.marcnote.match('^https?://\S+$') %]
+            <a target="_blank" href="[% MARCNOTE.marcnote %]">[% MARCNOTE.marcnote %]</a>
+        [% ELSE %]
+            [% MARCNOTE.marcnote FILTER html_line_break %]
+        [% END %]
+        </p>
     [% END %]
-    [% ELSE %]
+[% ELSE %]
     [% IF ( notes ) %]
-    <p>[% notes %]</p>
+        <p>[% notes %]</p>
     [% END %]
 [% END %]
 </div>
index 94d5e0b..25661ff 100644 (file)
                                                 <th scope="row">Notes</th>
                                                 <td>
                                                 [% FOREACH MARCNOTE IN BIBLIO_RESULT.MARCNOTES %]
-                                                    <p>- [% MARCNOTE.marcnote %]</p>
-                                                [% END %]</td>
+                                                    <p>
+                                                    [% IF MARCNOTE.marcnote.match('^https?://\S+$') %]
+                                                        - <a target="_blank" href="[% MARCNOTE.marcnote %]">[% MARCNOTE.marcnote %]</a>
+                                                    [% ELSE %]
+                                                        - [% MARCNOTE.marcnote %]
+                                                    [% END %]
+                                                    </p>
+                                                [% END %]
+                                                </td>
                                             </tr>
                                         [% END %]
 
index 6c17888..6bdcc47 100644 (file)
                             [% IF ( MARCNOTES ) %]
                                 <div id="marcnotes">
                                 [% FOREACH MARCNOTE IN MARCNOTES %]
-                                    <p>[% MARCNOTE.marcnote FILTER html_line_break %]</p>
+                                    <p>
+                                    [% IF MARCNOTE.marcnote.match('^https?://\S+$') %]
+                                        <a target="_blank" href="[% MARCNOTE.marcnote %]">[% MARCNOTE.marcnote %]</a>
+                                    [% ELSE %]
+                                        [% MARCNOTE.marcnote FILTER html_line_break %]
+                                    [% END %]
+                                    </p>
                                 [% END %]
                                 </div>
                             [% ELSE %]