[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-449-gea4c11c

Thomas Sibley trs at bestpractical.com
Wed Nov 10 17:08:01 EST 2010


The branch, 3.9-trunk has been updated
       via  ea4c11ca9fdb92687d0e409191b1d31a0535f047 (commit)
      from  aafceca9b93263a2d79eff4c9b38a8a88004af90 (commit)

Summary of changes:
 etc/RT_Config.pm.in                                |    3 +-
 sbin/rt-test-dependencies.in                       |    1 -
 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 +++----------
 10 files changed, 14 insertions(+), 141 deletions(-)
 delete mode 100644 share/html/NoAuth/css/base/history-folding.css
 delete mode 100644 share/html/NoAuth/js/history-folding.js
 delete mode 100644 share/html/Ticket/Elements/FoldStanzaJS
 delete mode 100644 share/html/Ticket/Elements/ShowHTMLMessageStanza

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

    Revert "Import history folding from a client project, somewhat retooled"
    
    This reverts commit 656ca37bd05c055bdc9c66a97450786db33e8666.
    
    Conflicts:
    
    	etc/RT_Config.pm.in
    
    The original commit broke the HTML of the page by leaving <div>s
    unclosed.  It also failed to take into account the message formatting
    options PlainTextPre and PlainTextMono.
    
    We want the history folding functionality, but it needs to work
    correctly first.  I'm moving it out to a branch for now where it can get
    fixed up.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 4631c11..18fab92 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 history-folding.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/);
 
 =cut
 
@@ -2153,7 +2153,6 @@ 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 4fdb63d..335eef3 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -180,7 +180,6 @@ 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
deleted file mode 100644
index 63bab97..0000000
--- a/share/html/NoAuth/css/base/history-folding.css
+++ /dev/null
@@ -1,14 +0,0 @@
-.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 1d833cc..7bd5ac8 100644
--- a/share/html/NoAuth/css/base/main.css
+++ b/share/html/NoAuth/css/base/main.css
@@ -64,7 +64,6 @@
 @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
deleted file mode 100644
index 96a7929..0000000
--- a/share/html/NoAuth/js/history-folding.js
+++ /dev/null
@@ -1,14 +0,0 @@
-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
deleted file mode 100644
index 6b7f078..0000000
--- a/share/html/Ticket/Elements/FoldStanzaJS
+++ /dev/null
@@ -1,9 +0,0 @@
-% 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
deleted file mode 100644
index 1824343..0000000
--- a/share/html/Ticket/Elements/ShowHTMLMessageStanza
+++ /dev/null
@@ -1,57 +0,0 @@
-<%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 a14dba8..1af57a8 100755
--- a/share/html/Ticket/Elements/ShowHistory
+++ b/share/html/Ticket/Elements/ShowHistory
@@ -77,13 +77,6 @@ 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 8811d6e..7331ba6 100755
--- a/share/html/Ticket/Elements/ShowMessageStanza
+++ b/share/html/Ticket/Elements/ShowMessageStanza
@@ -47,7 +47,9 @@
 %# END BPS TAGGED BLOCK }}}
 <%perl>
 if ( ref $Message ) {
-    $m->comp('FoldStanzaJS', Depth => $Depth);
+    $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{">} );
+
 
     my @stack;
     my $para = '';
@@ -56,9 +58,6 @@ 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";
@@ -68,8 +67,7 @@ if ( ref $Message ) {
         $Depth++;
         push @stack, [$Message, $i+1];
         ($Message, $i) = ($stanza, -1);
-
-        $m->comp('FoldStanzaJS', Depth => $Depth);
+        $m->out( qq{<div class="message-stanza-depth-$Depth">} );
     }
     if ( length $para ) {
         $print_content->( \$para ); $para = '';
@@ -78,7 +76,7 @@ if ( ref $Message ) {
     if ( @stack ) {
         ($Message, $i) = @{ pop @stack };
         $Depth--;
-        $m->out('</span>');
+        $m->out('</div>');
         goto AGAIN;
     }
 
diff --git a/share/html/Ticket/Elements/ShowTransactionAttachments b/share/html/Ticket/Elements/ShowTransactionAttachments
index 3c084f9..c49d328 100644
--- a/share/html/Ticket/Elements/ShowTransactionAttachments
+++ b/share/html/Ticket/Elements/ShowTransactionAttachments
@@ -184,7 +184,8 @@ my $render_attachment = sub {
                     && ( $message->ContentType !~ m{^text/(?:html|enriched)$} )
                 )
             )
-        ) {
+          )
+        {
 
             my $content;
             # If we've cached the content, use it from there
@@ -195,36 +196,14 @@ 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 ( $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' ) {
+            if ( $message->ContentType =~ m{^text/(?:html|enriched)$}i ) {
                 $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