Exemplo n.º 1
0
/**
 * 
 *
 */
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;
}
Exemplo n.º 2
0
/**
 * 
 *
 */
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[] = array($gui->req);
    $gui->other_versions[] = count($gui->req_versions) > 1 ? array_slice($gui->req_versions, 1) : null;
    $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->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)
{
    $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;
}
Exemplo n.º 4
0
 /**
  * 
  *
  */
 function show(&$argsObj, $request, $userFeedback, $updateCFOnDB = true)
 {
     $smartyObj = new TLSmarty();
     $guiObj = $this->initGuiBean($argsObj);
     $identity = $this->buildIdentity($argsObj);
     $guiObj->viewerArgs = array();
     $guiObj->refreshTree = $argsObj->refreshTree && $userFeedback['status_ok'] ? 1 : 0;
     $guiObj->has_been_executed = $argsObj->has_been_executed;
     $guiObj->steps_results_layout = config_get('spec_cfg')->steps_results_layout;
     $guiObj->user_feedback = '';
     if ($userFeedback['status_ok']) {
         $guiObj->user_feedback = '';
         if ($updateCFOnDB) {
             $cf_map = $this->tcaseMgr->cfield_mgr->get_linked_cfields_at_design($identity->tproject_id, 1, null, 'testcase');
             $this->tcaseMgr->cfield_mgr->design_values_to_db($request, $identity->version_id, $cf_map);
         }
         $guiObj->attachments[$argsObj->tcase_id] = getAttachmentInfosFrom($this->tcaseMgr, $identity->id);
     } else {
         $guiObj->viewerArgs['user_feedback'] = $guiObj->user_feedback = $userFeedback['msg'];
     }
     $guiObj->viewerArgs['refreshTree'] = $guiObj->refreshTree;
     $guiObj->viewerArgs['user_feedback'] = $guiObj->user_feedback;
     $this->tcaseMgr->show($smartyObj, $guiObj, $identity, $this->grants);
     exit;
 }
Exemplo n.º 5
0
 /**
  * show()
  *
  * args:  smarty [reference]
  *        id 
  *        sqlResult [default = '']
  *        action [default = 'update']
  *        modded_item_id [default = 0]
  * 
  * returns: -
  *
  **/
 function show(&$smarty, $guiObj, $template_dir, $id, $options = null, $sqlResult = '', $action = 'update', $modded_item_id = 0)
 {
     $gui = is_null($guiObj) ? new stdClass() : $guiObj;
     $gui->cf = '';
     $gui->sqlResult = '';
     $gui->sqlAction = '';
     // 20100314 - franciscom
     $gui->refreshTree = property_exists($gui, 'refreshTree') ? $gui->refreshTree : false;
     // BUGID 0003233: After test suite edit, display of Test suite do not
     //                have upload button enabled for attachment
     // $my['options'] = array('show_mode' => 'readonly');
     $my['options'] = array('show_mode' => 'readwrite');
     $my['options'] = array_merge($my['options'], (array) $options);
     $gui->modify_tc_rights = has_rights($this->db, "mgt_modify_tc");
     if ($my['options']['show_mode'] == 'readonly') {
         $gui->modify_tc_rights = 'no';
     }
     if ($sqlResult) {
         $gui->sqlResult = $sqlResult;
         $gui->sqlAction = $action;
     }
     $gui->container_data = $this->get_by_id($id);
     $gui->moddedItem = $gui->container_data;
     if ($modded_item_id) {
         $gui->moddedItem = $this->get_by_id($modded_item_id);
     }
     $gui->cf = $this->html_table_of_custom_field_values($id);
     $gui->keywords_map = $this->get_keywords_map($id, ' ORDER BY keyword ASC ');
     $gui->attachmentInfos = getAttachmentInfosFrom($this, $id);
     $gui->id = $id;
     $gui->idpage_title = lang_get('testsuite');
     $gui->level = 'testsuite';
     $smarty->assign('gui', $gui);
     $smarty->display($template_dir . 'containerView.tpl');
 }
/**
 *
 */
