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_machines_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 = MACH_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 # Machines 84 # ---------------------------------------------------------------------------------- 85 86 # ---------------------------------------------------------------------------------- 87 # Machines Form 88 # ---------------------------------------------------------------------------------- 89 if( $project_manager ) { 90 print"<form method=post action='project_add_machine_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_machine')."</td>". NEWLINE; 98 print"</tr>". NEWLINE; 99 print"<tr>". NEWLINE; 100 print"<td>". NEWLINE; 101 print"<table class=hide90>". NEWLINE; 102 print"<tr>". NEWLINE; 103 print"<td class='form-lbl-c'>". lang_get('machine_name') ." <span class='required'>*</span>". NEWLINE; 104 print"<input type=text size=20 maxlength=20 name='machine_name_required' value='".session_validate_form_get_field( 'machine_name_required' )."'>". NEWLINE; 105 print"</td>". NEWLINE; 106 print"<td class='form-lbl-c'>". lang_get('machine_location') ." <span class='required'>*</span>". NEWLINE; 107 print"<input type=text size=25 maxlength=25 name='machine_location_required' value='".session_validate_form_get_field( 'machine_location_required' )."'>". NEWLINE; 108 print"</td>". NEWLINE; 109 print"<td class='form-lbl-c'>". lang_get('machine_ip') ." <span class='required'>*</span>". NEWLINE; 110 print"<input type=text size=15 maxlength=15 name='machine_ip_required' value='".session_validate_form_get_field( 'machine_ip_required' )."'>". NEWLINE; 111 print"</td>". NEWLINE; 112 print"</tr>". NEWLINE; 113 print"</table>". NEWLINE; 114 print"</td>". NEWLINE; 115 print"</tr>". NEWLINE; 116 print"<tr>". NEWLINE; 117 print"<td class=center><input type=submit name='new_area_tested' value='".lang_get("add")."'></td>". NEWLINE; 118 print"</tr>". NEWLINE; 119 print"</table>". NEWLINE; 120 print"</td>". NEWLINE; 121 print"</tr>". NEWLINE; 122 print"</table>". NEWLINE; 123 print"</form>". NEWLINE; 124 } 125 126 # ---------------------------------------------------------------------------------- 127 # Machines Table 128 # ---------------------------------------------------------------------------------- 129 print"<br>". NEWLINE; 130 print"<form method=post action='$page?order_by=$order_by&order_dir=$order_dir'>". NEWLINE; 131 print"<input type=hidden name=table value=project_manage_machines>". NEWLINE; 132 print"<table class=hide70>". NEWLINE; 133 print"<tr>". NEWLINE; 134 print"<td>". NEWLINE; 135 $rows_machines = project_get_machines($selected_project_id, $order_by, $order_dir, $page_number); 136 print"<input type=hidden name='order_dir' value='$order_dir'>"; 137 print"<input type=hidden name='order_by' value='$order_by'>"; 138 print"</td>". NEWLINE; 139 print"</tr>". NEWLINE; 140 print"</table>". NEWLINE; 141 print"</form>". NEWLINE; 142 143 if( $rows_machines ) { 144 145 print"<table class='width70' rules='cols'>". NEWLINE; 146 print"<tr>". NEWLINE; 147 html_tbl_print_header( lang_get('machine_name'), MACH_NAME, $order_by, $order_dir, "$page?page_number=$page_number" ); 148 html_tbl_print_header( lang_get('machine_location'), MACH_LOCATION, $order_by, $order_dir, "$page?page_number=$page_number" ); 149 html_tbl_print_header( lang_get('machine_ip') ); 150 if( $project_manager ) { 151 html_tbl_print_header( lang_get('edit') ); 152 html_tbl_print_header( lang_get('delete') ); 153 } 154 print"\n</tr>". NEWLINE; 155 156 foreach($rows_machines as $row_machine) { 157 $row_machine_id = $row_machine[MACH_ID]; 158 $row_machine_name = $row_machine[MACH_NAME]; 159 $row_machine_location = $row_machine[MACH_LOCATION]; 160 $row_machine_ip = $row_machine[MACH_IP_ADDRESS]; 161 162 $row_style = html_tbl_alternate_bgcolor($row_style); 163 164 print"<tr class='$row_style'>". NEWLINE; 165 print"<td>$row_machine_name</td>". NEWLINE; 166 print"<td>$row_machine_location</td>". NEWLINE; 167 print"<td>$row_machine_ip</td>". NEWLINE; 168 if( $project_manager ) { 169 print"<td><a href='project_edit_machine_page.php?machine_id=$row_machine_id'>".lang_get("edit")."</a></td>". NEWLINE; 170 print"<td>". NEWLINE; 171 print"<form name='delete_release' method=post action='$delete_page'>". NEWLINE; 172 print"<input type='submit' name='delete_machine' value='". lang_get( 'delete' ) ."' class='page-numbers'>". NEWLINE; 173 print"<input type='hidden' name='r_page' value='$redirect_url#machines'>". NEWLINE; 174 print"<input type='hidden' name='f' value='remove_machine_from_project'>". NEWLINE; 175 print"<input type='hidden' name='id' value='$row_machine_id'>". NEWLINE; 176 print"<input type='hidden' name='project_id' value='$selected_project_id'>". NEWLINE; 177 print"<input type='hidden' name='msg' value='". DEL_MACHINE_FROM_PROJECT ."'>". NEWLINE; 178 print"</form>". NEWLINE; 179 print"</td>". NEWLINE; 180 } 181 print"</tr>". NEWLINE; 182 } 183 184 print"</table>". NEWLINE; 185 #print"</form>". NEWLINE; 186 187 print"<br>". NEWLINE; 188 } 189 190} else { 191 html_no_records_found_message( lang_get('no_projects') ); 192} 193 194print"</div>". NEWLINE; 195 196html_print_footer(); 197 198# ------------------------------------ 199# $Log: project_manage_machines_page.php,v $ 200# Revision 1.2 2006/08/05 22:08:24 gth2 201# adding NEWLINE constant to support multiple OS newline chars - gth 202# 203# Revision 1.1.1.1 2005/11/30 23:00:57 gth2 204# importing initial version - gth 205# 206# ------------------------------------ 207 208?>