zerocase.html.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * The zerocase view file of testcase 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 Tingting Dai <daitingting@easycorp.ltd>
  7. * @package testcase
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. include 'header.html.php';
  12. $canBatchEdit = hasPriv('story', 'batchEdit');
  13. $canBatchChangeStage = hasPriv('story', 'batchChangeStage');
  14. $canBatchReview = hasPriv('story', 'batchReview');
  15. $canBatchAction = $canBatchEdit || $canBatchChangeStage || $canBatchReview;
  16. $rejectItems = array();
  17. foreach($lang->story->reasonList as $key => $reason) $rejectItems[] = array('text' => $reason, 'innerClass' => 'batch-btn ajax-btn', 'data-url' => createLink('story', 'batchReview', "result=reject&reason=$key")) ;
  18. $reviewItems = array();
  19. foreach($lang->story->reviewResultList as $key => $result)
  20. {
  21. if(!$key || $key == 'revert') continue;
  22. if($key == 'reject')
  23. {
  24. $reviewItems[] = array('text' => $result, 'innerClass' => 'not-hide-menu', 'items' => $rejectItems);
  25. }
  26. else
  27. {
  28. $reviewItems[] = array('text' => $result, 'innerClass' => 'batch-btn ajax-btn', 'data-url' => helper::createLink('story', 'batchReview', "result=$key"));
  29. }
  30. }
  31. $stageItems = array();
  32. $lang->story->stageList[''] = $lang->null;
  33. foreach($lang->story->stageList as $key => $stage)
  34. {
  35. if(strpos('|tested|verified|rejected|released|closed|', "|$key|") === false) continue;
  36. $stageItems[] = array('text' => $stage, 'innerClass' => 'batch-btn ajax-btn', 'data-url' => helper::createLink('story', 'batchChangeStage', "stage=$key"));
  37. }
  38. $footToolbar = $canBatchAction ? array('items' => array
  39. (
  40. array('text' => $lang->edit, 'className' => 'batch-btn' . ($canBatchEdit ? '': 'hidden'), 'data-url' => createLink('story', 'batchEdit', "productID={$productID}&objectID={$objectID}&branch={$branch}")),
  41. array('text' => $lang->story->review, 'className' => ($canBatchReview ? '' : 'hidden') , 'caret' => 'up', 'items' => $reviewItems, 'data-toggle' => 'dropdown', 'data-placement' => 'top-start'),
  42. array('text' => $lang->story->stageAB, 'className' => ($canBatchChangeStage ? '' : 'hidden'), 'caret' => 'up', 'items' => $stageItems, 'data-toggle' => 'dropdown', 'data-placement' => 'top-start'),
  43. ), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary')) : null;
  44. $stories = initTableData($stories, $config->testcase->zerocase->dtable->fieldList, $this->story);
  45. foreach($stories as $id => $story)
  46. {
  47. if(!isset($story->actions)) continue;
  48. foreach($story->actions as $key => $action)
  49. {
  50. if(!empty($story->frozen) && in_array($action['name'], array('edit', 'change'))) $stories[$id]->actions[$key]['hint'] = sprintf($lang->story->frozenTip, $lang->story->{$action['name']});
  51. }
  52. }
  53. foreach($config->testcase->zerocase->dtable->fieldList as $colName => $col)
  54. {
  55. if(!isset($col['sortType'])) $config->testcase->zerocase->dtable->fieldList[$colName]['sortType'] = true;
  56. }
  57. $linkParams = '';
  58. foreach($app->rawParams as $key => $value) $linkParams = $key != 'orderBy' ? "{$linkParams}&{$key}={$value}" : "{$linkParams}&orderBy={name}_{sortType}";
  59. dtable
  60. (
  61. set::cols($config->testcase->zerocase->dtable->fieldList),
  62. set::data(array_values($stories)),
  63. set::userMap($users),
  64. set::orderBy($orderBy),
  65. set::sortLink(createLink($app->rawModule, $app->rawMethod, $linkParams)),
  66. set::footPager(usePager()),
  67. set::footToolbar($footToolbar),
  68. set::checkable($canBatchAction),
  69. set::emptyTip($lang->story->noStory)
  70. );
  71. render();