ajaxgetbugs.html.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. /**
  3. * The ajaxgetbugs view file of repo module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2024 禅道软件(青岛)有限公司(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 Yanyi Cao <caoyanyi@chandao.com>
  7. * @package repo
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. set::zui(true);
  12. jsVar('currentLink', inLink('ajaxGetBugs', "repoID={$repoID}&bugList=" . implode(',', $bugIDList) . "&currentBug=%s"));
  13. $tabs = array();
  14. foreach($bugs as $bug)
  15. {
  16. $commentBlock = array();
  17. $bugComments = array_values(zget($comments, $bug->id, array()));
  18. $commentCount = count($bugComments);
  19. foreach($bugComments as $index => $comment)
  20. {
  21. $commentBlock[] = div
  22. (
  23. setClass('comment-block mt-2'),
  24. set('data-id', $comment->id),
  25. set('data-bug', $bug->id),
  26. div
  27. (
  28. setClass('flex'),
  29. userAvatar
  30. (
  31. set::size(16),
  32. set::user($comment->user)
  33. ),
  34. span
  35. (
  36. setClass('strong ml-2'),
  37. zget($comment->user, 'realname', $comment->user->account)
  38. )
  39. ),
  40. div
  41. (
  42. setClass('mt-2'),
  43. div
  44. (
  45. setClass('comment-content'),
  46. html($comment->comment)
  47. ),
  48. div
  49. (
  50. setClass('comment-form-div hidden'),
  51. textarea
  52. (
  53. set::rows(3),
  54. set::name('comment'),
  55. set::value($comment->comment)
  56. ),
  57. div
  58. (
  59. setClass('text-right'),
  60. btn
  61. (
  62. $lang->repo->submit,
  63. setClass('editSubmit mt-2 primary size-sm')
  64. )
  65. )
  66. )
  67. ),
  68. div
  69. (
  70. setClass('mt-2'),
  71. $comment->date,
  72. hasPriv('repo', 'editComment') && $index + 1 == $commentCount ? icon('edit pull-right edit-comment cursor-pointer') : null
  73. )
  74. );
  75. }
  76. $tabs[] = tabPane
  77. (
  78. set::title($bug->title),
  79. set::key("tab-bug-{$bug->id}"),
  80. set::active($bug->id == $currentBug),
  81. div
  82. (
  83. setClass('pb-4'),
  84. div
  85. (
  86. userAvatar
  87. (
  88. set::size(16),
  89. set::user(zget($users, $bug->openedBy)),
  90. set::realname(isset($users[$bug->openedBy]) ? $users[$bug->openedBy]->realname : $bug->openedBy)
  91. ),
  92. span
  93. (
  94. setClass('strong px-2'),
  95. isset($users[$bug->openedBy]) ? $users[$bug->openedBy]->realname : $bug->openedBy
  96. ),
  97. span
  98. (
  99. setClass('text-muted'),
  100. sprintf($lang->repo->dateTmpl, $bug->openedDate)
  101. )
  102. ),
  103. div
  104. (
  105. setClass('mt-2'),
  106. $lang->repo->issueTitle,
  107. div(setClass('font-bold'), $bug->title)
  108. ),
  109. div
  110. (
  111. setClass('mt-2 flex', $bug->steps ? '' : 'hidden'),
  112. span(setClass('flex-none'), $lang->repo->issueDesc),
  113. div(setClass('ml-2 font-bold'), html($bug->steps))
  114. ),
  115. hasPriv('repo', 'addComment') ? div
  116. (
  117. setClass('mt-2 canvas'),
  118. tabs(tabPane
  119. (
  120. set::title($lang->repo->commentary),
  121. set::active(true),
  122. div
  123. (
  124. setClass('canvas comment-block'),
  125. set('data-id', $bug->id),
  126. textarea
  127. (
  128. set::rows(3),
  129. set::name('comment'),
  130. setClass('commentText form-control'),
  131. set::placeholder($lang->repo->notice->commentContent)
  132. ),
  133. formHidden('objectID', $bug->id),
  134. div
  135. (
  136. setClass('text-right'),
  137. btn
  138. (
  139. $lang->repo->submit,
  140. setClass('commentSubmit mt-2 primary size-sm')
  141. )
  142. )
  143. )
  144. ))
  145. ) : null,
  146. $commentBlock
  147. )
  148. );
  149. }
  150. $commonClass = 'canvas cursor-pointer absolute top-1';
  151. div
  152. (
  153. on::click('.commentSubmit')->call('saveComment', jsRaw('this')),
  154. on::click('.editSubmit')->call('editSubmit', jsRaw('this')),
  155. on::click('.edit-comment')->call('editComment', jsRaw('this')),
  156. on::click('.btn-left')->call('arrowTabs', 'bugTabs', 1),
  157. on::click('.btn-right')->call('arrowTabs', 'bugTabs', -2),
  158. on::click('.btn-close')->call('closeTabs'),
  159. tabs
  160. (
  161. set::id('bugTabs'),
  162. setClass('canvas px-2'),
  163. set::titleClass('clip'),
  164. div(setStyle(array('position' => 'absolute', 'width' => '100%', 'height' => '34px', 'background' => '#efefef', 'top' => '0px'))),
  165. $tabs,
  166. div(setClass($commonClass, 'left-0 z-20 arrow-left btn-left'), icon('chevron-left')),
  167. div(setClass($commonClass, 'right-4 z-20 arrow-right btn-right'), icon('chevron-right')),
  168. div(setClass($commonClass, 'right-0 z-20 arrow-right btn-close'), icon('close'))
  169. )
  170. );
  171. render('pagebase');