[Rt-commit] rt branch, 4.2/quote-folding-config, created. rt-4.0.5-282-g8127670

? sunnavy sunnavy at bestpractical.com
Sat Mar 3 14:06:37 EST 2012


The branch, 4.2/quote-folding-config has been created
        at  8127670060dc92bcb63830e605eb0a2e74252bbd (commit)

- Log -----------------------------------------------------------------
commit 8127670060dc92bcb63830e605eb0a2e74252bbd
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sun Mar 4 02:38:26 2012 +0800

    make quote folding an option so we can enable/disable it

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 2e8ef50..02f49d4 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1633,6 +1633,14 @@ your own styles of link detection.
 
 Set(@Active_MakeClicky, qw());
 
+=item C<$QuoteFolding>
+
+Disable quote folding by setting this to 0
+
+=cut
+
+Set($QuoteFolding, 1);
+
 =back
 
 
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 5a94f27..2a98635 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -430,6 +430,15 @@ our %META = (
             Description => q{Display ticket after "Quick Create"}, #loc
         },
     },
+    QuoteFolding => {
+        Section => 'Ticket display',
+        Overridable => 1,
+        SortOrder => 9,
+        Widget => '/Widgets/Form/Boolean',
+        WidgetArguments => {
+            Description => 'Enable quote folding?' # loc
+        }
+    },
 
     # User overridable locale options
     DateTimeFormat => {
diff --git a/share/html/Ticket/Elements/ShowHistory b/share/html/Ticket/Elements/ShowHistory
index b5e009c..7d27769 100755
--- a/share/html/Ticket/Elements/ShowHistory
+++ b/share/html/Ticket/Elements/ShowHistory
@@ -60,11 +60,16 @@ if ($ShowDisplayModes or $ShowTitle) {
     if ($ShowDisplayModes) {
         $titleright = '';
         
-        my $open_all  = $m->interp->apply_escapes( loc("Show all quoted text"), 'h' );
-        my $close_all = $m->interp->apply_escapes( loc("Hide all quoted text"), 'h' );
-        $titleright .=    '<a href="#" data-direction="open" '
-                        . qq{onclick='return toggle_all_folds(this, "$open_all", "$close_all");'}
-                        . ">$open_all</a> — ";
+        if ( RT->Config->Get( 'QuoteFolding', $session{CurrentUser} ) ) {
+            my $open_all =
+              $m->interp->apply_escapes( loc("Show all quoted text"), 'h' );
+            my $close_all =
+              $m->interp->apply_escapes( loc("Hide all quoted text"), 'h' );
+            $titleright .=
+                '<a href="#" data-direction="open" '
+              . qq{onclick='return toggle_all_folds(this, "$open_all", "$close_all");'}
+              . ">$open_all</a> — ";
+        }
 
         if ($ShowHeaders) {
             $titleright .= qq{<a href="$URIFile?id=} .
diff --git a/share/html/Ticket/Elements/ShowTransactionAttachments b/share/html/Ticket/Elements/ShowTransactionAttachments
index 877201f..1d0b149 100644
--- a/share/html/Ticket/Elements/ShowTransactionAttachments
+++ b/share/html/Ticket/Elements/ShowTransactionAttachments
@@ -215,8 +215,13 @@ my $render_attachment = sub {
                     ticket  => $Ticket,
                 );
 
-                require HTML::Quoted;
-                $content = HTML::Quoted->extract($content) unless length $name;
+                if ( !length $name
+                    && RT->Config->Get( 'QuoteFolding', $session{CurrentUser} )
+                  )
+                {
+                    require HTML::Quoted;
+                    $content = HTML::Quoted->extract($content);
+                }
 
                 $m->comp(
                     'ShowMessageStanza',
@@ -234,9 +239,15 @@ my $render_attachment = sub {
             # if it's a text/plain show the body
             elsif ( $message->ContentType =~ m{^(text|message)}i ) {
 
-                unless ( length $name ) {
-                    eval { require Text::Quoted;  $content = Text::Quoted::extract($content); };
-                    if ($@) { $RT::Logger->warning( "Text::Quoted failed: $@" ) }
+                unless ( length $name
+                    && RT->Config->Get( 'QuoteFolding', $session{CurrentUser} )
+                  )
+                {
+                    eval {
+                        require Text::Quoted;
+                        $content = Text::Quoted::extract($content);
+                    };
+                    if ($@) { $RT::Logger->warning("Text::Quoted failed: $@") }
                 }
 
                 $m->comp(

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


More information about the Rt-commit mailing list