Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
tengfei
2017-01-11 15:54:06 +08:00
28 changed files with 274 additions and 98 deletions
+2
View File
@@ -445,6 +445,8 @@ class bug extends control
if($bug->project and !$this->loadModel('project')->checkPriv($this->project->getByID($bug->project)))
{
echo(js::alert($this->lang->project->accessDenied));
$loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login";
if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index')));
die(js::locate('back'));
}
+20
View File
@@ -1230,6 +1230,26 @@ class bugModel extends model
->fetchAll('id');
}
/**
* Get case bugs.
*
* @param int $runID
* @param int $caseID
* @param int $version
* @access public
* @return void
*/
public function getCaseBugs($runID, $caseID = 0, $version = 0)
{
return $this->dao->select('*')->from(TABLE_BUG)
->where('1=1')
->beginIF($runID)->andWhere('`result`')->eq($runID)->fi()
->beginIF($runID == 0 and $caseID)->andWhere('`case`')->eq($caseID)->fi()
->beginIF($version)->andWhere('`caseVersion`')->eq($version)->fi()
->andWhere('deleted')->eq(0)
->fetchAll('id');
}
/**
* Get counts of some stories' bugs.
*
+1 -2
View File
@@ -934,7 +934,6 @@ class commonModel extends model
* Get the previous and next object.
*
* @param string $type story|task|bug|case
* @param string $objectIDs
* @param string $objectID
* @access public
* @return void
@@ -949,7 +948,7 @@ class commonModel extends model
$existObject = $type . 'PreAndNext';
if(isset($_SESSION[$existObject]) and $_SESSION[$existObject]['objectID'] == $objectID) return $_SESSION[$existObject]['preAndNextObject'];
/* Get objectIDs. */
/* Get objectIDList. */
$table = $this->config->objectTables[$type];
$queryCondition = $type . 'QueryCondition';
$typeOnlyCondition = $type . 'OnlyCondition';
+4 -8
View File
@@ -68,6 +68,7 @@ class datatableModel extends model
$set->width = $fieldList[$id]['width'];
$set->fixed = $fieldList[$id]['fixed'];
$set->title = $fieldList[$id]['title'];
$set->sort = isset($fieldList[$id]['sort']) ? $fieldList[$id]['sort'] : 'yes';
$setting[$key] = $set;
}
}
@@ -81,6 +82,7 @@ class datatableModel extends model
continue;
}
$set->title = $fieldList[$set->id]['title'];
$set->sort = isset($fieldList[$set->id]['sort']) ? $fieldList[$set->id]['sort'] : 'yes';
}
}
@@ -123,15 +125,9 @@ class datatableModel extends model
{
echo $this->lang->actions;
}
elseif($id == 'progess')
elseif(isset($col->sort) and $col->sort == 'no')
{
$this->app->loadLang('task');
echo $this->lang->task->progess;
}
elseif($id == 'taskCount' or $id == 'bugCount' or $id == 'caseCount')
{
$this->app->loadLang('story');
echo $this->lang->story->$id;
echo $col->title;
}
else
{
-5
View File
@@ -188,11 +188,6 @@ class my extends control
$sort = $this->loadModel('common')->appendOrder($orderBy);
$bugs = $this->loadModel('bug')->getUserBugs($this->app->user->account, $type, $sort, 0, $pager);
/* Save bugIDs session for get the pre and next bug. */
$bugIDs = '';
foreach($bugs as $bug) $bugIDs .= ',' . $bug->id;
$this->session->set('bugIDs', $bugIDs . ',');
/* assign. */
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->bug;
$this->view->position[] = $this->lang->my->bug;
+13 -1
View File
@@ -28,6 +28,8 @@ class productModel extends model
if($products and !isset($products[$productID]) and !$this->checkPriv($this->getById($productID)))
{
echo(js::alert($this->lang->product->accessDenied));
$loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login";
if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index')));
die(js::locate('back'));
}
@@ -95,7 +97,17 @@ class productModel extends model
if($productID > 0) $this->session->set('product', (int)$productID);
if($productID == 0 and $this->cookie->lastProduct) $this->session->set('product', (int)$this->cookie->lastProduct);
if($productID == 0 and $this->session->product == '') $this->session->set('product', key($products));
if(!isset($products[$this->session->product])) $this->session->set('product', key($products));
if(!isset($products[$this->session->product]))
{
$this->session->set('product', key($products));
if($productID > 0)
{
echo(js::alert($this->lang->product->accessDenied));
$loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login";
if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index')));
die(js::locate('back'));
}
}
if($this->cookie->preProductID != $productID)
{
$this->cookie->set('preBranch', 0);
-5
View File
@@ -557,11 +557,6 @@ class project extends control
$storyTasks = $this->task->getStoryTaskCounts(array_keys($stories), $projectID);
$users = $this->user->getPairs('noletter');
/* Save storyIDs session for get the pre and next story. */
$storyIDs = '';
foreach($stories as $story) $storyIDs .= ',' . $story->id;
$this->session->set('storyIDs', $storyIDs . ',');
/* Get project's product. */
$productID = 0;
$productPairs = $this->loadModel('product')->getProductsByProject($projectID);
+4
View File
@@ -86,6 +86,8 @@ class projectModel extends model
if($projects and !isset($projects[$projectID]) and !$this->checkPriv($project))
{
echo(js::alert($this->lang->project->accessDenied));
$loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login";
if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index')));
die(js::locate('back'));
}
@@ -204,6 +206,8 @@ class projectModel extends model
if($projectID > 0)
{
echo(js::alert($this->lang->project->accessDenied));
$loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login";
if(strpos($this->server->http_referer, $loginLink) !== false) die(js::locate(inlink('index')));
die(js::locate('back'));
}
}
+3
View File
@@ -93,16 +93,19 @@ $config->story->datatable->fieldList['taskCount']['title'] = 'taskCount';
$config->story->datatable->fieldList['taskCount']['fixed'] = 'no';
$config->story->datatable->fieldList['taskCount']['width'] = '90';
$config->story->datatable->fieldList['taskCount']['required'] = 'no';
$config->story->datatable->fieldList['taskCount']['sort'] = 'no';
$config->story->datatable->fieldList['bugCount']['title'] = 'bugCount';
$config->story->datatable->fieldList['bugCount']['fixed'] = 'no';
$config->story->datatable->fieldList['bugCount']['width'] = '90';
$config->story->datatable->fieldList['bugCount']['required'] = 'no';
$config->story->datatable->fieldList['bugCount']['sort'] = 'no';
$config->story->datatable->fieldList['caseCount']['title'] = 'caseCount';
$config->story->datatable->fieldList['caseCount']['fixed'] = 'no';
$config->story->datatable->fieldList['caseCount']['width'] = '90';
$config->story->datatable->fieldList['caseCount']['required'] = 'no';
$config->story->datatable->fieldList['caseCount']['sort'] = 'no';
$config->story->datatable->fieldList['openedBy']['title'] = 'openedByAB';
$config->story->datatable->fieldList['openedBy']['fixed'] = 'no';
+1
View File
@@ -93,6 +93,7 @@ $config->task->datatable->fieldList['progess']['title'] = 'progess';
$config->task->datatable->fieldList['progess']['fixed'] = 'no';
$config->task->datatable->fieldList['progess']['width'] = '40';
$config->task->datatable->fieldList['progess']['required'] = 'no';
$config->task->datatable->fieldList['progess']['sort'] = 'no';
$config->task->datatable->fieldList['deadline']['title'] = 'deadlineAB';
$config->task->datatable->fieldList['deadline']['fixed'] = 'no';
+15 -2
View File
@@ -16,7 +16,7 @@ $config->testcase->export = new stdclass();
$config->testcase->export->listFields = array('type', 'stage', 'pri', 'status');
$config->testcase->exportFields = '
id, product, module, story,
id, product, branch, module, story,
title, precondition, stepDesc, stepExpect, keywords,
pri, type, stage, status, lastRunResult, openedBy, openedDate,
lastEditedBy, lastEditedDate, version,linkCase';
@@ -66,7 +66,7 @@ $config->testcase->search['params']['openedDate'] = array('operator' => '=',
$config->testcase->search['params']['lastEditedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->testcase->datatable = new stdclass();
$config->testcase->datatable->defaultField = array('id', 'pri', 'title', 'type', 'openedBy', 'lastRunner', 'lastRunDate', 'lastRunResult', 'status', 'actions');
$config->testcase->datatable->defaultField = array('id', 'pri', 'title', 'type', 'openedBy', 'lastRunner', 'lastRunDate', 'lastRunResult', 'status', 'bugs', 'results', 'actions');
$config->testcase->datatable->fieldList['id']['title'] = 'idAB';
$config->testcase->datatable->fieldList['id']['fixed'] = 'left';
@@ -132,8 +132,21 @@ $config->testcase->datatable->fieldList['actions']['title'] = 'actions';
$config->testcase->datatable->fieldList['actions']['fixed'] = 'right';
$config->testcase->datatable->fieldList['actions']['width'] = '140';
$config->testcase->datatable->fieldList['actions']['required'] = 'yes';
$config->testcase->datatable->fieldList['actions']['sort'] = 'no';
$config->testcase->datatable->fieldList['branch']['title'] = 'branch';
$config->testcase->datatable->fieldList['branch']['fixed'] = 'left';
$config->testcase->datatable->fieldList['branch']['width'] = '100';
$config->testcase->datatable->fieldList['branch']['required'] = 'no';
$config->testcase->datatable->fieldList['bugs']['title'] = 'bugs';
$config->testcase->datatable->fieldList['bugs']['fixed'] = 'no';
$config->testcase->datatable->fieldList['bugs']['width'] = '80';
$config->testcase->datatable->fieldList['bugs']['required'] = 'no';
$config->testcase->datatable->fieldList['bugs']['sort'] = 'no';
$config->testcase->datatable->fieldList['results']['title'] = 'results';
$config->testcase->datatable->fieldList['results']['fixed'] = 'no';
$config->testcase->datatable->fieldList['results']['width'] = '80';
$config->testcase->datatable->fieldList['results']['required'] = 'no';
$config->testcase->datatable->fieldList['results']['sort'] = 'no';
+39 -14
View File
@@ -101,6 +101,7 @@ class testcase extends control
/* Process case for check story changed. */
$cases = $this->loadModel('story')->checkNeedConfirm($cases);
$cases = $this->testcase->appendBugAndResults($cases);
/* Build the search form. */
$actionURL = $this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID");
@@ -836,17 +837,22 @@ class testcase extends control
*/
public function export($productID, $orderBy, $taskID = 0)
{
$product = $this->loadModel('product')->getById($productID);
if($product->type != 'normal') $this->lang->testcase->branch = $this->lang->product->branchName[$product->type];
if($_POST)
{
$caseLang = $this->lang->testcase;
$caseConfig = $this->config->testcase;
/* Create field lists. */
$fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $caseConfig->exportFields);
$fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $caseConfig->exportFields);
foreach($fields as $key => $fieldName)
{
$fieldName = trim($fieldName);
$fields[$fieldName] = isset($caseLang->$fieldName) ? $caseLang->$fieldName : $fieldName;
if(!($product->type == 'normal' and $fieldName == 'branch'))
{
$fields[$fieldName] = isset($caseLang->$fieldName) ? $caseLang->$fieldName : $fieldName;
}
unset($fields[$key]);
}
@@ -884,6 +890,7 @@ class testcase extends control
/* Get users, products and projects. */
$users = $this->loadModel('user')->getPairs('noletter');
$products = $this->loadModel('product')->getPairs('nocode');
$branches = $this->loadModel('branch')->getPairs($productID);
/* Get related objects id lists. */
$relatedModuleIdList = array();
@@ -938,6 +945,7 @@ class testcase extends control
/* fill some field with useful value. */
if(isset($products[$case->product])) $case->product = $products[$case->product] . "(#$case->product)";
if(isset($branches[$case->branch])) $case->branch = $branches[$case->branch] . "(#$case->branch)";
if(isset($relatedModules[$case->module])) $case->module = $relatedModules[$case->module] . "(#$case->module)";
if(isset($relatedStories[$case->story])) $case->story = $relatedStories[$case->story] . "(#$case->story)";
@@ -990,6 +998,9 @@ class testcase extends control
{
if($_POST)
{
$product = $this->loadModel('product')->getById($productID);
if($product->type != 'normal') $fields['branch'] = $this->lang->product->branchName[$product->type];
$fields['module'] = $this->lang->testcase->module;
$fields['title'] = $this->lang->testcase->title;
$fields['stepDesc'] = $this->lang->testcase->stepDesc;
@@ -1005,6 +1016,10 @@ class testcase extends control
$fields['typeValue'] = $this->lang->testcase->lblTypeValue;
$fields['stageValue'] = $this->lang->testcase->lblStageValue;
$fields['statusValue'] = $this->lang->testcase->lblStatusValue;
if($product->type != 'normal') $fields['branchValue'] = $this->lang->product->branchName[$product->type];
$branches = $this->loadModel('branch')->getPairs($productID);
foreach($branches as $branchID => $branchName) $branches[$branchID] = $branchName . "(#$branchID)";
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case');
$rows = array();
@@ -1020,6 +1035,7 @@ class testcase extends control
$row->typeValue = join("\n", $this->lang->testcase->typeList);
$row->stageValue = join("\n", $this->lang->testcase->stageList);
$row->statusValue = join("\n", $this->lang->testcase->statusList);
if($product->type != 'normal') $row->branchValue = join("\n", $branches);
}
$rows[] = $row;
}
@@ -1053,7 +1069,7 @@ class testcase extends control
$fileName = $this->file->savePath . $file['pathname'];
$rows = $this->file->parseCSV($fileName);
$fields = $this->testcase->getImportFields();
$fields = $this->testcase->getImportFields($productID);
$fields = array_flip($fields);
$header = array();
foreach($rows[0] as $i => $rowValue)
@@ -1123,7 +1139,7 @@ class testcase extends control
$caseConfig = $this->config->testcase;
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, $branch);
$stories = $this->loadModel('story')->getProductStoryPairs($productID, $branch);
$fields = $this->testcase->getImportFields();
$fields = $this->testcase->getImportFields($productID);
$fields = array_flip($fields);
$rows = $this->loadModel('file')->parseCSV($file);
@@ -1151,16 +1167,7 @@ class testcase extends control
{
if(!isset($data[$key])) continue;
$cellValue = $data[$key];
if($field == 'story')
{
$case->$field = 0;
if(strrpos($cellValue, '(#') !== false)
{
$id = trim(substr($cellValue, strrpos($cellValue,'(#') + 2), ')');
$case->$field = $id;
}
}
elseif($field == 'module')
if($field == 'story' or $field == 'module' or $field == 'branch')
{
$case->$field = 0;
if(strrpos($cellValue, '(#') !== false)
@@ -1248,8 +1255,26 @@ class testcase extends control
$this->view->caseData = $caseData;
$this->view->stepData = $stepData;
$this->view->productID = $productID;
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->view->branch = $branch;
$this->view->product = $this->products[$productID];
$this->display();
}
/**
* Case bugs.
*
* @param int $runID
* @param int $caseID
* @param int $version
* @access public
* @return void
*/
public function bugs($runID, $caseID = 0, $version = 0)
{
$this->view->title = $this->lang->testcase->bugs;
$this->view->bugs = $this->loadModel('bug')->getCaseBugs($runID, $caseID, $version);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
}
+3
View File
@@ -12,3 +12,6 @@
.dropdown-list > li > a:focus {color: #1a4f85;text-decoration: none;background-color: #ddd;}
.pl-5px{padding-left:5px;}
tbody > tr > td > .btn-icon {margin-right: 3px;}
tbody > tr > td .icon-bug {margin-left: -8px;}
+3
View File
@@ -0,0 +1,3 @@
body{background:white}
.bugsList {padding:10px;}
.bugsList .table{border: 1px solid #ddd;}
+1 -1
View File
@@ -134,7 +134,7 @@ $lang->testcase->statusList['normal'] = 'Normal';
$lang->testcase->statusList['blocked'] = 'Blocked';
$lang->testcase->statusList['investigate'] = 'Investigating';
$lang->testcase->resultList['n/a'] = 'N/A';
$lang->testcase->resultList['n/a'] = 'Ignore';
$lang->testcase->resultList['pass'] = 'Pass';
$lang->testcase->resultList['fail'] = 'Fail';
$lang->testcase->resultList['blocked'] = 'Blocked';
+4 -1
View File
@@ -44,6 +44,9 @@ $lang->testcase->allProduct = "所有{$lang->productCommon}";
$lang->testcase->fromBug = '来源Bug';
$lang->testcase->toBug = '生成Bug';
$lang->testcase->changed = '用例变更';
$lang->testcase->bugs = '产生Bug数';
$lang->testcase->bugsAB = 'B';
$lang->testcase->results = '执行数';
$lang->testcase->createBug = '转Bug';
$lang->case = $lang->testcase; // 用于DAO检查时使用。因为case是系统关键字,所以无法定义该模块为case,只能使用testcase,但表还是使用的case。
@@ -134,7 +137,7 @@ $lang->testcase->statusList['normal'] = '正常';
$lang->testcase->statusList['blocked'] = '被阻塞';
$lang->testcase->statusList['investigate'] = '研究中';
$lang->testcase->resultList['n/a'] = 'N/A';
$lang->testcase->resultList['n/a'] = '忽略';
$lang->testcase->resultList['pass'] = '通过';
$lang->testcase->resultList['fail'] = '失败';
$lang->testcase->resultList['blocked'] = '阻塞';
+43 -2
View File
@@ -797,6 +797,7 @@ class testcaseModel extends model
$caseData = new stdclass();
$caseData->product = $product;
$caseData->branch = isset($data->branch[$key]) ? $data->branch[$key] : $branch;
$caseData->module = $data->module[$key];
$caseData->story = (int)$data->story[$key];
$caseData->title = $data->title[$key];
@@ -901,7 +902,7 @@ class testcaseModel extends model
$caseData->version = 1;
$caseData->openedBy = $this->app->user->account;
$caseData->openedDate = $now;
$caseData->branch = $branch;
$caseData->branch = isset($data->branch[$key]) ? $data->branch[$key] : $branch;
$this->dao->insert(TABLE_CASE)->data($caseData)->autoCheck()->exec();
if(!dao::isError())
@@ -933,8 +934,11 @@ class testcaseModel extends model
* @access public
* @return array
*/
public function getImportFields()
public function getImportFields($productID = 0)
{
$product = $this->loadModel('product')->getById($productID);
if($product->type != 'normal') $this->lang->testcase->branch = $this->lang->product->branchName[$product->type];
$caseLang = $this->lang->testcase;
$caseConfig = $this->config->testcase;
$fields = explode(',', $caseConfig->exportFields);
@@ -1048,6 +1052,12 @@ class testcaseModel extends model
case 'lastRunResult':
if($case->lastRunResult) echo $this->lang->testcase->resultList[$case->lastRunResult];
break;
case 'bugs':
echo (common::hasPriv('testcase', 'bugs') and $case->bugs) ? html::a(helper::createLink('testcase', 'bugs', "runID=0&caseID={$case->id}"), $case->bugs, '', "class='iframe'") : $case->bugs;
break;
case 'results':
echo (common::hasPriv('testtask', 'results') and $case->results) ? html::a(helper::createLink('testtask', 'results', "runID=0&caseID={$case->id}"), $case->results, '', "class='iframe'") : $case->results;
break;
case 'actions':
common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", '', 'list', 'play', '', 'runCase iframe');
common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", '', 'list', '', '', 'results iframe');
@@ -1066,4 +1076,35 @@ class testcaseModel extends model
echo '</td>';
}
}
/**
* Append bugs and results.
*
* @param array $cases
* @access public
* @return array
*/
public function appendBugAndResults($cases, $type = 'case')
{
$caseIdList = array_keys($cases);
if($type == 'case')
{
$caseBugs = $this->dao->select('count(*) as count, `case`')->from(TABLE_BUG)->where('`case`')->in($caseIdList)->andWhere('deleted')->eq(0)->groupBy('`case`')->fetchPairs('case', 'count');
$results = $this->dao->select('count(*) as count, `case`')->from(TABLE_TESTRESULT)->where('`case`')->in($caseIdList)->groupBy('`case`')->fetchPairs('case', 'count');
}
else
{
$caseBugs = $this->dao->select('count(*) as count, `case`')->from(TABLE_BUG)->where('`result`')->in($caseIdList)->andWhere('deleted')->eq(0)->groupBy('`case`')->fetchPairs('case', 'count');
$results = $this->dao->select('count(*) as count, `case`')->from(TABLE_TESTRESULT)->where('`run`')->in($caseIdList)->groupBy('`run`')->fetchPairs('case', 'count');
}
foreach($cases as $case)
{
$caseID = $type == 'case' ? $case->id : $case->case;
$case->bugs = isset($caseBugs[$caseID]) ? $caseBugs[$caseID] : 0;
$case->results = isset($results[$caseID]) ? $results[$caseID] : 0;
}
return $cases;
}
}
+1 -1
View File
@@ -47,7 +47,7 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
?>
<tfoot>
<tr>
<?php $mergeColums = $browseType == 'needconfirm' ? 5 : 10;?>
<?php $mergeColums = $browseType == 'needconfirm' ? 5 : 12;?>
<td colspan='<?php echo $mergeColums?>'>
<?php if($cases):?>
<div class='table-actions clearfix'>
+16 -11
View File
@@ -10,22 +10,25 @@
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/tablesorter.html.php';?>
<table class='table table-condensed table-hover table-striped tablesorter table-fixed table-selectable' id='caseList'>
<thead>
<tr>
<th class='w-id'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class='w-pri'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th> <?php common::printOrderLink('title', $orderBy, $vars, $lang->testcase->title);?></th>
<th class='w-id {sorter:false}'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class='w-pri {sorter:false}'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th class='{sorter:false}'> <?php common::printOrderLink('title', $orderBy, $vars, $lang->testcase->title);?></th>
<?php if($browseType == 'needconfirm'):?>
<th> <?php common::printOrderLink('story', $orderBy, $vars, $lang->testcase->story);?></th>
<th class='w-50px'><?php echo $lang->actions;?></th>
<th class='{sorter:false}'> <?php common::printOrderLink('story', $orderBy, $vars, $lang->testcase->story);?></th>
<th class='w-50px {sorter:false}'> <?php echo $lang->actions;?></th>
<?php else:?>
<th class='w-type'> <?php common::printOrderLink('type', $orderBy, $vars, $lang->typeAB);?></th>
<th class='w-user'> <?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
<th class='w-80px'> <?php common::printOrderLink('lastRunner', $orderBy, $vars, $lang->testtask->lastRunAccount);?></th>
<th class='w-120px'> <?php common::printOrderLink('lastRunDate', $orderBy, $vars, $lang->testtask->lastRunTime);?></th>
<th class='w-80px'> <?php common::printOrderLink('lastRunResult', $orderBy, $vars, $lang->testtask->lastRunResult);?></th>
<th class='w-100px'> <?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th class='w-type {sorter:false}'> <?php common::printOrderLink('type', $orderBy, $vars, $lang->typeAB);?></th>
<th class='w-user {sorter:false}'> <?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
<th class='w-80px {sorter:false}'> <?php common::printOrderLink('lastRunner', $orderBy, $vars, $lang->testtask->lastRunAccount);?></th>
<th class='w-120px {sorter:false}'> <?php common::printOrderLink('lastRunDate', $orderBy, $vars, $lang->testtask->lastRunTime);?></th>
<th class='w-80px {sorter:false}'> <?php common::printOrderLink('lastRunResult', $orderBy, $vars, $lang->testtask->lastRunResult);?></th>
<th class='w-100px {sorter:false}'> <?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th class='w-30px' title='<?php echo $lang->testcase->bugs?>'> <?php echo $lang->testcase->bugsAB;?></th>
<th class='w-60px'> <?php echo $lang->testcase->results?></th>
<th class='w-150px {sorter:false}'><?php echo $lang->actions;?></th>
<?php endif;?>
</tr>
@@ -68,6 +71,8 @@
}
?>
</td>
<td><?php echo (common::hasPriv('testcase', 'bugs') and $case->bugs) ? html::a(inlink('bugs', "runID=0&caseID={$case->id}"), $case->bugs, '', "class='iframe'") : $case->bugs?></td>
<td><?php echo (common::hasPriv('testtask', 'results') and $case->results) ? html::a($this->createLink('testtask', 'results', "runID=0&caseID={$case->id}"), $case->results, '', "class='iframe'") : $case->results?></td>
<td class='text-right'>
<?php
common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", '', 'list', 'play', '', 'runCase iframe');
+40
View File
@@ -0,0 +1,40 @@
<?php include '../../common/view/header.lite.html.php';?>
<div id='titlebar'>
<div class='heading'>
<span><?php echo html::icon($lang->icons['report']);?></span>
<small class='text-muted'> <?php echo $lang->testcase->bugs;?></small>
</div>
</div>
<div class='bugsList'>
<form class='form-condensed' target='hiddenwin'>
<table class='table table-fixed'>
<thead>
<tr class='text-center'>
<th class='w-20px'> <?php echo $lang->idAB;?></th>
<th class='w-p30'> <?php echo $lang->bug->title;?></th>
<th class='w-pri'> <?php echo $lang->priAB;?></th>
<th class='w-type'> <?php echo $lang->bug->type;?></th>
<th class='w-40px'><?php echo $lang->statusAB;?></th>
<th class='w-user'> <?php echo $lang->bug->assignedTo;?></th>
<th class='w-50px'> <?php echo $lang->bug->resolvedBy;?></th>
<th class='w-50px'> <?php echo $lang->bug->resolution;?></th>
</tr>
</thead>
<tbody>
<?php foreach($bugs as $key => $bug):?>
<tr class='text-center'>
<td><?php echo $bug->id;?></td>
<td class='text-left' title="<?php echo $bug->title?>"><?php echo $bug->title;?></td>
<td><span class='<?php echo 'pri' . zget($lang->bug->priList, $bug->pri, $bug->pri)?>'><?php echo $bug->pri == '0' ? '' : zget($lang->bug->priList, $bug->pri, $bug->pri);?></span></td>
<td><?php echo $lang->bug->typeList[$bug->type];?></td>
<td><?php echo $lang->bug->statusList[$bug->status];?></td>
<td><?php echo zget($users, $bug->assignedTo, $bug->assignedTo);?></td>
<td><?php echo zget($users, $bug->resolvedBy, $bug->resolvedBy);?></td>
<td><?php echo $lang->bug->resolutionList[$bug->resolution];?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</form>
</div>
<?php include '../../common/view/footer.lite.html.php';?>
+14 -8
View File
@@ -6,10 +6,13 @@
<table class='table table-fixed active-disabled table-custom'>
<thead>
<tr>
<th class='w-80px'><?php echo $lang->testcase->id?></th>
<th class='w-70px'><?php echo $lang->testcase->id?></th>
<th><?php echo $lang->testcase->title?></th>
<th class='w-90px'><?php echo $lang->testcase->module?></th>
<th class='w-100px'><?php echo $lang->testcase->story?></th>
<?php if($branches):?>
<th class='w-100px'><?php echo $lang->testcase->branch?></th>
<?php endif;?>
<th class='w-100px'><?php echo $lang->testcase->module?></th>
<th class='w-120px'><?php echo $lang->testcase->story?></th>
<th class='w-70px'><?php echo $lang->testcase->pri?></th>
<th class='w-100px'><?php echo $lang->testcase->type?></th>
<th class='w-100px'><?php echo $lang->testcase->status?></th>
@@ -46,11 +49,14 @@
?>
</td>
<td><?php echo html::input("title[$key]", $case->title, "class='form-control' style='margin-top:2px' autocomplete='off'")?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("module[$key]", $modules, !empty($case->module) ? $case->module : (!empty($case->id) ? $cases[$case->id]->module : ''), "class='form-control chosen'")?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("story[$key]", $stories, !empty($case->story) ? $case->story : (!empty($case->id) ? $cases[$case->id]->story : ''), "class='form-control chosen'")?></td>
<td><?php echo html::select("pri[$key]", $lang->testcase->priList, !empty($case->pri) ? $case->pri : (!empty($case->id) ? $cases[$case->id]->pri : ''), "class='form-control'")?></td>
<td><?php echo html::select("type[$key]", $lang->testcase->typeList, !empty($case->type) ? $case->type : (!empty($case->id) ? $cases[$case->id]->type : ''), "class='form-control'")?></td>
<td><?php echo html::select("status[$key]", $lang->testcase->statusList, !empty($case->status) ? $case->status : (!empty($case->id) ? $cases[$case->id]->status : 'normal'), "class='form-control'")?></td>
<?php if($branches):?>
<td class='text-left' style='overflow:visible'><?php echo html::select("branch[$key]", $branches, (isset($case->branch) and $case->branch !== '') ? $case->branch : (!empty($case->id) ? $cases[$case->id]->branch : $branch), "class='form-control chosen'")?></td>
<?php endif;?>
<td class='text-left' style='overflow:visible'><?php echo html::select("module[$key]", $modules, isset($case->module) ? $case->module : (!empty($case->id) ? $cases[$case->id]->module : ''), "class='form-control chosen'")?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("story[$key]", $stories, isset($case->story) ? $case->story : (!empty($case->id) ? $cases[$case->id]->story : ''), "class='form-control chosen'")?></td>
<td><?php echo html::select("pri[$key]", $lang->testcase->priList, isset($case->pri) ? $case->pri : (!empty($case->id) ? $cases[$case->id]->pri : ''), "class='form-control'")?></td>
<td><?php echo html::select("type[$key]", $lang->testcase->typeList, isset($case->type) ? $case->type : (!empty($case->id) ? $cases[$case->id]->type : ''), "class='form-control'")?></td>
<td><?php echo html::select("status[$key]", $lang->testcase->statusList, isset($case->status) ? $case->status : (!empty($case->id) ? $cases[$case->id]->status : 'normal'), "class='form-control'")?></td>
<td class='text-left' style='overflow:visible'><?php echo html::select("stage[$key][]", $lang->testcase->stageList, !empty($case->stage) ? $case->stage : (!empty($case->id) ? $cases[$case->id]->stage : ''), "multiple='multiple' class='form-control chosen'")?></td>
<td><?php echo html::input("keywords[$key]", isset($case->keywords) ? $case->keywords : "", "class='form-control' autocomplete='off'")?></td>
<td><?php echo html::textarea("precondition[$key]", isset($case->precondition) ? htmlspecialchars($case->precondition) : "", "class='form-control'")?></td>
+1 -1
View File
@@ -239,7 +239,7 @@
<?php endif;?>
<?php if($case->toBugs):?>
<tr>
<th valign="top"><?php echo $lang->testcase->toBug;?></th>
<th class='w-60px' valign="top"><?php echo $lang->testcase->toBug;?></th>
<td>
<?php
foreach($case->toBugs as $bugID => $bugTitle)
+1 -1
View File
@@ -13,4 +13,4 @@ $config->testtask->editor->start = array('id' => 'comment', 'tools' => 'simpleT
$config->testtask->editor->close = array('id' => 'report,comment', 'tools' => 'simpleTools');
$config->testtask->datatable = new stdclass();
$config->testtask->datatable->defaultField = array('id', 'pri', 'title', 'type', 'assignedTo', 'lastRunner', 'lastRunDate', 'lastRunResult', 'status', 'actions');
$config->testtask->datatable->defaultField = array('id', 'pri', 'title', 'type', 'assignedTo', 'lastRunner', 'lastRunDate', 'lastRunResult', 'status', 'bugs', 'results', 'actions');
+16 -17
View File
@@ -252,14 +252,9 @@ class testtask extends control
$sort = $this->loadModel('common')->appendOrder($orderBy, 't2.id');
/* Get test cases. */
$this->view->runs = $this->testtask->getTaskCases($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task);
$runs = $this->testtask->getTaskCases($productID, $browseType, $queryID, $moduleID, $sort, $pager, $task);
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false);
/* Save testcaseIDs session for get the pre and next testcase. */
$testcaseIDs = '';
foreach($this->view->runs as $run) $testcaseIDs .= ',' . $run->case;
$this->session->set('testcaseIDs', $testcaseIDs . ',');
/* Build the search form. */
$this->loadModel('testcase');
$this->config->testcase->search['module'] = 'testtask';
@@ -270,6 +265,9 @@ class testtask extends control
unset($this->config->testcase->search['params']['branch']);
$this->loadModel('search')->setSearchParams($this->config->testcase->search);
/* Append bugs and results. */
$runs = $this->testcase->appendBugAndResults($runs, 'run');
$this->view->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->common;
@@ -278,6 +276,7 @@ class testtask extends control
$this->view->productID = $productID;
$this->view->productName = $this->products[$productID];
$this->view->task = $task;
$this->view->runs = $runs;
$this->view->users = $this->loadModel('user')->getPairs('noclosed,qafirst');
$this->view->assignedTos = $this->loadModel('user')->getPairs('noclosed,nodeleted,qafirst');
$this->view->moduleTree = $this->loadModel('tree')->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createTestTaskLink'), $extra = $taskID);
@@ -686,14 +685,14 @@ class testtask extends control
*/
public function runCase($runID, $caseID = 0, $version = 0)
{
if($caseID)
if($runID)
{
$run = new stdclass();
$run->case = $this->loadModel('testcase')->getById($caseID, $version);
$run = $this->testtask->getRunById($runID);
}
else
{
$run = $this->testtask->getRunById($runID);
$run = new stdclass();
$run->case = $this->loadModel('testcase')->getById($caseID, $version);
}
$caseID = $caseID ? $caseID : $run->case->id;
@@ -737,10 +736,10 @@ class testtask extends control
$this->view->run = $run;
$this->view->preCase = $preCase;
$this->view->nextCase = $nextCase;
$this->view->results = $this->testtask->getResults($runID, $caseID);
$this->view->users = $this->loadModel('user')->getPairs('noclosed, noletter');
$this->view->caseID = $caseID;
$this->view->version = $version;
$this->view->runID = $runID;
die($this->display());
}
@@ -806,12 +805,7 @@ class testtask extends control
*/
public function results($runID, $caseID = 0, $version = 0)
{
if($caseID)
{
$case = $this->loadModel('testcase')->getByID($caseID, $version);
$results = $this->testtask->getResults(0, $caseID);
}
else
if($runID)
{
$case = $this->testtask->getRunById($runID)->case;
$results = $this->testtask->getResults($runID);
@@ -820,6 +814,11 @@ class testtask extends control
$testtask = $this->dao->select('build, product')->from(TABLE_TESTTASK)->where('id')->eq($testtaskID)->fetch();
$this->view->build = isset($builds[$testtask->build]) ? $builds[$testtask->build] : '';
}
else
{
$case = $this->loadModel('testcase')->getByID($caseID, $version);
$results = $this->testtask->getResults(0, $caseID);
}
$this->view->case = $case;
$this->view->results = $results;
+13 -7
View File
@@ -285,7 +285,7 @@ class testtaskModel extends model
->beginIF($moduleID)->andWhere('t2.module')->in($moduleID)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll();
->fetchAll('id');
}
/**
@@ -309,7 +309,7 @@ class testtaskModel extends model
->beginIF($modules)->andWhere('t2.module')->in($modules)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll();
->fetchAll('id');
}
/**
@@ -374,7 +374,7 @@ class testtaskModel extends model
->beginIF($task->branch)->andWhere('t2.branch')->in("0,{$task->branch}")->fi()
->orderBy(strpos($sort, 'assignedTo') !== false ? ('t1.' . $sort) : ('t2.' . $sort))
->page($pager)
->fetchAll();
->fetchAll('id');
}
return $runs;
}
@@ -573,13 +573,13 @@ class testtaskModel extends model
*/
public function getResults($runID, $caseID = 0)
{
if($caseID > 0)
{
$results = $this->dao->select('*')->from(TABLE_TESTRESULT)->where('`case`')->eq($caseID)->orderBy('id desc')->fetchAll('id');
if($runID > 0)
{
$results = $this->dao->select('*')->from(TABLE_TESTRESULT)->where('run')->eq($runID)->orderBy('id desc')->fetchAll('id');
}
else
{
$results = $this->dao->select('*')->from(TABLE_TESTRESULT)->where('run')->eq($runID)->orderBy('id desc')->fetchAll('id');
$results = $this->dao->select('*')->from(TABLE_TESTRESULT)->where('`case`')->eq($caseID)->orderBy('id desc')->fetchAll('id');
}
if(!$results) return array();
@@ -721,6 +721,12 @@ class testtaskModel extends model
$assignedTo = zget($users, $run->assignedTo, $run->assignedTo);
echo substr($assignedTo, strpos($assignedTo, ':') + 1);
break;
case 'bugs':
echo $run->bugs;
break;
case 'results':
echo $run->results;
break;
case 'actions':
common::printIcon('testtask', 'runCase', "id=$run->id", '', 'list', '', '', 'runCase iframe');
common::printIcon('testtask', 'results', "id=$run->id", '', 'list', '', '', 'iframe');
+1 -1
View File
@@ -47,7 +47,7 @@ var moduleID = '<?php echo $moduleID;?>';
?>
<tfoot>
<tr>
<td colspan='10'>
<td colspan='12'>
<?php if($runs):?>
<div class='table-actions clearfix'>
<?php if($hasCheckbox) echo html::selectButton();?>
+14 -9
View File
@@ -10,19 +10,22 @@
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/tablesorter.html.php';?>
<?php $vars = "taskID=$task->id&browseType=$browseType&param=$param&orderBy=%s&recToal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<table class='table table-condensed table-hover table-striped tablesorter table-fixed table-selectable' id='caseList'>
<thead>
<tr class='colhead'>
<th class='w-id'><nobr><?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></nobr></th>
<th class='w-pri'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th> <?php common::printOrderLink('title', $orderBy, $vars, $lang->testcase->title);?></th>
<th class='w-type'> <?php common::printOrderLink('type', $orderBy, $vars, $lang->testcase->type);?></th>
<th class='w-user'> <?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->testtask->assignedTo);?></th>
<th class='w-user'> <?php common::printOrderLink('lastRunner', $orderBy, $vars, $lang->testtask->lastRunAccount);?></th>
<th class='w-100px'> <?php common::printOrderLink('lastRunDate', $orderBy, $vars, $lang->testtask->lastRunTime);?></th>
<th class='w-80px'> <?php common::printOrderLink('lastRunResult', $orderBy, $vars, $lang->testtask->lastRunResult);?></th>
<th class='w-status'> <?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th class='w-id {sorter: false}'><nobr><?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></nobr></th>
<th class='w-pri {sorter: false}'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th class='{sorter: false}'> <?php common::printOrderLink('title', $orderBy, $vars, $lang->testcase->title);?></th>
<th class='w-type {sorter: false}'> <?php common::printOrderLink('type', $orderBy, $vars, $lang->testcase->type);?></th>
<th class='w-user {sorter: false}'> <?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->testtask->assignedTo);?></th>
<th class='w-user {sorter: false}'> <?php common::printOrderLink('lastRunner', $orderBy, $vars, $lang->testtask->lastRunAccount);?></th>
<th class='w-100px {sorter: false}'> <?php common::printOrderLink('lastRunDate', $orderBy, $vars, $lang->testtask->lastRunTime);?></th>
<th class='w-80px {sorter: false}'> <?php common::printOrderLink('lastRunResult', $orderBy, $vars, $lang->testtask->lastRunResult);?></th>
<th class='w-status {sorter: false}'> <?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th class='w-30px' title='<?php echo $lang->testcase->bugs?>'> <?php echo $lang->testcase->bugsAB;?></th>
<th class='w-60px'> <?php echo $lang->testcase->results?></th>
<th class='w-120px {sorter: false}'><?php echo $lang->actions;?></th>
</tr>
</thead>
@@ -52,6 +55,8 @@
<td><?php if(!helper::isZeroDate($run->lastRunDate)) echo date(DT_MONTHTIME1, strtotime($run->lastRunDate));?></td>
<td class='<?php echo $run->lastRunResult;?>'><?php if($run->lastRunResult) echo $lang->testcase->resultList[$run->lastRunResult];?></td>
<td class='<?php echo $run->status;?>'><?php echo ($run->version < $run->caseVersion) ? "<span class='warning'>{$lang->testcase->changed}</span>" : $lang->testtask->statusList[$run->status];?></td>
<td><?php echo (common::hasPriv('testcase', 'bugs') and $run->bugs) ? html::a($this->createLink('testcase', 'bugs', "runID={$run->id}&caseID={$run->case}"), $run->bugs, '', "class='iframe'") : $run->bugs?></td>
<td><?php echo (common::hasPriv('testtask', 'results') and $run->results) ? html::a($this->createLink('testtask', 'results', "runID={$run->id}&caseID={$run->case}"), $run->results, '', "class='iframe'") : $run->results?></td>
<td class='text-center'>
<?php
common::printIcon('testtask', 'runCase', "id=$run->id", '', 'list', '', '', 'runCase iframe');
+1 -1
View File
@@ -129,7 +129,7 @@
<script>
$(function()
{
$('#resultsContainer').load("<?php echo $this->createLink('testtask', 'results', "runID=0&caseID=$caseID&version=$version");?> #casesResults", function()
$('#resultsContainer').load("<?php echo $this->createLink('testtask', 'results', "runID={$runID}&caseID=$caseID&version=$version");?> #casesResults", function()
{
$('.result-item').click(function()
{