[Rt-commit] rt branch, 4.4/message-box-include-signature-before-quote, created. rt-4.1.23-4-g993b0ac

Alex Vandiver alexmv at bestpractical.com
Fri Oct 4 18:32:38 EDT 2013


The branch, 4.4/message-box-include-signature-before-quote has been created
        at  993b0acd19a3b4893c3bb86e8fd435501111cdcc (commit)

- Log -----------------------------------------------------------------
commit 1541e6d0901d13d984034f4caf52b0cadff92a06
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 12 21:41:59 2012 +0800

    added config MessageBoxIncludeSignatureBeforeQuote

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 57623ec..d42eaa2 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1678,6 +1678,16 @@ C<$MessageBoxIncludeSignature>.
 
 Set($MessageBoxIncludeSignatureOnComment, 1);
 
+=item C<$MessageBoxIncludeSignatureBeforeQuote>
+
+Should your users' signatures (from their Preferences page) be
+included before quoted text
+
+=cut
+
+Set($MessageBoxIncludeSignatureBeforeQuote, 0);
+
+
 =back
 
 
diff --git a/share/html/Elements/MessageBox b/share/html/Elements/MessageBox
index 53af2ca..c8c0d1c 100644
--- a/share/html/Elements/MessageBox
+++ b/share/html/Elements/MessageBox
@@ -48,7 +48,7 @@
 <textarea autocomplete="off" class="messagebox" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">\
 % $m->comp('/Articles/Elements/IncludeArticle', %ARGS) if $IncludeArticle;
 % $m->callback( %ARGS, SignatureRef => \$signature );
-<% $Default || '' %><% $message %><% $signature %></textarea>
+<% $Default || '' %><% RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote') ? ( $signature . ( $message =~ /\S/ ? "\n$message" : $message ) ) : ( $message . $signature ) %></textarea>
 % $m->callback( %ARGS, CallbackName => 'AfterTextArea' );
 <%INIT>
 

commit ce3887b1eee7d65f139556b382d198c8bd411946
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 12 21:52:10 2012 +0800

    allow user to customize MessageBoxIncludeSignatureBeforeQuote in pref

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index a99ba24..422fbd0 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -276,6 +276,15 @@ our %META;
             Description => 'Message box height',          #loc
         },
     },
+    MessageBoxIncludeSignatureBeforeQuote => {
+        Section         => 'Ticket composition', #loc
+        Overridable     => 1,
+        SortOrder       => 8.2,
+        Widget          => '/Widgets/Form/Boolean',
+        WidgetArguments => {
+            Description => 'Message box includes signature before quote', #loc
+        },
+    },
     DefaultTimeUnitsToHours => {
         Section         => 'Ticket composition', #loc
         Overridable     => 1,
diff --git a/share/html/Elements/MessageBox b/share/html/Elements/MessageBox
index c8c0d1c..f81df6f 100644
--- a/share/html/Elements/MessageBox
+++ b/share/html/Elements/MessageBox
@@ -48,7 +48,7 @@
 <textarea autocomplete="off" class="messagebox" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">\
 % $m->comp('/Articles/Elements/IncludeArticle', %ARGS) if $IncludeArticle;
 % $m->callback( %ARGS, SignatureRef => \$signature );
-<% $Default || '' %><% RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote') ? ( $signature . ( $message =~ /\S/ ? "\n$message" : $message ) ) : ( $message . $signature ) %></textarea>
+<% $Default || '' %><% RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote', $session{CurrentUser}) ? ( $signature . ( $message =~ /\S/ ? "\n$message" : $message ) ) : ( $message . $signature ) %></textarea>
 % $m->callback( %ARGS, CallbackName => 'AfterTextArea' );
 <%INIT>
 

commit 7b73ae5e2ac286728a52f6428fdbfb945a841e6b
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Oct 24 23:24:36 2012 +0800

    remove the unnecessary "\" because browsers ignore the first newline
    
    see also #21152

diff --git a/share/html/Elements/MessageBox b/share/html/Elements/MessageBox
index f81df6f..3d40789 100644
--- a/share/html/Elements/MessageBox
+++ b/share/html/Elements/MessageBox
@@ -45,7 +45,7 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<textarea autocomplete="off" class="messagebox" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">\
+<textarea autocomplete="off" class="messagebox" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">
 % $m->comp('/Articles/Elements/IncludeArticle', %ARGS) if $IncludeArticle;
 % $m->callback( %ARGS, SignatureRef => \$signature );
 <% $Default || '' %><% RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote', $session{CurrentUser}) ? ( $signature . ( $message =~ /\S/ ? "\n$message" : $message ) ) : ( $message . $signature ) %></textarea>

commit 993b0acd19a3b4893c3bb86e8fd435501111cdcc
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Oct 24 23:40:57 2012 +0800

    Tweak spaces around signature to provide useful default whitespace
    
    Most signatures don't have trailing newlines, so more than one "\n" is
    necessary between the sig and the quote.  Finally, having a blank line
    (or two) before the "-- \n" means there's an obvious place to click and
    start typing.  With signature-before-quote, this gives (all examples use
    "." for a blank line):
       .
       .
        --
        Foo
        Bar
       .
        On Oct 18, you wrote:
        > ...
    
    This provides a blank line to click on and begin to type, as well as a
    blank line thereafter to separate from the signature.
    
    With the standard signature-after setting, this now gives:
        On Oct 18, you wrote:
        > ...
       .
       .
       .
        --
        Foo
        Bar
    
    ...providing three blank lines in the middle.  This allows the user to
    click on the second one and start typing, but leave whitespace before
    and after their response.  Finally, if there's nothing to quote,
    regardless of the preference:
       .
       .
        --
        Foo
        Bar
    
    ..with a similar click-on-the-first-line use case as described above.

diff --git a/share/html/Elements/MessageBox b/share/html/Elements/MessageBox
index 3d40789..484f971 100644
--- a/share/html/Elements/MessageBox
+++ b/share/html/Elements/MessageBox
@@ -48,7 +48,7 @@
 <textarea autocomplete="off" class="messagebox" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">
 % $m->comp('/Articles/Elements/IncludeArticle', %ARGS) if $IncludeArticle;
 % $m->callback( %ARGS, SignatureRef => \$signature );
-<% $Default || '' %><% RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote', $session{CurrentUser}) ? ( $signature . ( $message =~ /\S/ ? "\n$message" : $message ) ) : ( $message . $signature ) %></textarea>
+<% $Default || '' %><% RT->Config->Get('MessageBoxIncludeSignatureBeforeQuote', $session{CurrentUser}) ? ( "\n\n$signature\n\n" . $message ) : ( $message .  "\n\n$signature" ) %></textarea>
 % $m->callback( %ARGS, CallbackName => 'AfterTextArea' );
 <%INIT>
 
@@ -58,10 +58,12 @@ if ( $QuoteTransaction ) {
     my $transaction = RT::Transaction->new( $session{'CurrentUser'} );
     $transaction->Load( $QuoteTransaction );
     $message = $transaction->Content( Quote => 1 );
+    chomp $message;
 }
 
 my $signature = '';
 if ( $IncludeSignature and my $text = $session{'CurrentUser'}->UserObj->Signature ) {
+    chomp $text;
     $signature = "-- \n". $text;
 }
 

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


More information about the Rt-commit mailing list