Bugzilla – Attachment 172533 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), 16.31 KB, created by
Caroline Cyr La Rose
on 2024-10-08 15:27:52 UTC
(
hide
)
Description:
Bug 38096: OPAC: Move 856 logic to renderMARCOnlineResourceField utils
Filename:
MIME Type:
Creator:
Caroline Cyr La Rose
Created:
2024-10-08 15:27:52 UTC
Size:
16.31 KB
patch
obsolete
>From f410d04d4991dd809c1d871d3a31b693006e36b7 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 | 51 +++-------------- > .../en/xslt/MARC21slim2OPACResults.xsl | 56 ++++--------------- > .../bootstrap/en/xslt/MARC21slimUtils.xsl | 54 ++++++++++++++++++ > 3 files changed, 71 insertions(+), 90 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index 01c503fdb1..1ba627cca5 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -1042,50 +1042,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> >- <xsl:value-of select="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> >+ <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> > </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 8f057967bc..8b2630be75 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >@@ -1215,54 +1215,18 @@ > </span> > </xsl:if> > >- <xsl:if test="marc:datafield[@tag=856]"> >- <xsl:if test="marc:datafield[@tag=856]/marc:subfield[@code='u']"> >- <div class="results_summary online_resources"> >+ <xsl:if test="marc:datafield[@tag=856]"> >+ <xsl:if test="marc:datafield[@tag=856]/marc:subfield[@code='u']"> >+ <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> >- <xsl:value-of select="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> >+ <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> > </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 9d35b9f94a..136c5e8d2e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >@@ -655,6 +655,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="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.34.1
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