function testset_add($testset_name, $testset_description, $build_id, $page_name)
{
    global $db;
    $ts_tbl = TS_TBL;
    $f_ts_id = TS_ID;
    $f_name = TS_NAME;
    $f_desc = TS_DESCRIPTION;
    $f_date_created = TS_DATE_CREATED;
    $f_orderby = TS_ORDERBY;
    $f_archive = TS_ARCHIVE;
    $f_build_id = TS_BUILD_ID;
    $date = date_get_short_dt();
    $archive = 'N';
    # query testset table by build and get the max order by
    # add one to the order by when inserting into the testset table
    $q = "SELECT MAX({$f_orderby}) FROM {$ts_tbl} WHERE {$f_build_id} = '{$build_id}'";
    $order_by = db_get_one($db, $q);
    if (!isset($order_by) || $order_by == '') {
        $order_by = '1';
    } else {
        $order_by = $order_by + 1;
    }
    $q = "INSERT INTO {$ts_tbl}\n\t\t ({$f_name}, {$f_desc}, {$f_date_created}, {$f_orderby}, {$f_archive}, {$f_build_id})\n\t\t VALUES\n\t\t ('{$testset_name}', '{$testset_description}', '{$date}', '{$order_by}', '{$archive}', '{$build_id}')";
    db_query($db, $q);
    $q = "SELECT MAX({$f_ts_id}) FROM {$ts_tbl} WHERE {$f_build_id} = '{$build_id}'";
    $testset_id = db_get_one($db, $q);
    #######################################################################################################
    #Add entry into the log table for the project
    $build_name = admin_get_build_name($build_id);
    $deletion = 'N';
    $creation = 'Y';
    $upload = 'N';
    $action = "ADDED TESTSET {$testset_name} to {$build_name}";
    log_activity_log($page_name, $deletion, $creation, $upload, $action);
    #logfile entry end
    #######################################################################################################
    session_set_properties("release", array("testset_id" => $testset_id));
    return $testset_id;
}
function test_add_test_step($test_id, $location, $action, $expected, $test_inputs, $info_step, $page_name)
{
    global $db;
    $ts_tbl = TEST_STEP_TBL;
    $f_id = TEST_STEP_ID;
    $f_test_id = TEST_STEP_TEST_ID;
    $f_step_no = TEST_STEP_NO;
    $f_action = TEST_STEP_ACTION;
    $f_expected = TEST_STEP_EXPECTED;
    $f_test_inputs = TEST_STEP_TEST_INPUTS;
    $f_info_step = TEST_STEP_INFO_STEP;
    $max_step_no = test_step_get_max_step_number($test_id);
    if ($location == 'end') {
        $step_no = $max_step_no + 1;
    } elseif ($location > 0) {
        $step_no = $location + 0.1;
    }
    $q = "INSERT INTO {$ts_tbl}\n\t\t({$f_test_id}, {$f_step_no}, {$f_action}, {$f_expected}, {$f_test_inputs}, {$f_info_step})\n\t\tVALUES ('{$test_id}', '{$step_no}', '{$action}', '{$expected}', '{$test_inputs}', '{$info_step}')";
    db_query($db, $q);
    ################################
    # Add entry into the log table for the project
    $deletion = 'N';
    $creation = 'Y';
    $upload = 'N';
    $log_action = "ADDED TEST STEP TO TEST ID {$test_id}";
    log_activity_log($page_name, $deletion, $creation, $upload, $log_action);
    #################################
}
# See the README and LICENSE files for details
#----------------------------------------------------------------------
# ---------------------------------------------------------------------
# Test Detail Delete Action Page
#
# $RCSfile: test_detail_delete_action.php,v $  $Revision: 1.1.1.1 $
# ---------------------------------------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$s_test_details = session_get_properties("test");
$test_id = $s_test_details['test_id'];
$test_name = test_get_name($test_id);
$redirect_page = "test_detail_page.php";
$delete = util_clean_post_vars('delete');
if ($delete == 'Yes') {
    test_delete_test($test_id);
    $page_name = "DELETE TEST";
    $deletion = 'Y';
    $creation = 'N';
    $upload = 'N';
    $action = "DELETED TEST {$test_name} ";
    log_activity_log($page_name, $deletion, $creation, $upload, $action);
    $redirect_page = "test_page.php";
}
html_redirect($redirect_page);
# ---------------------------------------------------------------------
# $Log: test_detail_delete_action.php,v $
# Revision 1.1.1.1  2005/11/30 23:00:58  gth2
# importing initial version - gth
#
# ---------------------------------------------------------------------
function admin_add_build($release_id, $build_name, $build_description, $page_name)
{
    global $db;
    $build_tbl = BUILD_TBL;
    $f_release_id = BUILD_REL_ID;
    $f_build_name = BUILD_NAME;
    $f_description = BUILD_DESCRIPTION;
    $f_date = BUILD_DATE_REC;
    $f_archive = BUILD_ARCHIVE;
    $date = date_get_short_dt();
    $archive = 'N';
    $q = "INSERT INTO {$build_tbl}\n\t\t ({$f_build_name}, {$f_description}, {$f_date}, {$f_release_id}, {$f_archive})\n\t\t VALUES\n\t\t ('{$build_name}', '{$build_description}', '{$date}', '{$release_id}', '{$archive}')";
    db_query($db, $q);
    #######################################################################################################
    # Add entry into the log table for the project
    $release_name = admin_get_release_name($release_id);
    $deletion = 'N';
    $creation = 'Y';
    $upload = 'N';
    $action = "ADDED BUILD {$build_name} TO RELEASE {$release_name}";
    log_activity_log($page_name, $deletion, $creation, $upload, $action);
    #logfile entry end
    #######################################################################################################
}