[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-388-g656ca37

Jesse Vincent jesse at bestpractical.com
Fri Nov 5 11:39:48 EDT 2010


The branch, 3.9-trunk has been updated
       via  656ca37bd05c055bdc9c66a97450786db33e8666 (commit)
       via  189b279f79f039b37700dfb899f423d9a9581e7e (commit)
      from  45aeae09eca5a4553b01b98e2dac453c5cf822d7 (commit)

Summary of changes:
 etc/RT_Config.pm.in                                |    3 +-
 sbin/rt-test-dependencies.in                       |    1 +
 share/html/NoAuth/RichText/ckeditor/config.js      |    7 +++
 share/html/NoAuth/css/base/history-folding.css     |   14 +++++
 share/html/NoAuth/css/base/main.css                |    1 +
 share/html/NoAuth/js/history-folding.js            |   14 +++++
 share/html/Ticket/Elements/FoldStanzaJS            |    9 +++
 share/html/Ticket/Elements/ShowHTMLMessageStanza   |   57 ++++++++++++++++++++
 share/html/Ticket/Elements/ShowHistory             |    7 +++
 share/html/Ticket/Elements/ShowMessageStanza       |   12 +++--
 .../Ticket/Elements/ShowTransactionAttachments     |   37 ++++++++++---
 11 files changed, 148 insertions(+), 14 deletions(-)
 create mode 100644 share/html/NoAuth/css/base/history-folding.css
 create mode 100644 share/html/NoAuth/js/history-folding.js
 create mode 100644 share/html/Ticket/Elements/FoldStanzaJS
 create mode 100644 share/html/Ticket/Elements/ShowHTMLMessageStanza

- Log -----------------------------------------------------------------
commit 189b279f79f039b37700dfb899f423d9a9581e7e
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Thu Nov 4 14:53:36 2010 -0400

    Port changes from FCKEditor config

diff --git a/share/html/NoAuth/RichText/ckeditor/config.js b/share/html/NoAuth/RichText/ckeditor/config.js
index f9e66ef..ff0b510 100644
--- a/share/html/NoAuth/RichText/ckeditor/config.js
+++ b/share/html/NoAuth/RichText/ckeditor/config.js
@@ -25,8 +25,15 @@ config.toolbar_Full =
     ['Link']
 ];
 
+config.enterMode = CKEDITOR.ENTER_BR;
+config.shiftEnterMode = CKEDITOR.ENTER_P;
 config.enableTabKeyTools = true;
 config.htmlEncodeOutput = false;
+
+config.disableNativeSpellChecker = false;
+config.browserContextMenuOnCtrl = true;
+
+
 config.toolbarStartupExpanded = false;
 config.font_names =
     'Arial/Arial, Helvetica, sans-serif;' +

commit 656ca37bd05c055bdc9c66a97450786db33e8666
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Thu Nov 4 16:00:29 2010 -0400

    Import history folding from a client project, somewhat retooled

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index b806d15..059fef9 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2127,7 +2127,7 @@ a list of js files to be included in head
 
 Example:
 
-Set(@JSFilesInHead, qw/jquery-1.4.2.min.js jquery_noconflict.js jquery-ui-1.8.4.custom.min.js jquery.tablesorter.min.js ui.timepickr.js titlebox-state.js util.js userautocomplete.js/);
+Set(@JSFilesInHead, qw/jquery-1.4.2.min.js jquery_noconflict.js jquery-ui-1.8.4.custom.min.js jquery.tablesorter.min.js ui.timepickr.js titlebox-state.js util.js userautocomplete.js history-folding.js/);
 
 =cut
 
@@ -2142,6 +2142,7 @@ Set(@JSFilesInHead, qw/
     userautocomplete.js
     superfish.js
     supersubs.js
+    history-folding.js
 /);
 
 =item C<$JSMinPath>
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index e69f8b0..15f0e9a 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -180,6 +180,7 @@ Text::Template 1.44
 File::ShareDir
 File::Spec 0.8
 HTML::Entities 
+HTML::Quoted
 HTML::Scrubber 0.08
 Log::Dispatch 2.23
 Sys::Syslog 0.16
diff --git a/share/html/NoAuth/css/base/history-folding.css b/share/html/NoAuth/css/base/history-folding.css
new file mode 100644
index 0000000..63bab97
--- /dev/null
+++ b/share/html/NoAuth/css/base/history-folding.css
@@ -0,0 +1,14 @@
+.message-stanza-folder {
+    color: #500050;
+    font-size: 0.9em;
+    padding: 0.2em;
+}
+
+.message-stanza-folder.open {
+    color: #ccc;
+}
+
+    .message-stanza-folder:before, .message-stanza-folder:after
+{
+    content: " - ";
+}
diff --git a/share/html/NoAuth/css/base/main.css b/share/html/NoAuth/css/base/main.css
index 7bd5ac8..1d833cc 100644
--- a/share/html/NoAuth/css/base/main.css
+++ b/share/html/NoAuth/css/base/main.css
@@ -64,6 +64,7 @@
 @import "portlets.css";
 @import "tools.css";
 @import "login.css";
