[Rt-commit] rt branch, history-folding, updated. rt-3.9.4-466-g10ff4d4

Jesse Vincent jesse at bestpractical.com
Mon Nov 22 16:10:29 EST 2010


The branch, history-folding has been updated
       via  10ff4d4b158ad7d8d38f4883388ac8fce96835ca (commit)
       via  831a6fc91d158cb182ac1e424c5ed5d55164f558 (commit)
       via  f2b4eca198371a6664ee1a6915ccf1593834a46f (commit)
       via  823b34096dc9c926b1da524c8de11bf4b4fc54eb (commit)
       via  ee87ddde15ccb4add2d207e347facd09a7a354e3 (commit)
       via  54cd684d002e1ccdf29eaae7d4bdc109144cde1b (commit)
       via  45d8319c4c0d0616c4ca5b3c117faaaf8e51823d (commit)
       via  d74c985b5e328cb88c3efca499f093d659239c23 (commit)
       via  056022aac0bf6606442c095fe72a3f77fd8ae5a5 (commit)
       via  a683d03d36cf3e13df50aa7107c68995ff1d297a (commit)
       via  591dc73757d58b460fbe0c8b443b5d0730623d3d (commit)
       via  20fb7fdb62d67c4c21f4a7de9bf7be06fc0d48df (commit)
       via  ac1d7d2a448e2a5a24a18a0fc8de2a5c7e415a5c (commit)
       via  aee21f9602588dfd85072d43b840d6c81ecc29bb (commit)
       via  427163819d48f552798b9b69f25ed22fdf001ebe (commit)
       via  b6f7262398ebed28405a8b115a4af9642699db5b (commit)
      from  884eb1cfc87b813d9973d51fc27a956b428c9a13 (commit)

Summary of changes:
 lib/RT/Interface/Web.pm                        |   12 +++++-
 sbin/rt-email-digest.in                        |    2 +-
 sbin/rt-message-catalog                        |    2 +-
 sbin/rt-server.in                              |    4 +-
 share/html/Admin/Global/Theme.html             |    2 +
 share/html/Admin/Groups/Modify.html            |   31 ++++---------
 share/html/Admin/Queues/Modify.html            |   17 ++++++-
 share/html/Admin/Users/Modify.html             |   11 +++-
 share/html/Elements/MaybeRedirectForResults    |    2 +-
 share/html/Elements/Tabs                       |    2 +-
 share/html/NoAuth/css/aileron/ticket.css       |    7 ---
 share/html/NoAuth/css/ballard/ticket.css       |    6 ---
 share/html/NoAuth/css/base/history-folding.css |   29 +++++++++++-
 share/html/NoAuth/css/web2/ticket.css          |    6 ---
 share/html/SelfService/Display.html            |    2 -
 share/html/Ticket/Create.html                  |    1 +
 share/html/Ticket/Elements/FoldStanzaJS        |    2 +-
 share/html/Ticket/Elements/ShowUpdateStatus    |    2 +-
 t/web/ticket_forward.t                         |   56 +++++++++++++++---------
 t/web/ticket_owner.t                           |   56 +++++++++++++++++++++++-
 20 files changed, 170 insertions(+), 82 deletions(-)

- Log -----------------------------------------------------------------
commit f2b4eca198371a6664ee1a6915ccf1593834a46f
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Nov 10 17:10:32 2010 -0500

    First pass at importing history folding from a client project
    
    This restores commit 656ca37bd05c055bdc9c66a97450786db33e8666 from
    3.9-trunk.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 18fab92..4631c11 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2137,7 +2137,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
 
@@ -2153,6 +2153,7 @@ Set(@JSFilesInHead, qw/
     jquery.event.hover-1.0.js
     superfish.js
     supersubs.js
+    history-folding.js
     late.js
 /);
 
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 335eef3..4fdb63d 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 );
             }
 

commit 831a6fc91d158cb182ac1e424c5ed5d55164f558
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Nov 22 16:07:47 2010 -0500

    Clean up folding of plaintext messages and colorization of message
    stanzas

diff --git a/share/html/NoAuth/css/aileron/ticket.css b/share/html/NoAuth/css/aileron/ticket.css
index fae607e..46e53f0 100644
--- a/share/html/NoAuth/css/aileron/ticket.css
+++ b/share/html/NoAuth/css/aileron/ticket.css
@@ -228,13 +228,6 @@ div#ticket-history .messagebody .messagebody{
 table.ticket-summary td.boxcontainer:first-child {
   width: 50%;
 }
