+ finish the feature of testcase step.

This commit is contained in:
wangchunsheng
2010-01-29 06:44:47 +00:00
parent ad46390988
commit 82e233964a
10 changed files with 342 additions and 255 deletions

View File

@@ -1,2 +1,13 @@
-- 20100128 修改user表中ip字段的默认值解决install失败的问题。
ALTER TABLE `zt_user` CHANGE `ip` `ip` CHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''
ALTER TABLE `zt_user` CHANGE `ip` `ip` CHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
-- 20100128: 调整casestep表。
ALTER TABLE `zt_caseStep` CHANGE `caseVersion` `version` SMALLINT( 3 ) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `zt_caseStep` CHANGE `step` `desc` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE `zt_caseStep` CHANGE `expect` `expect` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE `zt_caseStep` ADD INDEX ( `case` , `version` ) ;
-- 20100128 转换case中的step字段
update zt_case set version = 1 where version = 0;
insert into zt_caseStep select '', id,version,steps, '' from zt_case;
ALTER TABLE `zt_case` DROP `steps`;

View File

@@ -393,8 +393,8 @@ EOT;
/* <20>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>IJ<EFBFBD>ͬ<EFBFBD><CDAC>ժ<EFBFBD><D5AA>PHPQAT<41>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF>ܡ<EFBFBD>*/
public static function diff($text1, $text2)
{
$w = explode("\n", $text1);
$o = explode("\n", $text2);
$w = explode("\n", trim($text1));
$o = explode("\n", trim($text2));
$w1 = array_diff_assoc($w,$o);
$o1 = array_diff_assoc($o,$w);
$w2 = array();

View File

@@ -128,27 +128,24 @@ class testcase extends control
}
/* 查看一个case。*/
public function view($caseID)
public function view($caseID, $version = 0)
{
$this->loadModel('action');
$case = $this->testcase->getById($caseID);
/* 获取case和产品信息并设置菜单。*/
$case = $this->testcase->getById($caseID, $version);
$productID = $case->product;
$header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->view;
$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('noletter');
$actions = $this->action->getList('case', $caseID);
/* 导航信息。*/
$this->view->header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->view;
$this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->testcase->view;
$this->assign('header', $header);
$this->assign('position', $position);
$this->assign('case', $case);
$this->assign('actions', $actions);
$this->assign('productName', $this->products[$productID]);
$this->assign('modulePath', $this->tree->getParents($case->module));
/* 赋值。*/
$this->view->case = $case;
$this->view->productName = $this->products[$productID];
$this->view->modulePath = $this->tree->getParents($case->module);
$this->view->users = $this->user->getPairs('noletter');
$this->view->actions = $this->loadModel('action')->getList('case', $caseID);
$this->display();
}
@@ -197,6 +194,7 @@ class testcase extends control
$this->assign('header', $header);
$this->assign('position', $position);
$this->assign('case', $case);
$this->view->actions = $this->loadModel('action')->getList('case', $caseID);
$this->display();
}

View File

