Bugzilla – Attachment 151841 Details for
Bug 27378
Enable compliance with EU Cookie Legislation via cookie consent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27378: Change ConsentJS to CookieConsentedJS
Bug-27378-Change-ConsentJS-to-CookieConsentedJS.patch (text/plain), 10.76 KB, created by
Sam Lau
on 2023-05-30 20:03:42 UTC
(
hide
)
Description:
Bug 27378: Change ConsentJS to CookieConsentedJS
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2023-05-30 20:03:42 UTC
Size:
10.76 KB
patch
obsolete
>From f2aac9e594de7c3c7c5e80b397e7aa4eb4a94424 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Thu, 25 May 2023 15:40:08 +0000 >Subject: [PATCH] Bug 27378: Change ConsentJS to CookieConsentedJS > >This patch updates the name of the ConsentJS syspref to CookieConsentedJS and amends the description to be more clear what the syspref is for > >Signed-off-by: Sam Lau <samalau@gmail.com> >--- > Koha/Template/Plugin/JSConsents.pm | 4 ++-- > installer/data/mysql/mandatory/sysprefs.sql | 2 +- > koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss | 6 +++--- > .../intranet-tmpl/prog/en/includes/intranet-bottom.inc | 8 ++++---- > .../prog/en/modules/admin/preferences/patrons.pref | 8 ++++---- > koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc | 4 ++-- > koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc | 4 ++-- > t/db_dependent/Koha/Template/Plugin/JSConsents.t | 2 +- > 8 files changed, 19 insertions(+), 19 deletions(-) > >diff --git a/Koha/Template/Plugin/JSConsents.pm b/Koha/Template/Plugin/JSConsents.pm >index a21ae178c3..8a559904ad 100644 >--- a/Koha/Template/Plugin/JSConsents.pm >+++ b/Koha/Template/Plugin/JSConsents.pm >@@ -26,7 +26,7 @@ use C4::Context; > > sub all { > my ( $self ) = @_; >- my $consents = C4::Context->preference( 'ConsentJS' ); >+ my $consents = C4::Context->preference( 'CookieConsentedJS' ); > if (length $consents > 0) { > my $decoded = decode_base64($consents); > return decode_json $decoded; >@@ -40,7 +40,7 @@ sub all { > =head1 NAME > > Koha::Template::Plugin::JSConsents - TT Plugin for Javascript consents >-Provided by ConsentJS syspref >+Provided by CookieConsentedJS syspref > > =head1 SYNOPSIS > >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 461621a785..80a464d67d 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -157,7 +157,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('ComponentSortField','title','call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'), > ('ComponentSortOrder','asc','asc|dsc|az|za','Specify the default sort order','Choice'), > ('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'), >-('ConsentJS', '', NULL, 'Specify Javascript that requires user consent to run (e.g. tracking code)', 'Free'), >+('CookieConsentedJS', '', NULL, 'Add Javascript code that will run if cookie consent is provided (e.g. tracking code).', 'Free'), > ('ConsiderOnSiteCheckoutsAsNormalCheckouts','1',NULL,'Consider on-site checkouts as normal checkouts','YesNo'), > ('ContentWarningField', '', NULL, 'MARC field to use for content warnings', 'Free'), > ('CookieConsent', '0', NULL, 'Require cookie consent to be displayed', 'YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >index 047e01ccd8..c021bd0e4f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >@@ -4330,14 +4330,14 @@ div .suggestion_note { > } > } > >-#consentJSItems { >- #consentJSWarning { >+#cookieConsentedJSItems { >+ #cookieConsentedJSWarning { > margin: 20px 0; > text-align: center; > font-weight: 800; > font-size: 120%; > } >- .consentJSItem { >+ .cookieConsentedJSItem { > margin-bottom: 30px; > padding: 10px; > border: 1px solid #ccc; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc >index cf7fb3150d..3178c30fdc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc >@@ -85,7 +85,7 @@ > [% Koha.Preference( 'CookieConsentBar' ) | $raw %] > <div id="consentButtons"> > <button type="button" class="btn btn-primary consentAcceptAll">Accept all cookies</button> >- [% IF ( Koha.Preference( 'ConsentJS' ).length > 0 ) %] >+ [% IF ( Koha.Preference( 'CookieConsentedJS' ).length > 0 ) %] > <button type="button" class="btn btn-primary consentAcceptEssential">Accept only essential cookies</button> > <button type="button" class="btn btn-info" id="consentMoreInfo">More information</button> > [% END %] >@@ -122,7 +122,7 @@ > <div class="modal-footer"> > <div id="consentButtons"> > <button type="button" class="btn btn-primary consentAcceptAll">Accept all cookies</button> >- [% IF ( Koha.Preference( 'ConsentJS' ).length > 0 ) %] >+ [% IF ( Koha.Preference( 'CookieConsentedJS' ).length > 0 ) %] > <button type="button" class="btn btn-primary consentAcceptEssential">Accept only essential cookies</button> > <button type="button" class="btn btn-success" id="consentAcceptSelected">Accept selected non-essential cookies</button> > [% END %] >@@ -132,8 +132,8 @@ > </div> <!-- /.modal-dialog --> > </div> <!-- /#cookieConsentModal --> > [% END %] >- <!-- ConsentJS code that may run --> >- [% IF Koha.Preference( 'CookieConsent' ) && Koha.Preference( 'ConsentJS' ).length > 0 %] >+ <!-- CookieConsentedJS code that may run --> >+ [% IF Koha.Preference( 'CookieConsent' ) && Koha.Preference( 'CookieConsentedJS' ).length > 0 %] > [% consents = JSConsents.all() %] > [% FOREACH consent IN consents %] > <div class="consentCode" style="display:none" aria-hidden="true" data-consent-id="[% consent.id | html %]" data-consent-code="[% consent.code | html %]" data-consent-match-pattern="[% consent.matchPattern | html %]" data-consent-cookie-domain="[% consent.cookieDomain | html %]" data-consent-cookie-path="[% consent.cookiePath | html %]" data-requires-consent="[% consent.staffConsent ? 'true' : 'false' | html %]"></div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 55e8e10476..4bdb52f3e6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -389,11 +389,11 @@ Patrons: > no: "Don't require" > - cookie consent to be displayed > - >- - Specify Javascript that requires user consent to run (e.g. tracking code) >- - pref: ConsentJS >+ - Add Javascript code that will run if cookie consent is provided (e.g. tracking code). >+ - pref: CookieConsentedJS > type: modaljs >- initiator: populateConsentJS >- processor: prepareConsentJS >+ initiator: populateCookieConsentedJS >+ processor: prepareCookieConsentedJS > - > - Show the following HTML in the cookie consent bar that is displayed at the bottom of the screen > - pref: CookieConsentBar >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 0609fee5bc..8844023d3d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -451,7 +451,7 @@ > [% Koha.Preference( 'CookieConsentBar' ) | $raw %] > <div id="consentButtons"> > <button type="button" class="btn btn-primary consentAcceptAll">Accept all cookies</button> >- [% IF ( Koha.Preference( 'ConsentJS' ).length > 0 ) %] >+ [% IF ( Koha.Preference( 'CookieConsentedJS' ).length > 0 ) %] > <button type="button" class="btn btn-primary consentAcceptEssential">Accept only essential cookies</button> > <button type="button" class="btn btn-info" id="consentMoreInfo" aria-label="Click to view more information about your cookie consents">More information</button> > [% END %] >@@ -488,7 +488,7 @@ > <div class="modal-footer"> > <div id="consentButtons"> > <button type="button" class="btn btn-primary consentAcceptAll">Accept all cookies</button> >- [% IF ( Koha.Preference( 'ConsentJS' ).length > 0 ) %] >+ [% IF ( Koha.Preference( 'CookieConsentedJS' ).length > 0 ) %] > <button type="button" class="btn btn-primary consentAcceptEssential">Accept only essential cookies</button> > <button type="button" class="btn btn-warning" id="consentAcceptSelected">Accept selected non-essential cookies</button> > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index 5029d97ce4..ec0cc3794e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -120,8 +120,8 @@ > [% END # /IF OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'footer' %] > [% END # / UNLESS is_popup %] > >-<!-- ConsentJS code that may run --> >-[% IF Koha.Preference( 'CookieConsent' ) && Koha.Preference( 'ConsentJS' ).length > 0 %] >+<!-- CookieConsentedJS code that may run --> >+[% IF Koha.Preference( 'CookieConsent' ) && Koha.Preference( 'CookieConsentedJS' ).length > 0 %] > [% consents = JSConsents.all() %] > [% FOREACH consent IN consents %] > <div class="consentCode" style="display:none" aria-hidden="true" data-consent-id="[% consent.id | html %]" data-consent-code="[% consent.code | html %]" data-consent-match-pattern="[% consent.matchPattern | html %]" data-consent-cookie-domain="[% consent.cookieDomain | html %]" data-consent-cookie-path="[% consent.cookiePath | html %]" data-requires-consent="[% consent.opacConsent ? 'true' : 'false' | html %]"></div> >diff --git a/t/db_dependent/Koha/Template/Plugin/JSConsents.t b/t/db_dependent/Koha/Template/Plugin/JSConsents.t >index 4210f5f4b1..e48f359651 100755 >--- a/t/db_dependent/Koha/Template/Plugin/JSConsents.t >+++ b/t/db_dependent/Koha/Template/Plugin/JSConsents.t >@@ -17,7 +17,7 @@ ok( my $consents = Koha::Template::Plugin::JSConsents->new(), 'Able to instantia > subtest "all" => sub { > plan tests => 1; > >- t::lib::Mocks::mock_preference( 'ConsentJS', 'eyAidGVzdCI6ICJvbmUiIH0=' ); >+ t::lib::Mocks::mock_preference( 'CookieConsentedJS', 'eyAidGVzdCI6ICJvbmUiIH0=' ); > > is_deeply( $consents->all(), { test => 'one' }, 'Returns a Base64 decoded JSON object converted into a data structure'); > }; >-- >2.30.2
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 27378
:
115544
|
115545
|
115546
|
115547
|
115548
|
115756
|
116397
|
116398
|
116399
|
116400
|
116401
|
116402
|
116403
|
116416
|
116417
|
116418
|
116419
|
116420
|
116421
|
116422
|
116423
|
116978
|
116979
|
116980
|
116981
|
116982
|
116983
|
116984
|
116985
|
116986
|
121728
|
121729
|
121730
|
121731
|
121732
|
121733
|
121734
|
121735
|
121995
|
121996
|
121997
|
121998
|
121999
|
122000
|
122001
|
122002
|
122635
|
122636
|
122637
|
122638
|
122639
|
122640
|
122641
|
122642
|
124957
|
124958
|
124959
|
124960
|
124961
|
124962
|
124963
|
124964
|
124965
|
130072
|
130073
|
130074
|
130075
|
130076
|
130077
|
130078
|
130079
|
130080
|
135309
|
135310
|
135311
|
135312
|
135313
|
135314
|
135315
|
135316
|
135317
|
135318
|
151735
|
151736
|
151737
|
151738
|
151739
|
151740
|
151741
|
151742
|
151743
|
151744
|
151745
|
151746
|
151747
|
151748
|
151749
|
151750
|
151751
|
151752
|
151753
|
151826
|
151827
|
151828
|
151829
|
151830
|
151831
|
151832
|
151833
|
151834
|
151835
|
151836
|
151837
|
151838
|
151839
|
151840
|
151841
|
151842
|
151843
|
151844
|
153326
|
153327
|
153328
|
153329
|
153330
|
153331
|
153332
|
153333
|
153334
|
153335
|
153336
|
154015
|
154016
|
154017
|
154018
|
154019
|
154020
|
154021
|
154022
|
154023
|
154024
|
154025
|
154093
|
154264
|
154265
|
154266
|
154267
|
154268
|
154269
|
154270
|
154271
|
154272
|
154273
|
154274
|
154275
|
154276