Bug 26825: Add span for publication date in OPAC
authorOwen Leonard <oleonard@myacpl.org>
Tue, 27 Oct 2020 15:02:43 +0000 (15:02 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 4 Nov 2020 11:59:33 +0000 (12:59 +0100)
This patch modifies the XSL templates for OPAC results and OPAC details
so that the parts of the publisher details are wrapped separate <span>s:
Publisher place, name, and date.

To test, apply the patch "restart_all" if necessary.

You can add this to the OPACUserCSS system preference to better see the
change:

.publisher_place { color: red; }
.publisher_name { color: green; }
.publisher_date { color: orange; }

- Peform a search in the OPAC
- In the search results, confirm that the publisher plac, name, and date
  are wrapped in separate <span>s, either by confirming the custom
  colors or by inspecting the source.
- View the details for one of the results. Confirm that the same change
  has been made to the detail page.

Signed-off-by: B Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl

index 8f50ad5..f768671 100644 (file)
                  <xsl:for-each select="marc:datafield[@tag=260]">
                      <span property="publisher" typeof="Organization">
                      <xsl:if test="marc:subfield[@code='a']">
-                         <span property="location">
-                         <xsl:call-template name="subfieldSelect">
-                             <xsl:with-param name="codes">a</xsl:with-param>
-                         </xsl:call-template>
-                         </span>
+                        <span class="publisher_place" property="location">
+                            <xsl:call-template name="subfieldSelect">
+                                <xsl:with-param name="codes">a</xsl:with-param>
+                            </xsl:call-template>
+                        </span>
                      </xsl:if>
                      <xsl:text> </xsl:text>
                      <xsl:if test="marc:subfield[@code='b']">
-                     <span property="name"><a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Provider:<xsl:value-of select="str:encode-uri(marc:subfield[@code='b'], true())"/></xsl:attribute>
-                         <xsl:call-template name="subfieldSelect">
-                             <xsl:with-param name="codes">b</xsl:with-param>
-                         </xsl:call-template>
-                     </a></span>
+                        <span property="name" class="publisher_name">
+                            <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Provider:<xsl:value-of select="str:encode-uri(marc:subfield[@code='b'], true())"/></xsl:attribute>
+                                <xsl:call-template name="subfieldSelect">
+                                    <xsl:with-param name="codes">b</xsl:with-param>
+                                </xsl:call-template>
+                            </a>
+                        </span>
                      </xsl:if>
                      </span>
                      <xsl:text> </xsl:text>
                      <xsl:if test="marc:subfield[@code='c' or @code='g']">
-                     <span property="datePublished">
-                         <xsl:call-template name="chopPunctuation">
-                           <xsl:with-param name="chopString">
-                             <xsl:call-template name="subfieldSelect">
-                                 <xsl:with-param name="codes">cg</xsl:with-param>
-                             </xsl:call-template>
-                            </xsl:with-param>
-                        </xsl:call-template>
-                     </span>
+                        <span property="datePublished" class="publisher_date">
+                           <xsl:call-template name="chopPunctuation">
+                               <xsl:with-param name="chopString">
+                                    <xsl:call-template name="subfieldSelect">
+                                        <xsl:with-param name="codes">cg</xsl:with-param>
+                                    </xsl:call-template>
+                                </xsl:with-param>
+                            </xsl:call-template>
+                        </span>
                      </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:for-each>
index 1d0d473..cb74d0a 100644 (file)
             <span class="results_summary publisher"><span class="label">Publication details: </span>
                 <xsl:for-each select="marc:datafield[@tag=260]">
                     <xsl:if test="marc:subfield[@code='a']">
-                        <xsl:call-template name="subfieldSelect">
-                            <xsl:with-param name="codes">a</xsl:with-param>
-                        </xsl:call-template>
+                        <span class="publisher_place" property="location">
+                            <xsl:call-template name="subfieldSelect">
+                                <xsl:with-param name="codes">a</xsl:with-param>
+                            </xsl:call-template>
+                        </span>
                     </xsl:if>
                     <xsl:text> </xsl:text>
                     <xsl:if test="marc:subfield[@code='b']">
-                        <xsl:call-template name="subfieldSelect">
-                            <xsl:with-param name="codes">b</xsl:with-param>
-                        </xsl:call-template>
+                        <span property="name" class="publisher_name">
+                            <xsl:call-template name="subfieldSelect">
+                                <xsl:with-param name="codes">b</xsl:with-param>
+                            </xsl:call-template>
+                        </span>
                     </xsl:if>
                     <xsl:text> </xsl:text>
-                    <xsl:call-template name="chopPunctuation">
-                      <xsl:with-param name="chopString">
-                        <xsl:call-template name="subfieldSelect">
-                            <xsl:with-param name="codes">cg</xsl:with-param>
+                    <span property="datePublished" class="publisher_date">
+                        <xsl:call-template name="chopPunctuation">
+                            <xsl:with-param name="chopString">
+                                    <xsl:call-template name="subfieldSelect">
+                                        <xsl:with-param name="codes">cg</xsl:with-param>
+                                    </xsl:call-template>
+                            </xsl:with-param>
                         </xsl:call-template>
-                       </xsl:with-param>
-                    </xsl:call-template>
+                    </span>
                     <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
                 </xsl:for-each>
                 <xsl:if test="marc:datafield[@tag=264]">