import rt 3.0.12
[freeside.git] / rt / html / Ticket / Elements / ShowHistory
1 %# BEGIN LICENSE BLOCK
2 %# 
3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
4 %# 
5 %# (Except where explictly superceded by other copyright notices)
6 %# 
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
10 %# from www.gnu.org.
11 %# 
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 %# General Public License for more details.
16 %# 
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
21 %# 
22 %# 
23 %# END LICENSE BLOCK
24 <%perl>
25  if ($ShowDisplayModes or $ShowTitle) {
26 my $title;
27 my $titleright;
28 if ($ShowTitle) {
29     $title = loc('History');
30 }
31 else {
32     $title = '&nbsp;';
33 }
34 $titleright = loc('Display mode') . ":";
35 if ($ShowHeaders &&  $ShowHeaders == $Ticket->Id ) {
36     $titleright .= "[<A HREF=\"" . $URIFile . "?id="
37       . $Ticket->id . "\">"
38       . loc("Brief headers")
39       . "</a>] <b>["
40       . loc("Full headers") . "]</b>";
41 }
42 else {
43     $titleright .= "<b>["
44       . loc("Brief headers")
45       . "]</b> [<A HREF=\""
46       . $URIFile
47       . "?ShowHeaders="
48       . $Ticket->Id . "&id="
49       . $Ticket->id . "\">"
50       . loc("Full headers") . "</a>]";
51 }
52 </%perl>
53 <& /Elements/TitleBoxStart, title => $title, titleright => $titleright, bodyclass=> ''&>
54 % }
55
56 <TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=2 BORDER=0>
57 <%perl>
58 my @attachments = @{$Attachments->ItemsArrayRef()};
59 my @attachment_content = @{$AttachmentContent->ItemsArrayRef()};
60
61
62
63
64
65 while ( my $Transaction = $Transactions->Next ) {
66     my $skip = 0;
67     $m->comp( '/Elements/Callback',
68               _CallbackName => 'SkipTransaction',
69               Transaction   => $Transaction,
70               skip          => \$skip,
71               %ARGS );
72     next if $skip;
73     $i++;
74
75     $m->out('<a name="lasttrans"></a>') if ( $Transactions->IsLast );
76
77     my @trans_attachments = grep { $_->TransactionId == $Transaction->Id } @attachments;
78
79     my $trans_content = {};
80     grep { ($_->TransactionId == $Transaction->Id ) && ($trans_content->{$_->Id} = $_)  } @attachment_content;
81
82    
83     #Args is first because we're clobbering the "Attachments" parameter 
84     $m->comp( 'ShowTransaction',
85             %ARGS,
86
87               AttachPath          => $AttachPath,
88               UpdatePath           => $UpdatePath,
89               Ticket               => $Ticket,
90               Transaction          => $Transaction,
91               ShowHeaders          => $ShowHeaders,
92               Collapsed            => $Collapsed,
93               RowNum               => $i,
94               ShowTitleBarCommands => $ShowTitleBarCommands,
95               Attachments          => \@trans_attachments,
96               AttachmentContent    => $trans_content
97  );
98 }
99
100 </%perl>
101 </TABLE>
102 % if ($ShowDisplayModes or $ShowTitle) {
103 <& /Elements/TitleBoxEnd &>
104 % }
105 <%INIT>
106
107 my $Transactions = $Ticket->Transactions;
108 my $i;
109
110
111 $Attachments ||=  $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket);
112 $AttachmentContent ||= $m->comp('/Ticket/Elements/LoadTextAttachments', Ticket => $Ticket);
113
114
115
116 </%INIT>
117 <%ARGS>
118 $URIFile => $RT::WebPath."/Ticket/Display.html"
119 $Ticket => undef
120 $Attachments => undef
121 $AttachmentContent => undef
122 $ShowHeaders => undef
123 $Collapsed => undef
124 $ShowTitle => 1
125 $ShowDisplayModes => 1
126 $ShowTitleBarCommands => 1
127 $AttachPath => $RT::WebPath."/Ticket/Attachment"
128 $UpdatePath => $RT::WebPath."/Ticket/Update.html"
129
130 </%ARGS>