From ece628d8a00952d0363a7bc02e7256723c405679 Mon Sep 17 00:00:00 2001
From: Julian Maurice <julian.maurice@biblibre.com>
Date: Fri, 2 Sep 2016 16:00:34 +0200
Subject: [PATCH] Bug 8995: Fix and simplify usage of syspref
 OpenURLImageLocation

There were still references to the OPAC 'prog' theme in XSL files
Now, when using a relative URL, we have to give the full path
---
 .../prog/en/modules/admin/preferences/opac.pref          |  6 +++---
 .../bootstrap/en/xslt/MARC21slim2OPACDetail.xsl          | 16 ++--------------
 .../bootstrap/en/xslt/MARC21slim2OPACResults.xsl         | 16 ++--------------
 .../bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl         | 16 ++--------------
 .../bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl        | 16 ++--------------
 5 files changed, 11 insertions(+), 59 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
index 7313d75..c46396e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -514,11 +514,11 @@ OPAC:
             - 'Location of image for OpenURL links:'
             - pref: OpenURLImageLocation
               class: url
-            - '<br />Can be a complete URL starting with <code>http://</code> or'
-            - '<code>https://</code> or the name of a file in <code>images</code> directory'
+            - '<br />Can be an absolute URL starting with <code>http://</code> or'
+            - '<code>https://</code> or a relative URL'
             - '<br />Examples:'
             - '<br />- <code>http://www.example.com/img/openurl.png</code>'
-            - '<br />- <code>OpenURL/OpenURL.png</code> (file is in <code>opac-tmpl/&lt;opacthemes&gt;/images/OpenURL/OpenURL.png</code>)'
+            - '<br />- <code>/opac-tmpl/bootstrap/images/OpenURL.png</code>'
         -
             - pref: OPACShowOpenURL
               choices:
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
index 94e7eb7..2823a74 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
@@ -1247,18 +1247,6 @@
             </xsl:choose>
           </xsl:variable>
 
-          <xsl:variable name="openurlimagelocation">
-            <xsl:choose>
-              <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
-                <xsl:value-of select="$OpenURLImageLocation" />
-              </xsl:when>
-              <xsl:when test="$OpenURLImageLocation != ''">
-                <xsl:text>/opac-tmpl/prog/images/</xsl:text>
-                <xsl:value-of select="$OpenURLImageLocation" />
-              </xsl:when>
-            </xsl:choose>
-          </xsl:variable>
-
           <span class="results_summary"><a>
             <xsl:attribute name="href">
               <xsl:value-of select="$OpenURLResolverURL" />
@@ -1275,10 +1263,10 @@
               </xsl:attribute>
             </xsl:if>
             <xsl:choose>
-              <xsl:when test="$openurlimagelocation != ''">
+              <xsl:when test="$OpenURLImageLocation != ''">
                 <img>
                   <xsl:attribute name="src">
-                    <xsl:value-of select="$openurlimagelocation" />
+                    <xsl:value-of select="$OpenURLImageLocation" />
                   </xsl:attribute>
                 </img>
               </xsl:when>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl
index 8c7d0dd..22491d5 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl
@@ -462,18 +462,6 @@
         </xsl:choose>
       </xsl:variable>
 
-      <xsl:variable name="openurlimagelocation">
-        <xsl:choose>
-          <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
-            <xsl:value-of select="$OpenURLImageLocation" />
-          </xsl:when>
-          <xsl:when test="$OpenURLImageLocation != ''">
-            <xsl:text>/opac-tmpl/prog/images/</xsl:text>
-            <xsl:value-of select="$OpenURLImageLocation" />
-          </xsl:when>
-        </xsl:choose>
-      </xsl:variable>
-
       <span class="results_summary"><a>
         <xsl:attribute name="href">
           <xsl:value-of select="$OpenURLResolverURL" />
@@ -490,10 +478,10 @@
           </xsl:attribute>
         </xsl:if>
         <xsl:choose>
-          <xsl:when test="$openurlimagelocation != ''">
+          <xsl:when test="$OpenURLImageLocation != ''">
             <img>
               <xsl:attribute name="src">
-                <xsl:value-of select="$openurlimagelocation" />
+                <xsl:value-of select="$OpenURLImageLocation" />
               </xsl:attribute>
             </img>
           </xsl:when>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl
index 9cf3554..b94e9cc 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl
@@ -461,18 +461,6 @@
       </xsl:choose>
     </xsl:variable>
 
-    <xsl:variable name="openurlimagelocation">
-      <xsl:choose>
-        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
-          <xsl:value-of select="$OpenURLImageLocation" />
-        </xsl:when>
-        <xsl:when test="$OpenURLImageLocation != ''">
-          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
-          <xsl:value-of select="$OpenURLImageLocation" />
-        </xsl:when>
-      </xsl:choose>
-    </xsl:variable>
-
     <span class="results_summary"><a>
       <xsl:attribute name="href">
         <xsl:value-of select="$OpenURLResolverURL" />
@@ -489,10 +477,10 @@
         </xsl:attribute>
       </xsl:if>
       <xsl:choose>
-        <xsl:when test="$openurlimagelocation != ''">
+        <xsl:when test="$OpenURLImageLocation != ''">
           <img>
             <xsl:attribute name="src">
-              <xsl:value-of select="$openurlimagelocation" />
+              <xsl:value-of select="$OpenURLImageLocation" />
             </xsl:attribute>
           </img>
         </xsl:when>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl
index 2cebcd0..24db601 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl
@@ -102,18 +102,6 @@
       </xsl:choose>
     </xsl:variable>
 
-    <xsl:variable name="openurlimagelocation">
-      <xsl:choose>
-        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
-          <xsl:value-of select="$OpenURLImageLocation" />
-        </xsl:when>
-        <xsl:when test="$OpenURLImageLocation != ''">
-          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
-          <xsl:value-of select="$OpenURLImageLocation" />
-        </xsl:when>
-      </xsl:choose>
-    </xsl:variable>
-
     <span class="results_summary"><a>
       <xsl:attribute name="href">
         <xsl:value-of select="$OpenURLResolverURL" />
@@ -130,10 +118,10 @@
         </xsl:attribute>
       </xsl:if>
       <xsl:choose>
-        <xsl:when test="$openurlimagelocation != ''">
+        <xsl:when test="$OpenURLImageLocation != ''">
           <img>
             <xsl:attribute name="src">
-              <xsl:value-of select="$openurlimagelocation" />
+              <xsl:value-of select="$OpenURLImageLocation" />
             </xsl:attribute>
           </img>
         </xsl:when>
-- 
2.1.4