* Finish task #59480, #59481.

This commit is contained in:
liumengyi
2022-07-07 14:12:45 +08:00
parent b2dac0d660
commit e709c4bbda
8 changed files with 407 additions and 275 deletions
+22 -18
View File
@@ -1776,16 +1776,18 @@ class bugModel extends model
}
else
{
$bugs = $this->dao->select('*')->from(TABLE_BUG)
->where('deleted')->eq(0)
->beginIF(empty($build))->andWhere('project')->eq($projectID)->fi()
->beginIF(!empty($productID))->andWhere('product')->eq($productID)->fi()
->beginIF($type == 'unresolved')->andWhere('status')->eq('active')->fi()
->beginIF($type == 'noclosed')->andWhere('status')->ne('closed')->fi()
->beginIF($type == 'assignedtome')->andWhere('assignedTo')->eq($this->app->user->account)->fi()
->beginIF($type == 'openedbyme')->andWhere('openedBy')->eq($this->app->user->account)->fi()
->beginIF($build)->andWhere("CONCAT(',', openedBuild, ',') like '%,$build,%'")->fi()
->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi()
$bugs = $this->dao->select('t1.*')->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_MODULE)->alias('t2')->on('t1.module=t2.id')
->where('t1.deleted')->eq(0)
->beginIF(empty($build))->andWhere('t1.project')->eq($projectID)->fi()
->beginIF(!empty($productID))->andWhere('t1.product')->eq($productID)->fi()
->beginIF($type == 'unresolved')->andWhere('t1.status')->eq('active')->fi()
->beginIF($type == 'noclosed')->andWhere('t1.status')->ne('closed')->fi()
->beginIF($type == 'assignedtome')->andWhere('t1.assignedTo')->eq($this->app->user->account)->fi()
->beginIF($type == 'openedbyme')->andWhere('t1.openedBy')->eq($this->app->user->account)->fi()
->beginIF(!empty($param))->andWhere('t2.path')->like("%,$param,%")->andWhere('t2.deleted')->eq(0)->fi()
->beginIF($build)->andWhere("CONCAT(',', t1.openedBuild, ',') like '%,$build,%'")->fi()
->beginIF($excludeBugs)->andWhere('t1.id')->notIN($excludeBugs)->fi()
->orderBy($orderBy)->page($pager)->fetchAll();
}
@@ -1838,14 +1840,16 @@ class bugModel extends model
}
else
{
$bugs = $this->dao->select('*')->from(TABLE_BUG)
->where('deleted')->eq(0)
->beginIF(empty($build))->andWhere('execution')->eq($executionID)->fi()
->beginIF(!empty($productID))->andWhere('product')->eq($productID)->fi()
->beginIF($type == 'unresolved')->andWhere('status')->eq('active')->fi()
->beginIF($type == 'noclosed')->andWhere('status')->ne('closed')->fi()
->beginIF($build)->andWhere("CONCAT(',', openedBuild, ',') like '%,$build,%'")->fi()
->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi()
$bugs = $this->dao->select('t1.*')->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_MODULE)->alias('t2')->on('t1.module=t2.id')
->where('t1.deleted')->eq(0)
->beginIF(empty($build))->andWhere('t1.execution')->eq($executionID)->fi()
->beginIF(!empty($productID))->andWhere('t1.product')->eq($productID)->fi()
->beginIF($type == 'unresolved')->andWhere('t1.status')->eq('active')->fi()
->beginIF($type == 'noclosed')->andWhere('t1.status')->ne('closed')->fi()
->beginIF($build)->andWhere("CONCAT(',', t1.openedBuild, ',') like '%,$build,%'")->fi()
->beginIF(!empty($param))->andWhere('t2.path')->like("%,$param,%")->andWhere('t2.deleted')->eq(0)->fi()
->beginIF($excludeBugs)->andWhere('t1.id')->notIN($excludeBugs)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
+27 -2
View File
@@ -933,6 +933,7 @@ class execution extends control
$this->loadModel('user');
$this->loadModel('product');
$this->loadModel('datatable');
$this->loadModel('tree');
/* Save session. */
$this->session->set('bugList', $this->app->getURI(true), 'execution');
@@ -946,7 +947,7 @@ class execution extends control
$productPairs = array('0' => $this->lang->product->all);
foreach($products as $productData) $productPairs[$productData->id] = $productData->name;
$this->lang->modulePageNav = $this->product->select($productPairs, $productID, 'execution', 'bug', $executionID, $branchID, 0, '', false);
$this->lang->modulePageNav = $this->product->select($productPairs, $productID, 'execution', 'bug', $executionID, 0, 0, '', false);
/* Header and position. */
$title = $execution->name . $this->lang->colon . $this->lang->execution->bug;
@@ -1009,6 +1010,24 @@ class execution extends control
/* Process the openedBuild and resolvedBuild fields. */
$bugs = $this->bug->processBuildForBugs($bugs);
$moduleID = $type != 'bysearch' ? $param : 0;
$modules = $this->tree->getAllModulePairs('bug');
/* Get module tree.*/
$extra = array('executionID' => $executionID, 'orderBy' => $orderBy, 'type' => $type, 'build' => $build);
if($executionID and empty($productID) and count($products) > 1)
{
$moduleTree = $this->tree->getBugTreeMenu($executionID, $productID, 0, array('treeModel', 'createBugLink'), $extra);
}
else
{
$productID = empty($productID) ? key($products) : $productID;
$moduleTree = $this->tree->getTreeMenu($productID, 'bug', 0, array('treeModel', 'createBugLink'), $extra + array('productID' => $productID), 'all');
}
$tree = $moduleID ? $this->tree->getByID($moduleID) : '';
$showModule = !empty($this->config->datatable->projectBug->showModule) ? $this->config->datatable->executionBug->showModule : '';
/* Assign. */
$this->view->title = $title;
$this->view->position = $position;
@@ -1029,11 +1048,17 @@ class execution extends control
$this->view->builds = $this->build->getBuildPairs($productID);
$this->view->branchOption = $branchOption;
$this->view->branchTagOption = $branchTagOption;
$this->view->modulePairs = $showModule ? $this->loadModel('tree')->getModulePairs($productID, 'bug', $showModule) : array();
$this->view->plans = $this->loadModel('productplan')->getPairs($productID);
$this->view->stories = $storyList;
$this->view->tasks = $taskList;
$this->view->projectPairs = $this->loadModel('project')->getPairsByProgram();
$this->view->moduleTree = $moduleTree;
$this->view->modules = $modules;
$this->view->moduleID = $moduleID;
$this->view->moduleName = $moduleID ? $tree->name : $this->lang->tree->all;
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'bug', $showModule) : array();
$this->view->setModule = true;
$this->view->showBranch = false;
$this->display();
}
+1
View File
@@ -1,4 +1,5 @@
$(function()
{
if(browseType != 'bysearch') $('#module' + param).closest('li').addClass('active');
if($('#bugList thead th.c-title').width() < 150) $('#bugList thead th.c-title').width(150);
});
+148 -120
View File
@@ -16,7 +16,19 @@
#subHeader #dropMenu .col-left .list-group {margin-bottom: 0px; padding-top: 10px;}
#subHeader #dropMenu .col-left {padding-bottom: 0px;}
</style>
<div id="mainMenu" class="clearfix">
<div id="mainMenu" class="clearfix main-row fade in">
<div id="sidebarHeader">
<div class="title" title="<?php echo $moduleName;?>">
<?php
echo $moduleName;
if(!empty($moduleID))
{
$removeLink = $this->createLink('execution', 'bug', "executionID={$execution->id}&productID={$productID}&orderBy=$orderBy&build=$buildID&type=$type&param=0&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage");
echo html::a($removeLink, "<i class='icon icon-sm icon-close'></i>", '', "class='text-muted' data-app='{$this->app->tab}'");
}
?>
</div>
</div>
<div class="btn-toolbar pull-left">
<?php
$buildName = $build ? " <span class='label label-danger'>Build:{$build->name}</span>" : '';
@@ -27,7 +39,7 @@
</div>
<div class="btn-toolbar pull-right">
<?php common::printLink('bug', 'export', "productID=$productID&orderBy=$orderBy&browseType=&executionID=$execution->id", "<i class='icon icon-export muted'> </i> " . $lang->bug->export, '', "class='btn btn-link export'");?>
<?php if(common::canModify('execution', $execution)) common::printLink('bug', 'create', "productID=$defaultProduct&branch=$branchID&extras=executionID=$execution->id", "<i class='icon icon-plus'></i> " . $lang->bug->create, '', "class='btn btn-primary'");?>
<?php if(common::canModify('execution', $execution)) common::printLink('bug', 'create', "productID=$defaultProduct&branch=0&extras=executionID=$execution->id", "<i class='icon icon-plus'></i> " . $lang->bug->create, '', "class='btn btn-primary'");?>
</div>
</div>
<?php if($this->app->getViewType() == 'xhtml'):?>
@@ -42,139 +54,155 @@
</div>
</div>
<?php endif;?>
<div id="mainContent">
<div class="cell <?php if($type == 'bysearch') echo 'show';?>" id="queryBox" data-module='executionBug'></div>
<?php if(empty($bugs)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->bug->noBug;?></span>
<?php if(common::canModify('execution', $execution) and common::hasPriv('bug', 'create')):?>
<?php echo html::a($this->createLink('bug', 'create', "productID=$defaultProduct&branch=$branchID&extra=executionID=$execution->id"), "<i class='icon icon-plus'></i> " . $lang->bug->create, '', "class='btn btn-info' data-app='execution'");?>
<div id="mainContent" class='main-row split-row fade'>
<div class="side-col" id='sidebar' data-min-width='235'>
<div class="sidebar-toggle"><i class="icon icon-angle-left"></i></div>
<div class='cell'>
<?php if(!$moduleTree):?>
<hr class="space">
<div class="text-center text-muted"><?php echo $lang->bug->noModule;?></div>
<hr class="space">
<?php else:?>
<?php echo $moduleTree;?>
<?php endif;?>
</p>
</div>
<?php else:?>
<?php
$datatableId = $this->moduleName . ucfirst($this->methodName);
$useDatatable = (isset($config->datatable->$datatableId->mode) and $config->datatable->$datatableId->mode == 'datatable');
?>
<?php if($this->app->getViewType() == 'xhtml'):?>
<form class='main-table' method='post' id='executionBugForm'>
<?php else:?>
<form class='main-table' method='post' id='executionBugForm' <?php if(!$useDatatable) echo "data-ride='table'";?>>
<?php endif;?>
<div class="table-header fixed-right">
<nav class="btn-toolbar pull-right setting"></nav>
<div class="text-center"></div>
</div>
</div>
<div class='main-col' data-min-width='400'>
<div class="cell <?php if($type == 'bysearch') echo 'show';?>" id="queryBox" data-module='executionBug'></div>
<?php if(empty($bugs)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->bug->noBug;?></span>
<?php if(common::canModify('execution', $execution) and common::hasPriv('bug', 'create')):?>
<?php echo html::a($this->createLink('bug', 'create', "productID=$defaultProduct&branch=0&extra=executionID=$execution->id"), "<i class='icon icon-plus'></i> " . $lang->bug->create, '', "class='btn btn-info' data-app='execution'");?>
<?php endif;?>
</p>
</div>
<?php else:?>
<?php
$vars = "executionID={$execution->id}&productID={$productID}&orderBy=%s&build=$buildID&type=$type&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
$useDatatable ? include '../../common/view/datatable.html.php' : include '../../common/view/tablesorter.html.php';
$setting = $this->datatable->getSetting('execution');
$widths = $this->datatable->setFixedFieldWidth($setting);
$columns = 0;
$canBatchAssignTo = common::hasPriv('bug', 'batchAssignTo');
$datatableId = $this->moduleName . ucfirst($this->methodName);
$useDatatable = (isset($config->datatable->$datatableId->mode) and $config->datatable->$datatableId->mode == 'datatable');
?>
<?php if(!$useDatatable) echo '<div class="table-responsive">';?>
<table class='table has-sort-head<?php if($useDatatable) echo ' datatable';?>' id='bugList' data-fixed-left-width='<?php echo $widths['leftWidth']?>' data-fixed-right-width='<?php echo $widths['rightWidth']?>'>
<thead>
<tr>
<?php if($this->app->getViewType() == 'xhtml'):?>
<form class='main-table' method='post' id='executionBugForm'>
<?php else:?>
<form class='main-table' method='post' id='executionBugForm' <?php if(!$useDatatable) echo "data-ride='table'";?>>
<?php endif;?>
<div class="table-header fixed-right">
<nav class="btn-toolbar pull-right setting"></nav>
</div>
<?php
$vars = "executionID={$execution->id}&productID={$productID}&orderBy=%s&build=$buildID&type=$type&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
$useDatatable ? include '../../common/view/datatable.html.php' : include '../../common/view/tablesorter.html.php';
$setting = $this->datatable->getSetting('execution');
$widths = $this->datatable->setFixedFieldWidth($setting);
$columns = 0;
$canBatchAssignTo = common::hasPriv('bug', 'batchAssignTo');
?>
<?php if(!$useDatatable) echo '<div class="table-responsive">';?>
<table class='table has-sort-head<?php if($useDatatable) echo ' datatable';?>' id='bugList' data-fixed-left-width='<?php echo $widths['leftWidth']?>' data-fixed-right-width='<?php echo $widths['rightWidth']?>'>
<thead>
<tr>
<?php if($this->app->getViewType() == 'xhtml'):?>
<?php
foreach($setting as $value)
{
if($value->id == 'title' || $value->id == 'id' || $value->id == 'pri' || $value->id == 'status')
{
$this->datatable->printHead($value, $orderBy, $vars, $canBatchAssignTo);
$columns ++;
}
}
?>
<?php else:?>
<?php
foreach($setting as $value)
{
if($value->show)
{
if(common::checkNotCN() and $value->id == 'severity') $value->name = $lang->bug->severity;
if(common::checkNotCN() and $value->id == 'pri') $value->name = $lang->bug->pri;
if(common::checkNotCN() and $value->id == 'confirmed') $value->name = $lang->bug->confirmed;
$this->datatable->printHead($value, $orderBy, $vars, $canBatchAssignTo);
$columns ++;
}
}
?>
<?php endif;?>
</tr>
</thead>
<tbody>
<?php foreach($bugs as $bug):?>
<tr data-id='<?php echo $bug->id?>'>
<?php if($this->app->getViewType() == 'xhtml'):?>
<?php
foreach($setting as $value)
{
if($value->id == 'title' || $value->id == 'id' || $value->id == 'pri' || $value->id == 'status')
{
$this->datatable->printHead($value, $orderBy, $vars, $canBatchAssignTo);
$columns ++;
}
}
?>
foreach($setting as $value)
{
if($value->id == 'title' || $value->id == 'id' || $value->id == 'pri' || $value->id == 'status')
{
$this->bug->printCell($value, $bug, $users, $builds, $branchOption, $modulePairs, array($execution), $plans, $stories, $tasks, $useDatatable ? 'datatable' : 'table');
}
}?>
<?php else:?>
<?php
foreach($setting as $value)
{
if($value->show)
{
if(common::checkNotCN() and $value->id == 'severity') $value->name = $lang->bug->severity;
if(common::checkNotCN() and $value->id == 'pri') $value->name = $lang->bug->pri;
if(common::checkNotCN() and $value->id == 'confirmed') $value->name = $lang->bug->confirmed;
$this->datatable->printHead($value, $orderBy, $vars, $canBatchAssignTo);
$columns ++;
}
}
?>
<?php foreach($setting as $value) $this->bug->printCell($value, $bug, $users, $builds, $branchOption, $modulePairs, $executions, $plans, $stories, $tasks, $useDatatable ? 'datatable' : 'table', $projectPairs);?>
<?php endif;?>
</tr>
</thead>
<tbody>
<?php foreach($bugs as $bug):?>
<tr data-id='<?php echo $bug->id?>'>
<?php if($this->app->getViewType() == 'xhtml'):?>
<?php
foreach($setting as $value)
{
if($value->id == 'title' || $value->id == 'id' || $value->id == 'pri' || $value->id == 'status')
{
$this->bug->printCell($value, $bug, $users, $builds, $branchOption, $modulePairs, array($execution), $plans, $stories, $tasks, $useDatatable ? 'datatable' : 'table');
}
}?>
<?php else:?>
<?php foreach($setting as $value) $this->bug->printCell($value, $bug, $users, $builds, $branchOption, $modulePairs, $executions, $plans, $stories, $tasks, $useDatatable ? 'datatable' : 'table', $projectPairs);?>
<?php endif;?>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if(!$useDatatable) echo '</div>';?>
<div class='table-footer'>
<?php if($canBatchAssignTo):?>
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<div class="table-actions btn-toolbar">
<div class="btn-group dropup">
<button data-toggle="dropdown" type="button" class="btn"><?php echo $lang->bug->assignedTo?> <span class="caret"></span></button>
<?php
$withSearch = count($memberPairs) > 10;
$actionLink = $this->createLink('bug', 'batchAssignTo', "executionID={$execution->id}&type=execution");
echo html::select('assignedTo', $memberPairs, '', 'class="hidden"');
<?php endforeach;?>
</tbody>
</table>
<?php if(!$useDatatable) echo '</div>';?>
<div class='table-footer'>
<?php if($canBatchAssignTo):?>
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<div class="table-actions btn-toolbar">
<div class="btn-group dropup">
<button data-toggle="dropdown" type="button" class="btn"><?php echo $lang->bug->assignedTo?> <span class="caret"></span></button>
<?php
$withSearch = count($memberPairs) > 10;
$actionLink = $this->createLink('bug', 'batchAssignTo', "executionID={$execution->id}&type=execution");
echo html::select('assignedTo', $memberPairs, '', 'class="hidden"');
if($withSearch)
{
echo "<div class='dropdown-menu search-list search-box-sink' data-ride='searchList'>";
echo '<div class="input-control search-box has-icon-left has-icon-right search-example">';
echo '<input id="userSearchBox" type="search" class="form-control search-input" autocomplete="off" />';
echo '<label for="userSearchBox" class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>';
echo '<a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a>';
echo '</div>';
$membersPinYin = common::convert2Pinyin($memberPairs);
}
else
{
echo "<div class='dropdown-menu search-list'>";
}
echo '<div class="list-group">';
foreach($memberPairs as $key => $value)
{
if(empty($key)) continue;
$searchKey = $withSearch ? ('data-key="' . zget($membersPinYin, $value, '') . " @$key\"") : "data-key='@$key'";
echo html::a("javascript:$(\".table-actions #assignedTo\").val(\"$key\");setFormAction(\"$actionLink\")", $value, '', $searchKey);
}
echo "</div>";
echo "</div>";
?>
if($withSearch)
{
echo "<div class='dropdown-menu search-list search-box-sink' data-ride='searchList'>";
echo '<div class="input-control search-box has-icon-left has-icon-right search-example">';
echo '<input id="userSearchBox" type="search" class="form-control search-input" autocomplete="off" />';
echo '<label for="userSearchBox" class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>';
echo '<a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a>';
echo '</div>';
$membersPinYin = common::convert2Pinyin($memberPairs);
}
else
{
echo "<div class='dropdown-menu search-list'>";
}
echo '<div class="list-group">';
foreach($memberPairs as $key => $value)
{
if(empty($key)) continue;
$searchKey = $withSearch ? ('data-key="' . zget($membersPinYin, $value, '') . " @$key\"") : "data-key='@$key'";
echo html::a("javascript:$(\".table-actions #assignedTo\").val(\"$key\");setFormAction(\"$actionLink\")", $value, '', $searchKey);
}
echo "</div>";
echo "</div>";
?>
</div>
</div>
<?php endif;?>
<div class="table-statistic"><?php echo $summary;?></div>
<?php $pager->show('right', 'pagerjs');?>
</div>
<?php endif;?>
<div class="table-statistic"><?php echo $summary;?></div>
<?php $pager->show('right', 'pagerjs');?>
</div>
</form>
<?php endif;?>
</form>
<?php endif;?>
</div>
</div>
<?php js::set('replaceID', 'bugList');?>
<?php js::set('browseType', $type);?>
<?php js::set('param', $param);?>
<script>
<?php if(!empty($useDatatable)):?>
$(function(){$('#executionBugForm').table();})
+26 -1
View File
@@ -998,6 +998,7 @@ class project extends control
$this->loadModel('user');
$this->loadModel('product');
$this->loadModel('datatable');
$this->loadModel('tree');
/* Save session. */
$this->session->set('bugList', $this->app->getURI(true), 'project');
@@ -1066,6 +1067,24 @@ class project extends control
$storyList = $storyIdList ? $this->loadModel('story')->getByList($storyIdList) : array();
$taskList = $taskIdList ? $this->loadModel('task')->getByList($taskIdList) : array();
$moduleID = $type != 'bysearch' ? $param : 0;
$modules = $this->tree->getAllModulePairs('bug');
/* Get module tree.*/
$extra = array('projectID' => $projectID, 'orderBy' => $orderBy, 'type' => $type, 'build' => $build);
if($projectID and empty($productID) and count($products) > 1)
{
$moduleTree = $this->tree->getBugTreeMenu($projectID, $productID, 0, array('treeModel', 'createBugLink'), $extra);
}
else
{
$productID = empty($productID) ? 0 : $productID;
$moduleTree = $this->tree->getTreeMenu($productID, 'bug', 0, array('treeModel', 'createBugLink'), $extra + array('productID' => $productID), 'all');
}
$tree = $moduleID ? $this->tree->getByID($moduleID) : '';
$showModule = !empty($this->config->datatable->projectBug->showModule) ? $this->config->datatable->projectBug->showModule : '';
/* Assign. */
$this->view->title = $title;
$this->view->position = $position;
@@ -1086,11 +1105,17 @@ class project extends control
$this->view->branchOption = $branchOption;
$this->view->branchTagOption = $branchTagOption;
$this->view->executions = $executions;
$this->view->modulePairs = $showModule ? $this->loadModel('tree')->getModulePairs($productID, 'bug', $showModule) : array();
$this->view->plans = $this->loadModel('productplan')->getPairs($productID);
$this->view->stories = $storyList;
$this->view->tasks = $taskList;
$this->view->projectPairs = $this->project->getPairsByProgram();
$this->view->moduleTree = $moduleTree;
$this->view->modules = $modules;
$this->view->moduleID = $moduleID;
$this->view->moduleName = $moduleID ? $tree->name : $this->lang->tree->all;
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'bug', $showModule) : array();
$this->view->setModule = true;
$this->view->showBranch = false;
$this->display();
+1
View File
@@ -1,4 +1,5 @@
$(function()
{
if(browseType != 'bysearch') $('#module' + param).closest('li').addClass('active');
if($('#bugList thead th.c-title').width() < 150) $('#bugList thead th.c-title').width(150);
});
+125 -97
View File
@@ -16,7 +16,19 @@
#subHeader #dropMenu .col-left .list-group {margin-bottom: 0px; padding-top: 10px;}
#subHeader #dropMenu .col-left {padding-bottom: 0px;}
</style>
<div id="mainMenu" class="clearfix">
<div id="mainMenu" class="clearfix main-row fade in">
<div id="sidebarHeader">
<div class="title" title="<?php echo $moduleName;?>">
<?php
echo $moduleName;
if(!empty($moduleID))
{
$removeLink = $this->createLink('project', 'bug', "project={$project->id}&productID={$productID}&orderBy=$orderBy&build=$buildID&type=$type&param=0&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage");
echo html::a($removeLink, "<i class='icon icon-sm icon-close'></i>", '', "class='text-muted' data-app='{$this->app->tab}'");
}
?>
</div>
</div>
<div class="btn-toolbar pull-left">
<?php
$buildName = $build ? " <span class='label label-danger'>Build:{$build->name}</span>" : '';
@@ -30,111 +42,127 @@
<?php if(common::canModify('project', $project)) common::printLink('bug', 'create', "productID=$productID&branch=$branchID&extras=projectID=$project->id", "<i class='icon icon-plus'></i> " . $lang->bug->create, '', "class='btn btn-primary'");?>
</div>
</div>
<div id="mainContent">
<div class="cell <?php if($type == 'bysearch') echo 'show';?>" id="queryBox" data-module='projectBug'></div>
<?php if(empty($bugs)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->bug->noBug;?></span>
<?php if(common::canModify('project', $project) and common::hasPriv('bug', 'create')):?>
<?php echo html::a($this->createLink('bug', 'create', "productID=$productID&branch=$branchID&extra=projectID=$project->id"), "<i class='icon icon-plus'></i> " . $lang->bug->create, '', "class='btn btn-info' data-app='project'");?>
<div id="mainContent" class='main-row split-row fade'>
<div class="side-col" id='sidebar' data-min-width='235'>
<div class="sidebar-toggle"><i class="icon icon-angle-left"></i></div>
<div class='cell'>
<?php if(!$moduleTree):?>
<hr class="space">
<div class="text-center text-muted"><?php echo $lang->bug->noModule;?></div>
<hr class="space">
<?php else:?>
<?php echo $moduleTree;?>
<?php endif;?>
</p>
<div class="text-center"></div>
</div>
</div>
<?php else:?>
<?php
$datatableId = $this->moduleName . ucfirst($this->methodName);
$useDatatable = (isset($config->datatable->$datatableId->mode) and $config->datatable->$datatableId->mode == 'datatable');
?>
<form class='main-table' method='post' id='projectBugForm' <?php if(!$useDatatable) echo "data-ride='table'";?>>
<div class="table-header fixed-right">
<nav class="btn-toolbar pull-right setting"></nav>
<div class='main-col' data-min-width='400'>
<div class="cell <?php if($type == 'bysearch') echo 'show';?>" id="queryBox" data-module='projectBug'></div>
<?php if(empty($bugs)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->bug->noBug;?></span>
<?php if(common::canModify('project', $project) and common::hasPriv('bug', 'create')):?>
<?php echo html::a($this->createLink('bug', 'create', "productID=$productID&branch=$branchID&extra=projectID=$project->id"), "<i class='icon icon-plus'></i> " . $lang->bug->create, '', "class='btn btn-info' data-app='project'");?>
<?php endif;?>
</p>
</div>
<?php else:?>
<?php
$vars = "projectID={$project->id}&productID=$productID&orderBy=%s&build=$buildID&type=$type&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
if($useDatatable) include '../../common/view/datatable.html.php';
else include '../../common/view/tablesorter.html.php';
$setting = $this->datatable->getSetting('project');
$widths = $this->datatable->setFixedFieldWidth($setting);
$columns = 0;
$canBatchAssignTo = common::hasPriv('bug', 'batchAssignTo');
$datatableId = $this->moduleName . ucfirst($this->methodName);
$useDatatable = (isset($config->datatable->$datatableId->mode) and $config->datatable->$datatableId->mode == 'datatable');
?>
<?php if(!$useDatatable) echo '<div class="table-responsive">';?>
<table class='table has-sort-head<?php if($useDatatable) echo ' datatable';?>' id='bugList' data-fixed-left-width='<?php echo $widths['leftWidth']?>' data-fixed-right-width='<?php echo $widths['rightWidth']?>'>
<thead>
<tr>
<?php
foreach($setting as $key => $value)
{
if($value->show)
{
$this->datatable->printHead($value, $orderBy, $vars, $canBatchAssignTo);
$columns ++;
}
}
?>
</tr>
</thead>
<tbody>
<?php foreach($bugs as $bug):?>
<?php
$canBeChanged = common::canBeChanged('bug', $bug);
$arrtibute = $canBeChanged ? '' : 'disabled';
?>
<tr data-id='<?php echo $bug->id?>'>
<?php foreach($setting as $value) $this->bug->printCell($value, $bug, $users, $builds, $branchOption, $modulePairs, $executions, $plans, $stories, $tasks, $useDatatable ? 'datatable' : 'table', $projectPairs);?>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if(!$useDatatable) echo '</div>';?>
<div class='table-footer'>
<?php if($canBatchAssignTo):?>
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<div class="table-actions btn-toolbar">
<div class="btn-group dropup">
<button data-toggle="dropdown" type="button" class="btn"><?php echo $lang->bug->assignedTo?> <span class="caret"></span></button>
<?php
$withSearch = count($memberPairs) > 10;
$actionLink = $this->createLink('bug', 'batchAssignTo', "projectID={$project->id}&type=project");
echo html::select('assignedTo', $memberPairs, '', 'class="hidden"');
if($withSearch)
{
echo "<div class='dropdown-menu search-list search-box-sink' data-ride='searchList'>";
echo '<div class="input-control search-box has-icon-left has-icon-right search-example">';
echo '<input id="userSearchBox" type="search" class="form-control search-input" autocomplete="off" />';
echo '<label for="userSearchBox" class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>';
echo '<a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a>';
echo '</div>';
$membersPinYin = common::convert2Pinyin($memberPairs);
}
else
{
echo "<div class='dropdown-menu search-list'>";
}
echo '<div class="list-group">';
foreach($memberPairs as $key => $value)
{
if(empty($key)) continue;
$searchKey = $withSearch ? ('data-key="' . zget($membersPinYin, $value, '') . " @$key\"") : "data-key='@$key'";
echo html::a("javascript:$(\".table-actions #assignedTo\").val(\"$key\");setFormAction(\"$actionLink\")", $value, '', $searchKey);
}
echo "</div>";
echo "</div>";
?>
</div>
<form class='main-table' method='post' id='projectBugForm' <?php if(!$useDatatable) echo "data-ride='table'";?>>
<div class="table-header fixed-right">
<nav class="btn-toolbar pull-right setting"></nav>
</div>
<?php endif;?>
<?php $pager->show('right', 'pagerjs');?>
</div>
</form>
<?php endif;?>
<?php
$vars = "projectID={$project->id}&productID=$productID&orderBy=%s&build=$buildID&type=$type&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
if($useDatatable) include '../../common/view/datatable.html.php';
else include '../../common/view/tablesorter.html.php';
$setting = $this->datatable->getSetting('project');
$widths = $this->datatable->setFixedFieldWidth($setting);
$columns = 0;
$canBatchAssignTo = common::hasPriv('bug', 'batchAssignTo');
?>
<?php if(!$useDatatable) echo '<div class="table-responsive">';?>
<table class='table has-sort-head<?php if($useDatatable) echo ' datatable';?>' id='bugList' data-fixed-left-width='<?php echo $widths['leftWidth']?>' data-fixed-right-width='<?php echo $widths['rightWidth']?>'>
<thead>
<tr>
<?php
foreach($setting as $key => $value)
{
if($value->show)
{
$this->datatable->printHead($value, $orderBy, $vars, $canBatchAssignTo);
$columns ++;
}
}
?>
</tr>
</thead>
<tbody>
<?php foreach($bugs as $bug):?>
<?php
$canBeChanged = common::canBeChanged('bug', $bug);
$arrtibute = $canBeChanged ? '' : 'disabled';
?>
<tr data-id='<?php echo $bug->id?>'>
<?php foreach($setting as $value) $this->bug->printCell($value, $bug, $users, $builds, $branchOption, $modulePairs, $executions, $plans, $stories, $tasks, $useDatatable ? 'datatable' : 'table', $projectPairs);?>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if(!$useDatatable) echo '</div>';?>
<div class='table-footer'>
<?php if($canBatchAssignTo):?>
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<div class="table-actions btn-toolbar">
<div class="btn-group dropup">
<button data-toggle="dropdown" type="button" class="btn"><?php echo $lang->bug->assignedTo?> <span class="caret"></span></button>
<?php
$withSearch = count($memberPairs) > 10;
$actionLink = $this->createLink('bug', 'batchAssignTo', "projectID={$project->id}&type=project");
echo html::select('assignedTo', $memberPairs, '', 'class="hidden"');
if($withSearch)
{
echo "<div class='dropdown-menu search-list search-box-sink' data-ride='searchList'>";
echo '<div class="input-control search-box has-icon-left has-icon-right search-example">';
echo '<input id="userSearchBox" type="search" class="form-control search-input" autocomplete="off" />';
echo '<label for="userSearchBox" class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>';
echo '<a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a>';
echo '</div>';
$membersPinYin = common::convert2Pinyin($memberPairs);
}
else
{
echo "<div class='dropdown-menu search-list'>";
}
echo '<div class="list-group">';
foreach($memberPairs as $key => $value)
{
if(empty($key)) continue;
$searchKey = $withSearch ? ('data-key="' . zget($membersPinYin, $value, '') . " @$key\"") : "data-key='@$key'";
echo html::a("javascript:$(\".table-actions #assignedTo\").val(\"$key\");setFormAction(\"$actionLink\")", $value, '', $searchKey);
}
echo "</div>";
echo "</div>";
?>
</div>
</div>
<?php endif;?>
<?php $pager->show('right', 'pagerjs');?>
</div>
</form>
<?php endif;?>
</div>
</div>
<?php js::set('replaceID', 'bugList');?>
<?php js::set('browseType', $type);?>
<?php js::set('param', $param);?>
<script>
<?php if(!empty($useDatatable)):?>
$(function(){$('#projectBugForm').table();})
+57 -37
View File
@@ -422,12 +422,12 @@ class treeModel extends model
{
if($product->type != 'normal') $branches = array(BRANCH_MAIN => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($rootID, 'noempty');
}
elseif($type == 'case' and $this->app->tab == 'execution')
elseif(strpos(',case,bug,', ",$type,") !== false and $this->app->tab == 'execution')
{
if($product->type != 'normal' and $executionID) $branches += $this->branch->getPairs($product->id, 'noempty', $executionID);
if($onlyGetLinked) $executionModules = $this->getTaskTreeModules($executionID, true, $type);
}
elseif(($type == 'story' and $this->app->rawModule == 'projectstory') or ($type == 'case' and $this->app->tab == 'project'))
elseif(($type == 'story' and $this->app->rawModule == 'projectstory') or (strpos(',case,bug,', ",$type,") !== false and $this->app->tab == 'project'))
{
if($product->type != 'normal' and $projectID) $branches += $this->branch->getPairs($product->id, 'noempty', $projectID);
if($onlyGetLinked) $executionModules = $this->getTaskTreeModules($projectID, true, $type);
@@ -653,10 +653,11 @@ class treeModel extends model
*/
public function getBugTreeMenu($rootID, $productID = 0, $startModule = 0, $userFunc = '', $extra = '')
{
$extra = array('executionID' => $rootID, 'productID' => $productID, 'tip' => true, 'extra' => $extra);
$extra += array('executionID' => $rootID, 'projectID' => $rootID, 'productID' => $productID, 'tip' => true);
$tab = $this->app->tab;
/* If createdVersion <= 4.1, go to getTreeMenu(). */
$products = $this->loadModel('product')->getProductPairsByProject($rootID);
$products = $tab == 'execution' ? $this->loadModel('product')->getProducts($rootID) : $this->loadModel('product')->getProductPairsByProject($rootID);
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
/* createdVersion > 4.1. */
@@ -670,21 +671,18 @@ class treeModel extends model
if($startModule) $startModulePath = $startModule->path . '%';
}
$executionModules = $this->getTaskTreeModules($rootID, true, 'bug');
/* Get module according to product. */
$productNum = count($products);
$moduleName = strpos(',project,execution,', ",$tab,") !== false ? $this->app->tab : 'bug';
$methodName = strpos(',project,execution,', ",$tab,") !== false ? 'bug' : 'browse';
$param = strpos(',project,execution,', ",$tab,") !== false ? "{$tab}ID={$rootID}&" : '';
foreach($products as $id => $product)
{
$extra['productID'] = $id;
if($manage)
{
$link = helper::createLink('bug', 'browse', "productID=$id");
$menu .= "<li>" . html::a($link, $product, '_self', "id='product$id'");
}
else
{
$link = helper::createLink('bug', 'browse', "productID=$productID");
if($productNum > 1) $menu .= "<li>" . html::a($link, $product, '_self', "id='product$id'");
}
$link = helper::createLink($moduleName, $methodName, "{$param}productID=$id");
$menu .= "<li>" . html::a($link, is_object($product) ? $product->name : $product, '_self', "id='product$id'");
/* tree menu. */
$tree = '';
@@ -700,14 +698,12 @@ class treeModel extends model
$stmt = $this->dbh->query($query);
while($module = $stmt->fetch())
{
if(!$manage and !isset($executionModules[$module->id]) and strpos($extra['extra'], 'allModule') === false) continue;
$this->buildTree($treeMenu, $module, 'bug', $userFunc, $extra);
if(isset($executionModules[$module->id])) $this->buildTree($treeMenu, $module, 'bug', $userFunc, $extra);
}
if(isset($treeMenu[0]) and $branch) $treeMenu[0] = "<li><a>$branchName</a><ul>{$treeMenu[0]}</ul></li>";
$tree .= isset($treeMenu[0]) ? $treeMenu[0] : '';
}
if($tree && ($productNum > 1 or $manage)) $tree = "<ul>" . $tree . "</ul>\n</li>";
if($tree) $tree = "<ul>" . $tree . "</ul>\n</li>";
$menu .= $tree;
}
$menu .= '</ul>';
@@ -974,15 +970,29 @@ class treeModel extends model
if($linkObject)
{
if(strpos(',story,case,', ",$linkObject,") === false) return array();
/* Get object paths of this execution. */
$paths = $this->dao->select('DISTINCT t3.' . $field)->from($table1)->alias('t1')
->leftJoin($table2)->alias('t2')->on('t1.' . $linkObject . ' = t2.id')
->leftJoin(TABLE_MODULE)->alias('t3')->on('t2.module = t3.id')
->where('t1.project')->eq($executionID)
->andWhere('t3.deleted')->eq(0)
->fetchPairs();
if(strpos(',story,case,', ",$linkObject,") !== false)
{
$paths = $this->dao->select('DISTINCT t3.' . $field)->from($table1)->alias('t1')
->leftJoin($table2)->alias('t2')->on('t1.' . $linkObject . ' = t2.id')
->leftJoin(TABLE_MODULE)->alias('t3')->on('t2.module = t3.id')
->where('t1.project')->eq($executionID)
->andWhere('t3.deleted')->eq(0)
->fetchPairs();
}
elseif($linkObject == 'bug' and strpos(',project,execution,', ",{$this->app->tab},") !== false)
{
$paths = $this->dao->select('DISTINCT t2.' . $field)->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_MODULE)->alias('t2')->on('t1.module = t2.id')
->where('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
->andWhere("t1.{$this->app->tab}")->eq($executionID)
->fetchPairs();
}
else
{
return array();
}
}
else
{
@@ -1001,15 +1011,17 @@ class treeModel extends model
}
}
/* Add task paths of this execution.*/
$paths += $this->dao->select($field)->from(TABLE_MODULE)
->where('root')->eq($executionID)
->andWhere('type')->eq('task')
->andWhere('deleted')->eq(0)
->fetchPairs();
if(strpos(',case,bug,', ",$linkObject,") === false)
{
/* Add task paths of this execution.*/
$paths += $this->dao->select($field)->from(TABLE_MODULE)
->where('root')->eq($executionID)
->andWhere('type')->eq('task')
->andWhere('deleted')->eq(0)
->fetchPairs();
/* Add task paths of this execution for has existed. */
$paths += $this->dao->select('DISTINCT t1.' . $field)->from(TABLE_MODULE)->alias('t1')
/* Add task paths of this execution for has existed. */
$paths += $this->dao->select('DISTINCT t1.' . $field)->from(TABLE_MODULE)->alias('t1')
->leftJoin(TABLE_TASK)->alias('t2')->on('t1.id=t2.module')
->where('t2.module')->ne(0)
->andWhere('t2.execution')->eq($executionID)
@@ -1017,6 +1029,7 @@ class treeModel extends model
->andWhere('t1.type')->eq('story')
->andWhere('t1.deleted')->eq(0)
->fetchPairs();
}
/* Get all modules from paths. */
foreach($paths as $path)
@@ -1190,13 +1203,20 @@ class treeModel extends model
/**
* Create link of a bug.
*
* @param object $module
* @param string $type
* @param object $module
* @param array $extra
* @access public
* @return string
*/
public function createBugLink($type, $module)
public function createBugLink($type, $module, $extra = array())
{
return html::a(helper::createLink('bug', 'browse', "root={$module->root}&branch=&type=byModule&param={$module->id}"), $module->name, '_self', "id='module{$module->id}' title='{$module->name}'");
$moduleName = strpos(',project,execution,', ",{$this->app->tab},") !== false ? $this->app->tab : 'bug';
$methodName = strpos(',project,execution,', ",{$this->app->tab},") !== false ? 'bug' : 'browse';
$param = "root={$module->root}&branch=&type=byModule&param={$module->id}";
if($this->app->tab == 'execution') $param = "execuitonID={$extra['executionID']}&productID={$module->root}&orderBy={$extra['orderBy']}&build={$extra['build']}&type={$extra['type']}&param={$module->id}";
if($this->app->tab == 'project') $param = "projectID={$extra['projectID']}&productID={$module->root}&orderBy={$extra['orderBy']}&build={$extra['build']}&type={$extra['type']}&param={$module->id}";
return html::a(helper::createLink($moduleName, $methodName, $param), $module->name, '_self', "id='module{$module->id}' title='{$module->name}'");
}
/**