* adjust the testcase module UI.

This commit is contained in:
wangchunsheng
2009-12-18 02:26:48 +00:00
parent c87c619272
commit ee82b9d783
9 changed files with 227 additions and 226 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ class productModel extends model
/* 设置菜单。*/
public function setMenu($products, $productID)
{
$selectHtml = html::select('productID', $products, $productID, 'onchange="switchProduct(this.value);"');
$selectHtml = html::select('productID', $products, $productID, "onchange=\"switchProduct(this.value, 'product');\"");
common::setMenuVars($this->lang->product->menu, 'list', $selectHtml . $this->lang->arrow);
common::setMenuVars($this->lang->product->menu, 'story', $productID);
common::setMenuVars($this->lang->product->menu, 'edit', $productID);
+23 -14
View File
@@ -50,22 +50,19 @@ class testcase extends control
$productID = (int)$productID;
if($productID == 0) $productID = key($this->products);
$currentModuleID = ($type == 'byModule') ? (int)$param : 0;
if($currentModuleID == 0)
{
$currentModuleName = $this->lang->testcase->allCases;
}
else
{
$currentModule = $this->tree->getById($currentModuleID);
$currentModuleName = sprintf($this->lang->testcase->moduleCases, $currentModule->name);
}
/* 设置菜单。*/
$this->testcase->setMenu($this->products, $productID);
if($type == "byModule")
/* 设置模块ID。*/
$type = strtolower($type);
$moduleID = ($type == 'bymodule') ? (int)$param : 0;
/* 如果是按照模块查找,或者列出所有。*/
if($type == 'bymodule' or $type == 'all')
{
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
$childModuleIds = $this->tree->getAllChildId($currentModuleID);
$childModuleIds = $this->tree->getAllChildId($moduleID);
$cases = $this->testcase->getModuleCases($productID, $childModuleIds, $orderBy, $pager);
}
@@ -82,8 +79,11 @@ class testcase extends control
$this->assign('cases', $cases);
$this->assign('pager', $pager->get());
$this->assign('users', $this->user->getPairs($this->app->company->id, 'noletter'));
$this->assign('currentModuleID', $currentModuleID);
$this->assign('currentModuleName', $currentModuleName);
$this->assign('moduleID', $moduleID);
$this->assign('param', $param);
$this->assign('recTotal', $pager->recTotal);
$this->assign('recPerPage', $pager->recPerPage);
$this->assign('orderBy', $orderBy);
$this->display();
}
@@ -105,6 +105,9 @@ class testcase extends control
$productID = common::saveProductState($productID, key($this->products));
$currentModuleID = (int)$moduleID;
/* 设置菜单。*/
$this->testcase->setMenu($this->products, $productID);
$header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->create;
$position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
$position[] = $this->lang->testcase->create;
@@ -132,6 +135,9 @@ class testcase extends control
$position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
$position[] = $this->lang->testcase->view;
/* 设置菜单。*/
$this->testcase->setMenu($this->products, $productID);
$users = $this->user->getPairs($this->app->company->id, 'noletter');
$actions = $this->action->getList('case', $caseID);
@@ -173,6 +179,9 @@ class testcase extends control
$position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
$position[] = $this->lang->testcase->edit;
/* 设置菜单。*/
$this->testcase->setMenu($this->products, $productID);
$users = $this->user->getPairs($this->app->company->id);
$this->assign('header', $header);
$this->assign('position', $position);
+24 -33
View File
@@ -21,6 +21,27 @@
* @version $Id$
* @link http://www.zentao.cn
*/
$lang->testcase->id = '用例编号';
$lang->testcase->product = '所属产品';
$lang->testcase->module = '所属模块';
$lang->testcase->story = '相关需求';
$lang->testcase->title = '用例标题';
$lang->testcase->pri = '优 先 级';
$lang->testcase->type = '用例类型';
$lang->testcase->status = '用例状态';
$lang->testcase->steps = '用例步骤';
$lang->testcase->frequency = '执行频率';
$lang->testcase->order = '排序';
$lang->testcase->openedBy = '由谁创建 ';
$lang->testcase->openedDate = '创建日期';
$lang->testcase->lastEditedBy = '最后修改者';
$lang->testcase->lastEditedDate = '最后修改日期';
$lang->testcase->field1 = '字段一';
$lang->testcase->field2 = '字段二';
$lang->testcase->feidl3 = '字段三';
$lang->testcase->version = '用例版本';
$lang->case = $lang->testcase; // 用于DAO检查时使用。因为case是系统关键字,所以无法定义该模块为case,只能使用testcase,但表还是使用的case。
$lang->testcase->common = '用例管理';
$lang->testcase->index = "用例管理首页";
$lang->testcase->create = "创建用例";
@@ -34,7 +55,7 @@ $lang->testcase->byModule = '按模块';
$lang->testcase->assignToMe = '指派给我';
$lang->testcase->openedByMe = '由我创建';
$lang->testcase->allCases = '所有Case';
$lang->testcase->moduleCases = '%s';
$lang->testcase->moduleCases = '按模块浏览';
$lang->testcase->labProductAndModule = '产品模块';
$lang->testcase->labTypeAndPri = '类型&优先级';
@@ -56,12 +77,6 @@ $lang->testcase->legendAction = '操作';
$lang->testcase->legendHistory = '历史记录';
$lang->testcase->legendComment = '备注';
$lang->testcase->buttonEdit = '编辑';
$lang->testcase->buttonActivate = '激活';
$lang->testcase->buttonResolve = '解决';
$lang->testcase->buttonClose = '关闭';
$lang->testcase->buttonToList = '返回列表';
$lang->testcase->priList[3] = 3;
$lang->testcase->priList[1] = 1;
$lang->testcase->priList[2] = 2;
@@ -94,30 +109,6 @@ $lang->testcase->typeList['performance'] = '性能测试';
$lang->testcase->statusList['normal'] = '正常';
$lang->testcase->statusList['blocked'] = 'Blocked';
$lang->testcase->resolutionList->bydesign = 'By Design';
$lang->testcase->resolutionList->duplicate = 'Duplicate';
$lang->testcase->resolutionList->external = 'External';
$lang->testcase->resolutionList->fixed = 'Fixed';
$lang->testcase->resolutionList->notrepro = 'Not Repro';
$lang->testcase->resolutionList->postponed = 'Postponed';
$lang->testcase->resolutionList->willnotfix = "Won not Fix";
$lang->testcase->id = '用例编号';
$lang->testcase->product = '所属产品';
$lang->testcase->module = '所属模块';
$lang->testcase->story = '相关需求';
$lang->testcase->title = '用例标题';
$lang->testcase->pri = '优 先 级';
$lang->testcase->type = '用例类型';
$lang->testcase->status = '用例状态';
$lang->testcase->steps = '用例步骤';
$lang->testcase->frequency = '执行频率';
$lang->testcase->order = '排序';
$lang->testcase->openedBy = '由谁创建 ';
$lang->testcase->openedDate = '创建日期';
$lang->testcase->lastEditedBy = '最后修改者';
$lang->testcase->lastEditedDate = '最后修改日期';
$lang->testcase->field1 = '字段一';
$lang->testcase->field2 = '字段二';
$lang->testcase->feidl3 = '字段三';
$lang->testcase->version = '用例版本';
$lang->testcase->buttonEdit = '编辑';
$lang->testcase->buttonToList = '返回';
+7
View File
@@ -25,6 +25,13 @@
<?php
class testcaseModel extends model
{
/* 设置菜单。*/
public function setMenu($products, $productID)
{
$selectHtml = html::select('productID', $products, $productID, "onchange=\"switchProduct(this.value, 'case');\"");
common::setMenuVars($this->lang->testcase->menu, 'product', $selectHtml . $this->lang->arrow);
}
/* 创建一个Case。*/
function create()
{
+42 -50
View File
@@ -25,63 +25,51 @@
<?php include '../../common/header.html.php';?>
<?php include '../../common/treeview.html.php';?>
<script language='Javascript'>
function selectProduct(productID)
/* 切换浏览方式。*/
function browseByModule(active)
{
link = createLink('testcase', 'browse', 'productID=' + productID + '&type=byModule&param=0');
location.href=link;
$('#mainbox').addClass('yui-t7');
$('#treebox').removeClass('hidden');
$('#bymoduletab').addClass('active');
$('#' + active + 'tab').removeClass('active');
}
</script>
<div class="yui-d0 yui-t3">
<div class="yui-b">
<table class='table-1'>
<caption>
<?php echo $lang->testcase->selectProduct;?>
<?php echo html::select('productID', $products, $productID, 'onchange="selectProduct(this.value);" style="width:200px"');?>
</caption>
<tr>
<td>
<div id='main'><?php echo $moduleTree;?></div>
<div class='a-right'>
<?php echo html::a($this->createLink('testcase', 'browse', "productId=$productID"), $lang->testcase->allCases);?>
<?php echo html::a($this->createLink('tree', 'browse', "productID=$productID&view=case"), $lang->tree->manageCase);?>
</div>
</td>
</tr>
</table>
<div class='yui-d0'>
<div id='featurebar'>
<div class='f-left'>
<?php
echo "<span id='bymoduletab' onclick=\"browseByModule('$type')\">" . $lang->testcase->moduleCases . "</span> ";
echo "<span id='alltab'>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&type=all&param=0"), $lang->testcase->allCases) . "</span>";
?>
</div>
<div class='f-right'>
<?php common::printLink('testcase', 'create', "productID=$productID&moduleID=$moduleID", $lang->testcase->create); ?>
</div>
</div>
</div>
<div class='yui-d0 <?php if($type == 'bymodule') echo 'yui-t7';?>' id='mainbox'>
<div class='yui-b <?php if($type != 'bymodule') echo 'hidden';?>' id='treebox'>
<div class='box-title'><?php echo $productName;?></div>
<div class='box-content'>
<?php echo $moduleTree;?>
<div class='a-right'>
<?php common::printLink('tree', 'browse', "productID=$productID&view=case", $lang->tree->manage);?>
</div>
</div>
</div>
<div class="yui-main">
<div class="yui-b">
<div id='tabbar' class='yui-d0' style='clear:right'>
<ul>
<?php
echo "<li><nobr>$productName</nobr></li>";
echo "<li id='byModuleTab'><nobr>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&type=byModule&param=$currentModuleID"), $currentModuleName) . "</nobr></li>";
//echo "<li id='assignToMeTab'><nobr>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&type=assignToMe"), $lang->testcase->assignToMe) . "</nobr></li>";
//echo "<li id='openedByMeTab'><nobr>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&type=openedByMe"), $lang->testcase->openedByMe) . "</nobr></li>";
//echo "<li id='resolvedByMeTab'><nobr>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&type=resolvedByMe"), $lang->testcase->resolvedByMe) . "</nobr></li>";
//echo "<li id='assignToNullTab'><nobr>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&type=assignToNull"), $lang->testcase->assignToNull) . "</nobr></li>";
//echo "<li id='longLifeBugsTab'><nobr>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&type=longLifeBugs"), $lang->testcase->longLifeBugs) . "</nobr></li>";
//echo "<li id='postponedBugsTab'><nobr>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&type=postponedBugs"), $lang->testcase->postponedBugs) . "</nobr></li>";
echo <<<EOT
<script language="Javascript">
$("#{$type}Tab").addClass('active');
</script>
EOT;
?>
</ul>
<div>
<?php if(common::hasPriv('testcase', 'create')) echo html::a($this->createLink('testcase', 'create', "productID=$productID&moduleID=$currentModuleID"), $lang->testcase->create);?>
</div>
</div>
<div class='yui-b'>
<table class='table-1'>
<tr class='colhead'>
<th><?php echo $lang->testcase->id;?></th>
<th><?php echo $lang->testcase->pri;?></th>
<th><?php echo $lang->testcase->title;?></th>
<th><?php echo $lang->testcase->type;?></th>
<th><?php echo $lang->testcase->openedBy;?></th>
<th><?php echo $lang->testcase->status;?></th>
<?php $vars = "productID=$productID&type=$type&param=$param&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage"; ?>
<th><?php common::printOrderLink('id', $orderBy, $vars, $lang->testcase->id);?></th>
<th><?php common::printOrderLink('pri', $orderBy, $vars, $lang->testcase->pri);?></th>
<th><?php common::printOrderLink('title', $orderBy, $vars, $lang->testcase->title);?></th>
<th><?php common::printOrderLink('type', $orderBy, $vars, $lang->testcase->type);?></th>
<th><?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->testcase->openedBy);?></th>
<th><?php common::printOrderLink('status', $orderBy, $vars, $lang->testcase->status);?></th>
</tr>
<?php foreach($cases as $case):?>
<tr class='a-center'>
@@ -98,4 +86,8 @@ EOT;
</div>
</div>
</div>
<script language="Javascript">
$("#<?php echo $type;?>tab").addClass('active');
$("#module<?php echo $moduleID;?>").addClass('active');
</script>
<?php include '../../common/footer.html.php';?>
+3 -3
View File
@@ -47,9 +47,9 @@ function loadStory(productID)
}
</script>
<div class='yui-doc3'>
<div class='yui-d0'>
<form method='post' target='hiddenwin'>
<table align='center' class='table-1'>
<table class='table-1'>
<caption><?php echo $lang->testcase->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->testcase->labProductAndModule;?></th>
@@ -78,7 +78,7 @@ function loadStory(productID)
</td>
</tr>
<tr>
<td colspan='2'><?php echo html::submitButton() . html::resetButton();?> </td>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::resetButton();?> </td>
</tr>
</table>
</form>
+111 -120
View File
@@ -28,131 +28,122 @@
<div id='titlebar'>
CASE #<?php echo $case->id . $lang->colon . $case->title;?>
<div class='f-right'>
<?php
if(common::hasPriv('testcase', 'edit')) echo html::a($this->createLink('testcase', 'edit', "caseID=$case->id"), $lang->testcase->buttonEdit);
if(common::hasPriv('testcase', 'browse')) echo html::a($this->createLink('testcase', 'browse', "productID=$case->product"), $lang->testcase->buttonToList);
?>
</div>
</div>
</div>
<div class='yui-doc3 yui-t7'>
<div class='yui-g'>
<div class='yui-u first'>
<fieldset>
<legend><?php echo $lang->testcase->legendBasicInfo;?></legend>
<table class='table-1 a-left' cellpadding='0' cellspacing='0'>
<tr>
<td class='rowhead'><?php echo $lang->testcase->labProductAndModule;?></td>
<td>
<?php
echo $productName;
if(!empty($modulePath)) echo $lang->arrow;
foreach($modulePath as $key => $module)
{
echo $module->name;
if(isset($modulePath[$key + 1])) echo $lang->arrow;
}
?>
</td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->type;?></td>
<td><?php echo $lang->testcase->typeList[$case->type];?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->pri;?></td>
<td><?php echo $case->pri;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->status;?></td>
<td><?php echo $lang->testcase->statusList[$case->status];?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->story;?></td>
<td>
<?php
if(isset($case->storyTitle)) echo html::a($this->createLink('story', 'view', "storyID=$case->story"), "#$case->story:$case->storyTitle");
?>
</td>
</tr>
</table>
</fieldset>
<!--
<fieldset>
<legend><?php echo $lang->testcase->legendMailto;?></legend>
<div>mailto</div>
</fieldset>
<fieldset>
<legend><?php echo $lang->testcase->legendAttatch;?></legend>
<div>attatch</div>
</fieldset>
-->
</div>
<div class='yui-u'>
<fieldset>
<legend><?php echo $lang->testcase->legendOpenInfo;?></legend>
<table class='table-1 a-left'>
<tr>
<td width='40%' class='rowhead'><?php echo $lang->testcase->openedBy;?></td>
<td><?php echo $case->openedBy;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->openedDate;?></td>
<td><?php echo $case->openedDate;?></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend><?php echo $lang->testcase->legendLastInfo;?></legend>
<table class='table-1 a-left'>
<tr>
<td class='rowhead'><?php echo $lang->testcase->lastEditedBy;?></td>
<td><?php echo $case->lastEditedBy;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->lastEditedDate;?></td>
<td><?php echo $case->lastEditedDate;?></td>
</tr>
</table>
</fieldset>
<!--
<fieldset>
<legend><?php echo $lang->testcase->legendLinkBugs;?></legend>
<div> linkcase </div>
</fieldset>
-->
</div>
</div>
</div>
<div class='yui-d0'>
<fieldset>
<legend><?php echo $lang->testcase->legendAction;?></legend>
<div class='a-center' style='font-size:16px; font-weight:bold'>
<?php
if(common::hasPriv('testcase', 'edit')) echo html::a($this->createLink('testcase', 'edit', "caseID=$case->id"), $lang->testcase->buttonEdit);
if(common::hasPriv('testcase', 'browse')) echo html::a($this->createLink('testcase', 'browse', "productID=$case->product"), $lang->testcase->buttonToList);
common::printLink('testcase', 'edit', "caseID=$case->id", $lang->testcase->buttonEdit);
common::printLink('testcase', 'browse', "productID=$case->product", $lang->testcase->buttonToList);
?>
</div>
</fieldset>
</div>
</div>
<fieldset>
<legend><?php echo $lang->testcase->legendSteps;?></legend>
<div class='content'>
<?php echo nl2br($case->steps);?>
<div class='yui-d0 yui-t6'>
<div class='yui-main'>
<div class='yui-b'>
<fieldset>
<legend><?php echo $lang->testcase->legendSteps;?></legend>
<div class='content'>
<?php echo nl2br($case->steps);?>
</div>
</fieldset>
<?php include '../../common/action.html.php';?>
<fieldset>
<legend><?php echo $lang->testcase->legendAction;?></legend>
<div class='a-center' style='font-size:16px; font-weight:bold'>
<?php
common::printLink('testcase', 'edit', "caseID=$case->id", $lang->testcase->buttonEdit);
common::printLink('testcase', 'browse', "productID=$case->product", $lang->testcase->buttonToList);
?>
</div>
</fieldset>
</div>
</fieldset>
<?php include '../../common/action.html.php';?>
</div>
<div class='yui-b'>
<fieldset>
<legend><?php echo $lang->testcase->legendBasicInfo;?></legend>
<table class='table-1 a-left fixed'>
<tr>
<td class='rowhead'><?php echo $lang->testcase->labProductAndModule;?></td>
<td class='nobr'>
<?php
echo $productName;
if(!empty($modulePath)) echo $lang->arrow;
foreach($modulePath as $key => $module)
{
echo $module->name;
if(isset($modulePath[$key + 1])) echo $lang->arrow;
}
?>
</td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->type;?></td>
<td><?php echo $lang->testcase->typeList[$case->type];?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->pri;?></td>
<td><?php echo $case->pri;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->status;?></td>
<td><?php echo $lang->testcase->statusList[$case->status];?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->story;?></td>
<td class='nobr'>
<?php
if(isset($case->storyTitle)) echo html::a($this->createLink('story', 'view', "storyID=$case->story"), "#$case->story:$case->storyTitle");
?>
</td>
</tr>
</table>
</fieldset>
<!--
<fieldset>
<legend><?php echo $lang->testcase->legendMailto;?></legend>
<div>mailto</div>
</fieldset>
<fieldset>
<legend><?php echo $lang->testcase->legendAttatch;?></legend>
<div>attatch</div>
</fieldset>
-->
<fieldset>
<legend><?php echo $lang->testcase->legendOpenInfo;?></legend>
<table class='table-1 a-left'>
<tr>
<td width='40%' class='rowhead'><?php echo $lang->testcase->openedBy;?></td>
<td><?php echo $case->openedBy;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->openedDate;?></td>
<td><?php echo $case->openedDate;?></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend><?php echo $lang->testcase->legendLastInfo;?></legend>
<table class='table-1 a-left'>
<tr>
<td class='rowhead'><?php echo $lang->testcase->lastEditedBy;?></td>
<td><?php echo $case->lastEditedBy;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->lastEditedDate;?></td>
<td><?php echo $case->lastEditedDate;?></td>
</tr>
</table>
</fieldset>
<!--
<fieldset>
<legend><?php echo $lang->testcase->legendLinkBugs;?></legend>
<div> linkcase </div>
</fieldset>
-->
</div>
</div>
<?php include '../../common/footer.html.php';?>
+13 -2
View File
@@ -61,9 +61,20 @@ function setNowrapObjTitle()
}
/* 选择产品。*/
function switchProduct(productID)
function switchProduct(productID, type)
{
link = createLink('product', 'browse', 'productID=' + productID);
if(type == 'product')
{
link = createLink('product', 'browse', 'productID=' + productID);
}
else if(type == 'bug')
{
link = createLink('bug', 'browse', 'productID=' + productID + '&type=byModule&param=0');
}
else if(type == 'case')
{
link = createLink('testcase', 'browse', 'productID=' + productID + '&type=byModule&param=0');
}
location.href=link;
}
+3 -3
View File
@@ -22,10 +22,10 @@
*/
/*-----------------------FIELDSET SETTING----------------------------*/
fieldset {border:1px solid #e4e4e4; padding:8px; margin-bottom:5px}
fieldset {border:1px solid #e4e4e4; padding:1px 10px 1px 10px; margin-bottom:5px}
legend {font-weight:bold; color:darkgreen}
fieldset .table-1 {margin:0}
fieldset tr, fieldset td, fieldset th {border:none; padding:2px 2px 2px 10px}
fieldset .table-1 {margin:0;}
fieldset tr, fieldset td, fieldset th {border:none; padding:2px}
del{background:#fcc}
ins{background:#cfc; text-decoration:none}