function getItemData(&$itemMgr, &$guiObj, &$ofObj, $itemID, $updateAttachments = false)
{
    $dummy = $itemMgr->get_by_id($itemID);
    if (sizeof($dummy)) {
        $ofObj->Value = $dummy['notes'];
        $guiObj->testplan_name = $dummy['name'];
        $guiObj->is_active = $dummy['active'];
        $guiObj->is_public = $dummy['is_public'];
        $guiObj->api_key = $dummy['api_key'];
        $guiObj->tplan_id = $itemID;
        if ($updateAttachments) {
            $guiObj->attachments[$guiObj->tplan_id] = getAttachmentInfosFrom($itemMgr, $guiObj->tplan_id);
        }
    }
}
Exemplo n.º 7
0
/**
 *
 */
function initializeGui(&$objMgr, $id, $argsObj, $lbl)
{
    $guiObj = new stdClass();
    $guiObj->id = $id;
    $guiObj->refreshTree = $argsObj->refreshTree;
    $guiObj->btn_reorder_testcases = $lbl['btn_reorder_testcases'];
    $guiObj->page_title = $lbl['container_title_testsuite'];
    $guiObj->attachments = getAttachmentInfosFrom($objMgr, $id);
    $guiObj->fileUploadURL = $_SESSION['basehref'] . $objMgr->getFileUploadRelativeURL($id);
    return $guiObj;
}
Exemplo n.º 8
0
 /**
  * Displays smarty template to show test project info to users.
  *
  * @param type $smarty [ref] smarty object
  * @param type $id test project
  * @param type $sqlResult [default = '']
  * @param type $action [default = 'update']
  * @param type $modded_item_id [default = 0]
  * 
  * @todo havlatm (20100214): smarty should not be in this class - move code to appropariate page
  **/
 function show(&$smarty, $guiObj, $template_dir, $id, $sqlResult = '', $action = 'update', $modded_item_id = 0)
 {
     $gui = $guiObj;
     $gui->modify_tc_rights = has_rights($this->db, "mgt_modify_tc");
     $gui->mgt_modify_product = has_rights($this->db, "mgt_modify_product");
     $gui->sqlResult = '';
     $gui->sqlAction = '';
     if ($sqlResult) {
         $gui->sqlResult = $sqlResult;
     }
     $gui->container_data = $this->get_by_id($id);
     $gui->moddedItem = $gui->container_data;
     $gui->level = 'testproject';
     $gui->page_title = lang_get('testproject');
     $gui->refreshTree = property_exists($gui, 'refreshTree') ? $gui->refreshTree : false;
     $gui->attachmentInfos = getAttachmentInfosFrom($this, $id);
     if ($modded_item_id) {
         $gui->moddedItem = $this->get_by_id($modded_item_id);
     }
     $smarty->assign('gui', $gui);
     $smarty->display($template_dir . 'containerView.tpl');
 }
Exemplo n.º 9
0
 /**
  * Displays smarty template to show test project info to users.
  *
  * @param type $smarty [ref] smarty object
  * @param type $id test project
  * @param type $sqlResult [default = '']
  * @param type $action [default = 'update']
  * @param type $modded_item_id [default = 0]
  *
  * @internal revisions
  *
  **/
 function show(&$smarty, $guiObj, $template_dir, $id, $sqlResult = '', $action = 'update', $modded_item_id = 0)
 {
     $gui = $guiObj;
     $gui->modify_tc_rights = has_rights($this->db, "mgt_modify_tc");
     $gui->mgt_modify_product = has_rights($this->db, "mgt_modify_product");
     $gui->sqlResult = '';
     $gui->sqlAction = '';
     if ($sqlResult) {
         $gui->sqlResult = $sqlResult;
     }
     $p2ow = array('refreshTree' => false, 'user_feedback' => '');
     foreach ($p2ow as $prop => $value) {
         if (!property_exists($gui, $prop)) {
             $gui->{$prop} = $value;
         }
     }
     $safeID = intval($id);
     $gui->container_data = $this->get_by_id($safeID);
     $gui->moddedItem = $gui->container_data;
     $gui->level = 'testproject';
     $gui->page_title = lang_get('testproject');
     $gui->refreshTree = property_exists($gui, 'refreshTree') ? $gui->refreshTree : false;
     $gui->attachmentInfos = getAttachmentInfosFrom($this, $safeID);
     // attachments management on page
     $gui->fileUploadURL = $_SESSION['basehref'] . $this->getFileUploadRelativeURL($safeID);
     $gui->delAttachmentURL = $_SESSION['basehref'] . $this->getDeleteAttachmentRelativeURL($safeID);
     $gui->import_limit = TL_REPOSITORY_MAXFILESIZE;
     $gui->fileUploadMsg = '';
     $exclusion = array('testcase', 'me', 'testplan' => 'me', 'requirement_spec' => 'me');
     $gui->canDoExport = count($this->tree_manager->get_children($safeID, $exclusion)) > 0;
     if ($modded_item_id) {
         $gui->moddedItem = $this->get_by_id(intval($modded_item_id));
     }
     $smarty->assign('gui', $gui);
     $smarty->display($template_dir . 'containerView.tpl');
 }
