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_environment_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 		= ENVIRONMENT_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
65
66error_report_check( $_GET );
67
68$project_details = project_get_details( $selected_project_id );
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	# Environment
84	# ----------------------------------------------------------------------------------
85
86	# ----------------------------------------------------------------------------------
87	# Environment Form
88	# ----------------------------------------------------------------------------------
89	if( $project_manager ) {
90		print"<form method=post action='project_add_environment_action.php'>". NEWLINE;
91		print"<span class='required'>*</span><span class='print'>" . lang_get('must_complete_field') . "</span>". NEWLINE;
92		print"<table class='width70'>". NEWLINE;
93		print"<tr>". NEWLINE;
94		print"<td>". NEWLINE;
95		print"<table class=inner>". NEWLINE;
96		print"<tr>". NEWLINE;
97		print"<td class=form-header-l>".lang_get('add_environment')."</td>". NEWLINE;
98		print"</tr>". NEWLINE;
99		print"<tr>". NEWLINE;
100		print"<td class='form-lbl-c'>". lang_get('environment') ." <span class='required'>*</span>". NEWLINE;
101		print"<input type=text size=60 maxlength=50 name='environment_name_required' value='".session_validate_form_get_field( 'environment_required' )."'>". NEWLINE;
102		print"&nbsp;<input type=submit name='new_area_tested' value='".lang_get("add")."'>";
103		print"</td>". NEWLINE;
104		print"</tr>". NEWLINE;
105		print"</table>". NEWLINE;
106		print"</td>". NEWLINE;
107		print"</tr>". NEWLINE;
108		print"</table>". NEWLINE;
109		print"</form>". NEWLINE;
110	}
111
112	# ----------------------------------------------------------------------------------
113	# Environment Table
114	# ----------------------------------------------------------------------------------
115	print"<br>". NEWLINE;
116    print"<form method=post action='$page?order_by=$order_by&amp;order_dir=$order_dir'>". NEWLINE;
117	print"<input type=hidden name=table value=project_manage_environment>". NEWLINE;
118	print"<table class=hide70>". NEWLINE;
119	print"<tr>". NEWLINE;
120	print"<td>". NEWLINE;
121	$rows_environments = project_get_environments($selected_project_id, $order_by, $order_dir, $page_number);
122	print"<input type=hidden name='order_dir' value='$order_dir'>";
123	print"<input type=hidden name='order_by' value='$order_by'>";
124	print"</td>". NEWLINE;
125	print"</tr>". NEWLINE;
126	print"</table>". NEWLINE;
127	print"</form>". NEWLINE;
128
129	if( $rows_environments ) {
130		print"<table class='width70' rules=cols>". NEWLINE;
131		print"<tr>". NEWLINE;
132		html_tbl_print_header( lang_get('environment'), ENVIRONMENT_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_environments as $row_environment) {
140			$id		= $row_environment[ENVIRONMENT_ID];
141			$name 	= $row_environment[ENVIRONMENT_NAME];
142
143			$row_style = html_tbl_alternate_bgcolor($row_style);
144
145			print"<tr class='$row_style'>". NEWLINE;
146			print"<td>$name</td>". NEWLINE;
147			if( $project_manager ) {
148				print"<td><a href='project_edit_environment_page.php?environment_id=$id'>".lang_get("edit")."</a></td>". NEWLINE;
149				print"<td>". NEWLINE;
150				print"<form name='delete_release' method=post action='$delete_page'>". NEWLINE;
151				print"<input type='submit' name='delete_environment' value='". lang_get( 'delete' ) ."' class='page-numbers'>". NEWLINE;
152				print"<input type='hidden' name='r_page' value='$redirect_url#environment'>". NEWLINE;
153				print"<input type='hidden' name='f' value='remove_environment_from_project'>". NEWLINE;
154				print"<input type='hidden' name='id' value='$id'>". NEWLINE;
155				print"<input type='hidden' name='project_id' value='$selected_project_id'>". NEWLINE;
156				print"<input type='hidden' name='msg' value='". DEL_ENVIRONMENT_FROM_PROJECT ."'>". NEWLINE;
157				print"</form>". NEWLINE;
158				print"</td>". NEWLINE;
159			}
160			print"</tr>". NEWLINE;
161		}
162
163		print"</table>". NEWLINE;
164	}
165} else {
166	html_no_records_found_message( lang_get('no_projects') );
167}
168
169print"</div>". NEWLINE;
170
171html_print_footer();
172
173# ------------------------------------
174# $Log: project_manage_environment_page.php,v $
175# Revision 1.2  2006/08/05 22:08:24  gth2
176# adding NEWLINE constant to support multiple OS newline chars - gth
177#
178# Revision 1.1.1.1  2005/11/30 23:00:57  gth2
179# importing initial version - gth
180#
181# ------------------------------------
182
183?>