Esempio n. 1
0
function createExecNotesWebEditor($id, $basehref, $editorCfg, $content = null)
{
    // Important Notice:
    //
    // When using tinymce or none as web editor, we need to set rows and cols
    // to appropriate values, to avoid an ugly ui.
    // null => use default values defined on editor class file
    //
    // Rows and Cols values are useless for FCKeditor.
    //
    $of = web_editor("exec_notes_{$id}", $basehref, $editorCfg);
    $of->Value = $content;
    $editor = $of->CreateHTML(10, 60);
    unset($of);
    return $editor;
}
Esempio n. 2
0
$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;
switch ($args->doAction) {
    case 'create':
        $template = $templateCfg->default_template;
        $ui = create($args, $tproject_mgr);
        $gui->testprojects = $ui->testprojects;
        break;
    case 'edit':
        $template = $templateCfg->default_template;
        $ui = edit($args, $tproject_mgr);
        break;
    case 'doCreate':
        $op = doCreate($args, $tproject_mgr);
        $template = $op->status_ok ? null : $templateCfg->default_template;
        $ui = $op->ui;
Esempio n. 3
0
function createWebEditors($basehref, $editorCfg, $editorSet = null, $edit_steps = false)
{
    $specGUICfg = config_get('spec_cfg');
    $layout = $specGUICfg->steps_results_layout;
    // Rows and Cols configuration
    $owe = new stdClass();
    $cols = array('steps' => array('horizontal' => 38, 'vertical' => 44), 'expected_results' => array('horizontal' => 38, 'vertical' => 44));
    $owe->cfg = null;
    if ($edit_steps == false) {
        $owe->cfg = array('summary' => array('rows' => null, 'cols' => null), 'preconditions' => array('rows' => null, 'cols' => null));
    } else {
        $owe->cfg = array('steps' => array('rows' => null, 'cols' => null), 'expected_results' => array('rows' => null, 'cols' => null));
    }
    $owe->editor = array();
    $force_create = is_null($editorSet);
    foreach ($owe->cfg as $key => $value) {
        if ($force_create || isset($editorSet[$key])) {
            $owe->editor[$key] = web_editor($key, $basehref, $editorCfg);
        } else {
            unset($owe->cfg[$key]);
        }
    }
    return $owe;
}
Esempio n. 4
0
require_once '../../config.inc.php';
require_once 'common.php';
require_once 'exec.inc.php';
require_once "web_editor.php";
$editorCfg = getWebEditorCfg('execution');
require_once require_web_editor($editorCfg['type']);
testlinkInitPage($db, false, false, "checkRights");
$gui = new stdClass();
$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);
Esempio n. 5
0
/**
 * renderGui
 *
 */