Exemplo n.º 10
0
 function doUpdate(&$argsObj, $request)
 {
     $smartyObj = new TLSmarty();
     $viewer_args = array();
     $guiObj = $this->initGuiBean($argsObj);
     $guiObj->refreshTree = $argsObj->refreshTree ? 1 : 0;
     $guiObj->has_been_executed = $argsObj->has_been_executed;
     // BUGID 3610
     $guiObj->steps_results_layout = config_get('spec_cfg')->steps_results_layout;
     // 20100901 - seems useless
     // to get the name before the user operation
     // $tc_old = $this->tcaseMgr->get_by_id($argsObj->tcase_id,$argsObj->tcversion_id);
     $ret = $this->tcaseMgr->update($argsObj->tcase_id, $argsObj->tcversion_id, $argsObj->name, $argsObj->summary, $argsObj->preconditions, $argsObj->tcaseSteps, $argsObj->user_id, $argsObj->assigned_keywords_list, testcase::DEFAULT_ORDER, $argsObj->exec_type, $argsObj->importance);
     if ($ret['status_ok']) {
         $guiObj->refreshTree = 1;
         $guiObj->user_feedback = '';
         $ENABLED = 1;
         $NO_FILTERS = null;
         $cf_map = $this->tcaseMgr->cfield_mgr->get_linked_cfields_at_design($argsObj->testproject_id, $ENABLED, $NO_FILTERS, 'testcase');
         // BUGID 3162 - generated by not passing 3 argument
         // $this->tcaseMgr->cfield_mgr->design_values_to_db($request,$argsObj->tcase_id,$cf_map);
         //
         // BUGID 3431
         $this->tcaseMgr->cfield_mgr->design_values_to_db($request, $argsObj->tcversion_id, $cf_map);
         $guiObj->attachments[$argsObj->tcase_id] = getAttachmentInfosFrom($this->tcaseMgr, $argsObj->tcase_id);
     } else {
         $guiObj->refreshTree = 0;
         $guiObj->user_feedback = $ret['msg'];
     }
     $viewer_args['refreshTree'] = $guiObj->refreshTree;
     $viewer_args['user_feedback'] = $guiObj->user_feedback;
     $this->tcaseMgr->show($smartyObj, $guiObj, $this->templateCfg->template_dir, $argsObj->tcase_id, $argsObj->tcversion_id, $viewer_args, null, $argsObj->show_mode);
     return $guiObj;
 }
Exemplo n.º 11
0
/**
 *
 *
 */
