1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
6 %# <jesse@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 }}}
61 # First deal with the simple things from the map
62 if ( $COLUMN_MAP->{$name} ) {
63 return ( $COLUMN_MAP->{$name}->{$attr} );
66 # now, let's deal with harder things, like Custom Fields
68 elsif ( $name =~ /^(?:CF|CustomField)\.\{(.+)\}$/ ) {
71 if ( $attr eq 'attribute' ) {
72 return ("CF.{$field}");
74 elsif ( $attr eq 'title' ) {
77 elsif ( $attr eq 'value' ) {
78 # Display custom field contents, separated by newlines.
79 # For Image custom fields we also show a thumbnail here.
81 my $values = $_[0]->CustomFieldValues($field);
84 ($_->CustomFieldObj->Type eq 'Image')
85 ? \($m->scomp( '/Elements/ShowCustomFieldImage', Object => $_ ))
89 } @{ $values->ItemsArrayRef };
90 pop @values; # Remove that last <br />
97 my $LinkCallback = sub {
100 my $mode = $RT::Ticket::LINKTYPEMAP{$method}{Mode};
101 my $type = $RT::Ticket::LINKTYPEMAP{$method}{Type};
102 my $other_mode = ($mode eq "Target" ? "Base" : "Target");
103 my $mode_uri = $mode.'URI';
104 my $local_type = 'Local'.$mode;
109 $_->$mode_uri->Resolver->HREF,
111 ( $_->$mode_uri->IsLocal ? $_->$local_type : $_->$mode ),
113 } @{ $_[0]->Links($other_mode,$type)->ItemsArrayRef }
119 attribute => 'Queue',
121 value => sub { return $_[0]->Queue }
124 attribute => 'Queue',
126 value => sub { return $_[0]->QueueObj->Name }
130 attribute => 'Owner',
131 value => sub { return $_[0]->OwnerObj->Name }
136 value => sub { return $_[0]->id }
139 attribute => 'Status',
140 value => sub { return loc($_[0]->Status) }
143 attribute => 'Subject',
144 value => sub { return $_[0]->Subject || "(" . loc('No subject') . ")" }
148 attribute => 'Status',
152 if ( $Ticket->HasUnresolvedDependencies ) {
153 if ( $Ticket->HasUnresolvedDependencies( Type => 'approval' )
154 or $Ticket->HasUnresolvedDependencies( Type => 'code' ) )
156 return \'<em>', loc('(pending approval)'), \'</em>';
159 return \'<em>', loc('(pending other Collection)'), \'</em>';
163 return loc( $Ticket->Status );
169 attribute => 'Priority',
170 value => sub { return $_[0]->Priority }
173 attribute => 'InitialPriority',
174 name => 'Initial Priority',
175 value => sub { return $_[0]->InitialPriority }
178 attribute => 'FinalPriority',
179 name => 'Final Priority',
180 value => sub { return $_[0]->FinalPriority }
183 attribute => 'EffectiveId',
184 value => sub { return $_[0]->EffectiveId }
188 value => sub { return $_[0]->Type }
191 attribute => 'TimeWorked',
192 title => 'Time Worked',
193 value => sub { return $_[0]->TimeWorked }
196 attribute => 'TimeLeft',
197 title => 'Time Left',
198 value => sub { return $_[0]->TimeLeft }
201 attribute => 'TimeEstimated',
202 title => 'Time Estimated',
203 value => sub { return $_[0]->TimeEstimated }
206 attribute => 'Requestor.EmailAddress',
207 value => sub { return $_[0]->Requestors->MemberEmailAddressesAsString }
210 attribute => 'Cc.EmailAddress',
211 value => sub { return $_[0]->Cc->MemberEmailAddressesAsString }
214 attribute => 'AdminCc.EmailAddress',
215 value => sub { return $_[0]->AdminCc->MemberEmailAddressesAsString }
219 attribute => 'Starts',
220 value => sub { return $_[0]->StartsObj->AgeAsString }
224 attribute => 'Started',
225 value => sub { return $_[0]->StartedObj->AgeAsString }
229 attribute => 'Created',
230 value => sub { return $_[0]->CreatedObj->AgeAsString }
232 LastUpdatedRelative => {
233 title => 'Last Updated',
234 attribute => 'LastUpdated',
235 value => sub { return $_[0]->LastUpdatedObj->AgeAsString }
240 value => sub { return $_[0]->ToldObj->AgeAsString }
246 my $date = $_[0]->DueObj;
247 if ($date && $date->Unix > 0 && $date->Unix < time()) {
248 return (\'<span class="overdue">' , $date->AgeAsString , \'</span>');
250 return $date->AgeAsString;
254 ResolvedRelative => {
256 attribute => 'Resolved',
257 value => sub { return $_[0]->ResolvedObj->AgeAsString }
260 attribute => 'Starts',
261 value => sub { return $_[0]->StartsObj->AsString }
264 attribute => 'Started',
265 value => sub { return $_[0]->StartedObj->AsString }
268 attribute => 'Created',
269 value => sub { return $_[0]->CreatedObj->AsString }
272 attribute => 'Creator',
273 title => 'Created By',
274 value => sub { return $_[0]->CreatorObj->Name }
277 attribute => 'LastUpdated',
278 title => 'Last Updated',
279 value => sub { return $_[0]->LastUpdatedObj->AsString }
282 attribute => 'LastUpdatedBy',
283 title => 'Last Updated By',
284 value => sub { return $_[0]->LastUpdatedByObj->Name }
288 value => sub { return $_[0]->ToldObj->AsString }
292 value => sub { return $_[0]->DueObj->AsString }
295 attribute => 'Resolved',
296 value => sub { return $_[0]->ResolvedObj->AsString }
299 # Everything from LINKTYPEMAP
301 $_ => { value => $LinkCallback->( $_ ) }
302 } keys %RT::Ticket::LINKTYPEMAP),
305 value => sub { return $_[1] % 2 ? 'oddline' : 'evenline' }
308 attribute => 'checkbox',
309 title => loc('Update'),
311 value => sub { return \('<input type="checkbox" class="checkbox" name="UpdateTicket'.$_[0]->id.'" value="1" checked />') }
317 $m->comp( '/Elements/Callback', COLUMN_MAP => $COLUMN_MAP, _CallbackName => 'ColumnMap');
318 return $ColumnMap->( $Name, $Attr );