browsetask.html.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <?php
  2. /**
  3. * The browsetask view file of tree 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 Jinyong Zhu<zhujinyong@easycorp.ltd>
  7. * @package tree
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('rootID', $root->id);
  12. jsVar('viewType', 'task');
  13. $maxOrder = 0;
  14. /* Generate module rows. */
  15. $moduleRows = array();
  16. if($newModule and !$productID)
  17. {
  18. foreach($products as $product)
  19. {
  20. $moduleRows[] = formRow
  21. (
  22. formGroup
  23. (
  24. setClass('row-module'),
  25. input
  26. (
  27. setClass('col-module'),
  28. set::name("products[id$product->id]"),
  29. set::type('input'),
  30. set::value($product->name),
  31. set::disabled(true)
  32. )
  33. )
  34. );
  35. }
  36. }
  37. foreach($sons as $son)
  38. {
  39. if($son->order > $maxOrder) $maxOrder = $son->order;
  40. $moduleRows[] = formRow
  41. (
  42. formGroup
  43. (
  44. inputGroup
  45. (
  46. setClass('row-module'),
  47. input
  48. (
  49. setClass('col-module'),
  50. set::name("modules[id$son->id]"),
  51. set::type('input'),
  52. set::value($son->name),
  53. set::placeholder($lang->tree->name)
  54. ),
  55. input
  56. (
  57. setClass('col-short'),
  58. set::name("shorts[id$son->id]"),
  59. set::type('input'),
  60. set::value($son->short),
  61. set::placeholder($lang->tree->short)
  62. ),
  63. input
  64. (
  65. setClass('hidden'),
  66. set::name("order[id$son->id]"),
  67. set::value($son->order),
  68. set::control('hidden')
  69. )
  70. )
  71. )
  72. );
  73. }
  74. for($i = 0; $i < \tree::NEW_CHILD_COUNT; $i ++)
  75. {
  76. $moduleRows[] = formRow
  77. (
  78. formGroup
  79. (
  80. inputGroup
  81. (
  82. setClass('row-module'),
  83. input
  84. (
  85. setClass('col-module'),
  86. set::name("modules[$i]"),
  87. set::type('input'),
  88. set::value(''),
  89. set::placeholder($lang->tree->name)
  90. ),
  91. input
  92. (
  93. setClass('col-short'),
  94. set::name("shorts[$i]"),
  95. set::type('input'),
  96. set::value(''),
  97. set::placeholder($lang->tree->short)
  98. ),
  99. input
  100. (
  101. setClass('hidden'),
  102. set::name("branch[$i]"),
  103. set::value(0),
  104. set::control('hidden')
  105. )
  106. ),
  107. batchActions()
  108. )
  109. );
  110. }
  111. $parentPath = array();
  112. $parentPath[] = div
  113. (
  114. setClass('row flex-nowrap items-center text-clip'),
  115. a
  116. (
  117. setClass('tree-link text-clip'),
  118. set::title($root->name),
  119. set('href', helper::createLink('tree', 'browsetask', "rootID=$root->id&productID=$productID")),
  120. $root->name
  121. ),
  122. h::i
  123. (
  124. setClass('icon icon-angle-right muted align-middle'),
  125. setStyle('color', '#313C52')
  126. )
  127. );
  128. foreach($parentModules as $module)
  129. {
  130. $parentPath[] = div
  131. (
  132. setClass('row flex-nowrap items-center'),
  133. a
  134. (
  135. setClass('tree-link text-clip'),
  136. set('href', helper::createLink('tree', 'browsetask', "rootID=$root->id&productID=$productID&module=$module->id")),
  137. $module->name
  138. ),
  139. h::i
  140. (
  141. setClass('icon icon-angle-right muted align-middle'),
  142. setStyle('color', '#313C52')
  143. )
  144. );
  145. }
  146. div
  147. (
  148. setClass('flex gap-x-4 mb-3'),
  149. backBtn
  150. (
  151. set::icon('back'),
  152. set::type('secondary'),
  153. set::back('execution-task'),
  154. $lang->goback
  155. ),
  156. div
  157. (
  158. setClass('entity-label flex items-center gap-x-2 text-lg font-bold'),
  159. $lang->tree->common . $lang->hyphen . $root->name
  160. )
  161. );
  162. div
  163. (
  164. setClass('row gap-4'),
  165. sidebar
  166. (
  167. set::width(400),
  168. set::minWidth(350),
  169. set::maxWidth(550),
  170. set::toggleBtn(false),
  171. panel
  172. (
  173. set::title($title),
  174. treeEditor
  175. (
  176. set::selected($currentModuleID),
  177. set::type('task'),
  178. set::items($tree),
  179. set::canEdit(common::hasPriv('tree', 'edit') && $canBeChanged),
  180. set::canDelete(common::hasPriv('tree', 'delete') && $canBeChanged),
  181. set::sortable(array('handle' => '.icon-move')),
  182. set::onSort(jsRaw('window.updateOrder')),
  183. set::canSortTo(jsRaw('window.canSortTo'))
  184. )
  185. )
  186. ),
  187. div
  188. (
  189. setStyle('min-width', '60%'),
  190. panel
  191. (
  192. setClass('pb-4'),
  193. set::title($execution->multiple ? $lang->tree->manageTaskChild : $lang->tree->manageProjectChild),
  194. div
  195. (
  196. setClass('flex'),
  197. div
  198. (
  199. setClass('pr-2 tree-item-content row items-center'),
  200. setStyle('padding-bottom', '48px'),
  201. setStyle('max-width', '30%'),
  202. setStyle('flex-direction', 'row'),
  203. setStyle('flex-wrap', 'wrap'),
  204. setStyle('align-content', 'center'),
  205. $parentPath
  206. ),
  207. form
  208. (
  209. setClass('flex-1 form-horz'),
  210. set::url(helper::createLink('tree', 'manageChild', "root=$root->id&viewType=task")),
  211. $moduleRows,
  212. set::actions(array('submit', 'cancel')),
  213. set::back('execution-task'),
  214. set::actionsClass('justify-start'),
  215. input
  216. (
  217. set::type('hidden'),
  218. set::name('parentModuleID'),
  219. set::value($currentModuleID),
  220. set::control('hidden')
  221. ),
  222. input
  223. (
  224. set::type('hidden'),
  225. set::name('maxOrder'),
  226. set::value($maxOrder),
  227. set::control('hidden')
  228. )
  229. )
  230. )
  231. )
  232. )
  233. );
  234. render();