-
-/* Message quoting */
-
-.message-stanza-depth-1 {
-    color: #1a1aa6;
-}
-
 div.requestor-ticket-links {
     text-align: left;
     font-size: 0.8em;
diff --git a/share/html/NoAuth/css/ballard/ticket.css b/share/html/NoAuth/css/ballard/ticket.css
index f97c541..abd93e3 100644
--- a/share/html/NoAuth/css/ballard/ticket.css
+++ b/share/html/NoAuth/css/ballard/ticket.css
@@ -229,12 +229,6 @@ table.ticket-summary td.boxcontainer:first-child {
   width: 50%;
 }
 
-/* Message quoting */
-
-.message-stanza-depth-1 {
-    color: #1a1aa6;
-}
-
 div.requestor-ticket-links {
     text-align: left;
     font-size: 0.8em;
diff --git a/share/html/NoAuth/css/base/history-folding.css b/share/html/NoAuth/css/base/history-folding.css
index 63bab97..d1f1845 100644
--- a/share/html/NoAuth/css/base/history-folding.css
+++ b/share/html/NoAuth/css/base/history-folding.css
@@ -8,7 +8,32 @@
     color: #ccc;
 }
 
-    .message-stanza-folder:before, .message-stanza-folder:after
-{
+.message-stanza-folder:before, .message-stanza-folder:after {
     content: " - ";
 }
+
+/* Message quoting */
+
+.message-stanza {
+    color: #000;
+}
+
+.message-stanza .message-stanza{
+    color: #500050;
+}
+
+.message-stanza .message-stanza .message-stanza{
+    color: #1a1aa6;
+}
+
+.message-stanza .message-stanza .message-stanza .message-stanza {
+    color: #006633;
+}
+
+.message-stanza .message-stanza .message-stanza .message-stanza .message-stanza {
+    color: #003366;
+}
+
+.message-stanza .message-stanza .message-stanza .message-stanza .message-stanza .message-stanza {
+    color: #993366;
+}
diff --git a/share/html/NoAuth/css/web2/ticket.css b/share/html/NoAuth/css/web2/ticket.css
index f97c541..abd93e3 100644
--- a/share/html/NoAuth/css/web2/ticket.css
+++ b/share/html/NoAuth/css/web2/ticket.css
@@ -229,12 +229,6 @@ table.ticket-summary td.boxcontainer:first-child {
   width: 50%;
 }
 
-/* Message quoting */
-
-.message-stanza-depth-1 {
-    color: #1a1aa6;
-}
-
 div.requestor-ticket-links {
     text-align: left;
     font-size: 0.8em;
diff --git a/share/html/Ticket/Elements/FoldStanzaJS b/share/html/Ticket/Elements/FoldStanzaJS
index 6b7f078..a1db7b3 100644
--- a/share/html/Ticket/Elements/FoldStanzaJS
+++ b/share/html/Ticket/Elements/FoldStanzaJS
@@ -3,7 +3,7 @@
     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%>>
+<div class="message-stanza" <%($Depth == 1)? 'style="display: none;" ' : ''|n%>>
 <%ARGS>
 $Depth => 0
 </%ARGS>
diff --git a/share/html/Ticket/Elements/ShowMessageStanza b/share/html/Ticket/Elements/ShowMessageStanza
index 8811d6e..f69fa62 100755
--- a/share/html/Ticket/Elements/ShowMessageStanza
+++ b/share/html/Ticket/Elements/ShowMessageStanza
@@ -78,7 +78,7 @@ if ( ref $Message ) {
     if ( @stack ) {
         ($Message, $i) = @{ pop @stack };
         $Depth--;
-        $m->out('</span>');
+        $m->out('</div>');
         goto AGAIN;
     }
 

commit 10ff4d4b158ad7d8d38f4883388ac8fce96835ca
Merge: 831a6fc 884eb1c
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Nov 22 16:10:11 2010 -0500

    Merge branch 'history-folding' of git.bestpractical.com:/git/rt into history-folding
    
    * 'history-folding' of git.bestpractical.com:/git/rt:
      First pass at importing history folding from a client project
    
    Conflicts:
    	share/html/NoAuth/css/base/history-folding.css
    	share/html/Ticket/Elements/FoldStanzaJS


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


More information about the Rt-commit mailing list