Permalink
Browse files

Config report filter: added buttons to clear and reset default filter

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...
1 parent 8b426cf commit d76a21067e56aba847b650d17ad4e679392c7475 @dregad dregad committed Jan 2, 2013
Showing with 19 additions and 4 deletions.
  1. +18 −4 adm_config_report.php
  2. +1 −0 lang/strings_english.txt
View
22 adm_config_report.php
@@ -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' );
@@ -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>
View
1 lang/strings_english.txt
@@ -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:';

0 comments on commit d76a210

Please sign in to comment.