Bug 4506: Add links to other editions, some minor corrections

A new label 'Other editions:' is added with links to other editions.
The link starts a search for control number from 775$w in index control number.

A check for existence of $w/001 is added to always provide a fallback to a search for the link text.

Take care of repeated 773 fields.

Signed-off-by: Colin Campbell <colin.campbell@ptfs-europe.com>
This commit is contained in:
Katrin Fischer 2010-09-27 01:55:45 +02:00 committed by Colin Campbell
parent bfbf10e8e9
commit 26fa2de914
2 changed files with 84 additions and 10 deletions

View File

@ -220,7 +220,7 @@
<span class="results_summary"><span class="label">Volumes: </span>
<a>
<xsl:choose>
<xsl:when test="$UseControlNumber = '1'">
<xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
@ -235,17 +235,23 @@
<!-- Set -->
<xsl:if test="$leader19='c'">
<span class="results_summary"><span class="label">Set: </span>
<xsl:for-each select="marc:datafield[@tag=773]">
<a>
<xsl:choose>
<xsl:when test="$UseControlNumber = '1'">
<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:value-of select="marc:datafield[@tag=773]/marc:subfield[@code='w']"/></xsl:attribute>
<xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Title:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
</a>
<xsl:choose>
<xsl:when test="position()=last()"></xsl:when>
<xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
@ -533,6 +539,37 @@
</xsl:for-each>
</xsl:if>
<!-- 775 Other Edition -->
<xsl:if test="marc:datafield[@tag=775]">
<span class="results_summary"><span class="label">Other Editions: </span>
<xsl:for-each select="marc:datafield[@tag=775]">
<xsl:if test="marc:subfield[@code='i']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">i</xsl:with-param>
</xsl:call-template>
<xsl:text>: </xsl:text>
</xsl:if>
<a>
<xsl:choose>
<xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Title:<xsl:value-of select="translate(marc:subfield[@code='t'], '.', '')"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">t</xsl:with-param>
</xsl:call-template>
</a>
<xsl:choose>
<xsl:when test="position()=last()"></xsl:when>
<xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
<!-- 780 -->
<xsl:if test="marc:datafield[@tag=780]">
<xsl:for-each select="marc:datafield[@tag=780]">

View File

@ -239,7 +239,7 @@
<span class="results_summary"><span class="label">Volumes: </span>
<a>
<xsl:choose>
<xsl:when test="$UseControlNumber = '1'">
<xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="marc:controlfield[@tag=001]"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
@ -254,17 +254,23 @@
<!-- Set -->
<xsl:if test="$leader19='c'">
<span class="results_summary"><span class="label">Set: </span>
<xsl:for-each select="marc:datafield[@tag=773]">
<a>
<xsl:choose>
<xsl:when test="$UseControlNumber = '1'">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:datafield[@tag=773]/marc:subfield[@code='w']"/></xsl:attribute>
<xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
<xsl:value-of select="translate(//marc:datafield[@tag=245]/marc:subfield[@code='a'], '.', '')" />
</a>
<xsl:choose>
<xsl:when test="position()=last()"></xsl:when>
<xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
@ -602,6 +608,37 @@
</span>
</xsl:if>
<!-- 775 Other Edition -->
<xsl:if test="marc:datafield[@tag=775]">
<span class="results_summary"><span class="label">Other Editions: </span>
<xsl:for-each select="marc:datafield[@tag=775]">
<xsl:if test="marc:subfield[@code='i']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">i</xsl:with-param>
</xsl:call-template>
<xsl:text>: </xsl:text>
</xsl:if>
<a>
<xsl:choose>
<xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:value-of select="marc:subfield[@code='w']"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Title:<xsl:value-of select="translate(marc:subfield[@code='t'], '.', '')"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">t</xsl:with-param>
</xsl:call-template>
</a>
<xsl:choose>
<xsl:when test="position()=last()"></xsl:when>
<xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:if>
<!-- 780 -->
<xsl:if test="marc:datafield[@tag=780]">
<xsl:for-each select="marc:datafield[@tag=780]">