[Rt-commit] r15750 - rt/3.8/trunk/share/html/Admin/Elements
ruz at bestpractical.com
ruz at bestpractical.com
Wed Sep 3 22:12:18 EDT 2008
Author: ruz
Date: Wed Sep 3 22:12:15 2008
New Revision: 15750
Modified:
rt/3.8/trunk/share/html/Admin/Elements/SelectRights
Log:
* sort rights using localized values
Modified: rt/3.8/trunk/share/html/Admin/Elements/SelectRights
==============================================================================
--- rt/3.8/trunk/share/html/Admin/Elements/SelectRights (original)
+++ rt/3.8/trunk/share/html/Admin/Elements/SelectRights Wed Sep 3 22:12:15 2008
@@ -48,28 +48,31 @@
<input type="hidden" class="hidden" name="CheckACL" value="<%$ACLDesc%>" />
<table border="0">
<tr>
-<td valign="top" width="180" align="left">
-% my %current_rights;
+<td valign="top" width="180" align="left">
+<%PERL>
+my %current_rights;
+my @pairs;
+while ( my $ace = $ACLObj->Next ) {
+ my $right = $ace->RightName;
+ $current_rights{ $right } = 1;
+ push @pairs, [$right, loc($right)];
+}
+ at pairs = sort { $a->[1] cmp $b->[1] } @pairs;
+</%PERL>
<h3><&|/l&>Current rights</&></h3>
-% if ($ACLObj->Count() == 0) {
-<i><&|/l&>No rights granted.</&></i> <br />
+% unless ( @pairs ) {
+<i><&|/l&>No rights granted.</&></i> <br />
% } else {
-<i>(<&|/l&>Check box to revoke right</&>)</i> <br />
-% while (my $right = $ACLObj->Next()) {
-% if ($right->RightName) {
-% $current_rights{$right->RightName} = 1;
-<input type="checkbox" class="checkbox" value="<% $right->RightName %>" name="RevokeRight-<%$ACLDesc%>" /> <% loc($right->RightName) %><br />
-% }
-% }
-% }
+<i>(<&|/l&>Check box to revoke right</&>)</i><br />
+% foreach my $pair ( @pairs ) {
+<input type="checkbox" class="checkbox" value="<% $pair->[0] %>" name="RevokeRight-<% $ACLDesc %>" /> <% $pair->[1] %><br />
+% } }
</td>
<td valign="top">
<h3><&|/l&>New rights</&></h3>
<select size="5" multiple="multiple" name="GrantRight-<%$ACLDesc%>">
-% foreach $right (sort keys %Rights) {
-% next if $current_rights{$right};
- <option value="<%$right%>"
- ><% loc($right) %></option>
+% foreach my $pair (sort { $a->[1] cmp $b->[1] } map [$_, loc($_)], grep !$current_rights{$_}, keys %Rights) {
+ <option value="<% $pair->[0] %>"><% $pair->[1] %></option>
% }
<option value="" selected="selected"><&|/l&>(no value)</&></option>
</select>
@@ -77,7 +80,7 @@
</tr>
</table>
<%INIT>
- my ($right, $ACLDesc, $AppliesTo, %Rights);
+ my ($ACLDesc, $AppliesTo, %Rights);
# if the principal id points to a user, we really want to point
# to their ACL equivalence group. The machinations we're going through
More information about the Rt-commit
mailing list