Lines 31-36
Koha::Notice::Message - Koha notice message Object class, related to the message
Link Here
|
31 |
|
31 |
|
32 |
=cut |
32 |
=cut |
33 |
|
33 |
|
|
|
34 |
=head3 is_html |
35 |
|
36 |
my $bool = $message->is_html; |
37 |
|
38 |
Returns a boolean denoting whether the message was generated using a preformatted html template. |
39 |
|
40 |
=cut |
41 |
|
42 |
sub is_html { |
43 |
my ($self) = @_; |
44 |
my $content_type = $self->content_type // ''; |
45 |
return $content_type =~ m/html/io; |
46 |
} |
47 |
|
34 |
=head3 html_content |
48 |
=head3 html_content |
35 |
|
49 |
|
36 |
my $wrapped_content = $message->html_content; |
50 |
my $wrapped_content = $message->html_content; |
Lines 45-54
sub html_content {
Link Here
|
45 |
|
59 |
|
46 |
my $title = $self->subject; |
60 |
my $title = $self->subject; |
47 |
my $content = $self->content; |
61 |
my $content = $self->content; |
48 |
my $css = C4::Context->preference("NoticeCSS") || ''; |
|
|
49 |
$css = qq{<link rel="stylesheet" type="text/css" href="$css">} if $css; |
50 |
|
62 |
|
51 |
return <<EOS; |
63 |
my $wrapped; |
|
|
64 |
if ( $self->is_html ) { |
65 |
|
66 |
my $css = C4::Context->preference("NoticeCSS") || ''; |
67 |
$css = qq{<link rel="stylesheet" type="text/css" href="$css">} if $css; |
68 |
|
69 |
$wrapped = <<EOS; |
52 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
70 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
53 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
71 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
54 |
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> |
72 |
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> |
Lines 62-68
sub html_content {
Link Here
|
62 |
</body> |
80 |
</body> |
63 |
</html> |
81 |
</html> |
64 |
EOS |
82 |
EOS |
65 |
|
83 |
} else { |
|
|
84 |
$wrapped = "<div style=\"white-space: pre-wrap;\">"; |
85 |
$wrapped .= $content; |
86 |
$wrapped .= "</div>"; |
87 |
} |
88 |
return $wrapped; |
66 |
} |
89 |
} |
67 |
|
90 |
|
68 |
=head3 type |
91 |
=head3 type |
69 |
- |
|
|