Skip to content

Commit

Permalink
Config report: preset the edit form to the current filter
Browse files Browse the repository at this point in the history
The 'Username', 'Project Name' and 'Configuration Option' fields in the
'Set Configuration Option' form are now preset to the corresponding
value from the filter or defaulting to ALL_USERS, ALL_PROJECTS and blank
respectively if the filter is not defined or set to '[any]'.

This allows easier definition of related config, e.g. for a given
project or user.
  • Loading branch information
dregad committed Jan 2, 2013
1 parent b6f03b7 commit 8b426cf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions adm_config_report.php
Expand Up @@ -107,13 +107,6 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
$t_filter_project_value = gpc_get_int( 'filter_project_id', ALL_PROJECTS );
$t_filter_config_value = gpc_get_string( 'filter_config_id', META_FILTER_NONE );

# Get config edit values
$t_edit_user_id = gpc_get_int( 'user_id', ALL_USERS );
$t_edit_project_id = gpc_get_int( 'project_id', ALL_PROJECTS );
$t_edit_option = gpc_get_string( 'config_option', '' );
$t_edit_type = gpc_get_string( 'type', CONFIG_TYPE_DEFAULT );
$t_edit_value = gpc_get_string( 'value', '' );

# Manage filter's persistency through cookie
$t_cookie_name = config_get( 'manage_config_cookie' );
if( $t_filter_save ) {
Expand Down Expand Up @@ -143,6 +136,13 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
}
}

# Get config edit values
$t_edit_user_id = gpc_get_int( 'user_id', $t_filter_user_value == META_FILTER_NONE ? ALL_USERS : $t_filter_user_value );
$t_edit_project_id = gpc_get_int( 'project_id', $t_filter_project_value == META_FILTER_NONE ? ALL_PROJECTS : $t_filter_project_value );
$t_edit_option = gpc_get_string( 'config_option', $t_filter_config_value == META_FILTER_NONE ? '' : $t_filter_config_value );
$t_edit_type = gpc_get_string( 'type', CONFIG_TYPE_DEFAULT );
$t_edit_value = gpc_get_string( 'value', '' );

# Apply filters
$t_config_table = db_get_table( 'mantis_config_table' );
$t_project_table = db_get_table( 'mantis_project_table' );
Expand Down

0 comments on commit 8b426cf

Please sign in to comment.