* 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
+3
View File
@@ -337,3 +337,6 @@ INSERT INTO `zt_lang` (`lang`, `module`, `section`, `key`, `value`, `system`) VA
('zh-cn', 'custom', 'URSRList', '3', '{\"SRName\":\"\\u8f6f\\u9700\",\"URName\":\"\\u7528\\u9700\"}', '1'),
('zh-cn', 'custom', 'URSRList', '4', '{\"SRName\":\"\\u6545\\u4e8b\",\"URName\":\"\\u53f2\\u8bd7\"}', '1'),
('zh-cn', 'custom', 'URSRList', '5', '{\"SRName\":\"\\u9700\\u6c42\",\"URName\":\"\\u7528\\u6237\\u9700\\u6c42\"}', '1');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRProduct', '1');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRExecution', '1');
+2
View File
@@ -4147,3 +4147,5 @@ INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'custom', '', 'URSR', '6');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'project', '', 'unitList', 'CNY,USD');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'project', '', 'defaultCurrency', 'CNY');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRProduct', '1');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRExecution', '1');
+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)
+11 -3
View File
@@ -102,8 +102,10 @@ class productModel extends model
*/
public function select($products, $productID, $currentModule, $currentMethod, $extra = '', $branch = 0, $module = 0, $moduleType = '')
{
$isProjectBug = isset($products[0]) ? true : false;
$this->app->loadLang('product');
if(!$productID)
if(!$isProjectBug and !$productID)
{
unset($this->lang->product->setMenu->branch);
return;
@@ -111,13 +113,19 @@ class productModel extends model
$isMobile = $this->app->viewType == 'mhtml';
setCookie("lastProduct", $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true);
$currentProduct = $this->getById($productID);
if($productID) $currentProduct = $this->getById($productID);
if($isProjectBug and !$productID)
{
$currentProduct = new stdclass();
$currentProduct->name = $products[$productID];
$currentProduct->type = 'normal';
}
$this->session->set('currentProductType', $currentProduct->type);
$output = '';
if(!empty($products))
{
$dropMenuLink = helper::createLink('product', 'ajaxGetDropMenu', "objectID=$productID&module=$currentModule&method=$currentMethod&extra=$extra");
$dropMenuLink = helper::createLink($isProjectBug ? 'bug' : 'product', 'ajaxGetDropMenu', "objectID=$productID&module=$currentModule&method=$currentMethod&extra=$extra");
$output = "<div class='btn-group angle-btn'><div class='btn-group'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='{$currentProduct->name}'><span class='text'>{$currentProduct->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>";