diff options
Diffstat (limited to 'rt/share/html/Admin/Groups')
-rw-r--r-- | rt/share/html/Admin/Groups/CustomFields.html | 48 | ||||
-rwxr-xr-x | rt/share/html/Admin/Groups/GroupRights.html | 62 | ||||
-rw-r--r-- | rt/share/html/Admin/Groups/History.html | 11 | ||||
-rwxr-xr-x | rt/share/html/Admin/Groups/Members.html | 42 | ||||
-rwxr-xr-x | rt/share/html/Admin/Groups/Modify.html | 72 | ||||
-rwxr-xr-x | rt/share/html/Admin/Groups/UserRights.html | 56 | ||||
-rwxr-xr-x | rt/share/html/Admin/Groups/index.html | 53 |
7 files changed, 117 insertions, 227 deletions
diff --git a/rt/share/html/Admin/Groups/CustomFields.html b/rt/share/html/Admin/Groups/CustomFields.html deleted file mode 100644 index 21f15a99b..000000000 --- a/rt/share/html/Admin/Groups/CustomFields.html +++ /dev/null @@ -1,48 +0,0 @@ -%# BEGIN BPS TAGGED BLOCK {{{ -%# -%# COPYRIGHT: -%# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC -%# <sales@bestpractical.com> -%# -%# (Except where explicitly superseded by other copyright notices) -%# -%# -%# LICENSE: -%# -%# This work is made available to you under the terms of Version 2 of -%# the GNU General Public License. A copy of that license should have -%# been provided with this software, but in any event can be snarfed -%# from www.gnu.org. -%# -%# This work is distributed in the hope that it will be useful, but -%# WITHOUT ANY WARRANTY; without even the implied warranty of -%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -%# General Public License for more details. -%# -%# You should have received a copy of the GNU General Public License -%# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. -%# -%# -%# CONTRIBUTION SUBMISSION POLICY: -%# -%# (The following paragraph is not intended to limit the rights granted -%# to you to modify and distribute this software under the terms of -%# the GNU General Public License and is only of importance to you if -%# you choose to contribute your changes and enhancements to the -%# community by submitting them to Best Practical Solutions, LLC.) -%# -%# By intentionally submitting any modifications, corrections or -%# derivatives to this work, or any other work intended for use with -%# Request Tracker, to Best Practical Solutions, LLC, you confirm that -%# you are the copyright holder for those contributions and you grant -%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, -%# royalty-free, perpetual, license to use, copy, create derivative -%# works based on those contributions, and sublicense and distribute -%# those contributions and any derivatives thereof. -%# -%# END BPS TAGGED BLOCK }}} -<& /Admin/Elements/ObjectCustomFields, %ARGS, ObjectType => 'RT::Group' &> diff --git a/rt/share/html/Admin/Groups/GroupRights.html b/rt/share/html/Admin/Groups/GroupRights.html index fc3ac33b1..4d9c1187f 100755 --- a/rt/share/html/Admin/Groups/GroupRights.html +++ b/rt/share/html/Admin/Groups/GroupRights.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 %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,62 +46,17 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => loc('Modify group rights for group [_1]', $GroupObj->Name) &> -<& /Admin/Elements/GroupTabs, - GroupObj => $GroupObj, - current_tab => 'Admin/Groups/GroupRights.html?id='.$id, - Title => loc('Modify group rights for group [_1]', $GroupObj->Name) &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> - <form method="post" action="GroupRights.html"> + <form method="post" action="GroupRights.html" id="ModifyGroupRights" name="ModifyGroupRights"> <input type="hidden" class="hidden" name="id" value="<% $GroupObj->id %>" /> - -<&| /Widgets/TitleBox, title => loc('Modify group rights for group [_1]', $GroupObj->Name) &> - -<h1><&|/l&>System groups</&></h1> -<table> -% $Groups = RT::Groups->new($session{'CurrentUser'}); -% $Groups->LimitToSystemInternalGroups(); -% while (my $Group = $Groups->Next()) { - <tr align="right"> - <td valign="top"> - <% loc($Group->Type) %> - </td> - <td> - <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, - PrincipalType => 'Group', - Object => $GroupObj &> - </td> - </tr> -% } -</table> -<h1><&|/l&>User defined groups</&></h1> -<table> -% $Groups = RT::Groups->new($session{'CurrentUser'}); -% $Groups->LimitToUserDefinedGroups(); -% while (my $Group = $Groups->Next()) { - <tr align="right"> - <td valign="top"> - <% $Group->Name %> - </td> - <td> - <& /Admin/Elements/SelectRights, PrincipalId => $Group->PrincipalId, - PrincipalType => 'Group', - Object => $GroupObj &> - </td> - </tr> -% } -</table> - - </&> - <& /Elements/Submit, Label => loc('Modify Group Rights'), Reset => 1 &> - + <& /Admin/Elements/EditRights, Context => $GroupObj, Principals => \@principals &> + <& /Elements/Submit, Label => loc('Save Changes') &> </form> - <%INIT> - - #Update the acls. - my @results = ProcessACLChanges(\%ARGS); - +# Update the acls. +my @results = ProcessACLs(\%ARGS); if (!defined $id) { Abort(loc("No Group defined")); @@ -110,8 +65,7 @@ if (!defined $id) { my $GroupObj = RT::Group->new($session{'CurrentUser'}); $GroupObj->Load($id) || Abort(loc("Couldn't load group [_1]",$id)); -my $Groups; - +my @principals = GetPrincipalsMap($GroupObj, 'System', 'Groups'); </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Groups/History.html b/rt/share/html/Admin/Groups/History.html index 53b041dee..9a8ca015a 100644 --- a/rt/share/html/Admin/Groups/History.html +++ b/rt/share/html/Admin/Groups/History.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 %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,11 +46,7 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/GroupTabs, - id => $id, - GroupObj => $GroupObj, - current_subtab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Ticket/Elements/ShowHistory, Ticket => $GroupObj, @@ -58,8 +54,7 @@ &> <%INIT> -my $current_tab = 'Admin/Groups/History.html?id='.$id; -my $GroupObj = new RT::Group($session{'CurrentUser'}); +my $GroupObj = RT::Group->new($session{'CurrentUser'}); $GroupObj->Load($id) || Abort("Couldn't load group '$id'"); my $title = loc("History of the group [_1]", $GroupObj->Name); </%INIT> 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 %# <sales@bestpractical.com> %# %# (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 &> <form action="<% RT->Config->Get('WebPath') %>/Admin/Groups/Members.html" method="post"> @@ -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); } - </%INIT> <%ARGS> diff --git a/rt/share/html/Admin/Groups/Modify.html b/rt/share/html/Admin/Groups/Modify.html index de3dac4b5..148c98e1f 100755 --- a/rt/share/html/Admin/Groups/Modify.html +++ b/rt/share/html/Admin/Groups/Modify.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 %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -47,15 +47,12 @@ %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/GroupTabs, - GroupObj => $Group, - current_tab => $current_tab, - Title => $title &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> -<form action="<%RT->Config->Get('WebPath')%>/Admin/Groups/Modify.html" method="post" enctype="multipart/form-data"> +<form action="<%RT->Config->Get('WebPath')%>/Admin/Groups/Modify.html" name="ModifyGroup" method="post" enctype="multipart/form-data"> %unless ($Group->Id) { <input type="hidden" class="hidden" name="id" value="new" /> @@ -66,11 +63,11 @@ <tr><td align="right"> <&|/l&>Name</&>: </td> -<td><input name="Name" value="<%$Group->Name||''%>" /></td> +<td><input name="Name" value="<%$Group->Name||$Name||''%>" /></td> </tr> <tr> <td align="right"> -<&|/l&>Description</&>:</td><td colspan="3"><input name="Description" value="<%$Group->Description||''%>" size="60" /></td> +<&|/l&>Description</&>:</td><td colspan="3"><input name="Description" value="<%$Group->Description||$Description||''%>" size="60" /></td> </tr> % my $CFs = $Group->CustomFields; % while (my $CF = $CFs->Next) { @@ -99,67 +96,72 @@ </form> <%INIT> -my $current_tab; -my ($title, @results, $Disabled, $EnabledChecked); +my ($title, @results, @warnings, $Disabled, $EnabledChecked); my $Group = RT::Group->new($session{'CurrentUser'}); if ($Create) { - $current_tab = 'Admin/Groups/Modify.html?Create=1'; $title = loc("Create a new group"); -} - -else { - $current_tab = 'Admin/Groups/Modify.html?id='.$id; +} else { if ($id eq 'new' ) { - - my ($create_id, $create_msg) = $Group->CreateUserDefinedGroup(Name => - "$Name"); - unless ($create_id) { - Abort (loc("Group could not be created: [_1]", $create_msg)); - } - $id = $Group->Id; - } - else { + my ($create_id, $create_msg) = $Group->CreateUserDefinedGroup(Name => $Name ); + if ($create_id) { + $id = $Group->Id; + push @results, $create_msg; + } else { + push @results, loc("Group could not be created: [_1]", $create_msg); + } + } else { $Group->Load($id) || Abort('Could not load group'); } - - if ($id) { + if ($Group->Id) { $title = loc("Modify the group [_1]", $Group->Name); - - } + } # If the create failed else { $title = loc("Create a new group"); $Create = 1; - } - + } } -if ($id) { - +if ($Group->Id) { my @fields = qw(Description Name ); my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields, Object => $Group, ARGSRef => \%ARGS ); push (@results,@fieldresults); push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $Group ); + + # Warn about duplicate groups + my $dupcheck = RT::Groups->new(RT->SystemUser); + $dupcheck->LimitToUserDefinedGroups(); + $dupcheck->Limit( FIELD => 'Name', VALUE => $Group->Name ); + if ($dupcheck->Count > 1) { + push @warnings, loc("There is more than one group with the name '[_1]'. This may cause inconsistency in parts of the admin interface, and therefore it's recommended you rename the conflicting groups.", $Group->Name); + } } #we're asking about enabled on the web page but really care about disabled. if (defined $Enabled && $Enabled == 1) { $Disabled = 0; -} -else { +} else { $Disabled = 1; } -if ( ($SetEnabled) and ( $Disabled != $Group->Disabled) ) { +if ( $Group->Id and ($SetEnabled) and ( $Disabled != $Group->Disabled) ) { my ($code, $msg) = $Group->SetDisabled($Disabled); push @results, $msg; } +# This code does automatic redirection if any updates happen. +MaybeRedirectForResults( + Actions => \@results, + Arguments => { id => $Group->id }, +) if $Group->Id; + +push @results, @warnings; + unless ($Group->Disabled()) { $EnabledChecked ='checked="checked"'; } diff --git a/rt/share/html/Admin/Groups/UserRights.html b/rt/share/html/Admin/Groups/UserRights.html index aedb55e5e..8e6b09164 100755 --- a/rt/share/html/Admin/Groups/UserRights.html +++ b/rt/share/html/Admin/Groups/UserRights.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 %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,45 +46,18 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => loc('Modify user rights for group [_1]', $GroupObj->Name) &> -<& /Admin/Elements/GroupTabs, - GroupObj => $GroupObj, - current_tab => 'Admin/Groups/UserRights.html?id='.$id, - Title => loc('Modify user rights for group [_1]', $GroupObj->Name) &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> - <form method="post" action="UserRights.html"> + <form method="post" action="UserRights.html" name="ModifyUserRights" id="ModifyUserRights"> <input type="hidden" class="hidden" name="id" value="<% $GroupObj->id %>" /> - -<&| /Widgets/TitleBox, title => loc('Modify user rights for group [_1]', $GroupObj->Name) &> -<table> -% while ( my $Member = $Users->Next ) { -% my $UserObj = $Member->MemberObj->Object; - <tr align="right"> - <td valign="top"><& /Elements/ShowUser, User => $UserObj &></td> - <td><& /Admin/Elements/SelectRights, - PrincipalId => $Member->MemberObj->Id, - PrincipalType => 'User', - Object => $GroupObj, - &></td> - </tr> -% } -</table> -</&> - -<& /Elements/Submit, Label => loc('Modify User Rights'), Reset => 1 &> - -</form> + <& /Admin/Elements/EditRights, Context => $GroupObj, Principals => \@principals &> + <& /Elements/Submit, Label => loc('Save Changes') &> + </form> <%INIT> - - #Update the acls. - my @results = ProcessACLChanges(\%ARGS); - -# {{{ Deal with setting up the display of current rights. - - -#Define vars used in html above - +# Update the acls. +my @results = ProcessACLs(\%ARGS); if (!defined $id) { Abort(loc("No Group defined")); @@ -93,20 +66,9 @@ if (!defined $id) { my $GroupObj = RT::Group->new($session{'CurrentUser'}); $GroupObj->Load($id) || Abort(loc("Couldn't load group [_1]",$id)); -# Find out which users we want to display ACL selects for -my $Privileged = RT::Group->new($session{'CurrentUser'}); -$Privileged->LoadSystemInternalGroup('Privileged'); -my $Users = $Privileged->MembersObj(); - - - -# }}} - +my @principals = GetPrincipalsMap($GroupObj, 'Users'); </%INIT> <%ARGS> $id => undef -$UserString => undef -$UserOp => undef -$UserField => undef </%ARGS> diff --git a/rt/share/html/Admin/Groups/index.html b/rt/share/html/Admin/Groups/index.html index 2485ea731..ef7395f3e 100755 --- a/rt/share/html/Admin/Groups/index.html +++ b/rt/share/html/Admin/Groups/index.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 %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -46,14 +46,40 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/GroupTabs, current_tab => 'Admin/Groups/', - current_subtab => 'Admin/Groups/', - Title => $title &> -<% $caption %>:<br /> +<& /Elements/Tabs &> +<h1><% $caption %></h1> + +<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Groups/index.html"> +<input type="hidden" name="GroupField" value="Name" /> +<input type="hidden" name="GroupOp" value="LIKE" /> +<&|/l&>Go to group</&> +<input type="text" name="GroupString" value="" id="autocomplete-GroupString" /> +<script type="text/javascript"> +jQuery(function(){ + jQuery("#autocomplete-GroupString").autocomplete({ + source: <% RT->Config->Get('WebPath') |n,j%>+"/Helpers/Autocomplete/Groups", + // Auto-submit once a group is chosen + select: function( event, ui ) { + jQuery(event.target).val(ui.item.value); + var form = jQuery(event.target).closest('form'); + form.find('input[name=GroupOp]').val('='); + form.submit(); + } + }); +}); +</script> +</form> + +<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Groups/index.html"> +<&|/l&>Find groups whose</&> <& /Elements/SelectGroups &><br /> +<input type="checkbox" class="checkbox" name="FindDisabledGroups" value="1" <% $FindDisabledGroups? 'checked="checked"': '' |n %> /> <&|/l&>Include disabled groups in listing.</&><br /> +<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div> +</form> % unless ( $Groups->Count ) { <em><&|/l&>No groups matching search criteria found.</&></em> % } else { +<p><&|/l&>Select a group</&>:</p> <& /Elements/CollectionList, OrderBy => 'Name', @@ -65,23 +91,8 @@ AllowSorting => 1, PassArguments => [qw(Format Rows Page Order OrderBy GroupString GroupOp GroupField FindDisabledGroups)], &> - -% my $ids = join ',', map $_->id, @{ $Groups->ItemsArrayRef }; -% if ( $ids ) { -<div align="right"><em> -(<a href="<% RT->Config->Get('WebPath') %>/Download/Tabular/Group/<% $ids %>/Groups.tsv"> -<&|/l&>Download as a tab-delimited file</&> -</a>)</em></div> -% } - -<br /><br /> % } -<form method="post" action="<% RT->Config->Get('WebPath') %>/Admin/Groups/index.html"> -<input type="checkbox" class="checkbox" name="FindDisabledGroups" value="1" <% $FindDisabledGroups? 'checked="checked"': '' |n %> /> <&|/l&>Include disabled groups in listing.</&><br /> -<&|/l&>Find groups whose</&> <& /Elements/SelectGroups &><br /> -<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" /></div> -</form> <%INIT> my $Groups = RT::Groups->new($session{'CurrentUser'}); $Groups->LimitToUserDefinedGroups(); @@ -108,6 +119,8 @@ if (length $GroupString) { VALUE => $GroupString, ); } + RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Admin/Groups/Modify.html?id=".$Groups->First->id) + if $Groups->Count == 1 and $Groups->First; } else { $caption = loc("User-defined groups"); |