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# Manage Project Page
10#
11# $RCSfile: project_manage_areatested_page.php,v $ $Revision: 1.2 $
12# ------------------------------------
13
14include"./api/include_api.php";
15auth_authenticate_user();
16
17$page                   = basename(__FILE__);
18$project_manage_page	= 'project_manage_page.php';
19$project_add_page     	= 'project_add_page.php';
20$project_edit_page		= 'project_edit_page.php';
21$user_manage_page		= 'user_manage_page.php';
22$user_add_page			= 'user_add_page.php';
23$project_manage_action	= 'project_manage_action.php';
24$delete_page			= 'delete_page.php';
25
26$s_project_properties   = session_get_project_properties();
27$project_name           = $s_project_properties['project_name'];
28$project_id 			= $s_project_properties['project_id'];
29
30$s_user_properties		= session_get_user_properties();
31$user_id				= $s_user_properties['user_id'];
32
33session_set_properties("project_manage", $_GET);
34$selected_project_properties 	= session_get_properties("project_manage");
35$selected_project_id 			= $selected_project_properties['project_id'];
36
37$project_manager		= user_has_rights( $selected_project_id, $user_id, MANAGER );
38
39$redirect_url			= $page ."?project_id=". $selected_project_id;
40
41$s_user_properties		= session_get_user_properties();
42$user_id				= $s_user_properties['user_id'];
43$row_style              = '';
44
45$order_by 		= AREA_TESTED_NAME;
46$order_dir		= "ASC";
47$page_number	= 1;
48
49util_set_order_by($order_by, $_GET);
50util_set_order_dir($order_dir, $_GET);
51util_set_page_number($page_number, $_GET);
52
53util_set_order_by($order_by, $_POST);
54util_set_order_dir($order_dir, $_POST);
55util_set_page_number($page_number, $_POST);
56
57
58html_window_title();
59html_print_body();
60html_page_title(project_get_name($selected_project_id) ." - ". lang_get('manage_project_page') );
61html_page_header( $db, $project_name );
62html_print_menu();
63admin_menu_print( $page, $project_id, $user_id );
64
65error_report_check( $_GET );
66
67$project_details = project_get_details( $selected_project_id );
68
69print"<div class=center>". NEWLINE;
70
71html_project_manage_menu();
72
73print"<br>". NEWLINE;
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'>". NEWLINE;
89		print"<span class='required'>*</span><span class='print'>" . lang_get('must_complete_field') . "</span>". NEWLINE;
90		print"<table class='width70'>". NEWLINE;
91		print"<tr>". NEWLINE;
92		print"<td>". NEWLINE;
93		print"<table class=inner>". NEWLINE;
94		print"<tr>". NEWLINE;
95		print"<td class=form-header-l>".lang_get('add_area_tested')."</td>". NEWLINE;
96		print"</tr>". NEWLINE;
97		print"<tr>". NEWLINE;
98		print"<td class='form-lbl-c'>". lang_get('area_tested') ." <span class='required'>*</span>". NEWLINE;
99		print"<input type=text size=60 maxlength=50 name='area_tested_required' value='".session_validate_form_get_field( 'area_tested_required' )."'>". NEWLINE;
100		print"&nbsp;<input type=submit name='new_area_tested' value='".lang_get("add")."'>";
101		print"</td>". NEWLINE;
102		print"</tr>". NEWLINE;
103		print"</table>". NEWLINE;
104		print"</td>". NEWLINE;
105		print"</tr>". NEWLINE;
106		print"</table>". NEWLINE;
107		print"</form>". NEWLINE;
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>". NEWLINE;
118	print"<tr>". NEWLINE;
119	print"<td>". NEWLINE;
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>". NEWLINE;
124	print"</tr>". NEWLINE;
125	print"</table>". NEWLINE;
126	print"</form>". NEWLINE;
127
128	if( $rows_areas_tested ) {
129		print"<input type=hidden name=table value=project_manage_areas>". NEWLINE;
130		print"<table class='width70' rules='cols'>". NEWLINE;
131		print"<tr>". NEWLINE;
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>". NEWLINE;
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'>". NEWLINE;
147			print"<td>$area_tested</td>". NEWLINE;
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>". NEWLINE;
150				print"<td>". NEWLINE;
151				print"<form name='delete_area_tested' method=post action='$delete_page'>". NEWLINE;
152				print"<input type='submit' name='delete_area_tested' value='". lang_get( 'delete' ) ."' class='page-numbers'>". NEWLINE;
153				print"<input type='hidden' name='r_page' value='$redirect_url#area_tested'>". NEWLINE;
154				print"<input type='hidden' name='f' value='remove_area_from_project'>". NEWLINE;
155				print"<input type='hidden' name='id' value='$area_tested_id'>". NEWLINE;
156				print"<input type='hidden' name='project_id' value='$selected_project_id'>". NEWLINE;
157				print"<input type='hidden' name='msg' value='". DEL_AREA_FROM_PROJECT ."'>". NEWLINE;
158				print"</form>". NEWLINE;
159				print"</td>". NEWLINE;
160			}
161
162			print"</tr>". NEWLINE;
163		}
164
165		print"</table>". NEWLINE;
166
167		print"<br>". NEWLINE;
168	}
169
170} else {
171	html_no_records_found_message( lang_get('no_projects') );
172}
173
174print"</div>". NEWLINE;
175
176html_print_footer();
177
178# ------------------------------------
179# $Log: project_manage_areatested_page.php,v $
180# Revision 1.2  2006/08/05 22:08:24  gth2
181# adding NEWLINE constant to support multiple OS newline chars - gth
182#
183# Revision 1.1.1.1  2005/11/30 23:00:57  gth2
184# importing initial version - gth
185#
186# ------------------------------------
187
188?>