Bugzilla – Attachment 140346 Details for
Bug 31123
Add a simple way to add 'Harmful content warnings' to catalogue records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31123: Display content warnings on the intranet
Bug-31123-Display-content-warnings-on-the-intranet.patch (text/plain), 5.38 KB, created by
Martin Renvoize (ashimema)
on 2022-09-08 15:56:01 UTC
(
hide
)
Description:
Bug 31123: Display content warnings on the intranet
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-09-08 15:56:01 UTC
Size:
5.38 KB
patch
obsolete
>From b62414f613faa5d1de142e3bcf12d375f4df67a0 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 8 Sep 2022 15:07:57 +0100 >Subject: [PATCH] Bug 31123: Display content warnings on the intranet > >This patch adds handling to our XSLT processing to pass the new >`ContentWarningField` preference value to the stylesheets and then uses >that variable to add content warning notes to both the detail and search >result displays of the staff client. > >Test plan >1) Run the database update to expose the new system preference >2) Set `ContentWarningField` to something sensible, like `599` >3) Add the above select field to one of your frameworks with a subfield > `a`. >4) Edit a record with that framework to add a content warning into the > record >5) Search for the record and confirm you now see `Content warning: Your > test text` >6) Click into the record detail and confirm you see the content warning > text there too >7) Bonus points: Assign a new authorized value category to the chosen > field and subfield and confirm the staff client display text is used > in the above tests. >--- > C4/XSLT.pm | 2 +- > .../en/xslt/MARC21slim2intranetDetail.xsl | 22 +++++++++++++++++++ > .../en/xslt/MARC21slim2intranetResults.xsl | 21 ++++++++++++++++++ > 3 files changed, 44 insertions(+), 1 deletion(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 0fb7be0d6c..dd73af5b9b 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -171,7 +171,7 @@ sub get_xslt_sysprefs { > OPACResultsLibrary OPACShowOpenURL > OpenURLResolverURL OpenURLImageLocation > OPACResultsMaxItems OPACResultsMaxItemsUnavailable OPACResultsUnavailableGroupingBy >- OpenURLText OPACShowMusicalInscripts OPACPlayMusicalInscripts / ) >+ OpenURLText OPACShowMusicalInscripts OPACPlayMusicalInscripts ContentWarningField / ) > { > my $sp = C4::Context->preference( $syspref ); > next unless defined($sp); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index acaf38a650..2c86e445ac 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -1053,6 +1053,28 @@ > </span> > </xsl:if> > >+ <!-- Content Warning --> >+ <xsl:variable name="ContentWarningField" select="marc:sysprefs/marc:syspref[@name='ContentWarningField']"/> >+ <xsl:if test="marc:datafield[@tag=$ContentWarningField]"> >+ <span class="results_summary content_warning"> >+ <span class="label">Content warning: </span> >+ <xsl:for-each select="marc:datafield[@tag=$ContentWarningField]"> >+ <xsl:choose> >+ <xsl:when test="marc:subfield[@code='z']"> >+ <xsl:value-of select="marc:subfield[@code='z']"/><xsl:text> </xsl:text> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param> >+ </xsl:call-template> >+ </xsl:otherwise> >+ </xsl:choose> >+ <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if> >+ </xsl:for-each> >+ </span> >+ </xsl:if> >+ >+ > <!-- 773 --> > <xsl:if test="marc:datafield[@tag=773]"> > <xsl:for-each select="marc:datafield[@tag=773]"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >index ab6bbb9530..cc3e353a9b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >@@ -1010,6 +1010,27 @@ > </span> > </xsl:if> > >+ <!-- Content Warning --> >+ <xsl:variable name="ContentWarningField" select="marc:sysprefs/marc:syspref[@name='ContentWarningField']"/> >+ <xsl:if test="marc:datafield[@tag=$ContentWarningField]"> >+ <span class="results_summary content_warning"> >+ <span class="label">Content warning: </span> >+ <xsl:for-each select="marc:datafield[@tag=$ContentWarningField]"> >+ <xsl:choose> >+ <xsl:when test="marc:subfield[@code='z']"> >+ <xsl:value-of select="marc:subfield[@code='z']"/><xsl:text> </xsl:text> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">abcdefgijklnou</xsl:with-param> >+ </xsl:call-template> >+ </xsl:otherwise> >+ </xsl:choose> >+ <xsl:if test="position()!=last()"><span class="separator"><xsl:text> | </xsl:text></span></xsl:if> >+ </xsl:for-each> >+ </span> >+ </xsl:if> >+ > <!-- Indicate if record is suppressed in OPAC --> > <xsl:if test="$OpacSuppression = 1"> > <xsl:if test="marc:datafield[@tag=942][marc:subfield[@code='n'] = '1']"> >-- >2.20.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 31123
:
140345
|
140346
|
140347
|
140356
|
140357
|
140358
|
143880
|
143881
|
143882
|
147342
|
147343
|
147344
|
147345
|
147346
|
148992
|
148993
|
148994
|
148995
|
148996
|
148997