Bugzilla – Attachment 158871 Details for
Bug 30287
Notices using HTML render differently in notices.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30287: (follow-up) Add content wrap matching send time
Bug-30287-follow-up-Add-content-wrap-matching-send.patch (text/plain), 3.47 KB, created by
Martin Renvoize (ashimema)
on 2023-11-13 10:33:50 UTC
(
hide
)
Description:
Bug 30287: (follow-up) Add content wrap matching send time
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-11-13 10:33:50 UTC
Size:
3.47 KB
patch
obsolete
>From c3d38d356a8fe62447f8eb5ef2b119b33b787f3b Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 6 Nov 2023 14:00:21 +0000 >Subject: [PATCH] Bug 30287: (follow-up) Add content wrap matching send time > >This patch adds a new method to the Koha::Notice::Message class to wrap >content in the same way we currently do at email send time. We then >update the notice preview to use this method so we're embedding >NoticeCSS into that iframe. This means the generated preview should now >exactly match how your notice will display in email clients including >any CSS you may have placed within NoticeCSS. >--- > Koha/Notice/Message.pm | 35 ++++++++++++++++++- > .../prog/en/modules/members/notices.tt | 2 +- > 2 files changed, 35 insertions(+), 2 deletions(-) > >diff --git a/Koha/Notice/Message.pm b/Koha/Notice/Message.pm >index fcf7eca2a67..a44107a59c2 100644 >--- a/Koha/Notice/Message.pm >+++ b/Koha/Notice/Message.pm >@@ -17,7 +17,6 @@ package Koha::Notice::Message; > > use Modern::Perl; > >- > use Koha::Database; > > use base qw(Koha::Object); >@@ -32,6 +31,40 @@ Koha::Notice::Message - Koha notice message Object class, related to the message > > =cut > >+=head3 html_content >+ >+ my $wrapped_content = $message->html_content; >+ >+This method returns the message content approprately wrapped >+with html headers and css includes for html formatted notices. >+ >+=cut >+ >+sub html_content { >+ my ($self) = @_; >+ >+ my $title = $self->subject; >+ my $content = $self->content; >+ my $css = C4::Context->preference("NoticeCSS") || ''; >+ $css = qq{<link rel="stylesheet" type="text/css" href="$css">} if $css; >+ >+ return <<EOS; >+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> >+<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> >+ <head> >+ <title>$title</title> >+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> >+ $css >+ </head> >+ <body> >+ $content >+ </body> >+</html> >+EOS >+ >+} >+ > =head3 type > > =cut >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >index bc5357a97bd..660ac5fb032 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >@@ -67,7 +67,7 @@ > <td> > <a class="notice-title" data-noticeid="[% QUEUED_MESSAGE.message_id | html %]" href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | uri %]&noticeid=[% QUEUED_MESSAGE.message_id | uri %]">[% QUEUED_MESSAGE.subject | html %]</a> > [% IF QUEUED_MESSAGE.content_type.search('html') %] >- <iframe class="notice" id="notice[% QUEUED_MESSAGE.message_id | html %]" srcdoc="[% QUEUED_MESSAGE.content | html %]"></iframe> >+ <iframe class="notice" id="notice[% QUEUED_MESSAGE.message_id | html %]" srcdoc="[% QUEUED_MESSAGE.html_content | html %]"></iframe> > [% ELSE %] > <iframe class="notice" id="notice[% QUEUED_MESSAGE.message_id | html %]" srcdoc="[% QUEUED_MESSAGE.content | html | html_line_break %]"></iframe> > [% END %] >-- >2.41.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 30287
:
158517
|
158519
|
158520
|
158648
|
158649
|
158650
|
158651
|
158652
|
158653
|
158654
|
158655
|
158656
|
158834
|
158869
|
158870
|
158871
|
158872
|
158873
|
158892
|
158893
|
158894
|
158895
|
159431
|
159432
|
159433
|
159434