[Rt-commit] r9642 - rt/branches/3.6-RELEASE/lib/RT

audreyt at bestpractical.com audreyt at bestpractical.com
Sun Nov 11 15:05:50 EST 2007


Author: audreyt
Date: Sun Nov 11 15:05:50 2007
New Revision: 9642

Modified:
   rt/branches/3.6-RELEASE/lib/RT/Transaction_Overlay.pm

Log:
* RT::Transaction_Overlay: Be saner and allows explicitly
  calling $txn->Content(Type => 'text/html'), instead of
  relying on action-at-a-distance $PreferredContentType.

Modified: rt/branches/3.6-RELEASE/lib/RT/Transaction_Overlay.pm
==============================================================================
--- rt/branches/3.6-RELEASE/lib/RT/Transaction_Overlay.pm	(original)
+++ rt/branches/3.6-RELEASE/lib/RT/Transaction_Overlay.pm	Sun Nov 11 15:05:50 2007
@@ -277,14 +277,16 @@
 Takes a paramhash.  If the $args{'Quote'} parameter is set, wraps this message 
 at $args{'Wrap'}.  $args{'Wrap'} defaults to 70.
 
-If C<$RT::Transaction::PreferredContentType> is set to C<text/html>, plain texts
-are upgraded to HTML.  Otherwise, HTML texts are downgraded to plain text.
+If $args{'Type'} is set to C<text/html>, plain texts are upgraded to HTML.
+Otherwise, HTML texts are downgraded to plain text.  If $args{'Type'} is missing,
+it defaults to the value of C<$RT::Transaction::PreferredContentType>.
 
 =cut
 
 sub Content {
     my $self = shift;
     my %args = (
+        Type  => $PreferredContentType,
         Quote => 0,
         Wrap  => 70,
         @_
@@ -297,7 +299,7 @@
 	if ($content_obj->ContentType =~ m{^text/html$}i) {
             $content =~ s/<p>--\s+<br \/>.*?$//s if $args{'Quote'};
 
-            if ($PreferredContentType ne 'text/html') {
+            if ($args{Type} ne 'text/html') {
                 $content = HTML::FormatText->new(
                     leftmargin  => 0,
                     rightmargin => 78,
@@ -309,7 +311,7 @@
         else {
             $content =~ s/\n-- \n.*?$//s if $args{'Quote'};
 
-            if ($PreferredContentType eq 'text/html') {
+            if ($args{Type} eq 'text/html') {
                 # Extremely simple text->html converter
                 $content =~ s/&/&#38;/g;
                 $content =~ s/</&lt;/g;


More information about the Rt-commit mailing list