[Rt-commit] [svn] r1931 - in rt/branches/3.3-TESTING: . html/Ticket/Elements

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Mon Nov 22 14:44:10 EST 2004


Author: jesse
Date: Mon Nov 22 14:44:10 2004
New Revision: 1931

Modified:
   rt/branches/3.3-TESTING/   (props changed)
   rt/branches/3.3-TESTING/html/Ticket/Elements/ShowTransactionAttachments
Log:
 r9333 at tinbook:  jesse | 2004-11-22T19:44:47.283026Z
  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.3-TESTING/html/Ticket/Elements/ShowTransactionAttachments
==============================================================================
--- rt/branches/3.3-TESTING/html/Ticket/Elements/ShowTransactionAttachments	(original)
+++ rt/branches/3.3-TESTING/html/Ticket/Elements/ShowTransactionAttachments	Mon Nov 22 14:44:10 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