batchcreate.html.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. /**
  3. * The batch create view of story module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Yangyang Shi <shiyangyang@cnezsoft.com>
  8. * @package story
  9. * @version $Id$
  10. * @link http://www.zentao.net
  11. */
  12. ?>
  13. <?php include $this->app->getModuleRoot() . 'common/view/header.html.php';?>
  14. <div id="mainContent" class="main-content">
  15. <div class="main-header">
  16. <h2><?php echo $storyID ? $storyTitle . ' - ' . $this->lang->story->subdivide : $this->lang->story->batchCreate;?></h2>
  17. <div class="pull-right btn-toolbar">
  18. <?php if(common::hasPriv('file', 'uploadImages')) echo html::a($this->createLink('file', 'uploadImages', 'module=story&params=' . helper::safe64Encode("productID=$productID&branch=$branch&moduleID=$moduleID&storyID=$storyID&executionID=&plan=&type=$type")), $lang->uploadImages, '', "data-toggle='modal' data-type='iframe' class='btn btn-primary' data-width='70%'")?>
  19. <button type='button' data-toggle='modal' data-target="#importLinesModal" class="btn btn-primary"><?php echo $lang->pasteText;?></button>
  20. </div>
  21. </div>
  22. <?php
  23. $visibleFields = array();
  24. $requiredFields = array();
  25. foreach(explode(',', $showFields) as $field)
  26. {
  27. if($field) $visibleFields[$field] = '';
  28. }
  29. foreach(explode(',', $config->story->create->requiredFields) as $field)
  30. {
  31. if($field)
  32. {
  33. $requiredFields[$field] = '';
  34. if(strpos(",{$config->story->list->customBatchCreateFields},", ",{$field},") !== false) $visibleFields[$field] = '';
  35. }
  36. }
  37. unset($visibleFields['module']);
  38. ?>
  39. <form method='post' class='load-indicator main-form form-ajax' enctype='multipart/form-data' id="batchCreateForm">
  40. <div class="table-responsive">
  41. <table class="table table-form">
  42. <thead>
  43. <tr>
  44. <th class='c-module<?php echo zget($requiredFields, 'module', '', ' required');?>'><?php echo $lang->story->module;?></th>
  45. <th class='c-name required has-btn'><?php echo $lang->story->title;?></th>
  46. <th class='c-spec<?php echo zget($visibleFields, 'spec', ' hidden') . zget($requiredFields, 'spec', '', ' required');?>'><?php echo $lang->story->spec;?></th>
  47. <th class='c-pri<?php echo zget($requiredFields, 'pri', '', ' required');?>'><?php echo $lang->story->pri;?></th>
  48. <th class='c-estimate<?php echo zget($requiredFields, 'estimate', '', ' required');?>'><?php echo $lang->story->estimate;?></th>
  49. <th class="<?php if($forceReview) echo ' required'?>" style="width: 200px !important"><?php echo $lang->story->reviewedBy;?></th>
  50. <th class='c-keywords<?php echo zget($requiredFields, 'keywords', '', ' required');?>'><?php echo $lang->story->keywords;?></th>
  51. <?php
  52. $extendFields = $this->story->getFlowExtendFields();
  53. foreach($extendFields as $extendField) echo "<th class='c-extend'>{$extendField->name}</th>";
  54. ?>
  55. </tr>
  56. </thead>
  57. <tbody>
  58. <tr class="template">
  59. <td class='text-left' style='overflow:visible'><?php echo html::select('module[$id]', $moduleOptionMenu, $moduleID, "class='form-control chosen'");?></td>
  60. <td style='overflow:visible'>
  61. <div class="input-group">
  62. <div class="input-control has-icon-right">
  63. <input type="text" name="title[$id]" id="title$id" value="" class="form-control title-import input-story-title" autocomplete="off">
  64. <div class="colorpicker">
  65. <button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown"><span class="cp-title"></span><span class="color-bar"></span><i class="ic"></i></button>
  66. <ul class="dropdown-menu clearfix">
  67. <li class="heading"><?php echo $lang->story->colorTag;?><i class="icon icon-close"></i></li>
  68. </ul>
  69. <input type="hidden" class="colorpicker" id="color$id" name="color[$id]" value="" data-icon="color" data-wrapper="input-control-icon-right" data-update-color="#title$id">
  70. </div>
  71. </div>
  72. <span class="input-group-btn">
  73. <button type="button" class="btn btn-link btn-icon btn-copy" data-copy-from="#title$id" data-copy-to="#spec$id" title="<?php echo $lang->story->copyTitle;?>"><i class="icon icon-arrow-right"></i></button>
  74. </span>
  75. </div>
  76. </td>
  77. <td class='<?php echo zget($visibleFields, 'spec', 'hidden')?>'><textarea name="spec[$id]" id="spec$id" rows="1" class="form-control autosize"></textarea></td>
  78. <td class='text-left<?php echo zget($visibleFields, 'pri', ' hidden')?>' style='overflow:visible'><?php echo html::select('pri[$id]', $priList, $pri, "class='form-control chosen'");?></td>
  79. <td><?php echo html::input('estimate[$id]', $estimate, "class='form-control'");?></td>
  80. <td><?php echo html::select('reviewer[$id][]', $reviewers, '', "class='form-control chosen' multiple");?></td>
  81. <td><?php echo html::input('keywords[$id]', '', "class='form-control'");?></td>
  82. <?php foreach($extendFields as $extendField) echo "<td" . (($extendField->control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, '', $extendField->field . '[$id]') . "</td>";?>
  83. </tr>
  84. </tbody>
  85. <tfoot>
  86. <tr>
  87. <td colspan="7" class="text-center form-actions">
  88. <?php echo html::commonButton($lang->save, "id='saveButton'", 'btn btn-primary btn-wide');?>
  89. <?php echo html::commonButton($lang->story->saveDraft, "id='saveDraftButton'", 'btn btn-secondary btn-wide');?>
  90. <?php echo html::backButton();?>
  91. </td>
  92. </tr>
  93. </tfoot>
  94. </table>
  95. </div>
  96. </form>
  97. </div>
  98. <script>
  99. $(function()
  100. {
  101. var imageTitles = <?php echo empty($titles) ? '""' : json_encode($titles);?>;
  102. var storyTitles = <?php echo empty($titles) ? '""' : json_encode(array_keys($titles));?>;
  103. $('#batchCreateForm').batchActionForm(
  104. {
  105. idEnd: <?php echo max((empty($titles) ? 0 : count($titles)), 9)?>,
  106. rowCreator: function($row, index)
  107. {
  108. $row.find('select.chosen,select.picker-select').each(function()
  109. {
  110. var $select = $(this);
  111. if($select.hasClass('picker-select')) $select.parent().find('.picker').remove();
  112. if(index == 0) $select.find("option[value='ditto']").remove();
  113. if(index > 0) $select.val('ditto');
  114. if($select.attr('id').indexOf('branch') >= 0) $select.val('<?php echo $branch;?>')
  115. $select.chosen();
  116. setTimeout(function()
  117. {
  118. $select.next('.chosen-container').find('.chosen-drop').width($select.closest('td').width() + 50);
  119. }, 200);
  120. });
  121. var storyTitle = storyTitles && storyTitles[index];
  122. if (storyTitle !== undefined && storyTitle !== null)
  123. {
  124. $row.find('.input-story-title').val(storyTitle).after('<input type="hidden" name="uploadImage[' + index + ']" id="uploadImage[' + index + ']" value="' + imageTitles[storyTitle] + '">');
  125. }
  126. }
  127. });
  128. $(document).on('change', "#mainContent select[name^=needReview]", function()
  129. {
  130. select = $(this).parent('td').next('td').children("select[name^=reviewer]");
  131. $(select).removeAttr('disabled');
  132. if($(this).val() == 0) $(select).attr('disabled', 'disabled');
  133. $(select).trigger("chosen:updated");
  134. })
  135. });
  136. </script>
  137. <?php if(isset($execution)) js::set('execution', $execution);?>
  138. <?php js::set('storyType', $type);?>
  139. <?php include $this->app->getModuleRoot() . 'common/view/pastetext.html.php';?>
  140. <?php include $this->app->getModuleRoot() . 'common/view/footer.html.php';?>