@@ -42,6 +42,10 @@ $lang->testcase->feidl3 = '字段三';
$lang->testcase->version = '用例版本';
$lang->case = $lang->testcase; // 用于DAO检查时使用。因为case是系统关键字所以无法定义该模块为case只能使用testcase但表还是使用的case。
$lang->testcase->stepID = '编号';
$lang->testcase->stepDesc = '步骤';
$lang->testcase->stepExpect = '预期';
$lang->testcase->common = '用例管理';
$lang->testcase->index = "用例管理首页";
$lang->testcase->create = "创建用例";
@@ -50,6 +54,10 @@ $lang->testcase->view = "用例详情";
$lang->testcase->edit = "编辑用例";
$lang->testcase->browse = "用例列表";
$lang->testcase->deleteStep = '';
$lang->testcase->insertBefore = '+↑';
$lang->testcase->insertAfter = '+↓';
$lang->testcase->selectProduct = '请选择产品';
$lang->testcase->byModule = '按模块';
$lang->testcase->assignToMe = '指派给我';
@@ -58,51 +66,33 @@ $lang->testcase->allCases = '所有Case';
$lang->testcase->moduleCases = '按模块浏览';
$lang->testcase->bySearch = '搜索';
$lang->testcase->labProductAndModule = '产品模块';
$lang->testcase->labTypeAndPri = '类型&优先级';
$lang->testcase->labSystemBrowserAndHardware = '系统::浏览器';
$lang->testcase->labAssignAndMail = '指派给::抄送给';
$lang->testcase->labStory = '相关需求';
$lang->testcase->lblProductAndModule = '产品模块';
$lang->testcase->lblTypeAndPri = '类型&优先级';
$lang->testcase->lblSystemBrowserAndHardware = '系统::浏览器';
$lang->testcase->lblAssignAndMail = '指派给::抄送给';
$lang->testcase->lblStory = '相关需求';
$lang->testcase->lblLastEdited = '最后编辑';
$lang->testcase->legendRelated = '相关信息';
$lang->testcase->legendBasicInfo = '基本信息';
$lang->testcase->legendMailto = '抄送给';
$lang->testcase->legendAttatch = '附件';
$lang->testcase->legendLinkBugs = '相关Bug';
$lang->testcase->legendOpenInfo = '创建信息';
$lang->testcase->legendLastInfo = '最后编辑';
$lang->testcase->legendOpenAndEdit = '创建编辑';
$lang->testcase->legendStoryAndTask= '需求::任务';
$lang->testcase->legendCases = '相关用例';
$lang->testcase->legendSteps = '用例步骤';
$lang->testcase->legendAction = '操作';
$lang->testcase->legendHistory = '历史记录';
$lang->testcase->legendComment = '备注';
$lang->testcase->legendProduct = '产品模块';
$lang->testcase->legendVersion = '版本历史';
$lang->testcase->priList[3] = 3;
$lang->testcase->priList[1] = 1;
$lang->testcase->priList[2] = 2;
$lang->testcase->priList[4] = 4;
/* Define the OS list. */
$lang->testcase->osList->all = '全部';
$lang->testcase->osList->winxp = 'Windows XP';
$lang->testcase->osList->win2000 = 'Windows 2000';
$lang->testcase->osList->winnt = 'Windows NT';
$lang->testcase->osList->win98 = 'Windows 98';
$lang->testcase->osList->linux = 'Linux';
$lang->testcase->osList->unix = 'Unix';
$lang->testcase->osList->others = '其他';
/* Define the OS list. */
$lang->testcase->browserList->all = '全部';
$lang->testcase->browserList->ie6 = 'IE6';
$lang->testcase->browserList->ie7 = 'IE7';
$lang->testcase->browserList->ie8 = 'IE8';
$lang->testcase->browserList->firefox2 = 'firefox2';
$lang->testcase->browserList->firefx3 = 'firefox3';
$lang->testcase->browserList->opera9 = 'opera9';
$lang->testcase->browserList->oprea10 = '其他';
/* Define the types. */
$lang->testcase->typeList[''] = '';
$lang->testcase->typeList['feature'] = '功能测试';
@@ -112,6 +102,5 @@ $lang->testcase->statusList[''] = '';
$lang->testcase->statusList['normal'] = '正常';
$lang->testcase->statusList['blocked'] = 'Blocked';
$lang->testcase->buttonEdit = '编辑';
$lang->testcase->buttonToList = '返回';

View File

@@ -42,12 +42,27 @@ class testcaseModel extends model
->add('openedBy', $this->app->user->account)
->add('openedDate', $now)
->add('status', 'normal')
->add('version', 1)
->remove('steps,expects')
->setDefault('story', 0)
->stripTags('title')
->specialChars('steps')
->get();
$this->dao->insert(TABLE_CASE)->data($case)->autoCheck()->check('title', 'notempty')->exec();
return $this->dao->lastInsertID();
if(!$this->dao->isError())
{
$caseID = $this->dao->lastInsertID();
foreach($this->post->steps as $stepID => $stepDesc)
{
if(empty($stepDesc)) continue;
$step->case = $caseID;
$step->version = 1;
$step->desc = htmlspecialchars($stepDesc);
$step->expect = htmlspecialchars($this->post->expects[$stepID]);
$this->dao->insert(TABLE_CASESTEP)->data($step)->autoCheck()->exec();
}
return $caseID;
}
}
/* 获得某一个产品某一个模块下面的所有case。*/
@@ -59,11 +74,14 @@ class testcaseModel extends model
}
/* 获取一个case的详细信息。*/
public function getById($caseID)
public function getById($caseID, $version = 0)
{
$case = $this->dao->findById($caseID)->from(TABLE_CASE)->fetch();
foreach($case as $key => $value) if(strpos($key, 'Date') !== false and !(int)substr($value, 0, 4)) $case->$key = '';
if($case->story) $case->storyTitle = $this->dao->findById($case->story)->from(TABLE_STORY)->fetch('title');
if($version == 0) $version = $case->version;
$case->steps = $this->dao->select('*')->from(TABLE_CASESTEP)->where('`case`')->eq($caseID)->andWhere('version')->eq($version)->fetchAll();
$case->files = $this->loadModel('file')->getByObject('case', $caseID);
return $case;
}
@@ -72,15 +90,40 @@ class testcaseModel extends model
{
$oldCase = $this->getById($caseID);
$now = date('Y-m-d H:i:s');
$version = $oldCase->version + 1;
$case = fixer::input('post')
->add('lastEditedBy', $this->app->user->account)
->add('lastEditedDate', $now)
->add('version', $version)
->setDefault('story', 0)
->stripTags('title')
->specialChars('steps')
->remove('comment')
->remove('comment,steps,expects')
->get();
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck('title,status,type', 'notempty')->where('id')->eq((int)$caseID)->exec();
if(!dao::isError()) return common::createChanges($oldCase, $case);
if(!$this->dao->isError())
{
foreach($this->post->steps as $stepID => $stepDesc)
{
if(empty($stepDesc)) continue;
$step->case = $caseID;
$step->version = $version;
$step->desc = htmlspecialchars($stepDesc);
$step->expect = htmlspecialchars($this->post->expects[$stepID]);
$this->dao->insert(TABLE_CASESTEP)->data($step)->autoCheck()->exec();
}
/* 将步骤合并为字符串以计算diff。*/
$oldCase->steps = $this->joinStep($oldCase->steps);
$case->steps = $this->joinStep($this->getById($caseID, $version)->steps);
return common::createChanges($oldCase, $case);
}
}
/* 合并步骤。*/
private function joinStep($steps)
{
$retrun = '';
foreach($steps as $step) $return .= $step->desc . ' EXPECT:' . $step->expect . "\n";
return $return;
}
}

