Bug 33281: Improve detail auth links and add to marc preview

This patch adds atuh links tot he marc preview, and makes detial auth links open in a
new tab/window and consolidates some code

To test:
1 - View a record linked to authorities in staff client
2 - Note links have no hover text, and open in same window
3 - Apply patch
4 - Restart and reload
5 - Note links now have a hint
6 - Note they open in new window
7 -  View marc preview and note there are similar links

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-03-20 16:53:15 +00:00 committed by Tomas Cohen Arazi
parent 6cc5c0208a
commit 04f172d344
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 39 additions and 25 deletions

View file

@ -686,14 +686,9 @@
</a>
<xsl:if test="marc:subfield[@code=9]">
<xsl:text> </xsl:text>
<a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:element name="i">
<xsl:attribute name="class">fa fa-search</xsl:attribute>
<xsl:attribute name="aria-label">View authority record</xsl:attribute>
</xsl:element>
</a>
<xsl:call-template name="showAuthlink">
<xsl:with-param name="authid"><xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:choose>
@ -735,15 +730,11 @@
</xsl:call-template>
</a>
<xsl:if test="marc:subfield[@code=9]">
<xsl:text> </xsl:text>
<a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:element name="i">
<xsl:attribute name="class">fa fa-search</xsl:attribute>
<xsl:attribute name="aria-label">View authority record</xsl:attribute>
</xsl:element>
</a>
<xsl:call-template name="showAuthlink">
<xsl:with-param name="authid"><xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="position()!=last()"><span class="separator"> | </span></xsl:if>
</xsl:for-each>
@ -1745,14 +1736,9 @@
</xsl:if>
</a>
<xsl:if test="marc:subfield[@code=9]">
<xsl:text> </xsl:text>
<a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
<xsl:element name="i">
<xsl:attribute name="class">fa fa-search</xsl:attribute>
<xsl:attribute name="aria-label">View authority record</xsl:attribute>
</xsl:element>
</a>
<xsl:call-template name="showAuthlink">
<xsl:with-param name="authid"><xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:choose>
<xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
@ -1762,6 +1748,20 @@
</xsl:if>
</xsl:template>
<xsl:template name="showAuthlink">
<xsl:param name="authid"/>
<xsl:text> </xsl:text>
<a class='authlink'>
<xsl:attribute name="href">/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="$authid"/></xsl:attribute>
<xsl:attribute name="title">View authority record</xsl:attribute>
<xsl:attribute name="target">_blank</xsl:attribute>
<xsl:element name="i">
<xsl:attribute name="class">fa fa-search</xsl:attribute>
<xsl:attribute name="aria-label">View authority record</xsl:attribute>
</xsl:element>
</a>
</xsl:template>
<!-- #1807 Strip unwanted parenthesis from subjects for searching -->
<xsl:template name="subfieldSelectSubject">
<xsl:param name="codes"/>

View file

@ -51,7 +51,21 @@
</xsl:template>
<xsl:template match="marc:subfield">
<strong>_<xsl:value-of select="@code"/></strong> <xsl:value-of select="."/>
<strong>_<xsl:value-of select="@code"/></strong>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="@code = '9'">
<a>
<xsl:attribute name='href'>/cgi-bin/koha/authorities/detail.pl?authid=<xsl:value-of select="."/></xsl:attribute>
<xsl:attribute name="title">View authority record</xsl:attribute>
<xsl:attribute name='target'>_blank</xsl:attribute>
<xsl:value-of select="."/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="position()=last()"><xsl:text> </xsl:text></xsl:when><xsl:otherwise><br /></xsl:otherwise></xsl:choose>
</xsl:template>