* finish task #4164.

This commit is contained in:
wangyidong
2018-05-25 14:40:49 +08:00
parent 9065c7885b
commit 23973cbdb6
12 changed files with 130 additions and 147 deletions
+1 -7
View File
@@ -1,7 +1,6 @@
$(function()
{
if(browseType == 'bysearch') ajaxGetSearchForm();
if($('#bugList thead th.w-title').width() < 150) $('#bugList thead th.w-title').width(150);
if($('#bugList thead th.c-title').width() < 150) $('#bugList thead th.c-title').width(150);
if(flow == 'onlyTest')
{
@@ -38,8 +37,3 @@ $(function()
})
}
});
function setQueryBar(queryID, title)
{
$('#bysearchTab').before("<li id='QUERY" + queryID + "Tab' class='active'><a href='" + createLink('bug', 'browse', "productID=" + productID + "&branch=" + branch + "&browseType=bysearch&param=" + queryID) + "'>" + title + "</a></li>");
}
+34 -17
View File
@@ -101,14 +101,13 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow
}
foreach($menus as $menuItem)
{
if(isset($menuItem->hidden)) continue;
if(isset($menuItem->hidden) and $menuItem->name != 'QUERY') continue;
if($this->config->global->flow == 'onlyTest' and $menuItem->name == 'needconfirm') continue;
$menuBrowseType = strpos($menuItem->name, 'QUERY') === 0 ? 'bySearch' : $menuItem->name;
$barParam = strpos($menuItem->name, 'QUERY') === 0 ? (int)substr($menuItem->name, 5) : 0;
$label = "<span class='text'>{$menuItem->text}</span>";
$label .= $menuBrowseType == $browseType ? "<span class='label label-light label-badge'>{$pager->recTotal}</span>" : '';
$active = $menuBrowseType == $browseType ? 'btn-active-text' : '';
$label = "<span class='text'>{$menuItem->text}</span>";
$label .= $menuBrowseType == $browseType ? "<span class='label label-light label-badge'>{$pager->recTotal}</span>" : '';
$active = $menuBrowseType == $browseType ? 'btn-active-text' : '';
if($menuItem->name == 'my')
{
@@ -118,10 +117,35 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow
foreach($lang->bug->mySelects as $key => $value)
{
echo '<li' . ($key == $currentBrowseType ? " class='active'" : '') . '>';
echo html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=$key&param=$barParam"), $value);
echo html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=$key"), $value);
}
echo '</ul></li>';
}
elseif($menuItem->name == 'QUERY')
{
if(isset($lang->custom->queryList))
{
echo '<div class="btn-group" id="query">';
$active = '';
$current = $menuItem->text;
$dropdownHtml = "<ul class='dropdown-menu'>";
foreach($lang->custom->queryList as $queryID => $queryTitle)
{
if($browseType == 'bysearch' and $queryID == $param)
{
$active = 'btn-active-text';
$current = "<span class='text'>{$queryTitle}</span> <span class='label label-light label-badge'>{$pager->recTotal}</span>";
}
$dropdownHtml .= '<li' . ($param == $queryID ? " class='active'" : '') . '>';
$dropdownHtml .= html::a($this->inlink('browse', "productID=$productID&branch=$branch&browseType=bySearch&param=$queryID"), $queryTitle);
}
$dropdownHtml .= '</ul>';
echo html::a('javascript:;', $current . " <span class='caret'></span>", '', "data-toggle='dropdown' class='btn btn-link $active'");
echo $dropdownHtml;
echo '</div>';
}
}
else
{
if(strpos(',unconfirmed,assigntonull,longlifebugs,postponedbugs,overduebugs,needconfirm,', $menuItem->name) !== false)
@@ -131,12 +155,12 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow
echo "<div class='btn-group'><a href='javascript:;' data-toggle='dropdown' class='btn btn-link {$moreLabelActive}'>{$moreLabel} <span class='caret'></span></a>";
echo "<ul class='dropdown-menu'>";
}
echo '<li>' . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=$menuBrowseType&param=$barParam"), "<span class='text'>{$menuItem->text}</span>", '', "class='btn btn-link $active'") . '</li>';
echo '<li>' . html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=$menuBrowseType"), "<span class='text'>{$menuItem->text}</span>", '', "class='btn btn-link $active'") . '</li>';
if($menuItem->name == 'needconfirm') echo '</ul></div>';
}
else
{
echo html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=$menuBrowseType&param=$barParam"), $label, '', "class='btn btn-link $active'");
echo html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=$menuBrowseType"), $label, '', "class='btn btn-link $active'");
}
}
}
@@ -387,16 +411,9 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow
</div>
</div>
<script>
$('#' + bugBrowseType + 'Tab').addClass('active');
$('#module' + moduleID).addClass('active');
$('#module' + moduleID).closest('li').addClass('active');
<?php if($browseType == 'bysearch'):?>
$shortcut = $('#QUERY<?php echo (int)$param;?>Tab');
if($shortcut.size() > 0)
{
$shortcut.addClass('active');
$('#bysearchTab').removeClass('active');
$('#querybox').removeClass('show');
}
if($('#query li.active').size() == 0) ajaxGetSearchForm();
<?php endif;?>
<?php $this->app->loadConfig('qa', '', false);?>
<?php if(isset($config->qa->homepage) and $config->qa->homepage != 'browse' and $config->global->flow == 'full'):?>
+5 -4
View File
@@ -341,11 +341,12 @@ class customModel extends model
global $lang, $app, $dbh;
if(!isset($lang->$module->featureBar[$method])) return;
$queryModule = $module == 'project' ? 'task' : ($module == 'product' ? 'story' : $module);
$shortcuts = $dbh->query('select id, title from ' . TABLE_USERQUERY . " where `account` = '{$app->user->account}' AND `module` = '{$queryModule}' order by id")->fetchAll();
foreach($shortcuts as $shortcut)
$shortcuts = $dbh->query('select id, title from ' . TABLE_USERQUERY . " where `account` = '{$app->user->account}' AND `module` = '{$queryModule}' AND `shortcut` = '1' order by id")->fetchAll();
if($shortcuts)
{
$shortcutID = 'QUERY' . $shortcut->id;
$lang->$module->featureBar[$method][$shortcutID] = $shortcut->title;
$lang->$module->featureBar[$method]['QUERY'] = $lang->custom->common;
foreach($shortcuts as $shortcut) $lang->custom->queryList[$shortcut->id] = $shortcut->title;
}
}
+1 -6
View File
@@ -3,10 +3,5 @@ $(function()
$('.popoverStage').mouseover(function(){$(this).popover('show')});
$('.popoverStage').mouseout(function(){$(this).popover('hide')});
if($('#storyList thead th.w-title').width() < 150) $('#storyList thead th.w-title').width(150);
if($('#storyList thead th.c-title').width() < 150) $('#storyList thead th.c-title').width(150);
});
function setQueryBar(queryID, title)
{
$('#bysearchTab').before("<a id='QUERY" + queryID + "Tab' class='btn btn-link btn-active-text' href='" + createLink('product', 'browse', "productID=" + productID + "&branch=" + branch + "&browseType=bysearch&param=" + queryID) + "'><span class='text'>" + title + "</span></a>");
}
+29 -15
View File
@@ -30,9 +30,8 @@
</div>
<div class="btn-toolbar pull-left">
<?php foreach(customModel::getFeatureMenu($this->moduleName, $this->methodName) as $menuItem):?>
<?php if(isset($menuItem->hidden)) continue;?>
<?php if(isset($menuItem->hidden) and $menuItem->name != 'QUERY') continue;?>
<?php $menuBrowseType = strpos($menuItem->name, 'QUERY') === 0 ? 'bySearch' : $menuItem->name;?>
<?php $queryParam = strpos($menuItem->name, 'QUERY') === 0 ? '&param=' . (int)substr($menuItem->name, 5) : '';?>
<?php if($menuItem->name == 'more'):?>
<?php
echo '<div class="btn-group">';
@@ -49,12 +48,36 @@
foreach($lang->product->moreSelects as $key => $value)
{
echo '<li' . ($key == $this->session->storyBrowseType ? " class='active'" : '') . '>';
echo html::a($this->inlink('browse', "productID=$productID&branch=$branch&browseType=$key" . $queryParam), $value);
echo html::a($this->inlink('browse', "productID=$productID&branch=$branch&browseType=$key"), $value);
}
echo '</ul></div>';
?>
<?php elseif($menuItem->name == 'QUERY'):?>
<?php if(isset($lang->custom->queryList)):?>
<?php
echo '<div class="btn-group" id="query">';
$active = '';
$current = $menuItem->text;
$dropdownHtml = "<ul class='dropdown-menu'>";
foreach($lang->custom->queryList as $queryID => $queryTitle)
{
if($this->session->storyBrowseType == 'bysearch' and $queryID == $param)
{
$active = 'btn-active-text';
$current = "<span class='text'>{$queryTitle}</span> <span class='label label-light label-badge'>{$pager->recTotal}</span>";
}
$dropdownHtml .= '<li' . ($param == $queryID ? " class='active'" : '') . '>';
$dropdownHtml .= html::a($this->inlink('browse', "productID=$productID&branch=$branch&browseType=$menuBrowseType&param=$queryID"), $queryTitle);
}
$dropdownHtml .= '</ul>';
echo html::a('javascript:;', $current . " <span class='caret'></span>", '', "data-toggle='dropdown' class='btn btn-link $active'");
echo $dropdownHtml;
echo '</div>';
?>
<?php endif;?>
<?php else:?>
<?php echo html::a($this->inlink('browse', "productID=$productID&branch=$branch&browseType=$menuBrowseType" . $queryParam), "<span class='text'>$menuItem->text</span>" . ($menuItem->name == $this->session->storyBrowseType ? ' <span class="label label-light label-badge">' . $pager->recTotal . '</span>' : ''), '', "id='{$menuItem->name}Tab' class='btn btn-link" . ($this->session->storyBrowseType == $menuItem->name ? ' btn-active-text' : '') . "'");?>
<?php echo html::a($this->inlink('browse', "productID=$productID&branch=$branch&browseType=$menuBrowseType"), "<span class='text'>$menuItem->text</span>" . ($menuItem->name == $this->session->storyBrowseType ? ' <span class="label label-light label-badge">' . $pager->recTotal . '</span>' : ''), '', "id='{$menuItem->name}Tab' class='btn btn-link" . ($this->session->storyBrowseType == $menuItem->name ? ' btn-active-text' : '') . "'");?>
<?php endif;?>
<?php endforeach;?>
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->product->searchStory;?></a>
@@ -336,18 +359,9 @@
</div>
<script>
var moduleID = <?php echo $moduleID?>;
$('#module<?php echo $moduleID;?>').addClass('active');
$('#module<?php echo $moduleID;?>').closest('li').addClass('active');
<?php if($browseType == 'bysearch'):?>
$shortcut = $('#QUERY<?php echo (int)$param;?>Tab');
if($shortcut.size() > 0)
{
$shortcut.addClass('btn-active-text');
$('#bysearchTab').removeClass('btn-active-text');
}
else
{
ajaxGetSearchForm();
}
if($('#query li.active').size() == 0) ajaxGetSearchForm();
<?php endif;?>
$(function()
+3 -12
View File
@@ -1,16 +1,7 @@
$(function()
{
setOuterBox();
if(browseType == 'bysearch') ajaxGetSearchForm();
if($('#taskList thead th.w-name').width() < 150) $('#taskList thead th.w-name').width(150);
if($('#taskList thead th.c-name').width() < 150) $('#taskList thead th.c-name').width(150);
});
function setQueryBar(queryID, title)
{
var $tagTab = $('#featurebar #calendarTab').size() > 0 ? $('#featurebar #calendarTab') : $('#featurebar #kanbanTab');
$tagTab.before("<li id='QUERY" + queryID + "Tab' class='active'><a href='" + createLink('project', 'task', "projectID=" + projectID + "&browseType=bysearch&param=" + queryID) + "'>" + title + "</a></li>");
}
$('#module' + moduleID).addClass('active');
$('#product' + productID).addClass('active');
$('#module' + moduleID).closest('li').addClass('active');
$('#product' + productID).closest('li').addClass('active');
+27 -15
View File
@@ -51,14 +51,35 @@ js::set('browseType', $browseType);
foreach(customModel::getFeatureMenu('project', 'task') as $menuItem)
{
if($project->type == 'ops' && $menuItem->name == 'needconfirm') continue;
if(isset($menuItem->hidden)) continue;
if(isset($menuItem->hidden) and $menuItem->name != 'QUERY') continue;
$menuType = $menuItem->name;
if(strpos($menuType, 'QUERY') === 0)
if($menuType == 'QUERY')
{
$queryID = (int)substr($menuType, 5);
echo html::a(inlink('task', "project=$projectID&type=bySearch&param=$queryID"), $menuItem->text, '', "id='{$menuType}Tab' class='btn btn-link'");
if(isset($lang->custom->queryList))
{
echo "<div class='btn-group' id='query'>";
$current = $menuItem->text;
$active = '';
$dropdownHtml = "<ul class='dropdown-menu'>";
foreach($lang->custom->queryList as $queryID => $queryTitle)
{
if($this->session->taskBrowseType == 'bysearch' and $queryID == $param)
{
$current = "<span class='text'>{$queryTitle}</span> <span class='label label-light label-badge'>{$pager->recTotal}</span>";
$active = 'btn-active-text';
}
$dropdownHtml .= '<li' . ($queryID == $param ? " class='active'" : '') . '>';
$dropdownHtml .= html::a($this->createLink('project', 'task', "project=$projectID&type=bySearch&param=$queryID"), $queryTitle);
}
$dropdownHtml .= '</ul>';
echo html::a('javascript:;', $current . " <span class='caret'></span>", '', "data-toggle='dropdown' class='btn btn-link $active'");
echo $dropdownHtml;
echo '</div>';
}
}
elseif($menuType != 'status')
elseif($menuType != 'status' and $menuType != 'QUERY')
{
$label = "<span class='text'>{$menuItem->text}</span>";
$label .= $menuType == $browseType ? "<span class='label label-light label-badge'>{$pager->recTotal}</span>" : '';
@@ -290,17 +311,8 @@ js::set('browseType', $browseType);
<?php js::set('replaceID', 'taskList')?>
<script>
<?php if($browseType == 'bysearch'):?>
$shortcut = $('#QUERY<?php echo (int)$param;?>Tab');
if($shortcut.size() > 0)
{
$shortcut.addClass('btn-active-text');
$('#bysearchTab').removeClass('btn-active-text');
$('#querybox').removeClass('show');
}
if($('#query li.active').size() == 0) ajaxGetSearchForm();
<?php endif;?>
statusActive = '<?php echo isset($lang->project->statusSelects[$this->session->taskBrowseType]);?>';
if(statusActive) $('#statusTab').addClass('active');
$(function()
{
// Update table summary text
+1 -3
View File
@@ -70,9 +70,7 @@ class search extends control
$queryID = $this->search->saveQuery();
if(!$queryID) die(js::error(dao::getError()));
$onMenuBarFunc = '';
if($this->post->onMenuBar) $onMenuBarFunc = "if(typeof parent.parent.setQueryBar === 'function') parent.parent.setQueryBar($queryID, '{$this->post->title}')";
die(js::closeModal('parent.parent', '', "function(){parent.parent.loadQueries($queryID);$onMenuBarFunc}"));
die(js::closeModal('parent.parent', '', "function(){parent.parent.loadQueries($queryID)}"));
}
$this->view->module = $module;
$this->view->onMenuBar = $onMenuBar;
+1 -38
View File
@@ -270,49 +270,12 @@ class searchModel extends model
->skipSpecial('sql,form')
->remove('onMenuBar')
->get();
if($this->post->onMenuBar) $query->shortcut = 1;
$this->dao->insert(TABLE_USERQUERY)->data($query)->autoCheck()->check('title', 'notempty')->exec();
if(!dao::isError())
{
$queryID = $this->dao->lastInsertID();
/* Set this query show on menu bar. */
if($this->post->onMenuBar)
{
$queryModule = $query->module == 'task' ? 'project' : ($query->module == 'story' ? 'product' : $query->module);
$featureBarConfig = $this->dao->select('*')->from(TABLE_CONFIG)->where('owner')->eq($this->app->user->account)->andWhere('module')->eq('common')->andWhere('section')->eq('customMenu')->andWhere('`key`')->like($this->config->global->flow ."_feature_{$queryModule}_%")->fetch();
$this->app->loadLang($queryModule);
if(!isset($this->lang->$queryModule->featureBar)) return $queryID;
$method = key($this->lang->$queryModule->featureBar);
$newConfig = array();
if(isset($featureBarConfig->id)) $newConfig = json_decode($featureBarConfig->value);
if(empty($newConfig))
{
$order = 1;
foreach($this->lang->$queryModule->featureBar[$method] as $menuKey => $menuName)
{
$menu = new stdclass();
$menu->name = $menuKey;
$menu->order = $order;
$newConfig[] = $menu;
$order++;
}
}
$menu = new stdclass();
$menu->name = 'QUERY' . $queryID;
$menu->order = $order;
$newConfig[] = $menu;
$featureBarConfig = new stdclass();
$featureBarConfig->owner = $this->app->user->account;
$featureBarConfig->module = 'common';
$featureBarConfig->section = 'customMenu';
$featureBarConfig->key = $this->config->global->flow . "_feature_{$queryModule}_{$method}";
$featureBarConfig->value = json_encode($newConfig);
$this->dao->replace(TABLE_CONFIG)->data($featureBarConfig)->exec();
}
if(!dao::isError()) $this->loadModel('score')->create('search', 'saveQuery', $queryID);
return $queryID;
}
+1 -17
View File
@@ -1,13 +1,3 @@
/* Swtich to search module. */
function browseBySearch(active)
{
$('#querybox').removeClass('hidden');
$('.divider').addClass('hidden');
$('#' + active + 'Tab').removeClass('active');
$('#bysearchTab').addClass('active');
$('#bymoduleTab').removeClass('active');
}
/**
* Confirm batch delete cases.
*
@@ -23,8 +13,7 @@ function confirmBatchDelete(actionLink)
$(function()
{
if(browseType == 'bysearch') ajaxGetSearchForm();
if($('#caseList thead th.w-title').width() < 150) $('#caseList thead th.w-title').width(150);
if($('#caseList thead th.c-title').width() < 150) $('#caseList thead th.c-title').width(150);
if(flow == 'onlyTest')
{
@@ -35,8 +24,3 @@ $(function()
$('#subNavbar > .nav > li[data-id=' + browseType + ']').addClass('active');
}
});
function setQueryBar(queryID, title)
{
$('#bysearchTab').before("<li id='QUERY" + queryID + "Tab' class='active'><a href='" + createLink('testcase', 'browse', "productID=" + productID + "&branch=" + branch + "&browseType=bysearch&param=" + queryID) + "'>" + title + "</a></li>");
}
+3 -9
View File
@@ -40,7 +40,7 @@ js::set('branch', $branch);
</div>
</div>
<div class='main-col'>
<div id='queryBox' class='cell <?php if($browseType =='bysearch') echo 'show';?>'></div>
<div id='queryBox' class='cell'></div>
<form class='main-table table-case' data-ride='table' id='batchForm' method='post'>
<div class="table-header fixed-right">
<nav class="btn-toolbar pull-right"></nav>
@@ -205,16 +205,10 @@ js::set('branch', $branch);
</div>
</div>
<script>
$('#module' + moduleID).addClass('active');
$('#module' + moduleID).closest('li').addClass('active');
$('#' + caseBrowseType + 'Tab').addClass('btn-active-text').find('.text').after("<span class='label label-light label-badge'><?php echo $pager->recTotal;?></span>");
<?php if($browseType == 'bysearch'):?>
$shortcut = $('#QUERY<?php echo (int)$param;?>Tab');
if($shortcut.size() > 0)
{
$shortcut.addClass('btn-active-text');
$('#bysearchTab').removeClass('btn-active-text');
$('#querybox').removeClass('show');
}
if($('#query li.active').size() == 0) ajaxGetSearchForm();
<?php endif;?>
</script>
<?php include '../../common/view/footer.html.php';?>
+24 -4
View File
@@ -85,14 +85,34 @@
?>
<?php foreach(customModel::getFeatureMenu('testcase', 'browse') as $menuItem):?>
<?php
if(isset($menuItem->hidden)) continue;
if(isset($menuItem->hidden) and $menuItem->name != 'QUERY') continue;
$menuType = $menuItem->name;
if(!$config->testcase->needReview and empty($config->testcase->forceReview) and $menuType == 'wait') continue;
if($this->config->global->flow == 'onlyTest' and (strpos(',needconfirm,group,zerocase,', ',' . $menuType . ',') !== false)) continue;
if($hasBrowsePriv and strpos($menuType, 'QUERY') === 0)
if($hasBrowsePriv and $menuType == 'QUERY')
{
$queryID = (int)substr($menuType, 5);
echo html::a($this->createLink('testcase', 'browse', "productid=$productID&branch=$branch&browseType=bySearch&param=$queryID"), "<span class='text'>{$menuItem->text}</span>", '', "class='btn btn-link' id='{$menuType}Tab'");
if(isset($lang->custom->queryList))
{
echo '<div class="btn-group" id="query">';
$active = '';
$current = $menuItem->text;
$dropdownHtml = "<ul class='dropdown-menu'>";
foreach($lang->custom->queryList as $queryID => $queryTitle)
{
if($browseType == 'bysearch' and $queryID == $param)
{
$active = 'btn-active-text';
$current = "<span class='text'>{$queryTitle}</span> <span class='label label-light label-badge'>{$pager->recTotal}</span>";
}
$dropdownHtml .= '<li' . ($param == $queryID ? " class='active'" : '') . '>';
$dropdownHtml .= html::a($this->inlink('browse', "productID=$productID&branch=$branch&browseType=bySearch&param=$queryID"), $queryTitle);
}
$dropdownHtml .= '</ul>';
echo html::a('javascript:;', $current . " <span class='caret'></span>", '', "data-toggle='dropdown' class='btn btn-link $active'");
echo $dropdownHtml;
echo '</div>';
}
}
elseif($hasBrowsePriv and ($menuType == 'all' or $menuType == 'needconfirm' or $menuType == 'wait'))
{