* add actions of testtask.

This commit is contained in:
zhujinyong
2013-01-18 05:43:47 +00:00
parent 5d0b629775
commit 7323683405
7 changed files with 205 additions and 2 deletions
+76
View File
@@ -300,6 +300,82 @@ class testtask extends control
$this->display();
}
/**
* Start testtask.
*
* @param int $taskID
* @access public
* @return void
*/
public function start($taskID)
{
$actions = $this->loadModel('action')->getList('testtask', $taskID);
if(!empty($_POST))
{
$changes = $this->testtask->start($taskID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
$actionID = $this->action->create('testtask', $taskID, 'Started', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
die(js::locate($this->createLink('testtask', 'view', "taskID=$taskID"), 'parent'));
}
/* Get task info. */
$testtask = $this->testtask->getById($taskID);
$productID = $this->product->saveState($testtask->product, $this->products);
/* Set menu. */
$this->testtask->setMenu($this->products, $productID);
$this->view->testtask = $testtask;
$this->view->header->title = $testtask->name . $this->lang->colon . $this->lang->testtask->start;
$this->view->position[] = $this->lang->testtask->start;
$this->view->actions = $actions;
$this->display();
}
/**
* Close testtask.
*
* @param int $taskID
* @access public
* @return void
*/
public function close($taskID)
{
$actions = $this->loadModel('action')->getList('testtask', $taskID);
if(!empty($_POST))
{
$changes = $this->testtask->close($taskID);
if(dao::isError()) die(js::error(dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
$actionID = $this->action->create('testtask', $taskID, 'Closed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
die(js::locate($this->createLink('testtask', 'view', "taskID=$taskID"), 'parent'));
}
/* Get task info. */
$testtask = $this->testtask->getById($taskID);
$productID = $this->product->saveState($testtask->product, $this->products);
/* Set menu. */
$this->testtask->setMenu($this->products, $productID);
$this->view->testtask = $this->testtask->getById($taskID);
$this->view->header->title = $testtask->name . $this->lang->colon . $this->lang->close;
$this->view->position[] = $this->lang->close;
$this->view->actions = $actions;
$this->display();
}
/**
* Delete a test task.
*
+2
View File
@@ -26,6 +26,7 @@ $lang->testtask->createBug = "Bug(+)";
$lang->testtask->assign = 'Assign';
$lang->testtask->cases = 'Cases';
$lang->testtask->next = 'Next';
$lang->testtask->start = "Start";
$lang->testtask->common = 'Test task';
$lang->testtask->id = 'ID';
@@ -44,6 +45,7 @@ $lang->testtask->linkVersion = 'Version';
$lang->testtask->lastRunAccount = "Run";
$lang->testtask->lastRunTime = 'Time';
$lang->testtask->lastRunResult = 'Result';
$lang->testtask->report = 'Report';
$lang->testtask->statusList['wait'] = 'Pending';
$lang->testtask->statusList['doing'] = 'In progress';
+2
View File
@@ -26,6 +26,7 @@ $lang->testtask->createBug = "提Bug";
$lang->testtask->assign = '指派';
$lang->testtask->cases = '用例';
$lang->testtask->next = '下一个';
$lang->testtask->start = "开始";
$lang->testtask->common = '测试任务';
$lang->testtask->id = '任务编号';
@@ -44,6 +45,7 @@ $lang->testtask->linkVersion = '版本';
$lang->testtask->lastRunAccount = '执行人';
$lang->testtask->lastRunTime = '执行时间';
$lang->testtask->lastRunResult = '结果';
$lang->testtask->report = '测试报告';
$lang->testtask->statusList['wait'] = '未开始';
$lang->testtask->statusList['doing'] = '进行中';
+61
View File
@@ -147,6 +147,49 @@ class testtaskModel extends model
if(!dao::isError()) return common::createChanges($oldTask, $task);
}
/**
* Start testtask.
*
* @param int $taskID
* @access public
* @return void
*/
public function start($taskID)
{
$oldTesttask = $this->getById($taskID);
$testtask = fixer::input('post')
->setDefault('status', 'doing')
->remove('comment')->get();
$this->dao->update(TABLE_TESTTASK)->data($testtask)
->autoCheck()
->where('id')->eq((int)$taskID)
->exec();
if(!dao::isError()) return common::createChanges($oldTesttask, $testtask);
}
/**
* Close testtask.
*
* @access public
* @return void
*/
public function close($taskID)
{
$oldTesttask = $this->getById($taskID);
$testtask = fixer::input('post')
->setDefault('status', 'done')
->remove('comment')->get();
$this->dao->update(TABLE_TESTTASK)->data($testtask)
->autoCheck()
->where('id')->eq((int)$taskID)
->exec();
if(!dao::isError()) return common::createChanges($oldTesttask, $testtask);
}
/**
* Link cases.
*
@@ -421,4 +464,22 @@ class testtaskModel extends model
}
return $results;
}
/**
* Judge an action is clickable or not.
*
* @param object $product
* @param string $action
* @access public
* @return void
*/
public function isClickable($testtask, $action)
{
$action = strtolower($action);
if($action == 'start') return $testtask->status == 'wait';
if($action == 'close') return $testtask->status != 'done';
return true;
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
/**
* The close file of testtask module of ZenTaoPMS.
*
* @copyright Copyright 2009-2013 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang<wwccss@gmail.com>
* @package testtask
* @version $Id: close.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $testtask->name;?></caption>
<tr>
<td class='rowhead'><?php echo $lang->testtask->report;?></td>
<td><?php echo html::textarea('report', '', "rows='6' class='area-1'");?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->comment;?></td>
<td><?php echo html::textarea('comment', '', "rows='6' class='area-1'");?></td>
</tr>
<tr>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
<?php include '../../common/view/action.html.php';?>
</form>
<?php include '../../common/view/footer.html.php';?>
+28
View File
@@ -0,0 +1,28 @@
<?php
/**
* The start file of testtask module of ZenTaoPMS.
*
* @copyright Copyright 2009-2013 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang<wwccss@gmail.com>
* @package testtask
* @version $Id: start.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $testtask->name;?></caption>
<tr>
<td class='rowhead'><?php echo $lang->comment;?></td>
<td><?php echo html::textarea('comment', '', "rows='6' class='area-1'");?></td>
</tr>
<tr>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
<?php include '../../common/view/action.html.php';?>
</form>
<?php include '../../common/view/footer.html.php';?>
+4 -2
View File
@@ -56,8 +56,10 @@
$browseLink = $this->session->testtaskList ? $this->session->testtaskList : $this->createLink('testtask', 'browse', "productID=$task->product");
if(!$task->deleted)
{
common::printIcon('testtask', 'cases', "taskID=$task->id");
common::printIcon('testtask', 'linkCase', "taskID=$task->id");
common::printIcon('testtask', 'start', "taskID=$task->id", $task);
common::printIcon('testtask', 'close', "taskID=$task->id", $task);
common::printIcon('testtask', 'cases', "taskID=$task->id", $task);
common::printIcon('testtask', 'linkCase', "taskID=$task->id", $task);
common::printDivider();
common::printIcon('testtask', 'edit', "taskID=$task->id");