* Add ajax get drop menu of bug method.

This commit is contained in:
holan20180123
2021-03-12 14:25:30 +08:00
parent 9ff48bdb53
commit 39bc711931
7 changed files with 86 additions and 29 deletions
+32
View File
@@ -1768,4 +1768,36 @@ class bug extends control
die(json_encode(array('modules' => $modules, 'categories' => $type, 'versions' => $builds, 'severities' => $severity, 'priorities' => $pri)));
}
/**
* Drop menu page.
*
* @param int $productID
* @param string $module
* @param string $method
* @param string $extra
* @access public
* @return void
*/
public function ajaxGetDropMenu($productID, $module, $method, $extra = '', $from = '')
{
if($from == 'qa')
{
$this->app->loadConfig('qa');
foreach($this->config->qa->menuList as $menu) $this->lang->navGroup->$menu = 'qa';
}
$products = $this->product->getProducts($this->session->PRJ, $this->config->CRProduct ? 'all' : 'noclosed', 'program desc, line desc, ');
$this->view->link = $this->product->getProductLink($module, $method, $extra);
$this->view->productID = $productID;
$this->view->module = $module;
$this->view->method = $method;
$this->view->extra = $extra;
$this->view->products = $products;
$this->view->projectID = $this->session->PRJ;
$this->view->programs = $this->loadModel('program')->getPairs(true);
$this->view->lines = $this->product->getLinePairs();
$this->display();
}
}
+1
View File
@@ -28,6 +28,7 @@ class bugModel extends model
public function setMenu($products, $productID, $branch = 0, $moduleID = 0, $browseType = 'unclosed', $orderBy = '')
{
$this->loadModel('product')->setMenu($products, $productID, $branch, $moduleID, 'bug');
if($this->lang->navGroup->testcase == 'project' and $this->app->methodName == 'browse') $products = array(0 => $this->lang->bug->allProduct) + $products;
$selectHtml = $this->product->select($products, $productID, 'bug', 'browse', '', $branch, $moduleID, 'bug');
$pageNav = '';
+37
View File
@@ -0,0 +1,37 @@
<?php js::set('productID', $productID);?>
<?php js::set('module', $module);?>
<?php js::set('method', $method);?>
<?php js::set('extra', $extra);?>
<?php
$iCharges = 0;
$others = 0;
$closeds = 0;
$productNames = array();
foreach($products as $product)
{
if($product->status == 'normal' and $product->PO == $this->app->user->account) $iCharges++;
if($product->status == 'normal' and !($product->PO == $this->app->user->account)) $others++;
if($product->status == 'closed') $closeds++;
$productNames[] = $product->name;
}
$productsPinYin = common::convert2Pinyin($productNames);
$linkHtml = $this->product->setParamsForLink($module, $link, $projectID, 0);
$productsHtml = html::a($linkHtml, $this->lang->bug->allProduct, '', "class='text-important' title='{$this->lang->bug->allProduct}' data-key='" . zget($productsPinYin, $this->lang->bug->allProduct, '') . "' data-group='project'");
foreach($products as $product)
{
$productName = $product->program ? zget($programs, $product->program, '') . '/' : '';
$productName .= $product->line ? zget($lines, $product->line, '') . '/' . $product->name : $product->name;
$objectID = ($product->type != 'platform' && $module == 'branch' && $method == 'manage') ? $productID : $product->id;
$linkHtml = $this->product->setParamsForLink($module, $link, $projectID, $product->id);
$productsHtml .= html::a($linkHtml, $productName, '', "class='text-important' title='{$productName}' data-key='" . zget($productsPinYin, $product->name, '') . "' data-group='project'");
}
?>
<div class="table-row">
<div class="table-col col-left">
<div class='list-group'>
<?php echo $productsHtml; ?>
</div>
</div>
</div>
-26
View File
@@ -23,7 +23,6 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow
?>
<?php if($config->global->flow == 'full'):?>
<div id="mainMenu" class="clearfix">
<?php if(!$isProjectBug):?>
<div id="sidebarHeader">
<div class="title">
<?php
@@ -36,32 +35,7 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow
?>
</div>
</div>
<?php endif;?>
<div class="btn-toolbar pull-left">
<?php if($isProjectBug):?>
<div class='btn-group'>
<a href='javascript:;' class='btn btn-link btn-limit text-ellipsis' data-toggle='dropdown' style="max-width: 120px;"><span class='text' title='<?php echo $productName;?>'><?php echo $productName;?></span> <span class='caret'></span></a>
<ul class='dropdown-menu' style='max-height:240px; max-width: 300px; overflow-y:auto'>
<?php
echo "<li>" . html::a($this->createLink('bug', 'browse', "productID=0"), $lang->product->all) . "</li>";
foreach($projectProducts as $product)
{
echo "<li>" . html::a($this->createLink('bug', 'browse', "productID=$product->id&branch=0"), $product->name, '', "title='{$product->name}' class='text-ellipsis'") . "</li>";
}
?>
</ul>
</div>
<div class="btn-group">
<a href="javascript:;" class="btn btn-link" style="padding-right: 0;"> <?php echo $moduleName;?> </a>
<?php
if($moduleID)
{
$removeLink = $browseType == 'bymodule' ? $this->createLink($this->app->rawModule, $this->app->rawMethod, "productID=$productID&branch=$branch&browseType=$browseType&param=0&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("bugModule")';
echo html::a($removeLink, "<i class='icon icon-sm icon-close'></i>", '', "class='text-muted btn btn-link' style='padding-left: 0;'");
}
?>
</div>
<?php endif;?>
<?php
$menus = customModel::getFeatureMenu($this->moduleName, $this->methodName);
foreach($menus as $menuItem)