Commit da7ecb07 authored by myk%mozilla.org's avatar myk%mozilla.org

Fix for bug 252739: moves inclusion/exclusion action names to button name…

Fix for bug 252739: moves inclusion/exclusion action names to button name instead of button value so that button values (which are also used as labels) will be localizable; patch by Marc Schumann; r=kiko,myk; a=justdave
parent 864e9a12
...@@ -61,9 +61,11 @@ my $component_id; ...@@ -61,9 +61,11 @@ my $component_id;
# Determine whether to use the action specified by the user or the default. # Determine whether to use the action specified by the user or the default.
my $action = $::FORM{'action'} || 'list'; my $action = $::FORM{'action'} || 'list';
my @categoryActions;
if ($::FORM{'categoryAction'}) { if (@categoryActions = grep(/^categoryAction-.+/, keys(%::FORM))) {
processCategoryChange(); $categoryActions[0] =~ s/^categoryAction-//;
processCategoryChange($categoryActions[0]);
exit; exit;
} }
...@@ -145,6 +147,7 @@ sub edit { ...@@ -145,6 +147,7 @@ sub edit {
} }
sub processCategoryChange { sub processCategoryChange {
my $categoryAction = shift;
validateIsActive(); validateIsActive();
validateIsRequestable(); validateIsRequestable();
validateIsRequesteeble(); validateIsRequesteeble();
...@@ -152,22 +155,22 @@ sub processCategoryChange { ...@@ -152,22 +155,22 @@ sub processCategoryChange {
my @inclusions = $::MFORM{'inclusions'} ? @{$::MFORM{'inclusions'}} : (); my @inclusions = $::MFORM{'inclusions'} ? @{$::MFORM{'inclusions'}} : ();
my @exclusions = $::MFORM{'exclusions'} ? @{$::MFORM{'exclusions'}} : (); my @exclusions = $::MFORM{'exclusions'} ? @{$::MFORM{'exclusions'}} : ();
if ($::FORM{'categoryAction'} eq "Include") { if ($categoryAction eq 'include') {
validateProduct(); validateProduct();
validateComponent(); validateComponent();
my $category = ($::FORM{'product'} || "__Any__") . ":" . ($::FORM{'component'} || "__Any__"); my $category = ($::FORM{'product'} || "__Any__") . ":" . ($::FORM{'component'} || "__Any__");
push(@inclusions, $category) unless grep($_ eq $category, @inclusions); push(@inclusions, $category) unless grep($_ eq $category, @inclusions);
} }
elsif ($::FORM{'categoryAction'} eq "Exclude") { elsif ($categoryAction eq 'exclude') {
validateProduct(); validateProduct();
validateComponent(); validateComponent();
my $category = ($::FORM{'product'} || "__Any__") . ":" . ($::FORM{'component'} || "__Any__"); my $category = ($::FORM{'product'} || "__Any__") . ":" . ($::FORM{'component'} || "__Any__");
push(@exclusions, $category) unless grep($_ eq $category, @exclusions); push(@exclusions, $category) unless grep($_ eq $category, @exclusions);
} }
elsif ($::FORM{'categoryAction'} eq "Remove Inclusion") { elsif ($categoryAction eq 'removeInclusion') {
@inclusions = map(($_ eq $::FORM{'inclusion_to_remove'} ? () : $_), @inclusions); @inclusions = map(($_ eq $::FORM{'inclusion_to_remove'} ? () : $_), @inclusions);
} }
elsif ($::FORM{'categoryAction'} eq "Remove Exclusion") { elsif ($categoryAction eq 'removeExclusion') {
@exclusions = map(($_ eq $::FORM{'exclusion_to_remove'} ? () : $_), @exclusions); @exclusions = map(($_ eq $::FORM{'exclusion_to_remove'} ? () : $_), @exclusions);
} }
......
...@@ -118,18 +118,18 @@ ...@@ -118,18 +118,18 @@
[% item FILTER html %]</option> [% item FILTER html %]</option>
[% END %] [% END %]
</select><br> </select><br>
<input type="submit" name="categoryAction" value="Include"> <input type="submit" name="categoryAction-include" value="Include">
<input type="submit" name="categoryAction" value="Exclude"> <input type="submit" name="categoryAction-exclude" value="Exclude">
</td> </td>
<td style="vertical-align: top;"> <td style="vertical-align: top;">
<b>Inclusions:</b><br> <b>Inclusions:</b><br>
[% PROCESS "global/select-menu.html.tmpl" name="inclusion_to_remove" multiple="1" size="4" options=type.inclusions %]<br> [% PROCESS "global/select-menu.html.tmpl" name="inclusion_to_remove" multiple="1" size="4" options=type.inclusions %]<br>
<input type="submit" name="categoryAction" value="Remove Inclusion"> <input type="submit" name="categoryAction-removeInclusion" value="Remove Inclusion">
</td> </td>
<td style="vertical-align: top;"> <td style="vertical-align: top;">
<b>Exclusions:</b><br> <b>Exclusions:</b><br>
[% PROCESS "global/select-menu.html.tmpl" name="exclusion_to_remove" multiple="1" size="4" options=type.exclusions %]<br> [% PROCESS "global/select-menu.html.tmpl" name="exclusion_to_remove" multiple="1" size="4" options=type.exclusions %]<br>
<input type="submit" name="categoryAction" value="Remove Exclusion"> <input type="submit" name="categoryAction-removeExclusion" value="Remove Exclusion">
</td> </td>
</tr> </tr>
</table> </table>
......
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