* finish task #1396.

This commit is contained in:
wyd621
2013-08-19 15:43:35 +08:00
parent 70d6a157ae
commit 67a9c68636
4 changed files with 45 additions and 76 deletions
-13
View File
@@ -814,8 +814,6 @@ class testcase extends control
$endField = $field;
$caseData = array();
$stepData = array();
$hasEdit = false;
$hasNew = false;
while($csv)
{
$case = new stdclass();
@@ -889,15 +887,6 @@ class testcase extends control
$csv = substr($csv, $pos + strlen($delimiter));
}
if(!empty($case->id))
{
$hasEdit = true;
}
else
{
$hasNew = true;
}
$caseData[$row] = $case;
unset($case);
$row++;
@@ -919,8 +908,6 @@ class testcase extends control
$this->view->stepData = $stepData;
$this->view->productID = $productID;
$this->view->product = $this->products[$productID];
$this->view->hasEdit = $hasEdit;
$this->view->hasNew = $hasNew;
$this->display();
}
}
+1 -2
View File
@@ -69,8 +69,7 @@ $lang->testcase->export = "Export data";
$lang->testcase->confirmChange = 'Confirm case change';
$lang->testcase->confirmStoryChange = 'Confirm story change';
$lang->testcase->editHaved = 'Modify existing case';
$lang->testcase->addNew = 'Add new case';
$lang->testcase->new = 'New';
$lang->testcase->num = 'The number of cases';
+1 -2
View File
@@ -69,8 +69,7 @@ $lang->testcase->export = "导出数据";
$lang->testcase->confirmChange = '确认用例变动';
$lang->testcase->confirmStoryChange = '确认需求变动';
$lang->testcase->editHaved = '修改已有用例';
$lang->testcase->addNew = '添加新用例';
$lang->testcase->new = '新增';
$lang->testcase->num = '导入用例个数:';
+43 -59
View File
@@ -1,8 +1,9 @@
<?php include '../../common/view/header.html.php';?>
<style>
.affix {position:fixed; top:0px; width:95.6%;z-index:10000;}
</style>
<form target='hiddenwin' method='post'>
<?php if($hasEdit):?>
<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>
@@ -24,13 +25,24 @@
</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
if(isset($case->id))
{
echo $case->id . html::hidden("id[$key]", $case->id);
}
else
{
echo $key . " <sub class='gray' style='vertical-align:sub;'>{$lang->testcase->new}</sub>";
}
echo 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("module[$key]", $modules, isset($case->module) ? $case->module : (isset($case->id) ? $cases[$case->id]->module : ''), "class='select-2'")?></td>
<td><?php echo html::select("story[$key]", $stories, isset($case->story) ? $case->story : (isset($case->id) ? $cases[$case->id]->story : ''), "class='select-2'")?></td>
<td><?php echo html::select("pri[$key]", $lang->testcase->priList, isset($case->pri) ? $case->pri : (isset($case->id) ? $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>
@@ -52,58 +64,30 @@
<?php unset($caseData[$key]);?>
<?php endforeach;?>
</table>
<?php endif;?>
<?php if($hasNew):?>
<table class='table-1'>
<caption class='caption-tl'><?php echo $lang->testcase->addNew?></caption>
<tr class='colhead'>
<th><?php echo $lang->testcase->importID?></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):?>
<tr valign='top' align='center'>
<td><?php echo $key + 1?></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 : '', "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>
<?php endif;?>
<p><?php echo html::submitButton() . html::backButton()?></p>
</form>
<script>
$(function(){affix('.colhead')})
function affix(obj)
{
var fixH = $(obj).offset().top;
var first = true;
$(window).scroll(function()
{
var scroH = $(this).scrollTop();
if(scroH>=fixH && first)
{
$(obj).parent().parent().before("<table id='headerClone'></table>");
$('#headerClone').append($(obj).clone()).addClass('affix');
$('.table-1 ' + obj + ' th').each(function(i){$('#headerClone ' + obj + ' th').eq(i).width($(this).width())});
first = false;
}
else if(scroH<fixH)
{
$("#headerClone").remove();
first = true;
}
});
}
</script>
<?php include '../../common/view/footer.html.php';?>