function renderGui(&$argsObj, $guiObj, $opObj, $templateCfg, $editorCfg)
{
    $smartyObj = new TLSmarty();
    $renderType = 'none';
    $tpl = $tpd = null;
    $actionOperation = array('create' => 'doCreate', 'edit' => 'doUpdate', 'doDelete' => '', 'doReorder' => '', 'reorder' => '', 'doCreate' => 'doCreate', 'doUpdate' => 'doUpdate', 'createChild' => 'doCreate', 'copy' => 'doCopy', 'doCopy' => 'doCopy', 'copyRequirements' => 'doCopyRequirements', 'doCopyRequirements' => 'doCopyRequirements');
    $owebEditor = web_editor('scope', $argsObj->basehref, $editorCfg);
    switch ($argsObj->doAction) {
        case "edit":
        case "doCreate":
            $owebEditor->Value = $argsObj->scope;
            break;
        default:
            $owebEditor->Value = getItemTemplateContents('req_spec_template', $owebEditor->InstanceName, $argsObj->scope);
            break;
    }
    $guiObj->scope = $owebEditor->CreateHTML();
    $guiObj->editorType = $editorCfg['type'];
    // 20100808 - aismon - added logic to refresh filtered tree on action
    switch ($argsObj->doAction) {
        case "doCreate":
        case "doUpdate":
        case "doCopyRequirements":
        case "doCopy":
        case "doDelete":
            $guiObj->refreshTree = $argsObj->refreshTree;
            break;
    }
    switch ($argsObj->doAction) {
        case "edit":
        case "create":
        case "createChild":
        case "reorder":
        case "doDelete":
        case "doReorder":
        case "doCreate":
        case "doUpdate":
        case "copyRequirements":
        case "doCopyRequirements":
        case "copy":
        case "doCopy":
            $renderType = 'template';
            $key2loop = get_object_vars($opObj);
            foreach ($key2loop as $key => $value) {
                $guiObj->{$key} = $value;
            }
            $guiObj->operation = $actionOperation[$argsObj->doAction];
            $tpl = is_null($opObj->template) ? $templateCfg->default_template : $opObj->template;
            $tpd = isset($key2loop['template_dir']) ? $opObj->template_dir : $templateCfg->template_dir;
            break;
    }
    switch ($argsObj->doAction) {
        case "edit":
        case "create":
        case "createChild":
        case "reorder":
        case "doDelete":
        case "doReorder":
        case "copyRequirements":
        case "copy":
            $tpl = $tpd . $tpl;
            break;
        case "doCreate":
        case "doUpdate":
        case "doCopyRequirements":
        case "doCopy":
            $pos = strpos($tpl, '.php');
            if ($pos === false) {
                $tpl = $templateCfg->template_dir . $tpl;
            } else {
                $renderType = 'redirect';
            }
            break;
    }
    switch ($renderType) {
        case 'template':
            $smartyObj->assign('mgt_view_events', has_rights($db, "mgt_view_events"));
            $smartyObj->assign('gui', $guiObj);
            $smartyObj->display($tpl);
            break;
        case 'redirect':
            header("Location: {$tpl}");
            exit;
            break;
        default:
            break;
    }
}
Esempio n. 6
0
/**
 * initWebEditors
 *
 */
function initWebEditors($action, $itemType, $editorCfg)
{
    $webEditorKeys = array('testsuite' => array('details'));
    $itemTemplateKey = null;
    switch ($action) {
        case 'new_testsuite':
        case 'add_testsuite':
        case 'edit_testsuite':
            $accessKey = 'testsuite';
            break;
        default:
            $accessKey = '';
            break;
    }
    switch ($itemType) {
        case 'testproject':
        case 'testsuite':
            $itemTemplateKey = 'testsuite_template';
            $accessKey = 'testsuite';
            break;
    }
    $oWebEditor = array();
    $htmlNames = '';
    if (isset($webEditorKeys[$accessKey])) {
        $htmlNames = $webEditorKeys[$accessKey];
        foreach ($htmlNames as $key) {
            $oWebEditor[$key] = web_editor($key, $_SESSION['basehref'], $editorCfg);
        }
    }
    return array($oWebEditor, $htmlNames, $itemTemplateKey);
}
Esempio n. 7
0
function createExecNotesWebEditor(&$tcversions, $basehref, $editorCfg)
{
    if (is_null($tcversions) || count($tcversions) == 0) {
        return null;
        // nothing todo >>>------> bye!
    }
    // Important Notice:
    //
    // When using tinymce or none as web editor, we need to set rows and cols
    // to appropriate values, to avoid an ugly ui.
    // null => use default values defined on editor class file
    //
    // Rows and Cols values are useless for FCKeditor.
    //
    $itemTemplateValue = getItemTemplateContents('execution_template', 'notes', null);
    foreach ($tcversions as $key => $tcv) {
        $tcversion_id = $tcv['id'];
        $tcase_id = $tcv['testcase_id'];
        $of = web_editor("notes[{$tcversion_id}]", $basehref, $editorCfg);
        $of->Value = $itemTemplateValue;
        // Magic numbers that can be determined by trial and error
        $editors[$tcase_id] = $of->CreateHTML(10, 60);
        unset($of);
    }
    return $editors;
}
Esempio n. 8
0
/**
 *
 *
 */
