1<?php
2# ---------------------------------------------------------------------
3# truc is a tool for requirement and use case tracking
4# Copyright (C) 2006 ASDIS - http://sf.net/projects/truc
5#
6# (rth) Initial truc version based on rth
7#       Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
8#
9# This program is distributed under the terms and conditions of the GPL
10# See the README and LICENSE files for details
11#----------------------------------------------------------------------
12
13include"./api/include_api.php";
14auth_authenticate_user();
15
16$page                   = basename(__FILE__);
17$project_manage_page	= 'project_manage_page.php';
18$project_add_page     	= 'project_add_page.php';
19$project_edit_page		= 'project_edit_page.php';
20$user_manage_page		= 'user_manage_page.php';
21$user_add_page			= 'user_add_page.php';
22$project_manage_action	= 'project_manage_action.php';
23$delete_page			= 'delete_page.php';
24
25$s_project_properties   = session_get_project_properties();
26$project_name           = $s_project_properties['project_name'];
27$project_id 			= $s_project_properties['project_id'];
28
29$s_user_properties		= session_get_user_properties();
30$user_id				= $s_user_properties['user_id'];
31
32session_set_properties("project_manage", $_GET);
33$selected_project_properties 	= session_get_properties("project_manage");
34$selected_project_id 			= $selected_project_properties['project_id'];
35
36$project_manager		= user_has_rights( $selected_project_id, $user_id, MANAGER );
37
38$redirect_url			= $page ."?project_id=". $selected_project_id;
39
40$s_user_properties		= session_get_user_properties();
41$user_id				= $s_user_properties['user_id'];
42$row_style              = '';
43
44$order_by 		= AREA_TESTED_NAME;
45$order_dir		= "ASC";
46$page_number	= 1;
47
48util_set_order_by($order_by, $_GET);
49util_set_order_dir($order_dir, $_GET);
50util_set_page_number($page_number, $_GET);
51
52util_set_order_by($order_by, $_POST);
53util_set_order_dir($order_dir, $_POST);
54util_set_page_number($page_number, $_POST);
55
56
57html_window_title();
58html_print_body();
59html_page_title(project_get_name($selected_project_id) ." - ". lang_get('manage_project_page') );
60html_page_header( $db, $project_name );
61html_print_menu();
62admin_menu_print( $page, $project_id, $user_id );
63
64html_project_manage_menu();
65html_project_manage_tests_menu();
66
67error_report_check( $_GET );
68
69$project_details = project_get_details( $selected_project_id );
70
71print"<div align=center>\n";
72
73print"<br>\n";
74
75if( !empty( $project_details ) ) {
76
77	$project_id						= $project_details[PROJ_ID];
78	$project_name					= $project_details[PROJ_NAME];
79	$project_status					= $project_details[PROJ_STATUS];
80	$project_description			= $project_details[PROJ_DESCRIPTION];
81
82	####################################################################################
83	# Areas Tested
84	# ---------------------------------------------------------------------
85
86	# New Area Tested
87	if( $project_manager ) {
88		print"<form method=post action='project_add_area_action.php'>\n";
89		print"<span class='required'>*</span><span class='print'>" . lang_get('must_complete_field') . "</span>\n";
90		print"<table class='width70'>\n";
91		print"<tr>\n";
92		print"<td>\n";
93		print"<table class=inner>\n";
94		print"<tr>\n";
95		print"<td class=form-header-l>".lang_get('add_area_tested')."</td>\n";
96		print"</tr>\n";
97		print"<tr>\n";
98		print"<td class='form-lbl-c'>". lang_get('area_tested') ." <span class='required'>*</span>\n";
99		print"<input type=text size=60 maxlength=50 name='area_tested_required' value='".session_validate_form_get_field( 'area_tested_required' )."'>\n";
100		print"&nbsp;<input type=submit name='new_area_tested' value='".lang_get("add")."'>";
101		print"</td>\n";
102		print"</tr>\n";
103		print"</table>\n";
104		print"</td>\n";
105		print"</tr>\n";
106		print"</table>\n";
107		print"</form>\n";
108
109		print"<br>";
110
111	}
112
113	# ---------------------------------------------------------------------
114	# Areas Tested Table
115	# ---------------------------------------------------------------------
116	print"<form method=post name='area_tested_table' action='$page?order_by=$order_by&amp;order_dir=$order_dir'>";
117	print"<table class=hide70>\n";
118	print"<tr>\n";
119	print"<td>\n";
120	$rows_areas_tested = project_get_areas_tested($selected_project_id, $order_by, $order_dir, $page_number);
121	print"<input type=hidden name='order_dir' value='$order_dir'>";
122	print"<input type=hidden name='order_by' value='$order_by'>";
123	print"</td>\n";
124	print"</tr>\n";
125	print"</table>\n";
126	print"</form>\n";
127
128	if( $rows_areas_tested ) {
129		print"<input type=hidden name=table value=project_manage_areas>\n";
130		print"<table class='width70' rules='cols'>\n";
131		print"<tr>\n";
132		html_tbl_print_header( lang_get('area_tested'), AREA_TESTED_NAME, $order_by, $order_dir, "$page?page_number=$page_number", $page_number );
133		if( $project_manager ) {
134			html_tbl_print_header( lang_get('edit') );
135			html_tbl_print_header( lang_get('delete') );
136		}
137		print"\n</tr>\n";
138
139		foreach($rows_areas_tested as $row_area) {
140
141			$area_tested 	= $row_area[AREA_TESTED_NAME];
142			$area_tested_id	= $row_area[AREA_TESTED_ID];
143
144			$row_style = html_tbl_alternate_bgcolor($row_style);
145
146			print"<tr class='$row_style'>\n";
147			print"<td>$area_tested</td>\n";
148			if( $project_manager ) {
149				print"<td><a href='project_edit_area_tested_page.php?area_id=$area_tested_id'>".lang_get("edit")."</a></td>\n";
150				print"<td>\n";
151				print"<form name='delete_area_tested' method=post action='$delete_page'>\n";
152				print"<input type='submit' name='delete_area_tested' value='". lang_get( 'delete' ) ."' class='page-numbers'>\n";
153				print"<input type='hidden' name='r_page' value='$redirect_url#area_tested'>\n";
154				print"<input type='hidden' name='f' value='remove_area_tested_from_project'>\n";
155				print"<input type='hidden' name='id' value='$area_tested_id'>\n";
156				print"<input type='hidden' name='project_id' value='$selected_project_id'>\n";
157				print"<input type='hidden' name='msg' value='". DEL_AREA_FROM_PROJECT ."'>\n";
158				print"</form>\n";
159				print"</td>\n";
160			}
161
162			print"</tr>\n";
163		}
164
165		print"</table>\n";
166
167	} else {
168
169		html_no_records_found_message( lang_get('no_testareatested') );
170	}
171}
172
173print"</div>\n";
174
175html_print_footer();
176?>