%# BEGIN BPS TAGGED BLOCK {{{
-%#
+%#
%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-%# <jesse@bestpractical.com>
-%#
+%#
+%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
+%# <sales@bestpractical.com>
+%#
%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
+%#
+%#
%# LICENSE:
-%#
+%#
%# This work is made available to you under the terms of Version 2 of
%# the GNU General Public License. A copy of that license should have
%# been provided with this software, but in any event can be snarfed
%# from www.gnu.org.
-%#
+%#
%# This work is distributed in the hope that it will be useful, but
%# WITHOUT ANY WARRANTY; without even the implied warranty of
%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%# General Public License for more details.
-%#
+%#
%# You should have received a copy of the GNU General Public License
%# along with this program; if not, write to the Free Software
%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
%# 02110-1301 or visit their web page on the internet at
%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
+%#
+%#
%# CONTRIBUTION SUBMISSION POLICY:
-%#
+%#
%# (The following paragraph is not intended to limit the rights granted
%# to you to modify and distribute this software under the terms of
%# the GNU General Public License and is only of importance to you if
%# you choose to contribute your changes and enhancements to the
%# community by submitting them to Best Practical Solutions, LLC.)
-%#
+%#
%# By intentionally submitting any modifications, corrections or
%# derivatives to this work, or any other work intended for use with
%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
%# royalty-free, perpetual, license to use, copy, create derivative
%# works based on those contributions, and sublicense and distribute
%# those contributions and any derivatives thereof.
-%#
+%#
%# END BPS TAGGED BLOCK }}}
<%ARGS>
$Name => undef
$Attr => undef
+$GenericMap => {}
</%ARGS>
my $LinkCallback = sub {
my $method = shift;
- my $mode = $RT::Ticket::LINKTYPEMAP{$method}{Mode};
- my $type = $RT::Ticket::LINKTYPEMAP{$method}{Type};
+ my $mode = $RT::Link::TYPEMAP{$method}{Mode};
+ my $type = $RT::Link::TYPEMAP{$method}{Type};
my $other_mode = ($mode eq "Target" ? "Base" : "Target");
my $mode_uri = $mode.'URI';
- my $local_type = 'Local'.$mode;
return sub {
+ my $ObjectType = $_[2]||'';
map {
\'<a href="',
- $_->$mode_uri->Resolver->HREF,
+ $_->$mode_uri->AsHREF,
\'">',
- ( $_->$mode_uri->IsLocal ? $_->$local_type : $_->$mode ),
+ ( $_->$mode_uri->AsString ),
\'</a><br />',
- } @{ $_[0]->Links($other_mode,$type)->ItemsArrayRef }
+ } # if someone says __RefersTo.{Ticket}__ filter for only local links that are tickets
+ grep { $ObjectType
+ ? ( $_->$mode_uri->IsLocal
+ && ( $_->$mode_uri->Object->RecordType eq $ObjectType ))
+ : 1
+ }
+ @{ $_[0]->Links($other_mode,$type)->ItemsArrayRef }
+ }
+};
+
+my $trustSub = sub {
+ my $user = shift;
+ my %key = RT::Crypt->GetKeyInfo( Key => $user->EmailAddress );
+ if (!defined $key{'info'}) {
+ return $m->interp->apply_escapes(' ' . loc("(no pubkey!)"), "h");
+ } elsif ($key{'info'}{'TrustLevel'} == 0) {
+ return $m->interp->apply_escapes(' ' . loc("(untrusted!)"), "h");
}
};
my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query);
- return \'<a href="',$SearchURL,\'">', loc('(pending [quant,_1,other ticket])',$count), \'</a>';
+ return \'<a href="',$SearchURL,\'">', loc('(pending [quant,_1,other ticket,other tickets])',$count), \'</a>';
}
}
else {
title => 'Time Estimated', # loc
value => sub { return $_[0]->TimeEstimated }
},
- Requestors => {
- title => 'Requestors', # loc
- attribute => 'Requestor.EmailAddress',
- value => sub { return $_[0]->Requestors->MemberEmailAddressesAsString }
- },
- Cc => {
- title => 'Cc', # loc
- attribute => 'Cc.EmailAddress',
- value => sub { return $_[0]->Cc->MemberEmailAddressesAsString }
- },
- AdminCc => {
- title => 'AdminCc', # loc
- attribute => 'AdminCc.EmailAddress',
- value => sub { return $_[0]->AdminCc->MemberEmailAddressesAsString }
- },
StartsRelative => {
title => 'Starts', # loc
attribute => 'Starts',
value => sub {
my $date = $_[0]->DueObj;
# Highlight the date if it was due in the past, and it's still active
- if ( $date && $date->Unix > 0 && $date->Diff < 0 && $_[0]->QueueObj->IsActiveStatus($_[0]->Status)) {
+ if ( $date && $date->IsSet && $date->Diff < 0 && $_[0]->QueueObj->IsActiveStatus($_[0]->Status)) {
return (\'<span class="overdue">' , $date->AgeAsString , \'</span>');
} else {
return $date->AgeAsString;
}
}
},
+ WillResolveRelative => {
+ title => 'Will Resolve',
+ attribute => 'WillResolve',
+ value => sub { return $_[0]->WillResolveObj->AgeAsString },
+ },
ResolvedRelative => {
title => 'Resolved', # loc
attribute => 'Resolved',
Starts => {
title => 'Starts', # loc
attribute => 'Starts',
- value => sub { return $_[0]->StartsObj->AsString }
+ value => sub { return $_[0]->StartsObj }
},
Started => {
title => 'Started', # loc
attribute => 'Started',
- value => sub { return $_[0]->StartedObj->AsString }
+ value => sub { return $_[0]->StartedObj },
},
Told => {
title => 'Told', # loc
attribute => 'Told',
- value => sub { return $_[0]->ToldObj->AsString }
+ value => sub { return $_[0]->ToldObj },
},
Due => {
title => 'Due', # loc
attribute => 'Due',
- value => sub { return $_[0]->DueObj->AsString }
+ value => sub { return $_[0]->DueObj },
+ },
+ WillResolve => {
+ title => 'Will Resolve',
+ attribute => 'WillResolve',
+ value => sub { return $_[0]->WillResolveObj },
},
Resolved => {
title => 'Resolved', # loc
attribute => 'Resolved',
- value => sub { return $_[0]->ResolvedObj->AsString }
+ value => sub { return $_[0]->ResolvedObj }
},
UpdateStatus => {
title => 'New messages', # loc
KeyRequestors => {
title => 'Requestors', # loc
attribute => 'Requestor.EmailAddress',
- value => sub {
- my $t = shift;
- my @requestors = $t->Requestors->MemberEmailAddresses;
- for my $email (@requestors)
- {
- my %key = RT::Crypt::GnuPG::GetKeyInfo($email);
- if (!defined $key{'info'}) {
- $email .= loc(" (no pubkey!)");
- }
- elsif ($key{'info'}{'TrustLevel'} == 0) {
- $email .= loc(" (untrusted!)");
- }
- }
- return join ', ', @requestors;
- }
+ value => sub { return \($m->scomp("/Elements/ShowPrincipal", Object => $_[0]->Requestor, PostUser => $trustSub ) ) }
},
KeyOwnerName => {
title => 'Owner', # loc
value => sub {
my $t = shift;
my $name = $t->OwnerObj->Name;
- my %key = RT::Crypt::GnuPG::GetKeyInfo($t->OwnerObj->EmailAddress);
+ my %key = RT::Crypt->GetKeyInfo( Key => $t->OwnerObj->EmailAddress );
if (!defined $key{'info'}) {
$name .= ' '. loc("(no pubkey!)");
}
return $name;
}
},
+ KeyOwner => {
+ title => 'Owner', # loc
+ attribute => 'Owner',
+ value => sub { return \($m->scomp("/Elements/ShowPrincipal", Object => $_[0]->OwnerObj, PostUser => $trustSub ) ) }
+ },
# Everything from LINKTYPEMAP
(map {
$_ => { value => $LinkCallback->( $_ ) }
- } keys %RT::Ticket::LINKTYPEMAP),
+ } keys %RT::Link::TYPEMAP),
'_CLASS' => {
value => sub { return $_[1] % 2 ? 'oddline' : 'evenline' }
return \$bookmark;
},
},
-
- Customer => {
- title => 'Customer', #loc
- attribute => 'Customer', #title/attribute/name... what does it all mean?
- value => sub {
- my $Ticket = shift;
- my @Customers = @{ $Ticket->Customers->ItemsArrayRef };
- my @CustResolvers = map $_->TargetURI->Resolver, @Customers;
- my @return = ();
- for ( 0 .. $#CustResolvers ) {
- my $c = @CustResolvers[$_];
- push @return, \'<A HREF="', $c->HREF, \'">', $c->AsString, \'</A>';
- push @return, \'<BR>' if scalar(@CustResolvers) > 1
- && $_ != $#CustResolvers;
- }
- @return;
- },
- },
-
+
+ #freeside
+ $m->comp('/Elements/CustomerFields', 'ColumnMap'),
+ $m->comp('/Elements/ServiceFields', 'ColumnMap'),
};
-
-# if no GPG support, then KeyOwnerName and KeyRequestors fall back to the regular
-# versions
-if (RT->Config->Get('GnuPG')->{'Enable'}) {
- require RT::Crypt::GnuPG;
-}
-else {
- $COLUMN_MAP->{KeyOwnerName} = $COLUMN_MAP->{OwnerName};
- $COLUMN_MAP->{KeyRequestors} = $COLUMN_MAP->{Requestors};
-}
</%ONCE>
<%init>
-$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'Once', CallbackOnce => 1 );
-# backward compatibility
-$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'ColumnMap' );
+# if no encryption support, then KeyOwnerName and KeyRequestors fall back to the regular
+# versions
+unless (RT->Config->Get('Crypt')->{'Enable'}) {
+ $COLUMN_MAP->{KeyOwnerName} = $COLUMN_MAP->{OwnerName};
+ $COLUMN_MAP->{KeyRequestors} = $GenericMap->{Requestors};
+}
+
+$m->callback( GenericMap => $GenericMap, COLUMN_MAP => $COLUMN_MAP, CallbackName => 'Once', CallbackOnce => 1 );
return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr );
</%init>