function processTestCase(&$dbHandler, $tplEngine, $args, &$gui, $grants, $cfg)
{
    $get_path_info = false;
    $item_mgr = new testcase($dbHandler);
    // has sense only when we work on test case
    $dummy = testcase::getLayout();
    $gui->tableColspan = $dummy->tableToDisplayTestCaseSteps->colspan;
    $gui->viewerArgs['refresh_tree'] = 'no';
    $gui->path_info = null;
    $gui->platforms = null;
    $gui->loadOnCancelURL = '';
    $gui->attachments = null;
    $gui->direct_link = null;
    $gui->steps_results_layout = $cfg['spec']->steps_results_layout;
    $gui->bodyOnUnload = "storeWindowSize('TCEditPopup')";
    if ($args->caller == 'navBar' && !is_null($args->targetTestCase) && strcmp($args->targetTestCase, $args->tcasePrefix) != 0) {
        $args->id = $item_mgr->getInternalID($args->targetTestCase);
        $args->tcversion_id = testcase::ALL_VERSIONS;
        // I've added $args->caller, in order to make clear the logic, because some actions need to be done ONLY
        // when we have arrived to this script because user has requested a search from navBar.
        // Before we have trusted the existence of certain variables (do not think this old kind of approach is good).
        //
        // why strcmp($args->targetTestCase,$args->tcasePrefix) ?
        // because in navBar targetTestCase is initialized with testcase prefix to provide some help to user
        // then if user request search without adding nothing, we will not be able to search.
        // From navBar we want to allow ONLY to search for ONE and ONLY ONE test case ID.
        $gui->viewerArgs['show_title'] = 'no';
        $gui->viewerArgs['display_testproject'] = 1;
        $gui->viewerArgs['display_parent_testsuite'] = 1;
        if (!($get_path_info = $args->id > 0)) {
            $gui->warning_msg = $args->id == 0 ? lang_get('testcase_does_not_exists') : lang_get('prefix_does_not_exists');
        }
    }
    // because we can arrive here from a User Search Request, if args->id == 0 => nothing found
    if ($args->id > 0) {
        if ($get_path_info || $args->show_path) {
            $gui->path_info = $item_mgr->tree_manager->get_full_path_verbose($args->id);
        }
        $platform_mgr = new tlPlatform($dbHandler, $args->tproject_id);
        $gui->platforms = $platform_mgr->getAllAsMap();
        $gui->attachments[$args->id] = getAttachmentInfosFrom($item_mgr, $args->id);
        $gui->direct_link = $item_mgr->buildDirectWebLink($_SESSION['basehref'], $args->id);
        $gui->id = $args->id;
        $identity = new stdClass();
        $identity->id = $args->id;
        $identity->tproject_id = $args->tproject_id;
        $identity->version_id = $args->tcversion_id;
        try {
            $item_mgr->show($tplEngine, $gui, $identity, $grants);
        } catch (Exception $e) {
            echo $e->getMessage();
        }
        exit;
    } else {
        $templateCfg = templateConfiguration();
        // need to initialize search fields
        $xbm = $item_mgr->getTcSearchSkeleton();
        $xbm->warning_msg = lang_get('no_records_found');
        $xbm->pageTitle = lang_get('caption_search_form');
        $xbm->tableSet = null;
        $xbm->doSearch = false;
        $xbm->tproject_id = $args->tproject_id;
        $tplEngine->assign('gui', $xbm);
        $tplEngine->display($templateCfg->template_dir . 'tcSearchResults.tpl');
    }
}
Exemplo n.º 12
0
function moveTestCases(&$smartyObj, &$tsuiteMgr, &$treeMgr, $argsObj)
{
    if (sizeof($argsObj->tcaseSet) > 0) {
        // objectID - original container
        $guiObj = new stdClass();
        $guiObj->attachments = getAttachmentInfosFrom($tsuiteMgr, $argsObj->objectID);
        $guiObj->id = $argsObj->objectID;
        $guiObj->refreshTree = true;
        $guiObj->user_feedback = $user_feedback;
        $status_ok = $treeMgr->change_parent($argsObj->tcaseSet, $argsObj->containerID);
        $guiObj->user_feedback = $status_ok ? '' : lang_get('move_testcases_failed');
        $identity = new stdClass();
        $identity->tproject_id = $argsObj->tproject_id;
        $identity->id = $argsObj->objectID;
        $tsuiteMgr->show($smartyObj, $guiObj, $identity);
    }
}
Exemplo n.º 13
0
function moveTestCases(&$smartyObj, $template_dir, &$tsuiteMgr, &$treeMgr, $argsObj)
{
    if (sizeof($argsObj->tcaseSet) > 0) {
        $status_ok = $treeMgr->change_parent($argsObj->tcaseSet, $argsObj->containerID);
        $user_feedback = $status_ok ? '' : lang_get('move_testcases_failed');
        // objectID - original container
        $guiObj = new stdClass();
        $guiObj->attachments = getAttachmentInfosFrom($tsuiteMgr, $argsObj->objectID);
        $guiObj->id = $argsObj->objectID;
        // BUGID 3669
        $guiObj->refreshTree = true;
        $tsuiteMgr->show($smartyObj, $guiObj, $template_dir, $argsObj->objectID, null, $user_feedback);
    }
}
Exemplo n.º 14
0
        if (!is_null($args->targetTestCase) && strcmp($args->targetTestCase, $args->tcasePrefix) != 0) {
            $viewerArgs['show_title'] = 'no';
            $viewerArgs['display_testproject'] = 1;
            $viewerArgs['display_parent_testsuite'] = 1;
            $args->id = $item_mgr->getInternalID($args->targetTestCase);
            if (!($get_path_info = $args->id > 0)) {
                $gui->warning_msg = $args->id == 0 ? lang_get('testcase_does_not_exists') : lang_get('prefix_does_not_exists');
            }
        }
        if ($args->id > 0) {
            if ($get_path_info || $args->show_path) {
                $path_info = $item_mgr->tree_manager->get_full_path_verbose($args->id);
            }
            $platform_mgr = new tlPlatform($db, $args->tproject_id);
            $gui->platforms = $platform_mgr->getAllAsMap();
            $gui->attachments[$args->id] = getAttachmentInfosFrom($item_mgr, $args->id);
            $gui->direct_link = $item_mgr->buildDirectWebLink($_SESSION['basehref'], $args->id);
        }
        $gui->id = $args->id;
        $item_mgr->show($smarty, $gui, $templateCfg->template_dir, $args->id, $args->tcversion_id, $viewerArgs, $path_info, $args->show_mode);
        break;
    default:
        tLog('Argument "edit" has invalid value: ' . $args->feature, 'ERROR');
        trigger_error($_SESSION['currentUser']->login . '> Argument "edit" has invalid value.', E_USER_ERROR);
}
/**
 * 
 *
 */
