%# Earn cash in your spare time -- blackmail your friends
<& /Edit/Elements/104Header,
Focus => 'Name',
Buttons => [
Add => "index.html?Action-Add=1",
Save => "javascript:document.getElementById('mainform').submit()",
Delete => 1,
Copy => '',
Search => '',
],
Method => 'POST',
&>
<input type="hidden" name="Group" value="<% $Group %>">
<table width="97%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<table border=0 cellpadding=0 cellspacing=0>
<tr valign="bottom">
<td><& /Edit/Elements/Tab, Text => 'Groups' &></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table border="0" cellspacing="0" cellpadding="4" class="poptable" width="100%">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="18">
<& /Edit/Elements/Tabs, Name => 'Map2', Map => $ARGS{Map2}, URL => '/Edit/Groups/Roles/' &>
</td>
</tr>
<tr>
<td class="tableEmboss">
<table width="100%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td><& Top, Item => $Item &></td>
</tr>
<tr>
<td>
<& List, Delete => 1, Item => $Item, List => $List, Begin => $Begin, ARGS => \%ARGS &>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%INIT>
my $List;
my %Roles;
my $Item = $RT::Nothing;
if ($Group) {
$Item = RT::Group->new($session{'CurrentUser'});
$Item->Load( $Group );
}
if ($Action eq 'Save' and length($Name)) {
if (!$Group) {
$Item = RT::Group->new($session{'CurrentUser'});
$Item->CreateRoleGroup(Domain => 'RT::Group-Role', Type => 'Owner');
$Group = $Item->Id;
}
$Item->SetName($Name);
$Item->UpdateCompany if $Item->can('UpdateCompany');
}
elsif ($Action eq 'Delete') {
foreach my $Id (@ListDelete) {
my $item = RT::Group->new($session{'CurrentUser'});
$item->Load($Id);
$item->SetDisabled(1);
}
$Item = $RT::Nothing;
$Group = $Begin = 0;
}
elsif ($Action eq 'Add') {
$Begin = 0;
$Item = $RT::Nothing;
}
my $Groups = RT::Groups->new($session{'CurrentUser'});
$Groups->LimitToEnabled;
$Groups->LimitToRolesForGroup();
$Groups->OrderBy( FIELD => 'Name' );
$List = $Groups->ItemsArrayRef;
my $Role;
</%INIT>
<%ARGS>
$Name => ''
$Group => ''
$Begin => 0
$Action => ''
@ListDelete => ()
</%ARGS>