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# Requirement Add Page
10#
11# $RCSfile: requirement_add_page.php,v $  $Revision: 1.5 $
12# ---------------------------------------------------------------------
13
14include"./api/include_api.php";
15auth_authenticate_user();
16
17$page                   = basename(__FILE__);
18$project_properties     = session_get_project_properties();
19$project_id				= $project_properties['project_id'];
20$project_name           = $project_properties['project_name'];
21$username				= session_get_username();
22
23$s_properties 	= session_get_properties("requirements");
24$s_req_id		= $s_properties['req_id'];
25
26html_window_title();
27html_print_body();
28html_page_title($project_name ." - ". lang_get('req_add_page'));
29html_page_header( $db, $project_name );
30html_print_menu();
31
32requirement_menu_print($page);
33
34error_report_check( $_GET );
35
36print"<br>". NEWLINE;
37
38print"<div align=center>". NEWLINE;
39print"<form enctype=\"multipart/form-data\" name=\"upload\" method=post action='requirement_add_action.php'>". NEWLINE;
40print"<input type=hidden name=MAX_FILE_SIZE  value=25000000>". NEWLINE;
41print"<input type=hidden name=req_record_or_file value=".$_GET["type"].">". NEWLINE;
42
43# requirement this new requirement is a child of
44if( !empty($_GET["parent_req"]) ) {
45
46	print"<input type=hidden name=parent_req value=".$_GET["parent_req"].">". NEWLINE;
47}
48
49print"<input type=hidden name=req_author value=$username>". NEWLINE;
50print"<input type=hidden name=project_id value=$project_id>". NEWLINE;
51
52print"<span class='required'>*</span> <span class='print'>" . lang_get('must_complete_field') . "</span>". NEWLINE;
53
54print"<table class=width90>". NEWLINE;
55print"<tr>". NEWLINE;
56print"<td>". NEWLINE;
57print"<table class=inner>". NEWLINE;
58print"<tr>". NEWLINE;
59print"<td colspan=2><h4>". lang_get('new_version') ."</h4></td>". NEWLINE;
60print"</tr>". NEWLINE;
61print"<tr>". NEWLINE;
62print"<td class=center>". NEWLINE;
63
64# NAME
65print"<tr>". NEWLINE;
66print"<td class=form-lbl-r nowrap>". lang_get('req_name') ." <span class='required'>*</span></td>". NEWLINE;
67print"<td class=form-data-l><input type=text name=req_name_required size=69 maxlength=255 value='".session_validate_form_get_field("req_name_required")."'></td>". NEWLINE;
68
69if($_GET['type']=="F") {
70
71	# FILE
72	print"<tr>". NEWLINE;
73	print"<td class=form-lbl-r nowrap>". lang_get('file_name') ." <span class='required'>*</span></td>". NEWLINE;
74	print"<td class=form-data-l><input type=file name=upload_file size=69></td>". NEWLINE;
75
76	print"</tr>". NEWLINE;
77} else {
78
79	# REQUIREMENT DETAIL
80	$detail = session_validate_form_get_field('req_detail_required', "", session_use_FCKeditor());
81	print"<tr>". NEWLINE;
82	print"<td class='form-lbl-r' nowrap>". lang_get('detail') ." <span class='required'>*</span></td>". NEWLINE;
83	print"<td class='form-data-l'>". NEWLINE;
84	html_FCKeditor("req_detail_required", 600, 250, $detail);
85	print"</td>". NEWLINE;
86	print"</tr>". NEWLINE;
87}
88
89# REASON FOR CHANGE
90$reason_for_change = session_validate_form_get_field('req_reason_change', "", session_use_FCKeditor());
91print"<tr>". NEWLINE;
92print"<td class=form-lbl-r nowrap>". lang_get('req_reason_change') ."</td>". NEWLINE;
93print"<td class=form-data-l>";
94print"<textarea name=req_reason_change rows=5 cols=80 >$reason_for_change</textarea>";
95print"</tr>". NEWLINE;
96
97# VERSION
98print"<tr>". NEWLINE;
99print"<td class=form-lbl-r nowrap>". lang_get('version') ."</td>". NEWLINE;
100print"<td class=form-data-l><input type=text name=req_version value='".session_validate_form_get_field('req_version', "1.0" )."' size=5 maxlength=10></td>". NEWLINE;
101print"</tr>". NEWLINE;
102
103# AREA COVERED
104print"<tr>". NEWLINE;
105print"<td class=form-lbl-r nowrap>". lang_get('req_area') ."</td>". NEWLINE;
106print"<td class=form-data-l>". NEWLINE;
107print"<select name=req_area_covered size=1>". NEWLINE;
108	$list_box = array();
109
110	$rows_areas = project_get_req_areas_covered($project_id);
111
112	foreach($rows_areas as $row_area) {
113
114		$list_box[$row_area[REQ_AREA_COVERAGE_ID]] = $row_area[REQ_AREA_COVERAGE];
115	}
116	$list_box[""] = "";
117
118	html_print_list_box_from_key_array(	$list_box,
119										session_validate_form_get_field('req_area') );
120print"</select>". NEWLINE;
121print"</td>". NEWLINE;
122print"</tr>". NEWLINE;
123
124# DOC TYPE
125print"<tr>". NEWLINE;
126print"<td class=form-lbl-r nowrap>". lang_get('req_type') ."</td>". NEWLINE;
127print"<td class=form-data-l>". NEWLINE;
128print"<select name=req_type size=1>". NEWLINE;
129	$list_box = requirement_get_types($project_id, $blank=true);
130
131	html_print_list_box_from_key_array(	$list_box,
132										session_validate_form_get_field('req_type' ) );
133print"</select>". NEWLINE;
134print"</td>". NEWLINE;
135print"</tr>". NEWLINE;
136
137# STATUS
138print"<tr>". NEWLINE;
139print"<td class=form-lbl-r nowrap>". lang_get('req_status') ."</td>". NEWLINE;
140print"<td class=form-data-l>". NEWLINE;
141print"<select name=req_status size=1>". NEWLINE;
142	$list_box = requirement_get_statuses();
143
144	html_print_list_box_from_array(	$list_box,
145									session_validate_form_get_field('req_status') );
146print"</select>". NEWLINE;
147print"</td>". NEWLINE;
148print"</tr>". NEWLINE;
149
150# PRIORITY
151print"<tr>". NEWLINE;
152print"<td class=form-lbl-r nowrap>". lang_get('req_priority') ."</td>". NEWLINE;
153print"<td class=form-data-l>". NEWLINE;
154print"<select name=req_priority size=1>". NEWLINE;
155	$list_box = requirement_get_priority();
156
157	html_print_list_box_from_array(	$list_box,
158									session_validate_form_get_field('req_priority') );
159print"</select>". NEWLINE;
160print"</td>". NEWLINE;
161print"</tr>". NEWLINE;
162
163/*
164# ASSIGN TO RELEASE
165print"<tr>". NEWLINE;
166print"<td class=form-lbl-r nowrap>". lang_get('req_assign_release') ."</td>". NEWLINE;
167print"<td class=form-data-l>". NEWLINE;
168
169print"<select name='req_assign_release'>". NEWLINE;
170$rows_release = requirement_get_distinct_field($project_id, REQ_VERS_ASSIGN_RELEASE);
171for ($i=0; $i<sizeof($rows_release); $i++) {
172
173	$rows_release_2[$rows_release[$i]] = admin_get_release_name($rows_release[$i]);
174}
175
176$rows_release_2[""] = "";
177html_print_list_box_from_key_array( $rows_release_2, session_validate_form_get_field('req_assign_release') );
178print"</select>". NEWLINE;
179
180print"</td>". NEWLINE;
181print"</tr>". NEWLINE;
182*/
183
184# ASSIGNED TO
185print"<tr>". NEWLINE;
186print"<td class=form-lbl-r nowrap>". lang_get('assigned_to') ."</td>". NEWLINE;
187print"<td class=form-data-l>". NEWLINE;
188print"<select name='req_assigned_to'>". NEWLINE;
189
190    $rows_users = user_get_usernames_by_project($project_id, true);
191
192    html_print_list_box_from_array( $rows_users, session_validate_form_get_field('req_assigned_to') );
193
194print"</select>". NEWLINE;
195print"</td>". NEWLINE;
196print"</tr>". NEWLINE;
197
198# FUNCTIONALITY
199print"<tr>". NEWLINE;
200print"<td class=form-lbl-r valign=top nowrap>". lang_get('functionality') ."</td>". NEWLINE;
201print"<td class=form-data-l>". NEWLINE;
202print"<select name='req_functionality[]' size=6 multiple>". NEWLINE;
203	$list_box = array();
204
205	$rows = project_get_req_functionality($project_id);
206
207	foreach($rows as $row) {
208
209		$list_box[$row[REQ_FUNCT_ID]] = $row[REQ_FUNCT_NAME];
210	}
211
212	html_print_list_box_from_key_array( $list_box, session_validate_form_get_field('req_functionality') );
213	#html_print_list_box_from_key_array( $list_box );
214print"</select>". NEWLINE;
215print"</td>". NEWLINE;
216print"</tr>". NEWLINE;
217
218# SUBMIT BUTTON
219print"<tr>". NEWLINE;
220print"<td colspan='2' class=center>&nbsp;</td>". NEWLINE;
221print"</tr>". NEWLINE;
222
223print"<tr>". NEWLINE;
224print"<td colspan='2' class=center><input type='submit' value='". lang_get('create') ."'></td>". NEWLINE;
225print"</tr>". NEWLINE;
226print"</table>". NEWLINE;
227
228print"</td>". NEWLINE;
229print"</tr>". NEWLINE;
230print"</table>". NEWLINE;
231print"</form>". NEWLINE;
232print"</div>". NEWLINE;
233
234html_print_footer();
235
236# ---------------------------------------------------------------------
237# $Log: requirement_add_page.php,v $
238# Revision 1.5  2006/08/05 22:08:37  gth2
239# adding NEWLINE constant to support multiple OS newline chars - gth
240#
241# Revision 1.4  2006/02/24 11:37:48  gth2
242# update to div - class=div-c not working in firefox - gth
243#
244# Revision 1.3  2006/01/09 02:02:14  gth2
245# fixing some defects found while writing help file
246#
247# Revision 1.2  2005/12/13 13:59:56  gth2
248# Completed the addition of requirement priority - gth
249#
250# Revision 1.1.1.1  2005/11/30 23:00:57  gth2
251# importing initial version - gth
252#
253# ---------------------------------------------------------------------
254?>