Пример #1
0
    $testprojectRole = $role->getDisplayName();
} else {
    // general role applied
    $testprojectRole = $args->user->globalRole->getDisplayName();
}
$gui->whoami = $args->user->getDisplayName() . ' ' . $tlCfg->gui->role_separator_open . $testprojectRole . $tlCfg->gui->role_separator_close;
// only when the user has changed project using the combo the _GET has this key.
// Use this clue to launch a refresh of other frames present on the screen
// using the onload HTML body attribute
$gui->updateMainPage = 0;
if ($args->testproject) {
    $gui->updateMainPage = 1;
    // set test project ID for the next session
    setcookie('TL_lastTestProjectForUserID_' . $args->user->dbID, $args->testproject, TL_COOKIE_KEEPTIME, '/');
}
$gui->grants = getGrants($db, $args->user);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display('navBar.tpl');
/**
 * 
 */
function getGrants(&$db, &$userObj)
{
    $grants = new stdClass();
    $grants->view_testcase_spec = $userObj->hasRight($db, "mgt_view_tc");
    return $grants;
}
function init_args()
{
    $iParams = array("testproject" => array(tlInputParameter::INT_N));
Пример #2
0
/**
 * 
 *
 */
function initializeGui(&$dbHandler, &$argsObj, $cfgObj, &$tcaseMgr)
{
    $guiObj = new stdClass();
    $guiObj->editorType = $cfgObj->webEditorCfg['type'];
    $guiObj->grants = getGrants($dbHandler);
    $guiObj->opt_requirements = $argsObj->opt_requirements;
    $guiObj->action_on_duplicated_name = 'generate_new';
    $guiObj->show_mode = $argsObj->show_mode;
    $guiObj->has_been_executed = $argsObj->has_been_executed;
    $guiObj->attachments = null;
    $guiObj->parent_info = null;
    $guiObj->user_feedback = '';
    $guiObj->stay_here = $argsObj->stay_here;
    $guiObj->steps_results_layout = $cfgObj->spec->steps_results_layout;
    $guiObj->btn_reorder_testcases = lang_get('btn_reorder_testcases_externalid');
    $guiObj->import_limit = TL_REPOSITORY_MAXFILESIZE;
    $guiObj->msg = '';
    $guiObj->loadOnCancelURL = $_SESSION['basehref'] . "/lib/testcases/archiveData.php?edit=testcase&id=" . $argsObj->tcase_id . "&show_mode={$argsObj->show_mode}";
    $guiObj->fileUploadURL = $_SESSION['basehref'] . $tcaseMgr->getFileUploadRelativeURL($argsObj);
    if ($argsObj->container_id > 0) {
        $pnode_info = $tcaseMgr->tree_manager->get_node_hierarchy_info($argsObj->container_id);
        $node_descr = array_flip($tcaseMgr->tree_manager->get_available_node_types());
        $guiObj->parent_info['name'] = $pnode_info['name'];
        $guiObj->parent_info['description'] = lang_get($node_descr[$pnode_info['node_type_id']]);
    }
    $guiObj->direct_link = $tcaseMgr->buildDirectWebLink($_SESSION['basehref'], $argsObj->tcase_id, $argsObj->testproject_id);
    $guiObj->domainTCStatus = $argsObj->tcStatusCfg['code_label'];
    $grant2check = array('mgt_modify_tc', 'mgt_view_req', 'testplan_planning', 'mgt_modify_product', 'testproject_edit_executed_testcases', 'testproject_delete_executed_testcases');
    $guiObj->grants = new stdClass();
    foreach ($grant2check as $right) {
        $guiObj->{$right} = $guiObj->grants->{$right} = $argsObj->user->hasRight($dbHandler, $right, $argsObj->tproject_id);
    }
    return $guiObj;
}
$tproject_mgr = new testproject($db);
$user = $_SESSION['currentUser'];
$testprojectID = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0;
$testplanID = isset($_SESSION['testplanID']) ? intval($_SESSION['testplanID']) : 0;
$accessibleItems = $tproject_mgr->get_accessible_for_user($user->dbID, array('output' => 'map_name_with_inactive_mark'));
$tprojectQty = $tproject_mgr->getItemCount();
$userIsBlindFolded = (is_null($accessibleItems) || count($accessibleItems) == 0) && $tprojectQty > 0;
if ($userIsBlindFolded) {
    $testprojectID = $testplanID = 0;
    $_SESSION['testprojectTopMenu'] = '';
}
$tplan2check = null;
$currentUser = $_SESSION['currentUser'];
$userID = $currentUser->dbID;
$gui = new stdClass();
$gui->grants = getGrants($db, $user, $userIsBlindFolded);
$gui->hasTestCases = false;
if ($gui->grants['view_tc']) {
    $gui->hasTestCases = $tproject_mgr->count_testcases($testprojectID) > 0 ? 1 : 0;
}
$gui->hasKeywords = false;
if ($gui->hasTestCases) {
    $gui->hasKeywords = $tproject_mgr->hasKeywords($testprojectID);
}
// ----- Test Plan Section --------------------------------------------------------------
/** 
 * @TODO - franciscom - we must understand if these two calls are really needed,
 * or is enough just call to getAccessibleTestPlans()
 */
$filters = array('plan_status' => ACTIVE);
$gui->num_active_tplans = $tproject_mgr->getActiveTestPlansCount($testprojectID);
Пример #4
0
require_once '../../config.inc.php';
require_once "common.php";
testlinkInitPage($db);
$user = $_SESSION['currentUser'];
$userID = $user->dbID;
list($args, $gui) = initEnvironment($db, $user);
if ($gui->tprojectID && isset($user->tprojectRoles[$gui->tprojectID])) {
    // test project specific role applied
    $role = $user->tprojectRoles[$gui->tprojectID];
    $testprojectRole = $role->getDisplayName();
} else {
    // general role applied
    $testprojectRole = $user->globalRole->getDisplayName();
}
$gui->whoami = $user->getDisplayName() . ' ' . $tlCfg->gui->role_separator_open . $testprojectRole . $tlCfg->gui->role_separator_close;
$gui->grants = getGrants($db, $user, $gui->tprojectID, $gui->tplanID);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display('navBar.tpl');
/**
 */
function getGrants(&$dbHandler, &$userObj, $tproject_id, $tplan_id)
{
    $grants = new stdClass();
    $grants->view_testcase_spec = $userObj->hasRight($dbHandler, "mgt_view_tc", $tproject_id, $tplan_id);
    return $grants;
}
/**
 */
function initEnvironment(&$dbHandler, &$userObj)
{
Пример #5
0
/**
 * 
 *
 */
function initializeGui(&$dbHandler, &$argsObj, $cfgObj, &$tcaseMgr)
{
    $guiObj = new stdClass();
    $guiObj->editorType = $cfgObj->webEditorCfg['type'];
    $guiObj->grants = getGrants($dbHandler);
    $guiObj->opt_requirements = $argsObj->opt_requirements;
    $guiObj->action_on_duplicated_name = 'generate_new';
    $guiObj->show_mode = $argsObj->show_mode;
    $guiObj->has_been_executed = $argsObj->has_been_executed;
    $guiObj->attachments = null;
    $guiObj->parent_info = null;
    $guiObj->user_feedback = '';
    $guiObj->steps_results_layout = config_get('spec_cfg')->steps_results_layout;
    $guiObj->loadOnCancelURL = $_SESSION['basehref'] . "/lib/testcases/archiveData.php?edit=testcase&id=" . $argsObj->tcase_id . "&show_mode={$argsObj->show_mode}";
    if ($argsObj->container_id > 0) {
        $pnode_info = $tcaseMgr->tree_manager->get_node_hierarchy_info($argsObj->container_id);
        $node_descr = array_flip($tcaseMgr->tree_manager->get_available_node_types());
        $guiObj->parent_info['name'] = $pnode_info['name'];
        $guiObj->parent_info['description'] = lang_get($node_descr[$pnode_info['node_type_id']]);
    }
    $guiObj->direct_link = $tcaseMgr->buildDirectWebLink($_SESSION['basehref'], $argsObj->tcase_id, $argsObj->testproject_id);
    return $guiObj;
}
Пример #6
0
    $testprojectRole = $role->getDisplayName();
} else {
    // general role applied
    $testprojectRole = $user->globalRole->getDisplayName();
}
$gui->whoami = $user->getDisplayName() . ' ' . $tlCfg->gui->role_separator_open . $testprojectRole . $tlCfg->gui->role_separator_close;
// only when the user has changed project using the combo the _GET has this key.
// Use this clue to launch a refresh of other frames present on the screen
// using the onload HTML body attribute
$gui->updateMainPage = 0;
if ($args->testproject) {
    $gui->updateMainPage = 1;
    // set test project ID for the next session
    setcookie('TL_lastTestProjectForUserID_' . $userID, $args->testproject, TL_COOKIE_KEEPTIME, '/');
}
$gui->grants = getGrants($db);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display('navBar.tpl');
/**
 * @todo havlatm: project rights should be get from $_SESSION
 */
function getGrants(&$db)
{
    $grants = new stdClass();
    $grants->view_testcase_spec = has_rights($db, "mgt_view_tc");
    return $grants;
}
function init_args()
{
    $iParams = array("testproject" => array(tlInputParameter::INT_N));