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

jamie.baddeley at fx.net.nz jamie.baddeley at fx.net.nz
Wed Mar 31 07:33:41 EST 2004


Hi,

I tried this. But I needed to hack things a little. It works fine for me
now as diffed. (please beware of mail wrapping)

-jamie

crm:~# diff -u
/usr/share/request-tracker3/html/Ticket/Elements/ShowTransaction
/usr/local/share/request-tracker3/html/Ticket/Elements/ShowTransaction
--- /usr/share/request-tracker3/html/Ticket/Elements/ShowTransaction   
2004-02-14 06:31:23.000000000 +1300
+++
/usr/local/share/request-tracker3/html/Ticket/Elements/ShowTransaction      2004-04-01 00:27:27.000000000 +1200
@@ -59,12 +59,19 @@
          eval {
          require Text::Quoted;
             $quoted = Text::Quoted::extract($message->Content);
-        };
-        if ($@) {
-            $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'%>" >
       <TD BGCOLOR="<%$bgcolor%>">  </TD>



On Fri, 2004-03-05 at 01:58, ronny.pettersen at telenor.com wrote:
> 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'%>" >                                
> _______________________________________________
> rt-users mailing list
> rt-users at lists.bestpractical.com
> http://lists.bestpractical.com/mailman/listinfo/rt-users
> 
> Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm
> 




More information about the rt-users mailing list