batchcreate.html.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /**
  3. * The batchCreate view file of bug 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 Mengyi Liu <liumengyi@easycorp.ltd>
  7. * @package bug
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. $defaultBug = array('module' => $moduleID, 'project' => $projectID, 'execution' => $executionID, 'openedBuild' => 'trunk', 'pri' => 3, 'severity' => 3);
  12. if($product->type != 'normal') $defaultBug['branch'] = $branch;
  13. if($product->shadow) unset($customFields['plan']);
  14. if(isset($executionType) && $executionType == 'kanban')
  15. {
  16. $defaultBug['region'] = $regionID;
  17. $defaultBug['laneID'] = $laneID;
  18. }
  19. $bugs = array();
  20. if(!empty($titles))
  21. {
  22. foreach($titles as $title => $fileName)
  23. {
  24. $bug = $defaultBug;
  25. $bug['title'] = $title;
  26. $bug['uploadImage'] = $fileName;
  27. $bugs[] = $bug;
  28. }
  29. }
  30. foreach(array_filter(explode(',', $config->bug->create->requiredFields)) as $field) $requiredFields[$field] = '';
  31. $items = array();
  32. /* Field of id. */
  33. $items[] = array('name' => 'id', 'label' => $lang->idAB, 'control' => 'index', 'width' => '32px');
  34. if($bugs) $items[] = array('name' => 'uploadImage', 'label' => '', 'control' => 'hidden', 'hidden' => true);
  35. /* Field of branch. */
  36. if($product->type != 'normal') $items[] = array('name' => 'branch', 'label' => $lang->product->branchName[$product->type], 'control' => 'picker', 'items' => $branches, 'value' => $branch, 'width' => '200px', 'ditto' => true, 'hidden' => strpos(",{$showFields},", ',branch,') === false);
  37. /* Field of module. */
  38. $items[] = array('name' => 'module', 'label' => $lang->bug->module, 'control' => 'picker', 'items' => $moduleOptionMenu, 'value' => $moduleID, 'width' => '200px', 'required' => isset($requiredFields['module']), 'ditto' => true);
  39. /* Field of project. */
  40. $items[] = array('name' => 'project', 'label' => $lang->bug->project, 'control' => array('control' => 'picker', 'required' => !empty($product->shadow)), 'items' => $projects, 'value' => $projectID, 'width' => '200px', 'required' => isset($requiredFields['project']), 'ditto' => true);
  41. /* Field of execution. */
  42. $items[] = array
  43. (
  44. 'name' => 'execution',
  45. 'label' => isset($project->model) && $project->model == 'kanban' ? $lang->bug->kanban : $lang->bug->execution,
  46. 'control' => 'picker',
  47. 'items' => $executions,
  48. 'value' => $executionID,
  49. 'width' => '200px',
  50. 'required' => isset($requiredFields['execution']),
  51. 'hidden' => !empty($project) && isset($project->multiple) && empty($project->multiple),
  52. 'ditto' => true
  53. );
  54. /* Field of openedBuild. */
  55. $items[] = array('name' => 'openedBuild', 'label' => $lang->bug->openedBuild, 'control' => 'picker', 'items' => $builds, 'value' => 'trunk', 'multiple' => true, 'width' => '200px', 'required' => true, 'ditto' => true);
  56. /* Field of plan. */
  57. if(!$product->shadow) $items[] = array('name' => 'plan', 'label' => $lang->bug->plan, 'control' => 'picker', 'items' => $plans, 'value' => '', 'width' => '200px', 'required' => isset($requiredFields['plan']), 'ditto' => true);
  58. /* Field of title. */
  59. $items[] = array( 'name' => 'title', 'label' => $lang->bug->title, 'width' => '240px', 'required' => true, 'control' => 'colorInput');
  60. /* Field of region and lane. */
  61. if(isset($executionType) && $executionType == 'kanban')
  62. {
  63. $items[] = array('name' => 'region', 'label' => $lang->kanbancard->region, 'control' => 'picker', 'value' => $regionID, 'items' => $regionPairs, 'width' => '200px', 'required' => true);
  64. $items[] = array('name' => 'laneID', 'label' => $lang->kanbancard->lane, 'control' => 'picker', 'value' => $laneID, 'items' => $lanePairs, 'width' => '200px', 'required' => true);
  65. }
  66. /* Field of deadline. */
  67. $items[] = array('name' => 'deadline', 'label' => $lang->bug->deadline, 'control' => 'date', 'width' => '136px', 'required' => isset($requiredFields['deadline']), 'ditto' => true);
  68. /* Field of steps. */
  69. $items[] = array('name' => 'steps', 'control' => 'textarea', 'label' => $lang->bug->steps, 'width' => '240px', 'required' => isset($requiredFields['steps']));
  70. /* Field of type. */
  71. $items[] = array('name' => 'type', 'label' => $lang->typeAB, 'control' => 'picker', 'items' => $lang->bug->typeList, 'value' => '', 'width' => '160px', 'required' => isset($requiredFields['type']), 'ditto' => true);
  72. $items[] = array('name' => 'assignedTo', 'label' => $lang->bug->assignedTo, 'control' => 'picker', 'items' => $users, 'width' => '200px');
  73. /* Field of pri. */
  74. $items[] = array('name' => 'pri', 'label' => $lang->bug->pri, 'control' => array('control' => 'priPicker', 'required' => true), 'items' => $lang->bug->priList, 'value' => 3, 'width' => '100px', 'required' => isset($requiredFields['pri']), 'ditto' => true);
  75. /* Field of severity. */
  76. $items[] = array('name' => 'severity', 'label' => $lang->bug->severity, 'control' => array('control' => 'severityPicker', 'required' => true), 'items' => $lang->bug->severityList, 'value' => 3, 'width' => '80px', 'required' => isset($requiredFields['severity']));
  77. /* Field of os. */
  78. $items[] = array('name' => 'os', 'label' => $lang->bug->os, 'control' => 'picker', 'items' => $lang->bug->osList, 'width' => '200px', 'multiple' => true, 'required' => isset($requiredFields['os']));
  79. /* Field of browser. */
  80. $items[] = array('name' => 'browser', 'label' => $lang->bug->browser, 'control' => 'picker', 'items' => $lang->bug->browserList, 'width' => '200px', 'multiple' => true, 'required' => isset($requiredFields['browser']));
  81. /* Field of keywords. */
  82. $items[] = array('name' => 'keywords', 'label' => $lang->bug->keywords, 'width' => '200px', 'required' => isset($requiredFields['keywords']));
  83. formBatchPanel
  84. (
  85. set::title($lang->bug->batchCreate),
  86. set::uploadParams('module=bug&params=' . helper::safe64Encode("productID=$product->id&branch=$branch&executionID=$executionID&moduleID=$moduleID")),
  87. set::customFields(array('list' => $customFields, 'show' => explode(',', $showFields), 'key' => 'batchCreateFields')),
  88. set::pasteField('title'),
  89. $bugs ? set::data($bugs) : null,
  90. set::items($items),
  91. on::change('[data-name="branch"]', 'setBranchRelated'),
  92. on::change('[data-name="project"]', 'loadProductExecutionsByProject'),
  93. on::change('[data-name="execution"]', 'loadExecutionBuilds'),
  94. on::change('[data-name="region"]', 'setLane'),
  95. formHidden('product', $product->id)
  96. );
  97. render();