edit.html.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <?php
  2. /**
  3. * The create view file of mr 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 mr
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. h::importJs('js/misc/base64.js');
  12. jsVar('hostID', $MR->hostID);
  13. jsVar('projectID', $MR->sourceProject);
  14. $module = $app->tab == 'devops' ? 'repo' : $app->tab;
  15. dropmenu
  16. (
  17. set::module($module),
  18. set::tab($module),
  19. set::url(createLink($module, 'ajaxGetDropMenu', "objectID=$objectID&module={$app->rawModule}&method={$app->rawMethod}"))
  20. );
  21. $noEditBranch = $MR->status == 'merged' || $MR->status == 'closed' || $host->type == 'gogs';
  22. formPanel
  23. (
  24. set::title($lang->mr->edit),
  25. formRow(formGroup
  26. (
  27. set::width('1/2'),
  28. set::label($lang->repo->common),
  29. set::value($sourceProject),
  30. set::control('static')
  31. ), formGroup
  32. (
  33. setClass('hidden'),
  34. set::label($lang->mr->targetProject),
  35. set::value($targetProject),
  36. set::control('static')
  37. )),
  38. formRow(formGroup
  39. (
  40. set::width('1/2'),
  41. set::label($lang->mr->sourceBranch),
  42. set::value($MR->sourceBranch),
  43. set::control('static')
  44. ), formGroup
  45. (
  46. set::width('1/2'),
  47. !$noEditBranch ? set::required(true) : null,
  48. set::label($lang->mr->targetBranch),
  49. set::value($MR->targetBranch),
  50. !$noEditBranch ? set::name('targetBranch') : null,
  51. !$noEditBranch ? set::items($branches) : set::control('static')
  52. ), $noEditBranch ? input
  53. (
  54. set::type('hidden'),
  55. set::name('targetBranch'),
  56. set::value($MR->targetBranch)
  57. ) : null),
  58. formGroup
  59. (
  60. set::required(true),
  61. set::name('title'),
  62. set::label($lang->mr->title),
  63. set::value($MR->title)
  64. ),
  65. formGroup
  66. (
  67. set::disabled($noEditBranch),
  68. set::width('1/2'),
  69. set::required(true),
  70. set::name('assignee'),
  71. set::label($lang->mr->reviewer),
  72. set::control('picker'),
  73. set::items($users),
  74. set::value($MR->assignee)
  75. ),
  76. $noEditBranch ? input
  77. (
  78. set::type('hidden'),
  79. set::name('assignee'),
  80. set::value($MR->assignee)
  81. ) : null,
  82. formRow
  83. (
  84. formGroup
  85. (
  86. set::disabled($noEditBranch),
  87. set::label($lang->mr->submitType),
  88. set::name('needCI'),
  89. set::width('270px'),
  90. set::control(array('control' => 'checkbox', 'text' => $lang->mr->needCI, 'value' => '1', 'checked' => $MR->needCI == '1')),
  91. on::change('onNeedCiChange')
  92. ),
  93. $noEditBranch ? input
  94. (
  95. set::type('hidden'),
  96. set::name('needCI'),
  97. set::value($MR->needCI)
  98. ) : null,
  99. formGroup
  100. (
  101. set::name('removeSourceBranch'),
  102. set::width('150px'),
  103. set::control(array('control' => 'checkbox', 'text' => $lang->mr->removeSourceBranch, 'value' => '1', 'checked' => $MR->removeSourceBranch == '1')),
  104. set::disabled($noEditBranch)
  105. ),
  106. $noEditBranch ? input
  107. (
  108. set::type('hidden'),
  109. set::name('removeSourceBranch'),
  110. set::value($MR->removeSourceBranch)
  111. ) : null,
  112. formGroup
  113. (
  114. set::disabled($noEditBranch),
  115. set::name('squash'),
  116. set::control(array('control' => 'checkbox', 'text' => $lang->mr->squash, 'value' => '1', 'checked' => $MR->squash == '1')),
  117. btn(icon('help'), setClass('text-gray size-sm mt-1 ghost'), set('data-placement', 'right'), set('data-type', 'white'), set('data-class-name', 'text-gray border border-light'), toggle::tooltip(array('title' => $lang->mr->squashHelp)))
  118. ),
  119. $noEditBranch ? input
  120. (
  121. set::type('hidden'),
  122. set::name('squash'),
  123. set::value($MR->squash)
  124. ) : null
  125. ),
  126. formRow
  127. (
  128. $MR->needCI == '1' ? null : setClass('hidden'),
  129. formGroup
  130. (
  131. set::disabled($noEditBranch),
  132. set::width('1/2'),
  133. set::required(true),
  134. set::name('jobID'),
  135. set::label($lang->mr->pipeline),
  136. set::control('picker'),
  137. set::items($jobList),
  138. set::value($MR->jobID)
  139. ),
  140. $noEditBranch ? input
  141. (
  142. set::type('hidden'),
  143. set::name('jobID'),
  144. set::value($MR->jobID)
  145. ) : null
  146. ),
  147. formGroup
  148. (
  149. set::name('description'),
  150. set::label($lang->mr->description),
  151. set::control('textarea'),
  152. set::value($MR->description)
  153. ),
  154. formRow
  155. (
  156. setClass('hidden'),
  157. formGroup
  158. (
  159. set::name('repoID'),
  160. set::label($lang->devops->repo),
  161. set::value($MR->repoID)
  162. )
  163. )
  164. );
  165. render();