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# $RCSfile: test_add_doc_version_action.php,v $ $Revision: 1.6 $ 10# --------------------------------------------------------------------- 11 12include"./api/include_api.php"; 13auth_authenticate_user(); 14 15 16$page = basename(__FILE__); 17$s_test_details = session_get_properties("test"); 18$test_id = $s_test_details['test_id']; 19 20 21$project_properties = session_get_project_properties(); 22$project_id = $project_properties['project_id']; 23$upload_path = $project_properties['test_upload_path']; 24$s_user = session_get_user_properties(); 25$username = $s_user['username']; 26$test_name = test_get_name( $test_id ); 27 28if(isset($_POST['comments'])){ 29 $comments = $_POST['comments']; 30} 31if(isset($_POST['doc_type'])){ 32 $doc_type = $_POST['doc_type']; 33} 34 35if( isset( $_POST['manual_test_id'] ) && $_POST['manual_test_id'] != "" ) { 36 37 $manual_test_id = $_POST['manual_test_id']; //session_validate_form_get_field('manual_test_id'); 38} 39else { 40 $manual_test_id = $_GET['manual_test_id']; 41} 42 43$redirect_page = "test_detail_page.php?test_id=$test_id&project_id=$project_id&tab=2"; 44$redirect_on_error = "test_add_doc_version_page.php?test_id=$test_id&manual_test_id=$manual_test_id"; 45 46session_validate_form_set($_POST, $redirect_page); 47 48 49# Make sure the user entered a file name 50$file_temp_name = $_FILES['uploadfile_required']['tmp_name']; 51$file_name = str_replace(" ","_",$_FILES['uploadfile_required']['name']); 52$file_size = $_FILES['uploadfile_required']['size']; 53 54 55# Make sure the user filled in the file name. 56if( !isset( $file_temp_name ) || !is_uploaded_file( $file_temp_name) ) { 57 58 error_report_show($redirect_on_error, REQUIRED_FIELD_MISSING); 59} 60 61if( $file_size != '0' && is_uploaded_file($file_temp_name) ) { 62 63 //print"manual_test_id = $manual_test_id<br>"; 64 65 file_add_supporting_test_doc_version($file_temp_name, $file_name, $test_id, $manual_test_id, $comments, $doc_type ); 66 67} 68else{ 69 error_report_show($redirect_on_error, FAILED_FILE_UPLOAD); 70} 71 72html_print_operation_successful( 'file_upload_page', $redirect_page ); 73 74# --------------------------------------------------------------------- 75# $Log: test_add_doc_version_action.php,v $ 76# Revision 1.6 2008/08/07 10:57:51 peter_thal 77# Now blanks are replaced with underscores by adding a new supporting doc 78# 79# Revision 1.5 2008/08/05 07:22:33 peter_thal 80# fixed save bug for comment and doc type field 81# 82# Revision 1.4 2008/07/23 14:53:50 peter_thal 83# delete supporting docs feature added (linux/unix) 84# 85# Revision 1.3 2008/07/17 13:54:12 peter_thal 86# added new feature: test sets status (overview) 87# +fixed some bugs with project_id parameter in testdetail_page references 88# 89# Revision 1.2 2006/04/09 20:46:21 gth2 90# adding code lost during cvs outage - gth 91# 92# Revision 1.1 2006/03/12 21:29:09 gth2 93# Adding initial version - gth 94# 95# --------------------------------------------------------------------- 96 97?>