/** * * */ function initialize_gui(&$dbHandler, $argsObj) { $tproject_mgr = new testproject($dbHandler); $itemMgr = new requirement_spec_mgr($dbHandler); $commandMgr = new reqSpecCommands($dbHandler); $gui = $commandMgr->initGuiBean(); $gui->itemCfg = config_get('req_spec_cfg'); $gui->tproject_name = $argsObj->tproject_name; $gui->grants = new stdClass(); $gui->grants->req_mgmt = $argsObj->hasRight($dbHandler, "mgt_modify_req", $argsObj->tproject_id); $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->glueChar = config_get('testcase_cfg')->glue_character; $gui->pieceSep = config_get('gui_title_separator_1'); $gui->item_id = $argsObj->item_id; $info = $itemMgr->getRevisionByID($gui->item_id, array('decode_user' => true)); $gui->item = $info; $gui->cfields = $itemMgr->html_table_of_custom_field_values(null, $gui->item_id, $argsObj->tproject_id); $gui->show_title = false; $gui->main_descr = lang_get('req_spec') . $gui->pieceSep . $gui->item['name']; $gui->showContextInfo = $argsObj->showContextInfo; if ($gui->showContextInfo) { $gui->parent_descr = lang_get('req_spec_short') . $gui->pieceSep . $gui->item['name']; } $gui->itemSpecStatus = null; $gui->itemTypeDomain = init_labels($gui->itemCfg->type_labels); return $gui; }
/** * * */ function initialize_gui(&$dbHandler, &$argsObj) { $req_spec_mgr = new requirement_spec_mgr($dbHandler); $tproject_mgr = new testproject($dbHandler); $commandMgr = new reqSpecCommands($dbHandler); $gui = $commandMgr->initGuiBean(); $gui->req_spec_cfg = config_get('req_spec_cfg'); $gui->req_cfg = config_get('req_cfg'); // 20100810 - asimon - BUGID 3317: disabled total count of requirements by default $gui->external_req_management = $gui->req_cfg->external_req_management == ENABLED ? 1 : 0; $gui->grants = new stdClass(); $gui->grants->req_mgmt = has_rights($db, "mgt_modify_req"); $gui->req_spec = $req_spec_mgr->get_by_id($argsObj->req_spec_id); $gui->req_spec_id = $argsObj->req_spec_id; $gui->tproject_name = $argsObj->tproject_name; $gui->name = $gui->req_spec['title']; $gui->main_descr = lang_get('req_spec_short') . config_get('gui_title_separator_1') . "[{$gui->req_spec['doc_id']}] :: " . $gui->req_spec['title']; $gui->refresh_tree = 'no'; $gui->cfields = $req_spec_mgr->html_table_of_custom_field_values($argsObj->req_spec_id, $argsObj->tproject_id); $gui->attachments = getAttachmentInfosFrom($req_spec_mgr, $argsObj->req_spec_id); $gui->requirements_count = $req_spec_mgr->get_requirements_count($argsObj->req_spec_id); $gui->reqSpecTypeDomain = init_labels($gui->req_spec_cfg->type_labels); /* contribution BUGID 2999, show direct link */ $prefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->direct_link = $_SESSION['basehref'] . 'linkto.php?tprojectPrefix=' . urlencode($prefix) . '&item=reqspec&id=' . urlencode($gui->req_spec['doc_id']); return $gui; }
/** * init_args * */ function init_args(&$dbHandler) { $reqTitleSize = config_get('field_size')->requirement_title; $iParams = array("requirement_id" => array(tlInputParameter::INT_N), "req_version_id" => array(tlInputParameter::INT_N), "req_spec_id" => array(tlInputParameter::INT_N), "req_title" => array(tlInputParameter::STRING_N, 0, $reqTitleSize), "req_id_cbox" => array(tlInputParameter::ARRAY_INT), "reqDocId" => array(tlInputParameter::STRING_N, 0, 64), "reqStatus" => array(tlInputParameter::STRING_N, 0, 1), "reqType" => array(tlInputParameter::STRING_N, 0, 1), "containerID" => array(tlInputParameter::INT_N), "scope" => array(tlInputParameter::STRING_N), "countReq" => array(tlInputParameter::INT_N), "expected_coverage" => array(tlInputParameter::INT_N), "doAction" => array(tlInputParameter::STRING_N, 0, 20), "itemSet" => array(tlInputParameter::ARRAY_INT), "testcase_count" => array(tlInputParameter::ARRAY_INT), "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), "log_message" => array(tlInputParameter::STRING_N), "tcaseIdentity" => array(tlInputParameter::STRING_N), "file_id" => array(tlInputParameter::INT_N), "fileTitle" => array(tlInputParameter::STRING_N, 0, 100)); $args = new stdClass(); R_PARAMS($iParams, $args); $_REQUEST = strings_stripSlashes($_REQUEST); $args->req_id = $args->requirement_id; $args->title = $args->req_title; $args->arrReqIds = $args->req_id_cbox; $args->basehref = $_SESSION['basehref']; $args->tproject_id = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0; if ($args->tproject_id <= 0) { throw new Exception(__FILE__ . '::' . __FUNCTION__ . " Test project ID can not be <= 0 "); } $mgr = new testproject($dbHandler); $info = $mgr->get_by_id($args->tproject_id); if (is_null($info)) { throw new Exception(__FILE__ . '::' . __FUNCTION__ . " Unable to get test project data "); } $args->tproject_name = $info['name']; $args->tcasePrefix = $info['prefix']; $args->user_id = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0; if (!is_numeric($args->expected_coverage)) { $args->expected_coverage = 0; } $args->refreshTree = isset($_SESSION['setting_refresh_tree_on_action']) ? $_SESSION['setting_refresh_tree_on_action'] : 0; $args->stay_here = isset($_REQUEST['stay_here']) ? 1 : 0; return $args; }
/** * * */ function initialize_gui(&$dbHandler, &$argsObj) { $req_spec_mgr = new requirement_spec_mgr($dbHandler); $tproject_mgr = new testproject($dbHandler); $commandMgr = new reqSpecCommands($dbHandler); $gui = $commandMgr->initGuiBean(); $gui->refreshTree = $argsObj->refreshTree; $gui->req_spec_cfg = config_get('req_spec_cfg'); $gui->req_cfg = config_get('req_cfg'); $gui->external_req_management = $gui->req_cfg->external_req_management == ENABLED ? 1 : 0; $gui->grants = new stdClass(); $gui->grants->req_mgmt = $argsObj->user->hasRight($dbHandler, "mgt_modify_req", $argsObj->tproject_id); $gui->req_spec = $req_spec_mgr->get_by_id($argsObj->req_spec_id); $gui->revCount = $req_spec_mgr->getRevisionsCount($argsObj->req_spec_id); $gui->req_spec_id = $argsObj->req_spec_id; $gui->parentID = $argsObj->req_spec_id; $gui->req_spec_revision_id = $gui->req_spec['revision_id']; $gui->name = $gui->req_spec['title']; $gui->tproject_id = $argsObj->tproject_id; $gui->tproject_name = $argsObj->tproject_name; $gui->main_descr = lang_get('req_spec_short') . config_get('gui_title_separator_1') . "[{$gui->req_spec['doc_id']}] :: " . $gui->req_spec['title']; $gui->refresh_tree = 'no'; $gui->cfields = $req_spec_mgr->html_table_of_custom_field_values($argsObj->req_spec_id, $gui->req_spec_revision_id, $argsObj->tproject_id); $gui->attachments = $req_spec_mgr->getAttachmentInfos($argsObj->req_spec_id); $gui->requirements_count = $req_spec_mgr->get_requirements_count($argsObj->req_spec_id); $gui->reqSpecTypeDomain = init_labels($gui->req_spec_cfg->type_labels); $prefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->direct_link = $_SESSION['basehref'] . 'linkto.php?tprojectPrefix=' . urlencode($prefix) . '&item=reqspec&id=' . urlencode($gui->req_spec['doc_id']); $gui->actions = initializeActions($gui); return $gui; }
/** * * */ function initialize_gui(&$dbHandler, $argsObj) { $tproject_mgr = new testproject($dbHandler); $req_mgr = new requirement_mgr($dbHandler); $commandMgr = new reqCommands($db); $gui = $commandMgr->initGuiBean(); $gui->req_cfg = config_get('req_cfg'); $gui->tproject_name = $argsObj->tproject_name; $gui->grants = new stdClass(); $gui->grants->req_mgmt = has_rights($db, "mgt_modify_req"); $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->glueChar = config_get('testcase_cfg')->glue_character; $gui->pieceSep = config_get('gui_title_separator_1'); $gui->req_id = $argsObj->req_id; $gui->req_versions = $req_mgr->get_by_id($gui->req_id); $gui->req = current($gui->req_versions); $gui->req_coverage = $req_mgr->get_coverage($gui->req_id); // This seems weird but is done to adapt template than can display multiple // requirements. This logic has been borrowed from test case versions management $gui->current_version[0] = array($gui->req); // BUGID 2877 - Custom Fields linked to Requirement Versions $gui->cfields_current_version[0] = $req_mgr->html_table_of_custom_field_values($gui->req_id, $gui->req['version_id'], $argsObj->tproject_id); // Now CF for other Versions $gui->other_versions[0] = null; $gui->cfields_other_versions[] = null; if (count($gui->req_versions) > 1) { $gui->other_versions[0] = array_slice($gui->req_versions, 1); $loop2do = count($gui->other_versions[0]); for ($qdx = 0; $qdx < $loop2do; $qdx++) { $target_version = $gui->other_versions[0][$qdx]['version_id']; $gui->cfields_other_versions[0][$qdx] = $req_mgr->html_table_of_custom_field_values($gui->req_id, $target_version, $argsObj->tproject_id); } } $gui->show_title = false; $gui->main_descr = lang_get('req') . $gui->pieceSep . $gui->req['title']; $gui->showReqSpecTitle = $argsObj->showReqSpecTitle; if ($gui->showReqSpecTitle) { $gui->parent_descr = lang_get('req_spec_short') . $gui->pieceSep . $gui->req['req_spec_title']; } // BUGID 2877 - Custom Fields linked to Requirement Versions // $gui->cfields = array(); // $gui->cfields[] = $req_mgr->html_table_of_custom_field_values($gui->req_id,$argsObj->tproject_id); $gui->attachments[$gui->req_id] = getAttachmentInfosFrom($req_mgr, $gui->req_id); $gui->attachmentTableName = $req_mgr->getAttachmentTableName(); $gui->reqStatus = init_labels($gui->req_cfg->status_labels); $gui->reqTypeDomain = init_labels($gui->req_cfg->type_labels); // added req relations for BUGID 1748 $gui->req_relations = FALSE; $gui->req_relation_select = FALSE; $gui->testproject_select = FALSE; $gui->req_add_result_msg = isset($argsObj->relation_add_result_msg) ? $argsObj->relation_add_result_msg : ""; if ($gui->req_cfg->relations->enable) { $gui->req_relations = $req_mgr->get_relations($gui->req_id); $gui->req_relation_select = $req_mgr->init_relation_type_select(); if ($gui->req_cfg->relations->interproject_linking) { $gui->testproject_select = initTestprojectSelect($db, $argsObj, $tproject_mgr); } } return $gui; }
/** * * */ function initGuiBean(&$argsObj, $mandatory = null) { $obj = new stdClass(); $prop2scan = array('tproject_id' => 'Test project id can not be <= 0', 'tsuiteID' => 'Test suite id can not be <= 0'); if (!is_null($mandatory)) { foreach ($mandatory as $key) { $p2check[$key] = $prop2scan[$key]; } } else { $p2check =& $prop2scan; } foreach ($p2check as $prop => $msg) { if (($obj->{$prop} = intval($argsObj->{$prop})) <= 0) { throw new Exception(__METHOD__ . ':' . $msg); } } $tprojectMgr = new testproject($this->db); $dummy = $tprojectMgr->get_by_id($obj->tproject_id); $obj->testPriorityEnabled = $dummy['opt']->testPriorityEnabled; $obj->automationEnabled = $dummy['opt']->automationEnabled; $this->keywordSet = array('testproject' => $tprojectMgr->get_keywords_map($argsObj->tproject_id), 'testcase' => null); $obj->template_dir = $this->templateCfg->template_dir; $obj->action = ''; $obj->attachments = null; $obj->cleanUpWebEditor = false; $obj->direct_link = null; $obj->execution_types = $this->execution_types; $obj->grants = $this->grants; $obj->has_been_executed = false; $obj->initWebEditorFromTemplate = false; $obj->viewerArgs = null; $obj->path_info = null; $obj->main_descr = ''; $obj->name = ''; $obj->sqlResult = ''; $obj->step_id = -1; $obj->step_set = ''; $obj->steps = ''; $obj->tableColspan = 5; $obj->tcase_id = property_exists($argsObj, 'tcase_id') ? intval($argsObj->tcase_id) : -1; $p2check = array('goback_url' => '', 'show_mode' => 'show', 'refreshTree' => !tlTreeMenu::REFRESH_GUI); foreach ($p2check as $prop => $value) { if (property_exists($argsObj, $prop) && !is_null($argsObj->{$prop})) { $obj->{$prop} = $argsObj->{$prop}; } else { $obj->{$prop} = $value; } } // need to check where is used -> on cancel button on tcStepEdit.tpl $obj->loadOnCancelURL = "archiveData.php?tproject_id={$obj->tproject_id}&edit=testcase" . "&show_mode={$obj->show_mode}&id=%s&version_id=%s"; // Used on tcStepEdit.tpl to creare goback_url URL parameter $obj->goBackAction = $_SESSION['basehref'] . "lib/testcases/" . $obj->loadOnCancelURL; $obj->keywordsViewHREF = "lib/keywords/keywordsView.php?tproject_id={$obj->tproject_id} " . ' target="mainframe" class="bold" ' . ' title="' . lang_get('menu_manage_keywords') . '"'; return $obj; }
function initializeGui(&$dbHandler, $args) { $gui = new stdClass(); $tplan_mgr = new testplan($dbHandler); $tproject_mgr = new testproject($dbHandler); $gui_open = config_get('gui_separator_open'); $gui_close = config_get('gui_separator_close'); $gui->str_option_any = $gui_open . lang_get('any') . $gui_close; $gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close; $gui->tplan_id = $args->tplan_id; $gui->tproject_id = $args->tproject_id; $tplan_info = $tplan_mgr->get_by_id($gui->tplan_id); $gui->tplan_name = $tplan_info['name']; $tproject_info = $tproject_mgr->get_by_id($gui->tproject_id); $gui->tproject_name = $tproject_info['name']; $re = new results($dbHandler, $tplan_mgr, $tproject_info, $tplan_info); $gui->assigned_users = new stdClass(); $gui->keywords = new stdClass(); $gui->builds = new stdClass(); $gui->testsuites = new stdClass(); // 20090107 - franciscom // Show only users that are able to execute test cases ? // What happens if a user that has loose right to execute, but // before loosing this right has been assigned some tests, or have executed it? // // $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, ADD_BLANK_OPTION); // $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, // array(TL_USER_ANYBODY => $gui->str_option_any, // TL_USER_NOBODY => $gui->str_option_none) ); // $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any)); $gui->assigned_users->qty = count($gui->assigned_users->items); // BUGID 2012 - franciscom $gui->keywords->items[0] = $gui->str_option_any; if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) { $gui->keywords->items += $tplan_keywords_map; } $gui->builds->items = $tplan_mgr->get_builds($gui->tplan_id, testplan::ACTIVE_BUILDS); $gui->testsuites->items = $re->getTopLevelSuites(); $gui->keywords->qty = count($gui->keywords->items); $gui->builds->qty = count($gui->builds->items); $gui->testsuites->qty = count($gui->testsuites->items); $gui->status_code_label = get_status_for_reports_html_options(); $gui->report_type = $args->format; $reports_cfg = config_get('reportsCfg'); $startDate = time() - $reports_cfg->start_date_offset; $gui->selected_start_date = $startDate; $gui->selected_start_time = $reports_cfg->start_time; $gui->selected_end_date = null; $gui->selected_end_time = null; return $gui; }
function init_args(&$dbHandler, $dateFormat) { $_REQUEST = strings_stripSlashes($_REQUEST); $args = new stdClass(); // BUGID 3716 $args->target_date_original = isset($_REQUEST['target_date']) ? $_REQUEST['target_date'] : null; $args->start_date_original = isset($_REQUEST['start_date']) ? $_REQUEST['start_date'] : null; // convert target date to iso format to write to db if (isset($_REQUEST['target_date']) && $_REQUEST['target_date'] != '') { $date_array = split_localized_date($_REQUEST['target_date'], $dateFormat); if ($date_array != null) { // set date in iso format $args->target_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day']; } } // convert start date to iso format to write to db if (isset($_REQUEST['start_date']) && $_REQUEST['start_date'] != '') { $date_array = split_localized_date($_REQUEST['start_date'], $dateFormat); if ($date_array != null) { // set date in iso format $args->start_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day']; } } $key2loop = array('low_priority_tcases', 'medium_priority_tcases', 'high_priority_tcases'); foreach ($key2loop as $key) { $args->{$key} = isset($_REQUEST[$key]) ? intval($_REQUEST[$key]) : 0; } $args->id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0; $args->name = isset($_REQUEST['milestone_name']) ? $_REQUEST['milestone_name'] : null; $args->doAction = isset($_REQUEST['doAction']) ? $_REQUEST['doAction'] : null; $args->basehref = $_SESSION['basehref']; $treeMgr = new tree($dbHandler); $tprojectMgr = new testproject($dbHandler); $args->tproject_options = new stdClass(); $args->tproject_options->testPriorityEnabled = 0; $args->tproject_name = ''; $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0; if ($args->tproject_id > 0) { $info = $tprojectMgr->get_by_id($args->tproject_id); $args->tproject_name = $info['name']; $args->tproject_options = $info['opt']; } $args->tplan_name = ''; $args->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0; if ($args->tplan_id > 0) { $info = $treeMgr->get_node_hierarchy_info($args->tplan_id); $args->tplan_name = $info['name']; } return $args; }
/** * init_args * */ function init_args(&$dbHandler) { $args = new stdClass(); $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0; $args->tplans = null; if ($args->tproject_id > 0) { $tprojectMgr = new testproject($dbHandler); $dummy = $tprojectMgr->tree_manager->get_node_hierarchy_info($args->tproject_id); $args->tproject_name = $dummy['name']; $args->tplans = $tprojectMgr->get_all_testplans($args->tproject_id); } $args->grants = new stdClass(); $args->grants->testplan_create = $_SESSION['currentUser']->hasRight($dbHandler, "mgt_testplan_create", $args->tproject_id); return $args; }
function initializeGui(&$dbHandler, $argsObj, &$tplanMgr) { $gui = new stdClass(); $gui->title = lang_get('title_gen_test_rep'); $gui->do_report = array(); $gui->elapsed_time = 0; $mgr = new testproject($dbHandler); $dummy = $mgr->get_by_id($argsObj->tproject_id); $gui->testprojectOptions = new stdClass(); $gui->testprojectOptions->testPriorityEnabled = $dummy['opt']->testPriorityEnabled; $gui->tproject_name = $dummy['name']; $info = $tplanMgr->get_by_id($argsObj->tplan_id); $gui->tplan_name = $info['name']; return $gui; }
/** * 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 initialize_gui(&$dbHandler, $argsObj) { $tproject_mgr = new testproject($dbHandler); $req_mgr = new requirement_mgr($dbHandler); $commandMgr = new reqCommands($dbHandler); $gui = $commandMgr->initGuiBean(); $gui->req_cfg = config_get('req_cfg'); $gui->tproject_name = $argsObj->tproject_name; $gui->grants = new stdClass(); $gui->grants->req_mgmt = has_rights($dbHandler, "mgt_modify_req"); $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->glueChar = config_get('testcase_cfg')->glue_character; $gui->pieceSep = config_get('gui_title_separator_1'); $gui->item_id = $argsObj->item_id; // identify item is version or revision ? $node_type_id = $req_mgr->tree_mgr->get_available_node_types(); $node_id_type = array_flip($node_type_id); $item = $req_mgr->tree_mgr->get_node_hierarchy_info($gui->item_id); // TICKET 4702 // target_is is db id of item, item['id'] is the REQ ID. // for several logics we need to DB id (target_id) $info = null; switch ($node_id_type[$item['node_type_id']]) { case 'requirement_version': $info = $req_mgr->get_version($gui->item_id); $info['revision_id'] = -1; $info['target_id'] = $info['version_id']; break; case 'requirement_revision': $info = $req_mgr->get_revision($gui->item_id); $info['target_id'] = $info['revision_id']; break; } $gui->item = $info; $gui->cfields = $req_mgr->html_table_of_custom_field_values(null, $gui->item_id, $argsObj->tproject_id); $gui->show_title = false; $gui->main_descr = lang_get('req') . $gui->pieceSep . $gui->item['title']; $gui->showReqSpecTitle = $argsObj->showReqSpecTitle; if ($gui->showReqSpecTitle) { $gui->parent_descr = lang_get('req_spec_short') . $gui->pieceSep . $gui->item['req_spec_title']; } $gui->reqStatus = init_labels($gui->req_cfg->status_labels); $gui->reqTypeDomain = init_labels($gui->req_cfg->type_labels); return $gui; }
function __construct(&$db, $tproject_id) { $this->db = $db; $this->reqSpecMgr = new requirement_spec_mgr($db); $this->reqMgr = new requirement_mgr($db); $this->treeMgr = $this->reqMgr->tree_mgr; $req_spec_cfg = config_get('req_spec_cfg'); $this->reqSpecTypeDomain = init_labels($req_spec_cfg->type_labels); $this->commandMgr = new reqCommands($db); $this->submit_button_label = lang_get('btn_save'); $this->getRequirementsOptions = array('order_by' => " ORDER BY NH_REQ.node_order "); $tproject_mgr = new testproject($this->db); $info = $tproject_mgr->get_by_id($tproject_id); if ($info['reqmgr_integration_enabled']) { $sysmgr = new tlReqMgrSystem($this->db); $rms = $sysmgr->getInterfaceObject($tproject_id); $this->reqMgrSystem = $sysmgr->getLinkedTo($tproject_id); unset($sysmgr); } }
function initializeGui(&$dbHandler, &$argsObj) { $tproject_mgr = new testproject($dbHandler); $gui = new stdClass(); $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($argsObj->tprojectID) . config_get('testcase_cfg')->glue_character; $gui->mainCaption = lang_get('testproject') . " " . $argsObj->tprojectName; $gui->importance = config_get('testcase_importance_default'); $gui->creation_date_from = null; $gui->creation_date_to = null; $gui->modification_date_from = null; $gui->modification_date_to = null; $gui->search_important_notice = sprintf(lang_get('search_important_notice'), $argsObj->tprojectName); $gui->design_cf = $tproject_mgr->cfield_mgr->get_linked_cfields_at_design($argsObj->tprojectID, cfield_mgr::ENABLED, null, 'testcase'); $gui->keywords = $tproject_mgr->getKeywords($argsObj->tprojectID); $gui->filter_by['design_scope_custom_fields'] = !is_null($gui->design_cf); $gui->filter_by['keyword'] = !is_null($gui->keywords); $reqSpecSet = $tproject_mgr->genComboReqSpec($argsObj->tprojectID); $gui->filter_by['requirement_doc_id'] = !is_null($reqSpecSet); $gui->option_importance = array(0 => '', HIGH => lang_get('high_importance'), MEDIUM => lang_get('medium_importance'), LOW => lang_get('low_importance')); return $gui; }
/** * * */ function initialize_gui(&$dbHandler, &$argsObj) { $req_spec_mgr = new requirement_spec_mgr($dbHandler); $tproject_mgr = new testproject($dbHandler); $commandMgr = new reqSpecCommands($dbHandler, $argsObj->tproject_id); $gui = $commandMgr->initGuiBean(); $gui->refreshTree = $argsObj->refreshTree; $gui->req_spec_cfg = config_get('req_spec_cfg'); $gui->req_cfg = config_get('req_cfg'); $gui->external_req_management = $gui->req_cfg->external_req_management == ENABLED ? 1 : 0; $gui->grants = new stdClass(); $gui->grants->req_mgmt = has_rights($db, "mgt_modify_req"); $gui->req_spec = $req_spec_mgr->get_by_id($argsObj->req_spec_id); $gui->revCount = $req_spec_mgr->getRevisionsCount($argsObj->req_spec_id); $gui->req_spec_id = intval($argsObj->req_spec_id); $gui->parentID = $argsObj->req_spec_id; $gui->req_spec_revision_id = $gui->req_spec['revision_id']; $gui->name = $gui->req_spec['title']; $gui->tproject_name = $argsObj->tproject_name; $gui->main_descr = lang_get('req_spec_short') . config_get('gui_title_separator_1') . "[{$gui->req_spec['doc_id']}] :: " . $gui->req_spec['title']; $gui->refresh_tree = 'no'; $gui->cfields = $req_spec_mgr->html_table_of_custom_field_values($gui->req_spec_id, $gui->req_spec_revision_id, $argsObj->tproject_id); $gui->attachments = getAttachmentInfosFrom($req_spec_mgr, $argsObj->req_spec_id); $gui->requirements_count = $req_spec_mgr->get_requirements_count($argsObj->req_spec_id); $gui->reqSpecTypeDomain = init_labels($gui->req_spec_cfg->type_labels); $prefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->direct_link = $_SESSION['basehref'] . 'linkto.php?tprojectPrefix=' . urlencode($prefix) . '&item=reqspec&id=' . urlencode($gui->req_spec['doc_id']); $gui->fileUploadURL = $_SESSION['basehref'] . $req_spec_mgr->getFileUploadRelativeURL($gui->req_spec_id); $gui->delAttachmentURL = $_SESSION['basehref'] . $req_spec_mgr->getDeleteAttachmentRelativeURL($gui->req_spec_id); $gui->fileUploadMsg = ''; $gui->import_limit = TL_REPOSITORY_MAXFILESIZE; $gui->btn_import_req_spec = ''; $gui->reqMgrSystemEnabled = 0; if (!is_null($reqMgrSystem = $commandMgr->getReqMgrSystem())) { $gui->btn_import_req_spec = sprintf(lang_get('importViaAPI'), $reqMgrSystem['reqmgrsystem_name']); $gui->reqMgrSystemEnabled = 1; } return $gui; }
function init_args(&$dbHandler) { $args = new stdClass(); $treeMgr = new tree($dbHandler); $tprojectMgr = new testproject($dbHandler); $args->tproject_name = ''; $args->tproject_options = new stdClass(); $args->tproject_options->testPriorityEnabled = 0; $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0; if ($args->tproject_id > 0) { $info = $tprojectMgr->get_by_id($args->tproject_id); $args->tproject_name = $info['name']; $args->tproject_options = $info['opt']; } $args->tplan_name = ''; $args->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0; if ($args->tplan_id > 0) { $info = $treeMgr->get_node_hierarchy_info($args->tplan_id); $args->tplan_name = $info['name']; } return $args; }
function initEnv(&$dbHandler) { $args = init_args(); $gui = new stdClass(); $gui->bugIDMaxLength = 0; $gui->createIssueURL = null; $gui->issueTrackerVerboseID = ''; $gui->issueTrackerVerboseType = ''; $gui->tproject_id = $args->tproject_id; // get issue tracker config and object to manage TestLink - BTS integration $its = null; $tprojectMgr = new testproject($dbHandler); list($issueTrackerEnabled, $its) = $tprojectMgr->getIssueTrackerMgr($args->tproject_id); if ($issueTrackerEnabled) { if (!is_null($its)) { $gui->issueTrackerVerboseType = $issueT['verboseType']; $gui->issueTrackerVerboseID = $issueT['issuetracker_name']; $gui->bugIDMaxLength = $its->getBugIDMaxLength(); $gui->createIssueURL = $its->getEnterBugURL(); } } return array($args, $gui); }
/** * set session data after modification or authorization * * @param resource &$db reference to DB identifier * @param string $user * @param integer $id * @param integer $roleID * @param string $email * @param string $locale [default = null] * @param boolean $active [default = null] documentation * * @return integer status code * * @TODO havlatm: move to tlSession class * @TODO fix return functionality **/ function setUserSession(&$db, $user, $id, $roleID, $email, $locale = null, $active = null) { tLog('setUserSession: $user='******' $id=' . $id . ' $roleID=' . $roleID . ' $email=' . $email . ' $locale=' . $locale); $_SESSION['userID'] = $id; $_SESSION['testprojectID'] = null; $_SESSION['s_lastAttachmentList'] = null; if (!is_null($locale)) { $_SESSION['locale'] = $locale; set_dt_formats(); } $tproject_mgr = new testproject($db); $gui_cfg = config_get('gui'); $order_by = $gui_cfg->tprojects_combo_order_by; $arrProducts = $tproject_mgr->get_accessible_for_user($id, 'map', $order_by); // 20051208 - JBA - added to set the lastProduct the user has selected before logging off. $tproject_cookie = 'TL_lastTestProjectForUserID_' . $id; if (isset($_COOKIE[$tproject_cookie])) { if (isset($arrProducts[$_COOKIE[$tproject_cookie]]) && $arrProducts[$_COOKIE[$tproject_cookie]]) { $_SESSION['testprojectID'] = $_COOKIE[$tproject_cookie]; tLog('Cookie: {$tproject_cookie}=' . $_SESSION['testprojectID']); } } if (!$_SESSION['testprojectID']) { $tpID = null; if (sizeof($arrProducts)) { $tpID = key($arrProducts); } $_SESSION['testprojectID'] = $tpID; } // Validation is done in navBar.php $tplan_cookie = 'TL_lastTestPlanForUserID_' . $id; if (isset($_COOKIE[$tplan_cookie])) { $_SESSION['testplanID'] = $_COOKIE[$tplan_cookie]; tLog("Cookie: {$tplan_cookie}=" . $_SESSION['testplanID']); } return 1; }
/** * initialize user input * * @param resource dbHandler * @return array $args array with user input information */ function init_args(&$dbHandler) { $iParams = array("apikey" => array(tlInputParameter::STRING_N, 0, 64), "tproject_id" => array(tlInputParameter::INT_N), "tplan_id" => array(tlInputParameter::INT_N), "format" => array(tlInputParameter::INT_N)); $args = new stdClass(); $pParams = R_PARAMS($iParams, $args); if (!is_null($args->apikey)) { $cerbero = new stdClass(); $cerbero->args = new stdClass(); $cerbero->args->tproject_id = $args->tproject_id; $cerbero->args->tplan_id = $args->tplan_id; if (strlen($args->apikey) == 32) { $cerbero->args->getAccessAttr = true; $cerbero->method = 'checkRights'; $cerbero->redirect_target = "../../login.php?note=logout"; setUpEnvForRemoteAccess($dbHandler, $args->apikey, $cerbero); } else { $args->addOpAccess = false; $cerbero->method = null; $cerbero->args->getAccessAttr = false; setUpEnvForAnonymousAccess($dbHandler, $args->apikey, $cerbero); } } else { testlinkInitPage($dbHandler, false, false, "checkRights"); $args->tproject_id = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0; } $tproject_mgr = new testproject($dbHandler); $tplan_mgr = new testplan($dbHandler); if ($args->tproject_id > 0) { $args->tproject_info = $tproject_mgr->get_by_id($args->tproject_id); $args->tproject_name = $args->tproject_info['name']; $args->tproject_description = $args->tproject_info['notes']; } if ($args->tplan_id > 0) { $args->tplan_info = $tplan_mgr->get_by_id($args->tplan_id); } return array($args, $tproject_mgr, $tplan_mgr); }
/** * set session data after modification or authorization * * @param resource &$db reference to DB identifier * @param string $user * @param integer $id * @param integer $roleID * @param string $email * @param string $locale [default = null] * @param boolean $active [default = null] documentation * * @return integer status code * * @TODO havlatm: move to tlSession class * @TODO fix return functionality **/ function setUserSession(&$db, $user, $id, $roleID, $email, $locale = null, $active = null) { tLog('setUserSession: $user='******' $id=' . $id . ' $roleID=' . $roleID . ' $email=' . $email . ' $locale=' . $locale); $_SESSION['userID'] = $id; $_SESSION['testprojectID'] = null; $_SESSION['s_lastAttachmentList'] = null; if (!is_null($locale)) { $_SESSION['locale'] = $locale; setDateTimeFormats($locale); } $tproject_mgr = new testproject($db); $gui_cfg = config_get('gui'); $opt = array('output' => 'map_name_with_inactive_mark', 'order_by' => $gui_cfg->tprojects_combo_order_by); $arrProducts = $tproject_mgr->get_accessible_for_user($id, $opt); $tproject_cookie = 'TL_lastTestProjectForUserID_' . $id; if (isset($_COOKIE[$tproject_cookie])) { if (isset($arrProducts[$_COOKIE[$tproject_cookie]]) && $arrProducts[$_COOKIE[$tproject_cookie]]) { $_SESSION['testprojectID'] = $_COOKIE[$tproject_cookie]; tLog('Cookie: {$tproject_cookie}=' . $_SESSION['testprojectID']); } } if (!$_SESSION['testprojectID']) { $tpID = null; if (sizeof($arrProducts)) { $tpID = key($arrProducts); } $_SESSION['testprojectID'] = $tpID; } // Validation is done in navBar.php $tplan_cookie = 'TL_lastTestPlanForUserID_' . $id; if (isset($_COOKIE[$tplan_cookie])) { $_SESSION['testplanID'] = $_COOKIE[$tplan_cookie]; tLog("Cookie: {$tplan_cookie}=" . $_SESSION['testplanID']); } return 1; }
/** * */ 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; }
/** * Gets the arguments used to create the report. * * Some of these arguments are set in the $_REQUEST, and some in $_SESSION. Having * these arguments in hand, the init_args method will use TestLink objects, such * as a Test Project Manager (testproject class) to retrieve other information * that is displayed on the screen (e.g.: project name). * * @param $dbHandler handler to TestLink database * @return object of stdClass */ function init_args(&$dbHandler) { $_REQUEST = strings_stripSlashes($_REQUEST); $args = new stdClass(); $args->tproject_id = isset($_REQUEST['tproject_id']) ? $_REQUEST['tproject_id'] : isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0; if ($args->tproject_id > 0) { $tproject_mgr = new testproject($dbHandler); $dummy = $tproject_mgr->get_by_id($args->tproject_id); $args->tproject_name = $dummy['name']; $args->priority_enabled = $dummy['opt']->testPriorityEnabled ? true : false; unset($tproject_mgr); } $args->tplan_id = isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : 0; $args->user_id = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : 0; if ($args->user_id == 0) { $args->user_id = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0; $args->user_name = $_SESSION['currentUser']->login; } return $args; }
function initializeGui(&$dbHandler, $argsObj, &$tplanMgr) { $gui = new stdClass(); $gui->title = lang_get('title_gen_test_rep'); $gui->do_report = array(); $gui->showPlatforms = true; $gui->columnsDefinition = new stdClass(); $gui->columnsDefinition->keywords = null; $gui->columnsDefinition->testers = null; $gui->columnsDefinition->platform = null; $gui->statistics = new stdClass(); $gui->statistics->keywords = null; $gui->statistics->testers = null; $gui->statistics->milestones = null; $gui->statistics->overalBuildStatus = null; $gui->elapsed_time = 0; $gui->displayBuildMetrics = false; $gui->buildMetricsFeedback = lang_get('buildMetricsFeedback'); $mgr = new testproject($dbHandler); $dummy = $mgr->get_by_id($argsObj->tproject_id); $gui->testprojectOptions = new stdClass(); $gui->testprojectOptions->testPriorityEnabled = $dummy['opt']->testPriorityEnabled; $gui->tproject_name = $dummy['name']; $info = $tplanMgr->get_by_id($argsObj->tplan_id); $gui->tplan_name = $info['name']; $gui->platformSet = $tplanMgr->getPlatforms($argsObj->tplan_id, array('outputFormat' => 'map')); if (is_null($gui->platformSet)) { $gui->platformSet = array(''); $gui->showPlatforms = false; } return $gui; }
function migrate_cc_specs(&$source_db, &$target_db, &$items, &$old_new) { $mgtcom_keys = array('intro' => 'introduction', 'scope' => 'scope', 'ref' => 'references', 'method' => 'methodology', 'lim' => 'limitations'); $mgtcat_keys = array('objective' => 'objective', 'config' => 'configuration', 'data' => 'data', 'tools' => 'tools'); $tproject_mgr = new testproject($target_db); $ts_mgr = new testsuite($target_db); $tree_mgr = new tree($target_db); foreach ($items as $prod_id => $pd) { $old_new['product'][$prod_id] = @$tproject_mgr->create($pd['name'], $pd['color'], $pd['option_reqs'], EMPTY_NOTES, $pd['active']); echo "<pre><font color='blue'>Product {$pd['name']} has became a test project!</font></pre>"; flush(); $tproject_id = $old_new['product'][$prod_id]; $sql = "SELECT * FROM mgtcomponent WHERE prodid={$prod_id}"; $comp = $source_db->fetchRowsIntoMap($sql, 'id'); // for change_order_bulk($hash_node_id, $hash_node_order) // $hash_node_id=array(10=>10, 23=>23, 30=>30); // $hash_node_order=array(10=>3, 23=>1, 30=>2); // $hash_node_id=array(); // $hash_node_order=array(); // 20071021 - francisco.mancardi@gruppotesi.com // // $hash_order_node_order=array(3=>10, 1=>23, 2=>30); // means: node_id: 10 order:3 // node_id: 23 order:1 // node_id: 30 order:2 $hash_order_node_id = array(); if (count($comp) > 0) { foreach ($comp as $coid => $cod) { $details = ''; foreach ($mgtcom_keys as $key => $val) { $details .= $val . ": <br>" . $cod[$key] . "<p>"; } $ret = $ts_mgr->create($tproject_id, $cod['name'], $details); if ($ret['status_ok']) { echo "<pre>Component " . htmlentities($cod['name']) . " Migrated<br></pre>"; flush(); $mgtcomp_id = $ret['id']; $old_new['mgtcomp'][$coid] = $mgtcomp_id; } // ---------------------------------------------------------------------------------- $sql = "SELECT * FROM mgtcategory WHERE compid={$coid}"; $cat = $source_db->fetchRowsIntoMap($sql, 'id'); if (count($cat) > 0) { foreach ($cat as $caid => $cad) { // ---------------------------------------------------------------------------------- $details = ''; foreach ($mgtcat_keys as $key => $val) { $details .= $val . ": <br>" . $cad[$key] . "<p>"; } // ---------------------------------------------------------------------------------- $ret = $ts_mgr->create($mgtcomp_id, $cad['name'], $details); if ($ret['status_ok']) { echo "<pre> Category " . htmlentities($cad['name']) . " Migrated<br></pre>"; flush(); $mgtcat_id = $ret['id']; $old_new['mgtcat'][$caid] = $mgtcat_id; if ($cad['CATorder'] != 0) { // 20071021 - franciscom // $hash_node_id[$mgtcat_id]=$mgtcat_id; // $hash_node_order[$mgtcat_id]=$cad['CATorder']; $node_id = $mgtcat_id; $node_order = $cad['CATorder']; $hash_order_node_id[$node_order] = $node_id; } } // ---------------------------------------------------------------------------------- } } } // 20060725 - franciscom // $tree_mgr->change_order_bulk($hash_node_id, $hash_node_order) ; $tree_mgr->change_order_bulk($hash_order_node_id); } } }
/** * Important Notice about algorithm * We are trying to provide WHOLE Test Plan metrics, then BUILD INFO * will not be IMPORTANT. * * In addition, Keywords are attributes used on Test Case specification, * for this reason, our choice is that platforms will be ignored * for this metrics. * * Example: Platform X and Y * Test Case: TC1 with one Keyword K1 * * we can develop this data in this way * * Test Case - Platform - Keyword - Build - Exec. ID - Exec. Status * TC1 X K1 1.0 11 FAILED * TC1 Y K1 1.0 13 BLOCKED * TC1 X K1 2.0 16 PASSED * TC1 Y K1 2.0 15 BLOCKED * * * We have two choices: * OPT 1. Platform multiplication * * consider (as was done on Builds Overall Status) * TC1 as two test cases. * If we proceed this way, may be user will be confused, because * when searching test case spec according keyword, we are going to * find ONLY ONE. * * OPT 2. IGNORE PLAFORMS * Consider only LATEST execution, means we are going to count ONE test case * no matter how many Platforms exists on test plan. * * Our design choice is on OPT 1 * */ function getExecCountersByKeywordExecStatus($id, $filters = null, $opt = null) { $debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__; $safe_id = intval($id); list($my, $builds, $sqlStm) = $this->helperGetExecCounters($safe_id, $filters, $opt); // may be too brute force but ... if (($tprojectID = $my['opt']['tprojectID']) == 0) { $info = $this->tree_manager->get_node_hierarchy_info($safe_id); $tprojectID = $info['parent_id']; } $tproject_mgr = new testproject($this->db); $keywordSet = $tproject_mgr->get_keywords_map($tprojectID); $tproject_mgr = null; // This subquery is BETTER than a VIEW, need to understand why // Latest Execution Ignoring Build => Cross Build $sqlLEBP = $sqlStm['LEBP']; // Development Important Notice // DISTINCT is needed when you what to get data ONLY FOR test cases with assigned testers, // because we are (to make things worst) working on a BUILD SET, not on a SINGLE build, // Use of IN clause, will have a NOT wanted multiplier effect on this query. // // This do not happens with other queries on other metric attributes, // be careful before changing other queries. // $sqlUnionAK = "/* {$debugMsg} sqlUnionAK - executions */" . " SELECT DISTINCT NHTCV.parent_id, TCK.keyword_id, TPTCV.platform_id," . " COALESCE(E.status,'{$this->notRunStatusCode}') AS status " . " FROM {$this->tables['testplan_tcversions']} TPTCV " . $sqlStm['getAssignedFeatures'] . " /* GO FOR Absolute LATEST exec ID IGNORE BUILD */ " . " JOIN ({$sqlLEBP}) AS LEBP " . " ON LEBP.testplan_id = TPTCV.testplan_id " . " AND LEBP.platform_id = TPTCV.platform_id " . " AND LEBP.tcversion_id = TPTCV.tcversion_id " . " AND LEBP.testplan_id = " . $safe_id . " /* Get execution status WRITTEN on DB */ " . " JOIN {$this->tables['executions']} E " . " ON E.id = LEBP.id " . " /* Get ONLY Test case versions that has AT LEAST one Keyword assigned */ " . " JOIN {$this->tables['nodes_hierarchy']} NHTCV " . " ON NHTCV.id = TPTCV.tcversion_id " . " JOIN {$this->tables['testcase_keywords']} TCK " . " ON TCK.testcase_id = NHTCV.parent_id " . " WHERE TPTCV.testplan_id=" . $safe_id . $builds->whereAddExec; // See Note about DISTINCT, on sqlUnionAK $sqlUnionBK = "/* {$debugMsg} sqlUnionBK - NOT RUN */" . " SELECT DISTINCT NHTCV.parent_id, TCK.keyword_id, TPTCV.platform_id," . " COALESCE(E.status,'{$this->notRunStatusCode}') AS status " . " FROM {$this->tables['testplan_tcversions']} TPTCV " . $sqlStm['getAssignedFeatures'] . " /* Get REALLY NOT RUN => BOTH LEBP.id AND E.id ON LEFT OUTER see WHERE */ " . " LEFT OUTER JOIN ({$sqlLEBP}) AS LEBP " . " ON LEBP.testplan_id = TPTCV.testplan_id " . " AND LEBP.platform_id = TPTCV.platform_id " . " AND LEBP.tcversion_id = TPTCV.tcversion_id " . " AND LEBP.testplan_id = " . $safe_id . " LEFT OUTER JOIN {$this->tables['executions']} E " . " ON E.tcversion_id = TPTCV.tcversion_id " . " AND E.testplan_id = TPTCV.testplan_id " . " AND E.platform_id = TPTCV.platform_id " . $builds->joinAdd . " /* Get ONLY Test case versions that has AT LEAST one Keyword assigned */ " . " JOIN {$this->tables['nodes_hierarchy']} NHTCV " . " ON NHTCV.id = TPTCV.tcversion_id " . " JOIN {$this->tables['testcase_keywords']} TCK " . " ON TCK.testcase_id = NHTCV.parent_id " . " /* FILTER BUILDS in set on target test plan */ " . " WHERE TPTCV.testplan_id=" . $safe_id . $builds->whereAddNotRun . " /* Get REALLY NOT RUN => BOTH E.id AND LEBP.id NULL */ " . " AND E.id IS NULL AND LEBP.id IS NULL"; // Due to PLATFORMS we will have MULTIPLIER EFFECT $sql = " /* {$debugMsg} UNION Without ALL CLAUSE => DISCARD Duplicates */" . " SELECT keyword_id,status, count(0) AS exec_qty " . " FROM ({$sqlUnionAK} UNION {$sqlUnionBK} ) AS SQK " . " GROUP BY keyword_id,status "; $exec['with_tester'] = (array) $this->db->fetchMapRowsIntoMap($sql, 'keyword_id', 'status'); $this->helperCompleteStatusDomain($exec, 'keyword_id'); // On next queries: // we need to use distinct, because IF NOT we are going to get one record // for each build where test case has TESTER ASSIGNMENT // // $exec['total_assigned'] = null; $exec['total'] = null; $exec['key4total'] = 'total'; if ($my['opt']['getOnlyAssigned']) { // $exec['key4total'] = 'total_assigned'; $sql = "/* {$debugMsg} */ " . " SELECT COUNT(0) AS qty, keyword_id " . " FROM " . " ( /* Get test case,keyword pairs */ " . " SELECT DISTINCT NHTCV.parent_id, TCK.keyword_id,TPTCV.platform_id " . " FROM {$this->tables['user_assignments']} UA " . " JOIN {$this->tables['testplan_tcversions']} TPTCV ON TPTCV.id = UA.feature_id " . " /* Get ONLY Test case versions that has AT LEAST one Keyword assigned */ " . " JOIN {$this->tables['nodes_hierarchy']} NHTCV " . " ON NHTCV.id = TPTCV.tcversion_id " . " JOIN {$this->tables['testcase_keywords']} TCK " . " ON TCK.testcase_id = NHTCV.parent_id " . " WHERE UA. build_id IN ( " . $builds->inClause . " ) " . " AND UA.type = {$execCode} ) AS SQK " . " GROUP BY keyword_id"; } else { $sql = "/* {$debugMsg} */ " . " SELECT COUNT(0) AS qty, keyword_id " . " FROM " . " ( /* Get test case,keyword pairs */ " . " SELECT DISTINCT NHTCV.parent_id, TCK.keyword_id,TPTCV.platform_id " . " FROM {$this->tables['testplan_tcversions']} TPTCV " . " /* Get ONLY Test case versions that has AT LEAST one Keyword assigned */ " . " JOIN {$this->tables['nodes_hierarchy']} NHTCV " . " ON NHTCV.id = TPTCV.tcversion_id " . " JOIN {$this->tables['testcase_keywords']} TCK " . " ON TCK.testcase_id = NHTCV.parent_id " . " WHERE TPTCV.testplan_id = " . $safe_id . " ) AS SQK " . " GROUP BY keyword_id"; } $exec[$exec['key4total']] = (array) $this->db->fetchRowsIntoMap($sql, 'keyword_id'); $exec['keywords'] = $keywordSet; return $exec; }
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 doCopyToTestPlans(&$argsObj, &$buildMgr, &$tplanMgr) { $tprojectMgr = new testproject($tplanMgr->db); // exclude this testplan $filters = array('tplan2exclude' => $argsObj->tplan_id); $tplanset = $tprojectMgr->get_all_testplans($argsObj->tproject_id, $filters); if (!is_null($tplanset)) { foreach ($tplanset as $id => $info) { if (!$tplanMgr->check_build_name_existence($id, $argsObj->build_name)) { $buildMgr->create($id, $argsObj->build_name, $argsObj->notes, $argsObj->is_active, $argsObj->is_open); } } } }
<?php /** * TestLink Open Source Project - http://testlink.sourceforge.net/ * * @filesource navBar.php * * This file manages the navigation bar. * * internal revisions * **/ require_once '../../config.inc.php'; require_once "common.php"; testlinkInitPage($db, 'initProject' == 'initProject'); $tproject_mgr = new testproject($db); $args = init_args(); $gui = new stdClass(); $gui_cfg = config_get("gui"); $gui->tprojectID = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0; $gui->tcasePrefix = ''; $gui->searchSize = 8; if ($gui->tprojectID > 0) { $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($gui->tprojectID) . config_get('testcase_cfg')->glue_character; $gui->searchSize = tlStringLen($gui->tcasePrefix) + $gui_cfg->dynamic_quick_tcase_search_input_size; } $gui->TestProjects = $tproject_mgr->get_accessible_for_user($args->user->dbID, array('output' => 'map_name_with_inactive_mark', 'order_by' => $tlCfg->gui->tprojects_combo_order_by)); $gui->TestProjectCount = sizeof($gui->TestProjects); $gui->TestPlanCount = 0; $tprojectQty = $tproject_mgr->getItemCount(); if ($gui->TestProjectCount == 0 && $tprojectQty > 0) {
* @version CVS: $Id: tcAssign2Tplan.php,v 1.8 2010/05/20 18:20:46 franciscom Exp $ * @link http://www.teamst.org/index.php * * * @internal revisions * 20100520 - franciscom - BUGID 3480 - add to test plan problem when platforms exist * 20100514 - franciscom - BUGID 3189 * 20100124 - franciscom - BUGID 3064 - add logic to manage ONLY ACTIVE test plans **/ require_once "../../config.inc.php"; require_once "common.php"; testlinkInitPage($db); $templateCfg = templateConfiguration(); $tcase_mgr = new testcase($db); $tplan_mgr = new testplan($db); $tproject_mgr = new testproject($db); $glue = config_get('testcase_cfg')->glue_character; $args = init_args(); $gui = initializeGui($args); $getOpt = array('outputFormat' => 'map', 'addIfNull' => true); $gui->platformSet = $tplan_mgr->getPlatforms($args->tplan_id, $getOpt); $options['output'] = 'essential'; $tcase_all_info = $tcase_mgr->get_by_id($args->tcase_id, testcase::ALL_VERSIONS, null, $options); if (!is_null($tcase_all_info)) { foreach ($tcase_all_info as $tcversion_info) { if ($tcversion_info['id'] == $args->tcversion_id) { $version = $tcversion_info['version']; $gui->pageTitle = lang_get('test_case') . ':' . $tcversion_info['name']; $gui->tcaseIdentity = $tproject_mgr->getTestCasePrefix($args->tproject_id); $gui->tcaseIdentity .= $glue . $tcversion_info['tc_external_id'] . ':' . $tcversion_info['name']; break;
/** * * */ function display_children($dbHandler, $root_node, $parent, $filter_node, $tcprefix, $show_tcases = 1, $operation = 'manage', $helpText = array()) { static $showTestCaseID; $tables = tlObjectWithDB::getDBTables(array('tcversions', 'nodes_hierarchy', 'node_types')); $forbidden_parent = array('testproject' => 'none', 'testcase' => 'testproject', 'testsuite' => 'none'); $external = ''; $nodes = null; $filter_node_type = $show_tcases ? '' : ",'testcase'"; switch ($operation) { case 'print': $js_function = array('testproject' => 'TPROJECT_PTP', 'testsuite' => 'TPROJECT_PTS', 'testcase' => 'TPROJECT_PTS'); break; case 'manage': default: $js_function = array('testproject' => 'EP', 'testsuite' => 'ETS', 'testcase' => 'ET'); break; } $sql = " SELECT NHA.*, NT.description AS node_type " . " FROM {$tables['nodes_hierarchy']} NHA, {$tables['node_types']} NT " . " WHERE NHA.node_type_id = NT.id " . " AND parent_id = " . intval($parent) . " AND NT.description NOT IN " . " ('testcase_version','testplan','requirement_spec','requirement'{$filter_node_type}) "; if (!is_null($filter_node) && $filter_node > 0 && $parent == $root_node) { $sql .= " AND NHA.id = " . intval($filter_node); } $sql .= " ORDER BY NHA.node_order "; // for debug //file_put_contents('/tmp/sql_display_node.txt', $sql); $nodeSet = $dbHandler->get_recordset($sql); if ($show_tcases) { // Get external id, used on test case nodes $sql = " SELECT DISTINCT tc_external_id,NHA.parent_id " . " FROM {$tables['tcversions']} TCV " . " JOIN {$tables['nodes_hierarchy']} NHA ON NHA.id = TCV.id " . " JOIN {$tables['nodes_hierarchy']} NHB ON NHA.parent_id = NHB.id " . " WHERE NHB.parent_id = " . intval($parent) . " AND NHA.node_type_id = 4"; $external = $dbHandler->fetchRowsIntoMap($sql, 'parent_id'); } // print_r(array_values($nodeSet)); //file_put_contents('/tmpsql_display_node.txt', serialize(array_values($nodeSet))); if (!is_null($nodeSet)) { $tproject_mgr = new testproject($dbHandler); foreach ($nodeSet as $key => $row) { $path['text'] = htmlspecialchars($row['name']); $path['id'] = $row['id']; // this attribute/property is used on custom code on drag and drop $path['position'] = $row['node_order']; $path['leaf'] = false; $path['cls'] = 'folder'; // customs key will be accessed using node.attributes.[key name] $path['testlink_node_type'] = $row['node_type']; $path['testlink_node_name'] = $path['text']; // already htmlspecialchars() done $path['forbidden_parent'] = 'none'; $tcase_qty = null; switch ($row['node_type']) { case 'testproject': // at least on Test Specification seems that we do not execute this piece of code. $path['href'] = "javascript:EP({$path['id']})"; $path['forbidden_parent'] = $forbidden_parent[$row['node_type']]; break; case 'testsuite': $tcase_qty = $tproject_mgr->count_testcases($row['id']); $path['href'] = "javascript:" . $js_function[$row['node_type']] . "({$path['id']})"; $path['forbidden_parent'] = $forbidden_parent[$row['node_type']]; break; case 'testcase': $path['href'] = "javascript:" . $js_function[$row['node_type']] . "({$path['id']})"; $path['forbidden_parent'] = $forbidden_parent[$row['node_type']]; if (is_null($showTestCaseID)) { $showTestCaseID = config_get('treemenu_show_testcase_id'); } if ($showTestCaseID) { $path['text'] = htmlspecialchars($tcprefix . $external[$row['id']]['tc_external_id'] . ":") . $path['text']; } $path['leaf'] = true; break; } if (!is_null($tcase_qty)) { $path['text'] .= " ({$tcase_qty})"; } switch ($row['node_type']) { case 'testproject': case 'testsuite': if (isset($helpText[$row['node_type']])) { $path['text'] = '<span title="' . $helpText[$row['node_type']] . '">' . $path['text'] . '</span>'; } break; } $nodes[] = $path; } } return $nodes; }