bug.html.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /**
  3. * The bug view file of my 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 my
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. include 'header.html.php';
  12. $testcaseTitle = "[" . $lang->testcase->common . "#{case}]";
  13. $testcaseLink = createLink('testcase', 'view', "caseID={case}&version={caseVersion}");
  14. jsVar('testcaseTitle', $testcaseTitle);
  15. jsVar('testcaseLink', $testcaseLink);
  16. jsVar('checkedSummary', isset($checkedSummary) ? $checkedSummary : '');
  17. featurebar
  18. (
  19. set::current($type),
  20. set::linkParams("mode=bug&type={key}&param=&orderBy={$orderBy}"),
  21. li(searchToggle(set::module($this->app->rawMethod . 'Bug'), set::open($type == 'bySearch')))
  22. );
  23. $canBatchEdit = common::hasPriv('bug', 'batchEdit') && $type == 'assignedTo';
  24. $canBatchConfirm = common::hasPriv('bug', 'batchConfirm') && $type != 'closedBy';
  25. $canBatchClose = common::hasPriv('bug', 'batchClose') && strtolower($type) != 'closedby';
  26. $canBatchAssignTo = common::hasPriv('bug', 'batchAssignTo');
  27. $canBatchAction = $canBatchEdit || $canBatchConfirm || $canBatchClose || $canBatchAssignTo;
  28. $currentType = $type;
  29. if($type == 'bySearch') $type = $this->session->myBugType;
  30. if($type == 'openedBy')
  31. {
  32. $config->my->bug->dtable->fieldList['openedBy']['hidden'] = true;
  33. $config->my->bug->dtable->fieldList['openedDate']['hidden'] = true;
  34. $config->my->bug->dtable->fieldList['assignedDate']['hidden'] = true;
  35. }
  36. if($type == 'resolvedBy')
  37. {
  38. $config->my->bug->dtable->fieldList['openedDate']['hidden'] = true;
  39. $config->my->bug->dtable->fieldList['resolvedBy']['hidden'] = true;
  40. }
  41. if($type == 'assignedBy') $config->my->bug->dtable->fieldList['openedDate']['hidden'] = true;
  42. if($type == 'closedBy') $config->my->bug->dtable->fieldList['openedDate']['hidden'] = true;
  43. if($type == 'assignedTo') $config->my->bug->dtable->fieldList['assignedTo']['hidden'] = true;
  44. if($app->rawMethod == 'work')
  45. {
  46. $config->my->bug->dtable->fieldList['status']['hidden'] = true;
  47. $config->my->bug->dtable->fieldList['openedDate']['hidden'] = true;
  48. }
  49. else
  50. {
  51. $config->my->bug->dtable->fieldList['deadline']['hidden'] = true;
  52. }
  53. if(!$canBatchAction) $config->bug->dtable->fieldList['id']['type'] = 'id';
  54. $projectBrowseLink = createLink('project', 'browse');
  55. $productLink = explode('-', $config->productLink);
  56. $productParam = $config->productLink == 'product-all' ? '' : "productID={product}";
  57. $productBrowseLink = createLink('product', $productLink[1], $productParam);
  58. $config->bug->dtable->fieldList['product']['link'] = 'RAWJS<function(info){ if(info.row.data.shadow) return \'' . $projectBrowseLink . '\'; else return \'' . $productBrowseLink . '\'; }>RAWJS';
  59. foreach($bugs as $bug) $bug->canBeChanged = common::canBeChanged('bug', $bug);
  60. $pinyinItems = common::convert2Pinyin($memberPairs);
  61. $assignedToItems = array();
  62. foreach ($memberPairs as $key => $value)
  63. {
  64. if(!$key) continue;
  65. $key = base64_encode((string)$key); // 编码用户名中的特殊字符
  66. $assignedToItems[] = array('text' => $value, 'keys' => zget($pinyinItems, $value, ''), 'innerClass' => 'batch-btn ajax-btn not-open-url', 'data-url' => createLink('bug', 'batchAssignTo', "assignedTo=$key&productID=0&type=my"));
  67. }
  68. $footToolbar = $canBatchAction ? array('items' => array
  69. (
  70. array('text' => $lang->edit, 'className' => 'batch-btn ' . ($canBatchEdit ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchEdit')),
  71. array('text' => $lang->confirm, 'className' => 'batch-btn ajax-btn ' . ($canBatchConfirm ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchConfirm')),
  72. array('text' => $lang->close, 'className' => 'batch-btn ajax-btn ' . ($canBatchClose ? '' : 'hidden'), 'data-url' => createLink('bug', 'batchClose')),
  73. array('text' => $lang->bug->assignedTo, 'className' => ($canBatchAssignTo ? '' : 'hidden'), 'type' => 'dropdown', 'items' => $assignedToItems, 'caret' => 'up', 'data-placement' => 'top-start', 'data-menu' => array('searchBox' => true)),
  74. ), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary')) : null;
  75. $cols = $config->my->bug->dtable->fieldList;
  76. $bugs = initTableData($bugs, $cols, $this->bug);
  77. dtable
  78. (
  79. set::cols($cols),
  80. set::data(array_values($bugs)),
  81. set::priList($lang->bug->priList),
  82. set::severityList($lang->bug->severityList),
  83. set::userMap($users),
  84. set::fixedLeftWidth('44%'),
  85. set::onRenderCell(jsRaw('window.onRenderBugNameCell')),
  86. set::checkable($canBatchAction),
  87. set::checkInfo($type == 'resolvedBy' ? jsRaw('function(checks){return window.setStatistics(this, checks);}') : null),
  88. set::canRowCheckable(jsRaw('function(rowID){return this.getRowInfo(rowID).data.canBeChanged;}')),
  89. set::orderBy($orderBy),
  90. set::sortLink(createLink('my', $app->rawMethod, "mode={$mode}&type={$currentType}&param={$param}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")),
  91. set::footToolbar($footToolbar),
  92. set::footPager(usePager()),
  93. set::emptyTip($lang->bug->notice->noBug),
  94. set::customData($type == 'resolvedBy' ? array('pageSummary' => $summary) : array())
  95. );
  96. render();