diff --git a/trunk/module/common/lang/zh-cn.php b/trunk/module/common/lang/zh-cn.php index 22329badc4..0f7afb80b8 100644 --- a/trunk/module/common/lang/zh-cn.php +++ b/trunk/module/common/lang/zh-cn.php @@ -156,7 +156,7 @@ $lang->testcase->menu->testtask = array('link' => '测试任务|testtask|browse| $lang->testtask->menu->product = '%s'; $lang->testtask->menu->bug = array('link' => '缺陷管理|bug|browse|productID=%s'); $lang->testtask->menu->testcase = array('link' => '用例管理|testcase|browse|productID=%s'); -$lang->testtask->menu->testtask = array('link' => '测试任务|testtask|browse|productID=%s', 'alias' => 'view,create,edit,linkcase'); +$lang->testtask->menu->testtask = array('link' => '测试任务|testtask|browse|productID=%s', 'alias' => 'view,create,edit,linkcase,cases'); /* 组织结构视图菜单设置。*/ $lang->company->menu->browseUser = array('link' => '用户列表|company|browse', 'subModule' => 'user'); diff --git a/trunk/module/group/lang/zh-cn.php b/trunk/module/group/lang/zh-cn.php index 45ffe894b6..761b230b40 100644 --- a/trunk/module/group/lang/zh-cn.php +++ b/trunk/module/group/lang/zh-cn.php @@ -181,6 +181,7 @@ $lang->resource->testtask->index = 'index'; $lang->resource->testtask->create = 'create'; $lang->resource->testtask->browse = 'browse'; $lang->resource->testtask->view = 'view'; +$lang->resource->testtask->cases = 'cases'; $lang->resource->testtask->edit = 'edit'; $lang->resource->testtask->delete = 'delete'; $lang->resource->testtask->batchAssign = 'batchAssign'; diff --git a/trunk/module/testtask/control.php b/trunk/module/testtask/control.php index c66af82d51..eff52f9006 100644 --- a/trunk/module/testtask/control.php +++ b/trunk/module/testtask/control.php @@ -42,6 +42,9 @@ class testtask extends control /* 浏览一个产品下面的task。*/ public function browse($productID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { + /* 登记session。*/ + $this->session->set('testtaskList', $this->app->getURI(true)); + /* 设置产品和菜单。*/ $productID = common::saveProductState($productID, key($this->products)); $this->testtask->setMenu($this->products, $productID); @@ -70,6 +73,7 @@ class testtask extends control { $taskID = $this->testtask->create($productID); if(dao::isError()) die(js::error(dao::getError())); + $this->loadModel('action')->create('testtask', $taskID, 'opened'); die(js::locate($this->createLink('testtask', 'browse', "productID=$productID"), 'parent')); } @@ -91,10 +95,9 @@ class testtask extends control /* 查看一个task。*/ public function view($taskID) { - $this->app->loadLang('testcase'); - /* 获取task和产品信息,并设置菜单。*/ - $task = $this->testtask->getById($taskID); + $task = $this->testtask->getById($taskID); + if(!$task) die(js::error($this->lang->notFound) . js::locate('back')); $productID = $task->product; $this->testtask->setMenu($this->products, $productID); @@ -103,6 +106,32 @@ class testtask extends control $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->testtask->view; + /* 赋值。*/ + $this->view->productID = $productID; + $this->view->task = $task; + $this->view->users = $this->loadModel('user')->getPairs('noclosed'); + $this->view->actions = $this->loadModel('action')->getList('testtask', $taskID); + + $this->display(); + } + + /* 查看任务的用例列表。*/ + public function cases($taskID) + { + $this->app->loadLang('testcase'); + $this->session->set('caseList', $this->app->getURI(true)); + + /* 获取task和产品信息,并设置菜单。*/ + $task = $this->testtask->getById($taskID); + if(!$task) die(js::error($this->lang->notFound) . js::locate('back')); + $productID = $task->product; + $this->testtask->setMenu($this->products, $productID); + + /* 导航信息。*/ + $this->view->header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases; + $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); + $this->view->position[] = $this->lang->testtask->cases; + /* 赋值。*/ $this->view->productID = $productID; $this->view->task = $task; @@ -112,21 +141,24 @@ class testtask extends control $this->display(); } + /* 编辑一个Bug。*/ public function edit($taskID) { - /* 获得task信息。*/ - $task = $this->testtask->getById($taskID); - $productID = common::saveProductState($task->product, key($this->products)); - /* 更新task信息。*/ if(!empty($_POST)) { - $this->testtask->update($taskID); + $changes = $this->testtask->update($taskID); if(dao::isError()) die(js::error(dao::getError())); - die(js::locate(inlink('browse', "productID=$productID"), 'parent')); + $actionID = $this->loadModel('action')->create('testtask', $taskID, 'edited'); + $this->action->logHistory($actionID, $changes); + die(js::locate(inlink('view', "taskID=$taskID"), 'parent')); } + /* 获得task信息。*/ + $task = $this->testtask->getById($taskID); + $productID = common::saveProductState($task->product, key($this->products)); + /* 设置菜单。*/ $this->testtask->setMenu($this->products, $productID); @@ -152,7 +184,7 @@ class testtask extends control else { $task = $this->testtask->getByID($taskID); - $this->testtask->delete($taskID); + $this->testtask->delete(TABLE_TESTTASK, $taskID); die(js::locate(inlink('browse', "product=$task->product"), 'parent')); } } @@ -163,7 +195,7 @@ class testtask extends control if(!empty($_POST)) { $this->testtask->linkCase($taskID); - $this->locate(inlink('view', "taskID=$taskID")); + $this->locate(inlink('cases', "taskID=$taskID")); } $this->session->set('caseList', $this->app->getURI(true)); diff --git a/trunk/module/testtask/lang/zh-cn.php b/trunk/module/testtask/lang/zh-cn.php index e43bef03c2..9f1da35f01 100644 --- a/trunk/module/testtask/lang/zh-cn.php +++ b/trunk/module/testtask/lang/zh-cn.php @@ -28,12 +28,14 @@ $lang->testtask->view = "测试任务详情"; $lang->testtask->edit = "编辑测试任务"; $lang->testtask->browse = "测试任务列表"; $lang->testtask->linkCase = "关联用例"; +$lang->testtask->linkCaseAB = "关联"; $lang->testtask->unlinkCase = "移除"; $lang->testtask->batchAssign = "批量指派"; $lang->testtask->runCase = "执行"; $lang->testtask->results = "结果"; $lang->testtask->createBug = "创建Bug"; $lang->testtask->assign = '指派'; +$lang->testtask->cases = '用例'; $lang->testtask->common = '测试任务'; $lang->testtask->id = '任务编号'; diff --git a/trunk/module/testtask/model.php b/trunk/module/testtask/model.php index 66e88f0377..aae705a3e0 100644 --- a/trunk/module/testtask/model.php +++ b/trunk/module/testtask/model.php @@ -50,17 +50,23 @@ class testtaskModel extends model /* 获得某一个产品的测试任务列表。*/ public function getProductTasks($productID, $orderBy = 'id_desc', $pager = null) { - return $this->dao->select('t1.*, t2.name AS productName, t3.name AS projectName, t4.name AS buildName')->from(TABLE_TESTTASK)->alias('t1') + return $this->dao->select('t1.*, t2.name AS productName, t3.name AS projectName, t4.name AS buildName') + ->from(TABLE_TESTTASK)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') ->leftJoin(TABLE_PROJECT)->alias('t3')->on('t1.project = t3.id') ->leftJoin(TABLE_BUILD)->alias('t4')->on('t1.build = t4.id') - ->where('t1.product')->eq((int)$productID)->orderBy($orderBy)->page($pager)->fetchAll(); + ->where('t1.product')->eq((int)$productID) + ->andWhere('t1.deleted')->eq(0) + ->orderBy($orderBy) + ->page($pager) + ->fetchAll(); } /* 获取一个测试任务的详细信息。*/ public function getById($taskID) { - return $this->dao->select('t1.*, t2.name AS productName, t3.name AS projectName, t4.name AS buildName')->from(TABLE_TESTTASK)->alias('t1') + return $this->dao->select('t1.*, t2.name AS productName, t3.name AS projectName, t4.name AS buildName') + ->from(TABLE_TESTTASK)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') ->leftJoin(TABLE_PROJECT)->alias('t3')->on('t1.project = t3.id') ->leftJoin(TABLE_BUILD)->alias('t4')->on('t1.build = t4.id') @@ -70,17 +76,13 @@ class testtaskModel extends model /* 更新测试任务信息。*/ public function update($taskID) { + $oldTask = $this->getById($taskID); $task = fixer::input('post') ->stripTags('name') ->specialChars('desc') ->get(); $this->dao->update(TABLE_TESTTASK)->data($task)->autoCheck()->batchcheck($this->config->testtask->edit->requiredFields, 'notempty')->where('id')->eq($taskID)->exec(); - } - - /* 删除测试任务信息。*/ - public function delete($taskID) - { - $this->dao->delete()->from(TABLE_TESTTASK)->where('id')->eq($taskID)->exec(); + if(!dao::isError()) return common::createChanges($oldTask, $task); } /* 关联用例。*/ diff --git a/trunk/module/testtask/view/browse.html.php b/trunk/module/testtask/view/browse.html.php index f3c9666eb1..372cab516a 100644 --- a/trunk/module/testtask/view/browse.html.php +++ b/trunk/module/testtask/view/browse.html.php @@ -25,22 +25,21 @@
- -
+ + - - - + + - - - - + + + + @@ -48,17 +47,17 @@ - - - + + diff --git a/trunk/module/testtask/view/linkcase.html.php b/trunk/module/testtask/view/linkcase.html.php index 0815051909..971f84f586 100644 --- a/trunk/module/testtask/view/linkcase.html.php +++ b/trunk/module/testtask/view/linkcase.html.php @@ -36,17 +36,20 @@ function checkall(checker)
-
testtask->browse;?>
testtask->create);?>
testtask->id;?>testtask->name;?>testtask->product;?>idAB;?>testtask->name;?> testtask->project;?> testtask->build;?>testtask->begin;?>testtask->end;?>testtask->status;?>actions;?>testtask->begin;?>testtask->end;?>statusAB;?>actions;?>
id"), sprintf('%03d', $task->id));?> id"), $task->name);?>productName?>projectName?>buildName?>projectName?>build == 'trunk' ? print('Trunk') : print(html::a($this->createLink('build', 'view', "buildID=$task->build"), $task->buildName));?> begin?> end?> testtask->statusList[$task->status];?> id", $lang->testtask->cases); + common::printLink('testtask', 'linkcase', "taskID=$task->id", $lang->testtask->linkCaseAB); common::printLink('testtask', 'edit', "taskID=$task->id", $lang->edit); common::printLink('testtask', 'delete', "taskID=$task->id", $lang->delete, 'hiddenwin'); - common::printLink('testtask', 'linkcase', "taskID=$task->id", $lang->testtask->linkCase); ?>
- +
testtask->unlinkedCases;?>
+ - - - + + + - - - - + + + + @@ -54,7 +57,7 @@ function checkall(checker) - - - + + diff --git a/trunk/module/testtask/view/runcase.html.php b/trunk/module/testtask/view/runcase.html.php index e2e9576efd..1b401a5802 100644 --- a/trunk/module/testtask/view/runcase.html.php +++ b/trunk/module/testtask/view/runcase.html.php @@ -26,8 +26,8 @@
+
testtask->unlinkedCases;?>
+
session->testtaskList, $lang->goback);?>
+
testcase->id;?>testcase->pri;?>
idAB;?>priAB;?> testcase->title;?>testcase->type;?>testcase->openedBy;?>testcase->status;?>testtask->linkVersion;?>testcase->type;?>openedByAB;?>statusAB;?>testtask->linkVersion;?>
createLink('testcase', 'view', "testcaseID=$case->id"), sprintf('%03d', $case->id));?> pri?> + title . ' ( '; for($i = $case->version; $i >= 1; $i --) @@ -75,8 +78,8 @@ function checkall(checker)
selectAll;?>
- - + + diff --git a/trunk/module/testtask/view/view.html.php b/trunk/module/testtask/view/view.html.php index ef3e29a991..60923abdbf 100644 --- a/trunk/module/testtask/view/view.html.php +++ b/trunk/module/testtask/view/view.html.php @@ -24,113 +24,51 @@ ?> - - -
-
-
CASE#case->id. $lang->colon . $run->case->title;?>
CASE#case->id. $lang->colon . $run->case->title;?>
testcase->stepID;?> testcase->stepDesc;?> testcase->stepExpect;?>
- - - - - - - - - - - - - - - - - - - - - - - - -
testtask->view;?>
testtask->project;?>projectName;?>
testtask->build;?>buildName ? print($task->buildName) : print($task->build);?>
testtask->begin;?>begin;?> -
testtask->end;?>end;?> -
testtask->status;?>testtask->statusList[$task->status];?> -
testtask->name;?>name;?> -
testtask->desc;?>desc);?> -
- -
-
- id");?>' target='hiddenwin'> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
testtask->linkedCases;?>
-
id", $lang->testtask->linkCase);?>
-
testcase->id;?>testcase->pri;?>testcase->title;?>testcase->type;?>testtask->assignedTo;?>testtask->lastRun;?>testtask->lastResult;?>testtask->status;?>actions;?>
case' /> "; printf('%03d', $run->case);?>pri?>createLink('testcase', 'view', "caseID=$run->case&version=$run->version"), $run->title, '_blank');?> - testcase->typeList[$run->type];?>assignedTo];?>lastRun)) echo date(DT_MONTHTIME1, strtotime($run->lastRun));?>lastResult) echo $lang->testcase->resultList[$run->lastResult];?>testtask->statusList[$run->status];?> - id", $lang->testtask->runCase, '', 'class="iframe"'); - common::printLink('testtask', 'results', "id=$run->id", $lang->testtask->results, '', 'class="iframe"'); - common::printLink('bug', 'create', "product=$productID&extra=projectID=$task->project,buildID=$task->build,caseID=$run->case,runID=$run->id", $lang->testtask->createBug); - common::printLink('testtask', 'unlinkcase', "id=$run->id", $lang->testtask->unlinkCase, 'hiddenwin'); - ?> -
" . $lang->selectAll;?> - testtask->assign); - ?> -
- -
+ common::printLink('testtask', 'cases', "taskID=$task->id", $lang->testtask->cases); + common::printLink('testtask', 'linkcase', "taskID=$task->id", $lang->testtask->linkCaseAB); + common::printLink('testtask', 'edit', "taskID=$task->id", $lang->edit); + common::printLink('testtask', 'delete', "taskID=$task->id", $lang->delete, 'hiddenwin'); + } + echo html::a($browseLink, $lang->goback); + ?>
+