bug.html.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /**
  3. * The bug view file of execution 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 Shujie Tian<tianshujie@easycorp.ltd>
  7. * @package execution
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. /* zin: Define the set::module('bug') feature bar on main menu. */
  12. featureBar
  13. (
  14. set::current($type),
  15. set::linkParams("executionID={$execution->id}&productID={$productID}&branch={$branchID}&orderBy={$orderBy}&build={$buildID}&type={key}&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"),
  16. li(searchToggle(set::module('executionBug'), set::open($type == 'bysearch')))
  17. );
  18. /* zin: Define the toolbar on main menu. */
  19. $canExportBug = hasPriv('bug', 'export');
  20. $canCreateBug = hasPriv('bug', 'create') && common::canModify('execution', $execution);
  21. if($canExportBug) $exportItem = array
  22. (
  23. 'icon' => 'export',
  24. 'class' => 'ghost',
  25. 'text' => $lang->export,
  26. 'data-toggle' => 'modal',
  27. 'url' => $this->createLink('bug', 'export', "productID={$productID}&browseType=&executionID={$execution->id}")
  28. );
  29. if($canCreateBug) $createItem = array
  30. (
  31. 'icon' => 'plus',
  32. 'class' => 'primary createBug-btn',
  33. 'text' => $lang->bug->create,
  34. 'data-app' => 'execution',
  35. 'url' => $this->createLink('bug', 'create', "productID={$defaultProduct}&branch=0&extras=executionID={$execution->id},moduleID={$moduleID}")
  36. );
  37. toolbar
  38. (
  39. !empty($canExportBug) ? item(set($exportItem)) : null,
  40. !empty($createItem) ? item(set($createItem)) : null
  41. );
  42. /* zin: Define the sidebar in main content. */
  43. sidebar
  44. (
  45. moduleMenu(set(array(
  46. 'modules' => $moduleTree,
  47. 'activeKey' => $moduleID,
  48. 'closeLink' => $this->createLink('execution', 'bug', "executionID={$execution->id}")
  49. )))
  50. );
  51. $bugs = initTableData($bugs, $this->config->bug->dtable->fieldList, $this->bug);
  52. $canBatchAssignTo = common::hasPriv('bug', 'batchAssignTo');
  53. if($canBatchAssignTo)
  54. {
  55. $pinyinItems = common::convert2Pinyin($users);
  56. $assignedToItems = array();
  57. foreach($users as $account => $name)
  58. {
  59. if(empty($account)) continue;
  60. $account = base64_encode((string)$account); // 编码用户名中的特殊字符
  61. if($account != 'closed') $assignedToItems[] = array('text' => $name, 'keys' => zget($pinyinItems, $name, ''), 'innerClass' => 'batch-btn ajax-btn', 'data-url' => createLink('bug', 'batchAssignTo', "assignedTo={$account}&objectID={$execution->id}"));
  62. }
  63. $footToolbar['items'][] = array('caret' => 'up', 'text' => $lang->bug->assignedTo, 'className' => 'btn btn-caret size-sm secondary', 'items' => $assignedToItems, 'type' => 'dropdown', 'data-placement' => 'top', 'data-menu' => array('searchBox' => true));
  64. }
  65. jsVar('checkedSummary', $lang->selectedItems);
  66. jsVar('caseCommonLang', $this->lang->testcase->common);
  67. $cols = $this->loadModel('datatable')->getSetting('execution');
  68. if(isset($cols['module'])) $cols['module']['map'] = $modulePairs;
  69. if(isset($cols['branch'])) $cols['branch']['map'] = $branchOption;
  70. if(isset($cols['project'])) $cols['project']['map'] = $projectPairs;
  71. if(isset($cols['openedBuild'])) $cols['openedBuild']['map'] = $builds;
  72. if(isset($cols['plan'])) $cols['plan']['map'] = array('') + $plans;
  73. if(isset($cols['task'])) $cols['task']['map'] = array('') + $tasks;
  74. if(isset($cols['toTask'])) $cols['toTask']['map'] = array('') + $tasks;
  75. if(isset($cols['story'])) $cols['story']['map'] = array('') + $stories;
  76. if(isset($cols['activatedCount'])) $cols['activatedCount']['map'] = array('');
  77. $bugs = initTableData($bugs, $cols, $this->execution);
  78. dtable
  79. (
  80. set::userMap($users),
  81. set::cols($cols),
  82. set::data(array_values($bugs)),
  83. set::priList($lang->bug->priList),
  84. set::severityList($lang->bug->severityList),
  85. set::checkable($canBatchAssignTo),
  86. set::orderBy($orderBy),
  87. set::sortLink(createLink('execution', 'bug', "executionID={$execution->id}&productID={$productID}&branch={$branchID}&orderBy={name}_{sortType}&build=$buildID&type=$type&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  88. set::footToolbar(!empty($footToolbar) ? $footToolbar : null),
  89. set::customCols(true),
  90. set::footPager(
  91. usePager(array('linkCreator' => helper::createLink('execution', 'bug', "executionID={$execution->id}&productID={$productID}&branch={$branchID}&orderBy={$orderBy}&build=$buildID&type=$type&param=$param&recTotal={$pager->recTotal}&recPerPage={recPerPage}&pageID={page}")))
  92. ),
  93. set::emptyTip($lang->bug->notice->noBug),
  94. set::createTip($lang->bug->create),
  95. set::createLink($canCreateBug ? createLink('bug', 'create', "productID={$defaultProduct}&branch=0&extras=executionID={$execution->id}") : ''),
  96. set::checkInfo(jsRaw('function(checkedIDList){return window.setStatistics(this, checkedIDList);}')),
  97. set::summary($summary),
  98. set::onRenderCell(jsRaw('window.onRenderCell')),
  99. set::modules($modulePairs)
  100. );
  101. render();