[Rt-commit] r6320 - in rtir/branches/2.1-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Fri Oct 27 01:42:03 EDT 2006


Author: ruz
Date: Fri Oct 27 01:42:01 2006
New Revision: 6320

Modified:
   rtir/branches/2.1-EXPERIMENTAL/   (props changed)
   rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Elements/TransactionData

Log:
 r1785 at cubic-pc:  cubic | 2006-10-27 09:50:07 +0400
 * switch to Transaction->Content* methods to get txns' data


Modified: rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Elements/TransactionData
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Elements/TransactionData	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Elements/TransactionData	Fri Oct 27 01:42:01 2006
@@ -22,53 +22,26 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-<%PERL>
+<%INIT>
+my %Include = map { lc( $_ ) => 1 } grep $_, @Include;
+
 while ( my $Transaction = $Transactions->Next ) {
     my $type = $Transaction->Type;
     next if keys %Include && !$Include{ lc $type };
-    next if ( $type eq 'CustomField' and substr($Transaction->BriefDescription, 0, 6) eq '_RTIR_');
-
-    # BUG: If original ticket has a file attachment in create transaction
-    # we return empty content
-
-    my $attachments = $Transaction->Attachments;
-    my ($headers, $content);
-    while ( my $message = $attachments->Next ) {
-        #we don't want to show any empty transactions, unless they have kids
-        next unless ($message->Content || $message->Children->Count);
+    next if $type eq 'CustomField' and substr($Transaction->BriefDescription, 0, 6) eq '_RTIR_';
+    next unless my $ContentObj = $Transaction->ContentObj;
 
-        if ($ShowHeaders && $message->Parent == 0) {
-            $headers = $message->NiceHeaders;
-            chomp $headers;
-            if ($headers) {
-                # localize the common headers (like 'Subject:'), too.
-                eval {$headers =~ s/^([^:]+)(?=:)/loc($1)/em; } # we eval here to catch errors when 5.6 panics
-            }
-        }
-
-        my $inline = RT->Config->Get( 'MaxInlineBody', $session{'CurrentUser'} );
-        if ($message->ContentType =~ m{^(text/plain|message|text$)}i and 
-            (!$inline or length($message->Content) < $inline) ) {
-            $content = $message->Content;
-        } else {
-            $content = "";
-        }
+    if ( $ShowHeaders ) {
+        my $headers = $ContentObj->Parent?
+            $ContentObj->ParentObj->NiceHeaders:
+            $ContentObj->NiceHeaders;
+        # localize the common headers (like 'Subject:')
+        $headers =~ s/^(?![ \t])([^:]+)(?=:)/loc($1)/em;
+        $m->print( $headers );
     }
 
-    # quote the included text
-    if ( $QuoteText ) {
-        s/^/> /mg foreach ($headers, $content);
-    }
-</%PERL>
-%   if ($headers) {
-<%      $headers %>
-%   }
-%   if ($content) {
-<%      $content |n %>
-%   }
-% }
-<%INIT>
-my %Include = map { lc( $_ ) => 1 } grep $_, @Include;
+    $m->print( $Transaction->Content( Quote => $QuoteText ) );
+}
 </%INIT>
 <%ARGS>
 $Transactions => undef


More information about the Rt-commit mailing list