Bugzilla – Attachment 192814 Details for
Bug 38096
Field 857 is not considered for display on XSLT files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38096: OPAC: Move 856 logic to renderMARCOnlineResourceField utils
Bug-38096-OPAC-Move-856-logic-to-renderMARCOnlineR.patch (text/plain), 15.20 KB, created by
Pedro Amorim
on 2026-02-09 16:03:47 UTC
(
hide
)
Description:
Bug 38096: OPAC: Move 856 logic to renderMARCOnlineResourceField utils
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2026-02-09 16:03:47 UTC
Size:
15.20 KB
patch
obsolete
>From a961647fe052adca993eb7e40ad1ce82e196dc0a Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Mon, 7 Oct 2024 12:03:03 +0000 >Subject: [PATCH] Bug 38096: OPAC: Move 856 logic to > renderMARCOnlineResourceField utils > >Now that OPAC detail and search results are consitent, we can DRY this >logic to its own function to be also utilized by 857 in the following >commit > >Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> >--- > .../en/xslt/MARC21slim2OPACDetail.xsl | 49 +++-------------- > .../en/xslt/MARC21slim2OPACResults.xsl | 48 +++-------------- > .../bootstrap/en/xslt/MARC21slimUtils.xsl | 54 +++++++++++++++++++ > 3 files changed, 66 insertions(+), 85 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index c4d44a4234c..4ca9e0b97ca 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -1069,50 +1069,13 @@ > <span class="results_summary online_resources"> > <span class="label">Online resources: </span> > <ul class="resource_list"> >- <xsl:for-each select="marc:datafield[@tag=856 and marc:subfield[@code='u']]"> >- <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable> >- <li> >- <a property="url"> >- <xsl:choose> >- <xsl:when test="$OPACTrackClicks='track'"> >- <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute> >- </xsl:when> >- <xsl:when test="$OPACTrackClicks='anonymous'"> >- <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute> >- </xsl:when> >- <xsl:otherwise> >- <xsl:attribute name="href"> >- <xsl:call-template name="AddMissingProtocol"> >- <xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']"/> >- <xsl:with-param name="indicator1" select="@ind1"/> >- <xsl:with-param name="accessMethod" select="marc:subfield[@code='2']"/> >+ <xsl:call-template name="renderMARCOnlineResourceField"> >+ <xsl:with-param name="MARCOnlineResourceField">856</xsl:with-param> >+ <xsl:with-param name="Show856uAsImage" select="$Show856uAsImage"></xsl:with-param> >+ <xsl:with-param name="OPACTrackClicks" select="$OPACTrackClicks"></xsl:with-param> >+ <xsl:with-param name="OPACURLOpenInNewWindow" select="$OPACURLOpenInNewWindow"></xsl:with-param> >+ <xsl:with-param name="screen" select="detail"></xsl:with-param> > </xsl:call-template> >- <xsl:value-of select="normalize-space(marc:subfield[@code='u'])"/> >- </xsl:attribute> >- </xsl:otherwise> >- </xsl:choose> >- <xsl:if test="$OPACURLOpenInNewWindow='1'"> >- <xsl:attribute name="target">_blank</xsl:attribute> >- </xsl:if> >- <xsl:choose> >- <xsl:when test="($Show856uAsImage='Details' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')"> >- <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px</xsl:attribute></xsl:element><xsl:text></xsl:text> >- </xsl:when> >- <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']"> >- <xsl:call-template name="subfieldSelect"> >- <xsl:with-param name="codes">y3z</xsl:with-param> >- </xsl:call-template> >- </xsl:when> >- <xsl:when test="$URLLinkText!=''"> >- <xsl:value-of select="$URLLinkText"/> >- </xsl:when> >- <xsl:otherwise> >- <xsl:text>Click here to access online</xsl:text> >- </xsl:otherwise> >- </xsl:choose> >- </a> >- </li> >- </xsl:for-each> > </ul> > </span> > </xsl:if> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >index 26e9964e298..4572e62be07 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >@@ -1191,49 +1191,13 @@ > <div class="results_summary online_resources"> > <span class="label">Online resources: </span> > <ul class="resource_list"> >- <xsl:for-each select="marc:datafield[@tag=856 and marc:subfield[@code='u']]"> >- <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']"/></xsl:variable> >- <li> >- <a property="url"> >- <xsl:choose> >- <xsl:when test="$OPACTrackClicks='track'"> >- <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute> >- </xsl:when> >- <xsl:when test="$OPACTrackClicks='anonymous'"> >- <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute> >- </xsl:when> >- <xsl:otherwise> >- <xsl:attribute name="href"> >- <xsl:call-template name="AddMissingProtocol"> >- <xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']"/> >- <xsl:with-param name="indicator1" select="@ind1"/> >- <xsl:with-param name="accessMethod" select="marc:subfield[@code='2']"/> >+ <xsl:call-template name="renderMARCOnlineResourceField"> >+ <xsl:with-param name="MARCOnlineResourceField">856</xsl:with-param> >+ <xsl:with-param name="Show856uAsImage" select="$Show856uAsImage"></xsl:with-param> >+ <xsl:with-param name="OPACTrackClicks" select="$OPACTrackClicks"></xsl:with-param> >+ <xsl:with-param name="OPACURLOpenInNewWindow" select="$OPACURLOpenInNewWindow"></xsl:with-param> >+ <xsl:with-param name="screen" select="results"></xsl:with-param> > </xsl:call-template> >- <xsl:value-of select="normalize-space(marc:subfield[@code='u'])"/> >- </xsl:attribute> >- </xsl:otherwise> >- </xsl:choose> >- <xsl:if test="$OPACURLOpenInNewWindow='1'"> >- <xsl:attribute name="target">_blank</xsl:attribute> >- </xsl:if> >- <xsl:choose> >- <xsl:when test="($Show856uAsImage='Results' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')"> >- <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px;</xsl:attribute></xsl:element><xsl:text></xsl:text> >- </xsl:when> >- <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']"> >- <xsl:call-template name="subfieldSelect"> >- <xsl:with-param name="codes">y3z</xsl:with-param> >- </xsl:call-template> >- </xsl:when> >- <xsl:when test="$URLLinkText!=''"> >- <xsl:value-of select="$URLLinkText"/> >- </xsl:when> >- <xsl:otherwise> >- <xsl:text>Click here to access online</xsl:text> >- </xsl:otherwise> >- </xsl:choose> >- </a></li> >- </xsl:for-each> > </ul> > </div> > </xsl:if> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >index 120acc6b169..52392a1ea08 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >@@ -694,6 +694,60 @@ > </xsl:if> > </xsl:template> > >+ <xsl:template name="renderMARCOnlineResourceField"> >+ <xsl:param name="MARCOnlineResourceField" /> >+ <xsl:param name="Show856uAsImage" /> >+ <xsl:param name="OPACTrackClicks" /> >+ <xsl:param name="OPACURLOpenInNewWindow" /> >+ <xsl:param name="screen" /> >+ >+ <xsl:for-each select="marc:datafield[@tag=$MARCOnlineResourceField and marc:subfield[@code='u']]"> >+ <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']" /></xsl:variable> >+ <li> >+ <a property="url"> >+ <xsl:choose> >+ <xsl:when test="$OPACTrackClicks='track'"> >+ <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute> >+ </xsl:when> >+ <xsl:when test="$OPACTrackClicks='anonymous'"> >+ <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())" />&biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:attribute name="href"> >+ <xsl:call-template name="AddMissingProtocol"> >+ <xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']" /> >+ <xsl:with-param name="indicator1" select="@ind1" /> >+ <xsl:with-param name="accessMethod" select="marc:subfield[@code='2']" /> >+ </xsl:call-template> >+ <xsl:value-of select="normalize-space(marc:subfield[@code='u'])"/> >+ </xsl:attribute> >+ </xsl:otherwise> >+ </xsl:choose> >+ <xsl:if test="$OPACURLOpenInNewWindow='1'"> >+ <xsl:attribute name="target">_blank</xsl:attribute> >+ </xsl:if> >+ <xsl:choose> >+ <xsl:when test="(($screen='detail' and $Show856uAsImage='Details' or $Show856uAsImage='Both') or >+ ($screen='results' and $Show856uAsImage='Results' or $Show856uAsImage='Both')) and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')"> >+ <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']" /></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']" /></xsl:attribute><xsl:attribute name="style">height:100px;</xsl:attribute></xsl:element><xsl:text></xsl:text> >+ </xsl:when> >+ <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']"> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">y3z</xsl:with-param> >+ </xsl:call-template> >+ </xsl:when> >+ <xsl:when test="$URLLinkText!=''"> >+ <xsl:value-of select="$URLLinkText" /> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:text>Click here to access online</xsl:text> >+ </xsl:otherwise> >+ </xsl:choose> >+ </a> >+ </li> >+ </xsl:for-each> >+ </xsl:template> >+ > <xsl:template name="AddMissingProtocol"> > <xsl:param name="resourceLocation"/> > <xsl:param name="indicator1"/> >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38096
:
172466
|
172467
|
172468
|
172469
|
172470
|
172471
|
172532
|
172533
|
172534
|
172535
|
172536
|
192376
|
192377
|
192378
|
192379
|
192380
|
192381
|
192589
|
192590
|
192591
|
192592
|
192593
|
192594
|
192813
|
192814
|
192815
|
192816
|
192817
|
192818
|
192819
|
192906
|
192907
|
192908
|
192909
|
192910
|
192911
|
192919
|
192920
|
192921
|
192922
|
192966
|
193000