view.html.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /**
  3. * The view view file of testsuite 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 Mengyi Liu <liumengyi@easycorp.ltd>
  7. * @package testsuite
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. data('testsuite', $suite);
  12. $config->testsuite->actionList['edit']['text'] = $config->testsuite->actionList['edit']['hint'] = $lang->edit;
  13. $config->testsuite->actionList['delete']['text'] = $config->testsuite->actionList['delete']['hint'] = $lang->delete;
  14. $actions = $this->loadModel('common')->buildOperateMenu($suite);
  15. foreach($actions as $actionType => $typeActions)
  16. {
  17. foreach($typeActions as $key => $action)
  18. {
  19. $actions[$actionType][$key]['className'] = isset($action['className']) ? $action['className'] . ' ghost' : 'ghost';
  20. $actions[$actionType][$key]['iconClass'] = isset($action['iconClass']) ? $action['iconClass'] . ' text-primary' : 'text-primary';
  21. $actions[$actionType][$key]['url'] = str_replace('{id}', (string)$suite->id, $action['url']);
  22. }
  23. }
  24. detailHeader
  25. (
  26. to::title
  27. (
  28. entityLabel
  29. (
  30. set::entityID($suite->id),
  31. set::level(1),
  32. set::text($suite->name)
  33. ),
  34. $suite->deleted ? span(setClass('label danger'), $lang->testsuite->deleted) : null
  35. ),
  36. to::suffix
  37. (
  38. toolbar
  39. (
  40. set::items($actions['mainActions'])
  41. )
  42. )
  43. );
  44. $canBatchEdit = common::hasPriv('testcase', 'batchEdit');
  45. $canBatchUnlink = common::hasPriv('testsuite', 'batchUnlinkCases');
  46. $canBatchRun = common::hasPriv('testtask', 'batchRun');
  47. $hasCheckbox = ($canBeChanged && ($canBatchEdit || $canBatchUnlink || $canBatchRun));
  48. $batchItems = array(
  49. $canBatchUnlink ? array('text' => $lang->testsuite->unlinkCase, 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => helper::createLink('testsuite', 'batchUnlinkCases', "suiteID={$suite->id}")) : null,
  50. $canBatchRun ? array('text' => $lang->testtask->runCase, 'innerClass' => 'batch-btn not-open-url', 'data-url' => helper::createLink('testtask', 'batchRun', "productID={$productID}&&orderBy={$orderBy}")) : null,
  51. );
  52. $footToolbar = array('items' => array(
  53. array('type' => 'btn-group', 'items' => array
  54. (
  55. array('text' => $lang->edit, 'className' => 'batch-btn', 'data-url' => createLink('testcase', 'batchEdit', "productID={$productID}")),
  56. array('caret' => 'up', 'className' => 'btn btn-caret size-sm not-open-url', 'data-placement' => 'top-start', 'items' => $batchItems),
  57. )),
  58. ), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary'));
  59. $config->testsuite->testcase->dtable->fieldList['module']['map'] = $modules;
  60. $config->testsuite->testcase->dtable->fieldList['status']['statusMap']['changed'] = $lang->testcase->changed;
  61. foreach($cases as $case)
  62. {
  63. if($case->version > $case->caseVersion) $case->status = 'changed';
  64. }
  65. $tableData = initTableData($cases, $config->testsuite->testcase->dtable->fieldList);
  66. detailBody
  67. (
  68. sectionList
  69. (
  70. dtable
  71. (
  72. set::cols(array_values($config->testsuite->testcase->dtable->fieldList)),
  73. set::data(array_values($tableData)),
  74. set::fixedLeftWidth('0.5'),
  75. set::checkable($hasCheckbox),
  76. set::orderBy($orderBy),
  77. set::sortLink(createLink('testsuite', 'view', "suiteID={$suite->id}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  78. set::footToolbar($footToolbar),
  79. set::footPager(usePager('pager'))
  80. )
  81. ),
  82. history
  83. (
  84. set::hasComment(false),
  85. set::commentBtn(false),
  86. set::methodName('view_1'),
  87. set::objectID($suite->id)
  88. ),
  89. detailSide
  90. (
  91. section
  92. (
  93. setClass('py-4'),
  94. set::title($lang->testsuite->legendDesc),
  95. set::content(!empty($suite->desc) ? $suite->desc : "<span class='text-gray'>{$lang->noDesc}</span>"),
  96. set::useHtml(true)
  97. )
  98. )
  99. );