View File

@@ -22,56 +22,60 @@
* @link http://www.zentao.cn
*/
?>
<?php include '../../common/header.html.php';?>
<style>#produc{width:245px} #story {width:90%}</style>
<script language='Javascript'>
/* 加载产品对应的模块和需求。*/
function loadAll(productID)
{
loadModuleMenu(productID);
loadStory(productID);
}
/* 加载模块。*/
function loadModuleMenu(productID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case');
$('#moduleIdBox').load(link);
}
/* 加载需求列表。*/
function loadStory(productID)
{
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID);
$('#storyIdBox').load(link);
}
</script>
<?php include './header.html.php';?>
<div class='yui-d0'>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $lang->testcase->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->testcase->labProductAndModule;?></th>
<th class='rowhead'><?php echo $lang->testcase->lblProductAndModule;?></th>
<td class='a-left'>
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-2'");?>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID);?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->labStory;?></th>
<th class='rowhead'><?php echo $lang->testcase->lblStory;?></th>
<td class='a-left'><span id='storyIdBox'><?php echo html::select('story', $stories, '', 'class=select-3');?></span></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->title;?></th>
<td class='a-left'><input type='text' name='title' class='text-1' /></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->title;?></th>
<td class='a-left'><textarea class='area-1'></textarea></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->steps;?></th>
<td class='a-left'><textarea name='steps' class='area-1' rows='8'></textarea></td>
<td class='a-left'>
<table class='w-p90'>
<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->action;?></th>
</tr>
<?php
for($i = 1; $i <= 5; $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='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 "</nobr></td>";
echo '</tr>';
}
?>
</table>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->testcase->labTypeAndPri;?></th>
<th class='rowhead'><?php echo $lang->testcase->lblTypeAndPri;?></th>
<td class='a-left'>
<?php echo html::select('type', (array)$lang->testcase->typeList, '', 'class=select-2');?>
<?php echo html::select('pri', (array)$lang->testcase->priList, '', 'class=select-2');?>

View File

