View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0014559 | mantisbt | administration | public | 2012-08-07 04:44 | 2014-12-22 08:23 |
Reporter | Lapinkiller | Assigned To | dregad | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.8 | ||||
Target Version | 1.2.13 | Fixed in Version | 1.2.13 | ||
Summary | 0014559: Adding filter for "Configuration report" | ||||
Description | With lot of users and projects, the adminpage "Configuration report" is very very very long. So i have just added filters on "user" and/or "project" and/or "config id" | ||||
Additional Information | new lang var : | ||||
Tags | No tags attached. | ||||
Attached Files | adm_config_report.php-adding_filters-patch.diff (4,660 bytes)
Index: adm_config_report.php =================================================================== --- adm_config_report.php (revision 286) +++ adm_config_report.php (revision 306) @@ -87,15 +87,143 @@ echo '</pre>'; } + + $t_config_table = db_get_table( 'mantis_config_table' ); + + //Listes des filtres + $t_user_table = db_get_table( 'mantis_user_table' ); + $t_project_table = db_get_table( 'mantis_project_table' ); + //Utilisateurs ayant réalisé des tâches sur l'administration + $query = "SELECT DISTINCT user_id, ut.realname as username, ut.username as idrh + FROM $t_config_table as ct + JOIN $t_user_table as ut + ON ut.id=ct.user_id + ORDER BY username"; + $t_result = db_query_bound($query); + $t_users_list = array(); + $t_users_list[-1] = '<i>'.lang_get("none_filter").'</i>'; + $t_users_list[ALL_USERS] = lang_get("all_users"); + while ( $row = db_fetch_array( $t_result ) ) { + extract( $row, EXTR_PREFIX_ALL, 'v' ); + $t_users_list[$v_user_id] = "$v_username ($v_idrh)"; + } + + //Projets qui ont subi des modifications + $query = "SELECT DISTINCT project_id, pt.name as project_name + FROM $t_config_table as ct + JOIN $t_project_table as pt + ON pt.id=ct.project_id + WHERE project_id!=0 + ORDER BY project_name"; + $t_result = db_query_bound($query); + $t_projects_list = array(); + $t_projects_list[-1] = '<i>'.lang_get("none_filter").'</i>'; + $t_projects_list[ALL_PROJECTS] = lang_get("all_projects"); + while ( $row = db_fetch_array( $t_result ) ) { + extract( $row, EXTR_PREFIX_ALL, 'v' ); + $t_projects_list[$v_project_id] = $v_project_name; + } + + //Options de configuration + $query = "SELECT DISTINCT config_id + FROM $t_config_table + ORDER BY config_id"; + $t_result = db_query_bound($query); + $t_configs_list = array(); + $t_configs_list[-1] = '<i>'.lang_get("none_filter").'</i>'; + while ( $row = db_fetch_array( $t_result ) ) { + extract( $row, EXTR_PREFIX_ALL, 'v' ); + $t_configs_list[$v_config_id] = $v_config_id; + } + + function print_option_list_from_array($array,$filter_value){ + + foreach ($array as $key => $value){ + + if($filter_value == $key){ + $selected = " selected='selected' " ; + }else{ + $selected =""; + } + + echo "<option value='$key' $selected>$value</option>\n"; + } + + } + + //---- + + $t_filter_user_value = gpc_get_int('filter_user_id',-1); + $t_filter_project_value = gpc_get_int('filter_project_id',-1); + $t_filter_config_value = gpc_get_string('filter_config_id',-1); - $t_config_table = db_get_table( 'mantis_config_table' ); - $query = "SELECT config_id, user_id, project_id, type, value, access_reqd FROM $t_config_table ORDER BY user_id, project_id, config_id"; + $where = ''; + if($t_filter_user_value != -1){ + $where .= " AND user_id=$t_filter_user_value "; + } + if($t_filter_project_value != -1){ + $where .= " AND project_id=$t_filter_project_value "; + } + if($t_filter_config_value != -1){ + $where .= " AND config_id='$t_filter_config_value' "; + } + if($where!=''){ + $where = " WHERE 1=1 ".$where; + } + + $query = "SELECT config_id, user_id, project_id, type, value, access_reqd FROM $t_config_table $where ORDER BY user_id, project_id, config_id "; $result = db_query_bound( $query ); ?> + <br /> <div align="center"> +<form action="" name="form_filter"> <table class="width100" cellspacing="1"> + <!-- Title --> + <tr> + <td class="form-title" colspan="7"> + <?php echo lang_get( 'filters' ) ?> + </td> + </tr> + + <tr class="row-category" style="width:30%;"> + <td class="center"> + <?php echo lang_get( 'username' );?> : <br /> + <select name="filter_user_id" style="width:200px;"> + <?php + print_option_list_from_array($t_users_list, $t_filter_user_value); + ?> + </select> + </td> + <td class="center" style="width:30%;"> + <?php echo lang_get( 'project_name' );?> : <br /> + <select name="filter_project_id" style="width:200px;"> + <?php + print_option_list_from_array($t_projects_list, $t_filter_project_value); + ?> + </select> + </td> + <td class="center" style="width:40%;"> + <?php echo lang_get( 'configuration_option' );?> : <br /> + <select name="filter_config_id" style="width:200px;"> + <?php + print_option_list_from_array($t_configs_list, $t_filter_config_value); + ?> + </select> + </td> + </tr> + <tr> + <td colspan="3"> + <input type="submit" value="<?php echo lang_get('filter_button');?>"/> + </td> + </tr> +</table> +</form> +<br /> + +<table class="width100" cellspacing="1"> + <!-- Title --> <tr> <td class="form-title" colspan="7"> | ||||
related to | 0013680 | closed | dregad | Configuration page takes a very long time to load |
related to | 0013298 | closed | dregad | commas and multi-dimensional arrays in adm_config_set |
related to | 0015721 | closed | grangeway | Functionality to consider porting to master-2.0.x |
related to | 0015347 | closed | dregad | Bad performance and memory issue with print_user_option_list |
related to | 0012268 | acknowledged | In Config Report, hide or break out users custom column definations. |
please delete adm_config_report.php-adding_filters.diff |
|
Many thanks for this patch !I have been meaning to implement something similar for quite some time myself. I will review your code as time allows. |
|
Pull request https://github.com/mantisbt/mantisbt/pull/58 |
|
what about this pull request ? |
|
I have reworked your patch and improved it somewhat. Please seee https://github.com/dregad/mantisbt/tree/manage-config - feedback would be appreciated. |
|
I had a short look at it.
|
|
Hi atrol, Many thanks for your comments. I have pushed some changes to the branch, to cover for the 3 issues you raised:
|
|
Missing list of options after deleting an option
|
|
Thanks atrol. Latest commits to the branch [1] include
|
|
Editing of complex values (for example view_issues_page_columns) is not longer possible. |
|
The changes in adm_config_set.php are still a work in progress and require additional testing; I only performed basic tests, and there are a lot of corner cases related to parsing the user's input especially with associative and multi-dimentional arrays. I intentionally included these commits in the branch linked here, to benefit from additional testing - thanks for being a guinea pig ;) If you find additional issues related to adm_config_set.php (i.e. what happens after you click the "Set Configuration Option" button, it would be best to report them in 0013298 If you want to restrict your testing to current 1.2.x behavior for adm_config_set, you can use the following branch [1] instead. |
|
Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch |
|
MantisBT: master-1.2.x f8a81a33 2012-08-13 11:16 Committer: Damien Regad Details Diff |
fix 0014559 - Filter for adm_report_config.php Signed-off-by: Damien Regad <damien.regad@merckgroup.com> |
Affected Issues 0014559 |
|
mod - adm_config_report.php | Diff File | ||
mod - lang/strings_english.txt | Diff File | ||
mod - lang/strings_french.txt | Diff File | ||
MantisBT: master-1.2.x 259f95cd 2012-12-14 10:10 Details Diff |
Issue 0014559: improve adm_report_config.php filter The following changes were made - revised UI to make it more similar to the issues filter - make use of existing constants and language strings - filter defaults to All Users / All Projects / All options which avoids performance issues in installations having a large number of entries in the config table (workaround for issue 0013680) - filter form uses post instead of get method - comply to coding guidelines |
Affected Issues 0013680, 0014559 |
|
mod - adm_config_report.php | Diff File | ||
mod - lang/strings_english.txt | Diff File | ||
mod - lang/strings_french.txt | Diff File | ||
MantisBT: master-1.2.x 9f724904 2012-12-30 16:41 Details Diff |
Fix 1st uppercase letter for 'Filters' language string Affects issue 0014559 |
Affected Issues 0014559 |
|
mod - lang/strings_english.txt | Diff File | ||
MantisBT: master-1.2.x efdd6a75 2012-12-30 17:26 Details Diff |
Respect $g_show_realname setting in config report's filter userlist The filter's original implementation displayed "Realname (username)" in the user selection list. We now only retrieve the user id from the db, and call user_get_name() to get either the realname or the username as appropriate instead. Issue 0014559 |
Affected Issues 0014559 |
|
mod - adm_config_report.php | Diff File | ||
MantisBT: master-1.2.x 9dbfcd7d 2012-12-30 18:01 Details Diff |
Manage persistency of config report filter using a cookie A new cookie 'manage_config_cookie' was added to store the user's filter criteria. Includes documentation update to admin guide. Issue 0014559 |
Affected Issues 0014559 |
|
mod - adm_config_report.php | Diff File | ||
mod - config_defaults_inc.php | Diff File | ||
mod - core/helper_api.php | Diff File | ||
mod - docbook/administration_guide/en/configuration.sgml | Diff File | ||
MantisBT: master-1.2.x b6f03b73 2013-01-01 18:22 Details Diff |
Config report filter: added handling for invalid values in cookie In some cases, the cookie could contain values which are no longer applicable as filter criteria, e.g. - a project id which has been deleted - a user id for whom there are no config options - a config id for which there are no config options The code now correctly handles these, by making sure that either the filter criteria is dynamically updated to a valid value (ALL_PROJECTS for projects), or the filter's selection list effectively includes the invalid value (user id, config id), so that the displayed filter reflects the actual data listed in the Database Configuration table. Fixes the bug reported by atrol in issue 0014559's bugnote 34648 |
Affected Issues 0014559 |
|
mod - adm_config_report.php | Diff File | ||
MantisBT: master-1.2.x d76a2106 2013-01-02 06:46 Details Diff |
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 0014559 |
Affected Issues 0014559 |
|
mod - adm_config_report.php | Diff File | ||
mod - lang/strings_english.txt | Diff File | ||
MantisBT: master 0c81929d 2013-01-18 10:53 Details Diff |
Manage config page: added filtering Porting the following 1.2.x commits - f8a81a33880752364ea47bdd9a987bff986c81de - 259f95cdb5a1561f9401b8c05f1aeddf8f016c81 - 3f75f68b08b0c52d5b3b488034f99214977a5dab - 9f724904ec087cc1d07704cc387455f4c3c45068 - efdd6a7538ae2366b1dadb52e85fc5d95ae80c1c - 9dbfcd7dd612137c8f75ba644d921c43f1d0a9f9 - beea901ca69692b989ec19461c6609571b5da5a2 - 65696fbffa0c1a197ce7441483abe78bd0b813e1 - b6f03b73e9134d1001e77445e109de733562cb8a - 8b426cfc6c6ea7149beeafb352fa390dbf8c4624 - d76a21067e56aba847b650d17ad4e679392c7475 - c61dc631b4c37547a25e1306ed90aa09e9e1b837 Issue 0014559, 0015415 |
Affected Issues 0014559, 0015415 |
|
mod - adm_config_report.php | Diff File | ||
mod - config_defaults_inc.php | Diff File | ||
mod - core/helper_api.php | Diff File | ||
mod - core/obsolete.php | Diff File | ||
mod - css/default.css | Diff File | ||
mod - docbook/Admin_Guide/en-US/Configuration.xml | Diff File | ||
mod - lang/strings_english.txt | Diff File | ||
mod - manage_user_page.php | Diff File |