<& /Admin/Elements/Header, Title => $title &> <& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> <&| /Widgets/TitleBox, title => '', class => 'formtools-admin-description ml-auto mr-auto' &>
<&| /Elements/LabeledValue, Label => loc('Name') &> <&| /Elements/LabeledValue, Label => loc('Description') &>
<& /Elements/Submit, Label => loc('Create'), Name => 'Create' &>
<%INIT> Abort( loc('Permission Denied') ) unless $session{'CurrentUser'}->HasRight( Object => $RT::System, Right => 'AdminForm' ); my ($title, @results, $id); $title = loc('Create form group'); if ( $Create ) { push @results, loc('Missing Name') unless $Name; if ( $Name ) { my $form_group = RT::Attribute->new( $session{CurrentUser} ); my ( $existing ) = $form_group->LoadByCols( Name => 'FormTools Group', Description => $Name ); if ( $existing ) { push @results, loc("Form group '$Name' already exists"); } else { # create form group attribute my ( $ret, $msg ) = $form_group->Create( Name => 'FormTools Group', Description => $Name, Object => RT->System, Content => { banner_message => '', description => $ARGS{Description} || '', disabled => 0, }, ); if ( $ret ) { $id = $ret; push @results, loc("Created form group '$Name'"); } else { RT->Logger->error( loc( "Couldn't create form group '$Name': [_1]", $msg ) ) unless $ret; push @results, loc( "Couldn't create form group '$Name': [_1]", $msg ); } } } } MaybeRedirectForResults( Actions => \@results, Arguments => { id => $id }, Path => '/Admin/FormTools/Groups/Modify.html', ); <%ARGS> $Name => undef $Description => undef $Create => undef