1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2016 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 $m->comp('/Elements/ShowCustomFields', Object => $Transaction, HideEmpty => 1 ) if $HasTxnCFs;
73 'ShowTransactionAttachments',
79 % $m->callback( %ARGS, Transaction => $Transaction, CallbackName => 'AfterContent' );
84 $Object => $Transaction->Object
87 $AttachmentContent => undef
95 $AttachmentPath => undef
98 $EncryptionPath => undef
99 $EmailRecordPath => undef
106 my $record_type = $Object->RecordType;
107 my $type_class = $Object->ClassifyTransaction( $Transaction );
110 CallbackName => 'MassageTypeClass',
111 Transaction => $Transaction,
112 TypeClassRef => \$type_class,
118 "$record_type-transaction",
120 ($RowNum % 2 ? 'odd' : 'even')
123 my $desc = $Transaction->BriefDescriptionAsHTML;
124 if ( $Object->id != $Transaction->ObjectId ) {
127 $m->interp->apply_escapes(
128 loc("[_1] #[_2]:", loc($record_type), $Transaction->ObjectId), 'h'),
132 my $date = $Transaction->CreatedAsString;
135 $time = loc('[quant,_1,minute,minutes]', $Transaction->TimeTaken)
136 if $Transaction->TimeTaken;
138 if ( $ShowBody && !$Attachments ) {
139 $ARGS{'Attachments'} = $Attachments = {};
141 my $attachments = $Transaction->Attachments( WithHeaders => 1 );
142 push @{ $Attachments->{ $_->Parent || 0 } ||= [] }, $_
143 foreach @{ $attachments->ItemsArrayRef };
147 my $txn_type = $Transaction->Type;
148 if ( $txn_type =~ /EmailRecord$/ ) {
150 title => loc('Show'),
152 path => $EmailRecordPath
154 .'&Transaction='. $Transaction->id
155 .'&Attachment='. ( $Attachments->{0}[0] && $Attachments->{0}[0]->id ),
156 } if $EmailRecordPath;
161 # If the transaction has anything attached to it at all
162 elsif ( %$Attachments && $ShowActions ) {
163 my %has_right = map {
164 $_ => RT::ACE->CanonicalizeRightName( $_ . $record_type )
165 } qw(Modify CommentOn ReplyTo);
166 $has_right{'Forward'} = RT::ACE->CanonicalizeRightName('ForwardMessage');
168 my $can_modify = $has_right{'Modify'}
169 && $Object->CurrentUserHasRight( $has_right{'Modify'} );
171 if ( $UpdatePath && $has_right{'ReplyTo'}
173 || $Object->CurrentUserHasRight( $has_right{'ReplyTo'} )
177 class => "reply-link",
178 title => loc('Reply'),
181 .'&QuoteTransaction='. $Transaction->id
186 if ( $UpdatePath && $has_right{'CommentOn'}
188 || $Object->CurrentUserHasRight( $has_right{'CommentOn'} )
192 class => "comment-link",
193 title => loc('Comment'),
196 .'&QuoteTransaction='. $Transaction->id
201 if ( $ForwardPath && $has_right{'Forward'}
202 && $Object->CurrentUserHasRight( $has_right{'Forward'} )
205 class => "forward-link",
206 title => loc('Forward'),
209 .'&QuoteTransaction='. $Transaction->id
213 if ( $EncryptionPath && $can_modify
214 && RT->Config->Get('Crypt')->{'Enable'}
215 && RT->Config->Get('Crypt')->{'AllowEncryptDataInDB'}
218 class => "encryption-link",
219 title => loc('Encrypt/Decrypt'),
220 path => $EncryptionPath
221 .'?id='. $Transaction->id
222 .'&QuoteTransaction='. $Transaction->id
230 Transaction => $Transaction,
233 Classes => \@classes,
234 Actions => \@actions,
237 Description => \$desc,
238 ShowBody => \$ShowBody,
245 foreach my $a ( @actions ) {
247 .' href="'. $i->apply_escapes( $a->{'path'}, 'h' ) .'"'
249 ? ' target="'. $i->apply_escapes( $a->{'target'}, 'h' ) .'"'
253 ? ' class="'. $i->apply_escapes( $a->{'class'}, 'h' ) .'"'
256 .'>'. $i->apply_escapes( $a->{'title'}, 'h' ) .'</a>'
259 $actions = join ' ', map "[$_]", @actions;
262 # make date unbreakable
263 $date = $m->interp->apply_escapes( $date, 'h' );
264 $date =~ s/\s/ /g;