Ejemplo n.º 1
0
// BUGID 3516
// remove testcases which shall not be displayed because they were filtered out
if (!is_null($args->testcases_to_show) && $args->level == 'testsuite') {
    foreach ($gui->map_last_exec as $key => $tc) {
        if (!in_array($tc['testcase_id'], $args->testcases_to_show)) {
            unset($gui->map_last_exec[$key]);
            // tc shall not be displayed
        }
    }
    // fix indexes for smarty
    $gui->map_last_exec = array_values($gui->map_last_exec);
}
// $gui->can_use_bulk_op=$args->level == 'testsuite' && (!is_null($gui->map_last_exec) && count($gui->map_last_exec) > 1) ? 1 : 0;
$gui->can_use_bulk_op = $args->level == 'testsuite' && count($gui->map_last_exec) > 1 ? 1 : 0;
if ($gui->can_use_bulk_op) {
    $gui->execStatusValues = createResultsMenu();
    if (isset($gui->execStatusValues[$cfg->tc_status['all']])) {
        unset($gui->execStatusValues[$cfg->tc_status['all']]);
    }
    $of = web_editor("bulk_exec_notes", $_SESSION['basehref'], $cfg->editorCfg);
    $of->Value = getItemTemplateContents('execution_template', $of->InstanceName, null);
    // Magic numbers that can be determined by trial and error
    $gui->bulk_exec_notes_editor = $of->CreateHTML(10, 60);
    unset($of);
} else {
    $gui->exec_notes_editors = createExecNotesWebEditor($gui->map_last_exec, $_SESSION['basehref'], $cfg->editorCfg);
}
// To silence smarty errors
//  future must be initialized in a right way
$smarty->assign('test_automation_enabled', 0);
$smarty->assign('cfg', $cfg);
Ejemplo n.º 2
0
function initializeGui(&$dbHandler, &$argsObj, &$cfgObj, &$tplanMgr, &$tcaseMgr)
{
    $buildMgr = new build_mgr($dbHandler);
    $platformMgr = new tlPlatform($dbHandler, $argsObj->tproject_id);
    $gui = new stdClass();
    $gui->remoteExecFeedback = $gui->user_feedback = '';
    $gui->tplan_id = $argsObj->tplan_id;
    $gui->tproject_id = $argsObj->tproject_id;
    $gui->build_id = $argsObj->build_id;
    $gui->platform_id = $argsObj->platform_id;
    $gui->loadExecDashboard = false;
    $gui->treeFormToken = $argsObj->treeFormToken;
    // CORTADO
    $gui->execStatusValues = createResultsMenu();
    $gui->execStatusValues[$cfgObj->tc_status['not_run']] = '';
    if (isset($gui->execStatusValues[$cfgObj->tc_status['all']])) {
        unset($gui->execStatusValues[$cfgObj->tc_status['all']]);
    }
    $gui->can_use_bulk_op = 0;
    $gui->exec_notes_editors = null;
    $gui->bulk_exec_notes_editor = null;
    $gui->req_details = null;
    $gui->attachmentInfos = null;
    $gui->bugs = null;
    $gui->other_exec_cfields = null;
    $gui->ownerDisplayName = null;
    $gui->editorType = $cfgObj->editorCfg['type'];
    $gui->filter_assigned_to = $argsObj->filter_assigned_to;
    $gui->tester_id = $argsObj->user_id;
    $gui->include_unassigned = $argsObj->include_unassigned;
    $gui->tpn_view_status = $argsObj->tpn_view_status;
    $gui->bn_view_status = $argsObj->bn_view_status;
    $gui->bc_view_status = $argsObj->bc_view_status;
    $gui->platform_notes_view_status = $argsObj->platform_notes_view_status;
    $gui->refreshTree = $argsObj->refreshTree;
    if (!$argsObj->status || $argsObj->status == $cfgObj->tc_status['not_run']) {
        $gui->refreshTree = 0;
    }
    $gui->map_last_exec_any_build = null;
    $gui->map_last_exec = null;
    // 20081122 - franciscom
    // Just for the records:
    // doing this here, we avoid to do on processTestSuite() and processTestCase(),
    // but absolutely this will not improve in ANY WAY perfomance, because we do not loop
    // over these two functions.
    $tprojectMgr = new testproject($dbHandler);
    $gui->tcasePrefix = $tprojectMgr->getTestCasePrefix($argsObj->tproject_id);
    $build_info = $buildMgr->get_by_id($argsObj->build_id);
    $gui->build_notes = $build_info['notes'];
    $gui->build_is_open = $build_info['is_open'] == 1 ? 1 : 0;
    $gui->execution_types = $tcaseMgr->get_execution_types();
    if ($argsObj->filter_assigned_to) {
        $userSet = tlUser::getByIds($dbHandler, array_values($argsObj->filter_assigned_to));
        if ($userSet) {
            foreach ($userSet as $key => $userObj) {
                $gui->ownerDisplayName[$key] = $userObj->getDisplayName();
            }
        }
    }
    // ------------------------------------------------------------------
    $dummy = $tplanMgr->get_builds_for_html_options($argsObj->tplan_id);
    $gui->build_name = isset($dummy[$argsObj->build_id]) ? $dummy[$argsObj->build_id] : '';
    $gui->build_div_title = lang_get('build') . ' ' . $gui->build_name;
    $gui->exec_mode = initializeExecMode($dbHandler, $cfgObj->exec_cfg, $argsObj->user, $argsObj->tproject_id, $argsObj->tplan_id);
    $gui->grants = initializeRights($dbHandler, $argsObj->user, $argsObj->tproject_id, $argsObj->tplan_id);
    $rs = $tplanMgr->get_by_id($argsObj->tplan_id);
    $gui->testplan_notes = $rs['notes'];
    $gui->testplan_div_title = lang_get('test_plan') . ' ' . $rs['name'];
    // Important note:
    // custom fields for test plan can be edited ONLY on design, that's reason why we are using
    // scope = 'design' instead of 'execution'
    $gui->testplan_cfields = $tplanMgr->html_table_of_custom_field_values($argsObj->tplan_id, 'design', array('show_on_execution' => 1));
    $gui->build_cfields = $buildMgr->html_table_of_custom_field_values($argsObj->build_id, $argsObj->tproject_id, 'design', array('show_on_execution' => 1));
    $gui->history_on = manage_history_on($_REQUEST, $_SESSION, $cfgObj->exec_cfg, 'btn_history_on', 'btn_history_off', 'history_on');
    $gui->history_status_btn_name = $gui->history_on ? 'btn_history_off' : 'btn_history_on';
    $dummy = $platformMgr->getLinkedToTestplan($argsObj->tplan_id);
    $gui->has_platforms = !is_null($dummy) ? 1 : 0;
    $gui->platform_info['id'] = 0;
    $gui->platform_info['name'] = '';
    if (!is_null($argsObj->platform_id) && $argsObj->platform_id > 0) {
        $gui->platform_info = $platformMgr->getByID($argsObj->platform_id);
    }
    $gui->platform_div_title = lang_get('platform') . ' ' . $gui->platform_info['name'];
    $gui->issueTrackerIntegrationOn = $gui->tlCanCreateIssue = false;
    $gui->node_id = $argsObj->id;
    $gui->draw_save_and_exit = $argsObj->caller == 'tcAssignedToMe';
    return $gui;
}
 /**
  *
  */
 private function init_filter_result()
 {
     $result_key = 'filter_result_result';
     $method_key = 'filter_result_method';
     $build_key = 'filter_result_build';
     if (is_null($this->testplan_mgr)) {
         $this->testplan_mgr = new testplan($this->db);
     }
     $tplan_id = $this->settings['setting_testplan']['selected'];
     $this->configuration->results = config_get('results');
     // determine, which config to load and use for filter methods - depends on mode!
     $cfg = $this->mode == 'execution_mode' ? 'execution_filter_methods' : 'execution_assignment_filter_methods';
     $this->configuration->filter_methods = config_get($cfg);
     //
     // CRITIC - Differences bewteen this configuration and
     // (file const.inc.php)
     // $tlCfg->execution_filter_methods['default_type']
     // $tlCfg->execution_assignment_filter_methods['default_type']
     //
     // Will create issues: you will see an string on HTML SELECT, but code
     // returned on submit will not code for string you are seeing.!!!!
     //
     // determine which filter method shall be selected by the JS function in template,
     // when only one build is selectable by the user
     $js_key_to_select = 0;
     if ($this->mode == 'execution_mode') {
         $js_key_to_select = $this->configuration->filter_methods['status_code']['current_build'];
     } else {
         if ($this->mode == 'plan_mode') {
             $js_key_to_select = $this->configuration->filter_methods['status_code']['specific_build'];
         }
     }
     // values selected by user
     $result_selection = $this->args->{$result_key};
     $method_selection = $this->args->{$method_key};
     $build_selection = $this->args->{$build_key};
     // default values
     $default_filter_method = $this->configuration->filter_methods['default_type'];
     $any_result_key = $this->configuration->results['status_code']['all'];
     $newest_build_id = $this->testplan_mgr->get_max_build_id($tplan_id, testplan::GET_ACTIVE_BUILD);
     if (is_null($method_selection)) {
         $method_selection = $default_filter_method;
     }
     if (is_null($result_selection) || $this->args->reset_filters) {
         // no selection yet or filter reset requested
         $result_selection = $any_result_key;
         $method_selection = $default_filter_method;
         $build_selection = $newest_build_id;
     } else {
         $this->do_filtering = true;
     }
     // init array structure
     $key = 'filter_result';
     $this->filters[$key] = array($result_key => array('items' => null, 'selected' => $result_selection), $method_key => array('items' => array(), 'selected' => $method_selection, 'js_selection' => $js_key_to_select), $build_key => array('items' => null, 'selected' => $build_selection));
     // init menu for result selection by function from exec.inc.php
     $this->filters[$key][$result_key]['items'] = createResultsMenu();
     $this->filters[$key][$result_key]['items'][$any_result_key] = $this->option_strings['any'];
     // init menu for filter method selection
     foreach ($this->configuration->filter_methods['status_code'] as $statusname => $statusshortcut) {
         $code = $this->configuration->filter_methods['status_code'][$statusname];
         $this->filters[$key][$method_key]['items'][$code] = lang_get($this->configuration->filter_methods['status_label'][$statusname]);
     }
     // init menu for build selection
     $this->filters[$key][$build_key]['items'] = $this->testplan_mgr->get_builds_for_html_options($tplan_id, testplan::GET_ACTIVE_BUILD);
     // if "any" is selected, nullify the active filters
     if (is_array($result_selection) && in_array($any_result_key, $result_selection) || $result_selection == $any_result_key) {
         $this->active_filters[$result_key] = null;
         $this->active_filters[$method_key] = null;
         $this->active_filters[$build_key] = null;
         $this->filters[$key][$result_key]['selected'] = $any_result_key;
     } else {
         $this->active_filters[$result_key] = $result_selection;
         $this->active_filters[$method_key] = $method_selection;
         $this->active_filters[$build_key] = $build_selection;
     }
 }
