Skip to content

Commit

Permalink
Config report filter: added buttons to clear and reset default filter
Browse files Browse the repository at this point in the history
This provides the user with a single-click way to

 - reset the filter to default settings
   (i.e. ALL_USERS, ALL_PROJECTS, [any] config).
 - clear the filter to display all configs
   (i.e. [any] user, [any] project, [any] config)

Issue #14559
  • Loading branch information
dregad committed Jan 2, 2013
1 parent 8b426cf commit d76a210
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
22 changes: 18 additions & 4 deletions adm_config_report.php
Expand Up @@ -103,9 +103,21 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {

# Get filter values
$t_filter_save = gpc_get_bool( 'save' );
$t_filter_user_value = gpc_get_int( 'filter_user_id', ALL_USERS );
$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 );
$t_filter_default = gpc_get_bool( 'default_filter_button', false );
$t_filter_reset = gpc_get_bool( 'reset_filter_button', false );
if( $t_filter_default ) {
$t_filter_user_value = ALL_USERS;
$t_filter_project_value = ALL_PROJECTS;
$t_filter_config_value = META_FILTER_NONE;
} else if( $t_filter_reset ) {
$t_filter_user_value = META_FILTER_NONE;
$t_filter_project_value = META_FILTER_NONE;
$t_filter_config_value = META_FILTER_NONE;
} else {
$t_filter_user_value = gpc_get_int( 'filter_user_id', ALL_USERS );
$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 );
}

# Manage filter's persistency through cookie
$t_cookie_name = config_get( 'manage_config_cookie' );
Expand Down Expand Up @@ -274,7 +286,9 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
</tr>
<tr>
<td colspan="3">
<input type="submit" class="button-small" value="<?php echo lang_get( 'filter_button' )?>" />
<input name="apply_filter_button" type="submit" class="button-small" value="<?php echo lang_get( 'filter_button' )?>" />
<input name="default_filter_button" type="submit" class="button-small" value="<?php echo lang_get( 'default_filter' )?>" />
<input name="reset_filter_button" type="submit" class="button-small" value="<?php echo lang_get( 'reset_query' )?>" />
</td>
</tr>
</table>
Expand Down
1 change: 1 addition & 0 deletions lang/strings_english.txt
Expand Up @@ -748,6 +748,7 @@ $s_create_user_button = 'Create User';
# manage_page.php
$s_hide_disabled = 'Hide Disabled';
$s_filter_button = 'Apply Filter';
$s_default_filter = 'Default Filter';
$s_create_filter_link = 'Create Permalink'; # Permalink = Permanent Link
$s_create_short_link = 'Create Short Link';
$s_filter_permalink = 'Following is a permanent link to the currently configured filter:';
Expand Down

0 comments on commit d76a210

Please sign in to comment.