manageview.html.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <?php
  2. /**
  3. * The manageView view file of group 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 Shujie Tian<tianshujie@easycorp.ltd>
  7. * @package group
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $viewCheckList = null;
  12. foreach($lang->mainNav as $menuKey => $menu)
  13. {
  14. if(!is_string($menu)) continue;
  15. list($moduleName, $module) = explode('|', $menu);
  16. if($menuKey == 'my') continue;
  17. $moduleName = strip_tags($moduleName);
  18. $viewCheckList[] = checkbox
  19. (
  20. set::rootClass('group-item'),
  21. set::id($menuKey),
  22. set::name('actions[views][' . strtolower($menuKey) . ']'),
  23. set::text($moduleName),
  24. set::checked(isset($group->acl['views'][$menuKey]) || empty($group->acl['views'])),
  25. on::change('toggleBox')
  26. );
  27. }
  28. $viewCheckList[] = checkbox
  29. (
  30. set::rootClass('group-item'),
  31. set::name('actionallchecker'),
  32. set::text($lang->selectAll),
  33. set::checked(empty($group->acl['views'])),
  34. on::click('selectAll'),
  35. on::change('toggleBox')
  36. );
  37. function getActionsBox($navGroup, $group, $module)
  38. {
  39. global $lang, $app;
  40. $actionsBox = null;
  41. if(isset($lang->action->dynamicAction->$module))
  42. {
  43. foreach($lang->action->dynamicAction->$module as $action => $actionTitle)
  44. {
  45. if(!helper::hasFeature($module)) continue;
  46. $actionsBox[] = div
  47. (
  48. set::className('action-item'),
  49. set::style(array('flex' => $app->getClientLang() == 'en' ? '0 1 32%' : '0 1 18%')),
  50. checkbox
  51. (
  52. set::id("{$module}-{$action}"),
  53. set::name("actions[actions][$module][$action]"),
  54. set::text($actionTitle),
  55. set::checked(isset($group->acl['actions'][$module][$action]) || !isset($group->acl['actions']))
  56. )
  57. );
  58. }
  59. }
  60. if(isset($navGroup[$module]))
  61. {
  62. foreach($navGroup[$module] as $subModule)
  63. {
  64. if(isset($lang->action->dynamicAction->$subModule))
  65. {
  66. foreach($lang->action->dynamicAction->$subModule as $action => $actionTitle)
  67. {
  68. if(!helper::hasFeature($subModule)) continue;
  69. $actionsBox[] = div
  70. (
  71. set::className('action-item'),
  72. set::style(array('flex' => $app->getClientLang() == 'en' ? '0 1 32%' : '0 1 18%')),
  73. checkbox
  74. (
  75. set::id("$subModule-$action"),
  76. set::name("actions[actions][$subModule][$action]"),
  77. set::text($actionTitle),
  78. set::checked(isset($group->acl['actions'][$subModule][$action]) || !isset($group->acl['actions']))
  79. )
  80. );
  81. }
  82. }
  83. }
  84. }
  85. return $actionsBox;
  86. }
  87. $dynamicActionList = null;
  88. if($config->vision != 'or')
  89. {
  90. foreach($lang->mainNav as $module => $title)
  91. {
  92. if(!is_string($title)) continue;
  93. /* Ignore null actions menus. */
  94. $isNullActions = true;
  95. if(isset($lang->action->dynamicAction->$module)) $isNullActions = false;
  96. if(isset($navGroup[$module]) and $isNullActions)
  97. {
  98. foreach($navGroup[$module] as $subModule)
  99. {
  100. if(isset($lang->action->dynamicAction->$subModule))
  101. {
  102. $isNullActions = false;
  103. break;
  104. }
  105. }
  106. }
  107. if($isNullActions) continue;
  108. $dynamicActionList[] = div
  109. (
  110. set::id("{$module}ActionBox"),
  111. set::className('flex w-full'),
  112. div
  113. (
  114. set::className('flex item-center action-title'),
  115. checkbox
  116. (
  117. set::name('allchecker'),
  118. on::click('selectItems')
  119. ),
  120. span(html(substr($title, 0, strpos($title, '|'))))
  121. ),
  122. div
  123. (
  124. set::className('flex check-list-inline w-full justify-start'),
  125. getActionsBox($navGroup, $group, $module)
  126. )
  127. );
  128. }
  129. }
  130. formPanel
  131. (
  132. set::id('manageViewForm'),
  133. div
  134. (
  135. set::className('flex'),
  136. span
  137. (
  138. set::className('text-md font-bold'),
  139. icon('lock mr-2'),
  140. $group->name
  141. ),
  142. span
  143. (
  144. set::className('text-md text-gray'),
  145. html($lang->arrow),
  146. $lang->group->manageView
  147. )
  148. ),
  149. formGroup
  150. (
  151. set::label($lang->group->viewList),
  152. set::className('items-center'),
  153. div
  154. (
  155. set::className('viewBox check-list-inline flex flex-wrap w-full'),
  156. $viewCheckList
  157. )
  158. ),
  159. $config->systemMode == 'ALM' ? formRow
  160. (
  161. set::id('programBox'),
  162. set::className('items-center hidden'),
  163. formGroup
  164. (
  165. setClass('items-center'),
  166. set::label($lang->group->programList),
  167. $programs ? inputGroup
  168. (
  169. setClass('input-control'),
  170. picker
  171. (
  172. set::name('actions[programs][]'),
  173. set::items($programs),
  174. set::value(isset($group->acl['programs']) ? join(',', $group->acl['programs']) : ''),
  175. set::multiple(true)
  176. ),
  177. div
  178. (
  179. setClass('input-group-btn flex'),
  180. div
  181. (
  182. setClass('btn btn-default cursor-text'),
  183. icon('info text-warning'),
  184. $lang->group->noticeVisit
  185. )
  186. )
  187. ) : span(
  188. set::className('flex items-center'),
  189. icon('info text-warning mr-2'),
  190. $lang->group->noneProgram
  191. )
  192. )
  193. ) : null,
  194. formRow
  195. (
  196. set::id('productBox'),
  197. set::className('items-center hidden'),
  198. formGroup
  199. (
  200. setClass('items-center'),
  201. set::label($lang->group->productList),
  202. $products ? inputGroup
  203. (
  204. picker
  205. (
  206. set::name('actions[products][]'),
  207. set::items($products),
  208. set::value(isset($group->acl['products']) ? join(',', $group->acl['products']) : ''),
  209. set::multiple(true)
  210. ),
  211. div
  212. (
  213. setClass('input-group-btn flex'),
  214. div
  215. (
  216. setClass('btn btn-default cursor-text'),
  217. icon('info text-warning'),
  218. $lang->group->noticeVisit
  219. )
  220. )
  221. ) : span(
  222. set::className('flex items-center'),
  223. icon('info text-warning mr-2'),
  224. $lang->group->noneProduct
  225. )
  226. )
  227. ),
  228. formRow
  229. (
  230. set::className('items-center hidden'),
  231. set::id('projectBox'),
  232. formGroup
  233. (
  234. setClass('items-center'),
  235. set::label($lang->group->projectList),
  236. $projects ? inputGroup(picker
  237. (
  238. set::name('actions[projects][]'),
  239. set::items($projects),
  240. set::value(isset($group->acl['projects']) ? join(',', $group->acl['projects']) : ''),
  241. set::multiple(true)
  242. ), div
  243. (
  244. setClass('input-group-btn flex'),
  245. div
  246. (
  247. setClass('btn btn-default cursor-text'),
  248. icon('info text-warning'),
  249. $lang->group->noticeVisit
  250. )
  251. )) : span(
  252. set::className('flex items-center'),
  253. icon('info text-warning mr-2'),
  254. $lang->group->noneProject
  255. )
  256. )
  257. ),
  258. formRow
  259. (
  260. set::className('items-center hidden'),
  261. set::id('executionBox'),
  262. formGroup
  263. (
  264. setClass('items-center'),
  265. set::label($lang->group->executionList),
  266. $executions ? inputGroup
  267. (
  268. picker
  269. (
  270. set::name('actions[sprints][]'),
  271. set::items($executions),
  272. set::value(isset($group->acl['sprints']) ? join(',', $group->acl['sprints']) : ''),
  273. set::multiple(true)
  274. ),
  275. div
  276. (
  277. setClass('input-group-btn flex'),
  278. div
  279. (
  280. setClass('btn btn-default cursor-text'),
  281. icon('info text-warning'),
  282. $lang->group->noticeVisit
  283. )
  284. )
  285. ) : span(
  286. set::className('flex items-center'),
  287. icon('info text-warning mr-2'),
  288. $lang->group->noneExecution
  289. )
  290. )
  291. ),
  292. $config->vision != 'or' ? formGroup
  293. (
  294. set::label($lang->group->dynamic),
  295. $dynamicActionList
  296. ) : null
  297. );
  298. /* ====== Render page ====== */
  299. render();