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 Assoc Page
10#
11# $RCSfile: requirement_assoc_page.php,v $  $Revision: 1.4 $
12# ---------------------------------------------------------------------
13
14if( isset($_POST['submit_btn']) ) {
15
16	require_once("requirement_assoc_action.php");
17	exit;
18}
19
20include"./api/include_api.php";
21auth_authenticate_user();
22
23$page                   = basename(__FILE__);
24$action_page            = 'requirement_assoc_action.php';
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$row_style		= '';
30
31$records		= "";
32
33$s_properties		= session_set_properties("requirements", $_GET);
34$s_req_id			= $s_properties['req_id'];
35$s_req_version_id	= $s_properties['req_version_id'];
36
37$filter_per_page		= 100;
38$filter_doc_type		= "";
39$filter_status			= "";
40$filter_area_covered	= "";
41$filter_functionality	= "";
42$filter_assign_release	= "";
43$filter_show_versions	= "latest";
44$filter_search			= "";
45$filter_priority		= "";
46
47$order_by 		= REQ_FILENAME;
48$order_dir		= "ASC";
49$page_number	= 1;
50
51util_set_filter('per_page', $filter_per_page, $_POST);
52util_set_filter('doc_type', $filter_doc_type, $_POST);
53util_set_filter('status', $filter_status, $_POST);
54util_set_filter('area_covered', $filter_area_covered, $_POST);
55util_set_filter('functionality', $filter_functionality, $_POST);
56util_set_filter('assign_release', $filter_assign_release, $_POST);
57util_set_filter('requirement_search', $filter_search, $_POST);
58util_set_filter('priority', $filter_priority, $_POST);
59
60util_set_order_by($order_by, $_POST);
61util_set_order_dir($order_dir, $_POST);
62util_set_page_number($page_number, $_POST);
63
64$rows_children = requirement_get_children($s_req_id);
65$selected_rows = array();
66
67foreach($rows_children as $row_child) {
68
69	$selected_rows[$row_child["uid"]] = "";
70}
71
72
73session_records(	"requirement_requirement_assoc",
74					$selected_rows );
75
76html_window_title();
77html_print_body();
78html_page_title($project_name ." - ". lang_get("req_req_assoc_page"));
79html_page_header( $db, $project_name );
80html_print_menu();
81
82requirement_menu_print($page);
83
84error_report_check( $_GET );
85
86$row_requirement = requirement_get_detail( $project_id, $s_req_id, $s_req_version_id );
87
88foreach( $row_requirement as $row_detail ) {
89
90		$req_name			= $row_detail[REQ_FILENAME];
91		$req_version_num	= $row_detail[REQ_VERS_VERSION];
92		$req_status			= $row_detail[REQ_VERS_STATUS];
93		$area_covered		= $row_detail[REQ_AREA_COVERAGE];
94		$req_author			= $row_detail[REQ_VERS_UPLOADED_BY];
95		$req_doc_type		= $row_detail[REQ_DOC_TYPE_NAME];
96		$date_created		= $row_detail[REQ_VERS_TIMESTAMP];
97		$locked_by			= $row_detail[REQ_LOCKED_BY];
98		$locked_date		= $row_detail[REQ_LOCKED_DATE];
99		$assigned_to		= $row_detail[REQ_VERS_ASSIGNED_TO];
100		$record_or_file		= $row_detail[REQ_REC_FILE];
101		$req_file_name		= $row_detail[REQ_VERS_FILENAME]; # Blank if record based
102		$req_detail			= $row_detail[REQ_VERS_DETAIL]; # Blank if file based
103		$req_priority		= $row_detail[REQ_PRIORITY];
104
105}
106
107print"<br>". NEWLINE;
108
109print"<form method=post action='$page'>". NEWLINE;
110
111print"<div align=center>". NEWLINE;
112
113print"<table class=width100 rules=cols>". NEWLINE;
114print"<tr>". NEWLINE;
115print"<td width='50%' nowrap class=grid-header-c>".lang_get('req_id')."</td>". NEWLINE;
116print"<td width='50%' nowrap class=grid-header-c>".lang_get('req_name')."</td>". NEWLINE;
117print"</tr>". NEWLINE;
118
119print"<tr>". NEWLINE;
120print"<td width='50%' class=grid-data-c><a href='requirement_detail_page.php?req_id=$s_req_id&amp;req_version_id=$s_req_version_id'>".sprintf( "%05s",trim( $s_req_id ) )."</a></td>". NEWLINE;
121print"<td width='50%' class=grid-data-c>$req_name</td>". NEWLINE;
122print"</tr>". NEWLINE;
123print"</table>". NEWLINE;
124
125print"<br>";
126
127html_print_requirements_filter(	$project_id,
128								$filter_doc_type,
129								$filter_status,
130								$filter_area_covered,
131								$filter_functionality,
132								$filter_assign_release,
133								$filter_per_page,
134								$filter_show_versions,
135								$filter_search,
136								$filter_priority);
137
138print"<br>". NEWLINE;
139
140print"</div>". NEWLINE;
141
142$rows_requirement = requirement_get_edit_children(  $project_id,
143													$s_req_id,
144													$page_number,
145													$order_by,
146													$order_dir,
147													$filter_doc_type,
148													$filter_status,
149													$filter_area_covered,
150													$filter_functionality,
151													$filter_assign_release,
152													$filter_show_versions,
153													$filter_search,
154													$filter_priority,
155													$filter_per_page );
156
157################################################################################
158# Testset table
159
160if($rows_requirement) {
161
162
163	print"<div align=center>". NEWLINE;
164
165	print"<table class=width100 rules=cols>". NEWLINE;
166
167	# Table headers
168	print"<tr class=tbl_header>". NEWLINE;
169	print"<th></th>";
170	html_tbl_print_header( lang_get('req_id'), REQ_ID, $order_by, $order_dir );
171	html_tbl_print_header( "" );
172	html_tbl_print_header( lang_get('req_name'), REQ_FILENAME, $order_by, $order_dir );
173	html_tbl_print_header( lang_get('req_detail'), REQ_VERS_DETAIL, $order_by, $order_dir );
174	html_tbl_print_header( lang_get('req_type'), REQ_DOC_TYPE_NAME, $order_by, $order_dir );
175	html_tbl_print_header( lang_get('status'), REQ_VERS_STATUS, $order_by, $order_dir );
176	html_tbl_print_header( lang_get('req_area'), REQ_AREA_COVERAGE, $order_by, $order_dir );
177	html_tbl_print_header( lang_get('functionality') );
178	html_tbl_print_header( lang_get('req_locked_by'), REQ_LOCKED_BY, $order_by, $order_dir );
179	html_tbl_print_header( lang_get('req_locked_date'),	REQ_LOCKED_DATE, $order_by, $order_dir );
180	print"</tr>". NEWLINE;
181
182	foreach($rows_requirement as $row_requirement) {
183
184		$req_id					= $row_requirement[REQ_ID];
185		$req_version_id			= $row_requirement[REQ_VERS_UNIQUE_ID];
186
187		if( session_records_ischecked("requirement_requirement_assoc", $req_id) ) {
188
189			$checked = "checked";
190		} else {
191
192			$checked = "";
193		}
194
195		# Build list of records
196		if( empty($records) ) {
197			$records = $req_id." => ''";
198		} else {
199			$records .= ", ".$req_id." => ''";
200		}
201
202		$row_style = html_tbl_alternate_bgcolor($row_style);
203
204		$rows_functions = requirement_get_functionality($project_id, $row_requirement[REQ_ID]);
205
206		# Rows
207		print"<tr class='$row_style'>". NEWLINE;
208		print"<td><input type='checkbox' name=row_$req_id $checked></td>";
209		print"<td><a href='requirement_detail_page.php?req_id=$req_id&amp;req_version_id=$req_version_id'>".util_pad_id($row_requirement[REQ_ID])."</a></td>". NEWLINE;
210		print"<td>".html_file_type( $row_requirement[REQ_VERS_FILENAME] )."</td>". NEWLINE;
211		print"<td class='tbl-l'>".$row_requirement[REQ_FILENAME]."</td>". NEWLINE;
212		print"<td class='tbl-l'>".$row_requirement[REQ_VERS_DETAIL]."</td>". NEWLINE;
213		print"<td class='tbl-l'>".$row_requirement[REQ_DOC_TYPE_NAME]."</td>". NEWLINE;
214		print"<td class='tbl-l'>".$row_requirement[REQ_VERS_STATUS]."</td>". NEWLINE;
215		print"<td class='tbl-l'>".$row_requirement[REQ_AREA_COVERAGE]."</td>". NEWLINE;
216		print"<td class='tbl-l'>";
217		foreach($rows_functions as $key => $value) {
218
219			print$value."<br>";
220		}
221		print"</td>". NEWLINE;
222		print"<td class='tbl-l'>".$row_requirement[REQ_LOCKED_BY]."</td>". NEWLINE;
223		print"<td class='tbl-l'>".$row_requirement[REQ_LOCKED_DATE]."</td>". NEWLINE;
224		print"</tr>". NEWLINE;
225	}
226
227	print"</table>". NEWLINE;
228
229	print"</div>". NEWLINE;
230
231	//print lang_get("update").": &nbsp;". NEWLINE;
232	if( session_use_javascript() ) {
233		print"<input id=select_all type=checkbox name=thispage onClick='checkAll( this )'>". NEWLINE;
234		print"<label for=select_all>".lang_get("select_all")."</label>";
235		print"&nbsp;". NEWLINE;
236	}
237
238	print"<div align=center>";
239	print"<br><input type=submit name=submit_btn value='".lang_get("update")."'>". NEWLINE;
240	print"</div>";
241
242} else {
243
244	print lang_get("no_requirements");
245}
246
247print"<input type=hidden name=records value=\"$records\">". NEWLINE;
248print"</form>". NEWLINE;
249
250html_print_footer();
251
252
253# ---------------------------------------------------------------------
254# $Log: requirement_assoc_page.php,v $
255# Revision 1.4  2006/08/05 22:08:37  gth2
256# adding NEWLINE constant to support multiple OS newline chars - gth
257#
258# Revision 1.3  2006/02/24 11:37:48  gth2
259# update to div - class=div-c not working in firefox - gth
260#
261# Revision 1.2  2006/01/04 22:58:29  gth2
262# fixing bug with filter on req-to-req assoc page - gth
263#
264# Revision 1.1.1.1  2005/11/30 23:00:57  gth2
265# importing initial version - gth
266#
267# ---------------------------------------------------------------------
268?>