# ------------------------------------
# Manage Project Page
#
# $RCSfile: project_manage_testdoctype_page.php,v $ $Revision: 1.3 $
# ------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$page = basename(__FILE__);
$project_manage_page = 'project_manage_page.php';
$project_add_page = 'project_add_page.php';
$project_edit_page = 'project_edit_page.php';
$user_manage_page = 'user_manage_page.php';
$user_add_page = 'user_add_page.php';
$project_manage_action = 'project_manage_action.php';
$delete_page = 'delete_page.php';
$s_project_properties = session_get_project_properties();
$project_name = $s_project_properties['project_name'];
$project_id = $s_project_properties['project_id'];
$s_user_properties = session_get_user_properties();
$user_id = $s_user_properties['user_id'];
session_set_properties("project_manage", $_GET);
$selected_project_properties = session_get_properties("project_manage");
$selected_project_id = $selected_project_properties['project_id'];
$project_manager = user_has_rights($selected_project_id, $user_id, MANAGER);
$redirect_url = $page . "?project_id=" . $selected_project_id;
$s_user_properties = session_get_user_properties();
$user_id = $s_user_properties['user_id'];
$row_style = '';
$order_by = MAN_DOC_TYPE_NAME;
$order_dir = "ASC";
$page_number = 1;
Exemplo n.º 2
0
function test_import_excel($test_id, $name)
{
    global $db;
    $ts_tbl = TEST_STEP_TBL;
    $f_ts_id = TEST_STEP_ID;
    $f_ts_test_id = TEST_STEP_TEST_ID;
    $f_ts_step_no = TEST_STEP_NO;
    $f_ts_action = TEST_STEP_ACTION;
    $f_ts_input = TEST_STEP_TEST_INPUTS;
    $f_ts_expected = TEST_STEP_EXPECTED;
    $f_info_step = TEST_STEP_INFO_STEP;
    $s_project_properties = session_get_project_properties();
    $project_name = $s_project_properties['project_name'];
    $redirect_on_error = "test_step_import_csv_page.php?test_id={$test_id}";
    $uploaded_file = $_FILES[$name];
    $file_name = $_FILES[$name]['name'];
    $file_temp_name = $_FILES[$name]['tmp_name'];
    $file_size = $_FILES[$name]['size'];
    /*
    print"file_name = $file_name<br>";
    print"file_temp_name = $uploaded_file[tmp_name]<br>";
    print"file_size = $uploaded_file[size]<br>";
    */
    if ($file_size != '0' && is_uploaded_file($file_temp_name)) {
        require_once './Excel/reader.php';
        // ExcelFile($filename, $encoding);
        $data = new Spreadsheet_Excel_Reader();
        // Set output Encoding.
        $data->setOutputEncoding('CP1251');
        /***
         * if you want you can change 'iconv' to mb_convert_encoding:
         * $data->setUTFEncoder('mb');
         *
         **/
        /***
         * By default rows & cols indeces start with 1
         * For change initial index use:
         * $data->setRowColOffset(0);
         *
         **/
        /***
         *  Some function for formatting output.
         * $data->setDefaultFormat('%.2f');
         * setDefaultFormat - set format for columns with unknown formatting
         *
         * $data->setColumnFormat(4, '%.3f');
         * setColumnFormat - set format for column (apply only to number fields)
         *
         **/
        $data->read($uploaded_file['tmp_name']);
        //error_reporting(E_ALL ^ E_NOTICE);
        $debug = false;
        if (!$debug) {
            $q = "DELETE FROM {$ts_tbl} WHERE {$f_ts_test_id} = '{$test_id}'";
            db_query($db, $q);
        }
        for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
            $step_no = '';
            $action = '';
            $test_input = '';
            $expected = '';
            $info = '';
            //for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {
            //echo "\"".$data->sheets[0]['cells'][$i][1]."\",";
            /*
            print"i = $i<br>";
            	print"j = $j<br>";
            */
            # Get record from CSV file
            $step_no = @util_html_special_chars_string($data->sheets[0]['cells'][$i][1]);
            $action = @util_html_special_chars_string($data->sheets[0]['cells'][$i][2]);
            $test_input = @util_html_special_chars_string($data->sheets[0]['cells'][$i][3]);
            $expected = @util_html_special_chars_string($data->sheets[0]['cells'][$i][4]);
            $info = @util_html_special_chars_string($data->sheets[0]['cells'][$i][5]);
            # We don't need to insert the column headers
            if ($i > 1) {
                # Insert into the Test Set table
                $q = "\tINSERT INTO {$ts_tbl}\n\t\t\t\t\t\t( {$f_ts_test_id}, {$f_ts_step_no}, {$f_ts_action}, {$f_ts_input}, {$f_ts_expected}, {$f_info_step} )\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t( '{$test_id}', '{$step_no}', '{$action}', '{$test_input}', '{$expected}', '{$info}' )";
                if ($debug) {
                    print "{$q};<br>";
                } else {
                    db_query($db, $q);
                }
            }
        }
        # Create a version of the file in Test Doc Version table if the upload was successful
        if (file_name_exists($test_id, $file_name)) {
            # Get the manual_test_id from the Manual Test Doc table and add a new file version
            $manual_test_id = test_get_manual_test_id($test_id, $file_name);
            file_add_supporting_test_doc_version($file_temp_name, $file_name, $test_id, $manual_test_id, $comments = "", $file_type = "");
        } else {
            # Add a new file
            file_add_supporting_test_doc($file_temp_name, $file_name, $test_id, $comments = "", $file_type = "");
        }
    } else {
        # The user tried to upload and empty file
        error_report_show($redirect_on_error, NO_FILE_SPECIFIED);
    }
}
Exemplo n.º 3
0
function html_print_field_filter($filter_screen, $filter_search)
{
    $s_project_properties = session_get_project_properties();
    $project_id = $s_project_properties['project_id'];
    print "<table class=width60>" . NEWLINE;
    print "<tr>" . NEWLINE;
    print "<td>" . NEWLINE;
    print "<table class=inner rules=none border=0>" . NEWLINE;
    # TITLES FOR HEADER DIALOG
    print "<tr class=left>" . NEWLINE;
    print "<td class=form-header-c>" . lang_get('screen_name') . "</td>" . NEWLINE;
    print "<td class=form-header-c>" . lang_get('search') . "</td>" . NEWLINE;
    print "<td>&nbsp;</td>" . NEWLINE;
    print "</tr>" . NEWLINE;
    print "<tr>" . NEWLINE;
    # SCREEN_NAMES
    $screens = test_get_screens($project_id, SCREEN_NAME, "ASC");
    $screen_array = array();
    foreach ($screens as $screen) {
        $screen_array[$screen[SCREEN_ID]] = $screen[SCREEN_NAME];
    }
    print "<td align=center>" . NEWLINE;
    print "<select name='filter_screen'>" . NEWLINE;
    print "<option value=''></option>" . NEWLINE;
    html_print_list_box_from_key_array($screen_array, $filter_screen);
    print "</select>" . NEWLINE;
    print "</td>" . NEWLINE;
    # SEARCH
    print "<td align='center'>" . NEWLINE;
    print "<input type='text' size='15' maxlength='25' name='filter_search' value='" . $filter_search . "'>" . NEWLINE;
    print "</td>" . NEWLINE;
    # FILTER BUTTON
    print "<td align='center' rowspan=4 valign=center><input type='submit' value='Filter'></td>" . NEWLINE;
    print "</tr>" . NEWLINE;
    print "</table>";
    print "<input type=hidden name=field_form_filter_value value=true>" . NEWLINE;
    print "</td>" . NEWLINE;
    print "</tr>" . NEWLINE;
    print "</table>" . NEWLINE;
}
Exemplo n.º 4
0
function error_format($errno, $errstr, $errfile, $errline)
{
    $dt = date("Y-m-d H:i:s (T)");
    $user_details = session_get_user_properties();
    $project_details = session_get_project_properties();
    $user_name = $user_details['username'];
    $project_name = $project_details['project_name'];
    $error_type = error_type_map($errno);
    $err = "{$error_type}" . NEWLINE;
    $err .= "Time: " . $dt . "" . NEWLINE;
    $err .= "Message: " . $errstr . "" . NEWLINE;
    $err .= "File: " . $errfile . "" . NEWLINE;
    $err .= "Line Number: " . $errline . "" . NEWLINE;
    $err .= "User: "******"" . NEWLINE;
    $err .= "Project: " . $project_name . "" . NEWLINE;
    $err .= "Server: " . $_SERVER['SERVER_NAME'] . "" . NEWLINE;
    return $err;
}
Exemplo n.º 5
0
function file_add_bug_file($upload_file_temp_name, $upload_file_name, $bug_id, $redirect_page)
{
    global $db;
    $bug_file_tbl = BUG_FILE_TBL;
    $f_bug_id = BUG_FILE_TBL . "." . BUG_FILE_BUG_ID;
    $f_uploaded_by = BUG_FILE_TBL . "." . BUG_FILE_UPLOAD_DATE;
    $f_uploaded_date = BUG_FILE_TBL . "." . BUG_FILE_UPLOAD_BY;
    $f_display_name = BUG_FILE_TBL . "." . BUG_FILE_DISPLAY_NAME;
    $f_file_name = BUG_FILE_TBL . "." . BUG_FILE_NAME;
    $uploaded_by = session_get_username();
    $current_date = date("Y-m-d H:i:s");
    $project_properties = session_get_project_properties();
    $file_upload_dir = $project_properties['defect_upload_path'];
    # create a unique name for the file using the time function
    $file_db_name = "BugFile" . time() . "-{$upload_file_name}";
    # Throw error if user didn't enter a file name
    if (!isset($upload_file_temp_name) || !is_uploaded_file($upload_file_temp_name)) {
        error_report_show($redirect_page, REQUIRED_FIELD_MISSING);
    }
    # Insert a record into the bugfile table if the file upload was successful
    if (move_uploaded_file($upload_file_temp_name, $file_upload_dir . $file_db_name)) {
        $q = "INSERT INTO {$bug_file_tbl}\n\t\t\t\t( {$f_bug_id}, {$f_uploaded_by}, {$f_uploaded_date}, {$f_display_name}, {$f_file_name})\n\t\t\t  VALUES\n\t\t\t\t('{$bug_id}', '{$uploaded_by}', '{$current_date}', '{$upload_file_name}', '{$file_db_name}')";
        //print"$q<br>";
        db_query($db, $q);
    }
}
function requirement_group_assoc_release($req_ids, $release_id)
{
    global $db;
    $tbl_req = REQ_TBL;
    $f_req_proj_id = $tbl_req . "." . REQ_PROJECT_ID;
    $f_req_id = $tbl_req . "." . REQ_ID;
    $f_req_filename = $tbl_req . "." . REQ_FILENAME;
    $tbl_req_ver_assoc_rel = REQ_VERS_ASSOC_REL;
    $f_req_ver_assoc_rel_id = $tbl_req_ver_assoc_rel . "." . REQ_VERS_ASSOC_REL_ID;
    $f_req_ver_assoc_rel_req_id = $tbl_req_ver_assoc_rel . "." . REQ_VERS_ASSOC_REL_REQ_ID;
    $f_req_ver_assoc_rel_rel_id = $tbl_req_ver_assoc_rel . "." . REQ_VERS_ASSOC_REL_REL_ID;
    $tbl_release = RELEASE_TBL;
    $f_release_id = $tbl_release . "." . RELEASE_ID;
    $f_release_project_id = $tbl_release . "." . PROJECT_ID;
    $f_release_name = $tbl_release . "." . RELEASE_NAME;
    $f_release_archive = $tbl_release . "." . RELEASE_ARCHIVE;
    $s_project_properties = session_get_project_properties();
    $project_id = $s_project_properties['project_id'];
    foreach ($req_ids as $req_id) {
        $q = "\tSELECT {$f_req_ver_assoc_rel_id}\n\t\t\t\tFROM {$tbl_req_ver_assoc_rel}\n\t\t\t\tWHERE {$f_req_ver_assoc_rel_req_id} = {$req_id}\n\t\t\t\t\tAND\t{$f_req_ver_assoc_rel_rel_id} = " . $release_id;
        $rs = db_query($db, $q);
        $record_exists = db_num_rows($db, $rs);
        if (!$record_exists) {
            $q = "\tINSERT INTO {$tbl_req_ver_assoc_rel}\n\t\t\t\t\t\t({$f_req_ver_assoc_rel_req_id}, {$f_req_ver_assoc_rel_rel_id})\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$req_id}, {$release_id})";
        }
        db_query($db, $q);
    }
}
Exemplo n.º 7
0
function user_mail_by_pref($email_pref)
{
    global $db;
    $project_properties = session_get_project_properties();
    $project_id = $project_properties['project_id'];
    $tbl_user = USER_TBL;
    $f_user_id = USER_TBL . "." . USER_ID;
    $f_user_email = USER_TBL . "." . USER_EMAIL;
    $tbl_proj_user_assoc = PROJECT_USER_ASSOC_TBL;
    $f_proj_user_id = PROJECT_USER_ASSOC_TBL . "." . PROJ_USER_USER_ID;
    $f_proj_id = PROJECT_USER_ASSOC_TBL . "." . PROJ_USER_PROJ_ID;
    $f_proj_email_testset = PROJECT_USER_ASSOC_TBL . "." . $email_pref;
    $q = "\tSELECT {$f_user_email}\n\t\t\tFROM {$tbl_user}\n\t\t\tINNER JOIN {$tbl_proj_user_assoc} ON {$f_user_id} = {$f_proj_user_id}\n\t\t\tWHERE {$f_proj_email_testset} = 'Y'\n\t\t\t\tAND {$f_proj_id} = '{$project_id}'";
    $rs = db_query($db, $q);
    return db_fetch_array($db, $rs);
}
function testset_delete_test_plan($testset_plan_id)
{
    global $db;
    $tbl_test_plan = TEST_PLAN;
    $f_test_plan_id = TEST_PLAN . "." . TEST_PLAN_ID;
    $f_test_plan_build_id = TEST_PLAN . "." . TEST_PLAN_BUILDID;
    $f_test_plan_name = TEST_PLAN . "." . TEST_PLAN_NAME;
    $tbl_test_plan_version = TEST_PLAN_VERSION;
    $f_test_plan_version_id = TEST_PLAN_VERSION . "." . TEST_PLAN_VERSION_ID;
    $f_test_plan_version_test_plan_id = TEST_PLAN_VERSION . "." . TEST_PLAN_VERSION_TESTPLANID;
    $f_version = TEST_PLAN_VERSION . "." . TEST_PLAN_VERSION_VERSION;
    $f_uploaded_date = TEST_PLAN_VERSION . "." . TEST_PLAN_VERSION_UPLOADEDDATE;
    $f_uploaded_by = TEST_PLAN_VERSION . "." . TEST_PLAN_VERSION_UPLOADEDBY;
    $f_file_name = TEST_PLAN_VERSION . "." . TEST_PLAN_VERSION_FILENAME;
    $f_comments = TEST_PLAN_VERSION . "." . TEST_PLAN_VERSION_COMMMENTS;
    $project_properties = session_get_project_properties();
    $test_plan_upload_path = $project_properties['test_plan_upload_path'];
    # Get the filenames of all the test plan versions to delete
    $q = "SELECT {$f_file_name} FROM {$tbl_test_plan_version}\n\t\t  WHERE {$f_test_plan_version_test_plan_id} = {$testset_plan_id}";
    $rs = db_query($db, $q);
    # delete test plans
    while ($row = db_fetch_row($db, $rs)) {
        $file = $test_plan_upload_path . $row[TEST_PLAN_VERSION_FILENAME];
        unlink($file);
    }
    # delete test plan record
    $q = "DELETE FROM {$tbl_test_plan} \n\t\t  WHERE {$f_test_plan_id} = {$testset_plan_id}";
    db_query($db, $q);
    # delete test plan version record
    $q = "DELETE FROM {$tbl_test_plan_version}\n\t\t  WHERE {$f_test_plan_version_test_plan_id} = {$testset_plan_id}";
    db_query($db, $q);
}