From c997fe863f70fa951c71dca73296ed1f497aeca7 Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 5 Sep 2023 04:58:52 +0000 Subject: [PATCH] Bug 34711: Remove use of onclick for opac-privacy.pl This change removes the "onclick" attribute for the buttons on opac-privacy.pl. Note: The Javascript is placed in a separate file, which is the preferred way for Javascript to be handled by Content-Security-Policy Test plan: 0. Apply the patch 1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACPrivacy 2. Set syspref to "Allow" 3. Go to http://localhost:8080/cgi-bin/koha/opac-privacy.pl 4. The confirmation modal appears and "OK" and "Cancel" buttons work as expected Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../opac-tmpl/bootstrap/en/modules/opac-privacy.tt | 10 ++++++---- koha-tmpl/opac-tmpl/bootstrap/js/privacy.js | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/js/privacy.js diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt index 1d3c155f08..f3af3f48d5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt @@ -175,7 +175,7 @@ Immediately delete my checkout history. This action cannot be undone.
- +
@@ -183,7 +183,7 @@ Immediately delete my hold history. This action cannot be undone.
- +
@@ -191,7 +191,7 @@ Immediately delete my checkout history & my hold history. This action cannot be undone.
- +
@@ -208,4 +208,6 @@ [% INCLUDE 'opac-bottom.inc' %] -[% BLOCK jsinclude %][% END %] +[% BLOCK jsinclude %] + [% Asset.js('js/privacy.js') | $raw %] +[% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/privacy.js b/koha-tmpl/opac-tmpl/bootstrap/js/privacy.js new file mode 100644 index 0000000000..f2eeb89983 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/js/privacy.js @@ -0,0 +1,5 @@ +$(document).ready(function(){ + $('.privacy-confirm-delete').on('click',function(){ + return confirmDelete(MSG_CONFIRM_AGAIN); + }); +}); -- 2.39.5