From 475abdfcbaa5609ccbc480afa2ab1670574387fd Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Thu, 13 May 2010 08:50:15 -0700 Subject: Bug 555850: Make fields.html help on enter_bug happen when the user hovers over the fields r=timello, a=mkanat --- enter_bug.cgi | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'enter_bug.cgi') diff --git a/enter_bug.cgi b/enter_bug.cgi index 9c6a1c6b4..d85a9f060 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -534,38 +534,40 @@ if ( Bugzilla->params->{'usetargetmilestone'} ) { } # Construct the list of allowable statuses. -my $initial_statuses = Bugzilla::Status->can_change_to(); +my @statuses = @{ Bugzilla::Status->can_change_to() }; # Exclude closed states from the UI, even if the workflow allows them. # The back-end code will still accept them, though. -@$initial_statuses = grep { $_->is_open } @$initial_statuses; +@statuses = grep { $_->is_open } @statuses; -my @status = map { $_->name } @$initial_statuses; # UNCONFIRMED is illegal if allows_unconfirmed is false. if (!$product->allows_unconfirmed) { - @status = grep {$_ ne 'UNCONFIRMED'} @status; + @statuses = grep { $_->name ne 'UNCONFIRMED' } @statuses; } -scalar(@status) || ThrowUserError('no_initial_bug_status'); +scalar(@statuses) || ThrowUserError('no_initial_bug_status'); # If the user has no privs... unless ($has_editbugs || $has_canconfirm) { # ... use UNCONFIRMED if available, else use the first status of the list. - my $bug_status = (grep {$_ eq 'UNCONFIRMED'} @status) ? 'UNCONFIRMED' : $status[0]; - @status = ($bug_status); + my $bug_status = (grep { $_->name eq 'UNCONFIRMED' } @statuses) + ? 'UNCONFIRMED' : $statuses[0]->name; + @statuses = ($bug_status); } -$vars->{'bug_status'} = \@status; +$vars->{'bug_status'} = \@statuses; # Get the default from a template value if it is legitimate. # Otherwise, and only if the user has privs, set the default # to the first confirmed bug status on the list, if available. -if (formvalue('bug_status') && grep { $_ eq formvalue('bug_status') } @status) { +my $picked_status = formvalue('bug_status'); +if ($picked_status and grep($_->name eq $picked_status, @statuses)) { $default{'bug_status'} = formvalue('bug_status'); -} elsif (scalar @status == 1) { - $default{'bug_status'} = $status[0]; +} elsif (scalar @statuses == 1) { + $default{'bug_status'} = $statuses[0]->name; } else { - $default{'bug_status'} = ($status[0] ne 'UNCONFIRMED') ? $status[0] : $status[1]; + $default{'bug_status'} = ($statuses[0]->name ne 'UNCONFIRMED') + ? $statuses[0]->name : $statuses[1]->name; } my @groups = $cgi->param('groups'); -- cgit v1.2.3-24-g4f1b