@@ -22,33 +22,8 @@
* @link http://www.zentao.cn
*/
?>
<?php include '../../common/header.html.php';?>
<style>#produc{width:245px} #story {width:90%}</style>
<script language='Javascript'>
storyID ='<?php echo $case->story;?>'
/* 加载产品对应的模块和需求。*/
function loadAll(productID)
{
loadModuleMenu(productID);
loadStory(productID);
}
/* 加载模块。*/
function loadModuleMenu(productID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case');
$('#moduleIdBox').load(link);
}
/* 加载需求列表。*/
function loadStory(productID)
{
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleID=0&storyID=' + storyID);
$('#storyIdBox').load(link);
}
</script>
<?php include './header.html.php';?>
<style>#module{width:90%}</style>
<form method='post' target='hiddenwin'>
<div class='yui-d0'>
<div id='titlebar'>
@@ -60,112 +35,102 @@ function loadStory(productID)
</div>
</div>
<div class='yui-d0 yui-t7'>
<div class='yui-g'>
<div class='yui-u first'>
<div class='yui-d0 yui-t8'>
<div class='yui-main'>
<div class='yui-b'>
<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 html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-2'");?>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID);?></span>
</td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->type;?></td>
<td><?php echo html::select('type', (array)$lang->testcase->typeList, $case->type, 'class=select-2');?>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->pri;?></td>
<td><?php echo html::select('pri', (array)$lang->testcase->priList, $case->pri, 'class=select-2');?>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->status;?></td>
<td><?php echo html::select('status', (array)$lang->testcase->statusList, $case->status, 'class=select-2');?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->story;?></td>
<td class='a-left'><span id='storyIdBox'><?php echo html::select('story', $stories, $case->story, 'class=select-3');?></span></td>
</tr>
</table>
</fieldset>
<!--
<fieldset>
<legend><?php echo $lang->testcase->legendMailto;?></legend>
<div>mailto</div>
<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->action;?></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>
<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>
<legend><?php echo $lang->testcase->legendComment;?></legend>
<textarea name='comment' rows='6' class='w-p100'></textarea>
</fieldset>
<!--
<fieldset>
<legend><?php echo $lang->testcase->legendLinkBugs;?></legend>
<div> linkcase </div>
<legend><?php echo $lang->testcase->legendAttatch;?></legend>
<?php echo $this->fetch('file', 'buildform', 'filecount=2');?>
</fieldset>
-->
</div>
<div class='a-center'>
<?php echo html::submitButton();?>
<input type='button' value='<?php echo $lang->testcase->buttonToList;?>' class='button-s'
onclick='location.href="<?php echo $this->createLink('testcase', 'browse', "productID=$productID");?>"' />
</div>
<?php include '../../common/action.html.php';?>
</div>
</div>
</div>
<div class='yui-d0'>
<fieldset>
<legend><?php echo $lang->testcase->legendSteps;?></legend>
<div class='a-center'>
<textarea name='steps' rows='5' class='area-1'><?php echo $case->steps;?></textarea>
</div>
</fieldset>
<fieldset>
<legend><?php echo $lang->testcase->legendComment;?></legend>
<div class='a-center'>
<textarea name='comment' rows='4' class='area-1'></textarea></td>
</div>
</fieldset>
<fieldset>
<legend><?php echo $lang->testcase->legendAction;?></legend>
<div class='a-center'>
<?php echo html::submitButton();?>
<input type='button' value='<?php echo $lang->testcase->buttonToList;?>' class='button-s'
onclick='location.href="<?php echo $this->createLink('testcase', 'browse', "productID=$productID");?>"' />
</div>
</fieldset>
<div class='yui-b'>
<fieldset>
<legend><?php echo $lang->testcase->legendBasicInfo;?></legend>
<table class='table-1 a-left' cellpadding='0' cellspacing='0'>
<tr>
<td class='rowhead w-p20'><?php echo $lang->testcase->product;?></td>
<td><?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-1'");?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->module;?></td>
<td><span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID, "class='select-1'");?></span></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->type;?></td>
<td><?php echo html::select('type', (array)$lang->testcase->typeList, $case->type, 'class=select-1');?>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->pri;?></td>
<td><?php echo html::select('pri', (array)$lang->testcase->priList, $case->pri, 'class=select-1');?>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->status;?></td>
<td><?php echo html::select('status', (array)$lang->testcase->statusList, $case->status, 'class=select-1');?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->story;?></td>
<td class='a-left'><span id='storyIdBox'><?php echo html::select('story', $stories, $case->story, 'class=select-1');?></span></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend><?php echo $lang->testcase->legendOpenAndEdit;?></legend>
<table class='table-1 a-left'>
<tr>
<td class='rowhead w-p20'><?php echo $lang->testcase->openedBy;?></td>
<td><?php echo $case->openedBy . $lang->at . $case->openedDate;?></td>
<tr>
<td class='rowhead'><?php echo $lang->testcase->lblLastEdited;?></td>
<td><?php if($case->lastEditedBy) echo $case->lastEditedBy . $lang->at . $case->lastEditedDate;?></td>
</tr>
</table>
</fieldset>
</div>
</div>
<?php include '../../common/footer.html.php';?>

View File

