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
64error_report_check( $_GET );
65
66$project_details = project_get_details( $selected_project_id );
67
68print"<div class=center>\n";
69
70html_project_manage_menu();
71
72print"<br>\n";
73
74if( !empty( $project_details ) ) {
75
76	$project_id						= $project_details[PROJ_ID];
77	$project_name					= $project_details[PROJ_NAME];
78	$project_status					= $project_details[PROJ_STATUS];
79	$project_description			= $project_details[PROJ_DESCRIPTION];
80
81	####################################################################################
82	# Areas Tested
83	# ---------------------------------------------------------------------
84
85	# New Area Tested
86	if( $project_manager ) {
87		print"<form method=post action='project_add_area_action.php'>\n";
88		print"<span class='required'>*</span><span class='print'>" . lang_get('must_complete_field') . "</span>\n";
89		print"<table class='width70'>\n";
90		print"<tr>\n";
91		print"<td>\n";
92		print"<table class=inner>\n";
93		print"<tr>\n";
94		print"<td class=form-header-l>".lang_get('add_area_tested')."</td>\n";
95		print"</tr>\n";
96		print"<tr>\n";
97		print"<td class='form-lbl-c'>". lang_get('area_tested') ." <span class='required'>*</span>\n";
98		print"<input type=text size=60 maxlength=50 name='area_tested_required' value='".session_validate_form_get_field( 'area_tested_required' )."'>\n";
99		print"&nbsp;<input type=submit name='new_area_tested' value='".lang_get("add")."'>";
100		print"</td>\n";
101		print"</tr>\n";
102		print"</table>\n";
103		print"</td>\n";
104		print"</tr>\n";
105		print"</table>\n";
106		print"</form>\n";
107
108		print"<br>";
109
110	}
111
112	# ---------------------------------------------------------------------
113	# Areas Tested Table
114	# ---------------------------------------------------------------------
115	print"<form method=post name='area_tested_table' action='$page?order_by=$order_by&amp;order_dir=$order_dir'>";
116	print"<table class=hide70>\n";
117	print"<tr>\n";
118	print"<td>\n";
119	$rows_areas_tested = project_get_areas_tested($selected_project_id, $order_by, $order_dir, $page_number);
120	print"<input type=hidden name='order_dir' value='$order_dir'>";
121	print"<input type=hidden name='order_by' value='$order_by'>";
122	print"</td>\n";
123	print"</tr>\n";
124	print"</table>\n";
125	print"</form>\n";
126
127	if( $rows_areas_tested ) {
128		print"<input type=hidden name=table value=project_manage_areas>\n";
129		print"<table class='width70' rules='cols'>\n";
130		print"<tr>\n";
131		html_tbl_print_header( lang_get('area_tested'), AREA_TESTED_NAME, $order_by, $order_dir, "$page?page_number=$page_number", $page_number );
132		if( $project_manager ) {
133			html_tbl_print_header( lang_get('edit') );
134			html_tbl_print_header( lang_get('delete') );
135		}
136		print"\n</tr>\n";
137
138		foreach($rows_areas_tested as $row_area) {
139
140			$area_tested 	= $row_area[AREA_TESTED_NAME];
141			$area_tested_id	= $row_area[AREA_TESTED_ID];
142
143			$row_style = html_tbl_alternate_bgcolor($row_style);
144
145			print"<tr class='$row_style'>\n";
146			print"<td>$area_tested</td>\n";
147			if( $project_manager ) {
148				print"<td><a href='project_edit_area_tested_page.php?area_id=$area_tested_id'>".lang_get("edit")."</a></td>\n";
149				print"<td>\n";
150				print"<form name='delete_area_tested' method=post action='$delete_page'>\n";
151				print"<input type='submit' name='delete_area_tested' value='". lang_get( 'delete' ) ."' class='page-numbers'>\n";
152				print"<input type='hidden' name='r_page' value='$redirect_url#area_tested'>\n";
153				print"<input type='hidden' name='f' value='remove_area_from_project'>\n";
154				print"<input type='hidden' name='id' value='$area_tested_id'>\n";
155				print"<input type='hidden' name='project_id' value='$selected_project_id'>\n";
156				print"<input type='hidden' name='msg' value='". DEL_AREA_FROM_PROJECT ."'>\n";
157				print"</form>\n";
158				print"</td>\n";
159			}
160
161			print"</tr>\n";
162		}
163
164		print"</table>\n";
165
166		print"<br>\n";
167	}
168
169} else {
170	html_no_records_found_message( lang_get('no_projects') );
171}
172
173print"</div>\n";
174
175html_print_footer();
176?>