Commit 29a562e5 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 275608: The group selection when editing flag types should be a listbox with…

Bug 275608: The group selection when editing flag types should be a listbox with (no group) meaning no restriction - Patch by Frédéric Buclin <LpSolit@gmail.com> r=GavinS a=myk
parent 94b607da
...@@ -36,6 +36,7 @@ use Bugzilla; ...@@ -36,6 +36,7 @@ use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Flag; use Bugzilla::Flag;
use Bugzilla::FlagType; use Bugzilla::FlagType;
use Bugzilla::Group;
use Bugzilla::User; use Bugzilla::User;
use Bugzilla::Util; use Bugzilla::Util;
...@@ -153,7 +154,9 @@ sub edit { ...@@ -153,7 +154,9 @@ sub edit {
$vars->{'type'} = { 'target_type' => scalar $cgi->param('target_type'), $vars->{'type'} = { 'target_type' => scalar $cgi->param('target_type'),
'inclusions' => \%inclusions }; 'inclusions' => \%inclusions };
} }
# Get a list of groups available to restrict this flag type against.
my @groups = Bugzilla::Group::get_all_groups();
$vars->{'groups'} = \@groups;
# Return the appropriate HTTP response headers. # Return the appropriate HTTP response headers.
print $cgi->header(); print $cgi->header();
...@@ -203,7 +206,8 @@ sub processCategoryChange { ...@@ -203,7 +206,8 @@ sub processCategoryChange {
$vars->{'products'} = \@::legal_product; $vars->{'products'} = \@::legal_product;
$vars->{'components'} = \@::legal_components; $vars->{'components'} = \@::legal_components;
$vars->{'components_by_product'} = \%::components; $vars->{'components_by_product'} = \%::components;
my @groups = Bugzilla::Group::get_all_groups();
$vars->{'groups'} = \@groups;
$vars->{'action'} = $cgi->param('action'); $vars->{'action'} = $cgi->param('action');
my $type = {}; my $type = {};
foreach my $key ($cgi->param()) { $type->{$key} = $cgi->param($key) } foreach my $key ($cgi->param()) { $type->{$key} = $cgi->param($key) }
......
...@@ -195,8 +195,8 @@ ...@@ -195,8 +195,8 @@
<th>Grant Group:</th> <th>Grant Group:</th>
<td> <td>
the group allowed to grant/deny flags of this type the group allowed to grant/deny flags of this type
(to allow all users to grant/deny these flags, leave this empty)<br> (to allow all users to grant/deny these flags, select no group)<br>
<input type="text" name="grant_gid" value="[% type.grant_gid FILTER html %]" size="50" maxlength="255"> [% PROCESS select selname = "grant_gid" %]
</td> </td>
</tr> </tr>
...@@ -204,9 +204,9 @@ ...@@ -204,9 +204,9 @@
<th>Request Group:</th> <th>Request Group:</th>
<td> <td>
if flags of this type are requestable, the group allowed to request them if flags of this type are requestable, the group allowed to request them
(to allow all users to request these flags, leave this empty)<br> (to allow all users to request these flags, select no group)<br>
Note that the request group alone has no effect if the grant group is not defined!<br> Note that the request group alone has no effect if the grant group is not defined!<br>
<input type="text" name="request_gid" value="[% type.request_gid FILTER html %]" size="50" maxlength="255"> [% PROCESS select selname = "request_gid" %]
</td> </td>
</tr> </tr>
...@@ -225,3 +225,19 @@ ...@@ -225,3 +225,19 @@
</form> </form>
[% PROCESS global/footer.html.tmpl %] [% PROCESS global/footer.html.tmpl %]
[%############################################################################%]
[%# Block for SELECT fields #%]
[%############################################################################%]
[% BLOCK select %]
<select name="[% selname %]" id="[% selname %]">
<option value="">(no group)</option>
[% FOREACH group = groups %]
<option value="[% group.name FILTER html %]"
[% " selected" IF type.${selname} == group.name %]>[% group.name FILTER html %]
</option>
[% END %]
</select>
[% END %]
...@@ -563,6 +563,7 @@ ...@@ -563,6 +563,7 @@
'type.sortkey || 1', 'type.sortkey || 1',
'typeLabelLowerPlural', 'typeLabelLowerPlural',
'typeLabelLowerSingular', 'typeLabelLowerSingular',
'selname',
], ],
'admin/flag-type/list.html.tmpl' => [ 'admin/flag-type/list.html.tmpl' => [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment