* finish task #2540.

This commit is contained in:
chenfeiCF
2016-04-13 11:35:04 +08:00
parent f8ff737086
commit 3fec649bf1
4 changed files with 68 additions and 42 deletions
+4 -2
View File
@@ -24,10 +24,12 @@ $config->testcase->exportFields = '
pri, type, stage, status, lastRunResult, openedBy, openedDate,
lastEditedBy, lastEditedDate, version,linkCase';
$config->testcase->customCreateFields = 'stage,story,keywords';
$config->testcase->customCreateFields = 'stage,story,keywords';
$config->testcase->customBatchCreateFields = 'module,stage,story,precondition,keywords';
$config->testcase->custom = new stdclass();
$config->testcase->custom->create = $config->testcase->customCreateFields;
$config->testcase->custom->create = $config->testcase->customCreateFields;
$config->testcase->custom->batchcreate = $config->testcase->customBatchCreateFields;
global $lang;
$config->testcase->search['module'] = 'testcase';
+15 -14
View File
@@ -351,28 +351,29 @@ class testcase extends control
/* Set menu. */
$this->testcase->setMenu($this->products, $productID, $branch);
/* Init vars. */
$type = 'feature';
$title = '';
$title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->batchCreate;
$position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]);
$position[] = $this->lang->testcase->common;
$position[] = $this->lang->testcase->batchCreate;
/* Set story list. */
$story = $storyID ? $this->story->getByID($storyID) : '';
$storyList = $storyID ? array($storyID => $story->id . ':' . $story->title . '(' . $this->lang->story->pri . ':' . $story->pri . ',' . $this->lang->story->estimate . ':' . $story->estimate . ')') : array('');
$this->view->title = $title;
$this->view->position = $position;
/* Set module option menu. */
$moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch);
$moduleOptionMenu['ditto'] = $this->lang->testcase->ditto;
/* Set custom. */
foreach(explode(',', $this->config->testcase->customBatchCreateFields) as $field) $customFields[$field] = $this->lang->testcase->$field;
$this->view->customFields = $customFields;
$this->view->showFields = $this->config->testcase->custom->batchcreate;
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->batchCreate;
$this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]);
$this->view->position[] = $this->lang->testcase->common;
$this->view->position[] = $this->lang->testcase->batchCreate;
$this->view->productID = $productID;
$this->view->story = $story;
$this->view->storyList = $storyList;
$this->view->productName = $this->products[$productID];
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch);
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->view->currentModuleID = $currentModuleID;
$this->view->type = $type;
$this->view->title = $title;
$this->view->branch = $branch;
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
+16 -10
View File
@@ -119,16 +119,19 @@ class testcaseModel extends model
if($cases->type[$i] != '' and $cases->title[$i] != '')
{
$data[$i] = new stdclass();
$data[$i]->product = $productID;
$data[$i]->branch = $branch;
$data[$i]->module = $cases->module[$i];
$data[$i]->type = $cases->type[$i];
$data[$i]->story = $storyID ? $storyID : $cases->story[$i];
$data[$i]->title = $cases->title[$i];
$data[$i]->openedBy = $this->app->user->account;
$data[$i]->openedDate = $now;
$data[$i]->status = 'normal';
$data[$i]->version = 1;
$data[$i]->product = $productID;
$data[$i]->branch = $branch;
$data[$i]->module = $cases->module[$i];
$data[$i]->type = $cases->type[$i];
$data[$i]->stage = empty($cases->stage[$i]) ? '' : implode(',', $cases->stage[$i]);
$data[$i]->story = $storyID ? $storyID : $cases->story[$i];
$data[$i]->title = $cases->title[$i];
$data[$i]->precondition = $cases->precondition[$i];
$data[$i]->keywords = $cases->keywords[$i];
$data[$i]->openedBy = $this->app->user->account;
$data[$i]->openedDate = $now;
$data[$i]->status = 'normal';
$data[$i]->version = 1;
if(!$data[$i]->story)
{
$data[$i]->story = 0;
@@ -158,6 +161,9 @@ class testcaseModel extends model
unset($cases->type[$i]);
unset($cases->story[$i]);
unset($cases->title[$i]);
unset($cases->stage[$i]);
unset($cases->precondition[$i]);
unset($cases->keywords[$i]);
}
}
}
+33 -16
View File
@@ -25,26 +25,35 @@
<?php if($story):?>
<small class='text-muted'><?php echo html::icon($lang->icons['story']) . ' ' . $story->title ?></small>
<?php endif;?>
<div class='actions'><?php echo html::commonButton($lang->pasteText, "data-toggle='myModal' ")?></div>
<div class='actions'>
<button type="button" class="btn btn-default" data-toggle="customModal"><i class='icon icon-cog'></i></button>
<?php echo html::commonButton($lang->pasteText, "data-toggle='myModal' ")?>
</div>
</div>
</div>
<?php
$hasFields = array();
foreach(explode(',', $showFields) as $field)
{
if($field)$hasFields[$field] = '';
}
?>
<form class='form-condensed' method='post' enctype='multipart/form-data' target='hiddenwin'>
<table align='center' class='table table-form table-fixed'>
<thead>
<tr>
<th class='w-50px'><?php echo $lang->idAB;?></th>
<th class='w-300px'><?php echo $lang->testcase->module;?></th>
<th class='w-180px'><?php echo $lang->testcase->type;?> <span class='required'></span></th>
<th class='w-400px'><?php echo $lang->testcase->story;?></th>
<th class='w-200px<?php echo zget($hasFields, 'module', ' hidden')?>'><?php echo $lang->testcase->module;?></th>
<th class='w-200px<?php echo zget($hasFields, 'story', ' hidden')?>'><?php echo $lang->testcase->story;?></th>
<th><?php echo $lang->testcase->title;?> <span class='required'></span></th>
<th class='w-180px'><?php echo $lang->testcase->type;?> <span class='required'></span></th>
<th class='w-200px<?php echo zget($hasFields, 'precondition', ' hidden')?>'><?php echo $lang->testcase->precondition;?></th>
<th class='w-100px<?php echo zget($hasFields, 'keywords', ' hidden')?>'><?php echo $lang->testcase->keywords;?></th>
<th class='w-200px<?php echo zget($hasFields, 'stage', ' hidden')?>'><?php echo $lang->testcase->stage;?></th>
</tr>
</thead>
<?php
unset($lang->testcase->typeList['']);
$moduleOptionMenu['ditto'] = $lang->testcase->ditto;
?>
<?php unset($lang->testcase->typeList['']);?>
<?php for($i = 0; $i < $config->testcase->batchCreate; $i++):?>
<?php
if($i != 0) $currentModuleID = 'ditto';
@@ -54,14 +63,17 @@
?>
<tr class='text-center'>
<td><?php echo $i+1;?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("module[$i]", $moduleOptionMenu, $currentModuleID, "class='form-control chosen'");?></td>
<td><?php echo html::select("type[$i]", $lang->testcase->typeList, $type, "class=form-control");?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("story[$i]", $storyList, $story ? $story->id : '', 'class="form-control chosen"');?></td>
<td class='text-left<?php echo zget($hasFields, 'module', ' hidden')?>' style='overflow:visible'><?php echo html::select("module[$i]", $moduleOptionMenu, $currentModuleID, "class='form-control chosen'");?></td>
<td class='text-left<?php echo zget($hasFields, 'story', ' hidden')?>' style='overflow:visible'><?php echo html::select("story[$i]", $storyList, $story ? $story->id : '', 'class="form-control chosen"');?></td>
<td><?php echo html::input("title[$i]", '', "class='form-control'");?></td>
<td><?php echo html::select("type[$i]", $lang->testcase->typeList, $type, "class=form-control");?></td>
<td class='<?php echo zget($hasFields, 'precondition', 'hidden')?>'><?php echo html::textarea("precondition[$i]", '', "class='form-control'")?></td>
<td class='<?php echo zget($hasFields, 'keywords', 'hidden')?>'><?php echo html::input("keywords[$i]", '', "class='form-control'");?></td>
<td class='text-left<?php echo zget($hasFields, 'stage', ' hidden')?>' style='overflow:visible'><?php echo html::select("stage[$i][]", $lang->testcase->stageList, '', "class='form-control chosen' multiple");?></td>
</tr>
<?php endfor;?>
<tfoot>
<tr><td colspan='5' class='text-center'><?php echo html::submitButton() . html::backButton();?></td></tr>
<tr><td colspan='<?php echo count($hasFields) + 3?>' class='text-center'><?php echo html::submitButton() . html::backButton();?></td></tr>
</tfoot>
</table>
</form>
@@ -69,12 +81,17 @@
<tbody>
<tr class='text-center'>
<td>%s</td>
<td class='text-left' style='overflow:visible'><?php echo html::select("module[%s]", $moduleOptionMenu, $currentModuleID, "class='form-control'");?></td>
<td><?php echo html::select("type[%s]", $lang->testcase->typeList, $type, "class=form-control");?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("story[%s]", '', '', 'class="form-control"');?></td>
<td class='text-left<?php echo zget($hasFields, 'module', ' hidden')?>' style='overflow:visible'><?php echo html::select("module[%s]", $moduleOptionMenu, $currentModuleID, "class='form-control'");?></td>
<td class='text-left<?php echo zget($hasFields, 'story', ' hidden')?>' style='overflow:visible'><?php echo html::select("story[%s]", '', '', 'class="form-control"');?></td>
<td><?php echo html::input("title[%s]", '', "class='form-control'");?></td>
<td><?php echo html::select("type[%s]", $lang->testcase->typeList, $type, "class=form-control");?></td>
<td class='<?php echo zget($hasFields, 'precondition', 'hidden')?>'><?php echo html::textarea("precondition[%s]", '', "class='form-control'")?></td>
<td class='<?php echo zget($hasFields, 'keywords', 'hidden')?>'><?php echo html::input("keywords[%s]", '', "class='form-control'");?></td>
<td class='text-left<?php echo zget($hasFields, 'stage', ' hidden')?>' style='overflow:visible'><?php echo html::select("stage[%s][]", $lang->testcase->stageList, '', "class='form-control' multiple");?></td>
</tr>
</tbody>
</table>
<?php $customLink = $this->createLink('custom', 'ajaxSaveCustom', 'module=testcase&section=custom&key=batchcreate')?>
<?php include '../../common/view/customfield.html.php';?>
<?php include '../../common/view/pastetext.html.php';?>
<?php include '../../common/view/footer.html.php';?>