<& /Elements/Header, Title => loc('Todo List') &> <& /Elements/Tabs, current_toptab => 'Todo.html' &> <& /Elements/ListActions, actions => \@Actions &>

<% loc('Todo List') %>

<& .DisplayTodo, ( tickets => $tickets_cc, title => '[*,_1,group ticket]', # loc ) &> <& .DisplayTodo, ( tickets => $tickets_with_due, title => '[*,_1,ticket] due', # loc ) &> <& .DisplayTodo, ( tickets => $tickets_without_due, title => '[*,_1,unresolved ticket]', # loc ) &>
<&|/l&>Create new item
<% loc('Due') %>: <& /Elements/SelectQueue, Name => 'Queue', Default => $ARGS{'Queue'}&>
<%INIT> my @Actions; my $user = RT::User->new($session{'CurrentUser'}); $user->Load($session{'CurrentUser'}->Id); if ($ARGS{'Subject'}) { my $due = ''; if ($ARGS{'Due'}) { $due = ParseDateToISO($ARGS{'Due'}); } my $Ticket = RT::Ticket->new($session{'CurrentUser'}); my ($id, $Trans, $ErrMsg)= $Ticket->Create( Queue => $ARGS{Queue}, Subject => $ARGS{Subject}, Owner => $session{'CurrentUser'}->Id, Due => $due, ); unless ($id && $Trans) { Abort($ErrMsg); } push(@Actions, $ErrMsg); } if ($ARGS{'id'}) { my $Ticket = RT::Ticket->new($session{'CurrentUser'}); $Ticket->Load($ARGS{'id'}); if ($ARGS{'Status'} ) { my ($val, $msg) = $Ticket->SetStatus($ARGS{'Status'}); push @Actions, $msg; } } my $tickets_with_due = RT::Tickets->new($session{'CurrentUser'}); my $tickets_without_due = RT::Tickets->new($session{'CurrentUser'}); my $tickets_cc = RT::Tickets->new($session{'CurrentUser'}); foreach ($tickets_with_due, $tickets_without_due, $tickets_cc) { $_->LimitStatus(VALUE => 'open'); $_->LimitStatus(VALUE => 'new'); $_->OrderBy(FIELD => 'Due', ALIAS => 'main', ORDER => 'DESC'); } foreach ($tickets_with_due, $tickets_without_due) { $_->LimitOwner( VALUE => $user->Id ); } $tickets_cc->LimitWatcher( TYPE => 'CC', VALUE => $session{'CurrentUser'}->EmailAddress ); $tickets_with_due->Limit(FIELD => 'Due', OPERATOR => '>', VALUE => '1970-01-01 00:00'); $tickets_without_due->Limit(FIELD => 'Due', OPERATOR => '<=', VALUE => '1970-01-02 00:00'); <%DEF .DisplayTodo> % return unless $tickets->Count; <% loc($title, $tickets->Count) %> % my $i; % while (my $ticket = $tickets->Next) { <&|/l, $ticket->Id, $ticket->Subject &>#[_1]: [_2] % if ($ticket->Owner != $session{'CurrentUser'}->Id) {
<&|/l&>Owner: <% $ticket->OwnerAsString %> <&|/l&>Cc: <% $ticket->CcAddresses %> % } elsif (my $cc = $ticket->CcAddresses) {
<&|/l&>Cc: <% $cc %> % } % if ($ticket->DueObj->Unix == -1) {   % } elsif ($ticket->DueObj->Unix < (time + (86400*5))) { <% $ticket->DueObj->AsString %> % } else { <% $ticket->DueObj->AsString %> % } % if ($ticket->Owner == $session{'CurrentUser'}->Id) { [<&|/l&>Done] % } else {   % } % } <%ARGS> $tickets $title