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# Results Upload Test Run File Page
10#
11# $RCSfile: results_upload_test_run_file.php,v $  $Revision: 1.2 $
12# ---------------------------------------------------------------------
13
14include"./api/include_api.php";
15auth_authenticate_user();
16
17$page				= basename(__FILE__);
18$s_results			= session_get_properties("results");
19$test_id			= $s_results['test_id'];
20$testset_id			= $s_results['testset_id'];
21$test_run_id		= $s_results['test_run_id'];
22
23$redirect_page		= "results_view_verifications_page.php?test_id=". $test_id ."&testset_id=". $testset_id;
24$redirect_page_file_upload = "results_view_verifications_page.php?"." $test_id=" .$test_id."&testset_id=". $testset_id."&test_run_id=". $test_run_id;
25
26session_validate_form_set($_POST, $redirect_page);
27
28$s_user				= session_get_user_properties();
29$username			= $s_user['username'];
30$test_name			= test_get_name( $test_id );
31$comments			= $_POST['comments'];
32
33# ------------------------------------------------
34# FILE UPLOAD
35# ------------------------------------------------
36# NEED TO FIND OUT THE LINK FIELD IS FOR.  SPEAK TO RT
37$project_properties	= session_get_project_properties();
38$upload_path		= $project_properties['test_run_upload_path'];
39
40if( $_FILES['upload_file']['size'] != '0' && is_uploaded_file($_FILES['upload_file']['tmp_name']) ) {
41
42	file_add_test_run_doc(	$_FILES['upload_file']['tmp_name'],
43							$_FILES['upload_file']['name'],
44							$test_run_id,
45							$username,
46							$comments,
47							$redirect_page_file_upload);
48
49}
50else{
51	print"Error uploading file. Either the file size = 0 or the file is not a valid file";
52}
53
54html_print_operation_successful( 'run_manual_test_page', $redirect_page );
55
56# ---------------------------------------------------------------------
57# $Log: results_upload_test_run_file.php,v $
58# Revision 1.2  2006/01/09 02:02:14  gth2
59# fixing some defects found while writing help file
60#
61# Revision 1.1.1.1  2005/11/30 23:00:58  gth2
62# importing initial version - gth
63#
64# ---------------------------------------------------------------------
65
66?>