browsegroup.html.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /**
  3. * The browsegroup view file of gitlab 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 Zeng Gang<zenggang@easycorp.ltd>
  7. * @package gitlab
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. if(!empty($permissionError))
  12. {
  13. jsCall('alertJump', array($permissionError, $errorJump));
  14. return;
  15. }
  16. jsVar('gitlabUrl', $gitlab->url);
  17. $canCreate = hasPriv('instance', 'manage');
  18. $menus = $items = array();
  19. $gitlabs = $this->gitlab->getPairs();
  20. foreach($gitlabs as $id => $gitlabName)
  21. {
  22. $menus[] = array('text' => $gitlabName, 'id' => $id, 'keys' => zget(common::convert2Pinyin(array($gitlabName), $gitlabName), ''), 'url' => helper::createLink('gitlab', zget($config->gitlab->menus, 'group', 'group'), "gitlabID={$id}"));
  23. }
  24. foreach($config->gitlab->menus as $key => $method)
  25. {
  26. $langKey = 'browse' . ucwords($key);
  27. $items[] = li
  28. (
  29. setClass('nav-item'),
  30. a
  31. (
  32. setClass('' . ($key == 'group' ? 'active' : '')),
  33. set::href(createLink('gitlab', $method, "gitlabID={$gitlabID}")),
  34. $lang->gitlab->$langKey
  35. )
  36. );
  37. }
  38. foreach($gitlabGroupList as $gitlabGroup)
  39. {
  40. $gitlabGroup->fullName = $gitlabGroup->full_name;
  41. $gitlabGroup->path = $gitlabGroup->full_path;
  42. $gitlabGroup->gitlabID = $gitlabID;
  43. $gitlabGroup->createOn = substr($gitlabGroup->created_at, 0, 10);
  44. $gitlabGroup->isAdmin = $app->user->admin || in_array($gitlabGroup->id, $adminGroupIDList);
  45. }
  46. foreach($config->gitlab->dtable->group->fieldList['actions']['list'] as $action => $gitlabConfig)
  47. {
  48. if(!$this->gitlab->isDisplay($action)) unset($config->gitlab->dtable->group->fieldList['actions']['list'][$action]);
  49. }
  50. $config->gitlab->dtable->group->fieldList['fullName']['avatarProps'] = jsRaw("(col, row) => ({text: row.data.name})");
  51. $gitlabGroupList = initTableData($gitlabGroupList, $config->gitlab->dtable->group->fieldList, $this->gitlab);
  52. featureBar
  53. (
  54. dropmenu
  55. (
  56. set::id('groupDropmenu'),
  57. set::objectID($gitlabID),
  58. set::text($gitlab->name),
  59. set::data(array('data' => array('group' => $menus), 'tabs' => array(array('name' => 'group', 'text' => ''))))
  60. ),
  61. $items,
  62. form
  63. (
  64. set::id('searchForm'),
  65. set::actions(array()),
  66. set::ajax(array('beforeSubmit' => jsRaw('() => {searchGroup(); return false;}'))),
  67. formRow
  68. (
  69. input
  70. (
  71. set::placeholder($lang->gitlab->placeholderSearch),
  72. set::name('keyword'),
  73. set::value($keyword)
  74. ),
  75. btn
  76. (
  77. setClass('primary'),
  78. $lang->gitlab->search,
  79. on::click('searchGroup')
  80. )
  81. )
  82. )
  83. );
  84. toolBar
  85. (
  86. $canCreate ? item(set(array
  87. (
  88. 'text' => $lang->gitlab->group->create,
  89. 'icon' => 'plus',
  90. 'class' => 'btn primary',
  91. 'url' => createLink('gitlab', 'createGroup', "gitlabID={$gitlabID}")
  92. ))) : null
  93. );
  94. dtable
  95. (
  96. set::cols($config->gitlab->dtable->group->fieldList),
  97. set::data($gitlabGroupList),
  98. set::sortLink(createLink('gitlab', 'browseGroup', "gitlabID={$gitlabID}&orderBy={name}_{sortType}")),
  99. set::onRenderCell(jsRaw('window.renderCell')),
  100. set::orderBy($orderBy)
  101. );
  102. render();