function init_args(&$viewerCfg)
{
/**
 * 
 *
 */
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;
}
Exemplo n.º 16
0
 /**
  * show()
  *
  * args:  smarty [reference]
  *        id 
  *        sqlResult [default = '']
  *        action [default = 'update']
  *        modded_item_id [default = 0]
  * 
  * returns: -
  *
  **/
 function show(&$smarty, $guiObj, $template_dir, $id, $options = null, $sqlResult = '', $action = 'update', $modded_item_id = 0)
 {
     $gui = is_null($guiObj) ? new stdClass() : $guiObj;
     $gui->cf = '';
     $gui->sqlResult = '';
     $gui->sqlAction = '';
     $p2ow = array('refreshTree' => false, 'user_feedback' => '');
     foreach ($p2ow as $prop => $value) {
         if (!property_exists($gui, $prop)) {
             $gui->{$prop} = $value;
         }
     }
     // attachments management on page
     $gui->fileUploadURL = $_SESSION['basehref'] . $this->getFileUploadRelativeURL($id);
     $gui->delAttachmentURL = $_SESSION['basehref'] . $this->getDeleteAttachmentRelativeURL($id);
     $gui->import_limit = TL_REPOSITORY_MAXFILESIZE;
     $gui->fileUploadMsg = '';
     // After test suite edit, display of Test suite do not have upload button enabled for attachment
     $my['options'] = array('show_mode' => 'readwrite');
     $my['options'] = array_merge($my['options'], (array) $options);
     $gui->modify_tc_rights = has_rights($this->db, "mgt_modify_tc");
     if ($my['options']['show_mode'] == 'readonly') {
         $gui->modify_tc_rights = 'no';
     }
     if ($sqlResult) {
         $gui->sqlResult = $sqlResult;
         $gui->sqlAction = $action;
     }
     $gui->container_data = $this->get_by_id($id);
     $gui->moddedItem = $gui->container_data;
     if ($modded_item_id) {
         $gui->moddedItem = $this->get_by_id($modded_item_id);
     }
     $gui->cf = $this->html_table_of_custom_field_values($id);
     $gui->keywords_map = $this->get_keywords_map($id, ' ORDER BY keyword ASC ');
     $gui->attachmentInfos = getAttachmentInfosFrom($this, $id);
     $gui->id = $id;
     $gui->page_title = lang_get('testsuite');
     $gui->level = $gui->containerType = 'testsuite';
     $smarty->assign('gui', $gui);
     $smarty->display($template_dir . 'containerView.tpl');
 }