Example #1
0
 * @package     TestLink
 * @copyright   2007-2015, TestLink community 
 * @link        http://www.testlink.org
 *
 * @internal revisions
 * @since 1.9.14
 *
 */
require_once '../../config.inc.php';
require_once 'common.php';
require_once "web_editor.php";
$editorCfg = getWebEditorCfg('testproject');
require_once require_web_editor($editorCfg['type']);
testlinkInitPage($db, true, false, "checkRights");
$gui_cfg = config_get('gui');
$templateCfg = templateConfiguration();
$session_tproject_id = intval(isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0);
$template = null;
$ui = new stdClass();
$ui->doActionValue = '';
$ui->buttonValue = '';
$ui->caption = '';
$ui->main_descr = lang_get('title_testproject_management');
$user_feedback = '';
$reloadType = 'none';
// domain 'none','reloadNavBar'
$tproject_mgr = new testproject($db);
$args = init_args($tproject_mgr, $_REQUEST, $session_tproject_id);
$gui = initializeGui($db, $args);
$of = web_editor('notes', $_SESSION['basehref'], $editorCfg);
$status_ok = 1;
Example #2
0
 /**
  * Show Test Case
  * 
  * 
  * @internal
  *
  * returns:
  * 
  *  rev :
  * 
  */
 function show(&$smarty, $guiObj, $identity, $grants)
 {
     $env_tproject_id = $identity->tproject_id;
     $id = $identity->id;
     $version_id = isset($identity->version_id) ? $identity->version_id : self::ALL_VERSIONS;
     $idSet = is_array($id) ? $id : (array) $id;
     $status_ok = $idSet[0] > 0 ? 1 : 0;
     $idCard = new stdClass();
     $idCard->tcase_id = intval($idSet[0]);
     $idCard->tcversion_id = $version_id;
     $idCard->tproject_id = $identity->tproject_id;
     $gui = $this->initShowGui($guiObj, $grants, $idSet[0], $idCard);
     $userIDSet = array();
     if ($status_ok) {
         // Add To Testplan button will be disabled if the testcase doesn't belong to the current selected testproject
         // $gui->can_do->add2tplan = 'no';
         if ($env_tproject_id == $gui->tproject_id) {
             $gui->can_do->add2tplan = $gui->can_do->add2tplan == 'yes' ? $grants->testplan_planning : 'no';
         } else {
             $gui->can_do->add2tplan = 'no';
         }
     }
     if ($status_ok && sizeof($idSet)) {
         $cfx = 0;
         $cfPlaces = $this->buildCFLocationMap();
         $req_mgr = new requirement_mgr($this->db);
         $allReqs = $req_mgr->get_all_for_tcase($idSet);
         $allTCKeywords = $this->getKeywords($idSet, null, 'testcase_id', ' ORDER BY keyword ASC ');
         $ovx = 0;
         foreach ($idSet as $key => $tc_id) {
             // using $version_id has sense only when we are working on ONE SPECIFIC Test Case
             // if we are working on a set of test cases $version_id will be ALL VERSIONS
             if (!($tc_array = $this->get_by_id($tc_id, $version_id, null, array('renderGhost' => true, 'withGhostString' => true)))) {
                 continue;
             }
             $tc_array[0]['tc_external_id'] = $gui->tcasePrefix . $tc_array[0]['tc_external_id'];
             $tc_array[0]['ghost'] = '[ghost]"TestCase":"' . $tc_array[0]['tc_external_id'] . '","Version":"' . $tc_array[0]['version'] . '"[/ghost]';
             // status quo of execution and links of tc versions
             $gui->status_quo[] = $this->get_versions_status_quo($tc_id);
             $gui->linked_versions[] = $this->get_linked_versions($tc_id);
             $gui->keywords_map[] = isset($allTCKeywords[$tc_id]) ? $allTCKeywords[$tc_id] : null;
             $tc_current = $tc_array[0];
             $gui->tc_current_version[] = array($tc_current);
             // Get UserID and Updater ID for current Version
             $userIDSet[$tc_current['author_id']] = null;
             $userIDSet[$tc_current['updater_id']] = null;
             foreach ($cfPlaces as $locationKey => $locationFilter) {
                 $gui->cf_current_version[$cfx][$locationKey] = $this->html_table_of_custom_field_values($tc_id, 'design', $locationFilter, null, null, $gui->tproject_id, null, $tc_current['id']);
             }
             // Other versions (if exists)
             if (count($tc_array) > 1) {
                 $gui->testcase_other_versions[] = array_slice($tc_array, 1);
                 $target_idx = count($gui->testcase_other_versions) - 1;
                 $loop2do = count($gui->testcase_other_versions[$target_idx]);
                 $ref =& $gui->testcase_other_versions[$target_idx];
                 for ($qdx = 0; $qdx < $loop2do; $qdx++) {
                     $ref[$qdx]['ghost'] = '[ghost]"TestCase":"' . $tc_array[0]['tc_external_id'] . '","Version":"' . $ref[$qdx]['version'] . '"[/ghost]';
                     $target_tcversion = $gui->testcase_other_versions[$target_idx][$qdx]['id'];
                     foreach ($cfPlaces as $locationKey => $locationFilter) {
                         $gui->cf_other_versions[$cfx][$qdx][$locationKey] = $this->html_table_of_custom_field_values($tc_id, 'design', $locationFilter, null, null, $gui->tproject_id, null, $target_tcversion);
                     }
                 }
             } else {
                 $gui->testcase_other_versions[] = null;
                 $gui->cf_other_versions[$cfx] = null;
             }
             $cfx++;
             // Get author and updater id for each version
             if ($gui->testcase_other_versions[0]) {
                 foreach ($gui->testcase_other_versions[0] as $key => $version) {
                     $userIDSet[$version['author_id']] = null;
                     $userIDSet[$version['updater_id']] = null;
                 }
             }
             $gui->arrReqs[] = isset($allReqs[$tc_id]) ? $allReqs[$tc_id] : null;
         }
     }
     // Removing duplicate and NULL id's
     unset($userIDSet['']);
     $gui->users = tlUser::getByIDs($this->db, array_keys($userIDSet), 'id');
     $gui->cf = null;
     $this->initShowGuiActions($gui);
     $tplCfg = templateConfiguration('tcView');
     $smarty->assign('gui', $gui);
     $smarty->display($tplCfg->template_dir . $tplCfg->default_template);
 }