@@ -0,0 +1,77 @@
<?php include '../../common/header.html.php';?>
<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}
</style>
<script language='Javascript'>
/* 加载产品对应的模块和需求。*/
function loadAll(productID)
{
loadModuleMenu(productID);
loadStory(productID);
}
/* 加载模块。*/
function loadModuleMenu(productID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case');
$('#moduleIdBox').load(link);
}
/* 加载需求列表。*/
function loadStory(productID)
{
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID);
$('#storyIdBox').load(link);
}
/* 删除一行。*/
function deleteRow(rowID)
{
if($('.stepID').size() == 1) return;
$('#row' + rowID).remove();
updateID();
}
/* 之前增加一行。*/
function preInsert(rowID)
{
$('#row' + rowID).before(createRow());
updateID();
}
/* 之后增加一行。*/
function postInsert(rowID)
{
$('#row' + rowID).after(createRow());
updateID();
}
/* 创建一个row对象。*/
function createRow()
{
var newRowID = $('.stepID').size() + 1;
var lblDelete = '<?php echo $lang->testcase->deleteStep;?>';
var lblBefore = '<?php echo $lang->testcase->insertBefore;?>';
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='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 += "</nobr></td>";
return newRow;
}
/* 重新计算并更新stepID。*/
function updateID()
{
i = 1;
$('.stepID').each(function(){$(this).html(i ++)});
}
</script>

View File

@@ -23,6 +23,7 @@
*/
?>
<?php include '../../common/header.html.php';?>
<?php include '../../common/colorize.html.php';?>
<div class='yui-d0'>
<div id='titlebar'>
@@ -36,15 +37,36 @@
</div>
</div>
<div class='yui-d0 yui-t6'>
<div class='yui-d0 yui-t8'>
<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>
<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>
<!--
<fieldset>
<legend><?php echo $lang->testcase->legendAttatch;?></legend>
<div><?php foreach($case->files as $file) echo html::a($file->fullPath, $file->title, '_blank');?></div>
</fieldset>
-->
<?php include '../../common/action.html.php';?>
<fieldset>
<legend><?php echo $lang->testcase->legendAction;?></legend>
@@ -62,21 +84,23 @@
<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 class='rowhead w-p20'><?php echo $lang->testcase->product;?></td>
<td><?php if(!common::printLink('testcase', 'browse', "productID=$case->product", $productName)) echo $productName;?></td>
</tr>
<tr>
<td class='rowhead w-p20'><?php echo $lang->testcase->module;?></td>
<td>
<?php
foreach($modulePath as $key => $module)
{
if(!common::printLink('testcase', 'browse', "productID=$case->product&browseType=byModule&param=$module->id", $module->name)) echo $module->name;
if(isset($modulePath[$key + 1])) echo $lang->arrow;
}
?>
</td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->type;?></td>
<td class='rowhead w-p20'><?php echo $lang->testcase->type;?></td>
<td><?php echo $lang->testcase->typeList[$case->type];?></td>
</tr>
<tr>
@@ -95,55 +119,28 @@
?>
</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>
<legend><?php echo $lang->testcase->legendOpenAndEdit;?></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>
<td class='rowhead w-p20'><?php echo $lang->testcase->openedBy;?></td>
<td><?php echo $case->openedBy . $lang->at . $case->openedDate;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->testcase->openedDate;?></td>
<td><?php echo $case->openedDate;?></td>
<td class='rowhead w-p20'><?php echo $lang->testcase->lblLastEdited;?></td>
<td><?php if($case->lastEditedBy) echo $case->lastEditedBy . $lang->at . $case->lastEditedDate;?></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>
<legend><?php echo $lang->testcase->legendVersion;?></legend>
<div>
<?php for($i = $case->version; $i >= 1; $i --) echo html::a(inlink('view', "caseID=$case->id&version=$i"), '#' . $i) . ' ';?>
</div>
</fieldset>
<!--
<fieldset>
<legend><?php echo $lang->testcase->legendLinkBugs;?></legend>
<div> linkcase </div>
</fieldset>
-->
</div>
</div>
<?php include '../../common/footer.html.php';?>

View File

@@ -27,6 +27,7 @@ body{padding-bottom:50px}
fieldset {border:1px solid #e4e4e4; padding:5px 10px 5px 10px; margin-bottom:5px}
legend {font-weight:bold; color:darkgreen}
fieldset .table-1 {margin:0;}
fieldset .bd-1px, fieldset .bd-1px td, fieldset .bd-1px th {border:1px solid #efefef; padding:2px}
fieldset tr, fieldset td, fieldset th {border:none; padding:2px}
del{background:#fcc}
ins{background:#cfc; text-decoration:none}
@@ -112,8 +113,10 @@ caption {border:1px solid #e4e4e4; background:#efefef; margin:0; padding:5
.w-p80 {width: 80%}
.w-p85 {width: 85%}
.w-p90 {width: 90%}
.w-p100 {width: 100%}
.w-20px {width:20px}
.w-30px {width:30px}
.w-50px {width:50px}
.w-100px {width:100px}
.w-150px {width:150px}