testcase.html.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * The testcase view file of my module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Yuting Wang <wangyuting@easycorp.ltd>
  7. * @package my
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. include 'header.html.php';
  12. jsVar('unexecuted', $lang->testcase->unexecuted);
  13. featureBar
  14. (
  15. set::current($type),
  16. set::linkParams("mode=testcase&type={key}&param=&orderBy={$orderBy}"),
  17. li(searchToggle(set::module($this->app->rawMethod . 'Testcase'), set::open($type == 'bysearch')))
  18. );
  19. $canBatchEdit = common::hasPriv('testcase', 'batchEdit');
  20. $footToolbar = array('items' => array
  21. (
  22. $canBatchEdit ? array('text' => $lang->edit, 'className' => 'batch-btn', 'data-url' => helper::createLink('testcase', 'batchEdit', "productID=0&branch=all&type=case&from={$app->rawMethod}")) : null
  23. ), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary'));
  24. if($type == 'openedbyme' || $app->rawMethod == 'contribute')
  25. {
  26. unset($config->my->testcase->dtable->fieldList['testtask']);
  27. unset($config->my->testcase->dtable->fieldList['openedBy']);
  28. }
  29. if($type == 'assigntome')
  30. {
  31. $config->my->testcase->dtable->fieldList['title']['link']['params'] .= "&from=testtask&taskID={task}";
  32. $config->my->testcase->dtable->fieldList['actions']['list']['runCase']['url'] = array('module' => 'testtask', 'method' => 'runCase', 'params' => 'id={run}');
  33. $config->my->testcase->dtable->fieldList['actions']['list']['runResult']['url'] = array('module' => 'testtask', 'method' => 'results', 'params' => 'id={run}');
  34. $config->my->testcase->dtable->fieldList['actions']['list']['createBug']['url'] = array('module' => 'testcase', 'method' => 'createBug', 'params' => 'product={product}&caseID={case}&version={version}&runID={run}');
  35. $config->my->testcase->dtable->fieldList['actions']['menu'] = array('runCase', 'runResult', 'edit', 'createBug', 'create');
  36. }
  37. foreach($config->my->testcase->dtable->fieldList['actions']['list'] as &$action) $action['url']['params'] = str_replace(array('{caseID}', '%executionID%', '{runID}'), array('{id}', '0', '0'), $action['url']['params']);
  38. $cases = initTableData($cases, $config->my->testcase->dtable->fieldList, $this->testcase);
  39. $data = array_values($cases);
  40. $defaultSummary = sprintf($lang->testcase->failSummary, count($cases), $failCount);
  41. dtable
  42. (
  43. set::data($data),
  44. set::cols($config->my->testcase->dtable->fieldList),
  45. set::userMap($users),
  46. set::fixedLeftWidth('44%'),
  47. set::checkable(true),
  48. set::defaultSummary(array('html' => $defaultSummary)),
  49. set::checkedSummary($lang->testcase->failCheckedSummary),
  50. set::checkInfo(jsRaw('function(checkedIDList){return window.setStatistics(this, checkedIDList);}')),
  51. set::orderBy($orderBy),
  52. set::sortLink(createLink('my', $app->rawMethod, "mode={$mode}&type={$type}&param={$param}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  53. set::footToolbar($footToolbar),
  54. set::footPager(usePager()),
  55. set::emptyTip($lang->testcase->noCase)
  56. );
  57. render();