Bug 12655 [Revised] PROG/CCSR deprecation: Correct hard-coded opac-tmpl/prog path...
authorOwen Leonard <oleonard@myacpl.org>
Tue, 12 Aug 2014 14:09:57 +0000 (10:09 -0400)
committerChris Cormack <chrisc@catalyst.net.nz>
Wed, 29 Oct 2014 20:35:12 +0000 (09:35 +1300)
Two XSL files in the bootstrap theme contain hard-coded paths to the
prog theme directory. This patch adds a query of the opacthemes system
preference and builds the path based on the returned value.

To test in a MARC21 system:

Create or locate a record which contains a subject which is linked to an
authority record. View the detail page for that record in the bootstrap
OPAC and confirm that there is a magnifying class icon next to the link
for that subject heading. Inspect or right-click the image and "View
image" [FF. "Open image in new tab" in Chrome] to verify that the image
being shown is from the bootstrap theme directory.

Also modified: The NORMARC XSL for the detail page which has been
changed in the same way. I did not test it in a NORMARC catalog.

Edit: Fixed copy-and-paste error causing duplicate image.
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
C4/XSLT.pm
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
koha-tmpl/opac-tmpl/bootstrap/en/xslt/NORMARCslim2OPACDetail.xsl

index bfacc65..a255b33 100644 (file)
@@ -206,7 +206,7 @@ sub XSLTParse4Display {
                               UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
                               singleBranchMode OPACItemLocation DisplayIconsXSLT
                               AlternateHoldingsField AlternateHoldingsSeparator
-                              TrackClicks / )
+                              TrackClicks opacthemes / )
     {
         my $sp = C4::Context->preference( $syspref );
         next unless defined($sp);
index a856823..15960cd 100644 (file)
@@ -28,6 +28,7 @@
     <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
     <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='OPACDisplay856uAsImage']"/>
     <xsl:variable name="OPACTrackClicks" select="marc:sysprefs/marc:syspref[@name='TrackClicks']"/>
+    <xsl:variable name="theme" select="marc:sysprefs/marc:syspref[@name='opacthemes']"/>
     <xsl:variable name="biblionumber" select="marc:datafield[@tag=999]/marc:subfield[@code='c']"/>
     <xsl:variable name="TracingQuotesLeft">
       <xsl:choose>
             <xsl:if test="marc:subfield[@code=9]">
                 <a class='authlink'>
                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
-                    <img style="vertical-align:middle" height="15" width="15" src="/opac-tmpl/prog/images/filefind.png"/>
+                    <xsl:element name="img">
+                        <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
+                        <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
+                        <xsl:attribute name="height">15</xsl:attribute>
+                        <xsl:attribute name="width">15</xsl:attribute>
+                    </xsl:element>
                 </a>
             </xsl:if>
             <xsl:choose>
             <xsl:if test="marc:subfield[@code=9]">
                 <a class='authlink'>
                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
-                    <img style="vertical-align:middle" height="15" width="15" src="/opac-tmpl/prog/images/filefind.png"/>
+                    <xsl:element name="img">
+                        <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
+                        <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
+                        <xsl:attribute name="height">15</xsl:attribute>
+                        <xsl:attribute name="width">15</xsl:attribute>
+                    </xsl:element>
                 </a>
             </xsl:if>
         </xsl:for-each>
index e9fd625..62e004d 100644 (file)
@@ -33,6 +33,7 @@
           </xsl:choose>
         </xsl:variable>
         <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
+        <xsl:variable name="theme" select="marc:sysprefs/marc:syspref[@name='opacthemes']"/>
 
         <xsl:variable name="leader" select="marc:leader"/>
         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
         <xsl:if test="marc:subfield[@code=9]">
             <a class='authlink'>
                 <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
-                <img style="vertical-align:middle" height="15" width="15" src="/opac-tmpl/prog/images/filefind.png"/>
+                <xsl:element name="img">
+                    <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
+                    <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
+                    <xsl:attribute name="height">15</xsl:attribute>
+                    <xsl:attribute name="width">15</xsl:attribute>
+                </xsl:element>
             </a>
         </xsl:if>
         <xsl:choose>
         <xsl:if test="marc:subfield[@code=9]">
             <a class='authlink'>
                 <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
-                <img style="vertical-align:middle" height="15" width="15" src="/opac-tmpl/prog/images/filefind.png"/>
+                <xsl:element name="img">
+                    <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
+                    <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
+                    <xsl:attribute name="height">15</xsl:attribute>
+                    <xsl:attribute name="width">15</xsl:attribute>
+                </xsl:element>
             </a>
         </xsl:if>
         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
         <xsl:if test="marc:subfield[@code=9]">
             <a class='authlink'>
                 <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
-                <img style="vertical-align:middle" height="15" width="15" src="/opac-tmpl/prog/images/filefind.png"/>
+                <xsl:element name="img">
+                    <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
+                    <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
+                    <xsl:attribute name="height">15</xsl:attribute>
+                    <xsl:attribute name="width">15</xsl:attribute>
+                </xsl:element>
             </a>
         </xsl:if>
         <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
             <xsl:if test="marc:subfield[@code=9]">
                 <a class='authlink'>
                     <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute>
-                    <img style="vertical-align:middle" height="15" width="15" src="/opac-tmpl/prog/images/filefind.png"/>
+                    <xsl:element name="img">
+                        <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
+                        <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
+                        <xsl:attribute name="height">15</xsl:attribute>
+                        <xsl:attribute name="width">15</xsl:attribute>
+                    </xsl:element>
                 </a>
             </xsl:if>
             <xsl:choose>