1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
6 %# <sales@bestpractical.com>
8 %# (Except where explicitly superseded by other copyright notices)
13 %# This work is made available to you under the terms of Version 2 of
14 %# the GNU General Public License. A copy of that license should have
15 %# been provided with this software, but in any event can be snarfed
18 %# This work is distributed in the hope that it will be useful, but
19 %# WITHOUT ANY WARRANTY; without even the implied warranty of
20 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 %# General Public License for more details.
23 %# You should have received a copy of the GNU General Public License
24 %# along with this program; if not, write to the Free Software
25 %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 %# 02110-1301 or visit their web page on the internet at
27 %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
30 %# CONTRIBUTION SUBMISSION POLICY:
32 %# (The following paragraph is not intended to limit the rights granted
33 %# to you to modify and distribute this software under the terms of
34 %# the GNU General Public License and is only of importance to you if
35 %# you choose to contribute your changes and enhancements to the
36 %# community by submitting them to Best Practical Solutions, LLC.)
38 %# By intentionally submitting any modifications, corrections or
39 %# derivatives to this work, or any other work intended for use with
40 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 %# you are the copyright holder for those contributions and you grant
42 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43 %# royalty-free, perpetual, license to use, copy, create derivative
44 %# works based on those contributions, and sublicense and distribute
45 %# those contributions and any derivatives thereof.
47 %# END BPS TAGGED BLOCK }}}
48 <div class="<% join ' ', @classes %>">
49 <div class="metadata">
51 <a name="txn-<% $Transaction->id %>" \
52 % if ( $DisplayPath ) {
53 href="<% $DisplayPath %>?id=<% $Object->id %>#txn-<% $Transaction->id %>" \
57 % $m->callback( %ARGS, Transaction => $Transaction, CallbackName => 'AfterAnchor' );
58 <span class="date"><% $date |n %></span>
59 <span class="description">
60 <& /Elements/ShowUser, User => $Transaction->CreatorObj &> - <% $desc |n %>
61 % $m->callback( %ARGS, Transaction => $Transaction, CallbackName => 'AfterDescription' );
63 <span class="time-taken"><% $time %></span>
65 <span class="actions"><% $actions |n %></span>
71 if ( $Transaction->CustomFieldValues->Count ) {
72 $m->comp('/Elements/ShowCustomFields', Object => $Transaction );
75 'ShowTransactionAttachments',
81 % $m->callback( %ARGS, Transaction => $Transaction, CallbackName => 'AfterContent' );
86 $Object => $Transaction->Object
89 $AttachmentContent => undef
96 $AttachmentPath => undef
99 $EncryptionPath => undef
100 $EmailRecordPath => undef
107 my $record_type = $Object->RecordType;
108 my $type_class = $Object->ClassifyTransaction( $Transaction );
111 CallbackName => 'MassageTypeClass',
112 Transaction => $Transaction,
113 TypeClassRef => \$type_class,
119 "$record_type-transaction",
121 ($RowNum % 2 ? 'odd' : 'even')
124 my $desc = $Transaction->BriefDescriptionAsHTML;
125 if ( $Object->id != $Transaction->ObjectId ) {
128 $m->interp->apply_escapes(
129 loc("[_1] #[_2]:", loc($record_type), $Transaction->ObjectId), 'h'),
133 my $date = $Transaction->CreatedAsString;
136 $time = loc('[quant,_1,min,min]', $Transaction->TimeTaken)
137 if $Transaction->TimeTaken;
139 if ( $ShowBody && !$Attachments ) {
140 $ARGS{'Attachments'} = $Attachments = {};
142 my $attachments = $Transaction->Attachments( WithHeaders => 1 );
143 push @{ $Attachments->{ $_->Parent || 0 } ||= [] }, $_
144 foreach @{ $attachments->ItemsArrayRef };
148 if ( $ShowActions ) {
149 my $txn_type = $Transaction->Type;
150 if ( $txn_type =~ /EmailRecord$/ ) {
152 title => loc('Show'),
154 path => $EmailRecordPath
156 .'&Transaction='. $Transaction->id
157 .'&Attachment='. ( $Attachments->{0}[0] && $Attachments->{0}[0]->id ),
158 } if $EmailRecordPath;
163 # If the transaction has anything attached to it at all
164 elsif ( %$Attachments ) {
165 my %has_right = map {
166 $_ => RT::ACE->CanonicalizeRightName( $_ . $record_type )
167 } qw(Modify CommentOn ReplyTo);
168 $has_right{'Forward'} = RT::ACE->CanonicalizeRightName('ForwardMessage');
170 my $can_modify = $has_right{'Modify'}
171 && $Object->CurrentUserHasRight( $has_right{'Modify'} );
173 if ( $UpdatePath && $has_right{'ReplyTo'}
175 || $Object->CurrentUserHasRight( $has_right{'ReplyTo'} )
179 class => "reply-link",
180 title => loc('Reply'),
183 .'&QuoteTransaction='. $Transaction->id
188 if ( $UpdatePath && $has_right{'CommentOn'}
190 || $Object->CurrentUserHasRight( $has_right{'CommentOn'} )
194 class => "comment-link",
195 title => loc('Comment'),
198 .'&QuoteTransaction='. $Transaction->id
203 if ( $ForwardPath && $has_right{'Forward'}
204 && $Object->CurrentUserHasRight( $has_right{'Forward'} )
207 class => "forward-link",
208 title => loc('Forward'),
211 .'&QuoteTransaction='. $Transaction->id
215 if ( $EncryptionPath && $can_modify
216 && RT->Config->Get('Crypt')->{'Enable'}
217 && RT->Config->Get('Crypt')->{'AllowEncryptDataInDB'}
220 class => "encryption-link",
221 title => loc('Encrypt/Decrypt'),
222 path => $EncryptionPath
223 .'?id='. $Transaction->id
224 .'&QuoteTransaction='. $Transaction->id
233 Transaction => $Transaction,
236 Classes => \@classes,
237 Actions => \@actions,
240 Description => \$desc,
247 foreach my $a ( @actions ) {
249 .' href="'. $i->apply_escapes( $a->{'path'}, 'h' ) .'"'
251 ? ' target="'. $i->apply_escapes( $a->{'target'}, 'h' ) .'"'
255 ? ' class="'. $i->apply_escapes( $a->{'class'}, 'h' ) .'"'
258 .'>'. $i->apply_escapes( $a->{'title'}, 'h' ) .'</a>'
261 $actions = join ' ', map "[$_]", @actions;
264 # make date unbreakable
265 $date = $m->interp->apply_escapes( $date, 'h' );
266 $date =~ s/\s/ /g;