Ejemplo n.º 4
0
function initializeGui(&$dbHandler, &$argsObj, &$cfgObj, &$tplanMgr, &$tcaseMgr, &$issueTracker)
{
    $buildMgr = new build_mgr($dbHandler);
    $platformMgr = new tlPlatform($dbHandler, $argsObj->tproject_id);
    $gui = new stdClass();
    $gui->showExternalAccessString = true;
    $gui->showImgInlineString = false;
    $gui->issueSummaryForStep = null;
    $gui->addIssueOp = null;
    $gui->allowStepAttachments = true;
    $gui->tlCanCreateIssue = !is_null($issueTracker) && method_exists($issueTracker, 'addIssue');
    $gui->remoteExecFeedback = $gui->user_feedback = '';
    $gui->tplan_id = $argsObj->tplan_id;
    $gui->tproject_id = $argsObj->tproject_id;
    $gui->build_id = $argsObj->build_id;
    $gui->platform_id = $argsObj->platform_id;
    $gui->loadExecDashboard = false;
    $gui->treeFormToken = $argsObj->treeFormToken;
    $gui->import_limit = TL_REPOSITORY_MAXFILESIZE;
    $gui->execStatusValues = createResultsMenu();
    $gui->execStatusValues[$cfgObj->tc_status['not_run']] = '';
    if (isset($gui->execStatusValues[$cfgObj->tc_status['all']])) {
        unset($gui->execStatusValues[$cfgObj->tc_status['all']]);
    }
    $gui->can_use_bulk_op = 0;
    $gui->exec_notes_editors = null;
    $gui->bulk_exec_notes_editor = null;
    $gui->req_details = null;
    $gui->attachmentInfos = null;
    $gui->bugs = null;
    $gui->other_exec_cfields = null;
    $gui->ownerDisplayName = null;
    $gui->editorType = $cfgObj->editorCfg['type'];
    $gui->filter_assigned_to = $argsObj->filter_assigned_to;
    $gui->tester_id = $argsObj->user_id;
    $gui->include_unassigned = $argsObj->include_unassigned;
    $gui->tpn_view_status = $argsObj->tpn_view_status;
    $gui->bn_view_status = $argsObj->bn_view_status;
    $gui->bc_view_status = $argsObj->bc_view_status;
    $gui->platform_notes_view_status = $argsObj->platform_notes_view_status;
    $gui->refreshTree = $argsObj->refreshTree;
    if (!$argsObj->statusSingle || current($argsObj->statusSingle) == $cfgObj->tc_status['not_run']) {
        $gui->refreshTree = 0;
    }
    $gui->map_last_exec_any_build = null;
    $gui->map_last_exec = null;
    // 20081122 - franciscom
    // Just for the records:
    // doing this here, we avoid to do on processTestSuite() and processTestCase(),
    // but absolutely this will not improve in ANY WAY perfomance, because we do not loop
    // over these two functions.
    $tprojectMgr = new testproject($dbHandler);
    $gui->tcasePrefix = $tprojectMgr->getTestCasePrefix($argsObj->tproject_id);
    $build_info = $buildMgr->get_by_id($argsObj->build_id);
    $gui->build_notes = $build_info['notes'];
    $gui->build_is_open = $build_info['is_open'] == 1 ? 1 : 0;
    $gui->execution_types = $tcaseMgr->get_execution_types();
    if ($argsObj->filter_assigned_to) {
        $userSet = tlUser::getByIds($dbHandler, array_values($argsObj->filter_assigned_to));
        if ($userSet) {
            foreach ($userSet as $key => $userObj) {
                $gui->ownerDisplayName[$key] = $userObj->getDisplayName();
            }
        }
    }
    // ------------------------------------------------------------------
    $dummy = $tplanMgr->get_builds_for_html_options($argsObj->tplan_id);
    $gui->build_name = isset($dummy[$argsObj->build_id]) ? $dummy[$argsObj->build_id] : '';
    $gui->build_div_title = lang_get('build') . ' ' . $gui->build_name;
    $gui->exec_mode = initializeExecMode($dbHandler, $cfgObj->exec_cfg, $argsObj->user, $argsObj->tproject_id, $argsObj->tplan_id);
    $gui->grants = initializeRights($dbHandler, $argsObj->user, $argsObj->tproject_id, $argsObj->tplan_id);
    $rs = $tplanMgr->get_by_id($argsObj->tplan_id);
    $gui->testplan_notes = $rs['notes'];
    $gui->testplan_div_title = lang_get('test_plan') . ' ' . $rs['name'];
    $argsObj->tplan_apikey = $rs['api_key'];
    // Important note:
    // custom fields for test plan can be edited ONLY on design, that's reason why we are using
    // scope = 'design' instead of 'execution'
    $gui->testplan_cfields = $tplanMgr->html_table_of_custom_field_values($argsObj->tplan_id, 'design', array('show_on_execution' => 1));
    $gui->build_cfields = $buildMgr->html_table_of_custom_field_values($argsObj->build_id, $argsObj->tproject_id, 'design', array('show_on_execution' => 1));
    $gui->history_on = manage_history_on($_REQUEST, $_SESSION, $cfgObj->exec_cfg, 'btn_history_on', 'btn_history_off', 'history_on');
    $gui->history_status_btn_name = $gui->history_on ? 'btn_history_off' : 'btn_history_on';
    $dummy = $platformMgr->getLinkedToTestplan($argsObj->tplan_id);
    $gui->has_platforms = !is_null($dummy) ? 1 : 0;
    $gui->platform_info['id'] = 0;
    $gui->platform_info['name'] = '';
    if (!is_null($argsObj->platform_id) && $argsObj->platform_id > 0) {
        $gui->platform_info = $platformMgr->getByID($argsObj->platform_id);
    }
    $gui->platform_div_title = lang_get('platform') . ' ' . $gui->platform_info['name'];
    $gui->issueTrackerIntegrationOn = $gui->tlCanCreateIssue = $gui->tlCanAddIssueNote = false;
    $gui->node_id = $argsObj->id;
    $gui->draw_save_and_exit = $argsObj->caller == 'tcAssignedToMe';
    $gui->issueTrackerCfg = new stdClass();
    $gui->issueTrackerCfg->bugSummaryMaxLength = 100;
    // MAGIC I'm sorry
    $gui->issueTrackerCfg->editIssueAttr = false;
    if (!is_null($issueTracker)) {
        if ($issueTracker->isConnected()) {
            $itsCfg = $issueTracker->getCfg();
            $gui->issueTrackerCfg->bugSummaryMaxLength = $issueTracker->getBugSummaryMaxLength();
            $gui->issueTrackerCfg->editIssueAttr = intval($itsCfg->userinteraction);
            $gui->issueTrackerIntegrationOn = true;
            $gui->accessToIssueTracker = lang_get('link_bts_create_bug') . "({$argsObj->itsCfg['issuetracker_name']})";
            $gui->createIssueURL = $issueTracker->getEnterBugURL();
            $gui->tlCanCreateIssue = method_exists($issueTracker, 'addIssue') && $issueTracker->canCreateViaAPI();
            $gui->tlCanAddIssueNote = method_exists($issueTracker, 'addNote');
        } else {
            $gui->user_feedback = lang_get('issue_tracker_integration_problems');
        }
    }
    // get matadata
    $gui->issueTrackerMetaData = null;
    if ($gui->issueTrackerCfg->editIssueAttr == 1) {
        $gui->issueTrackerMetaData = !is_null($issueTracker) ? getIssueTrackerMetaData($issueTracker) : null;
        $k2c = array('issueType', 'issuePriority', 'artifactVersion', 'artifactComponent');
        foreach ($k2c as $kj) {
            $gui->{$kj} = $argsObj->{$kj};
            $kx = $kj . 'ForStep';
            $gui->{$kx} = $argsObj->{$kx};
        }
    }
    return $gui;
}