* finish task #2896.

This commit is contained in:
wangyidong
2017-03-03 09:00:45 +08:00
parent 20078c8695
commit 22115ecfbd
23 changed files with 323 additions and 40 deletions
+2
View File
@@ -20,3 +20,5 @@ CREATE TABLE `zt_suitecase` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `zt_case` ADD `lib` mediumint(8) unsigned NOT NULL DEFAULT '0' AFTER `branch`;
ALTER TABLE `zt_case` ADD `fromLib` mediumint(8) unsigned NOT NULL AFTER `fromBug`;
ALTER TABLE `zt_case` ADD `reviewedBy` varchar(255) NOT NULL AFTER `openedDate`;
ALTER TABLE `zt_case` ADD `reviewedDate` date NOT NULL AFTER `reviewedBy`;
+6 -6
View File
@@ -45,12 +45,12 @@ class custom extends control
unset($fieldList['newfeature']);
unset($fieldList['trackthings']);
}
if($module == 'story' && $field == 'review')
if(($module == 'story' || $module == 'testcase') && $field == 'review')
{
$this->app->loadConfig('story');
$this->app->loadConfig($module);
$this->view->users = $this->loadModel('user')->getPairs('nodeleted|noclosed');
$this->view->needReview = zget($this->config->story, 'needReview', 1);
$this->view->forceReview = zget($this->config->story, 'forceReview', '');
$this->view->needReview = zget($this->config->$module, 'needReview', 1);
$this->view->forceReview = zget($this->config->$module, 'forceReview', '');
}
if($module == 'task' && $field == 'hours')
{
@@ -66,10 +66,10 @@ class custom extends control
if(!empty($_POST))
{
if($module == 'story' && $field == 'review')
if(($module == 'story' || $module == 'testcase') && $field == 'review')
{
$data = fixer::input('post')->join('forceReview', ',')->get();
$this->loadModel('setting')->setItems('system.story', $data);
$this->loadModel('setting')->setItems("system.$module", $data);
}
elseif($module == 'task' && $field == 'hours')
{
+1
View File
@@ -49,6 +49,7 @@ $lang->custom->testcase->fields['typeList'] = '类型';
$lang->custom->testcase->fields['stageList'] = '阶段';
$lang->custom->testcase->fields['resultList'] = '执行结果';
$lang->custom->testcase->fields['statusList'] = '状态';
$lang->custom->testcase->fields['review'] = '评审流程';
$lang->custom->testtask = new stdClass();
$lang->custom->testtask->fields['priList'] = '优先级';
+1 -1
View File
@@ -62,7 +62,7 @@ EOT;
<div class='panel-heading'>
<strong><?php echo $lang->custom->object[$module] . $lang->arrow . $lang->custom->$module->fields[$field]?></strong>
</div>
<?php if($module == 'story' and $field == 'review'):?>
<?php if(($module == 'story' ||$module == 'testcase') and $field == 'review'):?>
<table class='table table-form mw-800px'>
<tr>
<th class='w-80px'><?php echo $lang->custom->storyReview;?></th>
+1 -1
View File
@@ -823,7 +823,7 @@ class productModel extends model
public function getProductLink($module, $method, $extra, $branch = false)
{
$link = '';
if(strpos('product,roadmap,bug,testcase,testtask,story,qa', $module) !== false)
if(strpos('product,roadmap,bug,testcase,testtask,story,qa,testsuite', $module) !== false)
{
if($module == 'product' && $method == 'project')
{
+1 -1
View File
@@ -691,7 +691,7 @@ class story extends control
* @access public
* @return void
*/
function batchReview($result, $reason = '')
public function batchReview($result, $reason = '')
{
$storyIDList = $this->post->storyIDList ? $this->post->storyIDList : die(js::locate($this->session->storyList, 'parent'));
$actions = $this->story->batchReview($storyIDList, $result, $reason);
+8
View File
@@ -706,6 +706,14 @@ class storyModel extends model
return $actions;
}
/**
* Subdivide story
*
* @param int $storyID
* @param array $stories
* @access public
* @return int
*/
public function subdivide($storyID, $stories)
{
$now = helper::now();
+4 -2
View File
@@ -2,6 +2,7 @@
$config->testcase = new stdclass();
$config->testcase->defaultSteps = 3;
$config->testcase->batchCreate = 10;
$config->testcase->needReview = 0;
$config->testcase->create = new stdclass();
$config->testcase->edit = new stdclass();
@@ -9,8 +10,9 @@ $config->testcase->create->requiredFields = 'title,type';
$config->testcase->edit->requiredFields = 'title,type';
$config->testcase->editor = new stdclass();
$config->testcase->editor->edit = array('id' => 'comment', 'tools' => 'simpleTools');
$config->testcase->editor->view = array('id' => 'comment,lastComment', 'tools' => 'simpleTools');
$config->testcase->editor->edit = array('id' => 'comment', 'tools' => 'simpleTools');
$config->testcase->editor->view = array('id' => 'comment,lastComment', 'tools' => 'simpleTools');
$config->testcase->editor->review = array('id' => 'comment', 'tools' => 'simpleTools');
$config->testcase->export = new stdclass();
$config->testcase->export->listFields = array('type', 'stage', 'pri', 'status');
+45
View File
@@ -384,6 +384,7 @@ class testcase extends control
$this->view->precondition = $precondition;
$this->view->keywords = $keywords;
$this->view->steps = $steps;
$this->view->users = $this->user->getPairs('noletter|nodeleted|noclosed');
$this->view->branch = $branch;
$this->view->branches = $this->session->currentProductType != 'normal' ? $this->loadModel('branch')->getPairs($productID) : array();
@@ -642,6 +643,7 @@ class testcase extends control
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->view->stories = $this->story->getProductStoryPairs($productID, $case->branch);
}
if(!$this->config->testcase->needReview) unset($this->lang->testcase->statusList['wait']);
$position[] = $this->lang->testcase->common;
$position[] = $this->lang->testcase->edit;
@@ -738,6 +740,7 @@ class testcase extends control
$this->view->title = $this->lang->testcase->batchEdit;
}
if(!$this->config->testcase->needReview) unset($this->lang->testcase->statusList['wait']);
/* Judge whether the editedTasks is too large and set session. */
$showSuhosinInfo = false;
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($cases), count(explode(',', $this->config->testcase->custom->batchEditFields)) + 3);
@@ -761,6 +764,46 @@ class testcase extends control
$this->display();
}
/**
* Review case.
*
* @param int $caseID
* @access public
* @return void
*/
public function review($caseID)
{
if($_POST)
{
$this->testcase->review($caseID);
if(dao::isError()) die(js::error(dao::getError()));
$result = $this->post->result;
$this->loadModel('action')->create('case', $caseID, 'Reviewed', $this->post->comment, ucfirst($result));
die(js::locate(inlink('view', "caseID=$caseID"), 'parent.parent'));
}
$this->view->users = $this->user->getPairs('noletter|nodeleted|noclosed');
$this->view->case = $this->testcase->getById($caseID);
$this->view->actions = $this->loadModel('action')->getList('case', $caseID);
$this->display();
}
/**
* Batch review case.
*
* @param string $result
* @access public
* @return void
*/
public function batchReview($result)
{
$caseIdList = $this->post->caseIDList ? $this->post->caseIDList : die(js::locate($this->session->caseList, 'parent'));
$actions = $this->testcase->batchReview($caseIdList, $result);
if(dao::isError()) die(js::error(dao::getError()));
die(js::locate($this->session->caseList, 'parent'));
}
/**
* Delete a test case
*
@@ -1141,6 +1184,7 @@ class testcase extends control
{
if($_POST)
{
if(!$this->config->testcase->needReview) unset($this->lang->testcase->statusList['wait']);
$product = $this->loadModel('product')->getById($productID);
if($product->type != 'normal') $fields['branch'] = $this->lang->product->branchName[$product->type];
@@ -1388,6 +1432,7 @@ class testcase extends control
echo js::alert($this->lang->error->noData);
die(js::locate($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch")));
}
if(!$this->config->testcase->needReview) unset($this->lang->testcase->statusList['wait']);
$this->view->title = $this->lang->testcase->common . $this->lang->colon . $this->lang->testcase->showImport;
$this->view->position[] = $this->lang->testcase->showImport;
+1
View File
@@ -1,4 +1,5 @@
.w-220px{width:220px}
.w-170px{width:170px}
#createActionMenu .dropdown-menu {width: 100%;}
+18 -5
View File
@@ -32,6 +32,9 @@ $lang->testcase->linkCase = '相关用例';
$lang->testcase->linkCases = '关联相关用例';
$lang->testcase->unlinkCase = '移除相关用例';
$lang->testcase->stage = '适用阶段';
$lang->testcase->reviewedBy = '由谁评审';
$lang->testcase->reviewedDate = '评审时间';
$lang->testcase->reviewResult = '评审结果';
$lang->testcase->lastEditedByAB = '修改者';
$lang->testcase->lastEditedDateAB = '修改日期';
$lang->testcase->lastEditedDate = '修改日期';
@@ -65,6 +68,7 @@ $lang->testcase->create = "建用例";
$lang->testcase->batchCreate = "批量添加";
$lang->testcase->delete = "删除用例";
$lang->testcase->view = "用例详情";
$lang->testcase->review = "评审";
$lang->testcase->edit = "编辑";
$lang->testcase->batchEdit = "批量编辑 ";
$lang->testcase->batchChangeModule = "批量修改模块";
@@ -140,10 +144,15 @@ $lang->testcase->stageList['system'] = '系统测试阶段';
$lang->testcase->stageList['smoke'] = '冒烟测试阶段';
$lang->testcase->stageList['bvt'] = '版本验证阶段';
$lang->testcase->reviewResultList[''] = '';
$lang->testcase->reviewResultList['pass'] = '确认通过';
$lang->testcase->reviewResultList['clarify'] = '有待明确';
$lang->testcase->groups[''] = '分组查看';
$lang->testcase->groups['story'] = '需求分组';
$lang->testcase->statusList[''] = '';
$lang->testcase->statusList['wait'] = '待评审';
$lang->testcase->statusList['normal'] = '正常';
$lang->testcase->statusList['blocked'] = '被阻塞';
$lang->testcase->statusList['investigate'] = '研究中';
@@ -155,19 +164,23 @@ $lang->testcase->resultList['blocked'] = '阻塞';
$lang->testcase->buttonToList = '返回';
$lang->testcase->errorEncode = '无数据,请选择正确的编码重新上传!';
$lang->testcase->noFunction = '不存在iconv和mb_convert_encoding转码方法,不能将数据转成想要的编码!';
$lang->testcase->noRequire = "%s行的“%s”是必填字段,不能为空";
$lang->testcase->noLibrary = "现在还没有公共库,请先创建!";
$lang->testcase->errorEncode = '无数据,请选择正确的编码重新上传!';
$lang->testcase->noFunction = '不存在iconv和mb_convert_encoding转码方法,不能将数据转成想要的编码!';
$lang->testcase->noRequire = "%s行的“%s”是必填字段,不能为空";
$lang->testcase->noLibrary = "现在还没有公共库,请先创建!";
$lang->testcase->mustChooseResult = '必须选择评审结果';
$lang->testcase->searchStories = '键入来搜索需求';
$lang->testcase->selectLib = '请选择库';
$lang->testcase->action = new stdclass();
$lang->testcase->action->fromlib = array('main' => '$date, 由 <strong>$actor</strong> 从公共库 <strong>$extra</strong>导入。');
$lang->testcase->action->fromlib = array('main' => '$date, 由 <strong>$actor</strong> 从公共库 <strong>$extra</strong>导入。');
$lang->testcase->action->reviewed = array('main' => '$date, 由 <strong>$actor</strong> 记录评审结果,结果为 <strong>$extra</strong>。', 'extra' => 'reviewResultList');
$lang->testcase->featureBar['browse']['all'] = $lang->testcase->allCases;
$lang->testcase->featureBar['browse']['needconfirm'] = $lang->testcase->needConfirm;
$lang->testcase->featureBar['browse']['wait'] = '待评审';
$lang->testcase->featureBar['browse']['group'] = '分组查看';
$lang->testcase->featureBar['browse']['zerocase'] = '零用例需求';
$lang->testcase->featureBar['browse']['suite'] = '套件';
+90 -5
View File
@@ -45,7 +45,7 @@ class testcaseModel extends model
$case = fixer::input('post')
->add('openedBy', $this->app->user->account)
->add('openedDate', $now)
->add('status', 'normal')
->add('status', $this->isForceReview() ? 'wait' : 'normal')
->add('version', 1)
->add('fromBug', $bugID)
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion((int)$this->post->story))
@@ -122,6 +122,7 @@ class testcaseModel extends model
$this->loadModel('story');
$storyVersions = array();
$isForceReview = $this->isForceReview();
for($i = 0; $i < $batchNum; $i++)
{
if($cases->type[$i] != '' and $cases->title[$i] != '')
@@ -140,7 +141,7 @@ class testcaseModel extends model
$data[$i]->keywords = $cases->keywords[$i];
$data[$i]->openedBy = $this->app->user->account;
$data[$i]->openedDate = $now;
$data[$i]->status = 'normal';
$data[$i]->status = $isForceReview ? 'wait' : 'normal';
$data[$i]->version = 1;
$caseStory = $data[$i]->story;
@@ -189,13 +190,14 @@ class testcaseModel extends model
* @access public
* @return array
*/
public function getModuleCases($productID, $branch = 0, $moduleIdList = 0, $orderBy = 'id_desc', $pager = null)
public function getModuleCases($productID, $branch = 0, $moduleIdList = 0, $orderBy = 'id_desc', $pager = null, $browseType = '')
{
return $this->dao->select('t1.*, t2.title as storyTitle')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
->where('t1.product')->eq((int)$productID)
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi()
->beginIF($browseType == 'wait')->andWhere('t1.status')->eq($browseType)->fi()
->andWhere('t1.deleted')->eq('0')
->orderBy($orderBy)->page($pager)->fetchAll('id');
}
@@ -295,9 +297,9 @@ class testcaseModel extends model
/* By module or all cases. */
$cases = array();
if($browseType == 'bymodule' or $browseType == 'all')
if($browseType == 'bymodule' or $browseType == 'all' or $browseType == 'wait')
{
$cases = $this->getModuleCases($productID, $branch, $modules, $sort, $pager);
$cases = $this->getModuleCases($productID, $branch, $modules, $sort, $pager, $browseType);
}
/* Cases need confirmed. */
elseif($browseType == 'needconfirm')
@@ -510,6 +512,7 @@ class testcaseModel extends model
->join('stage', ',')
->remove('comment,steps,expects,files,labels')
->get();
if($this->isForceReview() and $stepChanged) $case->status = 'wait';
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->edit->requiredFields, 'notempty')->where('id')->eq((int)$caseID)->exec();
if(!$this->dao->isError())
{
@@ -541,6 +544,64 @@ class testcaseModel extends model
}
}
/**
* Review case
*
* @param int $caseID
* @access public
* @return bool
*/
public function review($caseID)
{
if($this->post->result == false) die(js::alert($this->lang->testcase->mustChooseResult));
$oldCase = $this->dao->findById($caseID)->from(TABLE_CASE)->fetch();
$now = helper::now();
$case = fixer::input('post')
->remove('result,comment')
->setDefault('reviewedDate', substr($now, 0, 10))
->add('lastEditedBy', $this->app->user->account)
->add('lastEditedDate', $now)
->setIF($this->post->result == 'pass', 'status', 'normal')
->join('reviewedBy', ',')
->get();
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->where('id')->eq($caseID)->exec();
return true;
}
/**
* Batch review cases.
*
* @param array $caseIDList
* @access public
* @return array
*/
public function batchReview($caseIdList, $result)
{
$now = helper::now();
$actions = array();
$this->loadModel('action');
$oldCases = $this->getByList($caseIdList);
foreach($caseIdList as $caseID)
{
$oldCase = $oldCases[$caseID];
if($oldCase->status != 'wait') continue;
$case = new stdClass();
$case->reviewedBy = $this->app->user->account;
$case->reviewedDate = substr($now, 0, 10);
$case->lastEditedBy = $this->app->user->account;
$case->lastEditedDate = $now;
if($result == 'pass') $case->status = 'normal';
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->where('id')->eq($caseID)->exec();
$actions[$caseID] = $this->action->create('case', $caseID, 'Reviewed', '', ucfirst($result));
}
return $actions;
}
/**
* Link related cases.
*
@@ -791,6 +852,7 @@ class testcaseModel extends model
$action = strtolower($action);
if($action == 'createbug') return $case->lastRunResult == 'fail';
if($action == 'review') return $case->status == 'wait';
return true;
}
@@ -854,6 +916,7 @@ class testcaseModel extends model
$cases[$key] =$caseData;
}
$isForceReview = $this->isForceReview();
foreach($cases as $key => $caseData)
{
if(!empty($_POST['id'][$key]) and empty($_POST['insert']))
@@ -907,6 +970,7 @@ class testcaseModel extends model
{
$caseData->lastEditedBy = $this->app->user->account;
$caseData->lastEditedDate = $now;
if($stepChanged and $isForceReview) $caseData->status = 'wait';
$this->dao->update(TABLE_CASE)->data($caseData)->where('id')->eq($caseID)->autoCheck()->exec();
if($stepChanged)
{
@@ -935,6 +999,7 @@ class testcaseModel extends model
$caseData->openedBy = $this->app->user->account;
$caseData->openedDate = $now;
$caseData->branch = isset($data->branch[$key]) ? $data->branch[$key] : $branch;
if($isForceReview) $caseData->status = 'wait';
$this->dao->insert(TABLE_CASE)->data($caseData)->autoCheck()->exec();
if(!dao::isError())
@@ -1048,6 +1113,11 @@ class testcaseModel extends model
$this->config->testcase->search['fields']['branch'] = $this->lang->product->branch;
$this->config->testcase->search['params']['branch']['values'] = array('' => '') + $this->loadModel('branch')->getPairs($productID, 'noempty') + array('all' => $this->lang->branch->all);
}
if(!$this->config->testcase->needReview)
{
unset($this->lang->testcase->statusList['wait']);
$this->config->testcase->search['params']['status']['values'] = $this->lang->testcase->statusList;
}
$this->config->testcase->search['actionURL'] = $actionURL;
$this->config->testcase->search['queryID'] = $queryID;
@@ -1145,6 +1215,7 @@ class testcaseModel extends model
case 'actions':
common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", '', 'list', 'play', '', 'runCase iframe', false, "data-width='95%'");
common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", '', 'list', '', '', 'results iframe');
if($config->testcase->needReview) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'list', 'review', '', 'iframe');
common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list');
common::printIcon('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase&param=$case->id", $case, 'list', 'copy');
@@ -1283,4 +1354,18 @@ class testcaseModel extends model
/* 合并配置。*/
foreach($commonOption->graph as $key => $value) if(!isset($chartOption->graph->$key)) $chartOption->graph->$key = $value;
}
/**
* Check whether force review
*
* @access public
* @return void
*/
public function isForceReview()
{
if(!$this->config->testcase->needReview) return false;
if(empty($this->config->testcase->forceReview)) return true;
if(strpos(",{$this->config->testcase->forceReview},", ",{$this->app->user->account},") !== false) return true;
return false;
}
}
+18
View File
@@ -67,6 +67,24 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
$misc = common::hasPriv('testcase', 'batchDelete') ? "onclick=\"confirmBatchDelete('$actionLink')\"" : $class;
echo "<li>" . html::a('#', $lang->delete, '', $misc) . "</li>";
if(common::hasPriv('testcase', 'batchReview') and $config->testcase->needReview)
{
echo "<li class='dropdown-submenu'>";
echo html::a('javascript:;', $lang->testcase->review, '', "id='reviewItem'");
echo "<ul class='dropdown-menu'>";
unset($lang->testcase->reviewResultList['']);
foreach($lang->testcase->reviewResultList as $key => $result)
{
$actionLink = $this->createLink('testcase', 'batchReview', "result=$key");
echo '<li>' . html::a('#', $result, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"") . '</li>';
}
echo '</ul></li>';
}
elseif($config->testcase->needReview)
{
echo '<li>' . html::a('javascript:;', $lang->testcase->review, '', $class) . '</li>';
}
$actionLink = $this->createLink('testcase', 'batchStoryChange', "productID=$productID");
$misc = common::hasPriv('testcase', 'batchStoryChange') ? "onclick=\"setFormAction('$actionLink')\"" : $class;
echo "<li>" . html::a('#', $lang->testcase->batchStoryChange, '', $misc) . "</li>";
+2 -1
View File
@@ -30,7 +30,7 @@
<th class='w-30px' title='<?php echo $lang->testcase->bugs?>'> <?php echo $lang->testcase->bugsAB;?></th>
<th class='w-30px' title='<?php echo $lang->testcase->results?>'> <?php echo $lang->testcase->resultsAB;?></th>
<th class='w-30px' title='<?php echo $lang->testcase->stepNumber?>'> <?php echo $lang->testcase->stepNumberAB;?></th>
<th class='w-150px {sorter:false}'><?php echo $lang->actions;?></th>
<th class='<?php echo $config->testcase->needReview ? 'w-170px' : 'w-150px'?> {sorter:false}'><?php echo $lang->actions;?></th>
<?php endif;?>
</tr>
</thead>
@@ -79,6 +79,7 @@
<?php
common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", '', 'list', 'play', '', 'runCase iframe', false, "data-width='95%'");
common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", '', 'list', 'list-alt', '', 'results iframe', false, "data-width='95%'");
if($config->testcase->needReview) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'list', 'review', '', 'iframe');
common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list');
common::printIcon('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase&param=$case->id", $case, 'list', 'copy');
+10 -9
View File
@@ -21,17 +21,18 @@
<?php foreach(customModel::getFeatureMenu('testcase', 'browse') as $menuItem):?>
<?php
if(isset($menuItem->hidden)) continue;
$menyType = $menuItem->name;
if($hasBrowsePriv and strpos($menyType, 'QUERY') === 0)
$menuType = $menuItem->name;
if(!$config->testcase->needReview and $menuType == 'wait') continue;
if($hasBrowsePriv and strpos($menuType, 'QUERY') === 0)
{
$queryID = (int)substr($menyType, 5);
echo "<li id='{$menyType}Tab'>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&branch=$branch&browseType=bySearch&param=$queryID"), $menuItem->text) . "</li>";
$queryID = (int)substr($menuType, 5);
echo "<li id='{$menuType}Tab'>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&branch=$branch&browseType=bySearch&param=$queryID"), $menuItem->text) . "</li>";
}
elseif($hasBrowsePriv and ($menyType == 'all' or $menyType == 'needconfirm'))
elseif($hasBrowsePriv and ($menuType == 'all' or $menuType == 'needconfirm' or $menuType == 'wait'))
{
echo "<li id='{$menyType}Tab'>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&branch=$branch&browseType=$menyType"), $menuItem->text) . "</li>";
echo "<li id='{$menuType}Tab'>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&branch=$branch&browseType=$menuType"), $menuItem->text) . "</li>";
}
elseif($hasBrowsePriv and $menyType == 'suite')
elseif($hasBrowsePriv and $menuType == 'suite')
{
echo "<li id='bysuiteTab' class='dropdown'>";
$currentSuiteID = isset($suiteID) ? (int)$suiteID : 0;
@@ -48,7 +49,7 @@
}
echo '</ul></li>';
}
elseif($hasGroupPriv and $menyType == 'group')
elseif($hasGroupPriv and $menuType == 'group')
{
echo "<li id='groupTab' class='dropdown'>";
$groupBy = isset($groupBy) ? $groupBy : '';
@@ -64,7 +65,7 @@
}
echo '</ul></li>';
}
elseif($hasZeroPriv and $menyType == 'zerocase')
elseif($hasZeroPriv and $menuType == 'zerocase')
{
echo "<li id='zerocaseTab'>" . html::a($this->createLink('story', 'zeroCase', "productID=$productID"), $lang->story->zeroCase) . '</li>';
}
+53
View File
@@ -0,0 +1,53 @@
<?php
/**
* The view file of review method of testcase module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yidong Wang <yidong@cnezsoft.com>
* @package testcase
* @version $Id: review.html.php 4129 2013-01-18 01:58:14Z wwccss $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.lite.html.php';?>
<?php include '../../common/view/chosen.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<div id='titlebar'>
<div class='heading'>
<span class='prefix'><?php echo html::icon($lang->icons['testcase']);?> <strong><?php echo $case->id;?></strong></span>
<strong><?php echo html::a($this->createLink('case', 'view', "caseID=$case->id"), $case->title);?></strong>
<small><?php echo html::icon($lang->icons['review']) . ' ' . $lang->testcase->review;?></small>
</div>
</div>
<form method='post' target='hiddenwin' class='form-condensed'>
<table class='table table-form'>
<tr>
<th class='w-80px'><?php echo $lang->testcase->reviewedDate;?></th>
<td class='w-p25-f'><?php echo html::input('reviewedDate', helper::today(), "class='form-control form-date'");?></td><td></td>
</tr>
<tr>
<th><?php echo $lang->testcase->reviewResult;?></th>
<td><?php echo html::select('result', $lang->testcase->reviewResultList, '', 'class=form-control');?></td><td></td>
</tr>
<tr>
<th><?php echo $lang->testcase->reviewedBy;?></th>
<td colspan='2'><?php echo html::select('reviewedBy[]', $users, $app->user->account, "class='form-control chosen' multiple");?></td>
</tr>
<tr>
<th><?php echo $lang->comment;?></th>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='8' class='form-control'");?></td>
</tr>
<tr>
<td></td>
<td colspan='2'>
<?php echo html::submitButton();?>
<?php echo html::linkButton($lang->goback, $app->session->caseList ? $app->session->caseList : inlink('view', "caseID=$case->id"));?>
</td>
</tr>
</table>
</form>
<hr class='small'>
<div class='main'><?php include '../../common/view/action.html.php';?></div>
<?php include '../../common/view/footer.lite.html.php';?>
+14 -4
View File
@@ -42,15 +42,15 @@
{
ob_start();
echo "<div class='btn-group'>";
if(!$isLibCase)
{
echo "<div class='btn-group'>";
common::printIcon('testtask', 'runCase', "runID=$runID&caseID=$case->id&version=$case->currentVersion", '', 'button', '', '', 'runCase', false, "data-width='95%'");
common::printIcon('testtask', 'results', "runID=$runID&caseID=$case->id&version=$case->version", '', 'button', '', '', 'results', false, "data-width='95%'");
if($case->lastRunResult == 'fail') common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=$runID", '', 'button', 'bug', '', 'iframe');
echo '</div>';
common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=$runID", $case, 'button', 'bug', '', 'iframe');
}
if($config->testcase->needReview) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'button', 'review', '', 'iframe');
echo '</div>';
echo "<div class='btn-group'>";
common::printIcon('testcase', 'edit',"caseID=$case->id");
@@ -277,6 +277,16 @@
<th class='w-60px'><?php echo $lang->testcase->openedBy;?></th>
<td><?php echo $users[$case->openedBy] . $lang->at . $case->openedDate;?></td>
</tr>
<?php if($config->testcase->needReview):?>
<tr>
<th><?php echo $lang->testcase->reviewedBy;?></th>
<td><?php $reviewedBy = explode(',', $case->reviewedBy); foreach($reviewedBy as $account) echo ' ' . $users[trim($account)]; ?></td>
</tr>
<tr>
<th><?php echo $lang->testcase->reviewedDate;?></th>
<td><?php if($case->reviewedBy) echo $case->reviewedDate;?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->testcase->lblLastEdited;?></th>
<td><?php if($case->lastEditedBy) echo $users[$case->lastEditedBy] . $lang->at . $case->lastEditedDate;?></td>
+5
View File
@@ -288,6 +288,11 @@ class testsuite extends control
$branches = array('' => '') + $this->loadModel('branch')->getPairs($suite->product, 'noempty');
$this->config->testcase->search['params']['branch']['values'] = $branches;
}
if(!$this->config->testcase->needReview)
{
unset($this->lang->testcase->statusList['wait']);
$this->config->testcase->search['params']['status']['values'] = $this->lang->testcase->statusList;
}
$this->loadModel('search')->setSearchParams($this->config->testcase->search);
$this->view->title = $suite->name . $this->lang->colon . $this->lang->testsuite->linkCase;
+7 -1
View File
@@ -363,12 +363,13 @@ class testsuiteModel extends model
$browseType = ($browseType == 'bymodule' and $this->session->libBrowseType and $this->session->libBrowseType != 'bysearch') ? $this->session->libBrowseType : $browseType;
$cases = array();
if($browseType == 'bymodule' or $browseType == 'all')
if($browseType == 'bymodule' or $browseType == 'all' or $browseType == 'wait')
{
$cases = $this->dao->select('*')->from(TABLE_CASE)
->where('lib')->eq((int)$libID)
->andWhere('product')->eq(0)
->beginIF($moduleIdList)->andWhere('module')->in($moduleIdList)->fi()
->beginIF($browseType == 'wait')->andWhere('status')->eq($browseType)->fi()
->andWhere('deleted')->eq('0')
->orderBy($sort)->page($pager)->fetchAll('id');
}
@@ -455,6 +456,11 @@ class testsuiteModel extends model
$this->config->testcase->search['params']['lib']['operator'] = '=';
$this->config->testcase->search['params']['lib']['control'] = 'select';
$this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($libID, $viewType = 'testlib');
if(!$this->config->testcase->needReview)
{
unset($this->lang->testcase->statusList['wait']);
$this->config->testcase->search['params']['status']['values'] = $this->lang->testcase->statusList;
}
unset($this->config->testcase->search['fields']['product']);
unset($this->config->testcase->search['params']['product']);
unset($this->config->testcase->search['fields']['branch']);
-1
View File
@@ -56,5 +56,4 @@
</tbody>
<tfoot><tr><td colspan='6'><?php $pager->show();?></td></tr></tfoot>
</table>
<script>$(function(){$('#<?php echo $type?>Tab').addClass('active')})</script>
<?php include '../../common/view/footer.html.php';?>
+22 -2
View File
@@ -16,7 +16,7 @@ include '../../common/view/datatable.fix.html.php';
js::set('browseType', $browseType);
js::set('moduleID', $moduleID);
js::set('confirmDelete', $lang->testsuite->confirmDelete);
js::set('batchDelete', $lang->testcase->confirmBatchDelete);
js::set('batchDelete', $lang->testcase->confirmBatchDelete);
?>
<div id='featurebar'>
<div class='heading'>
@@ -38,7 +38,8 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
</li>
<?php $hasCasesPriv = common::hasPriv('testsuite', 'library'); ?>
<?php
if($hasCasesPriv) echo "<li id='allTab'>" . html::a($this->inlink('library', "libID=$libID&browseType=all&param=0"), $lang->testcase->allCases) . "</li>";
if($hasCasesPriv) echo "<li id='allTab'>" . html::a($this->inlink('library', "libID=$libID&browseType=all"), $lang->testcase->allCases) . "</li>";
if($hasCasesPriv and $config->testcase->needReview) echo "<li id='waitTab'>" . html::a($this->inlink('library', "libID=$libID&browseType=wait"), $lang->testcase->statusList['wait']) . "</li>";
echo "<li id='bysearchTab'><a href='#'><i class='icon-search icon'></i>&nbsp;{$lang->testcase->bySearch}</a></li> ";
if(common::hasPriv('testsuite', 'libView')) echo '<li>' . html::a(inlink('libView', "libID=$libID"), $lang->testsuite->view) . '</li>';
?>
@@ -106,6 +107,7 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
</td>
<td>
<?php
if($config->testcase->needReview) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'list', 'review', '', 'iframe');
common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list');
if(common::hasPriv('testcase', 'delete'))
{
@@ -139,6 +141,24 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
$misc = common::hasPriv('testcase', 'batchDelete') ? "onclick=\"confirmBatchDelete('$actionLink')\"" : $class;
echo "<li>" . html::a('#', $lang->delete, '', $misc) . "</li>";
if(common::hasPriv('testcase', 'batchReview') and $config->testcase->needReview)
{
echo "<li class='dropdown-submenu'>";
echo html::a('javascript:;', $lang->testcase->review, '', "id='reviewItem'");
echo "<ul class='dropdown-menu'>";
unset($lang->testcase->reviewResultList['']);
foreach($lang->testcase->reviewResultList as $key => $result)
{
$actionLink = $this->createLink('testcase', 'batchReview', "result=$key");
echo '<li>' . html::a('#', $result, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"") . '</li>';
}
echo '</ul></li>';
}
elseif($config->testcase->needReview)
{
echo '<li>' . html::a('javascript:;', $lang->testcase->review, '', $class) . '</li>';
}
if(common::hasPriv('testcase', 'batchChangeModule'))
{
$withSearch = count($modules) > 8;
+12
View File
@@ -261,6 +261,11 @@ class testtask extends control
$this->config->testcase->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->testcase->allProduct);
$this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case');
$this->config->testcase->search['actionURL'] = inlink('cases', "taskID=$taskID&browseType=bySearch&queryID=myQueryID");
if(!$this->config->testcase->needReview)
{
unset($this->lang->testcase->statusList['wait']);
$this->config->testcase->search['params']['status']['values'] = $this->lang->testcase->statusList;
}
unset($this->config->testcase->search['fields']['branch']);
unset($this->config->testcase->search['params']['branch']);
$this->loadModel('search')->setSearchParams($this->config->testcase->search);
@@ -564,6 +569,11 @@ class testtask extends control
if($task->branch) $branches = array('' => '', $task->branch => $branches[$task->branch]);
$this->config->testcase->search['params']['branch']['values'] = $branches;
}
if(!$this->config->testcase->needReview)
{
unset($this->lang->testcase->statusList['wait']);
$this->config->testcase->search['params']['status']['values'] = $this->lang->testcase->statusList;
}
$this->loadModel('search')->setSearchParams($this->config->testcase->search);
$this->view->title = $task->name . $this->lang->colon . $this->lang->testtask->linkCase;
@@ -642,6 +652,8 @@ class testtask extends control
$this->view->taskID = $taskID;
$this->view->pager = $pager;
$this->view->task = $task;
$this->view->type = $type;
$this->view->param = $param;
$this->view->suiteList = $this->loadModel('testsuite')->getSuites($task->product);
$this->display();
+2 -1
View File
@@ -26,9 +26,10 @@
echo "<ul class='dropdown-menu' style='max-height:240px;overflow-y:auto'>";
foreach($suiteList as $suiteID => $suite)
{
$active = ($type == 'bysuite' and (int)$param == $suiteID) ? "class='active'" : '';
$suiteName = $suite->name;
if($suite->type == 'public') $suiteName .= " <span class='label label-info'>{$lang->testsuite->authorList[$suite->type]}</span>";
echo "<li>" . html::a(inlink('linkCase', "taskID=$taskID&type=bysuite&param=$suiteID"), $suiteName) . "</li>";
echo "<li $active>" . html::a(inlink('linkCase', "taskID=$taskID&type=bysuite&param=$suiteID"), $suiteName) . "</li>";
}
echo "</ul></span>";
$lang->testtask->linkCase = $lang->testtask->linkByStory;