* code for task #1591.

This commit is contained in:
wyd621
2013-07-25 15:21:04 +08:00
parent 778c835bbc
commit f700350e83
4 changed files with 109 additions and 5 deletions
+4 -5
View File
@@ -793,8 +793,12 @@ class testcase extends control
foreach($columnKey as $field)
{
$delimiter = $field == $endField ? "\n" : ',';
$delimiter = $csv[0] == '"' ? '"' . $delimiter : $delimiter;
$pos = strpos($csv, $delimiter);
$cellValue = substr($csv, 0, $pos);
if($cellValue and $cellValue[0] == '"')$cellValue = substr($cellValue, 1);
if($field == 'story')
{
$case->$field = substr($cellValue, 1);
@@ -814,11 +818,6 @@ class testcase extends control
else
{
$delimiter = $csv[0] == '"' ? '",' : ',';
$pos = strpos($csv, $delimiter);
$cellValue = substr($csv, 0, $pos);
if($cellValue[0] == '"')$cellValue = substr($cellValue, 1);
$steps = explode("\n", $cellValue);
$stepKey = str_replace('step', '', strtolower($field));
$caseStep = array();
+1
View File
@@ -61,6 +61,7 @@ $lang->testcase->batchEdit = "Batch edit";
$lang->testcase->delete = "Delete";
$lang->testcase->browse = "Browse";
$lang->testcase->import = "Import";
$lang->testcase->showImport = "Show import";
$lang->testcase->exportTemplet = "Export templet";
$lang->testcase->export = "Export";
$lang->testcase->export = "Export";
+1
View File
@@ -61,6 +61,7 @@ $lang->testcase->batchEdit = "批量编辑 ";
$lang->testcase->delete = "删除";
$lang->testcase->browse = "用例列表";
$lang->testcase->import = "导入用例";
$lang->testcase->showImport = "显示导入内容";
$lang->testcase->exportTemplet = "导出模板";
$lang->testcase->export = "导出";
$lang->testcase->confirmChange = '确认用例变动';
+103
View File
@@ -0,0 +1,103 @@
<?php include '../../common/view/header.html.php';?>
<form target='hiddenwin' method='post'>
<table class='table-1'>
<caption class='caption-tl'><?php echo $lang->testcase->editHaved?></caption>
<tr class='colhead'>
<th><?php echo $lang->testcase->id?></th>
<th><?php echo $lang->testcase->title?></th>
<th><?php echo $lang->testcase->module?></th>
<th><?php echo $lang->testcase->story?></th>
<th><?php echo $lang->testcase->pri?></th>
<th><?php echo $lang->testcase->type?></th>
<th><?php echo $lang->testcase->status?></th>
<th><?php echo $lang->testcase->frequency?></th>
<th><?php echo $lang->testcase->stage?></th>
<th><?php echo $lang->testcase->precondition?></th>
<th><?php echo $lang->testcase->steps?>
<table class='table-1'>
<tr>
<th><?php echo $lang->testcase->stepDesc?></th>
<th><?php echo $lang->testcase->stepExpect?></th>
</tr>
</table>
</th>
</tr>
<?php foreach($caseData as $key => $case):?>
<?php if(empty($case->id)) continue?>
<tr valign='top' align='center'>
<td><?php echo $case->id . html::hidden("id[$key]", $case->id) . html::hidden("product[$key]", $productID)?></td>
<td><?php echo html::input("title[$key]", $case->title, "class='text-1' style='margin-top:2px'")?></td>
<td><?php echo html::select("module[$key]", $modules, isset($case->module) ? $case->module : $cases[$case->id]->module, "class='select-2'")?></td>
<td><?php echo html::select("story[$key]", $stories, isset($case->story) ? $case->story : $cases[$case->id]->story, "class='select-2'")?></td>
<td><?php echo html::select("pri[$key]", $lang->testcase->priList, isset($case->pri) ? $case->pri : $cases[$case->id]->pri)?></td>
<td><?php echo html::select("type[$key]", $lang->testcase->typeList, $case->type)?></td>
<td><?php echo html::select("status[$key]", $lang->testcase->statusList, isset($case->status) ? $case->status : '')?></td>
<td><?php echo html::input("frequency[$key]", isset($case->frequency) ? $case->frequency : 1, "size='2'")?></td>
<td><?php echo html::select("stage[$key][]", $lang->testcase->stageList, isset($case->stage) ? $case->stage : '', "multiple='multiple'")?></td>
<td><?php echo html::textarea("precondition[$key]", isset($case->precondition) ? $case->precondition : "", "style='margin-top:2px; height:65px;'")?></td>
<td>
<?php if(isset($stepData[$key]['desc'])):?>
<table class='table-1'>
<?php foreach($stepData[$key]['desc'] as $id => $desc):?>
<tr>
<td><?php echo html::textarea("desc[$key][$id]", $desc)?></td>
<td><?php echo html::textarea("expect[$key][$id]", isset($stepData[$key]['expect'][$id]) ? $stepData[$key]['expect'][$id] : '')?></td>
</tr>
<?php endforeach;?>
</table>
<?php endif;?>
</td>
</tr>
<?php unset($caseData[$key]);?>
<?php endforeach;?>
</table>
<table class='table-1'>
<caption class='caption-tl'><?php echo $lang->testcase->addNew?></caption>
<tr class='colhead'>
<th><?php echo $lang->testcase->title?></th>
<th><?php echo $lang->testcase->module?></th>
<th><?php echo $lang->testcase->story?></th>
<th><?php echo $lang->testcase->pri?></th>
<th><?php echo $lang->testcase->type?></th>
<th><?php echo $lang->testcase->status?></th>
<th><?php echo $lang->testcase->frequency?></th>
<th><?php echo $lang->testcase->stage?></th>
<th><?php echo $lang->testcase->precondition?></th>
<th><?php echo $lang->testcase->steps?>
<table class='table-1'>
<tr>
<th><?php echo $lang->testcase->stepDesc?></th>
<th><?php echo $lang->testcase->stepExpect?></th>
</tr>
</table>
</th>
</tr>
<?php foreach($caseData as $key => $case):?>
<tr valign='top' align='center'>
<td><?php echo html::input("title[$key]", $case->title, "class='text-1' style='margin-top:2px'")?></td>
<td><?php echo html::select("module[$key]", $modules, isset($case->module) ? $case->module : '', "class='select-2'") . html::hidden("product[$key]", $productID)?></td>
<td><?php echo html::select("story[$key]", $stories, isset($case->story) ? $case->story : '', "class='select-2'")?></td>
<td><?php echo html::select("pri[$key]", $lang->testcase->priList, isset($case->pri) ? $case->pri : '')?></td>
<td><?php echo html::select("type[$key]", $lang->testcase->typeList, $case->type)?></td>
<td><?php echo html::select("status[$key]", $lang->testcase->statusList, isset($case->status) ? $case->status : 'normal')?></td>
<td><?php echo html::input("frequency[$key]", isset($case->frequency) ? $case->frequency : 1, "size='2'")?></td>
<td><?php echo html::select("stage[$key][]", $lang->testcase->stageList, isset($case->stage) ? $case->stage : '', "multiple='multiple'")?></td>
<td><?php echo html::textarea("precondition[$key]", isset($case->precondition) ? $case->precondition : "", "style='margin-top:2px; height:69px'")?></td>
<td>
<?php if(isset($stepData[$key]['desc'])):?>
<table class='table-1'>
<?php foreach($stepData[$key]['desc'] as $id => $desc):?>
<tr>
<td><?php echo html::textarea("desc[$key][$id]", $desc)?></td>
<td><?php echo html::textarea("expect[$key][$id]", isset($stepData[$key]['expect'][$id]) ? $stepData[$key]['expect'][$id] : '')?></td>
</tr>
<?php endforeach;?>
</table>
<?php endif;?>
</td>
</tr>
<?php endforeach;?>
</table>
<p><?php echo html::submitButton() . html::backButton()?></p>
</form>
<?php include '../../common/view/footer.html.php';?>