Commit b3e936bf authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 448593: Move code to edit product group settings from editproducts.cgi to…

Bug 448593: Move code to edit product group settings from editproducts.cgi to Bugzilla/Product.pm - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=mkanat a=LpSolit
parent ce2c6035
...@@ -107,7 +107,7 @@ versions:</a> ...@@ -107,7 +107,7 @@ versions:</a>
</th> </th>
<td> <td>
[% IF product.group_controls.size %] [% IF product.group_controls.size %]
[% FOREACH g = product.group_controls.values %] [% FOREACH g = product.group_controls.values.sort("name") %]
<b>[% g.group.name FILTER html %]:</b>&nbsp; <b>[% g.group.name FILTER html %]:</b>&nbsp;
[% IF g.group.isactive %] [% IF g.group.isactive %]
[% group_control.${g.membercontrol} FILTER html %]/ [% group_control.${g.membercontrol} FILTER html %]/
......
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
<input type="hidden" name="action" value="updategroupcontrols"> <input type="hidden" name="action" value="updategroupcontrols">
<input type="hidden" name="product" value="[% product.name FILTER html %]"> <input type="hidden" name="product" value="[% product.name FILTER html %]">
<input type="hidden" name="token" value="[% token FILTER html %]"> <input type="hidden" name="token" value="[% token FILTER html %]">
<input type="hidden" name="classification"
value="[% classification.name FILTER html %]">
<table id="form" cellspacing="0" cellpadding="4" border="1"> <table id="form" cellspacing="0" cellpadding="4" border="1">
<tr bgcolor="#6666ff"> <tr bgcolor="#6666ff">
...@@ -46,23 +44,23 @@ ...@@ -46,23 +44,23 @@
<th>editbugs</th> <th>editbugs</th>
<th>[% terms.Bugs %]</th> <th>[% terms.Bugs %]</th>
</tr> </tr>
[% FOREACH group = groups %] [% FOREACH group = product.group_controls(1).values.sort("name") %]
[% IF group.isactive == 0 AND group.bugcount > 0 %] [% IF !group.group.isactive AND group.bug_count %]
<tr bgcolor="#bbbbbb"> <tr bgcolor="#bbbbbb">
<td> <td>
[% group.name FILTER html %] [% group.group.name FILTER html %]
</td> </td>
<td align="center" colspan=7> <td align="center" colspan=7>
Disabled Disabled
</td> </td>
<td> <td>
[% group.bugcount %] [% group.bug_count FILTER html %]
</td> </td>
<tr> <tr>
[% ELSIF group.isactive != 0 %] [% ELSIF group.group.is_active %]
<tr> <tr>
<td> <td>
[% group.name FILTER html %] [% group.group.name FILTER html %]
</td> </td>
<td> <td>
<input type=checkbox value=1 name=entry_[% group.id %] <input type=checkbox value=1 name=entry_[% group.id %]
...@@ -70,48 +68,48 @@ ...@@ -70,48 +68,48 @@
</td> </td>
<td> <td>
<select name="membercontrol_[% group.id %]"> <select name="membercontrol_[% group.id %]">
<option value=[% const.CONTROLMAPNA %] <option value=[% constants.CONTROLMAPNA %]
[% " selected=\"selected\"" [% " selected=\"selected\""
IF group.membercontrol == const.CONTROLMAPNA %] IF group.membercontrol == constants.CONTROLMAPNA %]
>NA >NA
</option> </option>
<option value=[% const.CONTROLMAPSHOWN %] <option value=[% constants.CONTROLMAPSHOWN %]
[% " selected=\"selected\"" [% " selected=\"selected\""
IF group.membercontrol == const.CONTROLMAPSHOWN %] IF group.membercontrol == constants.CONTROLMAPSHOWN %]
>Shown >Shown
</option> </option>
<option value=[% const.CONTROLMAPDEFAULT %] <option value=[% constants.CONTROLMAPDEFAULT %]
[% " selected=\"selected\"" [% " selected=\"selected\""
IF group.membercontrol == const.CONTROLMAPDEFAULT %] IF group.membercontrol == constants.CONTROLMAPDEFAULT %]
>Default >Default
</option> </option>
<option value=[% const.CONTROLMAPMANDATORY %] <option value=[% constants.CONTROLMAPMANDATORY %]
[% " selected=\"selected\"" [% " selected=\"selected\""
IF group.membercontrol == const.CONTROLMAPMANDATORY %] IF group.membercontrol == constants.CONTROLMAPMANDATORY %]
>Mandatory >Mandatory
</option> </option>
</select> </select>
</td> </td>
<td> <td>
<select name="othercontrol_[% group.id %]"> <select name="othercontrol_[% group.id %]">
<option value=[% const.CONTROLMAPNA %] <option value=[% constants.CONTROLMAPNA %]
[% " selected=\"selected\"" [% " selected=\"selected\""
IF group.othercontrol == const.CONTROLMAPNA %] IF group.othercontrol == constants.CONTROLMAPNA %]
>NA >NA
</option> </option>
<option value=[% const.CONTROLMAPSHOWN %] <option value=[% constants.CONTROLMAPSHOWN %]
[% " selected=\"selected\"" [% " selected=\"selected\""
IF group.othercontrol == const.CONTROLMAPSHOWN %] IF group.othercontrol == constants.CONTROLMAPSHOWN %]
>Shown >Shown
</option> </option>
<option value=[% const.CONTROLMAPDEFAULT %] <option value=[% constants.CONTROLMAPDEFAULT %]
[% " selected=\"selected\"" [% " selected=\"selected\""
IF group.othercontrol == const.CONTROLMAPDEFAULT %] IF group.othercontrol == constants.CONTROLMAPDEFAULT %]
>Default >Default
</option> </option>
<option value=[% const.CONTROLMAPMANDATORY %] <option value=[% constants.CONTROLMAPMANDATORY %]
[% " selected=\"selected\"" [% " selected=\"selected\""
IF group.othercontrol == const.CONTROLMAPMANDATORY %] IF group.othercontrol == constants.CONTROLMAPMANDATORY %]
>Mandatory >Mandatory
</option> </option>
</select> </select>
...@@ -133,7 +131,7 @@ ...@@ -133,7 +131,7 @@
[% " checked=\"checked\"" IF group.editbugs %]> [% " checked=\"checked\"" IF group.editbugs %]>
</td> </td>
<td> <td>
[% group.bugcount %] [% group.bug_count || 0 FILTER html %]
</td> </td>
</tr> </tr>
[% END %] [% END %]
......
...@@ -15,10 +15,8 @@ ...@@ -15,10 +15,8 @@
#%] #%]
[%# INTERFACE: [%# INTERFACE:
# removed_na: array of hashes; groups not applicable for the product. # product: Bugzilla::Product object; the product.
# added_mandatory: array of hashes; groups mandatory for the product. # changes: Hashref with changes made to the product group controls.
# classification: Bugzilla::Classification object; product classification.
# product: Bugzilla::Product object; the product.
#%] #%]
[% title = BLOCK %] [% title = BLOCK %]
...@@ -29,16 +27,16 @@ ...@@ -29,16 +27,16 @@
title = title title = title
%] %]
<p> <p>
[% IF removed_na.size > 0 %] [% IF changes.group_controls.now_na.size %]
[% FOREACH g = removed_na %] [% FOREACH g = changes.group_controls.now_na %]
Removing [% terms.bugs %] from group '[% g.name FILTER html %]' which Removing [% terms.bugs %] from group '[% g.name FILTER html %]' which
no longer applies to this product<p> no longer applies to this product<p>
[% g.bug_count FILTER html %] [%+ terms.bugs %] removed<p> [% g.bug_count FILTER html %] [%+ terms.bugs %] removed<p>
[% END %] [% END %]
[% END %] [% END %]
[% IF added_mandatory.size > 0 %] [% IF changes.group_controls.now_mandatory.size %]
[% FOREACH g = added_mandatory %] [% FOREACH g = changes.group_controls.now_mandatory %]
Adding [% terms.bugs %] to group '[% g.name FILTER html %]' which is Adding [% terms.bugs %] to group '[% g.name FILTER html %]' which is
mandatory for this product<p> mandatory for this product<p>
[% g.bug_count FILTER html %] [%+ terms.bugs %] added<p> [% g.bug_count FILTER html %] [%+ terms.bugs %] added<p>
......
...@@ -462,12 +462,11 @@ ...@@ -462,12 +462,11 @@
], ],
'admin/products/groupcontrol/edit.html.tmpl' => [ 'admin/products/groupcontrol/edit.html.tmpl' => [
'group.bugcount', 'group.id',
'group.id', 'constants.CONTROLMAPNA',
'const.CONTROLMAPNA', 'constants.CONTROLMAPSHOWN',
'const.CONTROLMAPSHOWN', 'constants.CONTROLMAPDEFAULT',
'const.CONTROLMAPDEFAULT', 'constants.CONTROLMAPMANDATORY',
'const.CONTROLMAPMANDATORY',
], ],
'admin/products/list.html.tmpl' => [ 'admin/products/list.html.tmpl' => [
......
...@@ -324,6 +324,16 @@ ...@@ -324,6 +324,16 @@
a <code>[% param FILTER html %]</code> argument, and that a <code>[% param FILTER html %]</code> argument, and that
argument was not set. argument was not set.
[% ELSIF error == "product_empty_group_controls" %]
[% title = "Missing Group Controls" %]
New settings must be defined to edit group controls for
the [% group.name FILTER html %] group.
[% ELSIF error == "product_illegal_group_control" %]
[% title = "Illegal Group Control" %]
'[% value FILTER html %]' is not a legal value for
the '[% field FILTER html %]' field.
[% ELSIF error == "protection_violation" %] [% ELSIF error == "protection_violation" %]
The function <code>[% function FILTER html %]</code> was called The function <code>[% function FILTER html %]</code> was called
......
...@@ -1236,6 +1236,11 @@ ...@@ -1236,6 +1236,11 @@
[% title = "Specified Product Does Not Exist" %] [% title = "Specified Product Does Not Exist" %]
The product '[% product FILTER html %]' does not exist. The product '[% product FILTER html %]' does not exist.
[% ELSIF error == "product_illegal_group" %]
[% title = "Illegal Group" %]
[% group.name FILTER html %] is not an active [% terms.bug %] group
and so you cannot edit group controls for it.
[% ELSIF error == "product_illegal_votes" %] [% ELSIF error == "product_illegal_votes" %]
[% title = "Votes Must Be Non-negative" %] [% title = "Votes Must Be Non-negative" %]
[% admindocslinks = {'voting.html' => 'Setting up the voting feature'} %] [% admindocslinks = {'voting.html' => 'Setting up the voting feature'} %]
......
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