<& /Elements/Header, Title => loc("Reported tickets") &> <& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &>

<% loc('Tickets reported as spam by others without rights to delete tickets.') %> <% loc('Confirm by clicking "S".') %> <% loc('If you have rights to delete tickets then they will be deleted.') %>

<& /Elements/CollectionList, Rows => 100, OrderBy => 'id', Order => 'DESC', %ARGS, Class => 'RT::Tickets', Query => $Query, Format => $Format, AllowSorting => 1, ShowEmpty => 1, &> <%ARGS> $Format => undef <%INIT> my $Query = 'HasAttribute = "SpamReports"'; my @results; $Format ||= qq{ '__id__/TITLE:#', '__Subject__/TITLE:Subject', Requestors, QueueName, ReportSpam }; if ( $session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser') ) { $Format .= ', ' . qq{'} . loc( 'Not Spam For All Users' ) . q{/TITLE:Action'}; if ( $ARGS{NotSpamForAllUsers} ) { my $ticket = RT::Ticket->new($session{CurrentUser}); $ticket->Load($ARGS{NotSpamForAllUsers}); if ( $ticket->id ) { if ( $ticket->FirstAttribute('SpamReports') ) { my ( $status, $msg ) = $ticket->DeleteAttribute( 'SpamReports' ); if ( $status ) { push @results, loc( "Ticket #[_1] is unmarked as spam for all users", $ARGS{NotSpamForAllUsers} ); } else { push @results, loc( "Failed to unmark ticket #[_1]: [_2]", $ARGS{NotSpamForAllUsers}, $msg ); } } else { push @results, loc("Ticket #[_1] is not marked as spam", $ARGS{NotSpamForAllUsers} ); } } else { push @results, loc( "Failed to load ticket #[_1]", $ARGS{NotSpamForAllUsers} ); } MaybeRedirectForResults( Actions => \@results, Path => "/Tools/Spam/Reported.html", Anchor => $ARGS{'Anchor'}, ); } }