/** * init_args * */ function init_args(&$dbHandler) { // take care of proper escaping when magic_quotes_gpc is enabled $_REQUEST = strings_stripSlashes($_REQUEST); $iParams = array("requirement_id" => array(tlInputParameter::INT_N), "req_spec_id" => array(tlInputParameter::INT_N), "containerID" => array(tlInputParameter::INT_N), "reqDocId" => array(tlInputParameter::STRING_N, 0, 64), "req_title" => array(tlInputParameter::STRING_N, 0, 100), "scope" => array(tlInputParameter::STRING_N), "reqStatus" => array(tlInputParameter::STRING_N, 0, 1), "reqType" => array(tlInputParameter::STRING_N, 0, 1), "countReq" => array(tlInputParameter::INT_N), "expected_coverage" => array(tlInputParameter::INT_N), "doAction" => array(tlInputParameter::STRING_N, 0, 20), "req_id_cbox" => array(tlInputParameter::ARRAY_INT), "itemSet" => array(tlInputParameter::ARRAY_INT), "testcase_count" => array(tlInputParameter::ARRAY_INT), "req_version_id" => array(tlInputParameter::INT_N), "copy_testcase_assignment" => array(tlInputParameter::CB_BOOL), "relation_id" => array(tlInputParameter::INT_N), "relation_source_req_id" => array(tlInputParameter::INT_N), "relation_type" => array(tlInputParameter::STRING_N), "relation_destination_req_doc_id" => array(tlInputParameter::STRING_N, 0, 64), "relation_destination_testproject_id" => array(tlInputParameter::INT_N), "save_rev" => array(tlInputParameter::INT_N), "do_save" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N), "log_message" => array(tlInputParameter::STRING_N)); $args = new stdClass(); R_PARAMS($iParams, $args); $args->req_id = $args->requirement_id; $args->title = $args->req_title; $args->arrReqIds = $args->req_id_cbox; $args->basehref = $_SESSION['basehref']; $args->tproject_name = ''; if ($args->tproject_id > 0) { $treeMgr = new tree($dbHandler); $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id); $args->tproject_name = $dummy['name']; } $args->user_id = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0; $args->user = $_SESSION['currentUser']; // to avoid database errors with null value if (!is_numeric($args->expected_coverage)) { $args->expected_coverage = 0; } $uk = 'setting_refresh_tree_on_action'; $args->refreshTree = testproject::getUserChoice($args->tproject_id, array('reqTreeRefreshOnAction')); $args->stay_here = isset($_REQUEST['stay_here']) ? 1 : 0; return $args; }
/** * */ function init_args(&$treeMgr) { $args = new stdClass(); $_REQUEST = strings_stripSlashes($_REQUEST); $args->build_id = isset($_REQUEST['build_id']) ? intval($_REQUEST['build_id']) : 0; $args->confirmed = isset($_REQUEST['confirmed']) && $_REQUEST['confirmed'] == 'yes' ? true : false; $args->user_id = $_SESSION['userID']; $args->tproject_name = ''; $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0; if ($args->tproject_id > 0) { $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id); $args->tproject_name = $dummy['name']; } // $args->refreshTree = isset($_SESSION['setting_refresh_tree_on_action']) ? // $_SESSION['setting_refresh_tree_on_action'] : false; $args->refreshTree = testproject::getUserChoice($args->tproject_id, array('tcaseTreeRefreshOnAction', 'plan_mode')); return $args; }
function init_args(&$dbHandler, &$cfgObj, &$tprojectMgr) { $_REQUEST = strings_stripSlashes($_REQUEST); $args = new stdClass(); $args->basehref = $_SESSION['basehref']; $args->user_id = $_SESSION['userID']; $args->tproject_id = intval($_REQUEST['tproject_id']); $args->user = $_SESSION['currentUser']; $args->userGrants = new stdClass(); $args->userGrants->mgt_modify_tc = $args->user->hasRight($dbHandler, 'mgt_modify_tc', $args->tproject_id); $args->userGrants->mgt_view_req = $args->user->hasRight($dbHandler, "mgt_view_req", $args->tproject_id); $args->userGrants->testplan_planning = $args->user->hasRight($dbHandler, "testplan_planning", $args->tproject_id); $args->exec_type = isset($_REQUEST['exec_type']) ? $_REQUEST['exec_type'] : TESTCASE_EXECUTION_TYPE_MANUAL; $args->importance = isset($_REQUEST['importance']) ? $_REQUEST['importance'] : config_get('testcase_importance_default'); $args->name = isset($_REQUEST['testcase_name']) ? $_REQUEST['testcase_name'] : null; $k2null = array('summary', 'preconditions', 'steps', 'expected_results', 'step_set', 'tcaseSteps', 'goback_url'); foreach ($k2null as $key) { $args->{$key} = isset($_REQUEST[$key]) ? $_REQUEST[$key] : null; } $id2get = array('tcase_id' => 'testcase_id', 'tcversion_id' => 'tcversion_id', 'new_container_id' => 'new_container', 'old_container_id' => 'old_container', 'has_been_executed' => 'has_been_executed', 'step_number' => 'step_number', 'step_id' => 'step_id'); foreach ($id2get as $prop => $input) { $args->{$prop} = isset($_REQUEST[$input]) ? intval($_REQUEST[$input]) : 0; } $id2get = array('tsuiteID' => array('tsuiteID', 'testsuite_id')); foreach ($id2get as $prop => $inputSet) { $args->{$prop} = 0; foreach ($inputSet as $input) { if (isset($_REQUEST[$input])) { $args->{$prop} = intval($_REQUEST[$input]); break; } } } $dummy = getConfigAndLabels('testCaseStatus', 'code'); $args->tcStatusCfg['status_code'] = $dummy['cfg']; $args->tcStatusCfg['code_label'] = $dummy['lbl']; $args->tc_status = isset($_REQUEST['tc_status']) ? intval($_REQUEST['tc_status']) : $args->tcStatusCfg['status_code']['draft']; $dk = 'estimated_execution_duration'; $args->{$dk} = trim(isset($_REQUEST[$dk]) ? $_REQUEST[$dk] : ''); $args->doAction = isset($_REQUEST['doAction']) ? $_REQUEST['doAction'] : ''; $key2loop = array('edit_tc' => 'edit', 'delete_tc' => 'delete', 'do_delete' => 'doDelete', 'create_tc' => 'create', 'do_create' => 'doCreate'); foreach ($key2loop as $key => $action) { if (isset($_REQUEST[$key])) { $args->doAction = $action; break; } } $key2loop = array('move_copy_tc', 'delete_tc_version', 'do_move', 'do_copy', 'do_create_new_version', 'do_delete_tc_version', 'stay_here'); foreach ($key2loop as $key) { $args->{$key} = isset($_REQUEST[$key]) ? 1 : 0; } $args->do_activate_this = isset($_REQUEST['activate_this_tcversion']) ? 1 : 0; $args->do_deactivate_this = isset($_REQUEST['deactivate_this_tcversion']) ? 1 : 0; $args->target_position = isset($_REQUEST['target_position']) ? $_REQUEST['target_position'] : 'bottom'; $key2loop = array("keyword_assignments", "requirement_assignments"); foreach ($key2loop as $key) { $args->copy[$key] = isset($_REQUEST[$key]) ? true : false; } $args->show_mode = isset($_REQUEST['show_mode']) && $_REQUEST['show_mode'] != '' ? $_REQUEST['show_mode'] : null; $dummy = $tprojectMgr->get_by_id($args->tproject_id); $args->opt_requirements = $dummy['opt']->requirementsEnabled; $args->requirementsEnabled = $dummy['opt']->requirementsEnabled; $args->automationEnabled = $dummy['opt']->automationEnabled; $args->testPriorityEnabled = $dummy['opt']->testPriorityEnabled; // TABBED BROWSING $args->refreshTree = testproject::getUserChoice($args->tproject_id, array('tcaseTreeRefreshOnAction', 'edit_mode')); $action2check = array("editStep" => true, "createStep" => true, "doCreateStep" => true, "doUpdateStep" => true, "doInsertStep" => true); if (isset($action2check[$args->doAction])) { $cfgObj->webEditorCfg = getWebEditorCfg('steps_design'); } $args->assigned_keyword_list = isset($_REQUEST['assigned_keyword_list']) ? $_REQUEST['assigned_keyword_list'] : ""; return $args; }
function init_args(&$treeMgr) { $args = new stdClass(); $_REQUEST = strings_stripSlashes($_REQUEST); $args->containerType = isset($_REQUEST['containerType']) ? $_REQUEST['containerType'] : 'testsuite'; $args->details = isset($_REQUEST['details']) ? $_REQUEST['details'] : ''; $args->midAirCollisionTimeStamp = isset($_REQUEST['midAirCollisionTimeStamp']) ? $_REQUEST['midAirCollisionTimeStamp'] : ''; $args->userID = $_SESSION['userID']; $args->userObj = $_SESSION['currentUser']; $args->tproject_name = ''; $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0; if ($args->tproject_id) { $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id); $args->tproject_name = $dummy['name']; } $args->refreshTree = testproject::getUserChoice($args->tproject_id, array('tcaseTreeRefreshOnAction', 'edit_mode')); $keys2loop = array('nodes_order' => null, 'tcaseSet' => null, 'target_position' => 'bottom', 'doAction' => ''); foreach ($keys2loop as $key => $value) { $args->{$key} = isset($_REQUEST[$key]) ? $_REQUEST[$key] : $value; } $args->tsuite_name = isset($_REQUEST['testsuiteName']) ? $_REQUEST['testsuiteName'] : null; $args->bSure = isset($_REQUEST['sure']) && $_REQUEST['sure'] == 'yes'; $args->assigned_keyword_list = isset($_REQUEST['assigned_keyword_list']) ? $_REQUEST['assigned_keyword_list'] : ""; // integer values $keys2loop = array('testsuiteID' => null, 'containerID' => null, 'objectID' => null, 'copyKeywords' => 0); foreach ($keys2loop as $key => $value) { $args->{$key} = isset($_REQUEST[$key]) ? intval($_REQUEST[$key]) : $value; } // hmmm IMHO depends on action // Would like to remove if (is_null($args->containerID)) { $args->containerID = $args->tproject_id; } if (isset($_REQUEST['container_name'])) { $args->nameIsOK = true; $args->msg = ''; $args->container_name = $args->name = trim($_REQUEST['container_name']); if (!check_string($args->container_name, config_get('ereg_forbidden'))) { $args->msg = lang_get('string_contains_bad_chars'); $args->nameIsOK = false; } if ($args->nameIsOK && $args->container_name == '') { $args->msg = lang_get('warning_empty_com_name'); $args->nameIsOK = false; } } return $args; }