* adjust the UI of testcase module.

This commit is contained in:
wangchunsheng
2010-11-25 02:16:21 +00:00
parent 46bd522896
commit 21e215815c
7 changed files with 119 additions and 78 deletions
+3 -3
View File
@@ -56,9 +56,9 @@ $lang->testcase->delete = "Delete";
$lang->testcase->browse = "Browse";
$lang->testcase->confirmStoryChange = 'Confirm story change';
$lang->testcase->deleteStep = 'x';
$lang->testcase->insertBefore = '+↑';
$lang->testcase->insertAfter = '+↓';
$lang->testcase->deleteStep = 'Delete';
$lang->testcase->insertBefore = 'Insert before';
$lang->testcase->insertAfter = 'Insert after';
$lang->testcase->selectProduct = 'Select product';
$lang->testcase->byModule = 'By module';
+3 -3
View File
@@ -56,9 +56,9 @@ $lang->testcase->delete = "删除用例";
$lang->testcase->browse = "用例列表";
$lang->testcase->confirmStoryChange = '确认需求变动';
$lang->testcase->deleteStep = 'x';
$lang->testcase->insertBefore = '+↑';
$lang->testcase->insertAfter = '+↓';
$lang->testcase->deleteStep = '删除';
$lang->testcase->insertBefore = '之前添加';
$lang->testcase->insertAfter = '之后添加';
$lang->testcase->selectProduct = '请选择产品';
$lang->testcase->byModule = '按模块';
+3 -2
View File
@@ -76,9 +76,10 @@ function browseBySearch(active)
</tr>
<?php foreach($cases as $case):?>
<tr class='a-center'>
<td><?php echo html::a($this->createLink('testcase', 'view', "testcaseID=$case->id"), sprintf('%03d', $case->id));?></td>
<?php $viewLink = inlink('view', "caseID=$case->id");?>
<td><?php echo html::a($viewLink, sprintf('%03d', $case->id));?></td>
<td><?php echo $case->pri?></td>
<td class='a-left'><?php echo $case->title;?></td>
<td class='a-left'><?php echo html::a($viewLink, $case->title);?></td>
<?php if($browseType == 'needconfirm'):?>
<td class='a-left'><?php echo html::a($this->createLink('story', 'view', "storyID=$case->story"), $case->storyTitle, '_blank');?></td>
<td><?php echo html::a(inlink('confirmStoryChange', "caseID=$case->id"), $lang->confirm, 'hiddenwin');?></td>
+6 -6
View File
@@ -53,16 +53,16 @@
<th class='w-100px'><?php echo $lang->actions;?></th>
</tr>
<?php
for($i = 1; $i <= 5; $i ++)
for($i = 1; $i <= 3; $i ++)
{
echo "<tr id='row$i' class='a-center'>";
echo "<th class='stepID'>$i</th>";
echo '<td class="w-p50">' . html::textarea('steps[]', '', "class='w-p100'") . '</td>';
echo '<td>' . html::textarea('expects[]', '', "class='w-p100'") . '</td>';
echo '<td class="w-p50">' . html::textarea('steps[]', '', "rows='3' class='w-p100'") . '</td>';
echo '<td>' . html::textarea('expects[]', '', "rows='3' class='w-p100'") . '</td>';
echo "<td class='a-center w-100px'><nobr>";
echo "<input type='button' tabindex='-1' class='addbutton' onclick='preInsert($i)' value='{$lang->testcase->insertBefore}' /> ";
echo "<input type='button' tabindex='-1' class='addbutton' onclick='postInsert($i)' value='{$lang->testcase->insertAfter}' /> ";
echo "<input type='button' tabindex='-1' class='delbutton' onclick='deleteRow($i)' value='{$lang->testcase->deleteStep}' /> ";
echo "<input type='button' tabindex='-1' class='addbutton' onclick='preInsert($i)' value='{$lang->testcase->insertBefore}' /><br /> ";
echo "<input type='button' tabindex='-1' class='addbutton' onclick='postInsert($i)' value='{$lang->testcase->insertAfter}' /><br /> ";
echo "<input type='button' tabindex='-1' class='delbutton' onclick='deleteRow($i)' value='{$lang->testcase->deleteStep}' /><br /> ";
echo "</nobr></td>";
echo '</tr>';
}
+24 -29
View File
@@ -32,35 +32,30 @@ $(document).ready(function()
<div class='yui-d0 yui-t8'>
<div class='yui-main'>
<div class='yui-b'>
<fieldset>
<legend><?php echo $lang->testcase->legendSteps;?></legend>
<div class='a-center'>
<table class='table-1 bd-1px'>
<tr class='colhead'>
<th class='w-30px'><?php echo $lang->testcase->stepID;?></th>
<th><?php echo $lang->testcase->stepDesc;?></th>
<th><?php echo $lang->testcase->stepExpect;?></th>
<th class='w-100px'><?php echo $lang->actions;?></th>
</tr>
<?php
foreach($case->steps as $stepID => $step)
{
$stepID += 1;
echo "<tr id='row$stepID' class='a-center'>";
echo "<th class='stepID'>$stepID</th>";
echo '<td class="w-p50">' . html::textarea('steps[]', $step->desc, "class='w-p100'") . '</td>';
echo '<td>' . html::textarea('expects[]', $step->expect, "class='w-p100'") . '</td>';
echo "<td class='a-center w-100px'><nobr>";
echo "<input type='button' tabindex='-1' class='addbutton' onclick='preInsert($stepID)' value='{$lang->testcase->insertBefore}' /> ";
echo "<input type='button' tabindex='-1' class='addbutton' onclick='postInsert($stepID)' value='{$lang->testcase->insertAfter}' /> ";
echo "<input type='button' tabindex='-1' class='delbutton' onclick='deleteRow($stepID)' value='{$lang->testcase->deleteStep}' /> ";
echo "</nobr></td>";
echo '</tr>';
}
?>
</table>
</div>
</fieldset>
<table class='table-1'>
<tr class='colhead'>
<th class='w-30px'><?php echo $lang->testcase->stepID;?></th>
<th><?php echo $lang->testcase->stepDesc;?></th>
<th><?php echo $lang->testcase->stepExpect;?></th>
<th class='w-100px'><?php echo $lang->actions;?></th>
</tr>
<?php
foreach($case->steps as $stepID => $step)
{
$stepID += 1;
echo "<tr id='row$stepID' class='a-center'>";
echo "<th class='stepID'>$stepID</th>";
echo '<td class="w-p50">' . html::textarea('steps[]', $step->desc, "rows='3' class='w-p100'") . '</td>';
echo '<td>' . html::textarea('expects[]', $step->expect, "rows='3' class='w-p100'") . '</td>';
echo "<td class='a-center w-100px'><nobr>";
echo "<input type='button' tabindex='-1' class='addbutton' onclick='preInsert($stepID)' value='{$lang->testcase->insertBefore}' /><br />";
echo "<input type='button' tabindex='-1' class='addbutton' onclick='postInsert($stepID)' value='{$lang->testcase->insertAfter}' /><br /> ";
echo "<input type='button' tabindex='-1' class='delbutton' onclick='deleteRow($stepID)' value='{$lang->testcase->deleteStep}' /><br /> ";
echo "</nobr></td>";
echo '</tr>';
}
?>
</table>
<fieldset>
<legend><?php echo $lang->testcase->legendComment;?></legend>
+63 -15
View File
@@ -2,33 +2,59 @@
<style>
#produc{width:90%}
#story {width:90%}
.delbutton{font-size:20px; font-weight:bolder; color:red; width:50px}
.addbutton{font-size:20px; font-weight:bolder; color:darkgreen; width:50px}
.delbutton{font-size:12px; color:red; width:80px; padding:0}
.addbutton{font-size:12px; color:darkgreen; width:80px; padding:0}
.searchleft{width:220px}
#story{width:100%}
</style>
<script language='Javascript'>
var newRowID = 0;
/* 加载产品对应的模块和需求。*/
/**
* Load modules and stories of a product.
*
* @param int $productID
* @access public
* @return void
*/
function loadAll(productID)
{
loadModuleMenu(productID);
loadStory(productID);
}
/* 加载模块。*/
/**
* Load module.
*
* @param int $productID
* @access public
* @return void
*/
function loadModuleMenu(productID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case');
$('#moduleIdBox').load(link);
}
/* 加载需求列表。*/
/**
* Load stories.
*
* @param int $productID
* @access public
* @return void
*/
function loadStory(productID)
{
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID);
$('#storyIdBox').load(link);
}
/* 删除一行。*/
/**
* Delete a step row.
*
* @param int $rowID
* @access public
* @return void
*/
function deleteRow(rowID)
{
if($('.stepID').size() == 1) return;
@@ -36,21 +62,38 @@ function deleteRow(rowID)
updateID();
}
/* 之前增加一行。*/
/**
* Insert before the step.
*
* @param int $rowID
* @access public
* @return void
*/
function preInsert(rowID)
{
$('#row' + rowID).before(createRow());
updateID();
}
/* 之后增加一行。*/
/**
* Insert after the step.
*
* @param int $rowID
* @access public
* @return void
*/
function postInsert(rowID)
{
$('#row' + rowID).after(createRow());
updateID();
}
/* 创建一个row对象。*/
/**
* Create a step row.
*
* @access public
* @return void
*/
function createRow()
{
if(newRowID == 0) newRowID = $('.stepID').size();
@@ -60,17 +103,22 @@ function createRow()
var lblAfter = '<?php echo $lang->testcase->insertAfter;?>';
var newRow = "<tr class='a-center' id='row" + newRowID + "'>";
newRow += "<th class='stepID'></th>";
newRow += "<td class='w-p50'><textarea name='steps[]' class='w-p100'></textarea></td>";
newRow += "<td><textarea name='expects[]' class='w-p100'></textarea></td>";
newRow += "<td class='w-p50'><textarea name='steps[]' rows=3 class='w-p100'></textarea></td>";
newRow += "<td><textarea name='expects[]' rows=3 class='w-p100'></textarea></td>";
newRow += "<td class='a-center w-100px'><nobr>";
newRow += "<input type='button' tabindex='-1' class='addbutton' value='" + lblBefore + "' onclick='preInsert(" + newRowID + ")' /> ";
newRow += "<input type='button' tabindex='-1' class='addbutton' value='" + lblAfter + "' onclick='postInsert(" + newRowID + ")' /> ";
newRow += "<input type='button' tabindex='-1' class='delbutton' value='" + lblDelete + "' onclick='deleteRow(" + newRowID + ")' /> ";
newRow += "<input type='button' tabindex='-1' class='addbutton' value='" + lblBefore + "' onclick='preInsert(" + newRowID + ")' /><br />";
newRow += "<input type='button' tabindex='-1' class='addbutton' value='" + lblAfter + "' onclick='postInsert(" + newRowID + ")' /><br />";
newRow += "<input type='button' tabindex='-1' class='delbutton' value='" + lblDelete + "' onclick='deleteRow(" + newRowID + ")' /><br />";
newRow += "</nobr></td>";
return newRow;
}
/* 重新计算并更新stepID。*/
/**
* Update the step id.
*
* @access public
* @return void
*/
function updateID()
{
i = 1;
+17 -20
View File
@@ -33,26 +33,23 @@
<div class='yui-d0 yui-t8'>
<div class='yui-main'>
<div class='yui-b'>
<fieldset>
<legend><?php echo $lang->testcase->legendSteps;?></legend>
<table class='table-1 bd-1px bd-gray colored'>
<tr class='colhead'>
<th class='w-30px bd-1px bd-gray'><?php echo $lang->testcase->stepID;?></td>
<th class='w-p70 bd-1px bd-gray'><?php echo $lang->testcase->stepDesc;?></td>
<th class='bd-1px bd-gray'><?php echo $lang->testcase->stepExpect;?></td>
</tr>
<?php
foreach($case->steps as $stepID => $step)
{
$stepID += 1;
echo "<tr class='bd-1px bd-gray'><th class='bd-1px bd-gray'>$stepID</th>";
echo "<td class='bd-1px bd-gray'>" . nl2br($step->desc) . "</td>";
echo "<td>" . nl2br($step->expect) . "</td>";
echo "</tr>";
}
?>
</table>
</fieldset>
<table class='table-1 colored'>
<tr class='colhead'>
<th class='w-30px'><?php echo $lang->testcase->stepID;?></td>
<th class='w-p70'><?php echo $lang->testcase->stepDesc;?></td>
<th><?php echo $lang->testcase->stepExpect;?></td>
</tr>
<?php
foreach($case->steps as $stepID => $step)
{
$stepID += 1;
echo "<tr><th class='rowhead w-id a-center strong'>$stepID</th>";
echo "<td>" . nl2br($step->desc) . "</td>";
echo "<td>" . nl2br($step->expect) . "</td>";
echo "</tr>";
}
?>
</table>
<?php echo $this->fetch('file', 'printFiles', array('files' => $case->files, 'fieldset' => 'true'));?>
<?php include '../../common/view/action.html.php';?>
<div class='a-center' style='font-size:16px; font-weight:bold'>