1<?php
2# ---------------------------------------------------------------------
3# rth is a requirement, test, and bugtracking system
4# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
5# This program is distributed under the terms and conditions of the GPL
6# See the README and LICENSE files for details
7#----------------------------------------------------------------------
8# ------------------------------------
9# Report Signoff Page
10#
11# $RCSfile: report_signoff_page.php,v $  $Revision: 1.6 $
12# ------------------------------------
13
14include"./api/include_api.php";
15auth_authenticate_user();
16
17$project_name = session_get_project_name();
18$page         = basename(__FILE__);
19
20$s_project_properties   = session_get_project_properties();
21$project_name           = $s_project_properties['project_name'];
22$project_id 			= $s_project_properties['project_id'];
23
24$row_style = '';
25
26$order_by		= TEST_NAME;
27$order_dir		= "ASC";
28$page_number	= 1;
29
30util_set_order_by($order_by, $_POST);
31util_set_order_dir($order_dir, $_POST);
32util_set_page_number($page_number, $_POST);
33
34if( isset($_GET['_release_id']) ) {
35	$release_id 	= $_GET['_release_id'];;
36}
37
38if( isset($_GET['_build_id']) ) {
39	$build_id 		= $_GET['_build_id'];
40}
41
42if( isset($_GET['_testset_id']) ) {
43	$testset_id 	= $_GET['_testset_id'];
44}
45
46html_window_title();
47html_print_body();
48html_page_title($project_name ." - " . lang_get('report_signoff_page') );
49html_page_header( $db, $project_name );
50html_print_menu();
51html_browse_release_menu($db, $page, $project_id);
52
53error_report_check($_GET);
54
55print"<div align=center>";
56print"<br>". NEWLINE;
57
58if( isset( $testset_id ) && $testset_id != 'all' ) {
59$g_timer->mark_time( "Image" );
60
61	$testset_status 				= report_get_testset_status( $testset_id );
62	$testset_num_of_tests 			= $testset_status[0];
63	$testset_num_of_passed 			= $testset_status[1];
64	$testset_num_of_failed 			= $testset_status[2];
65	$testset_num_of_awaiting_review	= $testset_status[3];
66	$testset_num_of_wip				= $testset_status[4];
67	$testset_num_of_not_running		= $testset_status[5];
68	$testset_num_of_not_started		= $testset_status[6];
69
70	$build_status 					= report_get_build_status( $build_id );
71	$build_date_received 			= $build_status[0];
72	$build_num_of_test_sets 		= $build_status[1];
73	$build_num_of_tests 			= $build_status[2];
74	$build_num_of_passed 			= $build_status[3];
75	$build_num_of_failed 			= $build_status[4];
76	$build_num_of_awaiting_review	= $build_status[5];
77	$build_num_of_wip				= $build_status[6];
78	$build_num_of_not_running		= $build_status[7];
79	$build_num_of_not_started		= $build_status[8];
80
81	$project_status 				= report_get_project_status( $project_id );
82	$project_num_of_test_sets 		= $project_status[0];
83	$project_num_of_tests 			= $project_status[1];
84	$project_num_of_passed 			= $project_status[2];
85	$project_num_of_failed 			= $project_status[3];
86	$project_num_of_awaiting_review	= $project_status[4];
87	$project_num_of_wip				= $project_status[5];
88	$project_num_of_not_running		= $project_status[6];
89	$project_num_of_not_started		= $project_status[7];
90
91	$pc_tests_not_run				= 100/$project_num_of_tests * ($project_num_of_tests- $testset_num_of_tests);
92
93	$pc_passed_in_project			= 100/$project_num_of_tests*$testset_num_of_passed;
94	$pc_failed_in_project			= 100/$project_num_of_tests*$testset_num_of_failed;
95	$pc_awaiting_review_in_project	= 100/$project_num_of_tests*$testset_num_of_awaiting_review;
96	$pc_wip_in_project				= 100/$project_num_of_tests*$testset_num_of_wip;
97	$pc_not_started_in_project		= 100/$project_num_of_tests*$testset_num_of_not_started;
98	$pc_not_running_in_project		= 100/$project_num_of_tests*$testset_num_of_not_running;
99
100
101	if( $testset_num_of_tests == 0 ) {
102		print"<p class='error'>". lang_get('no_tests_testset') ."</p>";
103	}
104	# start img pie chart
105	print"<img src=\"./images/pie_chart_2_image.php";
106	# chart title
107	print"?graph_title=".lang_get("status_of")." ".admin_get_build_name($build_id).", ".admin_get_release_name($release_id);
108	# legend
109	print"&amp;legend=";
110	print"'Passed',";
111	print"'Failed',";
112	print"'Awaiting Review',";
113	print"'WIP',";
114	print"'Not Running',";
115	print"'Not Started'";
116	//results_get_teststatus_by_project( $project_id );
117
118	# pie 1 title
119	print"&amp;p1_title=". lang_get("all_tests_in") ." ". $project_name;
120	# theme
121	print"&amp;p1_theme=test";
122
123	# pie 1 data
124	print"&amp;p1_data=";
125	print"$pc_passed_in_project,";
126	print"$pc_failed_in_project,";
127	print"$pc_awaiting_review_in_project,";
128	print"$pc_wip_in_project,";
129	print"$pc_not_running_in_project,";
130	print"$pc_not_started_in_project,";
131
132
133
134	# pie 2 title
135	print"&amp;p2_title=".lang_get("tests_in_ts")." ".admin_get_testset_name($testset_id);
136	# pie 2 theme
137	print"&amp;p2_theme=test";
138
139	# pie 2 data
140	print"&amp;p2_data=";
141	print"$testset_num_of_passed,";
142	print"$testset_num_of_failed,";
143	print"$testset_num_of_awaiting_review,";
144	print"$testset_num_of_wip,";
145	print"$testset_num_of_not_running,";
146	print"$testset_num_of_not_started,";
147	# end img
148	print"\">". NEWLINE;
149
150	$g_timer->mark_time( "First Table" );
151
152	print"<br><br>". NEWLINE;
153
154	print"<form method=post action='$page?_release_id=$release_id&amp;_build_id=$build_id'>";
155	print"<table class=width80 rules=all>". NEWLINE;
156	print"<tr>". NEWLINE;
157	html_tbl_print_header( "" );
158	html_tbl_print_header( lang_get('total') );
159	html_tbl_print_header( lang_get('percent_of_all_tests') );
160	html_tbl_print_header( lang_get('percent_of_tests_in_ts') );
161	print"</tr>". NEWLINE;
162
163	# TOTAL NUMBER OF TESTS
164	$row_style = html_tbl_alternate_bgcolor($row_style);
165	print"<tr class=$row_style>". NEWLINE;
166	html_tbl_print_header( lang_get("tot_num_tests") );
167	print"<td>$project_num_of_tests</td>". NEWLINE;
168	print"<td>100%</td>". NEWLINE;
169	print"<td>-</td>". NEWLINE;
170	print"</tr>". NEWLINE;
171
172	# NUMBER OF TESTS IN TEST SET
173	$row_style = html_tbl_alternate_bgcolor($row_style);
174	if( $project_num_of_tests > 0 ) {
175		$pc_tests_in_ts = sprintf( "%01.2f", (100/$project_num_of_tests*$testset_num_of_tests) );
176	} else {
177		$pc_tests_in_ts = "0.00";
178	}
179	print"<tr class=$row_style>". NEWLINE;
180	html_tbl_print_header( lang_get("tests_in_ts") );
181	print"<td>$testset_num_of_tests</td>". NEWLINE;
182	print"<td>$pc_tests_in_ts%</td>". NEWLINE;
183	print"<td>100%</td>". NEWLINE;
184	print"</tr>". NEWLINE;
185
186	# NUMBER OF PASSED
187	$row_style = html_tbl_alternate_bgcolor($row_style);
188	if( $project_num_of_tests ) {
189		$pc_passed_in_project = sprintf( "%01.2f", $pc_passed_in_project );
190	} else {
191		$pc_passed_in_project = "0.00";
192	}
193	if( $project_num_of_tests > 0 && $testset_num_of_passed > 0 ) {
194		$pc_passed_in_ts = sprintf( "%01.2f", (100/$testset_num_of_tests*$testset_num_of_passed) );
195	} else {
196		$pc_passed_in_ts = "0.00";
197	}
198	print"<tr class=$row_style>". NEWLINE;
199	html_tbl_print_header( "Passed" );
200	print"<td>$testset_num_of_passed</td>". NEWLINE;
201	print"<td>$pc_passed_in_project%</td>". NEWLINE;
202	print"<td>$pc_passed_in_ts%</td>". NEWLINE;
203	print"</tr>". NEWLINE;
204
205	# NUMBER OF FAILED
206	$row_style = html_tbl_alternate_bgcolor($row_style);
207	if( $project_num_of_tests ) {
208		$pc_failed_in_project = sprintf( "%01.2f", $pc_failed_in_project );
209	} else {
210		$pc_failed_in_project = "0.00";
211	}
212	if( $project_num_of_tests > 0 && $testset_num_of_failed > 0 ) {
213		$pc_failed_in_ts = sprintf( "%01.2f", (100/$testset_num_of_tests*$testset_num_of_failed) );
214	} else {
215		$pc_failed_in_ts = "0.00";
216	}
217	print"<tr class=$row_style>". NEWLINE;
218	html_tbl_print_header( "Failed" );
219	print"<td>$testset_num_of_failed</td>". NEWLINE;
220	print"<td>$pc_failed_in_project%</td>". NEWLINE;
221	print"<td>$pc_failed_in_ts%</td>". NEWLINE;
222	print"</tr>". NEWLINE;
223
224	# NUMBER FINISHED: AWAITING REVIEW
225	$row_style = html_tbl_alternate_bgcolor($row_style);
226	if( $project_num_of_tests ) {
227		$pc_awaiting_review_in_project = sprintf( "%01.2f", $pc_awaiting_review_in_project );
228	} else {
229		$pc_awaiting_review_in_project = "0.00";
230	}
231	if( $project_num_of_tests > 0 && $testset_num_of_awaiting_review > 0 ) {
232		$pc_awaiting_review_in_ts = sprintf( "%01.2f", (100/$testset_num_of_tests*$testset_num_of_awaiting_review) );
233	} else {
234		$pc_awaiting_review_in_ts = "0.00";
235	}
236	print"<tr class=$row_style>". NEWLINE;
237	html_tbl_print_header( "Finished: Awaiting Review" );
238	print"<td>$testset_num_of_awaiting_review</td>". NEWLINE;
239	print"<td>$pc_awaiting_review_in_project%</td>". NEWLINE;
240	print"<td>$pc_awaiting_review_in_ts%</td>". NEWLINE;
241	print"</tr>". NEWLINE;
242
243	# NUMBER WIP
244	$row_style = html_tbl_alternate_bgcolor($row_style);
245	if( $project_num_of_tests ) {
246		$pc_wip_in_project = sprintf( "%01.2f", $pc_wip_in_project );
247	} else {
248		$pc_wip_in_project = "0.00";
249	}
250	if( $project_num_of_tests > 0 && $testset_num_of_wip > 0 ) {
251		$pc_wip_in_ts = sprintf( "%01.2f", (100/$testset_num_of_tests*$testset_num_of_wip) );
252	} else {
253		$pc_wip_in_ts = "0.00";
254	}
255	print"<tr class=$row_style>". NEWLINE;
256	html_tbl_print_header( "WIP" );
257	print"<td>$testset_num_of_wip</td>". NEWLINE;
258	print"<td>$pc_wip_in_project%</td>". NEWLINE;
259	print"<td>$pc_wip_in_ts%</td>". NEWLINE;
260	print"</tr>". NEWLINE;
261
262	# NUMBER NOT RUNNING
263	$row_style = html_tbl_alternate_bgcolor($row_style);
264	if( $project_num_of_tests ) {
265		$pc_not_running_in_project = sprintf( "%01.2f", $pc_not_running_in_project );
266	} else {
267		$pc_not_running_in_project = "0.00";
268	}
269	if( $project_num_of_tests > 0 && $testset_num_of_not_running > 0 ) {
270		$pc_not_running_in_ts = sprintf( "%01.2f", (100/$testset_num_of_tests*$testset_num_of_not_running) );
271	} else {
272		$pc_not_running_in_ts = "0.00";
273	}
274	print"<tr class=$row_style>". NEWLINE;
275	html_tbl_print_header( "Not Running" );
276	print"<td>$testset_num_of_not_running</td>". NEWLINE;
277	print"<td>$pc_not_running_in_project%</td>". NEWLINE;
278	print"<td>$pc_not_running_in_ts%</td>". NEWLINE;
279	print"</tr>". NEWLINE;
280
281	# NUMBER NOT STARTED
282	$row_style = html_tbl_alternate_bgcolor($row_style);
283	if( $project_num_of_tests ) {
284		$pc_not_started_in_project = sprintf( "%01.2f", $pc_not_started_in_project );
285	} else {
286		$pc_not_started_in_project = "0.00";
287	}
288	if( $project_num_of_tests > 0 && $testset_num_of_not_started > 0 ) {
289		$pc_not_started_in_ts = sprintf( "%01.2f", (100/$testset_num_of_tests*$testset_num_of_not_started) );
290	} else {
291		$pc_not_started_in_ts = "0.00";
292	}
293	print"<tr class=$row_style>". NEWLINE;
294	html_tbl_print_header( "Not Started" );
295	print"<td>$testset_num_of_not_started</td>". NEWLINE;
296	print"<td>$pc_not_started_in_project%</td>". NEWLINE;
297	print"<td>$pc_not_started_in_ts%</td>". NEWLINE;
298	print"</tr>". NEWLINE;
299
300	print"</table>". NEWLINE;
301	print"</form>";
302
303	print"<br><br>". NEWLINE;
304
305	$g_timer->mark_time( "Second Table" );
306
307	$test_signoff_details = report_get_test_signoff_details($testset_id, $order_by, $order_dir, $page);
308
309	if( !empty($test_signoff_details) ) {
310		print"<form method=post action='$page?_release_id=$release_id&amp;_build_id=$build_id&amp;_testset_id=$testset_id'>";
311		print"<table class=width100 rules=cols>". NEWLINE;
312		print"<tr>". NEWLINE;
313		html_tbl_print_header( "" );
314		html_tbl_print_header( lang_get('test_name'), 		TEST_NAME, 					$order_by, $order_dir);
315		html_tbl_print_header( lang_get('area_tested'),		TEST_AREA_TESTED, 			$order_by, $order_dir);
316		html_tbl_print_header( lang_get('test_assigned_to'),TEST_TS_ASSOC_ASSIGNED_TO,	$order_by, $order_dir);
317		html_tbl_print_header( lang_get('test_status'), 	TEST_TS_ASSOC_STATUS, 		$order_by, $order_dir);
318		html_tbl_print_header( "" );
319		html_tbl_print_header( lang_get('os') );
320		html_tbl_print_header( lang_get('info'), 			TEST_TS_ASSOC_COMMENTS, 	$order_by, $order_dir);
321		html_tbl_print_header( lang_get('time_tested') );
322		html_tbl_print_header( lang_get('time_approved'), 	TEST_TS_ASSOC_TIMESTAMP, 	$order_by, $order_dir);
323		print"</tr>". NEWLINE;
324
325		foreach($test_signoff_details as $row_test_signoff) {
326
327			$row_style = html_tbl_alternate_bgcolor($row_style);
328
329			$last_test_run	= test_get_last_run($row_test_signoff[TEST_ID], $testset_id);
330
331			$os				= $last_test_run[TEST_RESULTS_OS];
332			$time_started	= $last_test_run[TEST_RESULTS_TIME_STARTED];
333
334			print"<tr class='$row_style'>". NEWLINE;
335			print"<td>".html_print_testtype_icon( $row_test_signoff[TEST_MANUAL], $row_test_signoff[TEST_AUTOMATED] )."</td>". NEWLINE;
336			print"<td>".$row_test_signoff[TEST_NAME]."</td>". NEWLINE;
337			print"<td>".$row_test_signoff[TEST_AREA_TESTED]."</td>". NEWLINE;
338			print"<td>";
339				if( !empty($row_test_signoff[TEST_TS_ASSOC_ASSIGNED_TO]) ) {
340					print $row_test_signoff[TEST_TS_ASSOC_ASSIGNED_TO];
341				} else {
342					print"Not Assigned";
343				}
344			print"</td>". NEWLINE;
345			print"<td>";
346				if( !empty($row_test_signoff[TEST_TS_ASSOC_STATUS]) ) {
347					print $row_test_signoff[TEST_TS_ASSOC_STATUS];
348				} else {
349					print"Not Used";
350				}
351			print"</td>". NEWLINE;
352			if( isset($row_test_signoff[TEST_TS_ASSOC_STATUS]) ) {
353				print results_verfication_status_icon( $row_test_signoff[TEST_TS_ASSOC_STATUS] );
354			} else {
355				print"<td></td>";
356			}
357			print"<td>$os</td>". NEWLINE;
358			print"<td>";
359				if( isset($row_test_signoff[TEST_TS_ASSOC_COMMENTS]) ) {
360					print html_info_icon( $row_test_signoff[TEST_TS_ASSOC_COMMENTS] );
361				}
362			print"</td>". NEWLINE;
363			print"<td>$time_started</td>". NEWLINE;
364			print"<td>";
365				if( isset($row_test_signoff[TEST_TS_ASSOC_TIMESTAMP]) ) {
366					print $row_test_signoff[TEST_TS_ASSOC_TIMESTAMP];
367				}
368			print"</td>". NEWLINE;
369
370			print"</tr>". NEWLINE;
371		}
372		print"</table>". NEWLINE;
373		print"</form>";
374		print"<br><br>". NEWLINE;
375	}
376}
377
378print"</div>";
379
380html_print_footer();
381
382
383# ------------------------------------
384# $Log: report_signoff_page.php,v $
385# Revision 1.6  2006/08/05 22:08:37  gth2
386# adding NEWLINE constant to support multiple OS newline chars - gth
387#
388# Revision 1.5  2006/06/10 01:55:06  gth2
389# no message
390#
391# Revision 1.4  2006/02/24 11:37:48  gth2
392# update to div - class=div-c not working in firefox - gth
393#
394# Revision 1.3  2006/01/14 19:08:05  gth2
395# accounting for division by zero error - gth
396#
397# Revision 1.2  2005/12/08 19:39:51  gth2
398# updating reports containing calls to jp-graph - gth
399#
400# Revision 1.1.1.1  2005/11/30 23:00:57  gth2
401# importing initial version - gth
402#
403# ------------------------------------
404?>