* adjust the code of bug and product's search feature.
This commit is contained in:
@@ -47,58 +47,60 @@ class bug extends control
|
||||
}
|
||||
|
||||
/* 浏览一个产品下面的bug。*/
|
||||
public function browse($productID = 0, $type = 'byModule', $param = 0, $orderBy = 'id|desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
public function browse($productID = 0, $browseType = 'byModule', $param = 0, $orderBy = 'id|desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$this->config->bug->search['actionURL'] = $this->createLink('bug', 'browse', "productID=$productID&type=byQuery");
|
||||
$this->assign('searchForm', $this->fetch('search', 'buildForm', $this->config->bug->search));
|
||||
/* 设置搜索表单。*/
|
||||
$this->config->bug->search['actionURL'] = $this->createLink('bug', 'browse', "productID=$productID&browseType=bySearch");
|
||||
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->bug->search);
|
||||
|
||||
$type = strtolower($type);
|
||||
/* 设置产品id和模块id。*/
|
||||
$browseType = strtolower($browseType);
|
||||
$productID = common::saveProductState($productID, key($this->products));
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
|
||||
|
||||
/* 设置菜单,登记session。*/
|
||||
$this->bug->setMenu($this->products, $productID);
|
||||
$this->session->set('bugList', $this->app->getURI(true));
|
||||
|
||||
$productID = common::saveProductState($productID, key($this->products));
|
||||
$moduleID = ($type == 'bymodule') ? (int)$param : 0;
|
||||
|
||||
/* 设置菜单。*/
|
||||
$this->bug->setMenu($this->products, $productID);
|
||||
|
||||
/* 加载分页类。*/
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = pager::init($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$bugs = array();
|
||||
if($type == 'all')
|
||||
if($browseType == 'all')
|
||||
{
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where('product')->eq($productID)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($type == "bymodule")
|
||||
elseif($browseType == "bymodule")
|
||||
{
|
||||
$childModuleIds = $this->tree->getAllChildId($moduleID);
|
||||
$bugs = $this->bug->getModuleBugs($productID, $childModuleIds, $orderBy, $pager);
|
||||
}
|
||||
elseif($type == 'assigntome')
|
||||
elseif($browseType == 'assigntome')
|
||||
{
|
||||
$bugs = $this->dao->findByAssignedTo($this->app->user->account)->from(TABLE_BUG)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
$bugs = $this->dao->findByAssignedTo($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($type == 'openedbyme')
|
||||
elseif($browseType == 'openedbyme')
|
||||
{
|
||||
$bugs = $this->dao->findByOpenedBy($this->app->user->account)->from(TABLE_BUG)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
$bugs = $this->dao->findByOpenedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($type == 'resolvedbyme')
|
||||
elseif($browseType == 'resolvedbyme')
|
||||
{
|
||||
$bugs = $this->dao->findByResolvedBy($this->app->user->account)->from(TABLE_BUG)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
$bugs = $this->dao->findByResolvedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->eq($productID)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($type == 'assigntonull')
|
||||
elseif($browseType == 'assigntonull')
|
||||
{
|
||||
$bugs = $this->dao->findByAssignedTo('')->from(TABLE_BUG)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
$bugs = $this->dao->findByAssignedTo('')->from(TABLE_BUG)->andWhere('product')->eq($productID)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($type == 'longlifebugs')
|
||||
elseif($browseType == 'longlifebugs')
|
||||
{
|
||||
$bugs = $this->dao->findByLastEditedDate("<", date('Y-m-d', strtotime('-7 days')))->from(TABLE_BUG)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
$bugs = $this->dao->findByLastEditedDate("<", date('Y-m-d', strtotime('-7 days')))->from(TABLE_BUG)->andWhere('product')->eq($productID)->andWhere('status')->ne('closed')->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($type == 'postponedbugs')
|
||||
elseif($browseType == 'postponedbugs')
|
||||
{
|
||||
$bugs = $this->dao->findByResolution('postponed')->from(TABLE_BUG)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
$bugs = $this->dao->findByResolution('postponed')->from(TABLE_BUG)->andWhere('product')->eq($productID)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
elseif($type == 'byquery')
|
||||
elseif($browseType == 'bysearch')
|
||||
{
|
||||
if($this->session->bugQuery == false) $this->session->set('bugQuery', ' 1 = 1');
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where($this->session->bugQuery)->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
@@ -115,7 +117,7 @@ class bug extends control
|
||||
$this->assign('productID', $productID);
|
||||
$this->assign('productName', $this->products[$productID]);
|
||||
$this->assign('moduleTree', $this->tree->getTreeMenu($productID, $viewType = 'bug', $rooteModuleID = 0, array('treeModel', 'createBugLink')));
|
||||
$this->assign('type', $type);
|
||||
$this->assign('browseType', $browseType);
|
||||
$this->assign('bugs', $bugs);
|
||||
$this->assign('users', $users);
|
||||
$this->assign('recTotal', $pager->recTotal);
|
||||
|
||||
@@ -26,22 +26,24 @@
|
||||
<?php include '../../common/treeview.html.php';?>
|
||||
<?php include '../../common/colorize.html.php';?>
|
||||
<script language='Javascript'>
|
||||
/* 切换浏览方式。*/
|
||||
/* 通过模块浏览。*/
|
||||
function browseByModule(active)
|
||||
{
|
||||
$('#mainbox').addClass('yui-t7');
|
||||
$('#treebox').removeClass('hidden');
|
||||
$('#bymoduletab').addClass('active');
|
||||
$('#bymoduleTab').addClass('active');
|
||||
$('#querybox').addClass('hidden');
|
||||
$('#' + active + 'tab').removeClass('active');
|
||||
$('#' + active + 'Tab').removeClass('active');
|
||||
}
|
||||
function search(active)
|
||||
/* 搜索。*/
|
||||
function browseBySearch(active)
|
||||
{
|
||||
$('#mainbox').removeClass('yui-t7');
|
||||
$('#treebox').addClass('hidden');
|
||||
$('#querybox').removeClass('hidden');
|
||||
$('#byquerytab').addClass('active');
|
||||
$('#' + active + 'tab').removeClass('active');
|
||||
$('#bymoduleTab').removeClass('active');
|
||||
$('#' + active + 'Tab').removeClass('active');
|
||||
$('#bysearchTab').addClass('active');
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -50,22 +52,22 @@ function search(active)
|
||||
<div id='featurebar'>
|
||||
<div class='f-left'>
|
||||
<?php
|
||||
echo "<span id='bymoduletab' onclick=\"browseByModule('$type')\">" . $lang->bug->moduleBugs . "</span> ";
|
||||
echo "<span id='assigntometab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=assignToMe¶m=0"), $lang->bug->assignToMe) . "</span>";
|
||||
echo "<span id='openedbymetab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=openedByMe¶m=0"), $lang->bug->openedByMe) . "</span>";
|
||||
echo "<span id='resolvedbymetab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=resolvedByMe¶m=0"), $lang->bug->resolvedByMe) . "</span>";
|
||||
echo "<span id='assigntonulltab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=assignToNull¶m=0"), $lang->bug->assignToNull) . "</span>";
|
||||
echo "<span id='longlifebugstab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=longLifeBugs¶m=0"), $lang->bug->longLifeBugs) . "</span>";
|
||||
echo "<span id='postponedbugstab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=postponedBugs¶m=0"), $lang->bug->postponedBugs) . "</span>";
|
||||
echo "<span id='byquerytab' onclick=\"search('$type')\">{$lang->bug->byQuery}</span> ";
|
||||
echo "<span id='alltab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=all¶m=0"), $lang->bug->allBugs) . "</span>";
|
||||
echo "<span id='bymoduleTab' onclick=\"browseByModule('$browseType')\">" . $lang->bug->moduleBugs . "</span> ";
|
||||
echo "<span id='assigntomeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=assignToMe¶m=0"), $lang->bug->assignToMe) . "</span>";
|
||||
echo "<span id='openedbymeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=openedByMe¶m=0"), $lang->bug->openedByMe) . "</span>";
|
||||
echo "<span id='resolvedbymeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=resolvedByMe¶m=0"), $lang->bug->resolvedByMe) . "</span>";
|
||||
echo "<span id='assigntonullTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=assignToNull¶m=0"), $lang->bug->assignToNull) . "</span>";
|
||||
echo "<span id='longlifebugsTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=longLifeBugs¶m=0"), $lang->bug->longLifeBugs) . "</span>";
|
||||
echo "<span id='postponedbugsTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=postponedBugs¶m=0"), $lang->bug->postponedBugs) . "</span>";
|
||||
echo "<span id='bysearchTab' onclick=\"browseBySearch('$browseType')\">{$lang->bug->byQuery}</span> ";
|
||||
echo "<span id='allTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&type=all¶m=0&orderBy=$orderBy&recTotal=$recTotal&recPerPage=200"), $lang->bug->allBugs) . "</span>";
|
||||
?>
|
||||
</div>
|
||||
<div class='f-right'>
|
||||
<?php common::printLink('bug', 'create', "productID=$productID&moduleID=$moduleID", $lang->bug->create); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id='querybox' class='<?php if($type !='byquery') echo 'hidden';?>'><?php echo $searchForm;?></div>
|
||||
<div id='querybox' class='<?php if($browseType !='bysearch') echo 'hidden';?>'><?php echo $searchForm;?></div>
|
||||
</div>
|
||||
|
||||
<div class='yui-d0 <?php if($type == 'bymodule') echo 'yui-t7';?>' id='mainbox'>
|
||||
@@ -81,13 +83,13 @@ function search(active)
|
||||
|
||||
<div class="yui-main">
|
||||
<div class="yui-b">
|
||||
<?php $vars = "productID=$productID&type=$type¶m=$param&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage"; ?>
|
||||
<?php $vars = "productID=$productID&browseType=$browseType¶m=$param&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage"; ?>
|
||||
<table class='table-1 fixed colored'>
|
||||
<thead>
|
||||
<tr class='colhead'>
|
||||
<th><?php common::printOrderLink('id', $orderBy, $vars, $lang->bug->id);?></th>
|
||||
<th><?php common::printOrderLink('severity', $orderBy, $vars, $lang->bug->severity);?></th>
|
||||
<th class='w-p50'><?php common::printOrderLink('title', $orderBy, $vars, $lang->bug->title);?></th>
|
||||
<th class='w-p50'><?php common::printOrderLink('title', $orderBy, $vars, $lang->bug->title);?></th>
|
||||
<th><?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->bug->openedBy);?></th>
|
||||
<th><?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->bug->assignedTo);?></th>
|
||||
<th><?php common::printOrderLink('resolvedBy', $orderBy, $vars, $lang->bug->resolvedBy);?></th>
|
||||
@@ -113,7 +115,7 @@ function search(active)
|
||||
</div>
|
||||
</div>
|
||||
<script language='javascript'>
|
||||
$("#<?php echo $type;?>tab").addClass('active');
|
||||
$("#<?php echo $browseType;?>Tab").addClass('active');
|
||||
$("#module<?php echo $moduleID;?>").addClass('active');
|
||||
</script>
|
||||
<?php include '../../common/footer.html.php';?>
|
||||
|
||||
@@ -49,19 +49,19 @@ class product extends control
|
||||
}
|
||||
|
||||
/* 浏览某一个产品。*/
|
||||
public function browse($productID = 0, $queryType = 'byModule', $param = 0, $orderBy = 'id|desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
public function browse($productID = 0, $browseType = 'byModule', $param = 0, $orderBy = 'id|desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
/* 设置搜索条件。*/
|
||||
$this->config->product->search['actionURL'] = $this->createLink('product', 'browse', "productID=$productID&type=bySearch");
|
||||
$this->config->product->search['actionURL'] = $this->createLink('product', 'browse', "productID=$productID&browseType=bySearch");
|
||||
$this->view->searchForm = $this->fetch('search', 'buildForm', $this->config->product->search);
|
||||
|
||||
/* 设置查询格式。*/
|
||||
$queryType = strtolower($queryType);
|
||||
$browseType = strtolower($browseType);
|
||||
|
||||
/* 设置当前的产品id和模块id。*/
|
||||
$this->session->set('storyList', $this->app->getURI(true));
|
||||
$productID = common::saveProductState($productID, key($this->products));
|
||||
$moduleID = ($queryType == 'bymodule') ? (int)$param : 0;
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
|
||||
|
||||
/* 设置菜单。*/
|
||||
$this->product->setMenu($this->products, $productID);
|
||||
@@ -75,16 +75,16 @@ class product extends control
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$stories = array();
|
||||
if($queryType == 'all')
|
||||
if($browseType == 'all')
|
||||
{
|
||||
$stories = $this->story->getProductStories($productID, 0, 'all', $orderBy, $pager);
|
||||
}
|
||||
elseif($queryType == 'bymodule')
|
||||
elseif($browseType == 'bymodule')
|
||||
{
|
||||
$childModuleIds = $this->tree->getAllChildID($moduleID);
|
||||
$stories = $this->story->getProductStories($productID, $childModuleIds, 'all', $orderBy, $pager);
|
||||
}
|
||||
elseif($queryType == 'bysearch')
|
||||
elseif($browseType == 'bysearch')
|
||||
{
|
||||
if($this->session->storyQuery == false) $this->session->set('storyQuery', ' 1 = 1');
|
||||
$stories = $this->story->getByQuery($this->session->storyQuery, $orderBy, $pager);
|
||||
@@ -99,7 +99,7 @@ class product extends control
|
||||
$this->assign('pager', $pager);
|
||||
$this->assign('users', $this->user->getPairs($this->app->company->id, 'noletter'));
|
||||
$this->assign('orderBy', $orderBy);
|
||||
$this->assign('queryType', $queryType);
|
||||
$this->assign('browseType', $browseType);
|
||||
$this->assign('moduleID', $moduleID);
|
||||
|
||||
$this->display();
|
||||
|
||||
@@ -52,18 +52,18 @@ function search(active)
|
||||
<div id='featurebar'>
|
||||
<div class='f-left'>
|
||||
<span id='bymoduleTab' onclick='browseByModule()'><?php echo $lang->product->moduleStory;?></span>
|
||||
<span id='bysearchTab' onclick='search("<?php echo $queryType;?>")'><?php echo $lang->product->searchStory;?></span>
|
||||
<span id='allTab'><?php echo html::a($this->createLink('product', 'browse', "productID=$productID&type=all"), $lang->product->allStory);?></span>
|
||||
<span id='bysearchTab' onclick='search("<?php echo $browseType;?>")'><?php echo $lang->product->searchStory;?></span>
|
||||
<span id='allTab'><?php echo html::a($this->createLink('product', 'browse', "productID=$productID&browseType=all¶m=0&orderBy=$orderBy&recTotal={$pager->recTotal}&recPerPage=200"), $lang->product->allStory);?></span>
|
||||
</div>
|
||||
<div class='f-right'>
|
||||
<?php if(common::hasPriv('story', 'create')) echo html::a($this->createLink('story', 'create', "productID=$productID&moduleID=$moduleID"), $lang->story->create); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id='querybox' class='<?php if($queryType !='bysearch') echo 'hidden';?>'><?php echo $searchForm;?></div>
|
||||
<div id='querybox' class='<?php if($browseType !='bysearch') echo 'hidden';?>'><?php echo $searchForm;?></div>
|
||||
</div>
|
||||
|
||||
<div class='yui-d0 <?php if($queryType == 'bymodule') echo 'yui-t7';?>' id='mainbox'>
|
||||
<div class='yui-b <?php if($queryType != 'bymodule') echo 'hidden';?>' id='treebox'>
|
||||
<div class='yui-d0 <?php if($browseType == 'bymodule') echo 'yui-t7';?>' id='mainbox'>
|
||||
<div class='yui-b <?php if($browseType != 'bymodule') echo 'hidden';?>' id='treebox'>
|
||||
<div class='box-title'><?php echo $productName;?></div>
|
||||
<div class='box-content'>
|
||||
<?php echo $moduleTree;?>
|
||||
@@ -80,7 +80,7 @@ function search(active)
|
||||
<table class='table-1 fixed colored'>
|
||||
<thead>
|
||||
<tr class='colhead'>
|
||||
<?php $vars = "productID=$productID&type=$queryType¶m=$moduleID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
|
||||
<?php $vars = "productID=$productID&browseType=$browseType¶m=$moduleID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
|
||||
<th><?php common::printOrderLink('id', $orderBy, $vars, $lang->story->id);?></th>
|
||||
<th><?php common::printOrderLink('pri', $orderBy, $vars, $lang->story->pri);?></th>
|
||||
<th class='w-p40'><?php common::printOrderLink('title', $orderBy, $vars, $lang->story->title);?></th>
|
||||
@@ -123,6 +123,6 @@ function search(active)
|
||||
</div>
|
||||
<script language='javascript'>
|
||||
$('#module<?php echo $moduleID;?>').addClass('active')
|
||||
$('#<?php echo $queryType;?>Tab').addClass('active')
|
||||
$('#<?php echo $browseType;?>Tab').addClass('active')
|
||||
</script>
|
||||
<?php include '../../common/footer.html.php';?>
|
||||
|
||||
@@ -53,7 +53,7 @@ function browseBySearch(active)
|
||||
<?php
|
||||
echo "<span id='bymoduleTab' onclick=\"browseByModule('$browseType')\">" . $lang->testcase->moduleCases . "</span> ";
|
||||
echo "<span id='bysearchTab' onclick=\"browseBySearch('$browseType')\">{$lang->testcase->bySearch}</span> ";
|
||||
echo "<span id='allTab'>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&browseType=all¶m=0&orderBy=$orderBy&recTotal=0&recPerPage=500"), $lang->testcase->allCases) . "</span>";
|
||||
echo "<span id='allTab'>" . html::a($this->createLink('testcase', 'browse', "productid=$productID&browseType=all¶m=0&orderBy=$orderBy&recTotal=0&recPerPage=200"), $lang->testcase->allCases) . "</span>";
|
||||
?>
|
||||
</div>
|
||||
<div class='f-right'>
|
||||
|
||||
Reference in New Issue
Block a user