예제 #1
1
function initializeGui(&$dbHandler, &$argsObj, &$cfgObj, &$tplanMgr, &$tcaseMgr)
{
    $buildMgr = new build_mgr($dbHandler);
    $platformMgr = new tlPlatform($dbHandler, $argsObj->tproject_id);
    $gui = new stdClass();
    $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->execStatusValues = null;
    $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 record:
    // 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();
            }
        }
    }
    // ------------------------------------------------------------------
    $the_builds = $tplanMgr->get_builds_for_html_options($argsObj->tplan_id);
    $gui->build_name = isset($the_builds[$argsObj->build_id]) ? $the_builds[$argsObj->build_id] : '';
    // 20090419 - franciscom
    $gui->grants = initializeRights($dbHandler, $argsObj->user, $argsObj->tproject_id, $argsObj->tplan_id);
    $gui->exec_mode = initializeExecMode($dbHandler, $cfgObj->exec_cfg, $argsObj->user, $argsObj->tproject_id, $argsObj->tplan_id);
    $rs = $tplanMgr->get_by_id($argsObj->tplan_id);
    $gui->testplan_notes = $rs['notes'];
    // 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->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->node_id = $argsObj->id;
    return $gui;
}
예제 #2
0
function initializeGui(&$dbHandler, &$argsObj, &$cfgObj, &$tplanMgr)
{
    $buildMgr = new build_mgr($dbHandler);
    $platformMgr = new tlPlatform($dbHandler, $argsObj->tproject_id);
    $gui = new stdClass();
    $gui->form_token = $argsObj->form_token;
    $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->attachmentInfos = null;
    $gui->refreshTree = 0;
    // 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;
    $dummy = $tplanMgr->get_builds_for_html_options($argsObj->tplan_id);
    $gui->build_name = isset($dummy[$argsObj->build_id]) ? $dummy[$argsObj->build_id] : '';
    $rs = $tplanMgr->get_by_id($argsObj->tplan_id);
    $gui->testplan_notes = $rs['notes'];
    $gui->testplan_name = $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));
    $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->pageTitlePrefix = lang_get('execution_context') . ':';
    return $gui;
}
예제 #3
0
/**
 * 
 *
 */
function getPlatforms($db, $tproject_id, $testplan_id)
{
    $platform_mgr = new tlPlatform($db, $tproject_id);
    if (is_null($testplan_id)) {
        $platforms = $platform_mgr->getAll();
    } else {
        $platforms = $platform_mgr->getLinkedToTestplan($testplan_id);
    }
    if (is_null($platforms)) {
        // need to create fake data for platform 0 in order
        // to have only simple logic
        $platforms = array('id' => 0, 'name' => '');
    }
    return $platforms;
}
예제 #4
0
function initializeGui(&$dbHandler, $argsObj, &$tplanMgr, &$tcaseMgr)
{
    $tcase_cfg = config_get('testcase_cfg');
    $title_separator = config_get('gui_title_separator_1');
    $gui = new stdClass();
    $gui->tproject_id = $argsObj->tproject_id;
    $gui->tplan_id = $argsObj->tplan_id;
    $gui->testCasePrefix = $tcaseMgr->tproject_mgr->getTestCasePrefix($argsObj->tproject_id);
    $gui->testCasePrefix .= $tcase_cfg->glue_character;
    $gui->can_remove_executed_testcases = $argsObj->user->hasRight($dbHandler, "testplan_unlink_executed_testcases", $argsObj->tproject_id);
    $gui->can_remove_executed_testcases = $gui->can_remove_executed_testcases == 'yes';
    $tprojectInfo = $tcaseMgr->tproject_mgr->get_by_id($argsObj->tproject_id);
    $gui->priorityEnabled = $tprojectInfo['opt']->testPriorityEnabled;
    $gui->keywordsFilterType = $argsObj->keywordsFilterType;
    $gui->keywords_filter = '';
    $gui->has_tc = 0;
    $gui->items = null;
    $gui->has_linked_items = false;
    $gui->keywordsFilterType = new stdClass();
    $gui->keywordsFilterType->options = array('OR' => 'Or', 'AND' => 'And');
    $gui->keywordsFilterType->selected = $argsObj->keywordsFilterType;
    // full_control, controls the operations planAddTC_m1.tpl will allow
    // 1 => add/remove
    // 0 => just remove
    $gui->full_control = 1;
    $tplan_info = $tplanMgr->get_by_id($argsObj->tplan_id);
    $gui->testPlanName = $tplan_info['name'];
    $gui->pageTitle = lang_get('test_plan') . $title_separator . $gui->testPlanName;
    $gui->refreshTree = $argsObj->refreshTree;
    $tproject_mgr = new testproject($dbHandler);
    $tproject_info = $tproject_mgr->get_by_id($argsObj->tproject_id);
    $userSet = $argsObj->user->getAll($dbHandler);
    $gui->testers = tlUser::getTestersForHtmlOptions($tplan_info, $tproject_info, $userSet);
    $gui->testerID = $argsObj->testerID;
    $gui->send_mail = $argsObj->send_mail;
    $gui->send_mail_checked = '';
    if ($gui->send_mail) {
        $gui->send_mail_checked = ' checked="checked" ';
    }
    $platform_mgr = new tlPlatform($dbHandler, $argsObj->tproject_id);
    $gui->platforms = $platform_mgr->getLinkedToTestplan($argsObj->tplan_id);
    $gui->platformsForHtmlOptions = null;
    $gui->usePlatforms = $platform_mgr->platformsActiveForTestplan($argsObj->tplan_id);
    if ($gui->usePlatforms) {
        // Create options for two different select boxes. $bulk_platforms
        // has "All platforms" on top and "$platformsForHtmlOptions" has an
        // empty item
        $gui->platformsForHtmlOptions[0] = '';
        foreach ($gui->platforms as $elem) {
            $gui->platformsForHtmlOptions[$elem['id']] = $elem['name'];
        }
        $gui->bulk_platforms = $platform_mgr->getLinkedToTestplanAsMap($argsObj->tplan_id);
        $gui->bulk_platforms[0] = lang_get("all_platforms");
        ksort($gui->bulk_platforms);
    }
    //
    $gui->warning_msg = new stdClass();
    $gui->warning_msg->executed = lang_get('executed_can_not_be_removed');
    if ($gui->can_remove_executed_testcases) {
        $gui->warning_msg->executed = lang_get('has_been_executed');
    }
    // BUGID 3406
    $gui->build = init_build_selector($tplanMgr, $argsObj);
    return $gui;
}
예제 #5
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;
}