* Finish task #58552.

This commit is contained in:
tianshujie
2022-06-27 17:22:49 +08:00
parent ff3052113a
commit 70b01098ac
3 changed files with 97 additions and 5 deletions
+30 -5
View File
@@ -325,7 +325,7 @@ class testtask extends control
}
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);
@@ -488,7 +488,7 @@ class testtask extends control
}
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);
@@ -619,7 +619,7 @@ class testtask extends control
}
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']);
@@ -683,7 +683,7 @@ class testtask extends control
}
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. */
@@ -1069,7 +1069,7 @@ class testtask extends control
}
else
{
$this->loadModel('qa')->setMenu($this->products, $productID, $task->branch, $taskID);
$this->testtask->setMenu($this->products, $productID, $task->branch, $taskID);
}
/* Load pager. */
@@ -1527,4 +1527,29 @@ 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
* @access public
* @return void
*/
public function ajaxGetDropMenu($productID, $branch, $taskID, $module, $method)
{
$testtasks = $this->testtask->getProductTasks($productID, $branch, 'id_desc', null, array('local', '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->testtasksPinyin = common::convert2Pinyin($namePairs);
$this->display();
}
}
+41
View File
@@ -2287,4 +2287,45 @@ 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='currentItem' 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);
}
}
@@ -0,0 +1,26 @@
<?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
*/
?>
<?php
$selectHtml = '';
foreach($testtasks as $testtaskID => $testtask)
{
$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}'");
}
?>
<div class="table-row">
<div class="table-col">
<div class='list-group'><?php echo $selectHtml;?></div>
</div>
</div>