View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004314 | mantisbt | feature | public | 2004-08-11 14:24 | 2005-04-18 10:35 |
Reporter | bpfennig | Assigned To | bpfennig | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Fixed in Version | 1.0.0a1 | ||||
Summary | 0004314: Bug status percentage | ||||
Description | I've created a "bug status percentage" row. This row shows the percentage of bug status. See attachment for an example. 29% of all bugs are new, 20% of all bugs are assigned and so on. If anybody is interested in ... | ||||
Tags | No tags attached. | ||||
Attached Files | patch_0004314.txt (3,947 bytes)
cvs -z3 diff -u html_api.php (in directory D:\cvsroot\mantisbt\core) Index: html_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/html_api.php,v retrieving revision 1.139 diff -u -r1.139 html_api.php --- html_api.php 25 Oct 2004 01:34:28 -0000 1.139 +++ html_api.php 4 Nov 2004 18:17:36 -0000 @@ -54,6 +54,8 @@ require_once( $t_core_dir . 'bug_api.php' ); require_once( $t_core_dir . 'project_api.php' ); require_once( $t_core_dir . 'helper_api.php' ); + require_once( $t_core_dir . 'authentication_api.php' ); + require_once( $t_core_dir . 'user_api.php' ); $g_rss_feed_url = null; @@ -686,6 +688,63 @@ } # -------------------- + # Print the legend for the status percentage + function html_status_percentage_legend() { + $t_mantis_bug_table = config_get( 'mantis_bug_table' ); + $t_project_id = helper_get_current_project(); + $t_user_id = auth_get_current_user_id(); + + #checking if it's a per project statistic or all projects + if ( ALL_PROJECTS == $t_project_id ) { + # Only projects to which the user have access + $t_accessible_projects_array = user_get_accessible_projects( $t_user_id ); + if ( count( $t_accessible_projects_array ) > 0 ) { + $specific_where = ' (project_id='. implode( ' OR project_id=', $t_accessible_projects_array ).')'; + } else { + $specific_where = '1=1'; + } + } else { + $specific_where = " project_id='$t_project_id'"; + } + + $query = "SELECT status + FROM $t_mantis_bug_table + WHERE $specific_where + ORDER BY status"; + $result = db_query( $query ); + + $bug_count = db_num_rows( $result ); + $t_status_array = array(); + + while ( $row = db_fetch_array( $result ) ) { + $t_status_array[] = $row[status]; + } + + $t_status_count_array = array_count_values( $t_status_array ); + + PRINT '<br />'; + PRINT '<table class="width100" cellspacing="0">'; + PRINT '<tr>'; + + + $t_arr = explode_enum_string( config_get( 'status_enum_string' ) ); + $enum_count = count( $t_arr ); + for ( $i=0; $i < $enum_count; $i++) { + $t_s = explode_enum_arr( $t_arr[$i] ); + $t_color = get_status_color( $t_s[0] ); + $width = round( ( $t_status_count_array[ $t_s[0] ] / $bug_count ) * 100 ); + + if ($width > 0) { + PRINT "<td class=\"small-caption-center\" width=\"$width%\" bgcolor=\"$t_color\">$width%</td>"; + } + } + + PRINT '</tr>'; + PRINT '</table>'; + } + + + # -------------------- # Print an html button inside a form function html_button ( $p_action, $p_button_text, $p_fields = null ) { $p_action = urlencode( $p_action ); cvs -z3 diff -u my_view_page.php (in directory D:\cvsroot\mantisbt\) Index: my_view_page.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/my_view_page.php,v retrieving revision 1.8 diff -u -r1.8 my_view_page.php --- my_view_page.php 7 Aug 2004 16:47:50 -0000 1.8 +++ my_view_page.php 4 Nov 2004 18:25:19 -0000 @@ -54,6 +54,13 @@ echo '</td>'; echo '</tr>'; } + if ( ON == config_get( 'status_percentage_legend' ) ) { + echo '<tr>'; + echo '<td colspan="2">'; + html_status_percentage_legend(); + echo '</td>'; + echo '</tr>'; + } ?> <?php cvs -z3 diff -u config_defaults_inc.php (in directory D:\cvsroot\mantisbt\) Index: config_defaults_inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v retrieving revision 1.219 diff -u -r1.219 config_defaults_inc.php --- config_defaults_inc.php 17 Oct 2004 00:14:27 -0000 1.219 +++ config_defaults_inc.php 4 Nov 2004 18:24:56 -0000 @@ -559,6 +559,8 @@ $g_default_email_on_priority_minimum_severity = 'any'; # @@@ Unused $g_default_email_bugnote_limit = 0; # default_language - is set to site language + + $g_status_percentage_legend = ON; ############################### # Mantis Summary Settings | ||||
Looks cool! The question is where to put it... |
|
I've now put it in "My View" but it could be placed in "View Issues" as well. Maybe I could add a global configuration setting to enable or disable. |
|
Alright, experiment with it a little. |
|
bpfennig, do you have the code for this? I would like to include this in our project. Thanks |
|
I've attached the patch to this bug! |
|
The patch works great! Thanks |
|
Commited to CVS. |
|