bug.html.php 4.8 KB

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