[Rt-commit] rt branch, 4.2-on-4.0/message-box-include-signature-before-quote, created. rt-4.0.8rc1-4-gfbfbb7c

Alex Vandiver alexmv at bestpractical.com
Tue Oct 30 15:03:38 EDT 2012


The branch, 4.2-on-4.0/message-box-include-signature-before-quote has been created
        at  fbfbb7c4a1234e5b640d7a68e3c55435965d9b59 (commit)

- Log -----------------------------------------------------------------
commit f332f0552de7feb66a949f6bd7d4027386010393
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 6532aed..161df5b 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1500,6 +1500,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 69227bf..f2df967 100755
--- 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 4ee66aa44b932c5d406789cdd1f33eb39263e035
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 ba338bb..e57c35d 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -271,6 +271,15 @@ our %META = (
             Hints => "When the WYSIWYG editor is not enabled, this setting determines whether automatic line wraps in the ticket message box are sent to RT or not.",              # 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 f2df967..477d7c4 100755
--- 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 9a784468491ccfcc0a46f480d84ab9ab9dc4a3f7
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 477d7c4..9aa69e2 100755
--- 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 fbfbb7c4a1234e5b640d7a68e3c55435965d9b59
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 9aa69e2..73befb8 100755
--- 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