[Rt-commit] rt branch, 4.0/respect-text-settings-in-ShowEmailRecord, created. rt-4.0.4-42-g6ee58c3
Ruslan Zakirov
ruz at bestpractical.com
Tue Nov 22 14:36:20 EST 2011
The branch, 4.0/respect-text-settings-in-ShowEmailRecord has been created
at 6ee58c3f8179725956b6917c8f9fc76b5b3d2a3f (commit)
- Log -----------------------------------------------------------------
commit 6ee58c3f8179725956b6917c8f9fc76b5b3d2a3f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Nov 22 23:32:37 2011 +0400
pre blocks are not good for printing, cut content
respect PlainText{Pre,Mono} options in ShowEmailRecord,
so we have consistency and printed version has all content
in most cases.
diff --git a/share/html/Ticket/ShowEmailRecord.html b/share/html/Ticket/ShowEmailRecord.html
index 25f0506..e1c7831 100644
--- a/share/html/Ticket/ShowEmailRecord.html
+++ b/share/html/Ticket/ShowEmailRecord.html
@@ -50,10 +50,18 @@ $Attachment => undef
$Transaction => undef
</%ARGS>
<%INIT>
+my $plain_text_pre
+ = RT->Config->Get( 'PlainTextPre', $session{'CurrentUser'} );
+my $plain_text_mono
+ = RT->Config->Get( 'PlainTextMono', $session{'CurrentUser'} );
+my $use_brs = !$plain_text_pre && !$plain_text_mono;
+
my $show_content = sub {
my $attach = shift;
if ( $attach->ContentType =~ m{^(?:text|message)/}i ) {
- $m->out( $m->interp->apply_escapes( $attach->Content, 'h' ) );
+ my $content = $m->interp->apply_escapes( $attach->Content, 'h' );
+ $content =~ s{(\r?\n)}{<br />}g if $use_brs;
+ $m->out( $content );
return;
}
my $href = RT->Config->Get('WebPath') .'/Ticket/Attachment/'
@@ -65,9 +73,16 @@ my $show_content = sub {
my $show;
$show = sub {
my $attach = shift;
- $m->out( '<div id="body"><pre style="padding: 2em;">' );
- $m->out( $m->interp->apply_escapes( $attach->Headers, 'h' ) );
- $m->out( "\n\n" );
+ $m->out('<div id="body">');
+ $m->out('<pre style="padding: 2em;">') if $plain_text_pre;
+ $m->out('<div class="plain-text-white-space">') if $plain_text_mono;
+
+ my $headers = $m->interp->apply_escapes( $attach->Headers, 'h' );
+ $headers =~ s{(\r?\n)}{<br />}g if $use_brs;
+ $m->out( $headers );
+
+ $m->out( $use_brs ? "<br /><br />" : "\n\n" );
+
if ( $attach->ContentType =~ m{^multipart/}i ) {
my $children = $attach->Children;
while ( my $child = $children->Next ) {
@@ -76,7 +91,9 @@ $show = sub {
} else {
$show_content->( $attach );
}
- $m->out( '</pre></div>' );
+ $m->out('</div>') if $plain_text_mono;
+ $m->out('</pre>') if $plain_text_pre;
+ $m->out('</div>');
};
my $AttachmentObj = RT::Attachment->new($session{'CurrentUser'});
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list