1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2007 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/copyleft/gpl.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' ) {
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]->QueueObj->Name }
125 attribute => 'Owner',
126 value => sub { return $_[0]->OwnerObj->Name }
131 value => sub { return $_[0]->id }
134 attribute => 'Status',
135 value => sub { return loc($_[0]->Status) }
138 attribute => 'Subject',
139 value => sub { return $_[0]->Subject || "(" . loc('No subject') . ")" }
143 attribute => 'Status',
147 if ( $Ticket->HasUnresolvedDependencies ) {
148 if ( $Ticket->HasUnresolvedDependencies( Type => 'approval' )
149 or $Ticket->HasUnresolvedDependencies( Type => 'code' ) )
151 return \'<em>', loc('(pending approval)'), \'</em>';
154 return \'<em>', loc('(pending other Collection)'), \'</em>';
158 return loc( $Ticket->Status );
164 attribute => 'Priority',
165 value => sub { return $_[0]->Priority }
168 attribute => 'InitialPriority',
169 name => 'Initial Priority',
170 value => sub { return $_[0]->InitialPriority }
173 attribute => 'FinalPriority',
174 name => 'Final Priority',
175 value => sub { return $_[0]->FinalPriority }
178 attribute => 'EffectiveId',
179 value => sub { return $_[0]->EffectiveId }
183 value => sub { return $_[0]->Type }
186 attribute => 'TimeWorked',
187 title => 'Time Worked',
188 value => sub { return $_[0]->TimeWorked }
191 attribute => 'TimeLeft',
192 title => 'Time Left',
193 value => sub { return $_[0]->TimeLeft }
196 attribute => 'TimeEstimated',
197 title => 'Time Estimated',
198 value => sub { return $_[0]->TimeEstimated }
201 attribute => 'Requestor.EmailAddress',
202 value => sub { return $_[0]->Requestors->MemberEmailAddressesAsString }
205 attribute => 'Cc.EmailAddress',
206 value => sub { return $_[0]->Cc->MemberEmailAddressesAsString }
209 attribute => 'AdminCc.EmailAddress',
210 value => sub { return $_[0]->AdminCc->MemberEmailAddressesAsString }
214 attribute => 'Starts',
215 value => sub { return $_[0]->StartsObj->AgeAsString }
219 attribute => 'Started',
220 value => sub { return $_[0]->StartedObj->AgeAsString }
224 attribute => 'Created',
225 value => sub { return $_[0]->CreatedObj->AgeAsString }
227 LastUpdatedRelative => {
228 title => 'Last Updated',
229 attribute => 'LastUpdated',
230 value => sub { return $_[0]->LastUpdatedObj->AgeAsString }
235 value => sub { return $_[0]->ToldObj->AgeAsString }
241 my $date = $_[0]->DueObj;
242 if ($date && $date->Unix > 0 && $date->Unix < time()) {
243 return (\'<span class="overdue">' , $date->AgeAsString , \'</span>');
245 return $date->AgeAsString;
249 ResolvedRelative => {
251 attribute => 'Resolved',
252 value => sub { return $_[0]->ResolvedObj->AgeAsString }
255 attribute => 'Starts',
256 value => sub { return $_[0]->StartsObj->AsString }
259 attribute => 'Started',
260 value => sub { return $_[0]->StartedObj->AsString }
263 attribute => 'Created',
264 value => sub { return $_[0]->CreatedObj->AsString }
267 attribute => 'CreatedBy',
268 title => 'Created By',
269 value => sub { return $_[0]->CreatorObj->Name }
272 attribute => 'LastUpdated',
273 title => 'Last Updated',
274 value => sub { return $_[0]->LastUpdatedObj->AsString }
277 attribute => 'LastUpdatedBy',
278 title => 'Last Updated By',
279 value => sub { return $_[0]->LastUpdatedByObj->Name }
283 value => sub { return $_[0]->ToldObj->AsString }
287 value => sub { return $_[0]->DueObj->AsString }
290 attribute => 'Resolved',
291 value => sub { return $_[0]->ResolvedObj->AsString }
294 # Everything from LINKTYPEMAP
296 $_ => { value => $LinkCallback->( $_ ) }
297 } keys %RT::Ticket::LINKTYPEMAP),
300 value => sub { return $_[1] % 2 ? 'oddline' : 'evenline' }
303 attribute => 'checkbox',
304 title => loc('Update'),
306 value => sub { return \('<input type="checkbox" class="checkbox" name="UpdateTicket'.$_[0]->id.'" value="1" checked />') }
312 $m->comp( '/Elements/Callback', COLUMN_MAP => $COLUMN_MAP, _CallbackName => 'ColumnMap');
313 return $ColumnMap->( $Name, $Attr );