function initWebEditors(&$guiObj, $cfgObj, $baseHREF)
{
    if ($guiObj->can_use_bulk_op) {
        //$guiObj->execStatusValues=createResultsMenu();
        //if( isset($guiObj->execStatusValues[$cfgObj->tc_status['all']]) )
        //{
        //    unset($guiObj->execStatusValues[$cfgObj->tc_status['all']]);
        //}
        $of = web_editor("bulk_exec_notes", $baseHREF, $cfgObj->editorCfg);
        $of->Value = getItemTemplateContents('execution_template', $of->InstanceName, null);
        // Magic numbers that can be determined by trial and error
        $guiObj->bulk_exec_notes_editor = $of->CreateHTML(10, 60);
        unset($of);
    } else {
        $guiObj->exec_notes_editors = createExecNotesWebEditor($guiObj->map_last_exec, $baseHREF, $cfgObj->editorCfg);
    }
}
Esempio n. 9
0
function setUpForBulkExec($guiObj)
{
    $guiObj->execStatusValues = testcase::createExecutionResultsMenu();
    if (isset($guiObj->execStatusValues[$guiObj->cfg->tc_status['all']])) {
        unset($guiObj->execStatusValues[$guiObj->cfg->tc_status['all']]);
    }
    $of = web_editor("bulk_exec_notes", $_SESSION['basehref'], $guiObj->cfg->editorCfg);
    $of->Value = getItemTemplateContents('execution_template', $of->InstanceName, null);
    // Magic numbers that can be determined by trial and error
    $guiObj->bulk_exec_notes_editor = $of->CreateHTML(10, 60);
    unset($of);
}
Esempio n. 10
0
/**
 * initWebEditors
 *
 */
function initWebEditors($webEditorKeys, $containerType, $editorCfg)
{
    switch ($containerType) {
        case 'testsuite':
            // $cfg=config_get('testsuite_template');
            $itemTemplateKey = 'testsuite_template';
            break;
        default:
            //$cfg=null;
            $itemTemplateKey = null;
            break;
    }
    $htmlNames = $webEditorKeys[$containerType];
    $oWebEditor = array();
    foreach ($htmlNames as $key) {
        $oWebEditor[$key] = web_editor($key, $_SESSION['basehref'], $editorCfg);
    }
    return array($oWebEditor, $htmlNames, $itemTemplateKey);
}
Esempio n. 11
0
/**
 * initWebEditors
 *
 */
function initWebEditors()
{
    $editorCfg = getWebEditorCfg('design');
    $editorSet = new stdClass();
    $editorSet->jsControls = array();
    $editorSet->templates = 'testsuite_template';
    $editorSet->inputNames = array('details');
    foreach ($editorSet->inputNames as $key) {
        $editorSet->jsControls[$key] = web_editor($key, $_SESSION['basehref'], $editorCfg);
    }
    return $editorSet;
}
Esempio n. 12
0
/**
 * 
 *
 */
