Example #1
0
/**
 * init_args
 *
 */
function init_args(&$dbHandler)
{
    // take care of proper escaping when magic_quotes_gpc is enabled
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $iParams = array("requirement_id" => array(tlInputParameter::INT_N), "req_spec_id" => array(tlInputParameter::INT_N), "containerID" => array(tlInputParameter::INT_N), "reqDocId" => array(tlInputParameter::STRING_N, 0, 64), "req_title" => array(tlInputParameter::STRING_N, 0, 100), "scope" => array(tlInputParameter::STRING_N), "reqStatus" => array(tlInputParameter::STRING_N, 0, 1), "reqType" => array(tlInputParameter::STRING_N, 0, 1), "countReq" => array(tlInputParameter::INT_N), "expected_coverage" => array(tlInputParameter::INT_N), "doAction" => array(tlInputParameter::STRING_N, 0, 20), "req_id_cbox" => array(tlInputParameter::ARRAY_INT), "itemSet" => array(tlInputParameter::ARRAY_INT), "testcase_count" => array(tlInputParameter::ARRAY_INT), "req_version_id" => array(tlInputParameter::INT_N), "copy_testcase_assignment" => array(tlInputParameter::CB_BOOL), "relation_id" => array(tlInputParameter::INT_N), "relation_source_req_id" => array(tlInputParameter::INT_N), "relation_type" => array(tlInputParameter::STRING_N), "relation_destination_req_doc_id" => array(tlInputParameter::STRING_N, 0, 64), "relation_destination_testproject_id" => array(tlInputParameter::INT_N), "save_rev" => array(tlInputParameter::INT_N), "do_save" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N), "log_message" => array(tlInputParameter::STRING_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    $args->req_id = $args->requirement_id;
    $args->title = $args->req_title;
    $args->arrReqIds = $args->req_id_cbox;
    $args->basehref = $_SESSION['basehref'];
    $args->tproject_name = '';
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    $args->user_id = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0;
    $args->user = $_SESSION['currentUser'];
    // to avoid database errors with null value
    if (!is_numeric($args->expected_coverage)) {
        $args->expected_coverage = 0;
    }
    $uk = 'setting_refresh_tree_on_action';
    $args->refreshTree = testproject::getUserChoice($args->tproject_id, array('reqTreeRefreshOnAction'));
    $args->stay_here = isset($_REQUEST['stay_here']) ? 1 : 0;
    return $args;
}
/**
 * create object with all user inputs
 *
 */
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $key2search = array('doAction', 'cfield', 'display_order', 'location', 'hidden_active_cfield', 'active_cfield', 'hidden_required_cfield', 'required_cfield');
    foreach ($key2search as $key) {
        $args->{$key} = isset($_REQUEST[$key]) ? $_REQUEST[$key] : null;
    }
    // Need comments
    if (!$args->cfield) {
        $args->cfield = array();
    }
    $args->tproject_name = '';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($args->tproject_id == 0) {
        $args->tproject_id = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0;
    }
    if ($args->tproject_id > 0) {
        $mgr = new tree($dbHandler);
        $dummy = $mgr->get_node_hierarchy_info($args->tproject_id, null, array('nodeType' => 'testproject'));
        if (is_null($dummy)) {
            throw new Exception("Unable to get Test Project ID");
        }
        $args->tproject_name = $dummy['name'];
    }
    return $args;
}
Example #3
0
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $args->show_help = isset($_REQUEST['level']) && $_REQUEST['level'] == 'testproject';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    $args->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0;
    $args->tplan_name = '';
    if ($args->tplan_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tplan_id);
        $args->tplan_name = $dummy['name'];
    }
    $args->node_type = isset($_REQUEST['level']) ? $_REQUEST['level'] : OFF;
    $args->node_id = isset($_REQUEST['id']) ? $_REQUEST['id'] : ERROR;
    // Sets urgency for suite
    if (isset($_REQUEST['high_urgency'])) {
        $args->urgency = HIGH;
    } elseif (isset($_REQUEST['medium_urgency'])) {
        $args->urgency = MEDIUM;
    } elseif (isset($_REQUEST['low_urgency'])) {
        $args->urgency = LOW;
    } else {
        $args->urgency = OFF;
    }
    // Sets urgency for every single tc
    if (isset($_REQUEST['urgency'])) {
        $args->urgency_tc = $_REQUEST['urgency'];
    }
    return $args;
}
function init_args(&$dbHandler)
{
    $args = new stdClass();
    $args->tproject_name = '';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    $args->basehref = $_SESSION['basehref'];
    return $args;
}
function init_args(&$dbHandler)
{
    $argsObj = new stdClass();
    $argsObj->tproject_name = '';
    $argsObj->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($argsObj->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($argsObj->tproject_id);
        $argsObj->tproject_name = $dummy['name'];
    }
    // new dbug($argsObj, array('calledFrom' => ' file: ' . basename(__FILE__) . ' -  function: ' . __FUNCTION__));
    return $argsObj;
}
Example #6
0
/**
 * create object with all user inputs
 *
 * @internal revisions
 * 20110417 - franciscom - BUGID 4429: Code refactoring to remove global coupling as much as possible
 */
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    $args->tproject_name = '';
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    return $args;
}
function init_args(&$dbHandler, $dateFormat)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    // BUGID 3716
    $args->target_date_original = isset($_REQUEST['target_date']) ? $_REQUEST['target_date'] : null;
    $args->start_date_original = isset($_REQUEST['start_date']) ? $_REQUEST['start_date'] : null;
    // convert target date to iso format to write to db
    if (isset($_REQUEST['target_date']) && $_REQUEST['target_date'] != '') {
        $date_array = split_localized_date($_REQUEST['target_date'], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $args->target_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    // convert start date to iso format to write to db
    if (isset($_REQUEST['start_date']) && $_REQUEST['start_date'] != '') {
        $date_array = split_localized_date($_REQUEST['start_date'], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $args->start_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    $key2loop = array('low_priority_tcases', 'medium_priority_tcases', 'high_priority_tcases');
    foreach ($key2loop as $key) {
        $args->{$key} = isset($_REQUEST[$key]) ? intval($_REQUEST[$key]) : 0;
    }
    $args->id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
    $args->name = isset($_REQUEST['milestone_name']) ? $_REQUEST['milestone_name'] : null;
    $args->doAction = isset($_REQUEST['doAction']) ? $_REQUEST['doAction'] : null;
    $args->basehref = $_SESSION['basehref'];
    $treeMgr = new tree($dbHandler);
    $tprojectMgr = new testproject($dbHandler);
    $args->tproject_options = new stdClass();
    $args->tproject_options->testPriorityEnabled = 0;
    $args->tproject_name = '';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($args->tproject_id > 0) {
        $info = $tprojectMgr->get_by_id($args->tproject_id);
        $args->tproject_name = $info['name'];
        $args->tproject_options = $info['opt'];
    }
    $args->tplan_name = '';
    $args->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0;
    if ($args->tplan_id > 0) {
        $info = $treeMgr->get_node_hierarchy_info($args->tplan_id);
        $args->tplan_name = $info['name'];
    }
    return $args;
}
Example #8
0
function init_args(&$dbHandler, $cfgObj)
{
    $args = new stdClass();
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $tplan_mgr = new testplan($dbHandler);
    // Settings we put on session to create some sort of persistent scope,
    // because we have had issues when passing this info using GET mode (size limits)
    //
    // we get info about build_id, platform_id, etc ...
    getContextFromGlobalScope($args);
    $args->user = $_SESSION['currentUser'];
    $args->user_id = $args->user->dbID;
    $args->caller = isset($_REQUEST['caller']) ? $_REQUEST['caller'] : 'exec_feature';
    $args->reload_caller = false;
    $args->tplan_id = intval(isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : $_SESSION['testplanID']);
    $args->tproject_id = intval(isset($_REQUEST['tproject_id']) ? $_REQUEST['tproject_id'] : $_SESSION['testprojectID']);
    if ($args->tproject_id <= 0) {
        $tree_mgr = new tree($dbHandler);
        $dm = $tree_mgr->get_node_hierarchy_info($args->tplan_id);
        $args->tproject_id = $dm['parent_id'];
    }
    if (is_null($args->build_id) || $args->build_id == 0) {
        // Go for the build
        // this info can be present in session, then we will try different ways
        // ATTENTION:
        // give a look to tlTestCaseFilterControl.class.php method init_setting_build()
        //
        $key = $args->tplan_id . '_stored_setting_build';
        $args->build_id = isset($_SESSION[$key]) ? intval($_SESSION[$key]) : null;
        if (is_null($args->build_id)) {
            $args->build_id = $tplan_mgr->get_max_build_id($args->tplan_id, 1, 1);
        }
    }
    if (is_null($args->platform_id) || $args->platform_id <= 0) {
        // Go for the platform (if any exists)
        // this info can be present in session, then we will try different ways
        // ATTENTION:
        // give a look to tlTestCaseFilterControl.class.php method init_setting_platform()
        //
        $itemSet = $tplan_mgr->getPlatforms($args->tplan_id);
        if (!is_null($itemSet)) {
            $key = $args->tplan_id . '_stored_setting_platform';
            $args->platform_id = isset($_SESSION[$key]) ? intval($_SESSION[$key]) : null;
            if (is_null($args->platform_id) || $args->platform_id <= 0) {
                $args->platform_id = $itemSet[0]['id'];
            }
        }
    }
    return array($args, $tplan_mgr);
}
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $iParams = array("doAction" => array(tlInputParameter::STRING_N, 0, 50), "export_filename" => array(tlInputParameter::STRING_N, 0, 255), "exportType" => array(tlInputParameter::STRING_N, 0, 255), "tproject_id" => array(tlInputParameter::INT_N));
    R_PARAMS($iParams, $args);
    $args->tproject_name = '';
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    return $args;
}
/**
 *
 */
function init_args(&$dbHandler)
{
    $iParams = array("item_id" => array(tlInputParameter::INT_N), "showContextInfo" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    $args->tproject_name = null;
    if ($args->tproject_id > 0) {
        $mgr = new tree($dbHandler);
        $dummy = $mgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    $args->user = $_SESSION['currentUser'];
    $args->userID = $args->user->dbID;
    return $args;
}
Example #11
0
/**
 *
 */
function init_args(&$dbHandler)
{
    $iParams = array("req_spec_id" => array(tlInputParameter::INT_N), "refreshTree" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    $args->refreshTree = intval($args->refreshTree);
    $args->tproject_name = '';
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    $args->user = $_SESSION['currentUser'];
    return $args;
}
Example #12
0
/**
 * @return object returns the arguments for the page
 */
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $iParams = array("UploadFile" => array(tlInputParameter::STRING_N, 0, 1), "importType" => array(tlInputParameter::STRING_N, 0, 100), "tproject_id" => array(tlInputParameter::INT_N));
    R_PARAMS($iParams, $args);
    $args->UploadFile = $args->UploadFile != "" ? 1 : 0;
    $args->fInfo = isset($_FILES['uploadedFile']) ? $_FILES['uploadedFile'] : null;
    $args->source = isset($args->fInfo['tmp_name']) ? $args->fInfo['tmp_name'] : null;
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    return $args;
}
Example #13
0
/**
 *
 */
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $iParams = array("requirement_id" => array(tlInputParameter::INT_N), "req_version_id" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N), "req_spec_id" => array(tlInputParameter::INT_N), "showReqSpecTitle" => array(tlInputParameter::INT_N), "refreshTree" => array(tlInputParameter::INT_N), "relation_add_result_msg" => array(tlInputParameter::STRING_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    $args->req_id = $args->requirement_id;
    $args->refreshTree = intval($args->refreshTree);
    $args->tproject_name = '';
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    $args->user = $_SESSION['currentUser'];
    $args->userID = $args->user->dbID;
    return $args;
}
function init_args(&$dbHandler)
{
    $iParams = array("tproject_id" => array(tlInputParameter::INT_N), "tplan_id" => array(tlInputParameter::INT_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    $treeMgr = new tree($dbHandler);
    $args->tproject_name = '';
    if ($args->tproject_id > 0) {
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    $args->tplan_name = '';
    if ($args->tplan_id > 0) {
        $dummy = $treeMgr->get_node_hierarchy_info($args->tplan_id);
        $args->tplan_name = $dummy['name'];
    }
    return $args;
}
Example #15
0
/**
 * @return object returns the arguments for the page
 */
function init_args(&$dbHandler)
{
    $args = new stdClass();
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $source = sizeof($_POST) ? "POST" : "GET";
    $iParams = array("doAction" => array($source, tlInputParameter::STRING_N, 0, 50), "id" => array($source, tlInputParameter::INT_N), "keyword" => array($source, tlInputParameter::STRING_N, 0, 100), "notes" => array($source, tlInputParameter::STRING_N), "tproject_id" => array($source, tlInputParameter::INT_N));
    $pParams = I_PARAMS($iParams);
    $args = new stdClass();
    $args->doAction = $pParams["doAction"];
    $args->keyword_id = $pParams["id"];
    $args->keyword = $pParams["keyword"];
    $args->notes = $pParams["notes"];
    $args->tproject_name = '';
    if (($args->tproject_id = $pParams["tproject_id"]) > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    return $args;
}
function init_args(&$dbHandler)
{
    $args = new stdClass();
    $treeMgr = new tree($dbHandler);
    $tprojectMgr = new testproject($dbHandler);
    $args->tproject_name = '';
    $args->tproject_options = new stdClass();
    $args->tproject_options->testPriorityEnabled = 0;
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($args->tproject_id > 0) {
        $info = $tprojectMgr->get_by_id($args->tproject_id);
        $args->tproject_name = $info['name'];
        $args->tproject_options = $info['opt'];
    }
    $args->tplan_name = '';
    $args->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0;
    if ($args->tplan_id > 0) {
        $info = $treeMgr->get_node_hierarchy_info($args->tplan_id);
        $args->tplan_name = $info['name'];
    }
    return $args;
}
Example #17
0
/**
 * 
 *
 */
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $iParams = array("countReq" => array(tlInputParameter::INT_N, 99999), "req_spec_id" => array(tlInputParameter::INT_N), "req_spec_revision_id" => array(tlInputParameter::INT_N), "parentID" => array(tlInputParameter::INT_N), "doAction" => array(tlInputParameter::STRING_N, 0, 250), "title" => array(tlInputParameter::STRING_N, 0, 100), "scope" => array(tlInputParameter::STRING_N), "doc_id" => array(tlInputParameter::STRING_N, 1, 32), "nodes_order" => array(tlInputParameter::ARRAY_INT), "containerID" => array(tlInputParameter::INT_N), "itemSet" => array(tlInputParameter::ARRAY_INT), "reqSpecType" => array(tlInputParameter::STRING_N, 0, 1), "copy_testcase_assignment" => array(tlInputParameter::CB_BOOL), "tproject_id" => array(tlInputParameter::INT_N), "save_rev" => array(tlInputParameter::INT_N), "do_save" => array(tlInputParameter::INT_N), "log_message" => array(tlInputParameter::STRING_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    // TO BE CHECKED
    // i guess due to required revison log it is necessary to strip slashes
    // after R_PARAMS call - at least this fixed the problem
    // $_REQUEST=strings_stripSlashes($_REQUEST);
    $args->user_id = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0;
    $args->user = $_SESSION['currentUser'];
    $args->basehref = $_SESSION['basehref'];
    $args->parentID = is_null($args->parentID) ? $args->tproject_id : $args->parentID;
    $args->refreshTree = isset($_SESSION['setting_refresh_tree_on_action']) ? $_SESSION['setting_refresh_tree_on_action'] : 0;
    $args->countReq = is_null($args->countReq) ? 0 : intval($args->countReq);
    if ($args->tproject_id > 0) {
        $nm = new tree($dbHandler);
        $dummy = $nm->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    return $args;
}
function init_args(&$dbHandler)
{
    $args = new stdClass();
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $iParams = array("doAction" => array(tlInputParameter::STRING_N, 0, 50), "export_filename" => array(tlInputParameter::STRING_N, 0, 255), "goback_url" => array(tlInputParameter::STRING_N, 0, 2048), "tproject_id" => array(tlInputParameter::INT));
    R_PARAMS($iParams, $args);
    $args->tproject_name = '';
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    if (is_null($args->export_filename)) {
        $args->export_filename = $args->tproject_name . "-platforms.xml";
    }
    $args->export_filename = trim(str_ireplace(" ", "", $args->export_filename));
    $target = $args->goback_url;
    if (strlen(trim($target)) > 0) {
        $target .= strpos($target, "?") === false ? "?" : "&";
        $target .= "tproject_id={$args->tproject_id}";
    }
    $args->goback_url = $target;
    return $args;
}
Example #19
0
/**
 * 
 *
 */
function init_args(&$dbHandler)
{
    $args = new stdClass();
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $source = sizeof($_POST) ? "POST" : "GET";
    $iParams = array("doAction" => array($source, tlInputParameter::STRING_N, 0, 50), "id" => array($source, tlInputParameter::INT_N), "name" => array($source, tlInputParameter::STRING_N, 0, 100), "notes" => array($source, tlInputParameter::STRING_N));
    $pParams = I_PARAMS($iParams);
    $args->doAction = $pParams["doAction"];
    $args->platform_id = $pParams["id"];
    $args->name = $pParams["name"];
    $args->notes = $pParams["notes"];
    // why we need this logic ????
    if ($args->doAction == "edit") {
        $_SESSION['platform_id'] = $args->platform_id;
    } else {
        if ($args->doAction == "do_update") {
            $args->platform_id = $_SESSION['platform_id'];
        }
    }
    $args->currentUser = $_SESSION['currentUser'];
    $args->tproject_name = '';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    return $args;
}
Example #20
0
    $gui->title = lang_get('title_del_tc') . TITLE_SEP_TYPE3 . lang_get('version') . " " . $tcinfo[0]['version'];
    $gui->testcase_name = $tcinfo[0]['name'];
    $gui->testcase_id = $args->tcase_id;
    $gui->tcversion_id = $args->tcversion_id;
    $gui->delete_message = $msg;
    $gui->exec_status_quo = $sq;
    $gui->refreshTree = 0;
    $smarty->assign('gui', $gui);
    $templateCfg = templateConfiguration('tcDelete');
    $smarty->display($templateCfg->template_dir . $templateCfg->default_template);
} else {
    if ($args->move_copy_tc) {
        // need to get the testproject for the test case
        // new dBug($args);
        // $tproject_id = $tcase_mgr->get_testproject($args->tcase_id);
        $the_tc_node = $tree_mgr->get_node_hierarchy_info($args->tcase_id);
        $tc_parent_id = $the_tc_node['parent_id'];
        $the_xx = $tproject_mgr->gen_combo_test_suites($args->tproject_id);
        $the_xx[$the_tc_node['parent_id']] .= ' (' . lang_get('current') . ')';
        $tc_info = $tcase_mgr->get_by_id($args->tcase_id);
        $container_qty = count($the_xx);
        $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->old_container = $the_tc_node['parent_id'];
        // original container
        $gui->array_container = $the_xx;
Example #21
0
require_once 'tree.class.php';
testlinkInitPage($db);
echo "<pre> tree - constructor - tree(&\$db)";
echo "</pre>";
$tree_mgr = new tree($db);
new dBug($tree_mgr);
echo "<pre> tree - get_available_node_types()";
echo "</pre>";
$available_node_types = $tree_mgr->get_available_node_types();
new dBug($available_node_types);
echo "<pre> tree - get_node_hierarchy_info(\$node_id)";
echo "</pre>";
$node_id = 1;
echo "<pre> get_node_hierarchy_info({$node_id})";
echo "</pre>";
$node_hierachy_info = $tree_mgr->get_node_hierarchy_info($node_id);
new dBug($node_hierachy_info);
echo "<pre> tree - get_subtree(\$node_id)";
echo "</pre>";
echo "<pre> get_subtree({$node_id})";
echo "</pre>";
$subtree = $tree_mgr->get_subtree($node_id);
new dBug($subtree);
echo "<pre> tree - get_subtree(\$node_id,\$exclude_node_types=null," . "<br>" . "                              \$exclude_children_of=null,\$exclude_branches=null," . "<br>" . "                              \$and_not_in_clause='',\$bRecursive = false)";
echo "</pre>";
echo "<pre> get_subtree({$node_id},null,null,null,'',false)";
echo "</pre>";
$subtree = $tree_mgr->get_subtree($node_id, null, null, null, '', false);
new dBug($subtree);
echo "<pre> get_subtree({$node_id},null,null,null,'',true)";
echo "</pre>";
Example #22
0
/**
 * xta2m: eXecution Tasks Assigned TO Me
 *
 */
function process_xta2m(&$dbHandler, $context)
{
    $ret = array();
    $ret['url'] = null;
    $ret['msg'] = 'ko';
    $treeMgr = new tree($dbHandler);
    $info = $treeMgr->get_node_hierarchy_info($context['tcversion_id']);
    $ret['url'] = "lib/execute/execSetResults.php?level=testcase" . "&version_id=" . $context['tcversion_id'] . "&id=" . $info['parent_id'] . "&setting_testplan=" . $context['setting_testplan'] . "&setting_build=" . $context['setting_build'] . "&setting_platform=" . $context['setting_platform'];
    $ret['msg'] = 'ok';
    return $ret;
}
 * @internal revisions:
 * 20110308 - asimon - backported this file from master to branch 1.9
 * 20110306 - franciscom - 	BUGID 4273: Option to print single requirement
 *							added revision number 
 *
 * 20110305 - franciscom - 	BUGID 4273: Option to print single requirement
 */
require_once "../../config.inc.php";
require_once "../../cfg/reports.cfg.php";
require_once "print.inc.php";
require_once "common.php";
testlinkInitPage($db);
$templateCfg = templateConfiguration();
$tree_mgr = new tree($db);
$args = init_args();
$node = $tree_mgr->get_node_hierarchy_info($args->req_id);
$node['version_id'] = $args->req_version_id;
$node['revision'] = $args->req_revision;
$gui = new stdClass();
$gui->object_name = '';
$gui->object_name = $node['name'];
$gui->page_title = sprintf(lang_get('print_requirement'), $node['name']);
$gui->tproject_name = $args->tproject_name;
$gui->tproject_id = $args->tproject_id;
$gui->req_id = $args->req_id;
$gui->req_version_id = $args->req_version_id;
$gui->req_revision = $args->req_revision;
// Struture defined in printDocument.php
$options = array('toc' => 0, 'req_linked_tcs' => 1, 'req_cf' => 1, 'req_scope' => 1, 'req_relations' => 1, 'req_coverage' => 1, 'req_status' => 1, 'req_type' => 1, 'req_author' => 1, 'displayVersion' => 1, 'displayDates' => 1, 'displayLastEdit' => 1, 'docType' => SINGLE_REQ);
$text2print = '';
$text2print .= renderHTMLHeader($gui->page_title, $_SESSION['basehref'], SINGLE_REQ);
function initEnv(&$dbHandler)
{
    $args = new stdClass();
    $gui = new stdClass();
    $iParams = array("apikey" => array(tlInputParameter::STRING_N, 32, 64), "tproject_id" => array(tlInputParameter::INT_N), "tplan_id" => array(tlInputParameter::INT_N), "show_only_active" => array(tlInputParameter::CB_BOOL), "show_only_active_hidden" => array(tlInputParameter::CB_BOOL));
    R_PARAMS($iParams, $args);
    if (!is_null($args->apikey)) {
        $args->show_only_active = true;
        $cerbero = new stdClass();
        $cerbero->args = new stdClass();
        $cerbero->args->tproject_id = $args->tproject_id;
        $cerbero->args->tplan_id = $args->tplan_id;
        $cerbero->args->getAccessAttr = true;
        $cerbero->method = 'checkRights';
        $cerbero->redirect_target = "../../login.php?note=logout";
        if (strlen($args->apikey) == 32) {
            setUpEnvForRemoteAccess($dbHandler, $args->apikey, $cerbero);
        } else {
            setUpEnvForAnonymousAccess($dbHandler, $args->apikey, $cerbero);
        }
    } else {
        testlinkInitPage($dbHandler, false, false, "checkRights");
        $args->tproject_id = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0;
    }
    if ($args->tproject_id <= 0) {
        $msg = __FILE__ . '::' . __FUNCTION__ . " :: Invalid Test Project ID ({$args->tproject_id})";
        throw new Exception($msg);
    }
    $mgr = new tree($dbHandler);
    $dummy = $mgr->get_node_hierarchy_info($args->tproject_id);
    $args->tproject_name = $dummy['name'];
    $args->user = $_SESSION['currentUser'];
    $args->currentUserID = $args->user->dbID;
    // I'm sorry for MAGIC
    $args->direct_link_ok = true;
    if (strlen(trim($args->user->userApiKey)) == 32) {
        $args->direct_link = $_SESSION['basehref'] . "lnl.php?type=metricsdashboard&" . "apikey={$args->user->userApiKey}&tproject_id={$args->tproject_id}";
    } else {
        $args->direct_link_ok = false;
        $args->direct_link = lang_get('can_not_create_direct_link');
    }
    if ($args->show_only_active) {
        $selection = true;
    } else {
        if ($args->show_only_active_hidden) {
            $selection = false;
        } else {
            if (isset($_SESSION['show_only_active'])) {
                $selection = $_SESSION['show_only_active'];
            } else {
                $selection = true;
            }
        }
    }
    $args->show_only_active = $_SESSION['show_only_active'] = $selection;
    $gui->tproject_name = $args->tproject_name;
    $gui->show_only_active = $args->show_only_active;
    $gui->direct_link = $args->direct_link;
    $gui->direct_link_ok = $args->direct_link_ok;
    $gui->warning_msg = lang_get('no_testplans_available');
    return array($args, $gui);
}
 function getAttachmentFamily($attachInfo)
 {
     $ret = null;
     switch ($attachInfo['fk_table']) {
         case 'nodes_hierarchy':
             $tree_manager = new tree($this->db);
             $dummy = $tree_manager->get_node_hierarchy_info($attachInfo['fk_id']);
             $class2use = $tree_manager->class_name[$dummy['node_type_id']];
             switch ($class2use) {
                 case 'testcase':
                     $mgr = new $class2use($this->db);
                     $signature = $mgr->getAuditSignature((object) array('id' => $attachInfo['fk_id']));
                     $ret = array('ownerType' => 'testcase', 'owner' => lang_get('testcase') . ':' . $signature);
                     break;
             }
             break;
     }
     return $ret;
 }
Example #26
0
function do_remote_execution(&$dbHandler, $context)
{
    $debugMsg = "File:" . __FILE__ . " Function: " . __FUNCTION__;
    $tables = array();
    $tables['executions'] = DB_TABLE_PREFIX . 'executions';
    $resultsCfg = config_get('results');
    $tc_status = $resultsCfg['status_code'];
    $tree_mgr = new tree($dbHandler);
    $cfield_mgr = new cfield_mgr($dbHandler);
    $ret = null;
    $executionResults = array();
    $myResult = array();
    $sql = " /* {$debugMsg} */ INSERT INTO {$tables['executions']} " . " (testplan_id,platform_id,build_id,tester_id,execution_type," . "  tcversion_id,execution_ts,status,notes) " . " VALUES ({$context['tplan_id']}, {$context['platform_id']}, {$context['build_id']}," . " {$context['user_id']}," . testcase::EXECUTION_TYPE_AUTO . ",";
    // have we got multiple test cases to execute ?
    $target =& $context['target'];
    foreach ($target['tc_versions'] as $version_id => $tcase_id) {
        $ret[$version_id] = array("verboseID" => null, "status" => null, "notes" => null, "system" => null, "scheduled" => null, "timestamp" => null);
        $tcaseInfo = $tree_mgr->get_node_hierarchy_info($tcase_id);
        $tcaseInfo['version_id'] = $version_id;
        // For each test case version we can have a different server config
        $serverCfg = $cfield_mgr->getXMLRPCServerParams($version_id, $target['feature_id'][$version_id]);
        $execResult[$version_id] = executeTestCase($tcaseInfo, $serverCfg, $context['context']);
        // RPC call
        $tryWrite = false;
        switch ($execResult[$version_id]['system']['status']) {
            case 'configProblems':
                $tryWrite = false;
                break;
            case 'connectionFailure':
                $tryWrite = false;
                break;
            case 'ok':
                $tryWrite = true;
                break;
        }
        if ($tryWrite) {
            $trun =& $execResult[$version_id]['execution'];
            if ($trun['scheduled'] == 'now') {
                $ret[$version_id]["status"] = strtolower($trun['result']);
                $ret[$version_id]["notes"] = trim($trun['notes']);
                $notes = $dbHandler->prepare_string($ret[$version_id]["notes"]);
                if ($ret[$version_id]["status"] != $tc_status['passed'] && $ret[$version_id]["status"] != $tc_status['failed'] && $ret[$version_id]["status"] != $tc_status['blocked']) {
                    $ret[$version_id]["status"] = $tc_status['blocked'];
                }
                //
                $sql2exec = $sql . $version_id . "," . $dbHandler->db_now() . ", '{$ret[$version_id]["status"]}', '{$notes}' )";
                $dbHandler->exec_query($sql2exec);
            } else {
                $ret[$version_id]["notes"] = trim($execResult[$version_id]['notes']);
                $ret[$version_id]["scheduled"] = $execResult[$version_id]['scheduled'];
                $ret[$version_id]["timestamp"] = $execResult[$version_id]['timestampISO'];
            }
        } else {
            $ret[$version_id]["system"] = $execResult[$version_id]['system'];
        }
    }
    return $ret;
}
/**
 * 
 *
 * 
 **/
function initializeGui(&$dbHandler, &$argsObj)
{
    $guiObj = new stdClass();
    $guiObj->importLimitBytes = config_get('import_file_max_size_bytes');
    $guiObj->importLimitKB = $guiObj->importLimitBytes / 1024;
    $guiObj->importTypes = array('XML' => 'Mantis XML');
    $guiObj->req_spec_id = $argsObj->req_spec_id;
    $guiObj->refreshTree = $guiObj->doImport = tlStringLen($argsObj->importType);
    $guiObj->resultMap = null;
    $guiObj->req_spec_name = '';
    $guiObj->file_check = array('status_ok' => 1, 'msg' => 'ok');
    $guiObj->import_title = lang_get('title_req_import');
    $guiObj->fileName = TL_TEMP_PATH . session_id() . "-import_req_from_issue";
    if ($argsObj->req_spec_id) {
        $tree_mgr = new tree($dbHandler);
        $node_info = $tree_mgr->get_node_hierarchy_info($argsObj->req_spec_id);
        unset($tree_mgr);
        $guiObj->req_spec_name = $node_info['name'];
    }
    return $guiObj;
}
require_once "../functions/xml.inc.php";
testlinkInitPage($db);
$templateCfg = templateConfiguration();
$tcase_mgr = null;
$tree_mgr = new tree($db);
$args = init_args();
$gui = initializeGui($args);
$node_id = $args->container_id;
$check_children = 0;
//
if ($args->useRecursion) {
    // Exporting situations:
    // All test suites in test project
    // One test suite
    // $dummy = array_flip($tree_mgr->get_available_node_types());
    $node_info = $tree_mgr->get_node_hierarchy_info($node_id);
    $gui->export_filename = $node_info['name'];
    $gui->page_title = lang_get('title_tsuite_export');
    $dummy = '.testsuite-deep.xml';
    if ($node_id == $args->tproject_id) {
        $gui->page_title = lang_get('title_tsuite_export_all');
        $dummy = '.testproject-deep.xml';
        $check_children = 1;
        $gui->nothing_todo_msg = lang_get('no_testsuites_to_export');
    }
    $gui->export_filename .= $dummy;
} else {
    // Exporting situations:
    // All test cases in test suite.
    // One test case.
    if ($gui->oneTestCaseExport) {
Example #29
0
function init_args(&$dbHandler)
{
    $args = new stdClass();
    $request = strings_stripSlashes($_REQUEST);
    $key = 'actionOnHit';
    $args->{$key} = isset($_REQUEST[$key]) ? $_REQUEST[$key] : 'update_last_version';
    $key = 'hitCriteria';
    $args->{$key} = isset($_REQUEST[$key]) ? $_REQUEST[$key] : 'docid';
    $args->req_spec_id = isset($request['req_spec_id']) ? $request['req_spec_id'] : null;
    $args->importType = isset($request['importType']) ? $request['importType'] : null;
    $args->emptyScope = isset($request['noEmpty']) ? $request['noEmpty'] : null;
    $args->conflictSolution = isset($request['conflicts']) ? $request['conflicts'] : null;
    $args->bUpload = isset($request['uploadFile']) ? 1 : 0;
    // useRecursion: used when you want to work on test project or req. spec
    $args->useRecursion = isset($request['useRecursion']) ? 1 : 0;
    $args->skip_frozen_req = isset($request['skip_frozen_req']) ? 1 : 0;
    $args->doAction = 'askFileName';
    $action_keys = array('uploadFile', 'executeImport');
    foreach ($action_keys as $action) {
        if (isset($request[$action])) {
            $args->doAction = $action;
            break;
        }
    }
    $args->achecked_req = isset($request['achecked_req']) ? $request['achecked_req'] : null;
    $args->tproject_name = '';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    $args->user_id = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0;
    $args->scope = isset($_REQUEST['scope']) ? $_REQUEST['scope'] : 'items';
    // BUGID 3761: requirement tree refresh after requirement import
    $args->refreshTree = isset($_SESSION['setting_refresh_tree_on_action']) ? $_SESSION['setting_refresh_tree_on_action'] : 0;
    return $args;
}
/**
 * 
 *
 * 
 **/
function initializeGui(&$dbHandler, &$argsObj)
{
    $guiObj = new stdClass();
    $guiObj->importLimitBytes = config_get('import_file_max_size_bytes');
    $guiObj->importLimitKB = $guiObj->importLimitBytes / 1024;
    $guiObj->containerID = $argsObj->container_id;
    $guiObj->refreshTree = $guiObj->doImport = tlStringLen($argsObj->importType);
    $guiObj->resultMap = null;
    $guiObj->container_name = '';
    $guiObj->file_check = array('status_ok' => 1, 'msg' => 'ok');
    $guiObj->import_title = lang_get('title_tc_import_to');
    $guiObj->container_description = lang_get('test_case');
    $dest_common = TL_TEMP_PATH . session_id() . "-importtcs";
    $dest_files = array('XML' => $dest_common . ".xml");
    $guiObj->dest = $dest_files['XML'];
    if (!is_null($argsObj->importType)) {
        $guiObj->dest = $dest_files[$argsObj->importType];
    }
    if ($argsObj->container_id) {
        $tree_mgr = new tree($dbHandler);
        $node_info = $tree_mgr->get_node_hierarchy_info($argsObj->container_id);
        unset($tree_mgr);
        $guiObj->container_name = $node_info['name'];
        if ($argsObj->container_id == $argsObj->tproject_id) {
            $guiObj->container_description = lang_get('testproject');
        }
    }
    return $guiObj;
}