[Rt-commit] rt branch 5.0/allow-rich-text-signatures created. rt-5.0.2-62-gfa087e37c1
BPS Git Server
git at git.bestpractical.com
Thu Feb 10 23:47:26 UTC 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/allow-rich-text-signatures has been created
at fa087e37c15d7a276f047f0c0893e7070542e5c8 (commit)
- Log -----------------------------------------------------------------
commit fa087e37c15d7a276f047f0c0893e7070542e5c8
Author: Brian Conry <bconry at bestpractical.com>
Date: Thu Feb 10 17:40:53 2022 -0600
Allow rich text signatures
If the user has their preferences set so that they use the WYSIWYG
editor for ticket updates then the signature textarea in their
Preferences will also be a WYSIWYG editor, allowing them to create a
rich text signature.
Signatures are automatically upconverted from plain text to rich text
either when the preferences are updated or each time corresponding on a
ticket.
There is no automatic down-conversion from a rich text signature to
plain text.
diff --git a/share/html/Elements/MessageBox b/share/html/Elements/MessageBox
index ce985aa51b..7aae0065d0 100644
--- a/share/html/Elements/MessageBox
+++ b/share/html/Elements/MessageBox
@@ -79,13 +79,16 @@ if ( $IncludeSignature and $signature =~ /\S/ ) {
$signature =~ s/\n*$//;
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> </p><p>-- <br />$signature</p>";
+ # only transform the signature if it doesn't look like HTML
+ if ($signature !~ /<.{1,5}>/) {
+ $signature =~ s/&/&/g;
+ $signature =~ s/</</g;
+ $signature =~ s/>/>/g;
+ $signature =~ s/"/"/g; # "//;
+ $signature =~ s/'/'/g; # '//;
+ $signature =~ s{\n}{<br />}g;
+ $signature = "<p> </p><p>-- <br />$signature</p>";
+ }
} else {
$signature = "\n\n-- \n". $signature . "\n";
}
diff --git a/share/html/Prefs/Elements/EditAboutMe b/share/html/Prefs/Elements/EditAboutMe
index cf66ad656a..1003287284 100644
--- a/share/html/Prefs/Elements/EditAboutMe
+++ b/share/html/Prefs/Elements/EditAboutMe
@@ -248,10 +248,17 @@
</div>
%if ($UserObj->Privileged) {
+% my $sig = $UserObj->Signature || '';
+% my $richtext = '';
<div class="form-row">
<div class="col-6">
<&| /Widgets/TitleBox, title => loc('Signature'), id => "user-prefs-signature" &>
- <textarea class="form-control signature" cols="80" rows="5" name="Signature" wrap="hard"><%$UserObj->Signature || ''%></textarea>
+% if (RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'})) {
+% # allow for a smooth transition from a plain text signature, with or without HTML content, to a rich text signature
+ <input type="text" style="display:none" name="SignatureType" id="SignatureType" value="<%$sig =~ /<.{1,5}>/ ? "text/html" : 'text/plain'%>"/>
+% $richtext = ' richtext';
+% }
+ <textarea class="form-control signature<%$richtext%>" cols="80" rows="5" name="Signature" wrap="hard"><%$sig%></textarea>
</&>
</div>
</div>
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list