create.field.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace zin;
  3. global $lang, $app;
  4. $isShadowProduct = data('product.shadow');
  5. $noMultipleProject = data('project.multiple') === '0';
  6. $isOriginalProduct = (int)data('bug.productID') === (int)data('productID');
  7. $resultFiles = data('resultFiles');
  8. $copyFiles = data('bug.files');
  9. $files = $copyFiles ? array_values($copyFiles) : array_values($resultFiles);
  10. $fields = defineFieldList('bug.create', 'bug');
  11. $fields->field('product')->hidden($isShadowProduct && $isOriginalProduct);
  12. $fields->field('project')
  13. ->foldable(!$isShadowProduct)
  14. ->wrapAfter($isShadowProduct && $isOriginalProduct && $noMultipleProject)
  15. ->className($isShadowProduct && !$isOriginalProduct && !$noMultipleProject ? 'w-1/4' : 'w-1/2')
  16. ->className(($isShadowProduct && $isOriginalProduct) || $noMultipleProject ? 'full:w-1/2' : 'full:w-1/4');
  17. $fields->field('execution')
  18. ->label(data('project.model') === 'kanban' ? $lang->bug->kanban : $lang->bug->execution)
  19. ->hidden($noMultipleProject)
  20. ->className($isShadowProduct && !$isOriginalProduct ? 'w-1/4' : 'w-1/2')
  21. ->className($isShadowProduct && $isOriginalProduct ? 'full:w-1/2' : 'full:w-1/4')
  22. ->foldable(!$isShadowProduct);
  23. $fields->field('plan')
  24. ->label($lang->bug->plan)
  25. ->className('w-1/2 full:w-1/2')
  26. ->hidden($noMultipleProject)
  27. ->items(data('plans'))
  28. ->foldable();
  29. if(common::hasPriv('build', 'create'))
  30. {
  31. $fields->field('openedBuild')
  32. ->itemBegin()->control(array('control' => 'btn', 'data-toggle' => 'modal', 'id' => 'createBuild', 'data-size' => 'lg'))
  33. ->text($lang->build->create)->hint($lang->build->create)
  34. ->url(createLink('build', 'create', 'executionID=' . data('executionID') . '&productID=' . data('bug.productID') . '&projectID=' . data('projectID')))
  35. ->className(count(data('builds')) > 1 || !data('executionID') ? 'hidden' : '')
  36. ->itemEnd();
  37. }
  38. if(common::hasPriv('release', 'create') && !common::isTutorialMode())
  39. {
  40. $fields->field('openedBuild')
  41. ->itemBegin()->control(array('control' => 'btn', 'data-toggle' => 'modal', 'data-size' => 'lg','id' => 'createRelease'))
  42. ->text($lang->release->create)->hint($lang->release->create)
  43. ->url(createLink('release', 'create', 'productID=' . data('bug.productID') . '&branch=' . data('bug.branch') . '&status=normal'))
  44. ->className(count(data('builds')) > 1 || data('executionID') ? 'hidden' : '')
  45. ->itemEnd();
  46. }
  47. $fields->field('title')->className($isShadowProduct ? 'full:w-1/2' : 'full:w-full');
  48. $fields->field('steps')
  49. ->width('full')
  50. ->control(array('control' => 'editor', 'templateType' => 'bug'));
  51. $fields->field('files')
  52. ->width('full')
  53. ->control('fileSelector', array('defaultFiles' => $files));
  54. $fields->field('case')->foldable();
  55. $fields->field('story')->foldable();
  56. $fields->field('task')->foldable();
  57. $fields->field('feedbackBy')->foldable();
  58. $fields->field('notifyEmail')->foldable();
  59. $fields->field('browser')->foldable();
  60. $fields->field('os')->foldable();
  61. $fields->field('mailto')->foldable();
  62. $fields->field('keywords')->foldable();
  63. $fields->field('module')->className($isShadowProduct ? 'w-1/2' : 'w-1/4')->className('full:w-1/2');
  64. $fields->field('openedBuild')->className($isShadowProduct ? 'w-1/2' : 'w-1/4')->className('full:w-1/2');
  65. $fields->field('fileList')->control('hidden')->value($copyFiles ? $copyFiles : $resultFiles);
  66. if($isShadowProduct && !$isOriginalProduct) $fields->moveAfter('module', 'product');