[Rt-commit] rt branch, history-folding, created. rt-3.9.4-451-g8ef6bc5
Alex Vandiver
alexmv at bestpractical.com
Mon Nov 22 17:27:13 EST 2010
The branch, history-folding has been created
at 8ef6bc59fd5e717401418bf9322e6d16659de3f9 (commit)
- Log -----------------------------------------------------------------
commit 884eb1cfc87b813d9973d51fc27a956b428c9a13
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 8ef6bc59fd5e717401418bf9322e6d16659de3f9
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;
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list