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

<form method="post" enctype="multipart/form-data" action="<% RT->Config->Get('WebPath') %>/Admin/Tools/AnnounceSimple.html">

<input type="text" name="announce" style="width: 50%;" value="<% $announce %>" />

<div>
% if ($attr) {
<input type="submit" name="delete" value="<&|/l&>Delete</&>" />
% }
<input type="submit" name="save" value="<&|/l&>Save</&>" />
</div>

</form>
<%init>
unless ($session{'CurrentUser'}->HasRight( Object=> RT->System, Right => 'SuperUser')) {
    Abort(loc('This feature is only available to system administrators.'));
}

my @results;

if ( $ARGS{'save'} and length $announce ) {
    my $my_system = RT::System->new( $session{CurrentUser} );
    my ($status, $msg) = $my_system->SetAttribute(
        Name        => 'AnnounceSimple',
        Description => 'AnnounceSimple text',
        Content     => $announce,
    );

    push @results, loc("Unable to update Announce text: [_1]", $msg)
        unless $status;
} elsif ( $ARGS{'delete'} ) {
    my ($status, $msg) = RT->System->DeleteAttribute('AnnounceSimple');

    push @results, loc("Unable to delete Announce text: [_1]", $msg)
        unless $status;
}

my $attr = RT->System->FirstAttribute('AnnounceSimple');
$announce = $attr ? $attr->Content : '';
</%init>
<%args>
$announce => ''
</%args>
