From 9c580a147f86723cb13204ec27c5a02ddbeef9b2 Mon Sep 17 00:00:00 2001
From: Julian Maurice <julian.maurice@biblibre.com>
Date: Wed, 18 Dec 2013 11:59:36 +0100
Subject: [PATCH] Bug 8995: Show OpenURL links in bootstrap theme

---
 .../opac-tmpl/bootstrap/en/modules/opac-detail.tt  |   21 ++++++++++++++++++++
 .../opac-tmpl/bootstrap/en/modules/opac-results.tt |   17 ++++++++++++++++
 koha-tmpl/opac-tmpl/bootstrap/less/opac.less       |    4 ++++
 3 files changed, 42 insertions(+)

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 6afb240..fa641a6 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
@@ -332,6 +332,27 @@
                                 </ul>
                             </div>
                         [% END # / IF MARCURLS %]
+
+                        [% IF (OPACShowOpenURL && OpenURLResolverURL && ocoins) %]
+                            [%# Build OpenURL image location %]
+                            [% IF (OpenURLImageLocation && !OpenURLImageLocation.match('^https?://')) %]
+                                [% openurlimagelocation = "$interface/$theme/images/$OpenURLImageLocation" %]
+                            [% ELSE %]
+                                [% openurlimagelocation = "$OpenURLImageLocation" %]
+                            [% END %]
+
+                            <span class="results_summary">
+                                <a class="OpenURL" href="[% OpenURLResolverURL %]?[% ocoins %]" title="[% OpenURLText %]">
+                                [% IF openurlimagelocation %]
+                                    <img src="[% openurlimagelocation %]" />
+                                [% ELSIF OpenURLText %]
+                                    [% OpenURLText %]
+                                [% ELSE %]
+                                    OpenURL
+                                [% END %]
+                                </a>
+                            </span>
+                        [% END # / IF (OPACShowOpenURL && OpenURLResolverURL && ocoins) %]
                     [% END # / IF OPACXSLTDetailsDisplay %]
 
                     [% IF ( AuthorisedValueImages && authorised_value_images ) %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
index 1328583..33bf1f6 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
@@ -167,6 +167,12 @@
 
                                 <!-- TABLE RESULTS START -->
                                 <table class="table table-striped">
+                                    [%# Build OpenURL image location %]
+                                    [% IF (OpenURLImageLocation && !OpenURLImageLocation.match('^https?://')) %]
+                                        [% openurlimagelocation = "$interface/$theme/images/$OpenURLImageLocation" %]
+                                    [% ELSE %]
+                                        [% openurlimagelocation = "$OpenURLImageLocation" %]
+                                    [% END %]
 
                                     <!-- Actual Search Results -->
                                     [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
@@ -314,6 +320,17 @@
                                                     [% ELSE %]
                                                         &nbsp;
                                                     [% END %]
+                                                    [% IF (SEARCH_RESULT.ShowOpenURL && OpenURLResolverURL && SEARCH_RESULT.coins) %]
+                                                        <a class="OpenURL" href="[% OpenURLResolverURL %]?[% SEARCH_RESULT.coins %]" title="[% OpenURLText %]">
+                                                        [% IF openurlimagelocation %]
+                                                            <img src="[% openurlimagelocation %]" />
+                                                        [% ELSIF OpenURLText %]
+                                                            [% OpenURLText %]
+                                                        [% ELSE %]
+                                                            OpenURL
+                                                        [% END %]
+                                                        </a>
+                                                    [% END %]
 
                                                     <span class="results_summary publisher">
                                                         <span class="label">Publication:</span>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less b/koha-tmpl/opac-tmpl/bootstrap/less/opac.less
index 19ead3d..227af4f 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less
+++ b/koha-tmpl/opac-tmpl/bootstrap/less/opac.less
@@ -2351,4 +2351,8 @@ a.reviewlink:visited {
     }
 }
 
+a.OpenURL img {
+    vertical-align: middle;
+}
+
 @import "responsive.less";
-- 
1.7.10.4