[Rt-commit] rt branch, master, updated. rt-4.1.8-412-gba81e0d

Ruslan Zakirov ruz at bestpractical.com
Thu May 23 07:12:21 EDT 2013


The branch, master has been updated
       via  ba81e0d788d1fe4eaa35e8f9133f5920a63a3095 (commit)
       via  3a375c4dd72c38775cab244a5eddf3152fdb028a (commit)
      from  b99c4db02d3bdbfef0b46fb3c694417143f35495 (commit)

Summary of changes:
 etc/RT_Config.pm.in                    | 17 +++--------------
 lib/RT/Config.pm                       | 25 ++++++++++++++++---------
 share/html/Elements/ShowMessageStanza  | 14 +-------------
 share/html/Ticket/ShowEmailRecord.html |  6 +-----
 4 files changed, 21 insertions(+), 41 deletions(-)

- Log -----------------------------------------------------------------
commit 3a375c4dd72c38775cab244a5eddf3152fdb028a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Mar 18 17:42:20 2013 -0400

    Remove PlainTextPre preference, in favor of PlainTextMono
    
    PlainTextPre was introduced in bb4704f; PlainTextMono was added in
    084a6d3 and 3cac06e, but at the time PlainTextPre was left as an option
    because it was better-supported under IE6.  As RT 4.2 removes support
    for IE6, remove the PlainTextPre option in favor of PlainTextMono, as it
    preserves white-space but still allows wrapping of long lines.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index d3fd15a..1008ca6 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1638,23 +1638,12 @@ behavior.
 
 Set($ShowTransactionImages, 1);
 
-=item C<$PlainTextPre>
+=item C<$PlainTextMono>
 
 Normally plaintext attachments are displayed as HTML with line breaks
 preserved.  This causes space- and tab-based formatting not to be
