[Rt-commit] r5296 - in rt/branches/3.5-TESTING: lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Thu May 25 21:15:13 EDT 2006


Author: jesse
Date: Thu May 25 21:15:12 2006
New Revision: 5296

Modified:
   rt/branches/3.5-TESTING/   (props changed)
   rt/branches/3.5-TESTING/lib/RT/Transaction_Overlay.pm

Log:
 r9824 at jesse-vincents-computer-2:  jesse | 2006-05-25 21:13:11 -0400
 * Actually do a credible job of showing html-only email messages in ticket history by downsampling them to plain text.


Modified: rt/branches/3.5-TESTING/lib/RT/Transaction_Overlay.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/Transaction_Overlay.pm	(original)
+++ rt/branches/3.5-TESTING/lib/RT/Transaction_Overlay.pm	Thu May 25 21:15:12 2006
@@ -82,6 +82,10 @@
 use RT::Attachments;
 use RT::Scrips;
 
+use HTML::FormatText;
+use HTML::TreeBuilder;
+
+
 # {{{ sub Create 
 
 =head2 Create
@@ -278,9 +282,13 @@
     );
 
     my $content;
-    my $content_obj = $self->ContentObj;
-    if ($content_obj) {
+    if (my $content_obj = $self->ContentObj) {
         $content = $content_obj->Content;
+
+	if ($content_obj->ContentType =~ m{^text/html$}i) {
+        $content = HTML::FormatText->new(leftmargin => 0, rightmargin => 78)->format(  HTML::TreeBuilder->new_from_content( $content));
+
+	}
     }
 
     # If all else fails, return a message that we couldn't find any content
@@ -342,7 +350,7 @@
 
     # If it's a message or a plain part, just return the
     # body.
-    if ( $Attachment->ContentType() =~ '^(text/plain$|message/)' ) {
+    if ( $Attachment->ContentType() =~ '^(?:text/plain$|text/html|message/)' ) {
         return ($Attachment);
     }
 


More information about the Rt-commit mailing list