1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2015 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 }}}
58 my $LinkCallback = sub {
61 my $mode = $RT::Link::TYPEMAP{$method}{Mode};
62 my $type = $RT::Link::TYPEMAP{$method}{Type};
63 my $other_mode = ($mode eq "Target" ? "Base" : "Target");
64 my $mode_uri = $mode.'URI';
67 my $ObjectType = $_[2]||'';
70 $_->$mode_uri->AsHREF,
72 ( $_->$mode_uri->AsString ),
74 } # if someone says __RefersTo.{Ticket}__ filter for only local links that are tickets
76 ? ( $_->$mode_uri->IsLocal
77 && ( $_->$mode_uri->Object->RecordType eq $ObjectType ))
80 @{ $_[0]->Links($other_mode,$type)->ItemsArrayRef }
86 my %key = RT::Crypt->GetKeyInfo( Key => $user->EmailAddress );
87 if (!defined $key{'info'}) {
88 return $m->interp->apply_escapes(' ' . loc("(no pubkey!)"), "h");
89 } elsif ($key{'info'}{'TrustLevel'} == 0) {
90 return $m->interp->apply_escapes(' ' . loc("(untrusted!)"), "h");
97 title => 'Queue id', # loc
98 value => sub { return $_[0]->Queue }
101 attribute => 'Queue',
102 title => 'Queue', # loc
103 value => sub { return $_[0]->QueueObj->Name }
106 title => 'Owner', # loc
107 attribute => 'Owner',
108 value => sub { return $_[0]->OwnerObj->Name }
111 title => 'Status', # loc
112 attribute => 'Status',
113 value => sub { return loc($_[0]->Status) }
116 title => 'Subject', # loc
117 attribute => 'Subject',
118 value => sub { return $_[0]->Subject || "(" . loc('No subject') . ")" }
121 title => 'Status', # loc
122 attribute => 'Status',
126 if ( my $count = $Ticket->HasUnresolvedDependencies ) {
127 if ( $Ticket->HasUnresolvedDependencies( Type => 'approval' )
128 or $Ticket->HasUnresolvedDependencies( Type => 'code' ) )
130 return \'<em>', loc('(pending approval)'), \'</em>';
133 my $Query = "DependedOnBy = " . $Ticket->id;
134 $Query .= " AND (" . join(" OR ", map { "Status = '$_'" } RT::Queue->ActiveStatusArray) . ")";
136 my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query);
138 return \'<a href="',$SearchURL,\'">', loc('(pending [quant,_1,other ticket,other tickets])',$count), \'</a>';
142 return loc( $Ticket->Status );
148 title => 'Priority', # loc
149 attribute => 'Priority',
150 value => sub { return $_[0]->Priority }
153 title => 'InitialPriority', # loc
154 attribute => 'InitialPriority',
155 name => 'Initial Priority',
156 value => sub { return $_[0]->InitialPriority }
159 title => 'FinalPriority', # loc
160 attribute => 'FinalPriority',
161 name => 'Final Priority',
162 value => sub { return $_[0]->FinalPriority }
165 title => 'EffectiveId', # loc
166 attribute => 'EffectiveId',
167 value => sub { return $_[0]->EffectiveId }
170 title => 'Type', # loc
172 value => sub { return $_[0]->Type }
175 attribute => 'TimeWorked',
176 title => 'Time Worked', # loc
177 value => sub { return $_[0]->TimeWorked }
180 attribute => 'TimeLeft',
181 title => 'Time Left', # loc
182 value => sub { return $_[0]->TimeLeftAsString }
185 attribute => 'TimeEstimated',
186 title => 'Time Estimated', # loc
187 value => sub { return $_[0]->TimeEstimated }
190 title => 'Starts', # loc
191 attribute => 'Starts',
192 value => sub { return $_[0]->StartsObj->AgeAsString }
195 title => 'Started', # loc
196 attribute => 'Started',
197 value => sub { return $_[0]->StartedObj->AgeAsString }
200 title => 'Told', # loc
202 value => sub { return $_[0]->ToldObj->AgeAsString }
205 title => 'Due', # loc
208 my $date = $_[0]->DueObj;
209 # Highlight the date if it was due in the past, and it's still active
210 if ( $date && $date->IsSet && $date->Diff < 0 && $_[0]->QueueObj->IsActiveStatus($_[0]->Status)) {
211 return (\'<span class="overdue">' , $date->AgeAsString , \'</span>');
213 return $date->AgeAsString;
217 WillResolveRelative => {
218 title => 'Will Resolve',
219 attribute => 'WillResolve',
220 value => sub { return $_[0]->WillResolveObj->AgeAsString },
222 ResolvedRelative => {
223 title => 'Resolved', # loc
224 attribute => 'Resolved',
225 value => sub { return $_[0]->ResolvedObj->AgeAsString }
228 title => 'Starts', # loc
229 attribute => 'Starts',
230 value => sub { return $_[0]->StartsObj }
233 title => 'Started', # loc
234 attribute => 'Started',
235 value => sub { return $_[0]->StartedObj },
238 title => 'Told', # loc
240 value => sub { return $_[0]->ToldObj },
243 title => 'Due', # loc
245 value => sub { return $_[0]->DueObj },
248 title => 'Will Resolve',
249 attribute => 'WillResolve',
250 value => sub { return $_[0]->WillResolveObj },
253 title => 'Resolved', # loc
254 attribute => 'Resolved',
255 value => sub { return $_[0]->ResolvedObj }
258 title => 'New messages', # loc
260 my $txn = $_[0]->SeenUpTo or return $_[0]->loc('No');
261 return \('<a href="'. RT->Config->Get('WebPath') .'/Ticket/Display.html?id='
262 . $_[0]->id .'#txn-'. $txn->id .'">'),
263 $_[0]->loc('New'), \'</a>';
267 title => 'Requestors', # loc
268 attribute => 'Requestor.EmailAddress',
269 value => sub { return \($m->scomp("/Elements/ShowPrincipal", Object => $_[0]->Requestor, PostUser => $trustSub ) ) }
272 title => 'Owner', # loc
273 attribute => 'Owner',
276 my $name = $t->OwnerObj->Name;
277 my %key = RT::Crypt->GetKeyInfo( Key => $t->OwnerObj->EmailAddress );
278 if (!defined $key{'info'}) {
279 $name .= ' '. loc("(no pubkey!)");
281 elsif ($key{'info'}{'TrustLevel'} == 0) {
282 $name .= ' '. loc("(untrusted!)");
289 title => 'Owner', # loc
290 attribute => 'Owner',
291 value => sub { return \($m->scomp("/Elements/ShowPrincipal", Object => $_[0]->OwnerObj, PostUser => $trustSub ) ) }
294 # Everything from LINKTYPEMAP
296 $_ => { value => $LinkCallback->( $_ ) }
297 } keys %RT::Link::TYPEMAP),
300 value => sub { return $_[1] % 2 ? 'oddline' : 'evenline' }
303 attribute => 'checkbox',
304 title => 'Update', # loc
306 value => sub { return \('<input type="checkbox" class="checkbox" name="UpdateTicket'.$_[0]->id.'" value="1" checked="checked" />') }
312 my $bookmark = $m->scomp( '/Ticket/Elements/Bookmark', id => $_[0]->id );
313 # the CollectionAsTable/Row template replaces newlines with <br>
314 $bookmark =~ s/\n//g;
321 $m->comp('/Elements/CustomerFields', 'ColumnMap'),
322 $m->comp('/Elements/ServiceFields', 'ColumnMap'),
326 # if no encryption support, then KeyOwnerName and KeyRequestors fall back to the regular
328 unless (RT->Config->Get('Crypt')->{'Enable'}) {
329 $COLUMN_MAP->{KeyOwnerName} = $COLUMN_MAP->{OwnerName};
330 $COLUMN_MAP->{KeyRequestors} = $GenericMap->{Requestors};
333 $m->callback( GenericMap => $GenericMap, COLUMN_MAP => $COLUMN_MAP, CallbackName => 'Once', CallbackOnce => 1 );
334 return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr );