import rt 3.0.12
[freeside.git] / rt / html / Ticket / Elements / ShowHistory
index 194be9b..c4fe417 100644 (file)
@@ -54,16 +54,50 @@ else {
 % }
 
 <TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=2 BORDER=0>
-% while (my $Transaction = $Transactions->Next) {
-% my $skip = 0;
-% $m->comp('/Elements/Callback', _CallbackName => 'SkipTransaction', Transaction => $Transaction, skip => \$skip, %ARGS);
-% next if $skip;
-% $i++;
-%      if ($Transactions->IsLast) {
-       <a name="lasttrans"></a>
-%      }
-           <& ShowTransaction, Ticket => $Ticket, Transaction => $Transaction, ShowHeaders => $ShowHeaders, Collapsed => $Collapsed, RowNum => $i, ShowTitleBarCommands => $ShowTitleBarCommands, %ARGS &>
-% }
+<%perl>
+my @attachments = @{$Attachments->ItemsArrayRef()};
+my @attachment_content = @{$AttachmentContent->ItemsArrayRef()};
+
+
+
+
+
+while ( my $Transaction = $Transactions->Next ) {
+    my $skip = 0;
+    $m->comp( '/Elements/Callback',
+              _CallbackName => 'SkipTransaction',
+              Transaction   => $Transaction,
+              skip          => \$skip,
+              %ARGS );
+    next if $skip;
+    $i++;
+
+    $m->out('<a name="lasttrans"></a>') if ( $Transactions->IsLast );
+
+    my @trans_attachments = grep { $_->TransactionId == $Transaction->Id } @attachments;
+
+    my $trans_content = {};
+    grep { ($_->TransactionId == $Transaction->Id ) && ($trans_content->{$_->Id} = $_)  } @attachment_content;
+
+   
+    #Args is first because we're clobbering the "Attachments" parameter 
+    $m->comp( 'ShowTransaction',
+            %ARGS,
+
+             AttachPath          => $AttachPath,
+             UpdatePath           => $UpdatePath,
+              Ticket               => $Ticket,
+              Transaction          => $Transaction,
+              ShowHeaders          => $ShowHeaders,
+              Collapsed            => $Collapsed,
+              RowNum               => $i,
+              ShowTitleBarCommands => $ShowTitleBarCommands,
+              Attachments          => \@trans_attachments,
+              AttachmentContent    => $trans_content
+ );
+}
+
+</%perl>
 </TABLE>
 % if ($ShowDisplayModes or $ShowTitle) {
 <& /Elements/TitleBoxEnd &>
@@ -74,13 +108,23 @@ my $Transactions = $Ticket->Transactions;
 my $i;
 
 
+$Attachments ||=  $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket);
+$AttachmentContent ||= $m->comp('/Ticket/Elements/LoadTextAttachments', Ticket => $Ticket);
+
+
+
 </%INIT>
 <%ARGS>
-$URIFile => 'Display.html'
+$URIFile => $RT::WebPath."/Ticket/Display.html"
 $Ticket => undef
+$Attachments => undef
+$AttachmentContent => undef
 $ShowHeaders => undef
 $Collapsed => undef
 $ShowTitle => 1
 $ShowDisplayModes => 1
 $ShowTitleBarCommands => 1
+$AttachPath => $RT::WebPath."/Ticket/Attachment"
+$UpdatePath => $RT::WebPath."/Ticket/Update.html"
+
 </%ARGS>