Merge branch 'sprint/208_tianshujie_58552' into 'master'

Sprint/208 tianshujie 58552

See merge request easycorp/zentaopms!4187
This commit is contained in:
王怡栋
2022-06-28 06:30:45 +00:00
8 changed files with 168 additions and 14 deletions
+47 -5
View File
@@ -318,14 +318,16 @@ class testtask extends control
if($this->app->tab == 'project')
{
$this->loadModel('project')->setMenu($task->project);
$this->lang->modulePageNav = $this->testtask->select($productID, $taskID, 'project', $task->project);
}
elseif($this->app->tab == 'execution')
{
$this->loadModel('execution')->setMenu($task->execution);
$this->lang->modulePageNav = $this->testtask->select($productID, $taskID, 'execution', $task->execution);
}
elseif($this->app->tab == 'qa')
{
$this->loadModel('qa')->setMenu($this->products, $productID, $task->branch, $taskID);
$this->testtask->setMenu($this->products, $productID, $task->branch, $taskID);
}
$this->executeHooks($taskID);
@@ -481,14 +483,16 @@ class testtask extends control
if($this->app->tab == 'project')
{
$this->loadModel('project')->setMenu($task->project);
$this->lang->modulePageNav = $this->testtask->select($productID, $taskID, 'project', $task->project);
}
elseif($this->app->tab == 'execution')
{
$this->loadModel('execution')->setMenu($task->execution);
$this->lang->modulePageNav = $this->testtask->select($productID, $taskID, 'execution', $task->execution);
}
else
{
$this->loadModel('qa')->setMenu($this->products, $productID, $task->branch, $taskID);
$this->testtask->setMenu($this->products, $productID, $task->branch, $taskID);
}
setcookie('preTaskID', $taskID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
@@ -612,14 +616,16 @@ class testtask extends control
if($this->app->tab == 'project')
{
$this->loadModel('project')->setMenu($task->project);
$this->lang->modulePageNav = $this->testtask->select($productID, $taskID, 'project', $task->project);
}
elseif($this->app->tab == 'execution')
{
$this->loadModel('execution')->setMenu($task->execution);
$this->lang->modulePageNav = $this->testtask->select($productID, $taskID, 'execution', $task->execution);
}
else
{
$this->loadModel('qa')->setMenu($this->products, $productID, $branchID, $taskID);
$this->testtask->setMenu($this->products, $productID, $branchID, $taskID);
}
unset($this->lang->testtask->report->charts['bugStageGroups']);
unset($this->lang->testtask->report->charts['bugHandleGroups']);
@@ -676,14 +682,16 @@ class testtask extends control
if($this->app->tab == 'project')
{
$this->loadModel('project')->setMenu($this->session->project);
$this->lang->modulePageNav = $this->testtask->select($productID, $taskID, 'project', $task->project);
}
elseif($this->app->tab == 'execution')
{
$this->loadModel('execution')->setMenu($task->execution);
$this->lang->modulePageNav = $this->testtask->select($productID, $taskID, 'execution', $task->execution);
}
else
{
$this->loadModel('qa')->setMenu($this->products, $productID, $task->branch, $taskID);
$this->testtask->setMenu($this->products, $productID, $task->branch, $taskID);
}
/* Determines whether an object is editable. */
@@ -1062,14 +1070,16 @@ class testtask extends control
if($this->app->tab == 'project')
{
$this->loadModel('project')->setMenu($task->project);
$this->lang->modulePageNav = $this->testtask->select($productID, $taskID, 'project', $task->project);
}
elseif($this->app->tab == 'execution')
{
$this->loadModel('execution')->setMenu($task->execution);
$this->lang->modulePageNav = $this->testtask->select($productID, $taskID, 'execution', $task->execution);
}
else
{
$this->loadModel('qa')->setMenu($this->products, $productID, $task->branch, $taskID);
$this->testtask->setMenu($this->products, $productID, $task->branch, $taskID);
}
/* Load pager. */
@@ -1527,4 +1537,36 @@ class testtask extends control
$pairs = $this->loadModel('testreport')->getPairs($productID);
return print(html::select('testreport', array('') + $pairs, '', "class='form-control chosen'"));
}
/**
* Drop menu page.
*
* @param int $productID
* @param int $branch
* @param int $taskID
* @param string $module
* @param string $method
* @param string $objectType
* @param int $objectID
* @access public
* @return void
*/
public function ajaxGetDropMenu($productID, $branch, $taskID, $module, $method, $objectType = '', $objectID = 0)
{
$status = empty($objectType) ? 'local' : 'totalStatus';
$testtasks = $this->testtask->getProductTasks($productID, $branch, 'id_desc', null, array($status, 'totalStatus'));
$namePairs = array_column($testtasks, 'name');
$this->view->currentTaskID = $taskID;
$this->view->testtasks = $testtasks;
$this->view->module = $module;
$this->view->method = $method;
$this->view->productID = $productID;
$this->view->branch = $branch;
$this->view->objectType = $objectType;
$this->view->objectID = $objectID;
$this->view->testtasksPinyin = common::convert2Pinyin($namePairs);
$this->display();
}
}
+69
View File
@@ -2287,4 +2287,73 @@ class testtaskModel extends model
}
return $menu;
}
/**
* Set menu.
*
* @param array $products
* @param int $productID
* @param int|string $branch
* @param int $taskID
* @access public
* @return void
*/
public function setMenu($products, $productID, $branch = '', $taskID = 0)
{
if(!$this->app->user->admin and strpos(",{$this->app->user->view->products},", ",$productID,") === false and $productID != 0 and !defined('TUTORIAL'))
{
$this->app->loadLang('product');
return print(js::error($this->lang->product->accessDenied) . js::locate('back'));
}
$branch = ($this->cookie->preBranch !== '' and $branch === '') ? $this->cookie->preBranch : $branch;
setcookie('preBranch', $branch, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
$product = $this->loadModel('product')->getById($productID);
if($product and $product->type != 'normal') $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
$selectHtml = $this->product->getSwitcher($productID, $taskID, $branch);
if($taskID and $this->app->viewType != 'mhtml')
{
$testtask = $this->getById($taskID);
$module = $this->app->rawModule;
$method = $this->app->rawMethod;
$dropMenuLink = helper::createLink('testtask', 'ajaxGetDropMenu', "productID=$productID&branch=$branch&taskID=$taskID&module=$module&method=$method");
$selectHtml .= "<div class='btn-group header-btn' id='swapper'><button data-toggle='dropdown' type='button' class='btn' id='currentTesttask' title='{$testtask->name}'><span class='text'>{$testtask->name}</span> <span class='caret' style='margin-bottom: -1px'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
$selectHtml .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
$selectHtml .= "</div></div>";
}
$this->lang->switcherMenu = $selectHtml;
common::setMenuVars('qa', $productID);
}
/**
* Create the select code of testtasks.
*
* @param int $productID
* @param int $testtaskID
* @param string $objectType execution|project
* @param int $objectID
* @access public
* @return string
*/
public function select($productID, $testtaskID, $objectType = '', $objectID = 0)
{
$output = '';
$currentModule = $this->app->rawModule;
$currentMethod = $this->app->rawMethod;
if($testtaskID and $this->app->viewType != 'mhtml')
{
$dropMenuLink = helper::createLink('testtask', 'ajaxGetDropMenu', "productID=$productID&branch=&taskID=$testtaskID&module=$currentModule&method=$currentMethod&objectType=$objectType&objectID=$objectID");
$testtask = $this->getById($testtaskID);
$output .= "<div class='btn-group angle-btn'><div class='btn-group'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentTesttask' title='{$testtask->name}'><span class='text'>{$testtask->name}</span> <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>';
$output .= "</div></div>";
}
$output .= '</div>';
return $output;
}
}
@@ -0,0 +1,43 @@
<?php
/**
* The ajaxgetdropmenu file of testtask module of ZenTaoPMS.
*
* @copyright Copyright 2009-2022 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Shujie Tian<tianshujie@easycorp.ltd>
* @package testtask
* @version $Id: ajaxgetdropmenu.html.php 935 2022-06-27 16:44:24Z $
* @link https://www.zentao.net
*/
?>
<style>
#currentTesttask + #dropMenu {max-width: 250px;}
#currentTesttask + #dropMenu > .list-group {overflow-x: hidden;}
#currentTesttask + #dropMenu .table-row > .table-col > .list-group {max-width: 248px;}
</style>
<?php
$selectHtml = '';
foreach($testtasks as $testtaskID => $testtask)
{
if($objectType == 'project' and $testtask->project != $objectID) continue;
if($objectType == 'execution' and $testtask->execution != $objectID) continue;
$selected = (string)$testtaskID == $currentTaskID ? 'selected' : '';
$param = $method == 'report' ? "productID=$productID&taskID=$testtaskID&browseType=all&branch=$branch" : "taskID=$testtaskID";
$selectHtml .= html::a($this->createLink($module, $method, $param), $testtask->name, '', "class='$selected' data-key='{$testtasksPinyin[$testtask->name]}' data-app='{$this->app->tab}' title='{$testtask->name}'");
}
?>
<div class="table-row">
<div class="table-col">
<div class='list-group'><?php echo $selectHtml;?></div>
</div>
</div>
<script>
$(function()
{
$('#currentTesttask + #dropMenu .list-group .table-row .table-col a').mouseout(function()
{
$(this).removeClass('active');
})
})
</script>