[Rt-commit] [svn] r1924 - in rt/branches/3.2-RELEASE: . html/Ticket/Elements

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Mon Nov 22 13:39:35 EST 2004


Author: jesse
Date: Mon Nov 22 13:39:35 2004
New Revision: 1924

Modified:
   rt/branches/3.2-RELEASE/   (props changed)
   rt/branches/3.2-RELEASE/html/Ticket/Elements/ShowTransactionAttachments
Log:
 r9322 at tinbook:  jesse | 2004-11-22T18:41:02.001214Z
 RT-Ticket: 6276
 RT-Status: resolved
 RT-Update: correspond
 
 Now honor the RT::MaxInlineBody configuration variable. Also, the Content-Disposition header.
 We no longer display long attachments inline if they were marked as attachments.
 
 


Modified: rt/branches/3.2-RELEASE/html/Ticket/Elements/ShowTransactionAttachments
==============================================================================
--- rt/branches/3.2-RELEASE/html/Ticket/Elements/ShowTransactionAttachments	(original)
+++ rt/branches/3.2-RELEASE/html/Ticket/Elements/ShowTransactionAttachments	Mon Nov 22 13:39:35 2004
@@ -79,21 +79,24 @@
      }
         
 </%PERL> 
-<A HREF="<%$AttachPath%>/<%$Transaction->Id%>/<%$message->Id%>/<%$message->Filename | u%>"><&|/l&>Download</&><%$message->Filename || loc('(untitled)') %></a> 
+<A HREF="<%$AttachPath%>/<%$Transaction->Id%>/<%$message->Id%>/<%$message->Filename | u%>"><&|/l&>Download</&> <%$message->Filename || loc('(untitled)') %></a> 
 <div class="downloadcontenttype">
 <%$message->ContentType%> <% $size %> 
 </div> 
 </div>
-%}
-
+% }
 % # }}}
 <div class="messagebody">
 <%perl>
-# {{{   if it's got content-disposition inline, show it inline
+# {{{   if it has a content-disposition: attachment, don't show inline
+unless ( $message->GetHeader('Content-Disposition') =~ /attachment/i ) {
+
     my $content;
 
     # If it's text
-    if ( $message->ContentType =~ m{^(text|message)}i ) {
+    if (   $message->ContentType =~ m{^(text|message)}i
+        && $size <= $RT::MaxInlineBody )
+    {
 
         if (
 
@@ -127,7 +130,7 @@
             if ( $message->ContentType =~ m{^text/(?:html|enriched)$}i ) {
                 $content =
                   $m->comp( '/Elements/ScrubHTML', Content => $content );
-                $m->out( $content );
+                $m->out($content);
             }
 
             # if it's a text/plain show the body
@@ -146,23 +149,26 @@
         }
 
     }
-        # if it's an image, show it as an image
-        elsif ( $message->ContentType =~ /^image\//i ) {
-            $m->out('<img src="'
-                  . $AttachPath . '/'
-                  . $Transaction->Id . '/'
-                  . $message->Id
-                  . '/">' );
-        }
 
+    # if it's an image, show it as an image
+    elsif ( $message->ContentType =~ /^image\//i ) {
+        $m->out('<img src="'
+              . $AttachPath . '/'
+              . $Transaction->Id . '/'
+              . $message->Id
+              . '/">' );
+    }
+}
 
-    # }}}
-
-    $m->comp( 'ShowTransactionAttachments', %ARGS,
-          Parent    => $message->id,
-          ParentObj => $message );
+# }}}
 
+$m->comp(
+    'ShowTransactionAttachments', %ARGS,
+    Parent    => $message->id,
+    ParentObj => $message
+);
 
+## Please see file perltidy.ERR
 }
 </%PERL>
 </div>


More information about the Rt-commit mailing list