<?php
# ---------------------------------------------------------------------
# truc is a tool for requirement and use case tracking
# Copyright (C) 2006 ASDIS - http://sf.net/projects/truc
#
# (rth) Initial truc version based on rth
#       Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
#
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------

include"./api/include_api.php";
auth_authenticate_user();

$test_id			= $_POST['test_id'];
$test_step_id		= $_POST['test_step_id'];
//$test_version_id	= $_POST['test_version_id'];
$page				= 'test_step_edit_page.php';
$error_page			= 'test_step_edit_page.php?test_step_id='. $test_step_id .'&test_id='. $test_id;
$redirect_page 		= 'test_detail_page.php?test_id='. $test_id;

session_validate_form_set($_POST, $error_page);

$user_properties		= session_get_user_properties();
$user_id				= $user_properties['user_id'];
$username				= $user_properties['username'];

        if (usecase_locked(-1,$test_id,$username)) {
                 html_print_operation_failed( 'usecase_edit_page',error_report_msg(CAN_NOT_MODIFY_USECASE_LOCKED,usecase_locked_by(-1,$test_id)), "test_detail_page.php?test_id=".$test_id);
                 exit;
       }


$info_step="N";
if (!empty($_POST['info_step'])) $info_step=$_POST['info_step'];

$parent_step=0;
if (!empty($_POST['parent_step'])) $parent_step=$_POST['parent_step'];

test_update_test_step(  $test_id,
						$test_step_id,
						session_validate_form_get_field('location'),
						session_validate_form_get_field('step_action_required', "", session_use_FCKeditor()),
						session_validate_form_get_field('step_inputs_required', "", session_use_FCKeditor()),
						session_validate_form_get_field('step_expected_required', "", session_use_FCKeditor()),
						$info_step,
                                                $parent_step );

session_validate_form_reset();

html_print_operation_successful( "add_test_step", $redirect_page );
?>