--- ../mantis-1.0.6/lang/strings_english.txt 2006-10-23 16:14:44.000000000 +0900
+++ lang/strings_english.txt 2007-03-30 14:46:32.000000000 +0900
@@ -138,6 +138,7 @@
$s_graph_imp_severity_title = 'Synthesis graphs by severity';
$s_graph_imp_category_title = 'Synthesis graphs by category';
$s_graph_imp_resolution_title = 'Synthesis graphs by resolution';
+$s_graph_imp_date_title = 'Sythesis graph by date';
$s_by_status_pct = 'by status percentage';
$s_by_priority_pct = 'by priority percentage';
$s_by_severity_pct = 'by severity percentage';
@@ -146,12 +147,17 @@
$s_by_severity_mix = 'by severity and status';
$s_by_priority_mix = 'by priority and status';
$s_by_resolution_mix = 'by resolution and status';
+$s_with_priority = 'with priority';
+$s_daily = 'Daily';
+$s_weekly = 'Weekly';
+$s_monthly = 'Monthly';
$s_synthesis_link = 'Synthesis';
$s_status_link = 'Per state';
$s_priority_link = 'Per priority';
$s_severity_link = 'Per severity';
$s_category_link = 'Per category';
$s_resolution_link = 'Per resolution';
+$s_date_link = 'Per date';
$s_legend_still_open = 'Still Open';
$s_legend_resolved = 'Resolved';
$s_legend_assigned = 'Assigned';
--- ../mantis-1.0.6/lang/strings_japanese_utf8.txt 2006-10-23 16:14:44.000000000 +0900
+++ lang/strings_japanese_utf8.txt 2007-03-30 16:17:36.000000000 +0900
@@ -140,6 +140,7 @@
$s_graph_imp_severity_title = '重要度によるグラフ';
$s_graph_imp_category_title = 'カテゴリによるグラフ';
$s_graph_imp_resolution_title = '分析状況によるグラフ';
+$s_graph_imp_date_title = '時系列によるグラフ';
$s_by_status_pct = 'ステータスパーセンテージ';
$s_by_priority_pct = '優先パーセンテージ';
$s_by_severity_pct = '重要度パーセンテージ';
@@ -148,12 +149,17 @@
$s_by_severity_mix = '重要度とステータス';
$s_by_priority_mix = '優先度とステータス';
$s_by_resolution_mix = '解決とステータス';
+$s_with_priority = '+ 優先度別';
+$s_daily = '日別';
+$s_weekly = '週別';
+$s_monthly = '月別';
$s_synthesis_link = '総合';
$s_status_link = 'ステータス別';
$s_priority_link = '優先度別';
$s_severity_link = '重要度別';
$s_category_link = 'カテゴリ別';
$s_resolution_link = '分析状況別';
+$s_date_link = '時系列別';
$s_legend_still_open = '未解決';
$s_legend_resolved = '解決済';
$s_legend_assigned = '割当済';
--- ../mantis-1.0.6/core/html_api.php 2006-09-09 14:47:14.000000000 +0900
+++ core/html_api.php 2007-03-29 18:35:17.000000000 +0900
@@ -600,7 +600,8 @@
PRINT '
' . lang_get( 'priority_link' ) . ' | ';
PRINT '
' . lang_get( 'severity_link' ) . ' | ';
PRINT '
' . lang_get( 'category_link' ) . ' | ';
- PRINT '
' . lang_get( 'resolution_link' ) . '';
+ PRINT '
' . lang_get( 'resolution_link' ) . ' | ';
+ PRINT '
' . lang_get( 'date_link' ) . '';
}
}
--- /dev/null 2007-04-10 15:51:58.000000000 +0900
+++ ./summary_graph_bydate.php 2007-04-10 14:19:37.000000000 +0900
@@ -0,0 +1,410 @@
+ $t_matches[1],
+ 'm' => $t_matches[2],
+ 'd' => $t_matches[3] );
+}
+
+function add_date( $p_d, $p_n ) {
+ preg_match( '/^(\d+)-(\d+)-(\d+)/', $p_d, $t_m );
+
+ $t_t = $p_n == INTERVAL_MONTH ?
+ mktime( 0, 0, 0, $t_m[2] + 1, 1, $t_m[1] ) :
+ mktime( 0, 0, 0, $t_m[2], $t_m[3] + $p_n, $t_m[1] );
+
+ return date( 'Y-m-d', $t_t );
+}
+
+function check_range( $p_range, $p_date ) {
+ preg_match ( '/^(\d+-\d+-\d+) - (\d+-\d+-\d+)$/', $p_range, $t_matches );
+// $t_v = $t_matches[1] <= $p_date && $p_date < $t_matches[2];
+// debug_r("$p_range, $p_date => " . ($t_v ? "true" : "false") . "\n");
+// return $t_v;
+ return $t_matches[1] <= $p_date && $p_date < $t_matches[2];
+}
+
+function get_custom_field_name( $t_fieldid ) {
+ $t_query = "SELECT name FROM mantis_custom_field_table
+ WHERE id='$t_fieldid'";
+ $t_result = db_query( $t_query );
+ return db_result( $t_result, 0, 0 );
+}
+
+function group_result_by_date( $p_data, $p_begin, $p_end, $p_interval ) {
+ $t_result = array();
+ $t_tmp = array();
+
+ $t_labels = array();
+ while ( $p_begin < $p_end ) {
+ $t_end = add_date( $p_begin, $p_interval );
+
+ switch ( $p_interval ) {
+ case INTERVAL_DAILY:
+ $t_labels[] = array( 'label' => $p_begin,
+ 'cond' => "$p_begin - $t_end" );
+ break;
+
+ case INTERVAL_MONTH:
+ preg_match( '/^(\d+-\d+)/', $p_begin, $t_matches );
+ $t_labels[] = array( 'label' => $t_matches[1],
+ 'cond' => "$p_begin - $t_end" );
+ break;
+
+ default:
+ $t_labels[] = array( 'label' => "$p_begin - $t_end",
+ 'cond' => "$p_begin - $t_end" );
+ break;
+ }
+
+ $p_begin = $t_end;
+ }
+
+ $t_current = array_shift( $t_labels );
+
+ foreach ( $p_data as $t_date => $t_value ) {
+ while ( $t_labels && !check_range( $t_current['cond'], $t_date ) ) {
+ $t_result[$t_current['label']] = $t_tmp;
+ $t_tmp = array();
+ $t_current = array_shift( $t_labels );
+ }
+
+ $t_tmp = array_merge( $t_tmp, $t_value );
+ }
+
+ $t_result[$t_current['label']] = $t_tmp;
+
+ foreach ( $t_labels as $t_label ) {
+ $t_result[$t_label['label']] = array();
+ }
+
+ return $t_result;
+}
+
+function graph_accbarplot( $p_metrics, $p_title, $p_legends,
+ $p_width, $p_height ) {
+ $t_graph_font = graph_get_font();
+
+ $graph = new Graph( $p_width, $p_height );
+ $graph->img->SetMargin( 45, 100, 35, 100 );
+ $graph->img->SetAntiAliasing();
+ $graph->SetScale('textlin');
+ $graph->SetMarginColor('white');
+ $graph->SetFrame(false);
+ $graph->title->SetFont( $t_graph_font, FS_BOLD );
+ $graph->title->Set($p_title);
+ if ( FF_FONT2 <= $t_graph_font ) {
+ $graph->xaxis->SetLabelAngle(60);
+ } else {
+ $graph->xaxis->SetLabelAngle(90);
+ }
+ $graph->xaxis->SetFont( $t_graph_font );
+ $graph->xaxis->SetTickLabels( array_keys( $p_metrics ) );
+ $graph->legend->Pos(0.05, 0.08);
+ $graph->legend->SetFont( $t_graph_font );
+ $graph->yaxis->scale->ticks->SetDirection(-1);
+ $graph->yaxis->SetFont( $t_graph_font );
+ $graph->yscale->SetGrace(10);
+
+ $t_plots = array();
+
+ foreach ( $p_legends as $t_label => $t_legend_attr ) {
+ $t_values = array();
+
+ foreach ( $p_metrics as $t_stat ) {
+ $t_values[] = $t_stat[$t_label];
+ }
+
+ $t_plot = new BarPlot( $t_values );
+ $t_plot->SetFillColor( $t_legend_attr['color'] );
+ $t_plot->SetLegend( $t_legend_attr['legend'] );
+ $t_plots[] = $t_plot;
+ }
+
+ $t_acc = new AccBarPlot( $t_plots );
+ $graph->Add( $t_acc );
+
+ if ( ON == config_get( 'show_queries_count' ) ) {
+ $graph->subtitle->Set( db_count_queries() . ' queries (' . db_count_unique_queries() . ' unique) (' . db_time_queries() . 'sec)' );
+ $graph->subtitle->SetFont( $t_graph_font, FS_NORMAL, 8 );
+ }
+
+ $graph->Stroke();
+}
+
+function generate_graph_total( $p_data, $p_title, $p_width, $p_height ) {
+ $t_metrics = array();
+
+ foreach ( $p_data as $t_label => $t_data ) {
+ $t_metrics[$t_label] = count( $t_data );
+ }
+
+ graph_bar( $t_metrics, $p_title, $p_width, $p_height );
+}
+
+function generate_graph_priority( $p_data, $p_title, $p_width, $p_height ) {
+ $t_priority_enum_strings = explode( ',',
+ lang_get( 'priority_enum_string' ) );
+ $t_priority_strings = array();
+
+ foreach ( $t_priority_enum_strings as $t_string ) {
+ $t_enum = explode( ':', $t_string );
+ $t_priority_strings[$t_enum[0]] = $t_enum[1];
+ }
+
+ $t_legends = array();
+ $t_legends['immediate'] = array( 'color' => 'goldenrod2',
+ 'legend' => $t_priority_strings[60] );
+ $t_legends['urgent'] = array( 'color' => 'lemonchiffon1',
+ 'legend' => $t_priority_strings[50] );
+ $t_legends['high'] = array( 'color' => 'cadetblue3',
+ 'legend' => $t_priority_strings[40] );
+ $t_legends['normal'] = array( 'color' => 'chartreuse3',
+ 'legend' => $t_priority_strings[30] );
+ $t_legends['low'] = array( 'color' => 'cyan4',
+ 'legend' => $t_priority_strings[20] );
+ $t_legends['none'] = array( 'color' => 'cyan3',
+ 'legend' => $t_priority_strings[10] );
+
+ $t_metrics = array();
+
+ foreach ( $p_data as $t_label => $t_value ) {
+ $t_tmp = array( 'none' => 0, 'low' => 0, 'normal' => 0,
+ 'high' => 0, 'urgent' => 0, 'immediate' => 0 );
+
+ foreach ( $t_value as $t_pri ) {
+ switch ( $t_pri['priority'] ) {
+ case 10: $t_tmp['none']++; break;
+ case 20: $t_tmp['low']++; break;
+ case 30: $t_tmp['normal']++; break;
+ case 40: $t_tmp['high']++; break;
+ case 50: $t_tmp['urgent']++; break;
+ case 60: $t_tmp['immediate']++; break;
+ }
+ }
+
+ $t_metrics[$t_label] = $t_tmp;
+ }
+
+ graph_accbarplot( $t_metrics, $p_title, $t_legends, $p_width, $p_height );
+}
+
+function generate_graph_custom( $p_data, $p_title, $p_width, $p_height ) {
+ $t_colors = array( 'goldenrod2', 'lemonchiffon1', 'cadetblue3',
+ 'chartreuse3', 'cyan4', 'cyan3', 'darkorchid',
+ 'hotpink', 'gold1', 'greenyellow' );
+ $i = 0;
+ $t_legends = array();
+ $t_metrics = array();
+
+ foreach ( $p_data as $t_label => $t_values ) {
+ foreach ( $t_values as $t_value ) {
+ $t_value = $t_value[0];
+
+ if ( !array_key_exists( $t_value, $t_legends ) ) {
+ $t_legends[$t_value] =
+ array ( 'legend' => $t_value,
+ 'color' => $t_colors[$i % count($t_colors)] );
+ $i++;
+ }
+ }
+ }
+
+ foreach ( $p_data as $t_label => $t_values ) {
+ $t_tmp = array();
+
+ foreach ( $t_legends as $t_legend ) {
+ $t_tmp[$t_legend['legend']] = 0;
+ }
+
+ foreach ( $t_values as $t_value ) {
+ $t_tmp[$t_value[0]]++;
+ }
+
+ $t_metrics[$t_label] = $t_tmp;
+ }
+
+ graph_accbarplot( $t_metrics, $p_title, $t_legends, $p_width, $p_height );
+}
+
+function generate_graph( $p_mode, $p_range, $p_width, $p_height ) {
+ $t_title = $t_interval = $t_length = $t_query = $t_fieldid =
+ $t_begin = $t_end = null;
+
+ switch ( $p_range ) {
+ case 'daily':
+ $t_title = lang_get( 'daily' );
+ $t_interval = INTERVAL_DAILY;
+ $t_length = 30;
+ $t_past = ($t_interval * $t_length) - 1;
+ $t_begin = date( 'Y-m-d', strtotime( "-$t_past day" ) );
+ $t_end = date( 'Y-m-d', strtotime( '+1 day' ) );
+ break;
+
+ case 'weekly':
+ $t_title = lang_get( 'weekly' );
+ $t_interval = INTERVAL_WEEKLY;
+ $t_length = 12;
+ $t_past = $t_length * 7;
+ $t_dow = date( 'w' );
+ $t_begin = date( 'Y-m-d',
+ mktime( 0, 0, 0,
+ date( 'm' ),
+ date( 'd' ) + 7 - $t_dow - $t_past,
+ date( 'Y' ) ) );
+ $t_end = date( 'Y-m-d',
+ mktime( 0, 0, 0,
+ date( 'm' ),
+ date( 'd' ) + 7 - $t_dow,
+ date( 'Y' ) ) );
+// $t_begin = date( 'Y-m-d', strtotime( "+1 Sunday -$t_past day" ) );
+// $t_end = date( 'Y-m-d', strtotime( '+1 Sunday' ) );
+ break;
+
+ case 'monthly':
+ $t_title = lang_get( 'monthly' );
+ $t_interval = INTERVAL_MONTH;
+ $t_length = LENGTH_INFINITY;
+
+ if ( $t_length != LENGTH_INFINITY ) {
+ $t_begin = date( 'Y-m-d',
+ mktime( 0, 0, 0,
+ date( 'm' ) - $t_length + 1,
+ 1, date( 'Y' ) ) );
+ } else {
+ $t_start = db_get_start_day();
+ $t_begin = date( 'Y-m-d',
+ mktime( 0, 0, 0,
+ $t_start['m'], 1, $t_start['Y'] ) );
+ }
+
+ $t_end = date( 'Y-m-d',
+ mktime( 0, 0, 0,
+ date( 'm' ) + 1, 1, date( 'Y' ) ) );
+ break;
+ }
+
+ $t_project_id = helper_get_current_project();
+
+ switch ( $p_mode ) {
+ case 'total':
+ $t_query = "SELECT date_submitted
+ FROM mantis_bug_table
+ WHERE project_id = '$t_project_id' AND
+ date_submitted >= '$t_begin' AND
+ date_submitted < '$t_end'";
+ break;
+
+ case 'priority':
+ $t_query = "SELECT date_submitted, priority
+ FROM mantis_bug_table
+ WHERE project_id = '$t_project_id' AND
+ date_submitted >= '$t_begin' AND
+ date_submitted < '$t_end'";
+ break;
+
+ default:
+ if ( preg_match( '/^custom(\d+)$/', $p_mode, $t_matches ) ) {
+ $t_fieldid = $t_matches[1];
+
+ $t_query = "SELECT b.date_submitted, s.value
+ FROM mantis_bug_table AS b,
+ mantis_custom_field_string_table AS s
+ WHERE b.id = s.bug_id AND
+ b.project_id = '$t_project_id' AND
+ s.field_id = '$t_fieldid' AND
+ b.date_submitted >= '$t_begin' AND
+ b.date_submitted < '$t_end'";
+ }
+ break;
+ }
+
+ $t_data = db_query_with_date( $t_query );
+ $t_data = group_result_by_date( $t_data, $t_begin, $t_end, $t_interval );
+
+ switch ( $p_mode ) {
+ case 'total':
+ generate_graph_total( $t_data, $t_title, $p_width, $p_height );
+ break;
+
+ case 'priority':
+ $t_title .= ' ' . lang_get( 'with_priority' );
+ generate_graph_priority( $t_data, $t_title, $p_width, $p_height );
+ break;
+
+ default:
+ if ( $t_fieldid !== null ) {
+ $tltitle .= ' (' . get_custom_field_name( $t_fieldid ) . ')';
+ generate_graph_custom( $t_data, $t_title, $p_width, $p_height );
+ }
+ }
+}
+
+?>
+
--- /dev/null 2007-04-10 15:51:58.000000000 +0900
+++ ./summary_graph_imp_date.php 2007-04-02 15:51:38.000000000 +0900
@@ -0,0 +1,72 @@
+';
+
+print_menu_graph();
+
+$t_width = config_get( 'graph_window_width' );
+$t_graph_width = (int) ( ( $t_width - 50 ) * 0.6 );
+?>
+
+
+
| + + | +
|
+ |
+
|
+ |
+
|
+ |
+
|
+ |
+
|
+ |
+
|
+ |
+
|
+ |
+
|
+ |
+
|
+ |
+