Bugzilla – Attachment 163554 Details for
Bug 36370
Add ContentWarningField to UNIMARC XSLT
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36370: Add ContentWarningField to UNIMARC XSLT
Bug-36370-Add-ContentWarningField-to-UNIMARC-XSLT.patch (text/plain), 10.15 KB, created by
Fridolin Somers
on 2024-03-20 15:10:22 UTC
(
hide
)
Description:
Bug 36370: Add ContentWarningField to UNIMARC XSLT
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2024-03-20 15:10:22 UTC
Size:
10.15 KB
patch
obsolete
>From 3411500031f624f0147dfe4c9744de7f8ab94325 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Wed, 20 Mar 2024 16:04:14 +0100 >Subject: [PATCH] Bug 36370: Add ContentWarningField to UNIMARC XSLT > >Bug 31123 added new feature with preference ContentWarningField. >Add this behavior to UNMARC XSLT files. > >This patch adds new template 'tag_content_warning' in UNIMARCslimUtils.xsl >called in results and details pages. > >New field is placed after 3xx. > >Test plan (in both interfaces OPAC and staff): >1) Create a new field 599 in framework >2) Set system preference ContentWarningField to 599 >3) Edit a record to add a 599 with text in $a$b and an URL in $u >4) Perform a search to find this record >=> Check you see content_warning: <a href="$u">$a</a> $b >5) Click on details page >=> Check you see content_warning: <a href="$u">$a</a> $b >--- > .../en/xslt/UNIMARCslim2intranetDetail.xsl | 6 ++++ > .../en/xslt/UNIMARCslim2intranetResults.xsl | 6 ++++ > .../prog/en/xslt/UNIMARCslimUtils.xsl | 36 +++++++++++++++++++ > .../en/xslt/UNIMARCslim2OPACDetail.xsl | 6 ++++ > .../en/xslt/UNIMARCslim2OPACResults.xsl | 6 ++++ > .../bootstrap/en/xslt/UNIMARCslimUtils.xsl | 36 +++++++++++++++++++ > 6 files changed, 96 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl >index 25a8d08dee..982bea8b8b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl >@@ -16,6 +16,7 @@ > > <xsl:template match="marc:record"> > <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/> >+ <xsl:variable name="ContentWarningField" select="marc:sysprefs/marc:syspref[@name='ContentWarningField']"/> > <xsl:variable name="leader" select="marc:leader"/> > <xsl:variable name="leader6" select="substring($leader,7,1)"/> > <xsl:variable name="leader7" select="substring($leader,8,1)"/> >@@ -306,6 +307,11 @@ > </span> > </xsl:if> > >+ <!-- Content Warning --> >+ <xsl:call-template name="tag_content_warning"> >+ <xsl:with-param name="tag" select="$ContentWarningField" /> >+ </xsl:call-template> >+ > <xsl:if test="marc:datafield[@tag=955]"> > <span class="results_summary sudoc_serial_history"> > <span class="label">SUDOC serial history: </span> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetResults.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetResults.xsl >index 624603c620..8fdabd47ee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetResults.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetResults.xsl >@@ -18,6 +18,7 @@ > > <xsl:template match="marc:record"> > <xsl:variable name="IntranetBiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='IntranetBiblioDefaultView']"/> >+ <xsl:variable name="ContentWarningField" select="marc:sysprefs/marc:syspref[@name='ContentWarningField']"/> > <xsl:variable name="leader" select="marc:leader"/> > <xsl:variable name="leader6" select="substring($leader,7,1)"/> > <xsl:variable name="leader7" select="substring($leader,8,1)"/> >@@ -77,5 +78,10 @@ > > <xsl:call-template name="tag_215" /> > >+ <!-- Content Warning --> >+ <xsl:call-template name="tag_content_warning"> >+ <xsl:with-param name="tag" select="$ContentWarningField" /> >+ </xsl:call-template> >+ > </xsl:template> > </xsl:stylesheet> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl >index 8860317cbf..e344fdf7de 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl >@@ -485,4 +485,40 @@ > </xsl:if> > </xsl:template> > >+ <xsl:template name="tag_content_warning"> >+ <xsl:param name="tag" /> >+ <xsl:if test="marc:datafield[@tag=$tag]"> >+ <span class="results_summary content_warning"> >+ <span class="label">Content warning: </span> >+ <xsl:for-each select="marc:datafield[@tag=$tag]"> >+ <xsl:choose> >+ <xsl:when test="marc:subfield[@code='u']"> >+ <a> >+ <xsl:attribute name="href"> >+ <xsl:value-of select="marc:subfield[@code='u']"/> >+ </xsl:attribute> >+ <xsl:choose> >+ <xsl:when test="marc:subfield[@code='a']"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="marc:subfield[@code='u']"/> >+ </xsl:otherwise> >+ </xsl:choose> >+ </a> >+ <xsl:text> </xsl:text> >+ </xsl:when> >+ <xsl:when test="not(marc:subfield[@code='u']) and marc:subfield[@code='a']"> >+ <xsl:value-of select="marc:subfield[@code='a']"/><xsl:text> </xsl:text> >+ </xsl:when> >+ </xsl:choose> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">bcdefghijklmnopqrstvwxyz</xsl:with-param> >+ </xsl:call-template> >+ <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if> >+ </xsl:for-each> >+ </span> >+ </xsl:if> >+ </xsl:template> >+ > </xsl:stylesheet> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >index f2bebe101f..0992550b1a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >@@ -22,6 +22,7 @@ > <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/> > <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/> > <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/> >+ <xsl:variable name="ContentWarningField" select="marc:sysprefs/marc:syspref[@name='ContentWarningField']"/> > > <xsl:if test="marc:datafield[@tag=200]"> > <xsl:for-each select="marc:datafield[@tag=200]"> >@@ -347,6 +348,11 @@ > </span> > </xsl:if> > >+ <!-- Content Warning --> >+ <xsl:call-template name="tag_content_warning"> >+ <xsl:with-param name="tag" select="$ContentWarningField" /> >+ </xsl:call-template> >+ > <xsl:if test="marc:datafield[@tag=955]"> > <span class="results_summary sudoc_serial_history"> > <span class="label">SUDOC serial history: </span> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl >index b9d36a2d35..51e37782e1 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl >@@ -31,6 +31,7 @@ > <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/> > <xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/> > <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/> >+ <xsl:variable name="ContentWarningField" select="marc:sysprefs/marc:syspref[@name='ContentWarningField']"/> > > <xsl:if test="marc:datafield[@tag=200]"> > <xsl:for-each select="marc:datafield[@tag=200]"> >@@ -155,6 +156,11 @@ > > <xsl:call-template name="tag_215" /> > >+ <!-- Content Warning --> >+ <xsl:call-template name="tag_content_warning"> >+ <xsl:with-param name="tag" select="$ContentWarningField" /> >+ </xsl:call-template> >+ > <span class="results_summary availability"> > <span class="label">Availability: </span> > <xsl:choose> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl >index dc02e6fc8e..d30304b150 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl >@@ -545,4 +545,40 @@ > </xsl:if> > </xsl:template> > >+ <xsl:template name="tag_content_warning"> >+ <xsl:param name="tag" /> >+ <xsl:if test="marc:datafield[@tag=$tag]"> >+ <span class="results_summary content_warning"> >+ <span class="label">Content warning: </span> >+ <xsl:for-each select="marc:datafield[@tag=$tag]"> >+ <xsl:choose> >+ <xsl:when test="marc:subfield[@code='u']"> >+ <a> >+ <xsl:attribute name="href"> >+ <xsl:value-of select="marc:subfield[@code='u']"/> >+ </xsl:attribute> >+ <xsl:choose> >+ <xsl:when test="marc:subfield[@code='a']"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="marc:subfield[@code='u']"/> >+ </xsl:otherwise> >+ </xsl:choose> >+ </a> >+ <xsl:text> </xsl:text> >+ </xsl:when> >+ <xsl:when test="not(marc:subfield[@code='u']) and marc:subfield[@code='a']"> >+ <xsl:value-of select="marc:subfield[@code='a']"/><xsl:text> </xsl:text> >+ </xsl:when> >+ </xsl:choose> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">bcdefghijklmnopqrstvwxyz</xsl:with-param> >+ </xsl:call-template> >+ <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if> >+ </xsl:for-each> >+ </span> >+ </xsl:if> >+ </xsl:template> >+ > </xsl:stylesheet> >-- >2.44.0
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 36370
:
163554
|
163764
|
166588