<& /Elements/Header,
    Title => $title,
&>

<& /Elements/Tabs &>

<& /Elements/ListActions, actions => \@results &>

<form action="<% $RT::WebPath %><% $m->request_comp->path %>" method="post">
<input type="hidden" class="hidden" name="Queue" value="<% $QueueObj->Name %>" />

<& /Dist/Elements/EditNotes, Queue => $QueueObj &>

<& /Dist/Elements/EditNotifyAddresses, Queue => $QueueObj &>

<& /Dist/Elements/EditSubjectTag, Queue => $QueueObj &>

<& /Elements/Submit, Label => loc('Save Changes'), Name => 'Update' &>

</form>
<%INIT>
$Name = $Queue unless $Name;
$Name =~ s/::/-/g;
my $QueueObj = RT::Queue->new( $session{CurrentUser} );
$QueueObj->Load( $Name );
unless ( $QueueObj->id ) {
    $m->comp('/Public/Elements/ErrorNoDist', Queue => $Name, %ARGS);
    $m->abort();
}
$ARGS{'Name'} = $Name = $QueueObj->Name;

unless ( $QueueObj->IsAdminCc( $session{'CurrentUser'}->id )
    || $QueueObj->CurrentUserHasRight('AdminQueue') )
{
    return $m->comp('/Elements/Error',
        Why => loc("You're not allowed to manage queue for this distribution"),
    );
}

my @results;
foreach ( qw(Notes NotifyAddresses SubjectTag) ) {
    push @results, $m->comp(
        '/Dist/Elements/Edit'. $_ .':Process',
        %ARGS,
        Queue => $QueueObj,
    );
}

my $title = loc( "Manage queue for [_1]", $Name );

my $current_subtab = "Dist/Display.html"
    ."&Queue=". $m->interp->apply_escapes($QueueObj->Name, 'u');

my ($base_url) = ( $current_subtab =~ m{^Dist/(.+)$} );
$base_url .= '&';

</%INIT>
<%ARGS>
$Name   => undef
# Queue is an alias for Name, Name has higher precendance
$Queue  => undef
</%ARGS>