+ at import "history-folding.css";
 
 % $m->callback(CallbackName => 'End');
 
diff --git a/share/html/NoAuth/js/history-folding.js b/share/html/NoAuth/js/history-folding.js
new file mode 100644
index 0000000..96a7929
--- /dev/null
+++ b/share/html/NoAuth/js/history-folding.js
@@ -0,0 +1,14 @@
+function fold_message_stanza(e,showmsg, hidemsg) {
+    var box = jQuery(e).next('.message-stanza');
+    if ( box.css('display') == 'none') {
+        box.css('display', 'block');
+        jQuery(e).addClass('open');
+        jQuery(e).removeClass('closed');
+        jQuery(e).text( hidemsg);
+    } else {
+        box.css('display', 'none');
+        jQuery(e).addClass('closed');
+        jQuery(e).removeClass('open');
+        jQuery(e).text( showmsg);
+    }
+}
diff --git a/share/html/Ticket/Elements/FoldStanzaJS b/share/html/Ticket/Elements/FoldStanzaJS
new file mode 100644
index 0000000..6b7f078
--- /dev/null
+++ b/share/html/Ticket/Elements/FoldStanzaJS
@@ -0,0 +1,9 @@
+% if ($Depth == 1 ) {
+<div
+    class="message-stanza-folder"
+    onclick="fold_message_stanza(this, '<%loc('Show quoted text')%>', '<%loc('Hide quoted text')%>');"><%loc('Show quoted text')%></div>
+% }
+<div class="message-stanza message-stanza-depth-<%$Depth%>" <%($Depth == 1)? 'style="display: none;" ' : ''|n%>>
+<%ARGS>
+$Depth => 0
+</%ARGS>
diff --git a/share/html/Ticket/Elements/ShowHTMLMessageStanza b/share/html/Ticket/Elements/ShowHTMLMessageStanza
new file mode 100644
index 0000000..1824343
--- /dev/null
+++ b/share/html/Ticket/Elements/ShowHTMLMessageStanza
@@ -0,0 +1,57 @@
+<%perl>
+if ( ref $Message ) {
+    $m->comp('FoldStanzaJS', Depth => $Depth);
+    my @stack;
+    my $para = '';
+    my $i = 0;
+
+    AGAIN: foreach ( ; $i < @$Message; $i++ ) {
+        my $stanza = $Message->[$i];
+        if ( ref $stanza eq "HASH" ) {
+            if ( $stanza->{raw} =~ /----- Original Message -----/ ) {
+                $Message->[$i+1] = [ splice @$Message, $i+1 ] if $Message->[$i+1];
+            }
+            $para .= (defined $stanza->{raw} ? $stanza->{raw} : '');
+        }
+        next unless ref $stanza eq "ARRAY";
+
+        $print_content->( \$para ); $para = '';
+
+        $Depth++;
+        push @stack, [$Message, $i+1];
+        ($Message, $i) = ($stanza, -1);
+
+        $m->comp('FoldStanzaJS', Depth => $Depth);
+    }
+    if ( length $para ) {
+        $print_content->( \$para ); $para = '';
+    }
+
+    if ( @stack ) {
+        ($Message, $i) = @{ pop @stack };
+        $Depth--;
+        $m->out('</div>');
+        goto AGAIN;
+    }
+
+    $m->out('</span>');
+} else {
+    $print_content->( \$Message );
+}
+</%perl>
+<%INIT>
+my $ticket = $Transaction ? $Transaction->TicketObj : undef;
+
+my $print_content = sub {
+    my $ref = shift;
+    return unless defined $$ref && length $$ref;
+
+    $m->callback( content => $ref, %ARGS );
+    $m->out( $$ref );
+};
+</%INIT>
+<%ARGS>
+$Message => undef
+$Depth => 0
+$Transaction => undef
+</%ARGS>
diff --git a/share/html/Ticket/Elements/ShowHistory b/share/html/Ticket/Elements/ShowHistory
index 1af57a8..a14dba8 100755
--- a/share/html/Ticket/Elements/ShowHistory
+++ b/share/html/Ticket/Elements/ShowHistory
@@ -77,6 +77,13 @@ if ($ShowDisplayModes or $ShowTitle) {
     }
 </%perl>
 <div class="history">
