From eb1dcb7d003293a56993552f6cc130ad13abcc30 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Fri, 18 Aug 2023 23:20:57 +0200 Subject: added tabbing to multipart/alternative --- lib/JWebmail/View/RenderMail.pm | 44 +++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'lib/JWebmail') diff --git a/lib/JWebmail/View/RenderMail.pm b/lib/JWebmail/View/RenderMail.pm index 387e586..63d3bdb 100644 --- a/lib/JWebmail/View/RenderMail.pm +++ b/lib/JWebmail/View/RenderMail.pm @@ -36,29 +36,29 @@ sub render_multipart_alternative { my ($self, $_subtype, $content, $path) = @_; my $parts = $content->{parts}; - my $R = qq'
'; - my $i = 0; - my $end; - - for (reverse @$parts) { - if (!$end) { - my $x = $self->mime_render(to_mime_types($_->{head}), $_->{body}, [@$path, $#$parts-$i]); - if ($x) { - $R .= $x; - $end = 1; - } - } - else { - $R .= '
'; - $R .= ''; - $R .= to_mime_type($_->{head}); - $R .= "\n"; - $R .= $self->mime_render(to_mime_types($_->{head}), $_->{body}, [@$path, $#$parts-$i]); - $R .= "
\n"; - } + my $T = "
    \n"; + my $C = '
    '; + my $i = 1; + my ($init, @rest) = reverse @$parts; + + $T .= '
  • ' . to_mime_type($init->{head}) . '
  • '; + + $C .= "
    \n"; + $C .= $self->mime_render(to_mime_types($init->{head}), $init->{body}, [@$path, $#$parts]); + $C .= "
    \n"; + + for (@rest) { + $T .= "
  • " . to_mime_type($_->{head}) . "
  • \n"; + + $C .= qq'\n"; + ++$i; } - return $R . "
    \n"; + $C .= qq'
'; + $T .= qq'
'; + return qq'
\n$T\n$C\n
\n'; } sub render_multipart { @@ -69,6 +69,7 @@ sub render_multipart { my $i = 0; for (@$parts) { + $R .= "
\n"; if ( !$_->{head}{content_disposition} || lc $_->{head}{content_disposition} eq 'none' || lc $_->{head}{content_disposition} eq 'inline') { @@ -86,6 +87,7 @@ sub render_multipart { warn "unknown Content-Disposition '$_->{head}{content_disposition}'"; $R .= "

unknown Content-Disposition '$_->{head}{content_disposition}'

\n"; } + $R .= "
\n"; ++$i; } return $R . "\n"; -- cgit v1.2.3