function renderGui(&$argsObj, $guiObj, $opObj, $templateCfg, $editorCfg, &$dbHandler)
{
    $smartyObj = new TLSmarty();
    $renderType = 'none';
    // @TODO document
    $actionOperation = array('create' => 'doCreate', 'edit' => 'doUpdate', 'doDelete' => '', 'doReorder' => '', 'reorder' => '', 'createTestCases' => 'doCreateTestCases', 'doCreateTestCases' => 'doCreateTestCases', 'doCreate' => 'doCreate', 'doUpdate' => 'doUpdate', 'copy' => 'doCopy', 'doCopy' => 'doCopy', 'doCreateVersion' => 'doCreateVersion', 'doCreateRevision' => 'doCreateRevision', 'doDeleteVersion' => '', 'doFreezeVersion' => 'doFreezeVersion', 'doAddRelation' => 'doAddRelation', 'doDeleteRelation' => 'doDeleteRelation');
    $owebEditor = web_editor('scope', $argsObj->basehref, $editorCfg);
    switch ($argsObj->doAction) {
        case "edit":
        case "doCreate":
            $owebEditor->Value = $argsObj->scope;
            break;
        default:
            if ($opObj->suggest_revision || $opObj->prompt_for_log) {
                $owebEditor->Value = $argsObj->scope;
            } else {
                $owebEditor->Value = getItemTemplateContents('requirement_template', $owebEditor->InstanceName, $argsObj->scope);
            }
            break;
    }
    $guiObj->askForRevision = $opObj->suggest_revision ? 1 : 0;
    $guiObj->askForLog = $opObj->prompt_for_log ? 1 : 0;
    $guiObj->scope = $owebEditor->CreateHTML();
    $guiObj->editorType = $editorCfg['type'];
    switch ($argsObj->doAction) {
        case "doDelete":
            $guiObj->refreshTree = 1;
            // has to be forced
            break;
        case "doCreate":
            $guiObj->refreshTree = $argsObj->refreshTree;
            break;
        case "doUpdate":
            // IMPORTANT NOTICE
            // we do not set tree refresh here, because on this situation
            // tree update has to be done when reqView page is called.
            // If we ask for tree refresh here we are going to do double refresh (useless and time consuming)
            break;
    }
    switch ($argsObj->doAction) {
        case "edit":
        case "create":
        case "reorder":
        case "doDelete":
        case "doReorder":
        case "createTestCases":
        case "doCreateTestCases":
        case "doCreate":
        case "doFreezeVersion":
        case "doUpdate":
        case "copy":
        case "doCopy":
        case "doCreateVersion":
        case "doDeleteVersion":
        case "doAddRelation":
        case "doDeleteRelation":
        case "doCreateRevision":
            $renderType = 'template';
            $key2loop = get_object_vars($opObj);
            foreach ($key2loop as $key => $value) {
                $guiObj->{$key} = $value;
            }
            // exceptions
            $guiObj->askForRevision = $opObj->suggest_revision ? 1 : 0;
            $guiObj->askForLog = $opObj->prompt_for_log ? 1 : 0;
            $guiObj->operation = $actionOperation[$argsObj->doAction];
            $tplDir = !isset($opObj->template_dir) || is_null($opObj->template_dir) ? $templateCfg->template_dir : $opObj->template_dir;
            $tpl = is_null($opObj->template) ? $templateCfg->default_template : $opObj->template;
            $pos = strpos($tpl, '.php');
            if ($pos === false) {
                $tpl = $tplDir . $tpl;
            } else {
                $renderType = 'redirect';
            }
            break;
    }
    $req_mgr = new requirement_mgr($dbHandler);
    $guiObj->last_doc_id = $req_mgr->get_last_doc_id_for_testproject($argsObj->tproject_id);
    $guiObj->doAction = $argsObj->doAction;
    switch ($renderType) {
        case 'template':
            $smartyObj->assign('gui', $guiObj);
            $smartyObj->display($tpl);
            break;
        case 'redirect':
            header("Location: {$tpl}");
            exit;
            break;
        default:
            break;
    }
}
Esempio n. 13
0
/**
 * 
 *
 */
