createbranch.html.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. /**
  3. * The create branch view file of repo 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 Yanyi Cao <caoyanyi@easycorp.ltd>
  7. * @package repo
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('module', $objectType);
  12. jsVar('linkParams', "objectID={$objectID}&repoID=%s");
  13. jsVar('branchLang', $lang->repo->branch);
  14. jsVar('tagLang', $lang->repo->tag);
  15. modalHeader
  16. (
  17. set::title($lang->repo->codeBranch),
  18. set::titleClass('panel-title text-lg')
  19. );
  20. $branchDom = array();
  21. foreach($linkedBranches as $branch)
  22. {
  23. $branchName = helper::safe64Encode(base64_encode($branch->BType));
  24. $branchDom[] = h::tr
  25. (
  26. h::td(a
  27. (
  28. set::href(createLink('repo', 'browse', "repoID={$branch->BID}")),
  29. zget($allRepos, $branch->BID, '')
  30. )),
  31. h::td(a(
  32. set::href(createLink('repo', 'browse', "repoID={$branch->BID}&branch={$branchName}")),
  33. $branch->BType
  34. )),
  35. common::hasPriv($objectType, 'unlinkBranch') ? h::td(
  36. a
  37. (
  38. setClass('btn ghost toolbar-item square size-sm text-primary ajax-submit'),
  39. setData(array(
  40. 'url' => createLink($objectType, 'unlinkBranch'),
  41. 'data' => "{\"branch\": \"$branch->BType\", \"objectID\": $objectID, \"repoID\": $branch->BID}",
  42. 'confirm' => sprintf($lang->repo->notice->unlinkBranch, $lang->{$objectType}->common)
  43. )),
  44. set::title($lang->repo->unlink),
  45. icon('unlink')
  46. )
  47. ) : null
  48. );
  49. }
  50. if(!$canCreate)
  51. {
  52. $noticeField = $objectType . 'NotActive';
  53. div
  54. (
  55. setClass('alert with-icon mb-4'),
  56. icon('exclamation-sign text-warning text-2xl'),
  57. div
  58. (
  59. setClass('content'),
  60. $lang->repo->notice->$noticeField
  61. )
  62. );
  63. }
  64. empty($linkedBranches) ? null : div
  65. (
  66. div
  67. (
  68. setClass('panel-title text-md'),
  69. $lang->repo->createdBranch
  70. ),
  71. h::table
  72. (
  73. setClass('table condensed bordered mb-4 mt-2 text-center'),
  74. h::tr
  75. (
  76. h::th
  77. (
  78. width('100px'),
  79. $lang->repo->codeRepo
  80. ),
  81. h::th
  82. (
  83. width('150px'),
  84. $lang->repo->branchName
  85. ),
  86. common::hasPriv($objectType, 'unlinkBranch') ? h::th
  87. (
  88. width('60px'),
  89. $lang->actions
  90. ) : null
  91. ),
  92. $branchDom
  93. )
  94. );
  95. $canCreate ? formPanel
  96. (
  97. setID('branchCreateForm'),
  98. set::title($lang->repo->createBranchAction),
  99. set::titleClass('panel-title text-md'),
  100. formGroup
  101. (
  102. setID('repoID'),
  103. set::label($lang->repo->codeRepo),
  104. set::required(true),
  105. set::labelWidth($app->clientLang == 'zh-cn' ? '6em' : '9em'),
  106. $app->tab == 'devops' ? set::control("static") : null,
  107. $app->tab == 'devops' ? set::value(zget($repoPairs, $repoID)) : picker
  108. (
  109. set::required(true),
  110. set::name('codeRepo'),
  111. set::items($repoPairs),
  112. set::value($repoID),
  113. set::popPlacement('bottom'),
  114. on::change('window.onRepoChange')
  115. )
  116. ),
  117. formGroup
  118. (
  119. setID('branchFrom'),
  120. set::label($lang->repo->branchFrom),
  121. set::required(true),
  122. set::labelWidth($app->clientLang == 'zh-cn' ? '6em' : '9em'),
  123. picker
  124. (
  125. set::name('branchFrom'),
  126. set::required(true),
  127. set::popPlacement('bottom'),
  128. set::items($fromList),
  129. set::value(!empty($fromList[0]['items']) ? $fromList[0]['items'][0]['value'] : '')
  130. )
  131. ),
  132. formGroup
  133. (
  134. set::name('branchName'),
  135. set::label($lang->repo->branchName),
  136. set::labelWidth($app->clientLang == 'zh-cn' ? '6em' : '9em'),
  137. set::required(true),
  138. set::value("{$objectType}-{$objectID}")
  139. ),
  140. set::actions(array('submit'))
  141. ) : null;