Beispiel #1
0
/**
 * 
 * 
 */
function initEnv(&$dbHandler)
{
    $uaWhiteList = array();
    $uaWhiteList['elements'] = array('link', 'create', 'doCreate', 'add_note');
    $uaWhiteList['lenght'] = array();
    foreach ($uaWhiteList['elements'] as $xmen) {
        $uaWhiteList['lenght'][] = strlen($xmen);
    }
    $user_action['maxLengh'] = max($uaWhiteList['lenght']);
    $user_action['minLengh'] = min($uaWhiteList['lenght']);
    $iParams = array("exec_id" => array("GET", tlInputParameter::INT_N), "bug_id" => array("REQUEST", tlInputParameter::STRING_N), "tproject_id" => array("REQUEST", tlInputParameter::INT_N), "tplan_id" => array("REQUEST", tlInputParameter::INT_N), "tcversion_id" => array("REQUEST", tlInputParameter::INT_N), "bug_notes" => array("POST", tlInputParameter::STRING_N), "issueType" => array("POST", tlInputParameter::INT_N), "issuePriority" => array("POST", tlInputParameter::INT_N), "artifactComponent" => array("POST", tlInputParameter::ARRAY_INT), "artifactVersion" => array("POST", tlInputParameter::ARRAY_INT), "user_action" => array("REQUEST", tlInputParameter::STRING_N, $user_action['minLengh'], $user_action['maxLengh']));
    $args = new stdClass();
    I_PARAMS($iParams, $args);
    if ($args->exec_id) {
        $_SESSION['bugAdd_execID'] = intval($args->exec_id);
    } else {
        $args->exec_id = intval(isset($_SESSION['bugAdd_execID']) ? $_SESSION['bugAdd_execID'] : 0);
    }
    $args->user = $_SESSION['currentUser'];
    $gui = new stdClass();
    switch ($args->user_action) {
        case 'create':
        case 'doCreate':
            $gui->pageTitle = lang_get('create_issue');
            break;
        case 'add_note':
            $gui->pageTitle = lang_get('add_issue_note');
            break;
        case 'link':
        default:
            $gui->pageTitle = lang_get('title_bug_add');
            break;
    }
    $gui->msg = '';
    $gui->bug_summary = '';
    $gui->tproject_id = $args->tproject_id;
    $gui->tplan_id = $args->tplan_id;
    $gui->tcversion_id = $args->tcversion_id;
    $gui->user_action = $args->user_action;
    $gui->bug_id = $args->bug_id;
    $gui->issueType = $args->issueType;
    $gui->issuePriority = $args->issuePriority;
    $gui->artifactVersion = $args->artifactVersion;
    $gui->artifactComponent = $args->artifactComponent;
    // -----------------------------------------------------------------------
    // Special processing
    list($itObj, $itCfg) = getIssueTracker($dbHandler, $args, $gui);
    // Second access to user input
    $bug_summary['minLengh'] = 1;
    $bug_summary['maxLengh'] = $itObj->getBugSummaryMaxLength();
    $inputCfg = array("bug_summary" => array("POST", tlInputParameter::STRING_N, $bug_summary['minLengh'], $bug_summary['maxLengh']));
    I_PARAMS($inputCfg, $args);
    $args->bug_id = trim($args->bug_id);
    switch ($args->user_action) {
        case 'create':
            if ($args->bug_id == '' && $args->exec_id > 0) {
                $map = get_execution($dbHandler, $args->exec_id);
                $args->bug_notes = $map[0]['notes'];
            }
            break;
        case 'doCreate':
        case 'add_note':
        case 'link':
        default:
            break;
    }
    $gui->bug_notes = $args->bug_notes = trim($args->bug_notes);
    $args->basehref = $_SESSION['basehref'];
    $tables = tlObjectWithDB::getDBTables(array('testplans'));
    $sql = ' SELECT api_key FROM ' . $tables['testplans'] . ' WHERE id=' . intval($args->tplan_id);
    $rs = $dbHandler->get_recordset($sql);
    $args->tplan_apikey = $rs[0]['api_key'];
    return array($args, $gui, $itObj, $itCfg);
}
Beispiel #2
0
$templateCfg = templateConfiguration();
$tcase_mgr = new testcase($db);
$args = init_args();
$gui->exec_id = $args->exec_id;
$gui->tcversion_id = $args->tcversion_id;
$gui->tplan_id = $args->tplan_id;
$gui->tproject_id = $args->tproject_id;
$owebeditor = web_editor('notes', $args->basehref, $editorCfg);
switch ($args->doAction) {
    case 'edit':
        break;
    case 'doUpdate':
        doUpdate($db, $args, $tcase_mgr, $_REQUEST);
        break;
}
$map = get_execution($db, $args->exec_id);
$owebeditor->Value = $map[0]['notes'];
$gui->cfields_exec = $tcase_mgr->html_table_of_custom_field_inputs($args->tcversion_id, null, 'execution', '_cf', $args->exec_id, $args->tplan_id, $args->tproject_id);
$gui->notes = $owebeditor->CreateHTML();
$gui->editorType = $editorCfg['type'];
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
function doUpdate(&$db, &$args, &$tcaseMgr, &$request)
{
    updateExecutionNotes($db, $args->exec_id, $args->notes);
    $cfield_mgr = new cfield_mgr($db);
    $cfield_mgr->execution_values_to_db($request, $args->tcversion_id, $args->exec_id, $args->tplan_id);
}
function init_args()
{
 * @internal revisions
 * @since 1.9.4
 * 20120721 - franciscom - TICKET 05104: Audit message for BUG delete needs more info (improvement)
 *
**/
require_once '../../config.inc.php';
require_once '../functions/common.php';
require_once 'exec.inc.php';
testlinkInitPage($db, false, false, "checkRights");
$templateCfg = templateConfiguration();
$args = init_args();
$msg = "";
if ($args->exec_id && $args->bug_id != "") {
    if (write_execution_bug($db, $args->exec_id, $args->bug_id, true)) {
        // get audit info
        $ainfo = get_execution($db, $args->exec_id, array('output' => 'audit'));
        $ainfo = $ainfo[0];
        $msg = lang_get('bugdeleting_was_ok');
        logAuditEvent(TLS('audit_executionbug_deleted', $args->bug_id, $ainfo['exec_id'], $ainfo['testcase_name'], $ainfo['testproject_name'], $ainfo['testplan_name'], $ainfo['platform_name'], $ainfo['build_name']), "DELETE", $args->exec_id, "executions");
    }
}
$smarty = new TLSmarty();
$smarty->assign('msg', $msg);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
/**
 * 
 * @return object returns the arguments of the page
 */
function init_args()
{
    $args = new stdClass();