Пример #1
0
/**
 * 
 *
 */
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $iParams = array("edit" => array(tlInputParameter::STRING_N, 0, 50), "id" => array(tlInputParameter::INT_N), "tcase_id" => array(tlInputParameter::INT_N), "tcversion_id" => array(tlInputParameter::INT_N), "targetTestCase" => array(tlInputParameter::STRING_N, 0, 24), "show_path" => array(tlInputParameter::INT_N), "show_mode" => array(tlInputParameter::STRING_N, 0, 50), "tcasePrefix" => array(tlInputParameter::STRING_N, 0, 16), "tcaseExternalID" => array(tlInputParameter::STRING_N, 0, 16), "tcaseVersionNumber" => array(tlInputParameter::INT_N), "add_relation_feedback_msg" => array(tlInputParameter::STRING_N, 0, 255), "caller" => array(tlInputParameter::STRING_N, 0, 10));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    $tprojectMgr = new testproject($dbHandler);
    $cfg = config_get('testcase_cfg');
    $args->tproject_id = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0;
    $args->user_id = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0;
    $args->feature = $args->edit;
    $args->tcaseTestProject = null;
    $args->viewerArgs = null;
    $args->automationEnabled = 0;
    $args->requirementsEnabled = 0;
    $args->testPriorityEnabled = 0;
    $args->tcasePrefix = trim($args->tcasePrefix);
    $args->form_token = isset($_REQUEST['form_token']) ? $_REQUEST['form_token'] : 0;
    // For more information about the data accessed in session here, see the comment
    // in the file header of lib/functions/tlTestCaseFilterControl.class.php.
    $args->refreshTree = getSettingFromFormNameSpace('edit_mode', 'setting_refresh_tree_on_action');
    // Try to understan how this script was called.
    switch ($args->caller) {
        case 'navBar':
            systemWideTestCaseSearch($dbHandler, $args, $cfg->glue_character);
            break;
        case 'openTCW':
            // all data come in
            // tcaseExternalID   DOM-22
            // tcaseVersionNumber  1
            $args->targetTestCase = $args->tcaseExternalID;
            // trick for systemWideTestCaseSearch
            systemWideTestCaseSearch($dbHandler, $args, $cfg->glue_character);
            break;
        default:
            if (!$args->tcversion_id) {
                $args->tcversion_id = testcase::ALL_VERSIONS;
            }
            break;
    }
    // used to manage goback
    if (intval($args->tcase_id) > 0) {
        $args->feature = 'testcase';
        $args->id = intval($args->tcase_id);
    }
    switch ($args->feature) {
        case 'testsuite':
            $args->viewerArgs = null;
            $_SESSION['setting_refresh_tree_on_action'] = $args->refreshTree ? 1 : 0;
            break;
        case 'testcase':
            $args->viewerArgs = array('action' => '', 'msg_result' => '', 'user_feedback' => '', 'disable_edit' => 0, 'refreshTree' => 0, 'add_relation_feedback_msg' => $args->add_relation_feedback_msg);
            $args->id = is_null($args->id) ? 0 : $args->id;
            $args->tcase_id = $args->id;
            if (is_null($args->tcaseTestProject) && $args->id > 0) {
                $args->tcaseTestProject = $tprojectMgr->getByChildID($args->id);
            }
            break;
    }
    if (is_null($args->tcaseTestProject)) {
        $args->tcaseTestProject = $tprojectMgr->get_by_id($args->tproject_id);
    }
    $args->requirementsEnabled = $args->tcaseTestProject['opt']->requirementsEnabled;
    $args->automationEnabled = $args->tcaseTestProject['opt']->automationEnabled;
    $args->testPriorityEnabled = $args->tcaseTestProject['opt']->testPriorityEnabled;
    return $args;
}