%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
%# 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 <% $Type eq 'text/html' ? 'richtext' : '' %>" <% $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>
% $m->callback( %ARGS, CallbackName => 'AfterTextArea' );
+% if ($Type eq 'text/html') {
+<input type="text" style="display:none" name="<% $Name %>Type" id="<% $Name %>Type" value="<% $m->request_args->{$Name."Type"}||$Type %>" />
+% }
<%INIT>
my $message = '';
if ( $QuoteTransaction ) {
my $transaction = RT::Transaction->new( $session{'CurrentUser'} );
$transaction->Load( $QuoteTransaction );
- $message = $transaction->Content( Quote => 1 );
+ $message = $transaction->Content( Quote => 1, Type => $Type );
}
my $signature = '';
if ( $IncludeSignature and my $text = $session{'CurrentUser'}->UserObj->Signature ) {
- $signature = "-- \n". $text;
+ $signature = "-- \n". $text;
+ if ($Type eq 'text/html') {
+ $signature =~ s/&/&/g;
+ $signature =~ s/</</g;
+ $signature =~ s/>/>/g;
+ $signature =~ s/"/"/g; # "//;
+ $signature =~ s/'/'/g; # '//;
+ $signature =~ s{\n}{<br />}g;
+ $signature = "<p>$signature</p>";
+ }
}
# wrap="something" seems to really break IE + richtext
-my $wrap_type = '';
-if ( not RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'}) ) {
- $wrap_type = 'wrap="' . $m->interp->apply_escapes($Wrap, 'h') . '"';
-}
+my $wrap_type = $Type eq 'text/html' ? '' : 'wrap="soft"';
# If there's no cols specified, we want to set the width to 100% in CSS
my $width_attr;
$Default => ''
$Width => RT->Config->Get('MessageBoxWidth', $session{'CurrentUser'} )
$Height => RT->Config->Get('MessageBoxHeight', $session{'CurrentUser'} ) || 15
-$Wrap => RT->Config->Get('MessageBoxWrap', $session{'CurrentUser'} ) || 'SOFT'
$IncludeSignature => RT->Config->Get('MessageBoxIncludeSignature');
$IncludeArticle => 1;
+$Type => RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'}) ? 'text/html' : 'text/plain';
</%ARGS>