Example #3
0
/**
 * renderLoginScreen
 * simple piece of code used to clean up code layout
 * 
 * @global  $g_tlLogger
 * @param stdClassObject $guiObj
 */
function renderLoginScreen($guiObj)
{
    global $g_tlLogger;
    $templateCfg = templateConfiguration();
    $logPeriodToDelete = config_get('removeEventsOlderThan');
    $g_tlLogger->deleteEventsFor(null, strtotime("-{$logPeriodToDelete} days UTC"));
    $smarty = new TLSmarty();
    $smarty->assign('gui', $guiObj);
    $smarty->display($templateCfg->default_template);
}
Example #4
0
            $of->Value = getItemTemplateContents('testcase_template', $of->InstanceName, '');
        } else {
            $of->Value = $args->{$key};
        }
        $smarty->assign($key, $of->CreateHTML($rows, $cols));
    }
    // foreach ($a_oWebEditor_cfg as $key)
    $filters = $tcase_mgr->buildCFLocationMap();
    foreach ($filters as $locationKey => $locationFilter) {
        $cf_smarty[$locationKey] = $tcase_mgr->html_table_of_custom_field_inputs($args->tcase_id, $args->container_id, 'design', '', null, null, null, $locationFilter);
    }
    $gui->cf = $cf_smarty;
    $gui->tc = $tc_default;
    $gui->containerID = $args->container_id;
    $smarty->assign('gui', $gui);
    $templateCfg = templateConfiguration('tcNew');
    $smarty->display($templateCfg->template_dir . $templateCfg->default_template);
}
/*
  function:

  args:

  returns:
  
  @internal revisions
*/
function init_args(&$dbHandler, &$cfgObj, &$tprojectMgr)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
Example #5
0
     $gui->move_enabled = 1;
     if ($container_qty == 1) {
         // move operation is nonsense
         $gui->move_enabled = 0;
     }
     $gui->top_checked = 'checked=checked';
     $gui->bottom_checked = '';
     $gui->array_container = $the_xx;
     $gui->old_container = $the_tc_node['parent_id'];
     // original container
     $gui->testsuite_id = $the_tc_node['parent_id'];
     $gui->testcase_id = $args->tcase_id;
     $gui->name = $tc_info[0]['name'];
     $gui->testcase_name = $tcase_mgr->generateTimeStampName($gui->name);
     $smarty->assign('gui', $gui);
     $templateCfg = templateConfiguration('tcMove');
     $smarty->display($templateCfg->template_dir . $templateCfg->default_template);
 } else {
     if ($args->do_move) {
         $result = $tree_mgr->change_parent($args->tcase_id, $args->new_container_id);
         $tree_mgr->change_child_order($args->new_container_id, $args->tcase_id, $args->target_position, $cfg->exclude_node_types);
         $gui->refreshTree = $args->refreshTree;
         $tsuite_mgr->show($smarty, $gui, $templateCfg->template_dir, $args->old_container_id);
     } else {
         if ($args->do_copy || $args->do_copy_ghost_zone) {
             $args->stepAsGhost = $args->do_copy_ghost_zone;
             $user_feedback = '';
             $msg = '';
             $action_result = 'copied';
             $options = array('check_duplicate_name' => config_get('check_names_for_duplicates'), 'action_on_duplicate_name' => config_get('action_on_duplicate_name'), 'copy_also' => $args->copy, 'stepAsGhost' => $args->do_copy_ghost_zone, 'use_this_name' => $args->name);
             $result = $tcase_mgr->copy_to($args->tcase_id, $args->new_container_id, $args->user_id, $options);
 /**
  * doInsertStep
  *
  */
 function doInsertStep(&$argsObj, $request)
 {
     $guiObj = $this->initGuiBean($argsObj);
     $guiObj->user_feedback = '';
     $guiObj->step_exec_type = $argsObj->exec_type;
     $guiObj->tcversion_id = $argsObj->tcversion_id;
     $this->initTestCaseBasicInfo($argsObj, $guiObj);
     // Get all existent steps - info needed to do renumbering
     $stepNumberSet = array();
     $existentSteps = $this->tcaseMgr->get_steps($argsObj->tcversion_id);
     $stepsQty = count($existentSteps);
     for ($idx = 0; $idx < $stepsQty; $idx++) {
         $stepNumberSet[$idx] = $existentSteps[$idx]['step_number'];
         $stepIDSet[$idx] = $existentSteps[$idx]['id'];
     }
     $stepInfo = $this->tcaseMgr->get_step_by_id($argsObj->step_id);
     $newStepNumber = $stepInfo['step_number'] + 1;
     $op = $this->tcaseMgr->create_step($argsObj->tcversion_id, $newStepNumber, '', '');
     $guiObj->main_descr = sprintf(lang_get('edit_step_number_x'), $newStepNumber, $guiObj->testcase['tc_external_id'] . ':' . $guiObj->testcase['name'], $guiObj->testcase['version']);
     if ($op['status_ok']) {
         $guiObj->user_feedback = sprintf(lang_get('step_number_x_created'), $newStepNumber);
         $guiObj->step_exec_type = TESTCASE_EXECUTION_TYPE_MANUAL;
         $guiObj->cleanUpWebEditor = true;
         // renumber steps only if new step hits an existent step number
         $hitPos = array_search($newStepNumber, $stepNumberSet);
         if ($hitPos !== FALSE) {
             // Process starts from this position
             $just_renumbered = array('pos' => $hitPos, 'value' => $newStepNumber + 1);
             $renumbered[$stepIDSet[$hitPos]] = $just_renumbered['value'];
             // now check if new renumbered collides with next
             // if not nothing needs to be done
             // if yes need to loop
             $startFrom = $hitPos + 1;
             $endOn = count($stepNumberSet);
             for ($jdx = $startFrom; $jdx < $endOn; $jdx++) {
                 if ($stepNumberSet[$jdx] == $just_renumbered['value']) {
                     $just_renumbered['value']++;
                     $renumbered[$stepIDSet[$jdx]] = $just_renumbered['value'];
                 }
             }
             $this->tcaseMgr->set_step_number($renumbered);
         }
         $this->tcaseMgr->update_last_modified($argsObj->tcversion_id, $argsObj->user_id);
         $this->initTestCaseBasicInfo($argsObj, $guiObj);
     }
     // Get all existent steps - updated
     $guiObj->tcaseSteps = $this->tcaseMgr->get_steps($argsObj->tcversion_id);
     $guiObj->action = __FUNCTION__;
     $guiObj->step_number = $newStepNumber;
     $guiObj->step_id = $op['id'];
     $guiObj->step_set = $this->tcaseMgr->get_step_numbers($argsObj->tcversion_id);
     $guiObj->step_set = is_null($guiObj->step_set) ? '' : implode(",", array_keys($guiObj->step_set));
     $guiObj->loadOnCancelURL = sprintf($guiObj->loadOnCancelURL, $argsObj->tcase_id, $argsObj->tcversion_id);
     $templateCfg = templateConfiguration('tcStepEdit');
     $guiObj->template = $templateCfg->default_template;
     return $guiObj;
 }
Example #7
0
testlinkInitPage($db);
$tree_mgr = new tree($db);
$tproject_mgr = new testproject($db);
$tsuite_mgr = new testsuite($db);
$tcase_mgr = new testcase($db);
$assign_gui = true;
$refreshTree = false;
list($args, $gui) = initializeEnv($db, $tree_mgr);
$keywordSet = array('testproject' => $tproject_mgr->get_keywords_map($args->tproject_id), 'testsuite' => null);
if ($args->action == 'edit_testsuite') {
    $keywordSet['testsuite'] = $tsuite_mgr->get_keywords_map($args->testsuiteID, " ORDER BY keyword ASC ");
}
$gui_cfg = config_get('gui');
$tpl = null;
$smarty = new TLSmarty();
$smarty->tlTemplateCfg = templateConfiguration();
$smarty->assign('editorType', $editorCfg['type']);
switch ($args->action) {
    case 'edit_testsuite':
    case 'new_testsuite':
        renderTestSuiteForManagement($smarty, $args, $gui, $tsuite_mgr, $keywordSet);
        exit;
        break;
    case 'add_testsuite':
        $messages = null;
        $op['status'] = 0;
        if ($args->nameIsOK) {
            $op = addTestSuite($tsuite_mgr, $args, $_REQUEST);
            $messages = array('result_msg' => $op['messages']['msg'], 'user_feedback' => $op['messages']['user_feedback']);
        }
        // $userInput is used to maintain data filled by user if there is
Example #8
0
/**
 *
 *
 */
function processTestCase(&$dbHandler, $tplEngine, $args, &$gui, $grants, $cfg)
{
    $get_path_info = false;
    $item_mgr = new testcase($dbHandler);
    // has sense only when we work on test case
    $dummy = testcase::getLayout();
    $gui->tableColspan = $dummy->tableToDisplayTestCaseSteps->colspan;
    $gui->viewerArgs['refresh_tree'] = 'no';
    $gui->path_info = null;
    $gui->platforms = null;
    $gui->loadOnCancelURL = '';
    $gui->attachments = null;
    $gui->direct_link = null;
    $gui->steps_results_layout = $cfg['spec']->steps_results_layout;
    $gui->bodyOnUnload = "storeWindowSize('TCEditPopup')";
    if ($args->caller == 'navBar' && !is_null($args->targetTestCase) && strcmp($args->targetTestCase, $args->tcasePrefix) != 0) {
        $args->id = $item_mgr->getInternalID($args->targetTestCase);
        $args->tcversion_id = testcase::ALL_VERSIONS;
        // I've added $args->caller, in order to make clear the logic, because some actions need to be done ONLY
        // when we have arrived to this script because user has requested a search from navBar.
        // Before we have trusted the existence of certain variables (do not think this old kind of approach is good).
        //
        // why strcmp($args->targetTestCase,$args->tcasePrefix) ?
        // because in navBar targetTestCase is initialized with testcase prefix to provide some help to user
        // then if user request search without adding nothing, we will not be able to search.
        // From navBar we want to allow ONLY to search for ONE and ONLY ONE test case ID.
        $gui->viewerArgs['show_title'] = 'no';
        $gui->viewerArgs['display_testproject'] = 1;
        $gui->viewerArgs['display_parent_testsuite'] = 1;
        if (!($get_path_info = $args->id > 0)) {
            $gui->warning_msg = $args->id == 0 ? lang_get('testcase_does_not_exists') : lang_get('prefix_does_not_exists');
        }
    }
    // because we can arrive here from a User Search Request, if args->id == 0 => nothing found
    if ($args->id > 0) {
        if ($get_path_info || $args->show_path) {
            $gui->path_info = $item_mgr->tree_manager->get_full_path_verbose($args->id);
        }
        $platform_mgr = new tlPlatform($dbHandler, $args->tproject_id);
        $gui->platforms = $platform_mgr->getAllAsMap();
        $gui->attachments[$args->id] = getAttachmentInfosFrom($item_mgr, $args->id);
        $gui->direct_link = $item_mgr->buildDirectWebLink($_SESSION['basehref'], $args->id);
        $gui->id = $args->id;
        $identity = new stdClass();
        $identity->id = $args->id;
        $identity->tproject_id = $args->tproject_id;
        $identity->version_id = $args->tcversion_id;
        try {
            $item_mgr->show($tplEngine, $gui, $identity, $grants);
        } catch (Exception $e) {
            echo $e->getMessage();
        }
        exit;
    } else {
        $templateCfg = templateConfiguration();
        // need to initialize search fields
        $xbm = $item_mgr->getTcSearchSkeleton();
        $xbm->warning_msg = lang_get('no_records_found');
        $xbm->pageTitle = lang_get('caption_search_form');
        $xbm->tableSet = null;
        $xbm->doSearch = false;
        $xbm->tproject_id = $args->tproject_id;
        $tplEngine->assign('gui', $xbm);
        $tplEngine->display($templateCfg->template_dir . 'tcSearchResults.tpl');
    }
}
 function edit(&$argsObj, $request)
 {
     $guiObj = $this->initGuiBean($argsObj, __FUNCTION__);
     $templateCfg = templateConfiguration('reqMgrSystemEdit');
     $guiObj->template = $templateCfg->default_template;
     $guiObj->item = $this->mgr->getByID($argsObj->id);
     $guiObj->canManage = $argsObj->currentUser->hasRight($this->db, 'reqmgrsystem_management');
     return $guiObj;
 }
 /**
  * doCopyStep
  *
  */
 function doCopyStep(&$argsObj, $request)
 {
     $guiObj = $this->initGuiBean($argsObj);
     $guiObj->user_feedback = '';
     $guiObj->step_exec_type = $argsObj->exec_type;
     $guiObj->tcversion_id = $argsObj->tcversion_id;
     // need to document difference bewteen these two similar concepts
     $guiObj->action = __FUNCTION__;
     $guiObj->operation = 'doUpdateStep';
     $tcaseInfo = $this->tcaseMgr->get_basic_info($argsObj->tcase_id, $argsObj->tcversion_id);
     $external = $this->tcaseMgr->getExternalID($tcaseInfo[0]['id'], $argsObj->testproject_id);
     $guiObj->main_descr = sprintf(lang_get('edit_step_number_x'), $argsObj->step_number, $external[0] . ':' . $tcaseInfo[0]['name'], $tcaseInfo[0]['version']);
     $new_step = $this->tcaseMgr->get_latest_step_number($argsObj->tcversion_id);
     $new_step++;
     $source_info = $this->tcaseMgr->get_steps($argsObj->tcversion_id, $argsObj->step_number);
     $source_info = current($source_info);
     $op = $this->tcaseMgr->create_step($argsObj->tcversion_id, $new_step, $source_info['actions'], $source_info['expected_results'], $source_info['execution_type']);
     if ($op['status_ok']) {
         $guiObj->user_feedback = sprintf(lang_get('step_number_x_created_as_copy'), $new_step, $argsObj->step_number);
         $guiObj->step_exec_type = TESTCASE_EXECUTION_TYPE_MANUAL;
     }
     // Get all existent steps
     $guiObj->tcaseSteps = $this->tcaseMgr->get_steps($argsObj->tcversion_id);
     // After copy I would like to return to target step in edit mode,
     // is enough to set $guiObj->step_number to target test step
     $guiObj->step_number = $argsObj->step_number;
     $guiObj->step_set = $this->tcaseMgr->get_step_numbers($argsObj->tcversion_id);
     $guiObj->step_set = is_null($guiObj->step_set) ? '' : implode(",", array_keys($guiObj->step_set));
     $guiObj->loadOnCancelURL = sprintf($guiObj->loadOnCancelURL, $tcaseInfo[0]['id'], $argsObj->tcversion_id);
     $templateCfg = templateConfiguration('tcStepEdit');
     $guiObj->template = $templateCfg->default_template;
     return $guiObj;
 }
Example #11
0
<?php 
require_once "../../config.inc.php";
require_once "common.php";
list($args, $gui) = initEnv($db);
$templateCfg = templateConfiguration($args->job_id);
$smarty = new TLSmarty();
$default_template = $templateCfg->default_template;
$op = new stdClass();
$platform_mgr = new tlPlatform($db, $args->testproject_id);
$gui->jobdetails = $platform_mgr->getSpecialJob($_GET['id']);
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
function initEnv(&$dbHandler)
{
    testlinkInitPage($dbHandler);
    $argsObj = init_args();
    $guiObj = init_gui($dbHandler, $argsObj);
    return array($argsObj, $guiObj);
}
function init_args()
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $source = sizeof($_POST) ? "POST" : "GET";
    $iParams = array("doAction" => array($source, tlInputParameter::STRING_N, 0, 50));
    $pParams = I_PARAMS($iParams);
    $args->testproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
    $args->testproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : 0;
    $args->currentUser = $_SESSION['currentUser'];
    return $args;
}
Example #12
0
 /**
  * Show Test Case logic
  * 
  * @param object $smarty reference to smarty object (controls viewer).
  * @param integer $id Test case unique identifier
  * @param integer $version_id (optional) you can work on ONE test case version, 
  * 				or on ALL; default: ALL
  * 
  * @internal
 
         [viewer_args]: map with keys
                        action
                        msg_result
                        refresh_tree: controls if tree view is refreshed after every operation.
                                      default: yes
                        user_feedback
                        disable_edit: used to overwrite user rights
                                         default: 0 -> no
 
   returns:
 
   rev :
 */
 function show(&$smarty, $guiObj, $identity, $grants)
 {
     $env_tproject_id = $identity->tproject_id;
     $id = $identity->id;
     $version_id = isset($identity->version_id) ? $identity->version_id : self::ALL_VERSIONS;
     $idSet = is_array($id) ? $id : (array) $id;
     $status_ok = $idSet[0] > 0 ? 1 : 0;
     $gui = $this->initShowGui($guiObj, $grants);
     $gui->grants = $grants;
     $gui->testcase_other_versions = array();
     if ($status_ok) {
         $req_mgr = new requirement_mgr($this->db);
         $path2root = $this->tree_manager->get_path($idSet[0]);
         $gui->tproject_id = $path2root[0]['parent_id'];
         $info = $this->tproject_mgr->get_by_id($gui->tproject_id);
         $gui->opt_requirements = $info['opt']->requirementsEnabled;
         $gui->requirementsEnabled = $info['opt']->requirementsEnabled;
         $platformMgr = new tlPlatform($this->db, $gui->tproject_id);
         $gui->platforms = $platformMgr->getAllAsMap();
         $testplans = $this->tproject_mgr->get_all_testplans($gui->tproject_id, array('plan_status' => 1));
         $gui->has_testplans = !is_null($testplans) && count($testplans) > 0 ? 1 : 0;
         if ($gui->display_testproject) {
             $gui->tprojectName = $info['name'];
         }
         if ($gui->display_parent_testsuite) {
             $parent_idx = count($path2root) - 2;
             $gui->parentTestSuiteName = $path2root[$parent_idx]['name'];
         }
         $tcasePrefix = $this->tproject_mgr->getTestCasePrefix($gui->tproject_id);
         if (trim($tcasePrefix) != "") {
             // 'Add To Testplan' button will be disabled if the testcase doesn't belong
             // to the current selected testproject
             // $gui->can_do->add2tplan = 'no';
             if ($env_tproject_id != $gui->tproject_id) {
                 $gui->can_do->add2tplan = $gui->can_do->add2tplan == 'yes' ? $grants->testplan_planning : 'no';
             } else {
                 $gui->can_do->add2tplan = 'yes';
             }
             $tcasePrefix .= $gui->tcase_cfg->glue_character;
         }
     }
     $userid_array = array();
     if ($status_ok && sizeof($idSet)) {
         $cfx = 0;
         $allTCKeywords = $this->getKeywords($idSet, null, 'testcase_id', ' ORDER BY keyword ASC ');
         $allReqs = $req_mgr->get_all_for_tcase($idSet);
         $tcStatus2exclude = config_get('tplanDesign')->hideTestCaseWithStatusIn;
         foreach ($idSet as $key => $tc_id) {
             $tc_array = $this->get_by_id($tc_id, $version_id);
             if (!$tc_array) {
                 continue;
             }
             $gui->attach[$tc_id] = new stdClass();
             $gui->attach[$tc_id]->itemID = $tc_id;
             $gui->attach[$tc_id]->dbTable = $this->attachmentTableName;
             $gui->attach[$tc_id]->infoSet = null;
             $gui->attach[$tc_id]->gui = null;
             list($gui->attach[$tc_id]->infoSet, $gui->attach[$tc_id]->gui) = $this->buildAttachSetup($tc_id);
             $gui->attach[$tc_id]->gui->display = TRUE;
             $gui->attach[$tc_id]->enabled = $gui->attach[$tc_id]->gui->enabled;
             $tc_array[0]['tc_external_id'] = $tcasePrefix . $tc_array[0]['tc_external_id'];
             // get the status quo of execution and links of tc versions
             // $gui->status_quo_map[] = $this->get_versions_status_quo($tc_id);
             $gui->status_quo[] = $this->get_versions_status_quo($tc_id);
             $gui->linked_versions[] = $this->get_linked_versions($tc_id);
             $gui->keywords_map[] = isset($allTCKeywords[$tc_id]) ? $allTCKeywords[$tc_id] : null;
             $tc_current = $tc_array[0];
             // add new attribute
             // enabledOnTestPlanDesign
             $tc_current['enabledOnTestPlanDesign'] = !isset($tcStatus2exclude[$tc_current['status']]);
             $tcversion_id_current = $tc_current['id'];
             $gui->tc_current_version[] = array($tc_current);
             //Get UserID and Updater ID for current Version
             $userid_array[$tc_current['author_id']] = null;
             $userid_array[$tc_current['updater_id']] = null;
             $cfPlaces = $this->buildCFLocationMap();
             foreach ($cfPlaces as $locationKey => $locationFilter) {
                 $gui->cf_current_version[$cfx][$locationKey] = $this->html_table_of_custom_field_values($tc_id, 'design', $locationFilter, null, null, $gui->tproject_id, null, $tcversion_id_current);
             }
             // Other versions (if exists)
             if (count($tc_array) > 1) {
                 $gui->testcase_other_versions[] = array_slice($tc_array, 1);
                 $target_idx = count($gui->testcase_other_versions) - 1;
                 $loop2do = count($gui->testcase_other_versions[$target_idx]);
                 for ($qdx = 0; $qdx < $loop2do; $qdx++) {
                     $tcRef =& $gui->testcase_other_versions[$target_idx][$qdx];
                     $tcRef['enabledOnTestPlanDesign'] = !isset($tcStatus2exclude[$tcRef['status']]);
                     $target_tcversion = $tcRef['id'];
                     foreach ($cfPlaces as $locationKey => $locationFilter) {
                         $gui->cf_other_versions[$cfx][$qdx][$locationKey] = $this->html_table_of_custom_field_values($tc_id, 'design', $locationFilter, null, null, $gui->tproject_id, null, $target_tcversion);
                     }
                 }
             } else {
                 $gui->testcase_other_versions[] = null;
                 $gui->cf_other_versions[$cfx] = null;
             }
             $cfx++;
             // Get author and updater id for each version
             // @TODO - franciscom - explain magic ZERO
             if ($gui->testcase_other_versions[0]) {
                 foreach ($gui->testcase_other_versions[0] as $key => $version) {
                     $userid_array[$version['author_id']] = null;
                     $userid_array[$version['updater_id']] = null;
                 }
             }
             $tcReqs = isset($allReqs[$tc_id]) ? $allReqs[$tc_id] : null;
             $gui->arrReqs[] = $tcReqs;
         }
         // foreach($a_id as $key => $tc_id)
     }
     // if (sizeof($a_id))
     // Removing duplicate and NULL id's
     unset($userid_array['']);
     $this->initShowGuiActions(&$gui);
     $gui->users = tlUser::getByIDs($this->db, array_keys($userid_array), 'id');
     $smarty->assign('gui', $gui);
     $dummy = templateConfiguration('tcView');
     $smarty->display($dummy->template_dir . $dummy->default_template);
 }
Example #13
0
 *
 */
require_once '../../config.inc.php';
require_once 'common.php';
require_once "web_editor.php";
require_once "form_api.php";
$editorCfg = getWebEditorCfg('testproject');
require_once require_web_editor($editorCfg['type']);
testlinkInitPage($db);
$templateCfg = templateConfiguration();
list($tprojectMgr, $args, $gui, $ui) = initializeEnv($db);
$gui->editorType = $editorCfg['type'];
checkRights($db, $_SESSION['currentUser'], $args);
// is failed script execution will be aborted
$cmdMgr = new projectCommands($db, $_SESSION['currentUser']);
$cmdMgr->setTemplateCfg(templateConfiguration());
$of = web_editor('notes', $_SESSION['basehref'], $editorCfg);
$status_ok = 1;
$template = null;
$doRender = false;
switch ($pfn = $args->doAction) {
    case 'create':
        $op = $cmdMgr->{$pfn}($args, $gui);
        $doRender = true;
        break;
    case 'edit':
        $template = $templateCfg->default_template;
        $ui = edit($args, $gui, $tprojectMgr);
        break;
    case 'doCreate':
        $op = doCreate($args, $tprojectMgr);