Пример #1
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;
}
Пример #2
0
 **/
require_once '../../config.inc.php';
require_once "common.php";
require_once 'email_api.php';
require_once "specview.php";
testlinkInitPage($db);
$tree_mgr = new tree($db);
$tsuite_mgr = new testsuite($db);
$tplan_mgr = new testplan($db);
$tproject_mgr = new testproject($db);
$tcase_mgr = new testcase($db);
$templateCfg = templateConfiguration();
$args = init_args();
$gui = initializeGui($db, $args, $tplan_mgr, $tcase_mgr);
// 3406
$gui->build = init_build_selector($tplan_mgr, $args);
$keywordsFilter = null;
if (is_array($args->keyword_id)) {
    $keywordsFilter = new stdClass();
    $keywordsFilter->items = $args->keyword_id;
    $keywordsFilter->type = $gui->keywordsFilterType->selected;
}
$do_display = 0;
switch ($args->item_level) {
    case 'testsuite':
        $do_display = 1;
        break;
    case 'testproject':
        show_instructions('planAddTC');
        exit;
        break;