49
49
# Find all the attachments which have parent $Parent
50
50
# For each of these attachments
51
51
foreach my $message ( grep $_->__Value('Parent') == $Parent, @$Attachments ) {
53
if (RT->Config->Get('GnuPG')->{'Enable'}) {
54
$m->comp( 'ShowGnuPGStatus', Attachment => $message, WarnUnsigned => $WarnUnsigned );
52
57
$m->comp( 'ShowMessageHeaders',
53
58
Message => $message,
54
59
DisplayHeaders => \@DisplayHeaders,
70
% # If there is sub-messages, open a dedicated div
75
%# If there is sub-messages, open a dedicated div
71
76
% if ( scalar ( grep $_->__Value('Parent') == $message->id, @$Attachments ) ) {
72
77
<div class="messageattachments">
74
79
<div class="messagebody">
77
# {{{ if it has a content-disposition: attachment, don't show inline
78
unless ( ($message->GetHeader('Content-Disposition')||"") =~ /attachment/i ) {
83
$render_attachment->( $message );
88
Parent => $message->id,
100
$DownloadableHeaders => 1
101
$ShowTitleBarCommands => 1
103
$AttachPath => RT->Config->Get('WebPath')."/Ticket/Attachment"
104
$UpdatePath => RT->Config->Get('WebPath')."/Ticket/Update.html"
105
$EmailRecordPath => RT->Config->Get('WebPath')."/Ticket/ShowEmailRecord.html"
106
$Attachments => undef
107
$AttachmentContent => {}
114
my @DisplayHeaders=qw(_all);
115
if ( $Transaction->Type =~ /EmailRecord$/ ) {
116
@DisplayHeaders = qw(To Cc Bcc);
119
# If the transaction has anything attached to it at all
120
elsif (!$ShowHeaders) {
121
@DisplayHeaders = qw(To From RT-Send-Cc Cc Bcc Date Subject);
122
push @DisplayHeaders, 'RT-Send-Bcc' if RT->Config->Get('ShowBccHeader');
125
my $size_to_str = sub {
127
# show a download link
128
if ( $size > 1024*1024 ) {
129
$size = loc( "[_1]b", int( $size / 1024 / 102.4 ) / 10 );
131
elsif ( $size > 1024 ) {
132
$size = loc( "[_1]k", int( $size / 102.4 ) / 10 );
135
$size = loc( "[_1]b", $size );
140
my $render_attachment = sub {
143
# if it has a content-disposition: attachment, don't show inline
144
my $disposition = $message->GetHeader('Content-Disposition');
145
if ( $disposition && $disposition =~ /attachment/i && $disposition !~ /^\s*inline/ ) {
146
$disposition = 'attachemnt';
148
$disposition = 'inline';
83
if ( $message->ContentType =~ m{^(text|message)}i
84
&& !( $message->Filename && RT->Config->Get('SuppressInlineTextFiles', $session{'CurrentUser'} ) )
85
&& ( !RT->Config->Get( 'MaxInlineBody', $session{'CurrentUser'} )
86
|| $size <= RT->Config->Get('MaxInlineBody', $session{'CurrentUser'} ) ) )
152
if ( $message->ContentType =~ m{^(text|message)}i ) {
153
my $max_size = RT->Config->Get( 'MaxInlineBody', $session{'CurrentUser'} );
154
if ( $message->Filename && RT->Config->Get('SuppressInlineTextFiles', $session{'CurrentUser'} ) ) {
155
$m->out('<p>'. loc( 'Text file is not shown because it is disabled in preferences.' ) .'</p>');
158
elsif ( $max_size && $message->ContentLength > $max_size ) {
159
$m->out('<p>'. loc( 'Message body not shown because it is too large.' ) .'</p>');
162
elsif ( $disposition ne 'inline' ) {
163
$m->out('<p>'. loc( 'Message body is not shown because sender requested not to inline it.' ) .'</p>');
151
243
elsif ( $message->ContentLength > 0 ) {
153
loc( 'Message body not shown because it is too large or is not plain text.' ) .
245
loc( 'Message body not shown because it is not plain text.' ) .
164
Parent => $message->id,
165
ParentObj => $message
173
$Transaction => undef
176
$DownloadableHeaders => 1
177
$ShowTitleBarCommands => 1
179
$AttachPath => RT->Config->Get('WebPath')."/Ticket/Attachment"
180
$UpdatePath => RT->Config->Get('WebPath')."/Ticket/Update.html"
181
$EmailRecordPath => RT->Config->Get('WebPath')."/Ticket/ShowEmailRecord.html"
182
$Attachments => undef
183
$AttachmentContent => {}
189
my @DisplayHeaders=qw(_all);
190
if ( $Transaction->Type =~ /EmailRecord$/ ) {
191
@DisplayHeaders = qw(To Cc Bcc);
194
# If the transaction has anything attached to it at all
195
elsif (!$ShowHeaders) {
196
@DisplayHeaders = qw(To From RT-Send-Cc Cc Bcc Date Subject);
197
push @DisplayHeaders, 'RT-Send-Bcc' if RT->Config->Get('ShowBccHeader');
200
my $size_to_str = sub {
202
# show a download link
203
if ( $size > 1024*1024 ) {
204
$size = loc( "[_1]b", int( $size / 1024 / 102.4 ) / 10 );
206
elsif ( $size > 1024 ) {
207
$size = loc( "[_1]k", int( $size / 102.4 ) / 10 );
210
$size = loc( "[_1]b", $size );