[rt-users] Show HTML-only messages in Display ticket (Intern)

ronny.pettersen at telenor.com ronny.pettersen at telenor.com
Thu Mar 4 07:58:43 EST 2004


Inspired by Ruslan's patch (http://lists.fsck.com/pipermail/rt-users/2003-December/019027.html), 
I made one that uses HTML::FormatText (and HTML::TreeBuilder).

This one gives me a plain text version of the HTML-email in Display Ticket.
I'm using encode_utf8 as all emails have iso-8859-1 encoding.
Not sure if I "need" to use Text::Quoted below(?).

I'd also like to include this text when someone does a reply (QuoteTransaction), but haven't
found the correct place in the code to modify... Anyone?


Regards,
Ronny Pettersen
--

--- rt3/share/html/Ticket/Elements/ShowTransaction.orig 2004-03-02 15:46:43.000000000 +0100
+++ rt3/share/html/Ticket/Elements/ShowTransaction      2004-03-04 12:48:40.000000000 +0100
@@ -63,6 +63,16 @@
             $quoted = $message->Content;
         }
      }
+     if ($message->ContentType =~ m{^text/html$}i &&
+                                   $message->ContentLength < $MAX_INLINE_BODY ) {
+       require HTML::TreeBuilder;
+       my $tree = HTML::TreeBuilder->new->parse(Encode::encode_utf8($message->Content));
+       require HTML::FormatText;
+       my $formatter = new HTML::FormatText;
+       #require Text::Quoted;
+       #$quoted = Text::Quoted::extract($formatter->format($tree)); 
+       $quoted = $formatter->format($tree);
+     }
         
 </%PERL>
 <TR class="<% $RowNum%2 ? 'oddline' : 'evenline'%>" >                                



More information about the rt-users mailing list