createlib.html.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <?php
  2. /**
  3. * The createLib 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 Shujie Tian<tianshujie@easycorp.ltd>
  7. * @package doc
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('libType', $type);
  12. $acl = 'default';
  13. if($type == 'mine') $acl = 'private';
  14. if($type == 'custom') $acl = 'open';
  15. $renderObjectBox = function(string $type) use ($lang, $objects, $objectID)
  16. {
  17. if(!in_array($type, array('product', 'project', 'execution'))) return null;
  18. $items = $type === 'execution'
  19. ? $objects
  20. : createLink($type, 'ajaxGetDropMenu', "objectID=$objectID&module=&method=&extra=selectmode&useLink=0");
  21. return formRow(
  22. setClass('objectBox'),
  23. formGroup(
  24. set::id('object'),
  25. set::width('5/6'),
  26. set::label($lang->doc->{$type}),
  27. set::name($type),
  28. set::items($items),
  29. set::value($objectID),
  30. set::required(true),
  31. $type == 'project' ? on::change('loadExecution') : null
  32. )
  33. );
  34. };
  35. formPanel
  36. (
  37. set::title($lang->doc->createLib),
  38. on::change('[name=product]', 'checkObjectPriv'),
  39. on::change('[name=project]', 'checkObjectPriv'),
  40. on::change('[name=execution]', 'checkObjectPriv'),
  41. on::change('[name^=users]', 'checkObjectPriv'),
  42. in_array($type, array('product', 'project')) ? formGroup
  43. (
  44. set::label($lang->doc->libType),
  45. setClass($config->vision == 'lite' ? 'hidden' : ''),
  46. set::width('5/6'),
  47. radioList
  48. (
  49. set::name('libType'),
  50. set::items($lang->doclib->type),
  51. set::value('wiki'),
  52. set::inline(true),
  53. on::change('changeDoclibAcl')
  54. )
  55. ) : null,
  56. $renderObjectBox($type),
  57. in_array($type, array('product', 'project', 'execution')) && $app->tab == 'doc' && $type == 'project' ? formRow
  58. (
  59. setClass('executionBox'),
  60. formGroup
  61. (
  62. set::label($lang->doc->execution),
  63. set::width('5/6'),
  64. set::name('execution'),
  65. set::items($executionPairs),
  66. set::placeholder($lang->doclib->tip->selectExecution),
  67. set::disabled(empty($project->multiple))
  68. ),
  69. formGroup
  70. (
  71. icon
  72. (
  73. 'help',
  74. set('data-toggle', 'tooltip'),
  75. set('data-title', $lang->doclib->tip->selectExecution),
  76. set('data-placement', 'right'),
  77. set('data-type', 'white'),
  78. set('data-class-name', 'text-gray border border-light'),
  79. setClass('ml-2 mt-2 text-gray')
  80. )
  81. )
  82. ) : null,
  83. $type == 'custom' || $type == 'mine' ? formRow
  84. (
  85. formGroup
  86. (
  87. set::label($lang->doc->space),
  88. set::required(true),
  89. set::width('5/6'),
  90. inputGroup
  91. (
  92. set::seg(true),
  93. picker
  94. (
  95. $spaces ? null : setClass('hidden'),
  96. set::name('parent'),
  97. set::items($spaces),
  98. set::value($spaceID),
  99. set::required(true)
  100. ),
  101. input($spaces ? setClass('hidden') : null, set::name('spaceName')),
  102. div
  103. (
  104. setClass('input-group-addon'),
  105. checkbox
  106. (
  107. on::change('toggleNewSpace'),
  108. set::name('newSpace'),
  109. set::checked(empty($spaces)),
  110. set::text($lang->doclib->createSpace)
  111. )
  112. )
  113. )
  114. )
  115. ) : null,
  116. formRow
  117. (
  118. setClass('normalLib'),
  119. formGroup
  120. (
  121. set::label($lang->doclib->name),
  122. set::width('5/6'),
  123. set::name('name')
  124. )
  125. ),
  126. formRow
  127. (
  128. setID('orderBox'),
  129. formGroup
  130. (
  131. set::label($lang->doclib->defaultOrder),
  132. set::width('5/6'),
  133. radioList
  134. (
  135. set::name('orderBy'),
  136. set::items($lang->doclib->idOrder),
  137. set::value('id_asc'),
  138. set::inline(true)
  139. )
  140. )
  141. ),
  142. formRow
  143. (
  144. setClass('apilib hidden'),
  145. formGroup
  146. (
  147. set::label($lang->api->baseUrl),
  148. set::width('5/6'),
  149. set::name('baseUrl'),
  150. set::placeholder($lang->api->baseUrlDesc)
  151. )
  152. ),
  153. formRow
  154. (
  155. setID('aclBox'),
  156. formGroup
  157. (
  158. set::label($lang->doclib->control),
  159. set::width('5/6'),
  160. radioList
  161. (
  162. set::name('acl'),
  163. set::items($lang->doclib->aclList),
  164. set::value(isset($acl) ? $acl : ''),
  165. on::change("toggleAcl('lib')")
  166. )
  167. )
  168. ),
  169. formRow
  170. (
  171. setID('whiteListBox'),
  172. setClass('hidden'),
  173. formGroup
  174. (
  175. set::label($lang->doc->whiteList),
  176. set::width('5/6'),
  177. div
  178. (
  179. setClass('w-full check-list'),
  180. div
  181. (
  182. setClass('w-full'),
  183. inputGroup
  184. (
  185. $lang->doclib->group,
  186. picker
  187. (
  188. set::name('groups[]'),
  189. set::items($groups),
  190. set::multiple(true)
  191. )
  192. )
  193. ),
  194. div
  195. (
  196. setClass('w-full'),
  197. userPicker(set::label($lang->doclib->user), set::items($users))
  198. )
  199. )
  200. )
  201. ),
  202. formRow
  203. (
  204. setID('aclAPIBox'),
  205. setClass('hidden'),
  206. formGroup
  207. (
  208. set::label($lang->doclib->control),
  209. radioList
  210. (
  211. set::name('acl'),
  212. set::items($lang->api->aclList)
  213. )
  214. )
  215. ),
  216. formRow
  217. (
  218. setID('aclOtherBox'),
  219. setClass('hidden'),
  220. formGroup
  221. (
  222. set::label($lang->doclib->control),
  223. radioList
  224. (
  225. set::name('acl'),
  226. set::items($lang->doclib->aclList)
  227. )
  228. ),
  229. formHidden('type', $type)
  230. )
  231. );
  232. /* ====== Render page ====== */
  233. render();