+<script type="text/javascript">
+var _rt_dict = {};
+_rt_dict = { 'hide quoted text': '<% loc('hide quoted text') %>',
+             'show quoted text': '<% loc('show quoted text') %>'
+           };
+</script>
+
 <& /Widgets/TitleBoxStart, title => $title, titleright_raw => $titleright &>
 % }
 <div id="ticket-history">
diff --git a/share/html/Ticket/Elements/ShowMessageStanza b/share/html/Ticket/Elements/ShowMessageStanza
index 7331ba6..8811d6e 100755
--- a/share/html/Ticket/Elements/ShowMessageStanza
+++ b/share/html/Ticket/Elements/ShowMessageStanza
@@ -47,9 +47,7 @@
 %# END BPS TAGGED BLOCK }}}
 <%perl>
 if ( ref $Message ) {
-    $m->out('<pre>') if $plain_text_pre && !$Depth && !$plain_text_mono;
-    $m->out( qq{<div class="message-stanza-depth-$Depth } .($plain_text_mono ? "plain-text-white-space" : "") .qq{">} );
-
+    $m->comp('FoldStanzaJS', Depth => $Depth);
 
     my @stack;
     my $para = '';
@@ -58,6 +56,9 @@ if ( ref $Message ) {
     AGAIN: foreach ( ; $i < @$Message; $i++ ) {
         my $stanza = $Message->[$i];
         if ( ref $stanza eq "HASH" ) {
+            if ( $stanza->{text} && $stanza->{text} =~ /----- Original Message -----/ ) {
+                $Message->[$i+1] = [ splice @$Message, $i+1 ] if $Message->[$i+1];
+            }
             $para .= ( defined $stanza->{raw} ? $stanza->{raw} : '') ."\n";
         }
         next unless ref $stanza eq "ARRAY";
@@ -67,7 +68,8 @@ if ( ref $Message ) {
         $Depth++;
         push @stack, [$Message, $i+1];
         ($Message, $i) = ($stanza, -1);
-        $m->out( qq{<div class="message-stanza-depth-$Depth">} );
+
+        $m->comp('FoldStanzaJS', Depth => $Depth);
     }
     if ( length $para ) {
         $print_content->( \$para ); $para = '';
@@ -76,7 +78,7 @@ if ( ref $Message ) {
     if ( @stack ) {
         ($Message, $i) = @{ pop @stack };
         $Depth--;
-        $m->out('</div>');
+        $m->out('</span>');
         goto AGAIN;
     }
 
diff --git a/share/html/Ticket/Elements/ShowTransactionAttachments b/share/html/Ticket/Elements/ShowTransactionAttachments
index c49d328..3c084f9 100644
--- a/share/html/Ticket/Elements/ShowTransactionAttachments
+++ b/share/html/Ticket/Elements/ShowTransactionAttachments
@@ -184,8 +184,7 @@ my $render_attachment = sub {
                     && ( $message->ContentType !~ m{^text/(?:html|enriched)$} )
                 )
             )
-          )
-        {
+        ) {
 
             my $content;
             # If we've cached the content, use it from there
@@ -196,14 +195,36 @@ my $render_attachment = sub {
                 $content = $message->Content;
             }
 
+            my $content_type = lc $message->ContentType;
+            $RT::Logger->debug(
+                "Rendering attachment #". $message->id
+                ." of '$content_type' type"
+            );
+
             # if it's a text/html clean the body and show it
-            if ( $message->ContentType =~ m{^text/(?:html|enriched)$}i ) {
+            if ( $content_type eq 'text/html' ) {
+                $content = $m->comp( '/Elements/ScrubHTML', Content => $content );
+
+                $m->comp(
+                    '/Elements/MakeClicky',
+                    content => \$content,
+                    html    => 1,
+                    ticket  => $Ticket,
+                );
+
+                require HTML::Quoted;
+                $content = HTML::Quoted->extract( $content );
+
+                $m->comp(
+                    'ShowHTMLMessageStanza',
+                    Depth       => 0,
+                    Message     => $content,
+                    Transaction => $Transaction
+                );
+            }
+
+            elsif ( $content_type eq 'text/enriched' ) {
                 $content = $m->comp( '/Elements/ScrubHTML', Content => $content );
-                if ( $message->ContentType eq 'text/html' ) {
-                    $m->comp('/Elements/MakeClicky', 
-                            content => \$content, html => 1,
-                            ticket => $Ticket );
-                }
                 $m->out( $content );
             }
 

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


More information about the Rt-commit mailing list