コード例 #1
0
 /**
  *
  */
 private function init_filter_assigned_user()
 {
     if (!$this->testproject_mgr) {
         $this->testproject_mgr = new testproject($this->db);
     }
     $key = 'filter_assigned_user';
     $unassigned_key = 'filter_assigned_user_include_unassigned';
     $tplan_id = $this->settings['setting_testplan']['selected'];
     // set selection to default (any), only change if value is sent by user and reset is not requested
     $selection = $this->args->{$key};
     if (!$selection || $this->args->reset_filters) {
         $selection = null;
     } else {
         $this->do_filtering = true;
     }
     $tproject_info = $this->testproject_mgr->get_by_id($this->args->testproject_id);
     $all_testers = getTestersForHtmlOptions($this->db, $tplan_id, $tproject_info, null, array(TL_USER_ANYBODY => $this->option_strings['any'], TL_USER_NOBODY => $this->option_strings['none'], TL_USER_SOMEBODY => $this->option_strings['somebody']), 'any');
     $visible_testers = $all_testers;
     // in execution mode the rights of the user have to be regarded
     if ($this->mode == 'execution_mode') {
         $role = $this->user->getEffectiveRole($this->db, $this->args->testproject_id, $tplan_id);
         $simple_tester_roles = array_flip($this->configuration->exec_cfg->simple_tester_roles);
         // check the user's rights to see what he may do
         $right_to_execute = $role->hasRight('testplan_execute');
         $right_to_manage = $role->hasRight('testplan_planning');
         $simple = false;
         if (isset($simple_tester_roles[$role->dbID]) || $right_to_execute && !$right_to_manage) {
             // user is only simple tester and may not see/execute everything
             $simple = true;
         }
         $view_mode = $simple ? $this->configuration->exec_cfg->view_mode->tester : 'all';
         if ($view_mode != 'all') {
             $visible_testers = (array) $this->user->getDisplayName();
             $selection = (array) $this->user->dbID;
         }
         // re-enable option "user_filter_default"
         if (!$selection && $this->configuration->exec_cfg->user_filter_default == 'logged_user') {
             $selection = (array) $this->user->dbID;
         }
     }
     $this->filters[$key] = array('items' => $visible_testers, 'selected' => $selection, $unassigned_key => $this->args->{$unassigned_key});
     // which value shall be passed to tree generation class?
     if (is_array($selection) && in_array(TL_USER_ANYBODY, $selection) || $selection == TL_USER_ANYBODY) {
         // delete user assignment filter if "any user" is part of the selection
         $this->active_filters[$key] = null;
         $this->active_filters[$unassigned_key] = 0;
     }
     if (is_array($selection)) {
         // get keys of the array as values
         $this->active_filters[$key] = array_flip($selection);
         foreach ($this->active_filters[$key] as $user_key => $user_value) {
             $this->active_filters[$key][$user_key] = $user_key;
         }
         $this->active_filters[$unassigned_key] = $this->filters[$key][$unassigned_key];
     }
 }
コード例 #2
0
function initializeGui(&$dbHandler, $argsObj, &$tplanMgr, &$tcaseMgr)
{
    $platform_mgr = new tlPlatform($dbHandler, $argsObj->tproject_id);
    $tcase_cfg = config_get('testcase_cfg');
    $gui = new stdClass();
    $gui->platforms = $platform_mgr->getLinkedToTestplanAsMap($argsObj->tplan_id);
    $gui->usePlatforms = $platform_mgr->platformsActiveForTestplan($argsObj->tplan_id);
    $gui->bulk_platforms = $platform_mgr->getLinkedToTestplanAsMap($argsObj->tplan_id);
    $gui->bulk_platforms[0] = lang_get("all_platforms");
    ksort($gui->bulk_platforms);
    $gui->send_mail = $argsObj->send_mail;
    $gui->send_mail_checked = "";
    if ($gui->send_mail) {
        $gui->send_mail_checked = ' checked="checked" ';
    }
    $gui->glueChar = $tcase_cfg->glue_character;
    if ($argsObj->level != 'testproject') {
        $gui->testCasePrefix = $tcaseMgr->tproject_mgr->getTestCasePrefix($argsObj->tproject_id);
        $gui->testCasePrefix .= $tcase_cfg->glue_character;
        $gui->keywordsFilterType = $argsObj->keywordsFilterType;
        $gui->build_id = $argsObj->build_id;
        $gui->tplan_id = $argsObj->tplan_id;
        $tplan_info = $tplanMgr->get_by_id($argsObj->tplan_id);
        $gui->testPlanName = $tplan_info['name'];
        $build_info = $tplanMgr->get_build_by_id($argsObj->tplan_id, $argsObj->build_id);
        $gui->buildName = $build_info['name'];
        $gui->main_descr = sprintf(lang_get('title_tc_exec_assignment'), $gui->buildName, $gui->testPlanName);
        $tproject_mgr = new testproject($dbHandler);
        $tproject_info = $tproject_mgr->get_by_id($argsObj->tproject_id);
        $gui->all_users = tlUser::getAll($dbHandler, null, "id", null);
        $gui->users = getUsersForHtmlOptions($dbHandler, null, null, null, $gui->all_users);
        $gui->testers = getTestersForHtmlOptions($dbHandler, $argsObj->tplan_id, $tproject_info, $gui->all_users);
    }
    return $gui;
}
コード例 #3
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->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, $argsObj->tplan_id);
    $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);
    $gui->testers = getTestersForHtmlOptions($dbHandler, $argsObj->tplan_id, $tproject_info);
    $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');
    }
    $gui->build = init_build_selector($tplanMgr, $argsObj);
    return $gui;
}