Bug 41053: Move notice contents to hidden div

With thanks to Jonathan for suggesting this direction.

Test plan:
Go to patron detail, notices tab for a patron with some notices.
Look for a string that only occurs in the notice text of some notice.
Without this patch, you should not find that one.
With this patch, you should find it.
Manipulate the text of a notice to check display of bad html. (Click title.)
* Like: update message_queue set content='<p>test</p><a href="' where message_id=X;

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 7694dd09c7)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Marcel de Rooy 2025-10-20 10:58:58 +02:00 committed by Paul Derscheid
parent 3174ddaabb
commit f791fd1876
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 2 additions and 7 deletions

View File

@ -16,11 +16,6 @@
[% END %]</title
>
[% INCLUDE 'doc-head-close.inc' %]
<style>
.notice {
display: none;
}
</style>
</head>
<body id="pat_notices" class="pat">
@ -70,7 +65,7 @@
href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | uri %]&amp;noticeid=[% QUEUED_MESSAGE.message_id | uri %]"
>[% QUEUED_MESSAGE.subject | html %]</a
>
<iframe class="notice" id="notice[% QUEUED_MESSAGE.message_id | html %]" srcdoc="[% QUEUED_MESSAGE.html_content | html %]"></iframe>
<div style="display:none;" class="notice" id="notice[% QUEUED_MESSAGE.message_id | html %]">[% QUEUED_MESSAGE.html_content | html %]</div>
</td>
<td>
[% IF ( QUEUED_MESSAGE.message_transport_type == 'email' ) %]
@ -195,7 +190,7 @@
var noticeid = $(this).data("noticeid");
// Use shadow DOM for notice content preview
var srcdoc = $("#notice" + noticeid).attr("srcdoc");
var srcdoc = $("#notice" + noticeid).text();
var shadowHost = document.createElement("div");
var shadowRoot = shadowHost.attachShadow({ mode: "open" });
shadowRoot.innerHTML = srcdoc;