PageRenderTime 79ms CodeModel.GetById 41ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/execute/execNavigator.php

https://bitbucket.org/pfernandez/testlink1.9.6
PHP | 739 lines | 26 code | 15 blank | 698 comment | 0 complexity | 6ebdf61c533ef1f805953e2a3056bb87 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, GPL-3.0
  1. <?php
  2. /**
  3. * TestLink Open Source Project - http://testlink.sourceforge.net/
  4. * This script is distributed under the GNU General Public License 2 or later.
  5. *
  6. * link/unlink test cases to a test plan
  7. *
  8. * @package TestLink
  9. * @copyright 2007-2009, TestLink community
  10. * @version CVS: $Id: execNavigator.php,v 1.119 2010/06/28 16:19:38 asimon83 Exp $
  11. * @filesource http://testlink.cvs.sourceforge.net/viewvc/testlink/testlink/lib/functions/object.class.php?view=markup
  12. * @link http://www.teamst.org/index.php
  13. *
  14. * @internal Revisions:
  15. * 20100628 - asimon - removal of constants from filter control class
  16. * 20100624 - asimon - CVS merge (experimental branch to HEAD)
  17. * 20100622 - asimon - huge refactoring for new filter design,
  18. * removed as much logic from here as possible
  19. * 20100609 - eloff - Prevent selection of invalid platform
  20. * 20100428 - asimon - BUGID 3301 and related issues - changed name or case
  21. * of some variables used in new common template
  22. * 20100417 - franciscom - BUGID 3380 execution type filter
  23. * 20100409 - eloff - BUGID 3050 - remember selected platform and build in session
  24. * 20100222 - asimon - fixes in initializeGui() for testplan select box when there are no builds
  25. * 20100217 - asimon - added check for open builds on initBuildInfo()
  26. * 20100202 - asimon - changed filtering, BUGID 2455, BUGID 3026
  27. * 20090828 - franciscom - added contribution platform feature
  28. * 20090828 - franciscom - BUGID 2296 - filter by Last Exec Result on Any of previous builds
  29. * 20081227 - franciscom - BUGID 1913 - filter by same results on ALL previous builds
  30. * 20081220 - franciscom - advanced/simple filters
  31. * 20081217 - franciscom - only users that have effective role with right
  32. * that allow test case execution are displayed on
  33. * filter by user combo.
  34. *
  35. * 20080517 - franciscom - fixed testcase filter bug
  36. * 20080428 - franciscom - keyword filter can be done on multiple keywords
  37. * 20080224 - franciscom - refactoring
  38. * 20080224 - franciscom - BUGID 1056
  39. *
  40. **/
  41. require_once('../../config.inc.php');
  42. require_once('common.php');
  43. require_once("users.inc.php");
  44. require_once('treeMenu.inc.php');
  45. require_once('exec.inc.php');
  46. testlinkInitPage($db);
  47. $templateCfg = templateConfiguration();
  48. $control = new tlTestCaseFilterControl($db, 'execution_mode');
  49. $gui = initializeGui($control);
  50. $control->build_tree_menu($gui);
  51. $smarty = new TLSmarty();
  52. $smarty->assign('gui',$gui);
  53. $smarty->assign('control', $control);
  54. $smarty->assign('menuUrl',$gui->menuUrl);
  55. $smarty->assign('args', $gui->args);
  56. $smarty->display($templateCfg->template_dir . $templateCfg->default_template);
  57. function initializeGui(&$control) {
  58. $gui = new stdClass();
  59. $gui->menuUrl = 'lib/execute/execSetResults.php';
  60. $gui->args = $control->get_argument_string();
  61. $gui->src_workframe = $control->args->basehref . $gui->menuUrl .
  62. "?edit=testproject&id={$control->args->testproject_id}" . $gui->args;
  63. return $gui;
  64. }
  65. // old file content
  66. //require_once('../../config.inc.php');
  67. //require_once('common.php');
  68. //require_once("users.inc.php");
  69. //require_once('treeMenu.inc.php');
  70. //require_once('exec.inc.php');
  71. //testlinkInitPage($db);
  72. //
  73. //
  74. //$templateCfg = templateConfiguration();
  75. //$cfg = getCfg();
  76. //$tproject_mgr = new testproject($db);
  77. //$tplan_mgr = new testplan($db);
  78. //$args = init_args($db,$cfg,$tproject_mgr,$tplan_mgr);
  79. //$exec_cfield_mgr = new exec_cfield_mgr($db,$args->tproject_id);
  80. //$platform_mgr = new tlPlatform($db, $args->tproject_id);
  81. //$gui = initializeGui($db,$args,$cfg,$exec_cfield_mgr,$tplan_mgr,$platform_mgr);
  82. //
  83. //buildAssigneeFilter($db,$gui,$args,$cfg);
  84. //
  85. //$treeMenu = buildTree($db,$gui,$args,$cfg,$exec_cfield_mgr);
  86. //$gui->tree = $treeMenu->menustring;
  87. //
  88. //if( !is_null($treeMenu->rootnode) )
  89. //{
  90. // $gui->ajaxTree = new stdClass();
  91. // $gui->ajaxTree->loader = '';
  92. // $gui->ajaxTree->root_node = new stdClass();
  93. // $gui->ajaxTree->root_node = $treeMenu->rootnode;
  94. // $gui->ajaxTree->children = $treeMenu->menustring;
  95. // $gui->ajaxTree->cookiePrefix = 'exec_tplan_id_' . $args->tplan_id;
  96. //}
  97. //
  98. //$smarty = new TLSmarty();
  99. //$smarty->assign('gui',$gui);
  100. //$smarty->assign('menuUrl',$gui->menuUrl);
  101. //$smarty->assign('args',$gui->args);
  102. //$smarty->assign('additionalArgs',$gui->additionalArgs);
  103. //
  104. //$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
  105. //
  106. //
  107. ///*
  108. // function:
  109. // args:
  110. // returns:
  111. //
  112. //*/
  113. //function init_args(&$dbHandler,$cfgObj, &$tprojectMgr, &$tplanMgr)
  114. //{
  115. // $_REQUEST = strings_stripSlashes($_REQUEST);
  116. // $args = new stdClass();
  117. //
  118. // $args->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
  119. // $args->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : '';
  120. // $args->user = $_SESSION['currentUser'];
  121. //
  122. // $args->tplan_id = isset($_SESSION['testplanID']) ? intval($_SESSION['testplanID']) : 0;
  123. // $args->tplan_name = isset($_SESSION['testplanName']) ? $_SESSION['testplanName'] : '';
  124. // if($args->tplan_id != 0)
  125. // {
  126. // $args->tplan_id = isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : $_SESSION['testplanID'];
  127. // $tplan_info = $tplanMgr->get_by_id($args->tplan_id);
  128. // $args->tplan_name = $tplan_info['name'];
  129. // }
  130. //
  131. // if($args->tplan_id != $_SESSION['testplanID']) {
  132. // //testplan was changed, so we reset the filters, they were chosen for another testplan
  133. // $keys2delete = array('tcase_id', 'targetTestCase', 'panelFiltersKeyword',
  134. // 'panelFiltersExecStatus','keywordsFilterType',
  135. // 'filter_method', 'filter_assigned_to', 'build_id', 'urgencyImportance',
  136. // 'filter_build_id', 'platform_id', 'include_unassigned', 'colored');
  137. // foreach ($keys2delete as $key) {
  138. // unset($_REQUEST[$key]);
  139. // }
  140. // $currentUser = $_SESSION['currentUser'];
  141. // $arrPlans = $currentUser->getAccessibleTestPlans($dbHandler,$args->tproject_id);
  142. // foreach ($arrPlans as $plan) {
  143. // if ($plan['id'] == $args->tplan_id) {
  144. // setSessionTestPlan($plan);
  145. // }
  146. // }
  147. // }
  148. //
  149. // // 20100524 - can not find where is used
  150. // // $args->treeColored = (isset($_REQUEST['colored']) && ($_REQUEST['colored'] == 'result')) ? 'selected="selected"' : null;
  151. //
  152. // $args->tcase_id = isset($_REQUEST['tcase_id']) ? intval($_REQUEST['tcase_id']) : null;
  153. //
  154. // $key = 'panelFiltersAdvancedFilterMode';
  155. // $args->$key = isset($_REQUEST[$key]) ? $_REQUEST[$key] : 0;
  156. //
  157. // // Attention: Is an array because is a multiselect
  158. // $key = 'panelFiltersKeyword';
  159. // $args->$key = isset($_REQUEST[$key]) ? $_REQUEST[$key] : 0;
  160. // $args->keywordsFilterType = isset($_REQUEST['keywordsFilterType']) ? $_REQUEST['keywordsFilterType'] : 'OR';
  161. //
  162. // $args->doUpdateTree = isset($_REQUEST['doUpdateTree']) ? 1 : 0;
  163. //
  164. // // 20081220 - franciscom
  165. // // Now can be multivalued
  166. // $key = 'panelFiltersExecStatus';
  167. // $args->$key = isset($_REQUEST[$key]) ? (array)$_REQUEST[$key] : null;
  168. // if( !is_null($args->$key) )
  169. // {
  170. // if( in_array($cfgObj->results['status_code']['all'], $args->$key) )
  171. // {
  172. // $args->$key = array($cfgObj->results['status_code']['all']);
  173. // }
  174. // else if( !$args->panelFiltersAdvancedFilterMode && count($args->$key) > 0)
  175. // {
  176. // // Because user has switched to simple mode we will get ONLY first status
  177. // $args->$key=array($args->$key[0]);
  178. // }
  179. // }
  180. //
  181. // // BUGID 2455
  182. // $filter_cfg = config_get('execution_filter_methods');
  183. // $args->filter_method_selected = isset($_REQUEST['filter_method']) ?
  184. // (array)$_REQUEST['filter_method'] : (array)$filter_cfg['default_type'];
  185. //
  186. // $user_filter_default = null;
  187. // switch($cfgObj->exec->user_filter_default)
  188. // {
  189. // case 'logged_user':
  190. // $user_filter_default = $args->user->dbID;
  191. // break;
  192. //
  193. // case 'none':
  194. // default:
  195. // break;
  196. // }
  197. //
  198. // $args->filter_assigned_to = isset($_REQUEST['filter_assigned_to']) ? $_REQUEST['filter_assigned_to'] : $user_filter_default;
  199. // if( !is_null($args->filter_assigned_to) )
  200. // {
  201. // $args->filter_assigned_to = (array)$args->filter_assigned_to;
  202. // if(in_array(TL_USER_ANYBODY, $args->filter_assigned_to))
  203. // {
  204. // $args->filter_assigned_to = array(TL_USER_ANYBODY);
  205. // }
  206. // else if(in_array(TL_USER_NOBODY, $args->filter_assigned_to))
  207. // {
  208. // $args->filter_assigned_to = array(TL_USER_NOBODY);
  209. // }
  210. // else if(!$args->panelFiltersAdvancedFilterMode && count($args->filter_assigned_to) > 0)
  211. // {
  212. // // Because user has switched to simple mode we will get ONLY first status
  213. // $args->filter_assigned_to=array($args->filter_assigned_to[0]);
  214. // }
  215. // }
  216. //
  217. // $args->urgencyImportance = isset($_REQUEST['urgencyImportance']) ? intval($_REQUEST['urgencyImportance']) : null;
  218. // if ($args->urgencyImportance == 0)
  219. // {
  220. // $args->urgencyImportance = null;
  221. // }
  222. //
  223. // // CRITIC: values assigned here will be used on functions initBuildInfo(), initPlatformInfo()
  224. // // if we can here we need to change functions
  225. //
  226. // // Set active platform (remember in session)
  227. // $args->optPlatformSelected = isset($_REQUEST['platform_id']) ? $_REQUEST['platform_id'] : null;
  228. // if (is_null($args->optPlatformSelected) && isset($_SESSION['platformID']))
  229. // {
  230. // $args->optPlatformSelected = intval($_SESSION['platformID']);
  231. // }
  232. // // Prevent selection of invalid platform
  233. // $platforms = $tplanMgr->getPlatforms($args->tplan_id,
  234. // array('outputFormat' => 'map'));
  235. // if (!array_key_exists($args->optPlatformSelected, $platforms))
  236. // {
  237. // $args->optPlatformSelected = null;
  238. // }
  239. //
  240. // // BUGID 3301 - added isset() checks in if statements for undefined errors in log
  241. // // because of undefined index warning in event log
  242. // // BUGID 3350 - inverted logic, working correctly now
  243. // if (!isset($_SESSION['platformID']) || $args->optPlatformSelected != $_SESSION['platformID'])
  244. // {
  245. // $_SESSION['platformID'] = $args->optPlatformSelected;
  246. // }
  247. //
  248. // // Set active build (remember in session)
  249. // $args->optBuildSelected = isset($_REQUEST['build_id']) ? $_REQUEST['build_id'] : -1;
  250. // if ($args->optBuildSelected == -1 && isset($_SESSION['buildID']))
  251. // {
  252. // $args->optBuildSelected = intval($_SESSION['buildID']);
  253. // }
  254. // if (!isset($_SESSION['buildID']) || $args->optBuildSelected != $_SESSION['buildID'])
  255. // {
  256. // $_SESSION['buildID'] = $args->optBuildSelected;
  257. // }
  258. // $args->optFilterBuildSelected = isset($_REQUEST['filter_build_id']) ? $_REQUEST['filter_build_id'] : -1;
  259. // $args->include_unassigned = isset($_REQUEST['include_unassigned']) ? $_REQUEST['include_unassigned'] : 0;
  260. //
  261. // // BUGID 3380
  262. // $key = 'panelFiltersExecType';
  263. // $args->$key = isset($_REQUEST[$key]) ? intval($_REQUEST[$key]) : 0;
  264. //
  265. // // BUGID 3301 - refresh on action logic borrowed from listTestCases.php
  266. // $args->tcspec_refresh_on_action = isset($_REQUEST['tcspec_refresh_on_action']) ?
  267. // $_REQUEST['tcspec_refresh_on_action'] : null;
  268. // $args->hidden_tcspec_refresh_on_action = isset($_REQUEST['hidden_tcspec_refresh_on_action']) ?
  269. // $_REQUEST['hidden_tcspec_refresh_on_action'] : null;
  270. // $args->do_refresh = "no";
  271. //
  272. // if (!is_null($args->hidden_tcspec_refresh_on_action))
  273. // {
  274. // if (!is_null($args->tcspec_refresh_on_action))
  275. // {
  276. // $args->do_refresh = $args->tcspec_refresh_on_action ? "yes" : "no";
  277. // }
  278. // }
  279. // else if (isset($_SESSION["tcspec_refresh_on_action"]))
  280. // {
  281. // $args->do_refresh = ($_SESSION["tcspec_refresh_on_action"] == "yes") ? "yes" : "no";
  282. // }
  283. // else
  284. // {
  285. // $args->do_refresh = ($cfgObj->spec->automatic_tree_refresh > 0) ? "yes": "no";
  286. // }
  287. // $_SESSION['tcspec_refresh_on_action'] = $args->do_refresh;
  288. //
  289. // return $args;
  290. //}
  291. //
  292. //
  293. ///**
  294. // * build arguments that will be passed to execSetResults.php
  295. // * with a http call
  296. // *
  297. // *
  298. // * @internal Revisions:
  299. // * 20090815 - franciscom - added platform feature (contribution)
  300. // */
  301. //function initializeGetArguments($argsObj,$cfgObj,$customFieldSelected)
  302. //{
  303. // $kl='';
  304. // $settings = '&build_id=' . $argsObj->optBuildSelected .
  305. // '&platform_id=' . $argsObj->optPlatformSelected .
  306. // '&include_unassigned=' . $argsObj->include_unassigned;
  307. //
  308. // if(is_array($argsObj->panelFiltersKeyword) && !in_array(0, $argsObj->panelFiltersKeyword))
  309. // {
  310. // $kl = implode(',',$argsObj->panelFiltersKeyword);
  311. // $settings .= '&keyword_id=' . $kl;
  312. // }
  313. // else if(!is_array($argsObj->panelFiltersKeyword) && $argsObj->panelFiltersKeyword > 0)
  314. // {
  315. // $settings .= '&keyword_id='.$argsObj->panelFiltersKeyword;
  316. // }
  317. // $settings .= '&keywordsFilterType='.$argsObj->keywordsFilterType;
  318. //
  319. // if($argsObj->tcase_id != 0)
  320. // {
  321. // $settings .= '&tc_id='.$argsObj->tcase_id;
  322. // }
  323. //
  324. // if ($argsObj->urgencyImportance > 0)
  325. // {
  326. // $settings .= "&urgencyImportance={$argsObj->urgencyImportance}";
  327. // }
  328. //
  329. // if( !is_null($argsObj->filter_assigned_to) &&
  330. // !in_array(TL_USER_ANYBODY,$argsObj->filter_assigned_to) )
  331. // {
  332. // $settings .= '&filter_assigned_to='. serialize($argsObj->filter_assigned_to);
  333. // }
  334. //
  335. // if( !is_null($argsObj->panelFiltersExecStatus) &&
  336. // !in_array($cfgObj->results['status_code']['all'],$argsObj->panelFiltersExecStatus) )
  337. // {
  338. // $settings .= '&filter_status='. serialize($argsObj->panelFiltersExecStatus);
  339. // }
  340. //
  341. // if ($customFieldSelected)
  342. // {
  343. // $settings .= '&cfields='. serialize($customFieldSelected);
  344. // }
  345. // return $settings;
  346. //}
  347. //
  348. //
  349. ///*
  350. // function:
  351. //
  352. // args :
  353. //
  354. // returns:
  355. //
  356. //*/
  357. //function getCfg()
  358. //{
  359. // $cfg = new stdClass();
  360. // $cfg->gui = config_get('gui');
  361. // $cfg->exec = config_get('exec_cfg');
  362. // $cfg->results = config_get('results');
  363. // $cfg->spec = config_get('spec_cfg');
  364. //
  365. // return $cfg;
  366. //}
  367. //
  368. //
  369. //
  370. ///*
  371. // function: buildAssigneeFilter
  372. //
  373. // args:
  374. //
  375. // returns:
  376. //
  377. //*/
  378. //function buildAssigneeFilter(&$dbHandler,&$guiObj,&$argsObj,$cfgObj)
  379. //{
  380. //
  381. // $guiObj->disable_filter_assigned_to = false;
  382. // $guiObj->assigned_to_user = '';
  383. //
  384. // $effective_role = $argsObj->user->getEffectiveRole($dbHandler,$argsObj->tproject_id,$argsObj->tplan_id);
  385. //
  386. // // 20081217 - franciscom
  387. // // If we check right 'testplan_execute', we do not get desired effect, because we are not able
  388. // // to treat in a different way a SIMPLE TESTER from a SENIOR TESTER.
  389. // // Possible solutions:
  390. // // 1- Check again a set of configurable roles
  391. // //
  392. // // 2- Create a set of execute rights, one that allows limited execution that is affected by
  393. // // exec->view_mode and exec->exec_mode, and other that is immune.
  394. // //
  395. // // 3- on execSetResults.php has been done
  396. // // Role is considered simple tester if:
  397. // // role == TL_ROLES_TESTER OR Role has Test Plan execute but not Test Plan planning
  398. // //
  399. // // 4- we can support option 1 and 2, or 1 and 3
  400. // //
  401. // //
  402. // //
  403. // $simple_tester_roles = array_flip($cfgObj->exec->simple_tester_roles);
  404. // $can_execute = $effective_role->hasRight('testplan_execute');
  405. // $can_manage = $effective_role->hasRight('testplan_planning');
  406. // $use_exec_cfg = isset($simple_tester_roles[$effective_role->dbID]) || ($can_execute && !$can_manage);
  407. // $exec_view_mode = $use_exec_cfg ? $cfgObj->exec->view_mode->tester : 'all';
  408. // switch ($exec_view_mode)
  409. // {
  410. // case 'all':
  411. // $guiObj->filterAssignedTo = is_null($argsObj->filter_assigned_to) ? null : $argsObj->filter_assigned_to;
  412. // break;
  413. //
  414. // case 'assigned_to_me':
  415. // $guiObj->disable_filter_assigned_to = true;
  416. // $argsObj->filter_assigned_to = (array)$argsObj->user->dbID;
  417. // $guiObj->filterAssignedTo = $argsObj->filter_assigned_to;
  418. // $guiObj->assigned_to_user = $argsObj->user->getDisplayName();
  419. // break;
  420. // }
  421. //}
  422. //
  423. //
  424. ///**
  425. // * Initialize a map with build info to choose as build to execute,
  426. // * for creating HTML Select in user interface.
  427. // * Load only active and open builds, no matter what role user has.
  428. // *
  429. // * @param resource &$dbHandler reference to database object
  430. // * @param stdClass &$argsObj reference to object with user input
  431. // * @param tlTestplan &$tplanMgr testplan manager object
  432. // * @return array $htmlSelect HTML-Select for build to execute selection
  433. // *
  434. // * @internal revisions:
  435. // * 20100217 - asimon - added also check for open status of builds,
  436. // * since builds have to be active AND open to be executed
  437. // *
  438. // */
  439. //function initBuildInfo(&$dbHandler,&$argsObj,&$tplanMgr)
  440. //{
  441. // $htmlSelect = array('items' => null, 'selected' => null);
  442. // $htmlSelect['items'] = $tplanMgr->get_builds_for_html_options($argsObj->tplan_id,
  443. // testplan::GET_ACTIVE_BUILD, testplan::GET_OPEN_BUILD);
  444. //
  445. // $maxBuildID = $tplanMgr->get_max_build_id($argsObj->tplan_id,
  446. // testplan::GET_ACTIVE_BUILD, testplan::GET_OPEN_BUILD);
  447. //
  448. // $argsObj->optBuildSelected = $argsObj->optBuildSelected > 0 ? $argsObj->optBuildSelected : $maxBuildID;
  449. // if (!$argsObj->optBuildSelected && sizeof($htmlSelect['items']))
  450. // {
  451. // $argsObj->optBuildSelected = key($htmlSelect['items']);
  452. // }
  453. // $htmlSelect['selected'] = $argsObj->optBuildSelected;
  454. //
  455. // return $htmlSelect;
  456. //}
  457. //
  458. ///**
  459. // * Initialize a map with build info to choose as filter option,
  460. // * for creating HTML Select in user interface.
  461. // * Load only active builds, as only they are to be displayed.
  462. // *
  463. // * @author asimon
  464. // * @param resource &$dbHandler reference
  465. // * @param object &$argsObj reference contains user input arguments
  466. // * @param tlTestplan &$tplanMgr reference
  467. // * @return initialize HTML-Select for filter methods
  468. // */
  469. //function initFilterBuildInfo(&$dbHandler,&$argsObj,&$tplanMgr)
  470. //{
  471. // $htmlSelect = array('items' => null, 'selected' => null);
  472. // $htmlSelect['items'] = $tplanMgr->get_builds_for_html_options($argsObj->tplan_id,
  473. // testplan::GET_ACTIVE_BUILD);
  474. //
  475. // $maxBuildID = $tplanMgr->get_max_build_id($argsObj->tplan_id, testplan::GET_ACTIVE_BUILD);
  476. //
  477. // $argsObj->optFilterBuildSelected = $argsObj->optFilterBuildSelected > 0 ? $argsObj->optFilterBuildSelected : $maxBuildID;
  478. // if (!$argsObj->optFilterBuildSelected && sizeof($htmlSelect['items']))
  479. // {
  480. // $argsObj->optFilterBuildSelected = key($htmlSelect['items']);
  481. // }
  482. // $htmlSelect['selected'] = $argsObj->optFilterBuildSelected;
  483. //
  484. // return $htmlSelect;
  485. //}
  486. //
  487. //
  488. ///**
  489. // * creates a map with platform information, useful to create on user
  490. // * interface an HTML select input.
  491. // *
  492. // * @param resource &$dbHandler reference
  493. // * @param object &$argsObj reference contains user input
  494. // * @param tlPlatform &$platformMgr reference
  495. // *
  496. // */
  497. //function initPlatformInfo(&$dbHandler,&$argsObj,&$platformMgr)
  498. //{
  499. // $htmlSelect = array('items' => null, 'selected' => null);
  500. // $htmlSelect['items'] = $platformMgr->getLinkedToTestplanAsMap($argsObj->tplan_id);
  501. // if( !is_null($htmlSelect['items']) && is_array($htmlSelect['items']) )
  502. // {
  503. // if (is_null($argsObj->optPlatformSelected))
  504. // {
  505. // $argsObj->optPlatformSelected = key($htmlSelect['items']);
  506. // }
  507. // $htmlSelect['selected'] = $argsObj->optPlatformSelected;
  508. // }
  509. // return $htmlSelect;
  510. //}
  511. //
  512. //
  513. ///*
  514. // function: buildTree
  515. //
  516. // args :
  517. //
  518. // returns:
  519. //
  520. //*/
  521. //function buildTree(&$dbHandler,&$guiObj,&$argsObj,&$cfgObj,&$exec_cfield_mgr)
  522. //{
  523. // $filters = new stdClass();
  524. // $additionalInfo = new stdClass();
  525. //
  526. // $filters->keyword = buildKeywordsFilter($argsObj->panelFiltersKeyword,$guiObj);
  527. // $filters->keywordsFilterType = $argsObj->keywordsFilterType;
  528. // $filters->include_unassigned = $guiObj->includeUnassigned;
  529. //
  530. // $filters->tc_id = $argsObj->tcase_id;
  531. // $filters->build_id = $argsObj->optBuildSelected;
  532. // $filters->filter_build_id = $argsObj->optFilterBuildSelected;
  533. //
  534. // // BUGID 3380
  535. // $filters->exec_type = $argsObj->panelFiltersExecType > 0 ? $argsObj->panelFiltersExecType : null;
  536. //
  537. //
  538. // // BUGID 2455
  539. // $filters->method = $argsObj->filter_method_selected;
  540. //
  541. // // in this way we have code as key
  542. // $filters->assignedTo = $guiObj->filterAssignedTo;
  543. // if( !is_null($filters->assignedTo) )
  544. // {
  545. // if( in_array(TL_USER_ANYBODY, $guiObj->filterAssignedTo) )
  546. // {
  547. // $filters->assignedTo = null;
  548. // }
  549. // else
  550. // {
  551. // $dummy = array_flip($guiObj->filterAssignedTo);
  552. // foreach( $dummy as $key => $value)
  553. // {
  554. // $dummy[$key] = $key;
  555. // }
  556. // $filters->assignedTo = $dummy;
  557. // }
  558. // }
  559. //
  560. // $filters->filter_status = null;
  561. // if( !is_null($argsObj->panelFiltersExecStatus) )
  562. // {
  563. // if( !in_array($cfgObj->results['status_code']['all'], $argsObj->panelFiltersExecStatus) )
  564. // {
  565. // // in this way we have code as key
  566. // $dummy = array_flip($argsObj->panelFiltersExecStatus);
  567. // foreach( $dummy as $status_code => $value)
  568. // {
  569. // $dummy[$status_code] = $status_code;
  570. // }
  571. // $filters->filter_status = $dummy;
  572. // }
  573. // }
  574. //
  575. //
  576. //
  577. // $filters->hide_testcases = false;
  578. // $filters->show_testsuite_contents = $cfgObj->exec->show_testsuite_contents;
  579. // $filters->urgencyImportance = $argsObj->urgencyImportance;
  580. // $filters->platform_id = $argsObj->optPlatformSelected;
  581. //
  582. // $filters->cf_hash = $exec_cfield_mgr->get_set_values();
  583. // $guiObj->args = initializeGetArguments($argsObj,$cfgObj,$filters->cf_hash);
  584. //
  585. // $additionalInfo->useCounters = $cfgObj->exec->enable_tree_testcase_counters;
  586. //
  587. // $additionalInfo->useColours = new stdClass();
  588. // $additionalInfo->useColours->testcases = $cfgObj->exec->enable_tree_testcases_colouring;
  589. // $additionalInfo->useColours->counters = $cfgObj->exec->enable_tree_counters_colouring;
  590. //
  591. // // link to load frame named 'workframe' when the update button is pressed
  592. // if($argsObj->doUpdateTree)
  593. // {
  594. // $guiObj->src_workframe = $_SESSION['basehref']. $guiObj->menuUrl .
  595. // "?level=testproject&id={$argsObj->tproject_id}" . $guiObj->args;
  596. // }
  597. // require_once ("../../third_party/dBug/dBug.php");
  598. //
  599. // $guiObj->additionalArgs = '';
  600. // list($treeMenu, $guiObj->additionalArgs) = generateExecTree($dbHandler,$guiObj->menuUrl,
  601. // $argsObj->tproject_id,$argsObj->tproject_name,
  602. // $argsObj->tplan_id,$argsObj->tplan_name,
  603. // $filters,$additionalInfo);
  604. //
  605. // return $treeMenu;
  606. //}
  607. //
  608. //
  609. ///*
  610. // function: initializeGui
  611. // args :
  612. // returns:
  613. //
  614. // rev: 20080429 - franciscom
  615. //*/
  616. //function initializeGui(&$dbHandler,&$argsObj,&$cfgObj,&$exec_cfield_mgr,&$tplanMgr,&$platformMgr)
  617. //{
  618. // $gui = new stdClass();
  619. //
  620. // //BUGID 3301
  621. // $gui->tcSpecRefreshOnAction = $argsObj->do_refresh;
  622. //
  623. // $gui->design_time_cfields = $exec_cfield_mgr->html_table_of_custom_field_inputs(30);
  624. // $gui->menuUrl = 'lib/execute/execSetResults.php';
  625. // $gui->src_workframe = null;
  626. // $gui->getArguments = null;
  627. //
  628. //
  629. // // new code
  630. // $initValues['keywords'] = "testplan,{$argsObj->tplan_id}";
  631. // $initValues['execTypes'] = 'init';
  632. // $gui->controlPanel = new tlControlPanel($dbHandler,$argsObj,$initValues);
  633. //
  634. // // Seems not be used
  635. // // $gui->treeColored = $argsObj->treeColored;
  636. //
  637. // $tplans = $_SESSION['currentUser']->getAccessibleTestPlans($dbHandler,$argsObj->tproject_id);
  638. //
  639. // $gui->mapTPlans = array();
  640. // foreach($tplans as $key => $value)
  641. // {
  642. // //dont take testplans into selection which have no builds assigned
  643. // $items = $tplanMgr->get_builds($value['id'],
  644. // testplan::GET_ACTIVE_BUILD, testplan::GET_OPEN_BUILD);
  645. // if (is_array($items) && count($items)) {
  646. // $gui->mapTPlans[$value['id']] = $value['name'];
  647. // }
  648. // }
  649. //
  650. // $gui->tPlanID = $argsObj->tplan_id;
  651. // $gui->tPlanName = $argsObj->tplan_name;
  652. //
  653. // $gui->includeUnassigned = $argsObj->include_unassigned;
  654. // $gui->urgencyImportance = $argsObj->urgencyImportance;
  655. // $gui->urgencyImportanceSelectable = TRUE; // TODO should this depend on project settings?
  656. //
  657. // $gui->optBuild = initBuildInfo($dbHandler,$argsObj,$tplanMgr);
  658. // $gui->optFilterBuild = initFilterBuildInfo($dbHandler,$argsObj,$tplanMgr);
  659. // $gui->optPlatform = initPlatformInfo($dbHandler,$argsObj,$platformMgr);
  660. //
  661. // // count of open builds that can be executed
  662. // $gui->buildCount = count($gui->optBuild['items']);
  663. //
  664. // // count of active builds that are shown and can be filtered
  665. // $gui->filterBuildCount = count($gui->optFilterBuild['items']);
  666. //
  667. // // 20090517 - francisco.mancardi@gruppotesi.com
  668. // // Assigned to combo must contain ALSO inactive users
  669. // $users = tlUser::getAll($dbHandler,null,"id",null);
  670. //
  671. // // BUGID 3301: $gui->users --> $gui->testers
  672. // $gui->testers = getTestersForHtmlOptions($dbHandler,$argsObj->tplan_id,$argsObj->tproject_id,
  673. // $users,array(TL_USER_ANYBODY => $gui->controlPanel->strOption['any'],
  674. // TL_USER_NOBODY => $gui->controlPanel->strOption['none'],
  675. // TL_USER_SOMEBODY => $gui->controlPanel->strOption['somebody']),'any' );
  676. //
  677. // $gui->tcase_id=intval($argsObj->tcase_id) > 0 ? $argsObj->tcase_id : '';
  678. //
  679. // $gui->optResult=createResultsMenu();
  680. // $gui->optResult[$cfgObj->results['status_code']['all']] = $gui->controlPanel->strOption['any'];
  681. //
  682. // // BUGID 2455, BUGID 3026
  683. // $filter_cfg = config_get('execution_filter_methods');
  684. // $gui->filterMethods = createExecutionFilterMethodMenu();
  685. // $gui->optFilterMethodSelected = $argsObj->filter_method_selected;
  686. // $gui->filterMethodSpecificBuild = $filter_cfg['status_code']['specific_build'];
  687. // $gui->filterMethodCurrentBuild = $filter_cfg['status_code']['current_build'];
  688. //
  689. // // $gui->advancedFilterMode=$argsObj->advancedFilterMode;
  690. // if($gui->controlPanel->advancedFilterMode)
  691. // {
  692. // $label = 'btn_simple_filters';
  693. // $qty = 4; // Standard: not run,passed,failed,blocked
  694. // }
  695. // else
  696. // {
  697. // $label = 'btn_advanced_filters';
  698. // $qty = 1;
  699. // }
  700. //
  701. // $gui->statusFilterItemQty = $qty;
  702. // $gui->assigneeFilterItemQty = $qty;
  703. // $gui->toggleFilterModeLabel=lang_get($label);
  704. //
  705. // return $gui;
  706. //}
  707. //
  708. ///**
  709. // * create map with filter methods for execution,
  710. // * used for creating HTML Select inputs
  711. // *
  712. // * @author asimon
  713. // * @return $menu_data HTML Select (labels and values)
  714. // */
  715. //function createExecutionFilterMethodMenu() {
  716. // $filter_cfg = config_get('execution_filter_methods');
  717. // $menu_data = array();
  718. // foreach($filter_cfg['status_code'] as $status => $label) {
  719. // $code = $filter_cfg['status_code'][$status];
  720. // $menu_data[$code] = lang_get($filter_cfg['status_label'][$status]);
  721. // }
  722. // return $menu_data;
  723. //}
  724. ?>