function renderGui(&$argsObj, $guiObj, $opObj, $templateCfg, $editorCfg, &$dbHandler)
{
    $smartyObj = new TLSmarty();
    $renderType = 'none';
    // @TODO document
    $actionOperation = array('create' => 'doCreate', 'edit' => 'doUpdate', 'doDelete' => '', 'doReorder' => '', 'reorder' => '', 'createTestCases' => 'doCreateTestCases', 'doCreateTestCases' => 'doCreateTestCases', 'doCreate' => 'doCreate', 'doUpdate' => 'doUpdate', 'copy' => 'doCopy', 'doCopy' => 'doCopy', 'doCreateVersion' => 'doCreateVersion', 'doDeleteVersion' => '', 'doFreezeVersion' => 'doFreezeVersion', 'doAddRelation' => 'doAddRelation', 'doDeleteRelation' => 'doDeleteRelation');
    $owebEditor = web_editor('scope', $argsObj->basehref, $editorCfg);
    switch ($argsObj->doAction) {
        case "edit":
        case "doCreate":
            $owebEditor->Value = $argsObj->scope;
            break;
        default:
            $owebEditor->Value = getItemTemplateContents('requirement_template', $owebEditor->InstanceName, $argsObj->scope);
            break;
    }
    $guiObj->scope = $owebEditor->CreateHTML();
    $guiObj->editorType = $editorCfg['type'];
    // 20100808 - aismon - added logic to refresh filtered tree on action
    switch ($argsObj->doAction) {
        case "doDelete":
        case "doCreate":
            $guiObj->refreshTree = $argsObj->refreshTree;
            break;
    }
    switch ($argsObj->doAction) {
        case "edit":
        case "create":
        case "reorder":
        case "doDelete":
        case "doReorder":
        case "createTestCases":
        case "doCreateTestCases":
        case "doCreate":
        case "doFreezeVersion":
        case "doUpdate":
        case "copy":
        case "doCopy":
        case "doCreateVersion":
        case "doDeleteVersion":
            // BUGID 1748
        // BUGID 1748
        case "doAddRelation":
        case "doDeleteRelation":
            $renderType = 'template';
            $key2loop = get_object_vars($opObj);
            foreach ($key2loop as $key => $value) {
                $guiObj->{$key} = $value;
            }
            $guiObj->operation = $actionOperation[$argsObj->doAction];
            $tplDir = !isset($opObj->template_dir) || is_null($opObj->template_dir) ? $templateCfg->template_dir : $opObj->template_dir;
            $tpl = is_null($opObj->template) ? $templateCfg->default_template : $opObj->template;
            $pos = strpos($tpl, '.php');
            if ($pos === false) {
                $tpl = $tplDir . $tpl;
            } else {
                $renderType = 'redirect';
            }
            break;
    }
    $req_mgr = new requirement_mgr($dbHandler);
    $guiObj->last_doc_id = $req_mgr->get_last_doc_id_for_testproject($argsObj->tproject_id);
    $guiObj->doAction = $argsObj->doAction;
    switch ($renderType) {
        case 'template':
            $smartyObj->assign('gui', $guiObj);
            $smartyObj->display($tpl);
            break;
        case 'redirect':
            header("Location: {$tpl}");
            exit;
            break;
        default:
            break;
    }
}
Esempio n. 14
0
/**
 * renderGui
 *
 */
