$enabled = 1; $no_filters = null; $gui->design_cf = $tproject_mgr->cfield_mgr->get_linked_cfields_at_design($args->tprojectID, $enabled, $no_filters, 'requirement'); $gui->keywords = $tproject_mgr->getKeywords($args->tprojectID); $reqSpecSet = $tproject_mgr->getOptionReqSpec($args->tprojectID, testproject::GET_NOT_EMPTY_REQSPEC); $gui->filter_by['design_scope_custom_fields'] = !is_null($gui->design_cf); $gui->filter_by['keyword'] = !is_null($gui->keywords); $gui->filter_by['requirement_doc_id'] = !is_null($reqSpecSet); $reqCfg = config_get('req_cfg'); $gui->types = init_labels($reqCfg->type_labels); $coverageManagement = $reqCfg->expected_coverage_management; $gui->filter_by['expected_coverage'] = !is_null($coverageManagement); $gui->reqStatus = init_labels($reqCfg->status_labels); //BUGID 1748 $gui->filter_by['relation_type'] = $reqCfg->relations->enable; $gui->req_relation_select = $req_mgr->init_relation_type_select(); foreach ($gui->req_relation_select['equal_relations'] as $key => $oldkey) { // set new key in array and delete old one $new_key = (int) str_replace("_source", "", $oldkey); $gui->req_relation_select['items'][$new_key] = $gui->req_relation_select['items'][$oldkey]; unset($gui->req_relation_select['items'][$oldkey]); } $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . 'reqSearchForm.tpl'); function init_args() { $args = new stdClass(); $args->tprojectID = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0; $args->tprojectName = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : 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->refreshTree = $argsObj->refreshTree; $gui->req_cfg = config_get('req_cfg'); $gui->tproject_id = $argsObj->tproject_id; $gui->tproject_name = $argsObj->tproject_name; $gui->grants = new stdClass(); $gui->grants->req_mgmt = $argsObj->user->hasRight($dbHandler, "mgt_modify_req", $argsObj->tproject_id); // IMPORTANT NOTICE // We can arrive here after following operation // 1. user click on left pane tree on REQ SPEC NODE // 2. on right pane screen user click on CREATE button on Requirements Operations // 3. on new screen user CLICK CANCEL // In this situation $argsObj->req_id is 0 OR EMPTY $gui->req_id = $argsObj->req_id; if ($gui->req_id <= 0) { // Quick Exit // is not too clear why do not need to add lib/requirements/ on target $target = "reqSpecView.php?tproject_id={$gui->tproject_id}" . "&req_spec_id={$argsObj->req_spec_id}"; header("Location: {$target}"); exit; } // everything is fine - standard processing $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->glueChar = config_get('testcase_cfg')->glue_character; $gui->pieceSep = config_get('gui_title_separator_1'); /* if wanted, show only the given version */ $gui->version_option = $argsObj->req_version_id ? $argsObj->req_version_id : requirement_mgr::ALL_VERSIONS; $gui->req_versions = $req_mgr->get_by_id($gui->req_id, $gui->version_option); $gui->req_has_history = count($req_mgr->get_history($gui->req_id, array('output' => 'array'))) > 1; $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); $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']; } $gui->attachments[$gui->req_id] = $req_mgr->getAttachmentInfos($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($argsObj->userID, $argsObj->tproject_id, $tproject_mgr); } } return $gui; }