[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-226-g8fd7ae2

Alex Vandiver alexmv at bestpractical.com
Tue Oct 26 22:23:25 EDT 2010


The branch, 3.9-trunk has been updated
       via  8fd7ae228e84e405902751c9ccc3c15eb1ae8894 (commit)
      from  6b12b8fe6726210a3c3a50cb9e91b9ee331eb157 (commit)

Summary of changes:
 share/html/NoAuth/js/util.js |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 8fd7ae228e84e405902751c9ccc3c15eb1ae8894
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Oct 26 22:23:17 2010 -0400

    Abstract out text to HTML replacement

diff --git a/share/html/NoAuth/js/util.js b/share/html/NoAuth/js/util.js
index f13c9f5..16a0159 100644
--- a/share/html/NoAuth/js/util.js
+++ b/share/html/NoAuth/js/util.js
@@ -244,6 +244,14 @@ jQuery(function() {
     } );
 });
 
+function textToHTML(value) {
+    return value.replace(/&/g,    "&amp;")
+                .replace(/</g,    "&lt;")
+                .replace(/>/g,    "&gt;")
+                .replace(/-- \n/g,"--&nbsp;\n")
+                .replace(/\n/g,   "\n<br />");
+};
+
 function ReplaceAllTextareas(encoded) {
     var sAgent = navigator.userAgent.toLowerCase();
     if (!CKEDITOR.env.isCompatible ||
@@ -260,11 +268,7 @@ function ReplaceAllTextareas(encoded) {
         if (jQuery(textArea).hasClass("messagebox")) {
             // Turn the original plain text content into HTML
             if (encoded == 0) {
-                textArea.value = textArea.value
-                    .replace(/&/g,  "&amp;")
-                    .replace(/</g,  "&lt;")
-                    .replace(/>/g,  "&gt;")
-                    .replace(/\n/g, "\n<br />");
+                textArea.value = textToHTML(textArea.value);
             }
             // For this javascript
             var CKeditorEncoded = document.createElement('input');

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


More information about the Rt-commit mailing list