Skip to content

Commit

Permalink
Issue #11729: Preselect next highest status in bug_change_status
Browse files Browse the repository at this point in the history
The bug change status dropdown list currently preselects the
first/lowest status as the default. It would be more useful if the
default value selected was the next highest status from the current
status. Failing that (for closed issues) we should revert back to using
the highest available status as the default.
  • Loading branch information
davidhicks committed Mar 31, 2010
1 parent 67f43bd commit 886dccd
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions core/html_api.php
Expand Up @@ -1351,11 +1351,20 @@ function html_button_bug_change_status( $p_bug_id ) {

if( count( $t_enum_list ) > 0 ) {

# resort the list into ascending order after noting the key from the first element (the default)
$t_default_arr = each( $t_enum_list );
$t_default = $t_default_arr['key'];
# resort the list into ascending order
ksort( $t_enum_list );

# Get the default selected option as the next highest available status
# Otherwise fall back to using the last element in the array
end( $t_enum_list );
$t_default = key( $t_enum_list );
reset( $t_enum_list );
foreach( $t_enum_list as $key => $val ) {
if( $key > $t_bug_current_state ) {
$t_default = $key;
break;
}
}

echo "<form method=\"post\" action=\"bug_change_status_page.php\">";
# CSRF protection not required here - form does not result in modifications
Expand Down

0 comments on commit 886dccd

Please sign in to comment.