-displayed correctly.  By setting $PlainTextPre messages will be
-displayed using <pre>.
-
-=cut
-
-Set($PlainTextPre, 0);
-
-
-=item C<$PlainTextMono>
-
-Set C<$PlainTextMono> to 1 to use monospaced font and preserve
-formatting; unlike C<$PlainTextPre>, the text will wrap to fit width
-of the browser window; this option overrides C<$PlainTextPre>.
+displayed correctly.  Set C<$PlainTextMono> to 1 to use a monospaced
+font and preserve formatting.
 
 =cut
 
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 6675137..981cd5d 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -383,13 +383,20 @@ our %META = (
 
     },
     PlainTextPre => {
-        Section         => 'Ticket display',
-        Overridable     => 1,
-        SortOrder       => 5,
-        Widget          => '/Widgets/Form/Boolean',
-        WidgetArguments => {
-            Description => 'add <pre> tag around plain text attachments', #loc
-            Hints       => "Use this to protect the format of plain text" #loc
+        PostSet => sub {
+            my $self  = shift;
+            my $value = shift;
+            $self->SetFromConfig(
+                Option => \'PlainTextMono',
+                Value  => [$value],
+                %{$self->Meta('PlainTextPre')->{'Source'}}
+            );
+        },
+        PostLoadCheck => sub {
+            my $self = shift;
+            # XXX: deprecated, remove in 4.4
+            $RT::Logger->info("You set \$PlainTextPre in your config, which has been removed in favor of \$PlainTextMono.  Please update your config.")
+                if $self->Meta('PlainTextPre')->{'Source'}{'Package'};
         },
     },
     PlainTextMono => {
@@ -398,8 +405,8 @@ our %META = (
         SortOrder       => 5,
         Widget          => '/Widgets/Form/Boolean',
         WidgetArguments => {
-            Description => 'display wrapped and formatted plain text attachments', #loc
-            Hints => 'Use css rules to display text monospaced and with formatting preserved, but wrap as needed.  This does not work well with IE6 and you should use the previous option', #loc
+            Description => 'Display plain-text attachments in fixed-width font', #loc
+            Hints => 'Display all plain-text attachments in a monospace font with formatting preserved, but wrapping as needed.', #loc
         },
     },
     MoreAboutRequestorTicketList => {
diff --git a/share/html/Elements/ShowMessageStanza b/share/html/Elements/ShowMessageStanza
index 189b62b..2651f2f 100644
--- a/share/html/Elements/ShowMessageStanza
+++ b/share/html/Elements/ShowMessageStanza
@@ -46,8 +46,6 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <%INIT>
-my $plain_text_pre
-    = RT->Config->Get( 'PlainTextPre', $session{'CurrentUser'} );
 my $plain_text_mono
     = RT->Config->Get( 'PlainTextMono', $session{'CurrentUser'} );
 my $Depth = 0;
@@ -66,7 +64,7 @@ my $print_content = sub {
                   %ARGS
                 );
 
-        if ( defined $$ref && !$plain_text_pre && !$plain_text_mono ) {
+        if ( defined $$ref && !$plain_text_mono ) {
             $$ref =~ s{(\r?\n)}{<br />}g;
         }
     } else {
@@ -78,11 +76,6 @@ my $print_content = sub {
 };
 
 if ( ref $Message ) {
-    $m->out('<pre>')
-        if (    $ContentType eq 'text/plain'
-             && $plain_text_pre
-             && !$Depth
-             && !$plain_text_mono );
     $m->out(   '<div class="message-stanza'
              . ( ($ContentType eq 'text/plain' &&  $plain_text_mono) ? ' plain-text-white-space' : '' ) . '"'
              . '>' );
@@ -172,11 +165,6 @@ AGAIN: foreach ( ; $i < @$Message; $i++ ) {
     }
 
     $m->out('</div>');
-    $m->out('</pre>')
-        if (    $ContentType eq 'text/plain'
-             && $plain_text_pre
-             && !$Depth
-             && !$plain_text_mono );
 } else {
     $print_content->( \$Message );
 }
diff --git a/share/html/Ticket/ShowEmailRecord.html b/share/html/Ticket/ShowEmailRecord.html
index df63fe8..2d4be7d 100644
--- a/share/html/Ticket/ShowEmailRecord.html
+++ b/share/html/Ticket/ShowEmailRecord.html
@@ -50,11 +50,9 @@ $Attachment => undef
 $Transaction => undef
 </%ARGS>
 <%INIT>
-my $plain_text_pre
-    = RT->Config->Get( 'PlainTextPre', $session{'CurrentUser'} );
 my $plain_text_mono
     = RT->Config->Get( 'PlainTextMono', $session{'CurrentUser'} );
-my $use_brs = !$plain_text_pre && !$plain_text_mono;
+my $use_brs = !$plain_text_mono;
 
 my $show_content = sub {
     my $attach = shift;
@@ -74,7 +72,6 @@ my $show;
 $show = sub {
     my $attach = shift;
     $m->out('<div id="body">');
-    $m->out('<pre style="padding: 2em;">') if $plain_text_pre;
     $m->out('<div class="plain-text-white-space">') if $plain_text_mono;
 
     my $headers = $m->interp->apply_escapes( $attach->Headers, 'h' );
@@ -92,7 +89,6 @@ $show = sub {
         $show_content->( $attach );
     }
     $m->out('</div>') if $plain_text_mono;
-    $m->out('</pre>') if $plain_text_pre;
     $m->out('</div>');
 };
 

commit ba81e0d788d1fe4eaa35e8f9133f5920a63a3095
Merge: b99c4db 3a375c4
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu May 23 15:10:15 2013 +0400

    Merge branch '4.2/remove-plain-text-pre'
    
    Conflicts:
    	etc/RT_Config.pm.in
    	share/html/Elements/ShowMessageStanza

diff --cc etc/RT_Config.pm.in
index 9c18167,1008ca6..642d61c
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@@ -1728,20 -1638,7 +1728,20 @@@ behavior
  
  Set($ShowTransactionImages, 1);
  
 +=item C<$ShowRemoteImages>
 +
 +By default, RT doesn't show remote images attached to incoming (and outgoing)
 +ticket updates inline.  Set this variable to 1 if you'd like to enable remote
 +image display.  Showing remote images may allow spammers and other senders to
 +track when messages are viewed and see referer information.
 +
 +Note that this setting is independent of L</$ShowTransactionImages> above.
 +
 +=cut
 +
 +Set($ShowRemoteImages, 0);
 +
- =item C<$PlainTextPre>
+ =item C<$PlainTextMono>
  
  Normally plaintext attachments are displayed as HTML with line breaks
  preserved.  This causes space- and tab-based formatting not to be
diff --cc share/html/Elements/ShowMessageStanza
index 65ee738,2651f2f..643fbb5
--- a/share/html/Elements/ShowMessageStanza
+++ b/share/html/Elements/ShowMessageStanza
@@@ -77,16 -75,11 +75,11 @@@ my $print_content = sub 
      $m->out($$ref);
  };
  
- $m->out('<pre>')
-     if (    $ContentType eq 'text/plain'
-          && $plain_text_pre
-          && !$Depth
-          && !$plain_text_mono );
 -if ( ref $Message ) {
 -    $m->out(   '<div class="message-stanza'
 -             . ( ($ContentType eq 'text/plain' &&  $plain_text_mono) ? ' plain-text-white-space' : '' ) . '"'
 -             . '>' );
 +$m->out(   '<div class="message-stanza'
 +         . ( ($ContentType eq 'text/plain' &&  $plain_text_mono) ? ' plain-text-white-space' : '' ) . '"'
 +         . '>' );
  
 +if ( ref $Message ) {
      my @stack;
      my $para = '';
      my $i    = 0;
@@@ -173,13 -166,8 +166,8 @@@ AGAIN: foreach ( ; $i < @$Message; $i+
  } else {
      $print_content->( \$Message );
  }
 +
 +$m->out('</div>');
- $m->out('</pre>')
-     if (    $ContentType eq 'text/plain'
-          && $plain_text_pre
-          && !$Depth
-          && !$plain_text_mono );
  </%INIT>
  <%ARGS>
  $Message => undef

-----------------------------------------------------------------------


More information about the Rt-commit mailing list