/** * * */ 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 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; }
* 20100908 - Julian - BUGID 2877 - Custom Fields linked to Req versions * 20100324 - asimon - added searching for requirement relation type (BUGID 1748) */ require_once "../../config.inc.php"; require_once "common.php"; require_once "requirements.inc.php"; require_once 'exttable.class.php'; testlinkInitPage($db); $templateCfg = templateConfiguration(); $tpl = 'reqSearchResults.tpl'; $tproject_mgr = new testproject($db); $req_cfg = config_get('req_cfg'); $tcase_cfg = config_get('testcase_cfg'); $charset = config_get('charset'); $commandMgr = new reqCommands($db); $gui = $commandMgr->initGuiBean(); $gui->main_descr = lang_get('caption_search_form_req'); $gui->warning_msg = ''; $gui->path_info = null; $gui->resultSet = null; $gui->tableSet = null; $edit_label = lang_get('requirement'); $edit_icon = TL_THEME_IMG_DIR . "edit_icon.png"; $map = null; $args = init_args(); $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($args->tprojectID); $gui->tcasePrefix .= $tcase_cfg->glue_character; if ($args->tprojectID) { $tables = tlObjectWithDB::getDBTables(array('cfield_design_values', 'nodes_hierarchy', 'req_specs', 'req_relations', 'req_versions', 'requirements', 'req_coverage', 'tcversions')); $filter = null; $from = array('by_custom_field' => null, 'by_relation_type' => null, 'by_tcid' => null);
/** * * */ 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; }
/** * * */ function initialize_gui(&$dbHandler, $argsObj, &$tproject_mgr) { $req_mgr = new requirement_mgr($dbHandler); $commandMgr = new reqCommands($dbHandler); $gui = $commandMgr->initGuiBean(); $gui->req_cfg = config_get('req_cfg'); $gui->glueChar = config_get('testcase_cfg')->glue_character; $gui->pieceSep = config_get('gui_title_separator_1'); $gui->refreshTree = $argsObj->refreshTree; $gui->tproject_name = $argsObj->tproject_name; $gui->req_id = $argsObj->req_id; /* 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, 1, array('renderImageInline' => true)); $gui->reqHasBeenDeleted = false; if (is_null($gui->req_versions)) { // this means that requirement does not exist anymore. // We have to give just that info to user $gui->reqHasBeenDeleted = true; $gui->main_descr = lang_get('req_does_not_exist'); unset($gui->show_match_count); return $gui; // >>>----> Bye! } $tproject_id = $req_mgr->getTestProjectID($argsObj->requirement_id); $target_id = $argsObj->tproject_id; if ($isAlien = $tproject_id != $argsObj->tproject_id) { $target_id = $tproject_id; } $gui->grants = new stdClass(); $gui->grants->req_mgmt = $argsObj->user->hasRight($dbHandler, "mgt_modify_req", $target_id); $gui->grants->unfreeze_req = $argsObj->user->hasRight($dbHandler, "mgt_unfreeze_req", $target_id); $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->req = current($gui->req_versions); $gui->req_coverage = $req_mgr->get_coverage($gui->req_id); $gui->direct_link = $_SESSION['basehref'] . 'linkto.php?tprojectPrefix=' . urlencode($gui->tcasePrefix) . '&item=req&id=' . urlencode($gui->req['req_doc_id']); $gui->fileUploadURL = $_SESSION['basehref'] . $req_mgr->getFileUploadRelativeURL($gui->req_id, $argsObj); $gui->delAttachmentURL = $_SESSION['basehref'] . $req_mgr->getDeleteAttachmentRelativeURL($gui->req_id); $gui->fileUploadMsg = ''; $gui->import_limit = TL_REPOSITORY_MAXFILESIZE; $gui->log_target = null; $loop2do = count($gui->req_versions); for ($rqx = 0; $rqx < $loop2do; $rqx++) { $gui->log_target[] = $gui->req_versions[$rqx]['revision_id'] > 0 ? $gui->req_versions[$rqx]['revision_id'] : $gui->req_versions[$rqx]['version_id']; } $gui->req_has_history = count($req_mgr->get_history($gui->req_id, array('output' => 'array'))) > 1; // 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] = 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); $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_relations['rw'] = !$isAlien; $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); } } $gui->user_feedback = $argsObj->user_feedback; return $gui; }