zentaolist.html.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. /**
  3. * The zentaoList view file of doc 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 Xinzhi Qi <qixinzhi@chandao.com>
  7. * @package doc
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $noticeTip = $noSupport ? sprintf($lang->doc->noSupportList, $lang->doc->zentaoList[$type] . $lang->doc->list) : '';
  12. if($type == 'gantt' && !empty($ganttData))
  13. {
  14. $userList = array();
  15. foreach($users as $account => $realname) $userList[] = array('key' => $account, 'label' => $realname);
  16. }
  17. if(!$isTemplate)
  18. {
  19. jsVar('blockType', $type);
  20. if(strpos(',productStory,ER,UR,planStory,projectStory,',",{$type},") !== false)
  21. {
  22. jsVar('gradeGroup', $gradeGroup);
  23. if($type != 'planStory' && $type != 'projectStory') jsVar('storyType', $storyType);
  24. }
  25. }
  26. if($type == 'productCase')
  27. {
  28. jsVar('scene', $lang->testcase->sceneb);
  29. jsVar('automated', $lang->testcase->automated);
  30. jsVar('noCase', $lang->scene->noCase);
  31. jsVar('caseChanged', $lang->testcase->changed);
  32. }
  33. $actions = array();
  34. $setText = (!$isTemplate && $fromTemplate && !$fromReport) ? $lang->doc->zentaoAction['setParams'] : $lang->doc->zentaoAction['set'];
  35. if(!$noSupport && ($type != 'gantt' || !$isTemplate)) $actions[] = array('icon' => 'menu-backend', 'text' => $setText, 'data-toggle' => 'modal', 'url' => str_replace('{blockID}', "$blockID", $settings), 'data-size' => $isTemplate || $fromReport ? 'sm' : 'lg');
  36. $actions[] = array('icon' => 'trash', 'text' => $lang->doc->zentaoAction['delete'], 'zui-on-click' => "deleteZentaoList($blockID)");
  37. if($isTemplate || $fromTemplate)
  38. {
  39. $blockTitle = '';
  40. if(!empty($lang->docTemplate->searchTabList[$type][$searchTab])) $blockTitle = $lang->docTemplate->searchTabList[$type][$searchTab] . $lang->docTemplate->of;
  41. if($type == 'bug' && $searchTab == 'overduebugs') $blockTitle = $lang->docTemplate->overdue . $lang->docTemplate->of;
  42. if(($type == 'productCase' || $type == 'projectCase') && !empty($caseStage)) $blockTitle = $blockTitle . $lang->testcase->stageList[$caseStage];
  43. }
  44. $emptyTip = $lang->doc->previewTip;
  45. if(!$isTemplate && $fromTemplate) $emptyTip = $isSetted ? $lang->docTemplate->emptyTip : $lang->docTemplate->previewTip;
  46. if($fromReport) $emptyTip = $lang->docTemplate->emptyDataTip;
  47. $listText = $type == 'gantt' ? $lang->docTemplate->zentaoList['gantt'] : $lang->doc->list;
  48. $emptyText = $isTemplate ? sprintf($lang->docTemplate->configTip, $listText) : $emptyTip;
  49. $pagerSetting = usePager();
  50. unset($pagerSetting['linkCreator']);
  51. $dataTable = null;
  52. if(!$isTemplate && $type != 'gantt' && !$noSupport)
  53. {
  54. $dataTable = dtable
  55. (
  56. set::cols(array_values($cols)),
  57. set::data(array_values($data)),
  58. set::userMap($users),
  59. set::emptyTip($emptyTip),
  60. set::checkable(false),
  61. set::colResize(true),
  62. set::customCols(false),
  63. set::onRenderCell(jsRaw('window.renderCell')),
  64. set::localPager(),
  65. set::footPager($pagerSetting),
  66. set::footer(array('flex', 'pager')),
  67. $type == 'productRelease' ? set::rowKey('rowID') : null,
  68. $type == 'productRelease' ? set::plugins(array('cellspan')) : null,
  69. $type == 'productRelease' ? set::getCellSpan(jsRaw('window.getCellSpan')) : null
  70. );
  71. }
  72. $ganttView = null;
  73. if($type == 'gantt' && !empty($ganttData))
  74. {
  75. $ganttView = zui::gantt
  76. (
  77. set::onInit(jsRaw('window.onInitGantt')),
  78. set::data($ganttData['data']),
  79. set::links($ganttData['links']),
  80. set::ganttFields($ganttFields),
  81. set::showFields('text,owner_id,begin,deadline,status,duration'),
  82. set::userList($userList),
  83. set::exts('zentao')
  84. );
  85. }
  86. div
  87. (
  88. set('data-id', $blockID),
  89. setClass('zentao-list my-3'),
  90. setCssVar('--affine-font-base', '13px!important'),
  91. setStyle('font-size', '13px'),
  92. css('.is-readonly .zentao-list-actions {display: none}'),
  93. div
  94. (
  95. setClass('zentao-list-heading row items-center gap-2 mb-1'),
  96. h2
  97. (
  98. setClass('font-bold text-xl'),
  99. (($isTemplate || $fromTemplate || $fromReport) ? $blockTitle . $lang->docTemplate->zentaoList[$type] : $lang->doc->zentaoList[$type]) . ($type == 'gantt' ? '' : $lang->doc->list)
  100. ),
  101. div
  102. (
  103. setClass('zentao-list-actions toolbar flex-auto justify-end'),
  104. dropdown
  105. (
  106. set::trigger('hover'),
  107. set::placement('bottom-end'),
  108. set::items($actions),
  109. btn(set::icon('ellipsis-v'), set::caret(false), set::type('ghost'))
  110. )
  111. )
  112. ),
  113. $isTemplate || ($type == 'gantt' && empty($ganttData)) ? div
  114. (
  115. setClass('canvas border rounded py-3 px-3'),
  116. div
  117. (
  118. setClass('config-tip text-center px-3 py-2'),
  119. $emptyText
  120. )
  121. ):null,
  122. $dataTable,
  123. $noSupport ? div
  124. (
  125. setClass('canvas border rounded py-3 px-3'),
  126. div
  127. (
  128. setClass('config-tip text-center px-3 py-2 text-gray-400'),
  129. div($noticeTip)
  130. )
  131. ) : null,
  132. $ganttView
  133. );