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# Test Detail New Upload Action Page
10#
11# $RCSfile: test_detail_new_upload_action.php,v $  $Revision: 1.8 $
12# ---------------------------------------------------------------------
13
14include"./api/include_api.php";
15auth_authenticate_user();
16
17$page				= basename(__FILE__);
18$s_test_details		= session_get_properties("test");
19$project_prop		= session_get_project_properties();
20$test_id			= $s_test_details['test_id'];
21$project_id			= $project_prop['project_id'];
22$redirect_page		= "test_detail_page.php?test_id=$test_id&project_id=$project_id&tab=2";
23$redirect_on_error	= "test_detail_page.php?test_id=$test_id&project_id=$project_id&tab=2";
24
25session_validate_form_set($_POST, $redirect_page);
26
27$project_properties	= session_get_project_properties();
28$upload_path		= $project_properties['test_upload_path'];
29$s_user				= session_get_user_properties();
30$username			= $s_user['username'];
31$test_name			= test_get_name( $test_id );
32$comments			= session_validate_form_get_field('comments');
33$doc_type			= session_validate_form_get_field('doc_type');
34
35$upload_file_name	= $_FILES['uploadfile']['name'];
36$_FILES['uploadfile']['name'] = str_replace(" ","_",$upload_file_name);
37
38# ------------------------------------------------
39# FILE UPLOAD
40# ------------------------------------------------
41if( $_FILES['uploadfile']['size'] != '0' && is_uploaded_file($_FILES['uploadfile']['tmp_name']) ) {
42
43	file_add_supporting_test_doc($_FILES['uploadfile']['tmp_name'], $_FILES['uploadfile']['name'], $test_id, $comments, $doc_type );
44
45}
46else{
47	error_report_show( $redirect_on_error, NO_FILE_SPECIFIED );
48}
49
50html_print_operation_successful( 'file_upload_page', $redirect_page );
51
52# ---------------------------------------------------------------------
53# $Log: test_detail_new_upload_action.php,v $
54# Revision 1.8  2008/08/07 10:57:51  peter_thal
55# Now blanks are replaced with underscores by adding a new supporting doc
56#
57# Revision 1.7  2008/07/23 14:53:50  peter_thal
58# delete supporting docs feature added (linux/unix)
59#
60# Revision 1.6  2008/07/09 07:13:24  peter_thal
61# added direct linking of test detail by adding project_id link parameter
62# added automated project switching if necessary
63#
64# Revision 1.5  2006/06/30 00:39:46  gth2
65# correct page title - gth
66#
67# Revision 1.4  2006/04/11 12:11:03  gth2
68# create a test version when uploading test steps - gth
69#
70# Revision 1.3  2006/04/05 12:39:30  gth2
71# no message
72#
73# Revision 1.2  2006/01/09 02:02:14  gth2
74# fixing some defects found while writing help file
75#
76# Revision 1.1.1.1  2005/11/30 23:00:58  gth2
77# importing initial version - gth
78#
79# ---------------------------------------------------------------------
80
81?>