3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 %# (Except where explictly superceded by other copyright notices)
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
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.
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.
24 <TR class="<% $RowNum%2 ? 'oddline' : 'evenline'%>" >
25 <TD bgcolor="<%$bgcolor%>"><A NAME="txn-<%$Transaction->Id%>" href="#txn-<%$Transaction->Id%>">#</A> </TD>
27 <TD><font size=-2><% $transdate|n %></font> </TD>
28 % my $desc = $Transaction->BriefDescription;
29 % $m->comp('/Elements/Callback', _CallbackName => 'ModifyDisplay', text => \$desc, Transaction => $Transaction, %ARGS);
30 <TD ALIGN="LEFT"><b><%$Transaction->CreatorObj->Name%> - <%$TicketString%> <%$desc%>
33 <TD><%$TimeTaken%> </TD>
34 <TD ALIGN="RIGHT"><font size=-1><%$titlebar_commands|n%></font></TD>
39 foreach my $message (@$Attachments) {
41 my ($headers, $quoted);
42 if ($ShowHeaders && ($ShowHeaders == $Ticket->Id)) {
43 $headers = $message->Headers;
45 $headers = $message->NiceHeaders;
49 # localize the common headers (like 'Subject:'), too.
50 eval {$headers =~ s/^([^:]+)(?=:)/loc($1)/em; } # we eval here to catch errors when 5.6 panics
54 my $MAX_INLINE_BODY = $RT::MaxInlineBody || 13456;
55 if ( $message->ContentType =~ m{^(text/plain|message|text$)}i
56 && $message->ContentLength < $MAX_INLINE_BODY ) {
59 # If we've preloaded all the content, let's pull from there
60 # if we haven't, load it now
61 if ($AttachmentContent->{$message->id}) {
62 $content = $AttachmentContent->{$message->id}->Content;
64 $content = $message->Content;
71 $quoted = Text::Quoted::extract( $content );
79 <TR class="<% $RowNum%2 ? 'oddline' : 'evenline'%>" >
80 <TD BGCOLOR="<%$bgcolor%>"> </TD>
82 <TD COLSPAN=3 VALIGN=TOP>
83 <span class="message">
85 <& ShowMessageHeaders, Headers => $headers, Transaction => $Transaction &>
87 % if ($message->ContentLength && !length($quoted) && $message->ContentType =~ m#^text/#) {
88 <blockquote><i><&|/l&>Message body not shown because it is too large or is not plain text.</&><br>
89 <&|/l&>You can access it with the Download button on the right.</&></i></blockquote>
91 <& ShowMessageStanza, Depth => 0, Message => $quoted, Transaction => $Transaction &>
95 <TD VALIGN=TOP ALIGN=RIGHT>
97 % if ($message->Parent == 0 ) {
101 my $size = $message->ContentLength or next;
105 $size = loc("[_1]k", int($size/102.4)/10);
108 $size = loc("[_1]b", $size);
111 <font size=-1><A HREF="<%$AttachPath%>/<%$Transaction->Id%>/<%$message->Id%>/<%$message->Filename | u%>"><&|/l&>Download</&> <% $message->Filename|| loc('(untitled)') %></a> <% $size %></font>
122 $Transaction => undef
125 $ShowTitleBarCommands => 1
127 $AttachPath => $RT::WebPath."/Ticket/Attachment"
128 $UpdatePath => $RT::WebPath."/Ticket/Update.html"
129 $Attachments => undef
130 $AttachmentContent => undef
136 my ($TimeTaken, $TicketString, $bgcolor);
138 my $transdate = $Transaction->CreatedAsString();
139 $transdate =~ s/\s/ /g;
141 if ($Transaction->Type =~ /^(Create|Correspond|Comment$)/) {
143 } elsif (($Transaction->Field =~ /^Owner$/) or
144 ($Transaction->Type =~ /^(AddWatcher|DelWatcher)$/)) {
147 } elsif ($Transaction->Type =~ /^(AddLink|DeleteLink)$/) {
149 } elsif ($Transaction->Type =~ /^(Status|Set|Told)$/) {
150 if ($Transaction->Field =~ /^(Told|Starts|Started|Due)$/) {
161 if ($Ticket->Id != $Transaction->Ticket) {
162 $TicketString = "Ticket ".$Transaction->Ticket .": ";
165 if ($Transaction->TimeTaken != 0) {
166 $TimeTaken = $Transaction->TimeTaken." min"
169 unless ($Attachments) {
170 my $attachments = $Transaction->Attachments;
171 $attachments->Columns( qw( Id Filename ContentType Headers Subject Parent ContentEncoding ContentType TransactionId) );
172 $Attachments = $attachments->ItemsArrayRef();
176 my $titlebar_commands=' ';
178 # If the transaction has anything attached to it at all
179 if ($Attachments->[0] && $ShowTitleBarCommands) {
180 if ($Ticket->CurrentUserHasRight('ReplyToTicket')) {
181 $titlebar_commands .=
182 "[<a href=\"".$UpdatePath."?id=".
183 $Transaction->Ticket . "&QuoteTransaction=".$Transaction->Id.
184 "&Action=Respond\">". loc('Reply') ."</a>] ";
186 if ($Ticket->CurrentUserHasRight('CommentOnTicket')) {
187 $titlebar_commands .=
188 "[<a href=\"".$UpdatePath."?id=".$Transaction->Ticket.
189 "&QuoteTransaction=".$Transaction->Id.
190 "&Action=Comment\">". loc('Comment') ."</a>]";