X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FAdmin%2FGroups%2FMembers.html;fp=rt%2Fshare%2Fhtml%2FAdmin%2FGroups%2FMembers.html;h=3ba5b657b78a3b19df30f1dbab66e84f64c0d6ee;hb=43a06151e47d2c59b833cbd8c26d97865ee850b6;hp=4b40e5bd30e1c97392bf9a73217204b4be4b649c;hpb=6587f6ba7d047ddc1686c080090afe7d53365bd4;p=freeside.git diff --git a/rt/share/html/Admin/Groups/Members.html b/rt/share/html/Admin/Groups/Members.html index 4b40e5bd3..3ba5b657b 100755 --- a/rt/share/html/Admin/Groups/Members.html +++ b/rt/share/html/Admin/Groups/Members.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -45,10 +45,8 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& /Admin/Elements/Header, Title => loc('RT/Admin/Edit the group [_1]', $Group->Name) &> -<& /Admin/Elements/GroupTabs, GroupObj => $Group, - current_tab => 'Admin/Groups/Members.html?id='.$id, - Title => "RT/Admin/Edit the group ". $Group->Name &> +<& /Admin/Elements/Header, Title => $title &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &>
@@ -113,9 +111,11 @@ my @users = sort { lc($a->[0]) cmp lc($b->[0]) } <%INIT> -my $Group = new RT::Group($session{'CurrentUser'}); +my $Group = RT::Group->new($session{'CurrentUser'}); $Group->Load($id) || Abort(loc('Could not load group')); +my $title = loc("Modify the group [_1]", $Group->Name); + my (%UsersSeen, %GroupsSeen); $GroupsSeen{ $Group->id } = 1; # can't be a member of ourself @@ -129,25 +129,37 @@ foreach my $key (keys %ARGS) { push (@results, $msg); } -foreach my $member (grep $_, @AddMembersUsers, @AddMembersGroups) { +# Process new users +foreach my $member (grep $_, @AddMembersUsers) { + my $principal = RT::User->new($session{'CurrentUser'}); + + if ($member =~ /^User-(\d+)$/) { + # Old style, using id + $principal->Load($1); + } else { + # New style, just a username + $principal->Load($member); + } + + my ($val, $msg) = $Group->AddMember($principal->PrincipalId); + push (@results, $msg); +} - my $principal; +# Process new groups +foreach my $member (grep $_, @AddMembersGroups) { + my $principal = RT::Group->new($session{'CurrentUser'}); if ($member =~ /^Group-(\d+)$/) { - $principal = RT::Group->new($session{'CurrentUser'}); - $principal->Load($1); - } elsif ($member =~ /^User-(\d+)$/) { - $principal = RT::User->new($session{'CurrentUser'}); + # Old style, using id $principal->Load($1); } else { - next; + # New style, just a group name + $principal->LoadUserDefinedGroup($member); } - my ($val, $msg) = $Group->AddMember($principal->PrincipalId); push (@results, $msg); } - <%ARGS>