<& /RTIR/Elements/Header, Title => $title &> <& "/RTIR/".$Type."/Elements/Tabs", Ticket => $ticket, current_tab => 'RTIR/Display.html?id='.$ticket->id, current_subtab => 'RTIR/Display.html?id='.$ticket->id, Title => $title, &> % $m->callback( CallbackName => 'BeforeActionList', %ARGS, Actions => \@results, ARGSRef => \%ARGS ); <& /Elements/ListActions, actions => \@results &>
<% loc('Return back to the ticket') %> <& /Elements/Submit, Label => ($encrypted? loc('Decrypt'): loc('Encrypt')), Name => ($encrypted? 'Decrypt': 'Encrypt'), &>
<%ARGS> $id => undef $Encrypt => 0 $Decrypt => 0 <%INIT> my $txn = RT::Transaction->new( $session{'CurrentUser'} ); $txn->Load( $id ); unless ( $txn->id ) { Abort(loc("Couldn't load transaction #[_1]", $id)); } $id = $txn->id; my $ticket = $txn->TicketObj; my $Type = RT::IR::TicketType( Ticket => $ticket ); return $m->comp( '/Ticket/GnuPG.html', %ARGS ) unless $Type; my @results; my $encrypted = 0; my $attachments = $txn->Attachments; while ( my $attachment = $attachments->Next ) { next unless $attachment->ContentType =~ m{^x-application-rt/gpg-encrypted\b}; $encrypted = 1; last; } $attachments->GotoFirstItem; if ( $Encrypt || $Decrypt ) { my $done = 1; while ( my $attachment = $attachments->Next ) { my ($status, $msg) = $Decrypt? $attachment->Decrypt : $attachment->Encrypt; push @results, $msg; unless ( $status ) { $done = 0; last; } } $encrypted = !$encrypted if $done; } my $title = loc("Encrypt/Decrypt transaction #[_1] of ticket #[_2]", $id, $ticket->id);