* Adjust testreport module.

This commit is contained in:
leiyong
2021-03-29 18:25:15 +08:00
parent 905868cc2d
commit cf6f149d6a
9 changed files with 26 additions and 23 deletions
+1
View File
@@ -1038,6 +1038,7 @@ class execution extends control
public function testtask($executionID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->loadModel('testtask');
$this->app->loadLang('testreport');
/* Save session. */
$this->session->set('testtaskList', $this->app->getURI(true), 'execution');
+8 -9
View File
@@ -39,7 +39,7 @@
<p>
<span class="text-muted"><?php echo $lang->testtask->noTesttask;?></span>
<?php if(common::canModify('execution', $execution) and common::hasPriv('testtask', 'create')):?>
<?php echo html::a($this->createLink('testtask', 'create', "product=0&execution=$executionID"), "<i class='icon icon-plus'></i> " . $lang->testtask->create, '', "class='btn btn-info'");?>
<?php echo html::a($this->createLink('testtask', 'create', "product=0&execution=$executionID"), "<i class='icon icon-plus'></i> " . $lang->testtask->create, '', "class='btn btn-info' data-app='execution'");?>
<?php endif;?>
</p>
</div>
@@ -99,15 +99,14 @@
<?php
if($canBeChanged)
{
common::printIcon('testtask', 'cases', "taskID=$task->id", $task, 'list', 'sitemap');
common::printIcon('testtask', 'linkCase', "taskID=$task->id", $task, 'list', 'link');
common::printIcon('testreport', 'browse', "objectID=$task->execution&objectType=execution&extra=$task->id", $task, 'list','flag');
common::printIcon('testtask', 'edit', "taskID=$task->id", $task, 'list');
if(common::hasPriv('testtask', 'delete', $task))
common::printIcon('testtask', 'cases', "taskID=$task->id", $task, 'list', 'sitemap');
common::printIcon('testtask', 'linkCase', "taskID=$task->id", $task, 'list', 'link');
if(common::hasPriv('execution', 'testreport'))
{
$deleteURL = $this->createLink('testtask', 'delete', "taskID=$task->id&confirm=yes");
echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"taskList\", confirmDelete)", '<i class="icon-trash"></i>', '', "class='btn' title='{$lang->testtask->delete}'");
echo html::a($this->createLink('testreport', 'browse', "objectID=$task->product&objectType=product&extra=$task->id"), '<i class="icon-testreport-browse icon-flag"></i>', '', 'class="btn " title="' . $lang->testreport->browse . '" data-app="qa"');
}
common::printIcon('testtask', 'edit', "taskID=$task->id", $task, 'list');
common::printIcon('testtask', 'delete', "taskID=$task->id", $task, 'list', 'trash', 'hiddenwin');
}
?>
</td>
@@ -131,7 +130,7 @@
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<div class="table-actions btn-toolbar">
<?php
$actionLink = $this->createLink('testreport', 'browse', "objectID=$executionID&objctType=execution");
$actionLink = $this->createLink('execution', 'testreport', "objectID=$executionID&objctType=execution");
$misc = common::hasPriv('testreport', 'browse') ? "onclick=\"setFormAction('$actionLink', '', '#testtaskForm')\"" : "disabled='disabled'";
echo html::commonButton($lang->testreport->common, $misc);
?>
+3 -3
View File
@@ -240,9 +240,9 @@ class testreport extends control
$executionID = $this->commonAction($objectID, $objectType);
if($executionID != $objectID) die(js::error($this->lang->error->accessDenied) . js::locate('back'));
$execution = $this->execution->getById($executionID);
$tasks = $this->testtask->getExecutionTasks($executionID);
$owners = array();
$execution = $this->execution->getById($executionID);
$tasks = $this->testtask->getExecutionTasks($executionID);
$owners = array();
$buildIdList = array();
$productIdList = array();
foreach($tasks as $i => $task)
-1
View File
@@ -1,6 +1,5 @@
$(function()
{
if(objectType == 'project' $('#subNavbar ul li[data-id=qa]').addClass('active');
$('#mainContent .main-header h2 #selectTask').change(function()
{
var taskID = $(this).val();
+4 -4
View File
@@ -147,10 +147,10 @@ class testreportModel extends model
{
$objectID = (int)$objectID;
return $this->dao->select('*')->from(TABLE_TESTREPORT)->where('deleted')->eq(0)
->beginIF(!empty($extra))->andWhere('objectID')->eq($extra)->fi()
->beginIF($objectType == 'product')->andWhere('product')->eq($objectID)->fi()
->beginIF($objectType == 'project')->andWhere('project')->eq($objectID)->fi()
->beginIF($objectType == 'execution')->andWhere('execution')->eq($objectID)->fi()
->beginIF($objectType == 'execution')->andWhere('objectID')->eq($objectID)->andWhere('objectType')->eq('execution')->fi()
->beginIF($objectType == 'project')->andWhere('objectID')->eq($objectID)->andWhere('objectType')->eq('project')->fi()
->beginIF($objectType == 'product' and $extra)->andWhere('objectID')->eq((int)$extra)->andWhere('objectType')->eq('testtask')->fi()
->beginIF($objectType == 'product' and empty($extra))->andWhere('product')->eq($objectID)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
+3 -2
View File
@@ -47,8 +47,9 @@
<tbody class='text-center'>
<?php foreach($reports as $report):?>
<tr>
<td><?php echo html::a(helper::createLink('testreport', 'view', "reportID=$report->id"), sprintf('%03d', $report->id));?></td>
<td class='text-left' title='<?php $report->title?>'><?php echo html::a(inlink('view', "reportID=$report->id"), $report->title)?></td>
<?php $viewLink = helper::createLink('testreport', 'view', "reportID=$report->id");?>
<td><?php echo html::a($viewLink, sprintf('%03d', $report->id), '', "data-app='{$this->app->openApp}'");?></td>
<td class='text-left' title='<?php $report->title?>'><?php echo html::a($viewLink, $report->title, '', "data-app='{$this->app->openApp}'")?></td>
<td><?php echo zget($users, $report->createdBy);?></td>
<td><?php echo substr($report->createdDate, 2);?></td>
<?php $executionName = $report->execution ? '#' . $report->execution . $executions[$report->execution] : '';?>
+2 -2
View File
@@ -15,8 +15,8 @@
<?php include '../../common/view/chart.html.php';?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<?php $browseLink = $this->session->reportList ? $app->session->reportList : $browseLink;?>
<?php if(!isonlybody()):?>
<?php $browseLink = $this->session->reportList != false ? $app->session->reportList : $browseLink;?>
<?php echo html::a($browseLink, "<i class='icon icon-back icon-sm'></i>" . $lang->goback, '', "class='btn btn-primary'");?>
<div class='divider'></div>
<?php endif;?>
@@ -116,7 +116,7 @@
<?php
if(common::canBeChanged('report', $report))
{
if(common::hasPriv('testreport', 'create')) echo html::a(inLink('create', "objectID=$report->objectID&objectType=$report->objectType&extra=$report->id"), "<i class='icon-refresh'></i>", '', "class='btn' title='{$lang->testreport->recreate}'");
if(common::hasPriv('testreport', 'create')) echo html::a(inLink('create', "objectID=$report->objectID&objectType=$report->objectType&extra=$report->id"), "<i class='icon-refresh'></i>", '', "class='btn' title='{$lang->testreport->recreate}' data-app='{$this->app->openApp}'");
common::printIcon('testreport', 'edit', "reportID=$report->id", '', 'button');
common::printIcon('testreport', 'delete', "reportID=$report->id", '', 'button', 'trash', 'hiddenwin');
}
+5 -1
View File
@@ -884,7 +884,11 @@ class testtask extends control
}
$this->send($response);
}
die(js::locate(inlink('browse', "product=$task->product"), 'parent'));
$browseList = $this->createLink('testtask', 'browse', "productID=$task->product");
if($this->app->openApp == 'execution') $browseList = $this->createLink('execution', 'testtask', "executionID=$task->execution");
if($this->app->openApp == 'project') $browseList = $this->createLink('project', 'testtask', "projectID=$task->project");
die(js::locate($browseList, 'parent'));
}
}
-1
View File
@@ -72,7 +72,6 @@ class testtaskModel extends model
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.execution = t5.project and t1.product = t5.product')
->where('t1.deleted')->eq(0)
->beginIF($this->config->systemMode == 'new' and $this->app->openApp != 'qa')->andWhere('t1.project')->eq($this->session->project)->fi()
->andWhere('t1.auto')->ne('unit')
->beginIF(!$this->app->user->admin)->andWhere('t3.id')->in("0,{$this->app->user->view->sprints}")->fi()
->beginIF($scopeAndStatus[0] == 'local')->andWhere('t1.product')->eq((int)$productID)->fi()