groupcase.html.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /**
  3. * The groupcase view file of testtask 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 testtask
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('allTestcases', $lang->testcase->allTestcases);
  12. $canCreateSuite = hasPriv('testsuite', 'create');
  13. $canLinkCase = hasPriv('testtask', 'linkCase');
  14. $canExport = hasPriv('testcase', 'export');
  15. $canReport = hasPriv('testtask', 'report');
  16. $canView = hasPriv('testtask', 'view');
  17. featureBar(set::linkParams("taskID={$task->id}&browseType={key}"));
  18. $viewItems = array();
  19. $viewItems[] = array('text' => $lang->testcase->listView, 'url' => inlink('cases', "taskID={$task->id}"), 'active' => false, 'data-app' => $app->tab);
  20. $viewItems[] = array('text' => $lang->testcase->groupView, 'url' => inlink('groupCase', "taskID={$task->id}&groupBy=story"), 'active' => true, 'data-app' => $app->tab);
  21. toolbar
  22. (
  23. dropdown
  24. (
  25. btn
  26. (
  27. setClass('btn ghost square'),
  28. set::icon('kanban')
  29. ),
  30. set::items($viewItems),
  31. set::placement('bottom-end')
  32. ),
  33. $canLinkCase ? btn
  34. (
  35. set::className('ghost'),
  36. set::icon('link'),
  37. set::url(inlink('linkCase', "taskID=$task->id")),
  38. set('data-app', $app->tab),
  39. $lang->testtask->linkCase
  40. ) : null,
  41. $canExport ? btn
  42. (
  43. set::className('ghost'),
  44. set::icon('export'),
  45. setData('toggle', 'modal'),
  46. set::url($this->createLink('testcase', 'export', "productID=$productID&orderBy=case_desc&taskID=$task->id")),
  47. set('data-app', $app->tab),
  48. $lang->export
  49. ) : null,
  50. $canReport ? btn
  51. (
  52. set::className('ghost'),
  53. set::icon('bar-chart'),
  54. set::url(inlink('report', "productID=$productID&taskID=$task->id&browseType=group&branchID=$task->branch&moduleID=" . (empty($moduleID) ? '' : $moduleID))),
  55. set('data-app', $app->tab),
  56. $lang->testtask->report->common
  57. ) : null,
  58. $canView ? btn
  59. (
  60. set::className('ghost'),
  61. set::icon('list-alt'),
  62. set::url(inlink('view', "taskID=$task->id")),
  63. set('data-app', $app->tab),
  64. $lang->testtask->view
  65. ) : null,
  66. btn(set::icon('back'), set::className('ghost'), set::url($this->session->testtaskList), $lang->goback)
  67. );
  68. $config->testcase->actionList['runCase']['url'] = array('module' => 'testtask', 'method' => 'runCase', 'params' => 'runID={id}&caseID={case}&version={version}');
  69. $config->testcase->actionList['edit']['url'] = array('module' => 'testcase', 'method' => 'edit', 'params' => 'caseID={case}&comment=false&executionID={execution}');
  70. $config->testcase->actionList['unlinkCase']['url'] = array('module' => 'testtask', 'method' => 'unlinkCase', 'params' => 'caseID={id}');
  71. $config->testcase->actionList['unlinkCase']['class'] = 'ajax-submit';
  72. $config->testcase->actionList['unlinkCase']['data-confirm'] = $lang->testtask->confirmUnlinkCase;
  73. $config->testcase->group->dtable->fieldList['actions']['list'] = $config->testcase->actionList;
  74. $config->testcase->group->dtable->fieldList['id']['name'] = 'case';
  75. $config->testcase->group->dtable->fieldList['actions']['menu'] = array('runCase', 'edit', 'unlinkCase');
  76. $config->testcase->group->dtable->fieldList['title']['link']['params'] = 'caseID={case}';
  77. $config->testcase->group->dtable->fieldList['bugs']['link']['params'] = 'runID={id}&caseID={case}';
  78. foreach($config->testcase->group->dtable->fieldList as $colName => $col) $cols[$colName]['sortType'] = false;
  79. $cases = initTableData($cases, $config->testcase->group->dtable->fieldList);
  80. $cols = array_map(function($col){$col['sortType'] = false; return $col;}, $config->testcase->group->dtable->fieldList); // Disable sort by table header for dtable.
  81. foreach($cases as $index => $case)
  82. {
  83. if(!isset($case->id)) $cases[$index]->actions = array();
  84. }
  85. dtable
  86. (
  87. set::id('groupCaseTable'),
  88. set::userMap($users),
  89. set::cols($cols),
  90. set::data($cases),
  91. set::plugins(array('cellspan')),
  92. set::onRenderCell(jsRaw('window.onRenderCell')),
  93. set::getCellSpan(jsRaw('window.getCellSpan'))
  94. );
  95. render();