/** * Display simple info and exit * * @param string $title * @param string $message */ function displayInfo($title, $message) { $smarty = new TLSmarty(); $smarty->assign('title', $title); $smarty->assign('content', $message); $smarty->display('workAreaSimple.tpl'); exit; }
/** * Display simple info and exit * * @param string $title * @param string $message */ function displayInfo($title, $message) { $smarty = new TLSmarty(); $gui = new stdClass(); $gui->title = $title; $gui->content = $message; $gui->hint_text = $gui->link_to_op = ''; $smarty->assign('gui', $gui); $smarty->display('workAreaSimple.tpl'); exit; }
/** */ function renderGui(&$dbHandler, &$argsObj, $guiObj, $opObj, $templateCfg) { $smartyObj = new TLSmarty(); $renderType = 'none'; // key: gui action // value: next gui action (used to set value of action button on gui) $actionOperation = array('create' => 'doCreate', 'edit' => 'doUpdate', 'doDelete' => '', 'doCreate' => 'doCreate', 'doUpdate' => 'doUpdate'); // Get rendering type and set variable for template switch ($argsObj->doAction) { case "edit": case "create": case "doDelete": case "doCreate": case "doUpdate": $key2loop = get_object_vars($opObj); foreach ($key2loop as $key => $value) { $guiObj->{$key} = $value; } $guiObj->operation = $actionOperation[$argsObj->doAction]; $renderType = 'redirect'; $tpl = is_null($opObj->template) ? $templateCfg->default_template : $opObj->template; $pos = strpos($tpl, '.php'); if ($pos === false) { $tplDir = !isset($opObj->template_dir) || is_null($opObj->template_dir) ? $templateCfg->template_dir : $opObj->template_dir; $tpl = $tplDir . $tpl; $renderType = 'template'; } break; } // execute rendering // new dBug($tpl); // new dBug($guiObj); switch ($renderType) { case 'template': $smartyObj->assign('gui', $guiObj); $smartyObj->display($tpl); break; case 'redirect': header("Location: {$tpl}"); exit; break; default: break; } }
/** * * */ function displayReport($template_file, &$smarty, $doc_format, $mailCfg = null) { switch ($doc_format) { case FORMAT_HTML: case FORMAT_ODT: case FORMAT_ODS: case FORMAT_XLS: case FORMAT_MSWORD: case FORMAT_PDF: flushHttpHeader($doc_format, $doc_kind = 0); break; case FORMAT_MAIL_HTML: $op = generateHtmlEmail($smarty, $template_file, $mailCfg); $message = $op->status_ok ? '' : lang_get('send_mail_ko'); $smarty = new TLSmarty(); $smarty->assign('message', $message . ' ' . $op->msg); $smarty->assign('title', $mailCfg->subject); $template_file = "emailSent.tpl"; break; } $smarty->display($template_file); }
$phase = $_POST['phaseName']; } else { $errStr = "<h1>Phase Name: PR-" . $_POST['phaseName'] . " updated succesfully!!!</h1>"; } } else { $errStr .= "Build or phase is empty"; } mysql_close($link); } } else { $errStr = ""; } $smarty = new TLSmarty(); $smarty->assign('valid_user', $arr[0]); $smarty->assign('none', $arr[1]); $smarty->assign('userString', $arr[2]); $smarty->assign('errString', $errStr); $smarty->assign('submitPHP', "resultCons.php"); $smarty->assign('searchPHP', "resultCons.php"); $smarty->assign('regr', "regression"); $smarty->assign('tableHeader', $tableHeader); $smarty->assign('columnCount', "10"); $smarty->assign('regReq', $regReq); $smarty->assign('builds', $builds); $smarty->assign('phaser', $phase); $smarty->assign('submit', $submit); $smarty->display('resultCons.tpl'); ?>
} $gui->items = $out['spec_view']; // useful to avoid error messages on smarty template. $gui->items_qty = is_null($gui->items) ? 0 : count($gui->items); $gui->has_tc = $out['num_tc'] > 0 ? 1 : 0; $gui->support_array = array_keys($gui->items); if ($_SESSION['testprojectOptions']->testPriorityEnabled) { $urgencyCfg = config_get('urgency'); $gui->priority_labels = init_labels($urgencyCfg["code_label"]); } // Changing to _flat template $tpl = $templateCfg->template_dir . $templateCfg->default_template; $tpl = str_replace('.tpl', '_flat.tpl', $tpl); $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display($tpl); /* function: args : returns: */ function init_args() { $_REQUEST = strings_stripSlashes($_REQUEST); $args = new stdClass(); $args->user_id = intval($_SESSION['userID']); $args->tproject_id = intval($_SESSION['testprojectID']); $args->tproject_name = $_SESSION['testprojectName']; $key2loop = array('doActionButton' => null, 'doAction' => null, 'level' => null, 'achecked_tc' => null, 'version_id' => 0, 'has_prev_assignment' => null, 'send_mail' => false, 'tester_for_tcid' => null, 'feature_id' => null, 'id' => 0); foreach ($key2loop as $key => $value) {
require_once "common.php"; require_once "web_editor.php"; $editorCfg = getWebEditorCfg('testplan'); require_once require_web_editor($editorCfg['type']); testlinkInitPage($db, false, false, "checkRights"); $templateCfg = templateConfiguration(); $tplan_mgr = new testplan($db); $tproject_mgr = new testproject($db); $smarty = new TLSmarty(); $do_display = false; $template = null; $args = init_args($_REQUEST); if (!$args->tproject_id) { $smarty->assign('title', lang_get('fatal_page_title')); $smarty->assign('content', lang_get('error_no_testprojects_present')); $smarty->display('workAreaSimple.tpl'); exit; } $gui = initializeGui($db, $args, $editorCfg, $tproject_mgr); $of = web_editor('notes', $_SESSION['basehref'], $editorCfg); $of->Value = getItemTemplateContents('testplan_template', $of->InstanceName, $args->notes); // Checks on testplan name, and testplan name<=>testplan id if ($args->do_action == "do_create" || $args->do_action == "do_update") { $gui->testplan_name = $args->testplan_name; $name_exists = $tproject_mgr->check_tplan_name_existence($args->tproject_id, $args->testplan_name); $name_id_rel_ok = isset($gui->tplans[$args->tplan_id]) && $gui->tplans[$args->tplan_id]['name'] == $args->testplan_name; } // interface changes to be able to do not loose CF values if some problem arise on User Interface $gui->cfields = $tplan_mgr->html_table_of_custom_field_inputs($args->tplan_id, $args->tproject_id, 'design', '', $_REQUEST); switch ($args->do_action) { case 'fileUpload':
case "create": $op = $action($args, $gui, $platform_mgr); $of->Value = $gui->notes; break; } if ($op->status == 1) { $default_template = $op->template; $gui->user_feedback['message'] = $op->user_feedback; } else { $gui->user_feedback['message'] = getErrorMessage($op->status, $args->name); $gui->user_feedback['type'] = 'ERROR'; } $gui->platforms = $platform_mgr->getAll(array('include_linked_count' => true)); $gui->notes = $of->CreateHTML(); $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . $default_template); /** * * */ 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"];
$index++; } } } } } ########################################################################################################################### # Save Baseline Counts to DB for entire build in one shot if ($_REQUEST[baseline]) { createBaseline($moduleArr, $version, $build, $regr); } ########################################################################################################################### $smarty = new TLSmarty(); $smarty->assign('gren', $gren); $smarty->assign('rap', $rap); $smarty->assign('regr', $regr); $smarty->assign('moduleArr', $moduleArr); $smarty->assign('isbased', $isBaselined); $smarty->assign('version', $version); $smarty->assign('build', $build); $smarty->assign('count', count($cases)); $smarty->assign('valid_user', $arr[0]); $smarty->assign('none', $arr[1]); $smarty->assign('userString', $arr[2]); $smarty->assign('userLogin', $_POST[username]); $smarty->assign('submitPHP', "modules.php?regr={$regr}&rap=" . $rap . "&gren=" . $gren . "&version=" . $version . "&build=" . $build . "&platform=" . $platform); $smarty->display('modules.tpl'); ########################################################################################################################### ?>
* @copyright 2007-2013, TestLink community * @link http://www.teamst.org/index.php * * @internal revisions * @since 1.9.7 * **/ require_once "../../config.inc.php"; require_once "../functions/common.php"; testlinkInitPage($db); $templateCfg = templateConfiguration(); $args = init_args(); $gui = initializeGui($db, $args); $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . 'tcSearchForm.tpl'); /** * * */ function init_args() { $args = new stdClass(); $args->tprojectID = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0; $args->tprojectName = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : 0; if ($args->tprojectID <= 0) { throw new Exception("Error Processing Request - Invalid Test project id " . __FILE__); } return $args; } function initializeGui(&$dbHandler, &$argsObj)
/** * 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); }
} } else { $noPrev = "none"; } ///////////////////////////////////////////////////////////////////////////// if ($_GET[week] == "") { $noNext = "none"; } else { $noNext = ""; } if ($from == 30 && $to == -1) { $noNext = "none"; } krsort($releaseTables[releases], SORT_NUMERIC); $smarty = new TLSmarty(); $smarty->assign('releaseTables', $releaseTables); $smarty->assign('releaseCount', count($arrData)); $smarty->assign('valid_user', $arr[0]); $smarty->assign('none', $arr[1]); $smarty->assign('userString', $arr[2]); $smarty->assign('to', $to); $smarty->assign('from', $from); $smarty->assign('private', "&private=yes"); $smarty->assign('noNext', $noNext); $smarty->assign('searchPHP', "searchBuild.php"); $smarty->assign('submitPHP', "private.php"); $smarty->assign('totalColLabel', "Total Private Runs"); $smarty->assign('columnHide', ""); $smarty->assign('columnCount', "11"); $smarty->display('index.tpl');
/** * 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; } }
// When TL undertand that session exists but has expired // is OK to call login with expired indication, but is not this case // // Dev Notes: // may be we are going to login.php and it will call us again! redirect(TL_BASE_HREF . "login.php"); exit; } // We arrive to these lines only if we are logged in // // Calling testlinkInitPage() I'm doing what we do on navBar.php // navBar.php is called via main.tpl // testlinkInitPage($db,('initProject' == 'initProject')); $tplEngine = new TLSmarty(); $tplEngine->assign('gui', $gui); $tplEngine->display('main.tpl'); /** * * */ function initEnv() { $iParams = array("reqURI" => array(tlInputParameter::STRING_N, 0, 4000)); $pParams = G_PARAMS($iParams); $args = new stdClass(); $args->reqURI = $pParams["reqURI"] != '' ? $pParams["reqURI"] : 'lib/general/mainPage.php'; $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0; $args->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0; $gui = new stdClass(); $gui->title = lang_get('main_page_title'); $gui->titleframe = "lib/general/navBar.php?tproject_id={$args->tproject_id}&tplan_id={$args->tplan_id}" . "&updateMainPage=1";
testlinkInitPage($db, false, false, "checkRights"); $args = init_args(); $deleteDone = false; if ($args->id) { $attachmentRepository = tlAttachmentRepository::create($db); $attachmentInfo = $attachmentRepository->getAttachmentInfo($args->id); if ($attachmentInfo && checkAttachmentID($db, $args->id, $attachmentInfo)) { $deleteDone = $attachmentRepository->deleteAttachment($args->id, $attachmentInfo); if ($deleteDone) { logAuditEvent(TLS("audit_attachment_deleted", $attachmentInfo['title']), "DELETE", $args->id, "attachments"); } } } $smarty = new TLSmarty(); $smarty->assign('bDeleted', $deleteDone); $smarty->display('attachmentdelete.tpl'); /** * @return object returns the arguments for the page */ function init_args() { //the id (attachments.id) of the attachment to be deleted $iParams = array("id" => array(tlInputParameter::INT_N)); $args = new stdClass(); G_PARAMS($iParams, $args); return $args; } /** * @param $db resource the database connection handle * @param $user the current active user *
$smarty->assign('buildTableOAWRap', $buildTableOAWRap); $smarty->assign('tableHeaderRap', $tableHeaderRap); $smarty->assign('columnCountRap', "11"); $smarty->assign('errStringRap', $errStrRap); // Rap Reg values $smarty->assign('buildTableRapReg', $buildTableRapReg); $smarty->assign('buildTableOAWRapReg', $buildTableOAWRapReg); $smarty->assign('tableHeaderRapReg', $tableHeaderRapReg); $smarty->assign('columnCountRapReg', "10"); $smarty->assign('errStringRapReg', $errStrRapReg); // Gren values $smarty->assign('buildTableGren', $buildTableGren); $smarty->assign('buildTableOAWGren', $buildTableOAWGren); $smarty->assign('tableHeaderGren', $tableHeaderGren); $smarty->assign('columnCountGren', "11"); $smarty->assign('errStringGren', $errStrGren); // Gren Reg values $smarty->assign('buildTableGrenReg', $buildTableGrenReg); $smarty->assign('buildTableOAWGrenReg', $buildTableOAWGrenReg); $smarty->assign('tableHeaderGrenReg', $tableHeaderGrenReg); $smarty->assign('columnCountGrenReg', "10"); $smarty->assign('errStringGrenReg', $errStrGrenReg); if ($_GET['buildID'] == "") { $smarty->assign('no_results', 1); } elseif ($buildTable == "" && $buildTableOAW == "" && $buildTableReg == "" && $buildTableOAWReg == "" && $buildTableRap == "" && $buildTableOAWRap == "" && $buildTableRapReg == "" && $buildTableOAWRapReg == "" && $buildTableGren == "" && $buildTableOAWGren == "" && $buildTableGrenReg == "" && $buildTableOAWGrenReg == "") { $smarty->assign('no_results', 2); } else { $smarty->assign('no_results', 0); } $smarty->display('search.tpl');
require_once 'testproject.class.php'; require_once 'users.inc.php'; testlinkInitPage($db, true); $smarty = new TLSmarty(); $smarty->assign('title', lang_get('main_page_title')); // display outer or inner frame? if (!isset($_GET['load'])) { // display outer frame, pass parameters to next script call for inner frame $item = isset($_GET['item']) ? "item=" . $_GET['item'] : ''; $id = isset($_GET['id']) ? "&id=" . $_GET['id'] : ''; $tprojectPrefix = isset($_GET['tprojectPrefix']) ? "&tprojectPrefix=" . $_GET['tprojectPrefix'] : ''; $anchor = isset($_GET['anchor']) ? '&anchor=' . $_GET['anchor'] : ""; $version = isset($_GET['version']) ? "&version=" . $_GET['version'] : ''; $smarty->assign('titleframe', 'lib/general/navBar.php'); $smarty->assign('mainframe', 'linkto.php?' . $item . $id . $version . $tprojectPrefix . '&load' . $anchor); $smarty->display('main.tpl'); } else { // inner frame, parameters passed // figure out what to display // // key: item, value: url to tree management page $itemCode = array('req' => 'lib/requirements/reqSpecListTree.php', 'reqspec' => 'lib/requirements/reqSpecListTree.php', 'testcase' => 'lib/testcases/listTestCases.php?feature=edit_tc'); $op = array('status_ok' => true, 'msg' => ''); // First check for keys in _GET that MUST EXIST // key: key on _GET, value: labelID defined on strings.txt $mustKeys = array('tprojectPrefix' => 'testproject_not_set', 'item' => 'item_not_set', 'id' => 'id_not_set'); foreach ($mustKeys as $key => $labelID) { $op['status_ok'] = isset($_GET[$key]); if (!$op['status_ok']) { $op['msg'] = lang_get($labelID); break;
* @internal revision * @since 1.9.6 * */ require_once '../../config.inc.php'; require_once 'common.php'; require_once 'attachments.inc.php'; require_once 'requirements.inc.php'; require_once 'users.inc.php'; testlinkInitPage($db, false, false, "checkRights"); $templateCfg = templateConfiguration(); $args = init_args(); $gui = initialize_gui($db, $args); $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . 'reqViewRevisionRO.tpl'); /** * */ function init_args() { $iParams = array("item_id" => array(tlInputParameter::INT_N), "showReqSpecTitle" => array(tlInputParameter::INT_N)); $args = new stdClass(); R_PARAMS($iParams, $args); $args->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0; $args->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : null; $user = $_SESSION['currentUser']; $args->userID = $user->dbID; return $args; } /**
// get result for Alcatel build $buildDataOAW = createDataForRegBuild($_GET['buildID'] . "_OAW", $regType); if (is_array($buildDataOAW)) { writeRegBuildCasesToFile($buildDataOAW, $_GET['buildID'] . "_OAW", $regType); } $arrDataOAW = getDataForRegBuild($_GET['buildID'] . "_OAW", $regType); if (!is_array($arrData)) { $errStr = "BUILD '" . $_GET['buildID'] . "' is NOT FOUND!<br>PLEASE SEARCH ANOTHER BUILD!"; } else { $buildTable = createSearchRegBuildTable($arrData, $_GET['buildID'], $arr[1], 0, $regType); } if (is_array($arrDataOAW)) { $buildTableOAW = createSearchRegBuildTable($arrDataOAW, $_GET['buildID'] . "_OAW", $arr[1], 1, $regType); } } $tableHeader = "<tr>\r\n <th style=\"width: 3%\">Build</th>\r\n <th style=\"width: 5%\">Type</th>\r\n <th style=\"width: 3%\">Version</th>\r\n <th style=\"width: 3%\">Started</th>\r\n <th style=\"width: 23%\">Total-Pass-Fail</th>\r\n <th style=\"width: 4%\">RunStatus</th>\r\n <th style=\"width: 4%\">Analysis</th>\r\n <th style=\"width: 15%\">Chart</th>\r\n <th style=\"width: 37%\">Comments</th>\r\n <th style=\"width: 4%\">Bugs</th>\r\n </tr> \r\n <tr><td colspan=\"{\$columnCount}\"></td></tr>\r\n <tr><td colspan=\"{\$columnCount}\"></td></tr>\r\n <tr><td colspan=\"{\$columnCount}\"></td></tr>"; $smarty = new TLSmarty(); $smarty->assign('buildTable', $buildTable); $smarty->assign('buildTableOAW', $buildTableOAW); $smarty->assign('valid_user', $arr[0]); $smarty->assign('none', $arr[1]); $smarty->assign('userString', $arr[2]); $smarty->assign('errString', $errStr); $smarty->assign('buildID', $_GET['buildID']); $smarty->assign('submitPHP', "searchReg.php?regr={$regType}&buildID={$_GET['buildID']}"); $smarty->assign('searchPHP', "searchReg.php?regr={$regType}"); $smarty->assign('regr', $regType); $smarty->assign('tableHeader', $tableHeader); $smarty->assign('columnCount', "10"); $smarty->display('searchBuild.tpl');
$releaseTablesReg[releases][$name][buildTables][$buildID] = createGrenRegBuildTable($build, $buildID, $arr[1]); $buildCountID++; $regCount++; } $releaseTablesReg[releases][$name][releaseTable] = createReleaseTable($rel, $name, $relCountID, count($rel[builds]), $regCount); $buildCountID = 0; $releaseTablesReg[releases][$name][countID] = $relCountID; $relCountID++; } krsort($releaseTablesReg[releases], SORT_NUMERIC); } ///////////////////////////////////////////////////////////////////////////// $smarty = new TLSmarty(); $smarty->assign('releaseTables', $releaseTables); $smarty->assign('releaseTablesReg', $releaseTablesReg); $smarty->assign('releaseCount', count($arrData)); $smarty->assign('releaseCountReg', count($arrDataReg)); $smarty->assign('startRegID', 50); $smarty->assign('valid_user', $arr[0]); $smarty->assign('none', $arr[1]); $smarty->assign('userString', $arr[2]); $smarty->assign('to', $to); $smarty->assign('from', $from); $smarty->assign('noNext', $noNext); $smarty->assign('searchPHP', "search.php"); $smarty->assign('submitPHP', "gren.php"); $smarty->assign('totalColLabel', "Total Smoke Runs"); $smarty->assign('columnHide', ""); $smarty->assign('columnCount', "11"); $smarty->display('gren.tpl');
<?php /** * TestLink Open Source Project - http://testlink.sourceforge.net/ * This script is distributed under the GNU General Public License 2 or later. * * @version $Id: project_req_spec_mgmt.php,v 1.6 2009/01/07 19:55:35 schlundus Exp $ * @author Martin Havlat * * Allows you to show test suites, test cases. * Normally launched from tree navigator. * */ require_once '../../config.inc.php'; require_once 'common.php'; testlinkInitPage($db, false, false, "checkRights"); $tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0; $tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : 'undefined'; $gui = new stdClass(); $gui->main_descr = lang_get('testproject') . TITLE_SEP . $tproject_name; $gui->tproject_id = $tproject_id; $gui->refresh_tree = 'no'; $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display('requirements/project_req_spec_mgmt.tpl'); function checkRights(&$db, &$user) { return $user->hasRight($db, 'mgt_view_req') && $user->hasRight($db, 'mgt_modify_req'); }
while ($myrow = mysql_fetch_assoc($result)) { $data[runID][$myrow['runID']] = $myrow; $limitedRunIDs[] = $myrow['runID']; if (!isset($machine[$myrow['runMachineID']])) { list($ip, $client, $hostnameID, $hostname) = getMachineInfo($myrow['runID']); $machine[$hostnameID][ip] = $ip; $machine[$hostnameID][client] = $client; $machine[$hostnameID][hostnameID] = $hostnameID; $machine[$hostnameID][hostname] = $hostname; } $data[runID][$myrow['runID']][machineIPAddr] = $machine[$myrow['runMachineID']][ip]; $data[runID][$myrow['runID']][p4Client] = $machine[$myrow['runMachineID']][client]; $data[runID][$myrow['runID']][hostname] = $machine[$myrow['runMachineID']][hostname]; $data[runID][$myrow['runID']][scriptCount] = 0; $data[runID][$myrow['runID']][caseCount] = 0; $data[runID][$myrow['runID']][scripts][passed] = 0; } } getTestScriptResults($data, $condition, $limitedRunIDs); $smarty = new TLSmarty(); $smarty->assign("chosenQueueID", is_null($queueIDform) ? "" : $queueIDform); $smarty->assign("errors", $error); $smarty->assign("data", $data); # note: for the href to work you will need to edit gui/javascript/highlightTableRow.js # in order to propery set the <rowname>href attribute $spanInfo = array(array(id => "runID", show => "yes", message => "runID", colName => "runID", tdTag => 'id="runID" width="6%"', href => 'smokeruns_ts.php?runID={$data.runID.$runID.runID}'), array(id => "versioncolumn", show => "yes", message => "Version", colName => "versionDottedQuad"), array(id => "buildcolumn", show => "yes", message => "Build", colName => "buildNum"), array(id => "purpose", show => "no", message => "Purpose", colName => "runPurpose"), array(id => "user", show => "yes", message => "User", colName => "NTID"), array(id => "total", show => "yes", message => "Total", colName => "scriptCount"), array(id => "passed", show => "yes", message => "Passed", evalColName => '{$data.runID.$runID.scripts.passed}'), array(id => "status", show => "yes", color => "yes", message => "Status", colName => "runStatus"), array(id => "machine", show => "no", message => "Where Run", colName => "hostname"), array(id => "cli", show => "no", color => "no", tdTag => 'class="cli"', message => "Command Line", colName => "runExecuteMethod")); $smarty->assign("spaninfo", $spanInfo); $smarty->display('smokeruns.tpl'); ?>
$testprojectRole = $args->user->globalRole->getDisplayName(); } $gui->whoami = $args->user->getDisplayName() . ' ' . $tlCfg->gui->role_separator_open . $testprojectRole . $tlCfg->gui->role_separator_close; // only when the user has changed project using the combo the _GET has this key. // Use this clue to launch a refresh of other frames present on the screen // using the onload HTML body attribute $gui->updateMainPage = 0; if ($args->testproject) { $gui->updateMainPage = 1; // set test project ID for the next session setcookie('TL_lastTestProjectForUserID_' . $args->user->dbID, $args->testproject, TL_COOKIE_KEEPTIME, '/'); } $gui->grants = getGrants($db, $args->user); $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display('navBar.tpl'); /** * */ function getGrants(&$db, &$userObj) { $grants = new stdClass(); $grants->view_testcase_spec = $userObj->hasRight($db, "mgt_view_tc"); return $grants; } function init_args() { $iParams = array("testproject" => array(tlInputParameter::INT_N)); $args = new stdClass(); $pParams = G_PARAMS($iParams, $args); $args->user = $_SESSION['currentUser'];
$gui->url = array('metrics_dashboard' => 'lib/results/metricsDashboard.php', 'testcase_assignments' => 'lib/testcases/tcAssignedToUser.php'); $gui->launcher = 'lib/general/frmWorkArea.php'; $gui->arrPlans = $arrPlans; $gui->countPlans = count($gui->arrPlans); $gui->testprojectID = $testprojectID; $gui->testplanID = $testplanID; $gui->docs = config_get('userDocOnDesktop') ? getUserDocumentation() : null; $secCfg = config_get('config_check_warning_frequence'); $gui->securityNotes = ''; if (strcmp($secCfg, 'ALWAYS') == 0 || strcmp($secCfg, 'ONCE_FOR_SESSION') == 0 && !isset($_SESSION['getSecurityNotesOnMainPageDone'])) { $_SESSION['getSecurityNotesOnMainPageDone'] = 1; $gui->securityNotes = getSecurityNotes($db); } $gui->opt_requirements = isset($_SESSION['testprojectOptions']->requirementsEnabled) ? $_SESSION['testprojectOptions']->requirementsEnabled : null; $smarty->assign('gui', $gui); $smarty->display('mainPage.tpl'); /** * Get User Documentation * based on contribution by Eugenia Drosdezki */ function getUserDocumentation() { $target_dir = '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'docs'; $documents = null; if ($handle = opendir($target_dir)) { while (false !== ($file = readdir($handle))) { clearstatcache(); if ($file != "." && $file != "..") { if (is_file($target_dir . DIRECTORY_SEPARATOR . $file)) { $documents[] = $file; }
/** * manage GUI rendering * */ function renderGui(&$argsObj, $guiObj, $opObj, $templateCfg, $cfgObj, $edit_steps) { $smartyObj = new TLSmarty(); // need by webeditor loading logic present on inc_head.tpl $smartyObj->assign('editorType', $guiObj->editorType); $renderType = 'none'; // // key: operation requested (normally received from GUI on doAction) // value: operation value to set on doAction HTML INPUT // This is useful when you use same template (example xxEdit.tpl), for create and edit. // When template is used for create -> operation: doCreate. // When template is used for edit -> operation: doUpdate. // // used to set value of: $guiObj->operation // $actionOperation = array('create' => 'doCreate', 'doCreate' => 'doCreate', 'edit' => 'doUpdate', 'delete' => 'doDelete', 'doDelete' => '', 'createStep' => 'doCreateStep', 'doCreateStep' => 'doCreateStep', 'doCopyStep' => 'doUpdateStep', 'editStep' => 'doUpdateStep', 'doUpdateStep' => 'doUpdateStep', 'doDeleteStep' => '', 'doReorderSteps' => '', 'doInsertStep' => 'doUpdateStep'); $key2work = 'initWebEditorFromTemplate'; $initWebEditorFromTemplate = property_exists($opObj, $key2work) ? $opObj->{$key2work} : false; $key2work = 'cleanUpWebEditor'; $cleanUpWebEditor = property_exists($opObj, $key2work) ? $opObj->{$key2work} : false; $oWebEditor = createWebEditors($argsObj->basehref, $cfgObj->webEditorCfg, null, $edit_steps); foreach ($oWebEditor->cfg as $key => $value) { $of =& $oWebEditor->editor[$key]; $rows = $oWebEditor->cfg[$key]['rows']; $cols = $oWebEditor->cfg[$key]['cols']; switch ($argsObj->doAction) { case "edit": case "delete": case "editStep": $initWebEditorFromTemplate = false; $of->Value = $argsObj->{$key}; break; case "doCreate": case "doDelete": case "doCopyStep": case "doUpdateStep": $initWebEditorFromTemplate = false; $of->Value = $argsObj->{$key}; break; case "create": case "doCreateStep": case "doInsertStep": default: $initWebEditorFromTemplate = true; break; } $guiObj->operation = $actionOperation[$argsObj->doAction]; if ($initWebEditorFromTemplate) { $of->Value = getItemTemplateContents('testcase_template', $of->InstanceName, ''); } else { if ($cleanUpWebEditor) { $of->Value = ''; } } $smartyObj->assign($key, $of->CreateHTML($rows, $cols)); } // manage tree refresh switch ($argsObj->doAction) { case "doDelete": $guiObj->refreshTree = $argsObj->refreshTree; break; } switch ($argsObj->doAction) { case "edit": case "create": case "delete": case "createStep": case "editStep": case "doCreate": case "doDelete": case "doCreateStep": case "doUpdateStep": case "doDeleteStep": case "doReorderSteps": case "doCopyStep": case "doInsertStep": $renderType = 'template'; // Document !!!! $key2loop = get_object_vars($opObj); foreach ($key2loop as $key => $value) { $guiObj->{$key} = $value; } $guiObj->operation = $actionOperation[$argsObj->doAction]; new dBug($opObj); $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; } switch ($renderType) { case 'template': new dBug($tpl); $smartyObj->assign('gui', $guiObj); $smartyObj->display($tpl); break; case 'redirect': header("Location: {$tpl}"); exit; break; default: break; } }
header("Cache-Control: "); if (!(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" && preg_match("/MSIE/", $_SERVER["HTTP_USER_AGENT"]))) { header('Pragma: no-cache'); } header('Content-Type: ' . $attachmentInfo['file_type']); header('Content-Length: ' . $attachmentInfo['file_size']); header("Content-Disposition: inline; filename=\"{$attachmentInfo['file_name']}\""); header("Content-Description: Download Data"); echo $content; exit; } } } $smarty = new TLSmarty(); $smarty->assign('gui', $args); $smarty->display('attachment404.tpl'); /** * @return object returns the arguments for the page */ function init_args() { //the id (attachments.id) of the attachment to be downloaded $iParams = array("id" => array(tlInputParameter::INT_N), 'skipCheck' => array(tlInputParameter::INT_N)); $args = new stdClass(); G_PARAMS($iParams, $args); return $args; } /** * @param $db resource the database connection handle * @param $user the current active user * @return boolean returns true if the page can be accessed
setPaths(); $validSession = checkSessionValid($db, false); // Send a json reply, include localized strings for use in js to display a login form. echo json_encode(array('validSession' => $validSession, 'username_label' => lang_get('login_name'), 'password_label' => lang_get('password'), 'login_label' => lang_get('btn_login'))); break; case 'loginform': $doRender = true; break; } // BUGID 0003129 if ($doRender) { $logPeriodToDelete = config_get('removeEventsOlderThan'); $g_tlLogger->deleteEventsFor(null, strtotime("-{$logPeriodToDelete} days UTC")); $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display($templateCfg->default_template); } /** * * */ function init_args() { $iParams = array("note" => array(tlInputParameter::STRING_N, 0, 255), "tl_login" => array(tlInputParameter::STRING_N, 0, 30), "tl_password" => array(tlInputParameter::STRING_N, 0, 32), "req" => array(tlInputParameter::STRING_N, 0, 4000), "reqURI" => array(tlInputParameter::STRING_N, 0, 4000), "action" => array(tlInputParameter::STRING_N, 0, 10)); $pParams = R_PARAMS($iParams); $args = new stdClass(); $args->note = $pParams['note']; $args->login = $pParams['tl_login']; $args->pwd = $pParams['tl_password']; $args->reqURI = urlencode($pParams['req']); $args->preqURI = urlencode($pParams['reqURI']);
$casesUpDown[$caseID][countID] = $i; $i++; $time += $case[time]; if ($case[status] == "PASSED") { $passed++; } elseif ($case[status] != "RUNNING") { $failed++; } } $smarty = new TLSmarty(); $smarty->assign('flag', $flag); $smarty->assign('testcases', $casesUpDown); $smarty->assign('version', $version); $smarty->assign('build', $build); $smarty->assign('mod', $mod); $smarty->assign('cat', $cat); $smarty->assign('rap', $rap); $smarty->assign('gren', $gren); $smarty->assign('regr', $regression); $smarty->assign('relID', $relIDarg); $smarty->assign('updown', $updown); $smarty->assign('count', count($casesUpDown)); $smarty->assign('pass', $passed); $smarty->assign('fail', $failed); $smarty->assign('time', Sec2Time($time)); $smarty->assign('platform', $_GET['platform']); $smarty->assign('moduleArrUpDown', $results[0]); $smarty->assign('relNames', $results[1]); $smarty->assign('updownStatus', is_array($results) ? "" : "not_array"); $smarty->display('platform.tpl'); }
} } if ($addReqMgrSystem) { $imgSet = $smarty->getImages(); $loop2do = count($gui->tprojects); $labels = init_labels(array('active_integration' => null, 'inactive_integration' => null)); for ($idx = 0; $idx < $loop2do; $idx++) { $gui->tprojects[$idx]['rmsstatusImg'] = ''; if ($gui->tprojects[$idx]['rmsname'] != '') { $ak = $gui->tprojects[$idx]['reqmgr_integration_enabled'] ? 'active' : 'inactive'; $gui->tprojects[$idx]['rmsstatusImg'] = ' <img title="' . $labels[$ak . '_integration'] . '" ' . ' alt="' . $labels[$ak . '_integration'] . '" ' . ' src="' . $imgSet[$ak] . '"/>'; } } } $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . $template); break; case "ErrorOnAction": default: if ($args->doAction != "edit" && $args->doAction != "ErrorOnAction") { $of->Value = getItemTemplateContents('project_template', $of->InstanceName, $args->notes); } else { $of->Value = $args->notes; } foreach ($ui as $prop => $value) { $smarty->assign($prop, $value); } $smarty->assign('gui', $args); $smarty->assign('notes', $of->CreateHTML()); $smarty->assign('user_feedback', $user_feedback); $smarty->assign('feedback_type', $feedback_type);
*/ require_once '../../config.inc.php'; require_once "common.php"; require_once "treeMenu.inc.php"; testlinkInitPage($db); $templateCfg = templateConfiguration(); // new class for filter controlling/handling $control = new tlTestCaseFilterControl($db, 'edit_mode'); $gui = initializeGui($db, $control); $control->build_tree_menu($gui); $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->assign('control', $control); $smarty->assign('args', $control->get_argument_string()); $smarty->assign('menuUrl', $gui->menuUrl); $smarty->display($templateCfg->template_dir . 'tcTree.tpl'); /** * Initialize object with information for graphical user interface. * * @param tlTestCaseFilterControl $control * @return stdClass $gui */ function initializeGui(&$dbHandler, &$control) { $gui = new stdClass(); $gui->feature = $control->args->feature; $gui->treeHeader = lang_get('title_navigator') . ' - ' . lang_get('title_test_spec'); $feature_path = array('edit_tc' => "lib/testcases/archiveData.php", 'keywordsAssign' => "lib/keywords/keywordsAssign.php", 'assignReqs' => "lib/requirements/reqTcAssign.php"); $gui->tree_drag_and_drop_enabled = array('edit_tc' => has_rights($dbHandler, "mgt_modify_tc") == 'yes', 'keywordsAssign' => false, 'assignReqs' => false); $gui->menuUrl = $feature_path[$gui->feature]; return $gui;