+ finish the task #570.

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-10-25 07:41:54 +00:00
parent 153dd4e48f
commit 49cf4a6287
12 changed files with 168 additions and 7 deletions
+2
View File
@@ -62,6 +62,7 @@ $lang->action->desc->commented = '$date, Commented by <strong>$actor</strong>.
$lang->action->desc->activated = '$date, Activated by <strong>$actor</strong>.';
$lang->action->desc->moved = '$date, Moved by <strong>$actor</strong>, previouse is "$extra"';
$lang->action->desc->confirmed = '$date, Confirmed by <strong>$actor</strong>, version is<strong>#$extra</strong>';
$lang->action->desc->bugconfirmed= '$date, Confirmed by <strong>$actor</strong>';
$lang->action->desc->started = '$date, Started by <strong>$actor</strong>.';
$lang->action->desc->canceled = '$date, Canceled by <strong>$actor</strong>.';
$lang->action->desc->svncommited = '$date, <strong>$actor</strong> commited to svn,revision is <strong>#$extra</strong>' . "\n";
@@ -87,6 +88,7 @@ $lang->action->label->resolved = 'resolved';
$lang->action->label->reviewed = 'reviewed';
$lang->action->label->moved = 'moded';
$lang->action->label->confirmed = 'confirmed,';
$lang->action->label->bugconfirmed = 'confirmed Bug,';
$lang->action->label->svncommited = 'commited svn';
$lang->action->label->linked2plan = 'link to plan';
$lang->action->label->unlinkedfromplan = 'unlink from plan';
+1
View File
@@ -88,6 +88,7 @@ $lang->action->label->resolved = '解决了';
$lang->action->label->reviewed = '评审了';
$lang->action->label->moved = '移动了';
$lang->action->label->confirmed = '确认了需求,';
$lang->action->label->bugconfirmed = '确认了Bug,';
$lang->action->label->svncommited = '提交Svn';
$lang->action->label->linked2plan = '关联计划';
$lang->action->label->unlinkedfromplan = '移除计划';
+5 -2
View File
@@ -13,7 +13,7 @@
<?php include './header.html.php';?>
<form method='post' enctype='multipart/form-data'>
<table align='center' class='table-1'>
<caption><?php echo $lang->story->product . $lang->colon . $lang->story->batchCreate; echo "<span class='star'><small>{$lang->story->notes}</small></span>";?></caption>
<caption><?php echo $lang->story->product . $lang->colon . $lang->story->batchCreate;?></caption>
<tr>
<th class='w-id'><?php echo $lang->idAB;?></th>
<th><?php echo $lang->story->module;?></th>
@@ -38,7 +38,10 @@
<td><?php echo html::select("needReview[$i]", $lang->story->reviewList, 0, '');?></td>
</tr>
<?php endfor;?>
<tr><td colspan='8' class='a-center'><?php echo html::submitButton() . html::resetButton();?></td></tr>
<tr>
<td colspan='3' class='a-center'><?php echo "<span class='star'><small>{$lang->story->notes}</small></span>";?></td>
<td colspan='5' class='a-left'><?php echo html::submitButton() . html::resetButton();?></td>
</tr>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>
+5 -2
View File
@@ -13,7 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<form method='post' enctype='multipart/form-data'>
<table align='center' class='table-1'>
<caption><?php echo $lang->task->project . $lang->colon . $lang->task->batchCreate; echo "<span class='star'><small>{$lang->task->notes}</small></span>";?></caption>
<caption><?php echo $lang->task->project . $lang->colon . $lang->task->batchCreate;?></caption>
<tr>
<th class='w-id'><?php echo $lang->idAB;?></th>
<th><?php echo $lang->task->story;?></th>
@@ -40,7 +40,10 @@
<td><?php echo html::input("estimate[$i]", '', "class='w-50px'"); echo "<span class='star'>*</span>";?></td>
</tr>
<?php endfor;?>
<tr><td colspan='8' class='a-center'><?php echo html::submitButton() . html::resetButton();?></td></tr>
<tr>
<td colspan='4' class='a-center'><?php echo "<span class='star'><small>{$lang->task->notes}</small></span>";?></td>
<td colspan='4' class='a-left'><?php echo html::submitButton() . html::resetButton();?></td>
</tr>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>
+1
View File
@@ -27,6 +27,7 @@ $config->testcase->search['params']['type'] = array('operator' => '=',
$config->testcase->search['params']['stage'] = array('operator' => 'include', 'control' => 'select', 'values' => $lang->testcase->stageList);
$config->testcase->defaultSteps = 3;
$config->testcase->batchCreate = 10;
$config->testcase->create->requiredFields = 'title,type';
$config->testcase->edit->requiredFields = 'title,type';
+51 -1
View File
@@ -165,7 +165,7 @@ class testcase extends control
$this->loadModel('story');
if(!empty($_POST))
{
$caseID = $this->testcase->create();
$this->testcase->create();
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
$this->action->create('case', $caseID, 'Opened');
@@ -254,6 +254,56 @@ class testcase extends control
$this->display();
}
/**
* Create a batch test case.
*
* @param int $productID
* @param int $moduleID
* @param int $testcaseID
* @access public
* @return void
*/
public function batchCreate($productID, $moduleID = 0)
{
$this->loadModel('story');
if(!empty($_POST))
{
$caseID = $this->testcase->batchCreate($productID);
if(dao::isError()) die(js::error(dao::getError()));
die(js::locate($this->createLink('testcase', 'browse', "productID=$_POST[product]&browseType=byModule&param=$_POST[module]"), 'parent'));
}
if(empty($this->products)) $this->locate($this->createLink('product', 'create'));
/* Set productID and currentModuleID. */
$productID = $this->product->saveState($productID, $this->products);
$currentModuleID = (int)$moduleID;
/* Set menu. */
$this->testcase->setMenu($this->products, $productID);
/* Init vars. */
$type = 'feature';
$title = '';
$header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->batchCreate;
$position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
$position[] = $this->lang->testcase->batchCreate;
$users = $this->user->getPairs();
$this->view->header = $header;
$this->view->position = $position;
$this->view->productID = $productID;
$this->view->users = $users;
$this->view->productName = $this->products[$productID];
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0);
$this->view->currentModuleID = $currentModuleID;
$this->view->stories = $this->story->getProductStoryPairs($productID);
$this->view->type = $type;
$this->view->title = $title;
$this->display();
}
/**
* View a test case.
+1
View File
@@ -0,0 +1 @@
.text-1{height:30px}
+5 -1
View File
@@ -15,6 +15,7 @@ $lang->testcase->module = 'Module';
$lang->testcase->story = 'Story';
$lang->testcase->storyVersion = 'Story version';
$lang->testcase->title = 'Title';
$lang->testcase->precondition = 'precondition';
$lang->testcase->pri = 'Priority';
$lang->testcase->type = 'Type';
$lang->testcase->status = 'Status';
@@ -50,6 +51,7 @@ $lang->testcase->common = 'Case';
$lang->testcase->index = "Index";
$lang->testcase->create = "Create";
$lang->testcase->delete = "Delete";
$lang->testcase->batchCreate = "Batch create";
$lang->testcase->view = "Info";
$lang->testcase->edit = "Edit";
$lang->testcase->delete = "Delete";
@@ -93,7 +95,9 @@ $lang->testcase->legendComment = 'Comment';
$lang->testcase->legendProduct = 'Product & module';
$lang->testcase->legendVersion = 'Versions';
$lang->testcase->confirmDelete = 'Are you sure to delete this case?';
$lang->testcase->confirmDelete = 'Are you sure to delete this case?';
$lang->testcase->same = 'The same as above';
$lang->testcase->notes = '(Notes: the type and title must be written, otherwise it is no use)';
$lang->testcase->priList[3] = 3;
$lang->testcase->priList[1] = 1;
+4 -1
View File
@@ -50,6 +50,7 @@ $lang->testcase->stepExpect = '预期';
$lang->testcase->common = '用例管理';
$lang->testcase->index = "用例管理首页";
$lang->testcase->create = "创建用例";
$lang->testcase->batchCreate = "批量添加用例";
$lang->testcase->delete = "删除用例";
$lang->testcase->view = "用例详情";
$lang->testcase->edit = "编辑用例";
@@ -94,7 +95,9 @@ $lang->testcase->legendComment = '备注';
$lang->testcase->legendProduct = '产品模块';
$lang->testcase->legendVersion = '版本历史';
$lang->testcase->confirmDelete = '您确认要删除该测试用例吗?';
$lang->testcase->confirmDelete = '您确认要删除该测试用例吗?';
$lang->testcase->same = '同上';
$lang->testcase->notes = '(注:“用例类型”和“用例标题”必须填写,否则此行无效)';
$lang->testcase->priList[3] = 3;
$lang->testcase->priList[1] = 1;
+49
View File
@@ -69,6 +69,55 @@ class testcaseModel extends model
return $caseID;
}
}
/**
* Create a batch case.
*
* @access public
* @return void
*/
function batchCreate($productID)
{
$now = helper::now();
$cases = fixer::input('post')->get();
for($i = 0; $i < $this->config->testcase->batchCreate; $i++)
{
if($cases->type[$i] != '' and $cases->title[$i] != '')
{
$data[$i]->product = $productID;
$data[$i]->module = $cases->module[$i] == 'same' ? ($i == 0 ? 0 : $data[$i-1]->module) : $cases->module[$i];
$data[$i]->type = $cases->type[$i] == 'same' ? ($i == 0 ? '' : $data[$i-1]->type) : $cases->type[$i];
$data[$i]->story = $cases->story[$i] == 'same' ? ($i == 0 ? 0 : $data[$i-1]->story) : $cases->story[$i];
$data[$i]->title = $cases->title[$i];
$data[$i]->openedBy = $this->app->user->account;
$data[$i]->openedDate = $now;
$data[$i]->status = 'normal';
$data[$i]->version = 1;
if($data[$i]->story != 0) $data[$i]->storyVersion = $this->loadModel('story')->getVersion($this->post->story);
$this->dao->insert(TABLE_CASE)->data($data[$i])
->autoCheck()
->batchCheck($this->config->testcase->create->requiredFields, 'notempty')
->exec();
if(dao::isError())
{
echo js::error(dao::getError());
die(js::reload('parent'));
}
$caseID = $this->dao->lastInsertID();
$actionID = $this->loadModel('action')->create('case', $caseID, 'Opened');
}
else
{
unset($cases->module[$i]);
unset($cases->type[$i]);
unset($cases->story[$i]);
unset($cases->title[$i]);
}
}
}
/**
* Get cases of a module.
+43
View File
@@ -0,0 +1,43 @@
<?php
/**
* The batch create view of story module of ZenTaoPMS.
*
* @copyright Copyright 2009-2011 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Yangyang Shi <shiyangyang@cnezsoft.com>
* @package story
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<form method='post' enctype='multipart/form-data'>
<table align='center' class='table-1'>
<caption><?php echo $lang->testcase->batchCreate;?></caption>
<tr>
<th class='w-id'><?php echo $lang->idAB;?></th>
<th><?php echo $lang->testcase->module;?></th>
<th><?php echo $lang->testcase->type;?></th>
<th><?php echo $lang->testcase->story;?></th>
<th><?php echo $lang->testcase->title;?></th>
</tr>
<?php for($i = 0; $i < $config->testcase->batchCreate; $i++):?>
<?php $moduleOptionMenu['same'] = $lang->testcase->same; if($i != 0) $currentModuleID = 'same';?>
<?php $lang->testcase->typeList['same'] = $lang->testcase->same; $type = $i == 0 ? '' : 'same';?>
<?php $stories['same'] = $lang->testcase->same; $story = $i == 0 ? '' : 'same';?>
<?php $pri = 3;?>
<tr class='a-center'>
<td><?php echo $i+1;?></td>
<td><?php echo html::select("module[$i]", $moduleOptionMenu, $currentModuleID, "class=select-3");?></td>
<td><?php echo html::select("type[$i]", $lang->testcase->typeList, $type, "class=select-3"); echo "<span class='star'>*</span>";?></td>
<td><?php echo html::select("story[$i]", $stories, $story, 'class=select-3');?></td>
<td><?php echo html::input("title[$i]", '', "class='text-1'"); echo "<span class='star'>*</span>";?></td>
</tr>
<?php endfor;?>
<tr>
<td colspan='3' class='a-center'><?php echo "<span class='star'><small>{$lang->testcase->notes}</small></span>";?></td>
<td colspan='2' class='a-left'><?php echo html::submitButton() . html::resetButton();?></td>
</tr>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>
+1
View File
@@ -29,6 +29,7 @@ var moduleID = '<?php echo $moduleID;?>';
</div>
<div class='f-right'>
<?php if($browseType != 'needconfirm') common::printLink('testcase', 'export', "productID=$productID&orderBy=$orderBy", $lang->export, '', 'class="export"'); ?>
<?php common::printLink('testcase', 'batchCreate', "productID=$productID&moduleID=$moduleID", $lang->testcase->batchCreate); ?>
<?php common::printLink('testcase', 'create', "productID=$productID&moduleID=$moduleID", $lang->testcase->create); ?>
</div>
</div>