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# Test Detail Page
10#
11# $RCSfile: test_detail_page.php,v $  $Revision: 1.15 $
12# ---------------------------------------------------------------------
13
14include"./api/include_api.php";
15
16auth_authenticate_user();
17$step_action="";
18$step_expected="";
19
20$page						= basename(__FILE__);
21$update_action_page			= 'test_detail_update_page.php';
22$copy_action_page			= 'test_detail_copy_page.php';
23$add_version_page			= 'test_add_version_page.php';
24$delete_page				= 'delete_page.php';
25$new_upload_action_page		= 'test_detail_new_upload_action.php';
26$row_test_step_add_action_page  = 'test_step_add_action.php';
27$row_test_step_renumber_page    = 'test_step_renumber_action.php';
28$row_test_step_edit_page		= 'test_step_edit_page.php';
29$delete_page				= 'delete_page.php';
30$active_version_page		= 'test_version_make_active_action.php';
31$test_page					= 'test_page.php';
32#$row_test_step_delete_page		= 'delete_page.php';
33
34$num                    = 0;
35$bg_color               = '';
36$row_style				= '';
37
38$project_id				= $_GET['project_id'];
39$s_test_details			= session_set_properties("test", $_GET);
40$test_id				= $s_test_details['test_id'];
41$s_user_properties		= session_get_user_properties();
42$s_user_id				= $s_user_properties['user_id'];
43$test_name 				= test_get_name( $test_id );
44
45
46#validation of several item existence
47$pm = project_get_name($project_id);
48if( !empty($pm) ) {
49
50    $project_name = project_get_name($project_id);
51} else {
52
53 	error_report_show('login.php', PROJECT_NOT_EXISTS);
54}
55
56if( !user_has_rights($project_id, $s_user_id, USER)){
57	error_report_show('login.php', NO_RIGHTS_TO_VIEW_PROJECT);
58}
59
60if( !test_id_exists($project_id, $test_id)){
61	error_report_show('login.php', TEST_NOT_EXISTS);
62}
63
64session_set_new_project_name($project_name);
65session_reset_project();
66session_initialize();
67
68session_setLogged_in(TRUE);
69session_set_application_details( $project_name, session_get_username() );
70
71
72$s_user_properties		= session_get_user_properties();
73$s_project_properties   = session_get_project_properties();
74$s_show_options 		= session_get_show_options();
75$s_test_details			= session_set_properties("test", $_GET);
76$teststep_display_options= session_set_display_options("test_steps", $_POST);
77
78$s_user_id				= $s_user_properties['user_id'];
79$s_username				= $s_user_properties['username'];
80$s_tempest_admin		= $s_user_properties['tempest_admin'];
81$s_project_rights		= $s_user_properties['project_rights'];
82$s_delete_rights		= $s_user_properties['delete_rights'];
83$s_email				= $s_user_properties['email'];
84
85$order_by				= $teststep_display_options['order_by'];
86$order_dir				= $teststep_display_options['order_dir'];
87
88#$project_name           = $s_project_properties['project_name'];
89#$project_id				= $s_project_properties['project_id'];
90
91
92
93
94$show_priority 			= $s_show_options['show_priority'];
95
96$test_id				= $s_test_details['test_id'];
97//$test_version_id		= $s_test_details['test_version_id'];
98
99$redirect_url			= $page . "?test_id=". $test_id ."&project_id=". $project_id;
100
101$test_name 				= test_get_name( $test_id );
102
103session_set_display_options('test_detail', $_POST);
104$s_test_detail_options 	= session_set_display_options('test_detail', $_GET);
105$s_tab					= $s_test_detail_options['tab'];
106$s_page_number			= $s_test_detail_options['page_number'];
107
108if( isset($_GET['test_id']) ) {
109
110	$s_page_number = 1;
111}
112
113
114if( isset($_GET['failed']) ) {
115	$is_validation_failure = $_GET['failed'];
116} else {
117	$is_validation_failure = false;
118}
119
120
121
122$project_manager		= user_has_rights( $project_id, $s_user_id, MANAGER );
123$user_has_delete_rights	= ($s_delete_rights==="Y" || $project_manager);
124
125
126html_window_title();
127html_print_body();
128html_page_title($project_name ." - ". lang_get('test_detail_page') );
129html_page_header( $db, $project_name );
130html_print_menu();
131
132test_menu_print($page);
133
134error_report_check( $_GET );
135
136$row = test_get_detail( $test_id );
137
138$test_name       	= $row[TEST_NAME];
139$test_purpose    	= $row[TEST_PURPOSE];
140$test_comments		= $row[TEST_COMMENTS];
141$ba_owner        	= $row[TEST_BA_OWNER];
142$qa_owner        	= $row[TEST_QA_OWNER];
143$tester	        	= $row[TEST_TESTER];
144$test_type       	= $row[TEST_TESTTYPE];
145$area_tested     	= $row[TEST_AREA_TESTED];
146$test_priority   	= $row[TEST_PRIORITY];
147$manual          	= $row[TEST_MANUAL];
148$automated       	= $row[TEST_AUTOMATED];
149$performance	 	= $row[TEST_LR];
150$autopass        	= $row[TEST_AUTO_PASS];
151$assigned_to     	= $row[TEST_ASSIGNED_TO];
152$assigned_by     	= $row[TEST_ASSIGNED_BY];
153$dateassigned    	= $row[TEST_DATE_ASSIGNED];
154$dateexpcomplete 	= $row[TEST_DATE_EXPECTED];
155$dateactcomplete 	= $row[TEST_DATE_COMPLETE];
156$duration		 	= $row[TEST_DURATION];
157$test_status     	= $row[TEST_STATUS];
158$signoff_by		 	= $row[TEST_SIGNOFF_BY];
159$signoff_date    	= $row[TEST_SIGNOFF_DATE];
160$last_updated_date 	= $row[TEST_LAST_UPDATED];
161$last_updated_by 	= $row[TEST_LAST_UPDATED_BY];
162$email_ba_owner		= $row[TEST_EMAIL_BA_OWNER];
163$email_qa_owner		= $row[TEST_EMAIL_QA_OWNER];
164
165# $test_version_id = $row[TEST_VERS_ID]; It's in the session
166//$version_no		 = $row[TEST_VERS_NUMBER];
167//$latest_version	 = $row[TEST_VERS_LATEST];
168//$active_version  = $row[TEST_VERS_ACTIVE];
169//$test_comments   = $row[TEST_VERS_COMMENTS];
170//$test_status     = $row[TEST_VERS_STATUS];
171//$signoff_by		 = $row[TEST_VERS_SIGNOFF_BY];
172//$signoff_date    = $row[TEST_VERS_SIGNOFF_DATE];
173//$author			 = $row[TEST_AUTHOR];
174$date_created	 = $row[TEST_DATE_CREATED];
175
176print"<br>";
177print"<div align=center>";
178
179if ( !empty($row) ) {
180
181	print"<table class=width95>". NEWLINE;
182	print"<tr class='tbl_header'>". NEWLINE;
183		print"<td width='50%'>". lang_get('test_id') ."</td>". NEWLINE;
184		print"<td width='50%'>". lang_get('test_name') ."</td>". NEWLINE;
185		#print"<td width='33%'>". lang_get('test_version') ."</td>". NEWLINE;
186	print"</tr>". NEWLINE;
187	print"<tr>". NEWLINE;
188		$display_test_id = util_pad_id( $test_id );
189		print"<td class=grid-data-c>$display_test_id</td>". NEWLINE;
190		print"<td class=grid-data-c>$test_name</td>". NEWLINE;
191		#print"<td class=grid-data-c>$version_no</td>". NEWLINE;
192	print"</tr>". NEWLINE;
193	print"</table>". NEWLINE;
194
195	print"<br>". NEWLINE;
196
197	print"<table class=width95>". NEWLINE;
198		print"<tr>". NEWLINE;
199
200				print"<td class=grid-header-l width='25%'>". NEWLINE;
201				print lang_get('test_performance') ." | ". lang_get('man_auto');
202				print"</td>". NEWLINE;
203				print"<td class=grid-data-l width='25%'>". NEWLINE;
204				print html_print_testtype_icon( $manual, $automated, $performance );
205				print"</td>". NEWLINE;
206				print"<td class=grid-header-l width='25%'>". NEWLINE;
207				print lang_get('last_updated_by');
208				print"</td>". NEWLINE;
209				print"<td class=grid-data-l width='25%'>". NEWLINE;
210				print $last_updated_by;
211				print"</td>". NEWLINE;
212			print"</tr>". NEWLINE;
213			print"<tr>". NEWLINE;
214				print"<td class=grid-header-l>". lang_get('test_status') ."</td>". NEWLINE;
215				print"<td class=grid-data-l>$test_status</td>". NEWLINE;
216				print"<td class=grid-header-l>". lang_get('last_updated_date') ."</td>". NEWLINE;
217				print"<td class=grid-data-l>$last_updated_date</td>". NEWLINE;
218			print"</tr>". NEWLINE;
219			print"<tr>". NEWLINE;
220				print"<td class=grid-header-l>". lang_get('area_tested') ."</td>". NEWLINE;
221				print"<td class=grid-data-l>$area_tested</td>". NEWLINE;
222				print"<td class=grid-header-l>". lang_get('assigned_to') ."</td>". NEWLINE;
223				print"<td class=grid-data-l>$assigned_to</td>". NEWLINE;
224			print"</tr>". NEWLINE;
225			print"<tr>". NEWLINE;
226				print"<td class=grid-header-l>". lang_get('testtype') ."</td>". NEWLINE;
227				print"<td class=grid-data-l>$test_type</td>". NEWLINE;
228				print"<td class=grid-header-l>". lang_get('test_assigned_by') ."</td>". NEWLINE;
229				print"<td class=grid-data-l>$assigned_by</td>". NEWLINE;
230			print"</tr>". NEWLINE;
231			print"<tr>". NEWLINE;
232				print"<td class=grid-header-l>". lang_get('qa_owner') ."</td>". NEWLINE;
233				print"<td class=grid-data-l>$qa_owner</td>". NEWLINE;
234				print"<td class=grid-header-l>". lang_get('date_assigned') ."</td>". NEWLINE;
235				print"<td class=grid-data-l>$dateassigned</td>". NEWLINE;
236			print"</tr>". NEWLINE;
237			print"<tr>". NEWLINE;
238				print"<td class=grid-header-l>". lang_get('ba_owner') ."</td>". NEWLINE;
239				print"<td class=grid-data-l>$ba_owner</td>". NEWLINE;
240				print"<td class=grid-header-l>". lang_get('date_expected') ."</td>". NEWLINE;
241				print"<td class=grid-data-l>$dateexpcomplete</td>". NEWLINE;
242			print"</tr>". NEWLINE;
243			print"<tr>". NEWLINE;
244				print"<td class=grid-header-l>". lang_get('tester') ."</td>". NEWLINE;
245				print"<td class=grid-data-l>$tester</td>". NEWLINE;
246				print"<td class=grid-header-l>". lang_get('date_complete') ."</td>". NEWLINE;
247				print"<td class=grid-data-l>$dateactcomplete</td>". NEWLINE;
248			print"</tr>". NEWLINE;
249			print"<tr>". NEWLINE;
250				print"<td class=grid-header-l>". lang_get('priority') ."</td>". NEWLINE;
251				print"<td class=grid-data-l>$test_priority</td>". NEWLINE;
252				print"<td class=grid-header-l>". lang_get('signoff_by') ."</td>". NEWLINE;
253				print"<td class=grid-data-l></td>". NEWLINE;
254			print"</tr>". NEWLINE;
255			print"<tr>". NEWLINE;
256				//if($show_priority == 'Y') {
257				print"<td class=grid-header-l>". lang_get('duration') ."</td>". NEWLINE;
258				print"<td class=grid-data-l>$duration</td>";
259				/*}
260				else {
261					"We need to get rid of the show_priority session var and make it standard<br>";
262				}
263				*/
264				print"<td class=grid-header-l>". lang_get('ba_signoff_date') ."</td>". NEWLINE;
265				print"<td class=grid-data-l>$signoff_date</td>". NEWLINE;
266			print"</tr>". NEWLINE;
267
268			print"<tr>". NEWLINE;
269				print"<td class=grid-header-l>". lang_get('test_purpose') ."</td>". NEWLINE;
270				print"<td class=grid-data-l>";
271				print nl2br(replace_uri($test_purpose));
272				print"</td>". NEWLINE;
273				print"<td class=grid-header-l>". lang_get('email_ba_owner') ."</td>". NEWLINE;
274				print"<td class=grid-data-l>";
275				print ("Y" == $email_ba_owner) ? "Yes" : "No";
276				print"</td>". NEWLINE;
277			print"</tr>". NEWLINE;
278
279			print"<tr>". NEWLINE;
280				print"<td class=grid-header-l>". lang_get('autopass') ."</td>". NEWLINE;
281				print"<td class=grid-data-l>". NEWLINE;
282				print ("Y" == $autopass) ? "Yes" : "No";
283				print"</td>". NEWLINE;
284				print"<td class=grid-header-l>". lang_get('email_qa_owner') ."</td>". NEWLINE;
285				print"<td class=grid-data-l>";
286				print ("Y" == $email_qa_owner) ? "Yes" : "No";
287				print"</td>". NEWLINE;
288				print"</tr>". NEWLINE;
289
290				/*print"<td class=grid-data-l colspan=3>". NEWLINE;
291				print nl2br($test_purpose);
292				print"</td>". NEWLINE;
293			print"</tr>". NEWLINE;*/
294
295			print"<tr>". NEWLINE;
296				print"<td class=grid-header-l>". NEWLINE;
297				print lang_get('test_comments');
298				print"</td>". NEWLINE;
299				print"<td class=grid-data-l colspan=3>". NEWLINE;
300				print nl2br(replace_uri($test_comments));
301				print"</td>". NEWLINE;
302			print"</tr>". NEWLINE;
303
304
305	print"</table>". NEWLINE;
306
307	print"<table class=hide95>". NEWLINE;
308	print"<tr>". NEWLINE;
309
310		# UPDATE TEST
311		print"<td class=center width='50%'>". NEWLINE;
312		print"<form method=post action='$update_action_page'>". NEWLINE;
313		print"<input type='submit' value='". lang_get('update_test') ."'>". NEWLINE;
314		print"</form>". NEWLINE;
315		print"</td>". NEWLINE;
316
317		# ADD VERSION
318		/*
319		print"<td class=center width='33%'>". NEWLINE;
320		print"<form name=testdetail method=post action='$add_version_page'>". NEWLINE;
321		print"<input type='submit' value='". lang_get('add_version') ."'>". NEWLINE;
322		print"</form>". NEWLINE;
323		print"</td>". NEWLINE;
324		*/
325
326		# DELETE TEST
327
328		# disable delete button if user does not have the rights
329		if( $user_has_delete_rights ) {
330			$delete_disabled = "";
331		} else {
332			$delete_disabled = "disabled";
333		}
334
335		print"<td class=center width='50%'>". NEWLINE;
336		print"<form method=post action='$delete_page'>". NEWLINE;
337		print"<input type='submit' value='". lang_get('delete_test_btn') ."' $delete_disabled>". NEWLINE;
338		print"<input type='hidden' name='r_page' value='$test_page'>";
339		print"<input type='hidden' name='f' value='delete_test'>";
340		print"<input type='hidden' name='id' value='$test_id'>";
341		print"<input type='hidden' name='msg' value='210'>";
342
343		print"</form>". NEWLINE;
344		print"</td>". NEWLINE;
345
346		# COPY TEST
347
348		# disable copy button if user has not project manager rigths
349		if( $project_manager ) {
350			$copy_disabled = "";
351		} else {
352			$copy_disabled = "disabled";
353		}
354		$s_user_projects = session_get_user_projects_excluding_current_project($project_name);
355		print"<td class=center width='50%'>". NEWLINE;
356		print"<form method=post action='$copy_action_page'>". NEWLINE; // TODO
357		print"<table class=hide95>". NEWLINE;
358		print"<tr>". NEWLINE;
359		print"<td class=center width='50%'>". NEWLINE;
360		print"<input type='submit' value='". lang_get('copy_test_btn') ."' $copy_disabled>". NEWLINE;
361		print"</td>". NEWLINE;
362		print"<td class=center width='50%'>". NEWLINE;
363		print"<select name='copy_to_project' size='1' $copy_disabled>". NEWLINE;
364		html_print_list_box_from_array(	$s_user_projects, 1 );
365        print"</select>". NEWLINE;
366        print"</td>". NEWLINE;
367        print"</tr>". NEWLINE;
368		print"</table>". NEWLINE;
369		print"<input type='hidden' name='test_id' value='$test_id'>";
370		print"<input type='hidden' name='test_name' value='$test_name'>";
371		print"<input type='hidden' name='test_purpose' value='$test_purpose'>";
372		print"<input type='hidden' name='test_comments' value='$test_comments'>";
373		print"<input type='hidden' name='manual' value='$manual'>";
374		print"<input type='hidden' name='performance' value='$performance'>";
375		print"<input type='hidden' name='test_status' value='$test_status'>";
376		print"<input type='hidden' name='duration' value='$duration'>";
377		print"<input type='hidden' name='email_ba_owner' value='$email_ba_owner'>";
378		print"<input type='hidden' name='email_qa_owner' value='$email_qa_owner'>";
379		print"<input type='hidden' name='autopass' value='$autopass'>";
380		print"<input type='hidden' name='automated' value='$automated'>";
381        print"</form>". NEWLINE;
382		print"</td>". NEWLINE;
383
384	print"</tr>". NEWLINE;
385	print"</table>". NEWLINE;
386
387} else {
388    print"<br><span class='print'>" . lang_get('no_test_suites') . $project_name . "</span>";
389}
390
391
392# Begin section for Test Steps - Documentation - Requirement Association
393print"<br>";
394
395print"<table class=hide100>". NEWLINE;
396print"<tr>". NEWLINE;
397print"<td>". NEWLINE;
398test_sub_menu_print( $test_id, $project_id, $page, $s_tab );
399print"</td>". NEWLINE;
400print"</tr>". NEWLINE;
401
402print"<tr>". NEWLINE;
403print"<td align=center>". NEWLINE;
404
405if( $user_has_delete_rights ) {
406	switch( $s_tab ) {
407	case 3:
408		print"[ <a href='test_req_assoc_page.php?test_id=$test_id'>".lang_get("edit_assoc")."</a> ]". NEWLINE;
409		break;
410	}
411} else {
412
413	print"&nbsp;";
414}
415
416print"</td>". NEWLINE;
417print"</tr>". NEWLINE;
418
419//error_report_check( $_GET );
420
421print"<tr>". NEWLINE;
422print"<td align=center>". NEWLINE;
423
424switch( $s_tab ) {
425
426	# TEST STEPS
427	case '1':
428
429		if( IMPORT_EXPORT_TO_EXCEL ) {
430			print"[ <a href='test_step_import_csv_page.php'>".lang_get('import_teststeps_excel')."</a> ]". NEWLINE;
431			print"[ <a href='csv_export.php?table=test_steps'>".lang_get('export_teststeps_excel')."</a> ]". NEWLINE;
432		}
433		else {
434			print"[ <a href='test_step_import_csv_page.php'>".lang_get('import_teststeps_csv')."</a> ]". NEWLINE;
435			print"[ <a href='csv_export.php?table=test_steps'>".lang_get('export_teststeps_csv')."</a> ]". NEWLINE;
436		}
437
438
439		print"<form method=post name='test_steps' action='$redirect_url' id='form_order'>". NEWLINE;
440		print"<table class=hide100>". NEWLINE;
441		print"<tr>". NEWLINE;
442		print"<td>". NEWLINE;
443		$rows_test_steps = test_get_test_steps( $test_id, $s_page_number, $csv_name=null ,$order_by,$order_dir);
444		print"</td>". NEWLINE;
445		print"</tr>". NEWLINE;
446		print"</table>". NEWLINE;
447		print"</form>". NEWLINE;
448
449		# Find out if there are existing test steps
450		#$row = test_get_test_steps( $test_id );
451		$num_test_steps = sizeof($rows_test_steps);
452
453		if( $num_test_steps != '0' ) {  # Display test steps if they exist
454
455			print"<table class='width100' rules='cols'>". NEWLINE;
456			print"<tr class='tbl_header'>". NEWLINE;
457			#html_tbl_print_header( lang_get('step_no') );
458			#html_tbl_print_header( lang_get('step_action') );
459			#html_tbl_print_header( lang_get('test_inputs') );
460			#html_tbl_print_header( lang_get('step_expected') );
461			#html_tbl_print_header( lang_get('step_edit') );
462			html_tbl_print_header( lang_get('step_no') );
463			html_tbl_print_header(lang_get('step_action') );
464			html_tbl_print_header( lang_get('test_inputs') );
465			html_tbl_print_header( lang_get('step_expected') );
466			html_tbl_print_header( lang_get('step_edit') );
467			print"</tr>". NEWLINE;
468
469			$row_style = '';
470			foreach($rows_test_steps as $row_test_step ) {
471
472				$row_test_step_id	= $row_test_step[TEST_STEP_ID];
473				$step_number     	= $row_test_step[TEST_STEP_NO];
474				$step_action     	= $row_test_step[TEST_STEP_ACTION];
475				$step_test_inputs  	= $row_test_step[TEST_STEP_TEST_INPUTS];
476				$step_expected   	= $row_test_step[TEST_STEP_EXPECTED];
477				$info_step 			= $row_test_step[TEST_STEP_INFO_STEP];
478
479				$info_step_class = "";
480				if( $info_step=="Y" ) {
481					$info_step_class = "class='test-step-info'";
482				}
483				$row_style = html_tbl_alternate_bgcolor( $row_style );
484				print"<tr class='$row_style'>". NEWLINE;
485				print"<td align=center><div $info_step_class>$step_number</div></td>". NEWLINE;
486				html_print_teststep_with_hyperlinks($info_step_class, $step_action, $step_test_inputs, $step_expected);
487
488				#print"<td align=left><div $info_step_class>$step_action</div></td>". NEWLINE;
489				#print"<td align=left><div $info_step_class>$step_test_inputs</div></td>". NEWLINE;
490				#print"<td align=left><div $info_step_class>$step_expected</div></td>". NEWLINE;
491				print"<td class='tbl-c'>";
492					print"<a href='$row_test_step_edit_page?test_id=$test_id&amp;test_step_id=$row_test_step_id'>[". lang_get('edit_link') ."]</a>&nbsp". NEWLINE;
493					print"<form name='delete_test_step' method=post action='$delete_page'>". NEWLINE;
494					print"<input type='submit' name='delete' value='[". lang_get( 'delete' ) ."]' class='page-numbers'>";
495					print"<input type='hidden' name='r_page' value='$redirect_url'>". NEWLINE;
496					print"<input type='hidden' name='f' value='delete_test_step'>". NEWLINE;
497					print"<input type='hidden' name='id' value='$row_test_step_id'>". NEWLINE;
498					print"<input type='hidden' name='msg' value='100'>". NEWLINE;
499					print"</form>". NEWLINE;
500				print"</td>". NEWLINE;
501				print"</tr>". NEWLINE;
502
503			}
504
505			print"</table>". NEWLINE;
506			print"<br>". NEWLINE;
507			# RENUMBER TEST STEPS BUTTON
508			print"<form action=$row_test_step_renumber_page method=post>". NEWLINE;
509			print"<input type='submit' name=renumber value='". lang_get( 'renumber_steps' ) ."'>". NEWLINE;
510			print"<input type='hidden' name='test_id' value='$test_id'>". NEWLINE;
511			//print"<input type='hidden' name='test_version_id' value='$test_version_id'>";
512			print"</form>". NEWLINE;
513
514		}
515
516		print"<br><br>". NEWLINE;
517
518
519
520		# ------------------------------------------------------
521		# Begin Test Step Form that allows users to add steps
522		# ------------------------------------------------------
523		print"<span class='required'>*</span> <span class='print'>" . lang_get('must_complete_field') . "</span>". NEWLINE;
524
525		print"<table class='width100'>". NEWLINE;
526		print"<tr>". NEWLINE;
527		print"<td>". NEWLINE;
528
529		print"<a name='steps' id='steps'></a>". NEWLINE;
530
531		print"<form method=post name='test_step_add' action=$row_test_step_add_action_page>". NEWLINE;
532		//print"<td><input type='hidden' name='test_version_id' value='$test_version_id'></td>";
533
534		print"<table class='inner'>". NEWLINE;
535		print"<tr>". NEWLINE;
536			print"<td colspan=2 align=left class='form-lbl-l'>". lang_get('add_test_step') ."</td>". NEWLINE;
537		print"</tr>";
538		# ADD STEP AFTER...
539		print"<tr>". NEWLINE;
540			print"<td class='form-lbl-r'>". lang_get('position') ."</td>". NEWLINE;
541
542			$test_step_tbl  = TEST_STEP_TBL;
543			$f_test_id		= TEST_STEP_TEST_ID;
544			$f_test_step_no	= TEST_STEP_NO;
545
546			print"<td align=left>". NEWLINE;
547			print"<select name='location'>";
548			print"<option value='end'>At end of table</option>";
549				$q = "SELECT * FROM $test_step_tbl WHERE $f_test_id = '$test_id' ORDER BY $f_test_step_no";
550				$rs = db_query( $db, $q );
551				while($rw = db_fetch_row( $db, $rs ) ){
552					print"<option value=$rw[$f_test_step_no]>After Step $rw[$f_test_step_no]</option>";
553				}
554			print"</select>". NEWLINE;
555			print"</td>". NEWLINE;
556		print"</tr>";
557
558		print"<tr>". NEWLINE;
559			print"<td class='form-lbl-r'>". lang_get('info_step') ."</td>". NEWLINE;
560			print"<td align=left><input type=checkbox name=info_step></td>";
561		print"</tr>";
562
563		# ACTION
564		$action = session_validate_form_get_field("step_action_required", "", session_use_FCKeditor());
565		print"<tr>";
566			print"<td class='form-lbl-r'>". lang_get('step_action') ." <span class='required'>*</span></td>". NEWLINE;
567			print"<td align=left>";
568			html_FCKeditor("step_action_required", 600, 200, $action);
569			print"</td>". NEWLINE;
570		print"</tr>";
571
572		# TEST INPUTS
573		$test_inputs = session_validate_form_get_field("step_test_inputs", "", session_use_FCKeditor());
574						print"<tr>";
575							print"<td class='form-lbl-r'>". lang_get('test_inputs');
576							//<span class='required'>*</span></td>". NEWLINE;
577							print"<td align=left>";
578							html_FCKeditor("step_test_inputs", 600, 200, $action);
579							print"</td>". NEWLINE;
580		print"</tr>". NEWLINE;
581
582		# EXPTECTED RESULT
583		$expected_result = session_validate_form_get_field("step_expected_required", "", session_use_FCKeditor());
584		print"<tr>";
585			print"<td class='form-lbl-r'>". lang_get('step_expected') ." <span class='required'>*</span></td>". NEWLINE;
586			print"<td align=left>";
587			html_FCKeditor("step_expected_required", 600, 200, $expected_result);
588			print"</td>". NEWLINE;
589		print"</tr>". NEWLINE;
590
591		print"<tr>". NEWLINE;
592			print"<td><input type='hidden' name='test_id' value='$test_id'></td>". NEWLINE;
593		print"</tr>". NEWLINE;
594
595		util_add_spacer();
596
597		# SUBMIT BUTTON
598		print"<tr>". NEWLINE;
599		print"<td colspan='3' class=center><input type='submit' value='". lang_get('add_step') ."'></td>". NEWLINE;
600		print"</tr>". NEWLINE;
601
602		util_add_spacer();
603
604		print"</table>". NEWLINE;
605		print"</form>". NEWLINE;
606
607		print"</td>". NEWLINE;
608		print"</tr>". NEWLINE;
609		print"</table>". NEWLINE;
610
611		break;
612
613	# SUPPORTING DOCUMENTATION
614	# FILE UPLOAD
615	case '2':
616
617		$upload_rows = test_get_uploaded_documents($test_id);
618		$message = lang_get('delete_confirm_suppdoc');
619
620		if( !empty($upload_rows) ) {
621
622			print"<br>";
623			print"<table class=width95>";
624			print"<tr>";
625			print"<td>";
626				print"<table class=inner>";
627				print"<tr>";
628					print"<td class=grid-header-c>". lang_get('file_type') ."</td>";
629					print"<td class=grid-header-c>". lang_get('file_name') ."</td>";
630					print"<td class=grid-header-c>". lang_get('version') ."</td>";
631					print"<td class=grid-header-c>". lang_get('view') ."</td>";
632					print"<td class=grid-header-c>". lang_get('download') ."</td>";
633					print"<td class=grid-header-c>". lang_get('show_history') ."</td>";
634					print"<td class=grid-header-c>". lang_get('add_version') ."</td>";
635					if($user_has_delete_rights){
636						print"<td class=grid-header-c>". lang_get('delete') ."</td>";
637					}
638					//print"<td class=grid-header-c>". lang_get('edit') ."</td>";
639					print"<td class=grid-header-c>". lang_get('uploaded_by') ."</td>";
640					print"<td class=grid-header-c>". lang_get('date_added') ."</td>";
641					print"<td class=grid-header-c>". lang_get('info') ."</td>";
642					//print"<td class=grid-header-c>". lang_get('delete_latest') ."</td>";
643				print"</tr>";
644
645				foreach($upload_rows as $upload_row) {
646
647					$display_name  = $upload_row[MAN_TD_DISPLAY_NAME];
648					$man_test_id   = $upload_row[MAN_TD_MANUAL_TEST_ID];
649					$doc_detail_row = test_get_uploaded_document_detail($man_test_id);
650					$filename      = $doc_detail_row[MAN_TD_VER_FILENAME];
651					$comments      = $doc_detail_row[MAN_TEST_DOCS_VERS_COMMENTS];
652					$time_stamp    = $doc_detail_row[MAN_TD_VER_TIME_STAMP];
653					$uploaded_by   = $doc_detail_row[MAN_TD_VER_UPLOADED_BY];
654					$version       = $doc_detail_row[MAN_TD_VER_VERSION];
655					$doc_type      = $doc_detail_row[MAN_TEST_DOCS_VERS_MANUAL_DOC_TYPE_NAME];
656
657					$fname = $s_project_properties['test_upload_path'] . $filename;
658					if(IGNORE_VERSION_FILENAME_VALIDATION){
659						$file_name = substr($filename,28);
660					}else
661						$file_name = $display_name;
662
663					print"<tr>";
664						print"<td class=grid-data-c>".html_file_type( $filename )."</td>";
665						print"<td class=grid-data-c>$file_name</td>";
666						print"<td class=grid-data-c>$version</td>";
667						print"<td class=grid-data-c>";
668						print"<a href='$fname' target='new'>" . lang_get('view') . "</a>";
669						print"</td>";
670						print"<td class=grid-data-c>";
671						print"<a href='download.php?upload_filename=$fname'>" . lang_get('download') . "</a>";
672						print"</td>";
673						print"<td class=grid-data-c>";
674						print"<a href='test_doc_history_page.php?test_id=$test_id&mantestid=$man_test_id'>" . lang_get('show') . "</a>";
675						print"</td>";
676						print"<td class=grid-data-c>";
677						print"<a href='test_add_doc_version_page.php?test_id=$test_id&manual_test_id=$man_test_id'>" . lang_get('add') . "</a>";
678						print"</td>";
679						if($user_has_delete_rights){
680							print"<td class=grid-data-c>".NEWLINE;
681							print '<a onclick="return confirmSubmit(\''.$message.'\')" href="test_delete_doc_action.php?test_id='.$test_id. '&manual_test_id='. $man_test_id .'">' . lang_get('delete') . '</a>'.NEWLINE;
682							print"</td>";
683						}
684						//print"<td class=grid-data-c>";
685						//print"<a href='test_doc_edit_page.php?mantestid=$man_test_id'>" . lang_get('edit') . "</a>";
686						//print"</td>";
687						print"<td class=grid-data-c>$uploaded_by</td>";
688						print"<td class=grid-data-c>$time_stamp</td>";
689						print"<td class=grid-data-c>";
690
691						  if($comments) {
692							  print"<img src='". IMG_SRC . "/info.gif' title='$comments'>";
693						  }
694						  else {
695							  print"&nbsp;";
696						  }
697
698						print"</td>";
699						//print"<td class=grid-data-c>";
700						//print"<a href='test_doc_delete_page.php?mantestid=$man_test_id'>" . lang_get('delete') . "</a>";
701						//print"</td>";
702					print"</tr>";
703				}
704
705				print"</table>";
706			print"</td>";
707			print"</tr>";
708			print"</table>";
709
710
711		}
712		else {
713			print"<br><span class='print'><div align='center'>" . lang_get('no_documentation') . "</div></span>";
714		}
715
716		print"<br>". NEWLINE;
717		print"<table class=width95>". NEWLINE;
718		print"<tr>". NEWLINE;
719		print"<td>". NEWLINE;
720			print"<form enctype=multipart/form-data name=upload action='$new_upload_action_page' method=post>". NEWLINE;
721			print"<table class=inner>". NEWLINE;
722
723			print"<tr class=left>". NEWLINE;
724				print"<td class=form-header-l colspan=2>" . lang_get('upload_heading') . "</td>". NEWLINE;
725			print"</tr>". NEWLINE;
726			print"<tr>". NEWLINE;
727				print"<td class=form-lbl-r>" . lang_get('file_name') . "</td>". NEWLINE;
728				print"<td class=form-data-l><input type='file' name='uploadfile' size='60'></td>". NEWLINE;
729			print"</tr>". NEWLINE;
730			print"<tr>". NEWLINE;
731				print"<td class=form-lbl-r>" . lang_get('comments') . "</td>". NEWLINE;
732				print"<td class=form-data-l><textarea rows='2' cols='45' name='comments'></textarea></td>". NEWLINE;
733			print"</tr>". NEWLINE;
734			print"<tr>". NEWLINE;
735				print"<td class=form-lbl-r>" .  lang_get('file_type') . "</td>". NEWLINE;
736				print"<td class=form-data-l>". NEWLINE;
737				print"<select name=doc_type>". NEWLINE;
738					$test_types = test_get_test_type( $project_id, $blank=true );
739					html_print_list_box_from_array( $test_types );
740				print"</select></td>". NEWLINE;
741			print"</tr>". NEWLINE;
742			print"<tr>". NEWLINE;
743				print"<td colspan=2><input type='hidden' name='MAX_FILE_SIZE' value='25000000'></td>". NEWLINE;
744			print"</tr>". NEWLINE;
745			print"<tr>". NEWLINE;
746				print"<td class=center colspan=2><input type='submit' value='Upload'></td>". NEWLINE;
747			print"</tr>". NEWLINE;
748			print"</table>". NEWLINE;
749			print"</form>". NEWLINE;
750		print"</td>". NEWLINE;
751		print"</tr>". NEWLINE;
752		print"</table>". NEWLINE;
753		print"<br>". NEWLINE;
754		print"<br>". NEWLINE;
755
756		break;
757
758	# REQ ASSOC
759	case '3':
760
761		/*
762		print"<br>";
763		print"<b><div align='left'>" . lang_get('req_assoc_section') . "</div></b>";
764		print"<hr>";
765		print"<br>";
766		*/
767		$associated_row = test_get_associated_requirements($test_id);
768		if (!empty($associated_row)) {
769
770		print"<table cellpadding=4 width='90%'>". NEWLINE;
771		print"<tr>". NEWLINE;
772		print"<td>". NEWLINE;
773
774		print"<table rules=cols class=width100>". NEWLINE;
775		print"<tr>". NEWLINE;
776			print"<th class=grid-header-c>". lang_get('req_id') ."</th>";
777			print"<th class=grid-header-c>". lang_get('req_name') ."</th>";
778			print"<th class=grid-header-c>". lang_get('percent_covered_test') ."</th>";
779			/*print"<th class=grid-header-c>";
780			print lang_get('edit') . ' ' .lang_get('percent_covered') . $test_name ;
781			print"</th>";*/
782			if( $user_has_delete_rights ) {
783				print"<th class=grid-header-c>". lang_get('delete') ."</th>";
784			}
785		print"</tr>";
786
787		foreach( $associated_row as $row_associated_reqs ) {
788			$assoc_id			= $row_associated_reqs[TEST_REQ_ASSOC_ID];
789			$req_id				= $row_associated_reqs[REQ_ID];
790			$req_filename		= $row_associated_reqs[REQ_FILENAME];
791			$req_assoc_covered	= $row_associated_reqs[TEST_REQ_ASSOC_PERCENT_COVERED];
792			$req_id_link		= util_pad_id($req_id);
793
794			$row_style = html_tbl_alternate_bgcolor($row_style);
795			print"<tr class='$row_style'>". NEWLINE;
796				print"<td class='tbl-c'><a href='requirement_detail_page.php?req_id=$req_id&tab=2'>$req_id_link</a></td>";
797				print"<td class='tbl-l'>$req_filename</td>";
798				print"<td class='tbl-c'>$req_assoc_covered%</td>";
799				//print"<td class='tbl-c'><a href='test_req_edit_coverage_page.php?req_id=$req_id&amp;tab=2'>" . lang_get('edit') ."</a></td>";
800				if( $user_has_delete_rights ) {
801					print"<td class='tbl-c'><a href='test_delete_assoc_action.php?assoc=req&amp;assoc_id=$assoc_id'>" . lang_get('delete') ."</a></td>";
802				}
803			print"</tr>";
804
805		}
806		print"</table>";
807		print"</td>";
808		print"</tr>";
809		print"</table>";
810		}
811		else {
812			print("<br><div align='left'><span class='print'>" . lang_get('no_req_assoc') . "</span></div>");
813		}
814		break;
815	/*
816	case '4':
817
818	print"<br>";
819	print"<table class=width95>";
820		print"<tr>";
821		print"<td>";
822			print"<table class=inner>";
823			print"<tr>";
824				print"<td class=grid-header-c>". lang_get('test_version') ."</td>";
825				print"<td class=grid-header-c>". lang_get('created_by') ."</td>";
826				print"<td class=grid-header-c>". lang_get('test_created_date') ."</td>";
827				print"<td class=grid-header-c>". lang_get('test_status') ."</td>";
828				print"<td class=grid-header-c>". lang_get('signoff_by') ."</td>";
829				print"<td class=grid-header-c>". lang_get('signoff_date') ."</td>";
830				print"<td class=grid-header-c>". lang_get('signoff') ."</td>";
831				print"<td class=grid-header-c>". lang_get('active') ."</td>";
832				print"<td class=grid-header-c>". lang_get('make_active') ."</td>";
833				print"<td class=grid-header-c>". lang_get('view_test') ."</td>";
834			print"</tr>";
835
836		$tst_versions = test_get_all_versions( $test_id );
837
838		foreach( $tst_versions as $tst_version ) {
839
840			$tst_version_id		= $tst_version[TEST_VERS_ID];
841			$tst_version_no		= $tst_version[TEST_VERS_NUMBER];
842			$tst_created_by		= $tst_version[TEST_VERS_AUTHOR];
843			$tst_created_date	= $tst_version[TEST_VERS_DATE_CREATED];
844			$tst_version_status = $tst_version[TEST_VERS_STATUS];
845			$tst_active			= $tst_version[TEST_VERS_ACTIVE];
846			$tst_signoff_by		= $tst_version[TEST_VERS_SIGNOFF_BY];
847			$tst_signoff_date	= $tst_version[TEST_VERS_SIGNOFF_DATE];
848
849			$signoff_page = "blah.php";
850			$active_url = $active_version_page . "?test_id=$test_id&tst_version_id=$tst_version_id";
851
852			print"<tr>". NEWLINE;
853				print"<td class='grid-data-c'>$tst_version_no</td>". NEWLINE;
854				print"<td class='grid-data-c'>$tst_created_by</td>". NEWLINE;
855				print"<td class='grid-data-c'>$tst_created_date</td>". NEWLINE;
856				print"<td class='grid-data-c'>$tst_version_status</td>". NEWLINE;
857				print"<td class='grid-data-c'>$tst_signoff_by</td>". NEWLINE;
858				print"<td class='grid-data-c'>$tst_signoff_date</td>". NEWLINE;
859				# SIGN OFF
860				if( $tst_signoff_by == '' && $tst_signoff_date == '' ) {
861					$signoff_page = 'Blah.php';
862					print"<td class='grid-data-c'><a href='$signoff_page'>". lang_get('signoff') ."</a></td>". NEWLINE;
863				}
864				else {
865					print"<td class='grid-data-c'></td>". NEWLINE;
866				}
867				# ACTIVE
868				if( $tst_active == 'Y' ) {
869					print"<td class='grid-data-c'>X</td>". NEWLINE;
870				}
871				else {
872					print"<td class='grid-data-c'></td>". NEWLINE;
873				}
874				# MAKE ACTIVE
875				if( $tst_active == 'Y' ) {
876					print"<td class='grid-data-c'></td>". NEWLINE;
877				}
878				else {
879					print"<td class='grid-data-c'><a href='$active_url'>". lang_get('make_active') ."</a></td>". NEWLINE;
880				}
881				# VIEW
882				if( $tst_version_no == $version_no ) {
883					print"<td class='grid-data-c'></td>". NEWLINE;
884				}
885				else {
886					print"<td class='grid-data-c'><a href='$signoff_page'>". lang_get('view') ."</a></td>". NEWLINE;
887				}
888			print"</tr>". NEWLINE;
889		}
890
891		print"</table>";
892	print"</td>". NEWLINE;
893	print"</tr>". NEWLINE;
894	print"</table>". NEWLINE;
895
896	break;
897	*/
898}
899
900print"</td>". NEWLINE;
901print"</tr>". NEWLINE;
902print"</table>". NEWLINE;
903
904print"</div>";
905
906
907session_validate_form_reset();
908
909
910html_print_footer();
911
912# ---------------------------------------------------------------------
913# $Log: test_detail_page.php,v $
914# Revision 1.15  2008/08/07 10:57:51  peter_thal
915# Now blanks are replaced with underscores by adding a new supporting doc
916#
917# Revision 1.14  2008/08/05 10:42:43  peter_thal
918# small changes: delete confirm SuppDocs, Error message file upload, disabled sorting teststeps
919#
920# Revision 1.13  2008/08/04 06:54:58  peter_thal
921# added sorting function to several tables
922#
923# Revision 1.12  2008/07/23 14:53:50  peter_thal
924# delete supporting docs feature added (linux/unix)
925#
926# Revision 1.11  2008/07/09 07:13:25  peter_thal
927# added direct linking of test detail by adding project_id link parameter
928# added automated project switching if necessary
929#
930# Revision 1.10  2008/01/22 08:17:46  cryobean
931# added copy test feature
932#
933# Revision 1.9  2007/11/15 12:58:48  cryobean
934# bugfixes
935#
936# Revision 1.8  2007/02/12 07:16:35  gth2
937# adding email functionality on test update - gth
938#
939# Revision 1.7  2006/08/05 22:09:13  gth2
940# adding NEWLINE constant to support multiple OS newline chars - gth
941#
942# Revision 1.6  2006/06/24 14:34:14  gth2
943# updating changes lost with cvs problem.
944#
945# Revision 1.5  2006/04/05 12:39:30  gth2
946# no message
947#
948# Revision 1.4  2006/02/24 11:36:04  gth2
949# update to div - class=div-c not working in firefox - gth
950#
951# Revision 1.3  2006/01/16 13:27:45  gth2
952# adding excel integration - gth
953#
954# Revision 1.2  2006/01/09 02:02:14  gth2
955# fixing some defects found while writing help file
956#
957# Revision 1.1.1.1  2005/11/30 23:00:58  gth2
958# importing initial version - gth
959#
960# ---------------------------------------------------------------------
961
962?>