function renderGui(&$argsObj, $guiObj, $opObj, $templateCfg, $editorCfg)
{
    $smartyObj = new TLSmarty();
    $renderType = 'none';
    $tpl = $tpd = null;
    $actionOperation = array('create' => 'doCreate', 'edit' => 'doUpdate', 'doDelete' => '', 'doReorder' => '', 'reorder' => '', 'doCreate' => 'doCreate', 'doUpdate' => 'doUpdate', 'createChild' => 'doCreate', 'copy' => 'doCopy', 'doCopy' => 'doCopy', 'doFreeze' => 'doFreeze', 'copyRequirements' => 'doCopyRequirements', 'doCopyRequirements' => 'doCopyRequirements', 'doCreateRevision' => 'doCreateRevision');
    // ------------------------------------------------------------------------------------------------
    // Web Editor Processing
    $owebEditor = web_editor('scope', $argsObj->basehref, $editorCfg);
    switch ($argsObj->doAction) {
        case "edit":
        case "doCreate":
            $owebEditor->Value = $argsObj->scope;
            break;
        default:
            // TICKET 4661
            if ($opObj->askForRevision || $opObj->askForLog || !$opObj->action_status_ok) {
                $owebEditor->Value = $argsObj->scope;
            } else {
                $owebEditor->Value = getItemTemplateContents('req_spec_template', $owebEditor->InstanceName, $argsObj->scope);
            }
            break;
    }
    $guiObj->scope = $owebEditor->CreateHTML();
    $guiObj->editorType = $editorCfg['type'];
    // Tree refresh Processing
    switch ($argsObj->doAction) {
        case "doCreate":
        case "doUpdate":
        case "doCopyRequirements":
        case "doCopy":
        case "doFreeze":
        case "doDelete":
            $guiObj->refreshTree = $argsObj->refreshTree;
            break;
    }
    // GUI rendering Processing
    switch ($argsObj->doAction) {
        case "edit":
        case "create":
        case "createChild":
        case "reorder":
        case "doDelete":
        case "doReorder":
        case "doCreate":
        case "doUpdate":
        case "copyRequirements":
        case "doCopyRequirements":
        case "copy":
        case "doCopy":
        case "doFreeze":
        case "doCreateRevision":
            $renderType = 'template';
            $key2loop = get_object_vars($opObj);
            if ($opObj->action_status_ok == false) {
                // Remember that scope normally is a WebRichEditor, and that
                // we have already processed WebRichEditor
                // Need to understand if remove of scope key can be done always
                // no matter action_status_ok
                unset($key2loop['scope']);
            }
            foreach ($key2loop as $key => $value) {
                $guiObj->{$key} = $value;
            }
            $guiObj->operation = $actionOperation[$argsObj->doAction];
            $tpl = is_null($opObj->template) ? $templateCfg->default_template : $opObj->template;
            $tpd = isset($key2loop['template_dir']) ? $opObj->template_dir : $templateCfg->template_dir;
            $pos = strpos($tpl, '.php');
            if ($pos === false) {
                $tpl = $tpd . $tpl;
            } else {
                $renderType = 'redirect';
            }
            break;
    }
    switch ($renderType) {
        case 'template':
            $smartyObj->assign('mgt_view_events', $argsObj->user->hasRights($db, "mgt_view_events"));
            $smartyObj->assign('gui', $guiObj);
            $smartyObj->display($tpl);
            break;
        case 'redirect':
            header("Location: {$tpl}");
            exit;
            break;
        default:
            echo '$argsObj->doAction:' . $argsObj->doAction . ' Can not process RENDERING!!!';
            break;
    }
}
 function createWebEditors($basehref, $editorCfg, $editorSet = null)
 {
     // Rows and Cols configuration
     $cols = array('notes' => array('horizontal' => 38, 'vertical' => 44));
     $owe = new stdClass();
     $owe->cfg = array('notes' => array('rows' => null, 'cols' => null));
     $owe->editor = array();
     if (is_null($basehref) || trim($basehref) == '') {
         throw new Exception(__METHOD__ . ' basehref can NOT BE EMPTY.');
     }
     $force_create = is_null($editorSet);
     foreach ($owe->cfg as $key => $value) {
         if ($force_create || isset($editorSet[$key])) {
             $owe->editor[$key] = web_editor($key, $basehref, $editorCfg);
         } else {
             unset($owe->cfg[$key]);
         }
     }
     return $owe;
 }
Esempio n. 16
0
/**
 *
 *
 */
function initWebEditors(&$guiObj, $cfgObj, $baseHREF)
{
    if ($guiObj->can_use_bulk_op) {
        $of = web_editor("bulk_exec_notes", $baseHREF, $cfgObj->editorCfg);
        $of->Value = getItemTemplateContents('execution_template', $of->InstanceName, null);
        // Magic numbers that can be determined by trial and error
        $cols = intval(isset($editorCfg['cols']) ? $cfgObj->editorCfg['cols'] : 60);
        $rows = intval(isset($editorCfg['rows']) ? $cfgObj->editorCfg['rows'] : 10);
        $guiObj->bulk_exec_notes_editor = $of->CreateHTML($rows, $cols);
        unset($of);
    } else {
        $guiObj->exec_notes_editors = createExecNotesWebEditor($guiObj->map_last_exec, $baseHREF, $cfgObj->editorCfg);
    }
}