* finish task #7256.
This commit is contained in:
@@ -766,7 +766,7 @@ class bug extends control
|
||||
$branchProduct = $product->type == 'normal' ? false : true;
|
||||
|
||||
/* Set plans. */
|
||||
$plans = $this->loadModel('productplan')->getPairs($productID, $branch);
|
||||
$plans = $this->loadModel('productplan')->getPairs($productID, $branch);
|
||||
$plans = array('' => '', 'ditto' => $this->lang->bug->ditto) + $plans;
|
||||
|
||||
/* Set product menu. */
|
||||
|
||||
@@ -21,7 +21,6 @@ $(function()
|
||||
if(page == 'create' || page == 'edit' || page == 'assignedto' || page == 'confirmbug')
|
||||
{
|
||||
oldProductID = $('#product').val();
|
||||
$("#story, #task, #mailto").chosen();
|
||||
}
|
||||
|
||||
if(window.flow != 'full')
|
||||
@@ -48,7 +47,7 @@ function loadAll(productID)
|
||||
setAssignedTo();
|
||||
}
|
||||
|
||||
if(!changeProductConfirmed)
|
||||
if(typeof(changeProductConfirmed) != 'undefined' && !changeProductConfirmed)
|
||||
{
|
||||
firstChoice = confirm(confirmChangeProduct);
|
||||
changeProductConfirmed = true; // Only notice the user one time.
|
||||
|
||||
+18
-4
@@ -1428,10 +1428,11 @@ class bugModel extends model
|
||||
* @param int $param
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param array $excludeBugs
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectBugs($projectID, $build = 0, $type = '', $param = 0, $orderBy = 'id_desc', $pager = null)
|
||||
public function getProjectBugs($projectID, $build = 0, $type = '', $param = 0, $orderBy = 'id_desc', $pager = null, $excludeBugs = array())
|
||||
{
|
||||
$type = strtolower($type);
|
||||
if($type == 'bysearch')
|
||||
@@ -1461,6 +1462,7 @@ class bugModel extends model
|
||||
->where($bugQuery)
|
||||
->andWhere('project')->eq((int)$projectID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi()
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
@@ -1471,7 +1473,9 @@ class bugModel extends model
|
||||
->where('deleted')->eq(0)
|
||||
->beginIF(empty($build))->andWhere('project')->eq($projectID)->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()
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
}
|
||||
|
||||
@@ -1485,10 +1489,13 @@ class bugModel extends model
|
||||
*
|
||||
* @param int $build
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param string $linkedBugs
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProductLeftBugs($build, $productID, $branch = 0)
|
||||
public function getProductLeftBugs($build, $productID, $branch = 0, $linkedBugs = '', $pager = null)
|
||||
{
|
||||
$build = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq($build)->fetch();
|
||||
if(empty($build->project)) return array();
|
||||
@@ -1510,7 +1517,9 @@ class bugModel extends model
|
||||
->andWhere('openedDate')->le($project->end)
|
||||
->andWhere("(status = 'active' OR resolvedDate > '{$project->end}')")
|
||||
->andWhere('openedBuild')->notin($beforeBuilds)
|
||||
->beginIF($linkedBugs)->andWhere('id')->notIN($linkedBugs)->fi()
|
||||
->beginIF($branch)->andWhere('branch')->in("0,$branch")->fi()
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
|
||||
return $bugs;
|
||||
@@ -1547,7 +1556,7 @@ class bugModel extends model
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getReleaseBugs($buildID, $productID, $branch = 0)
|
||||
public function getReleaseBugs($buildID, $productID, $branch = 0, $linkedBugs = '', $pager = null)
|
||||
{
|
||||
$project = $this->dao->select('t1.id,t1.begin')->from(TABLE_PROJECT)->alias('t1')
|
||||
->leftJoin(TABLE_BUILD)->alias('t2')->on('t1.id = t2.project')
|
||||
@@ -1557,10 +1566,12 @@ class bugModel extends model
|
||||
->where('resolvedDate')->ge($project->begin)
|
||||
->andWhere('resolution')->ne('postponed')
|
||||
->andWhere('product')->eq($productID)
|
||||
->beginIF($linkedBugs)->andWhere('id')->notIN($linkedBugs)->fi()
|
||||
->beginIF($branch)->andWhere('branch')->in("0,$branch")->fi()
|
||||
->andWhere("(project != '$project->id' OR (project = '$project->id' and openedDate < '$project->begin'))")
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy('openedDate ASC')
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
return $bugs;
|
||||
}
|
||||
@@ -2303,10 +2314,12 @@ class bugModel extends model
|
||||
* @param int $queryID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param int $branch
|
||||
* @param array $excludeBugs
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBySearch($productID, $queryID, $orderBy, $pager = null, $branch = 0)
|
||||
public function getBySearch($productID, $queryID, $orderBy, $pager = null, $branch = 0, $excludeBugs = '')
|
||||
{
|
||||
if($queryID)
|
||||
{
|
||||
@@ -2345,6 +2358,7 @@ class bugModel extends model
|
||||
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where($bugQuery)
|
||||
->beginIF(!$this->app->user->admin)->andWhere('project')->in('0,' . $this->app->user->view->projects)->fi()
|
||||
->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->orderBy($orderBy)->page($pager)->fetchAll();
|
||||
return $bugs;
|
||||
|
||||
+48
-25
@@ -185,10 +185,17 @@ class build extends control
|
||||
* View a build.
|
||||
*
|
||||
* @param int $buildID
|
||||
* @param string $type
|
||||
* @param string $link
|
||||
* @param string $param
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function view($buildID, $type = 'story', $link = 'false', $param = '', $orderBy = 'id_desc')
|
||||
public function view($buildID, $type = 'story', $link = 'false', $param = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 100, $pageID = 1)
|
||||
{
|
||||
if($type == 'story')$this->session->set('storyList', $this->app->getURI(true));
|
||||
if($type == 'bug') $this->session->set('bugList', $this->app->getURI(true));
|
||||
@@ -196,6 +203,10 @@ class build extends control
|
||||
$this->loadModel('story');
|
||||
$this->loadModel('bug');
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
|
||||
|
||||
/* Set menu. */
|
||||
$build = $this->build->getById((int)$buildID, true);
|
||||
if(!$build) die(js::error($this->lang->notFound) . js::locate('back'));
|
||||
@@ -203,8 +214,10 @@ class build extends control
|
||||
$product = $this->loadModel('product')->getById($build->product);
|
||||
if($product->type != 'normal') $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
|
||||
|
||||
$bugPager = new pager($type == 'bug' ? $recTotal : 0, $recPerPage, $type == 'bug' ? $pageID : 1);
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($build->bugs)->andWhere('deleted')->eq(0)
|
||||
->beginIF($type == 'bug')->orderBy($orderBy)->fi()
|
||||
->page($bugPager)
|
||||
->fetchAll();
|
||||
|
||||
if($this->config->global->flow == 'onlyTest')
|
||||
@@ -219,8 +232,10 @@ class build extends control
|
||||
}
|
||||
else
|
||||
{
|
||||
$storyPager = new pager($type == 'story' ? $recTotal : 0, $recPerPage, $type == 'story' ? $pageID : 1);
|
||||
$stories = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($build->stories)->andWhere('deleted')->eq(0)
|
||||
->beginIF($type == 'story')->orderBy($orderBy)->fi()
|
||||
->page($storyPager)
|
||||
->fetchAll('id');
|
||||
$stages = $this->dao->select('*')->from(TABLE_STORYSTAGE)->where('story')->in($build->stories)->andWhere('branch')->eq($build->branch)->fetchPairs('story', 'stage');
|
||||
foreach($stages as $storyID => $stage)$stories[$storyID]->stage = $stage;
|
||||
@@ -232,9 +247,11 @@ class build extends control
|
||||
$this->view->position[] = html::a($this->createLink('project', 'task', "projectID=$build->project"), $projects[$build->project]);
|
||||
$this->view->position[] = $this->lang->build->view;
|
||||
$this->view->stories = $stories;
|
||||
$this->view->generatedBugs = $this->bug->getProjectBugs($build->project, $build->id, '', 0, $type == 'newbug' ? $orderBy : 'status_desc,id_desc', null);
|
||||
$this->view->bugs = $bugs;
|
||||
$this->view->type = $type;
|
||||
$this->view->storyPager = $storyPager;
|
||||
|
||||
$newBugPager = new pager($type == 'newbug' ? $recTotal : 0, $recPerPage, $type == 'newbug' ? $pageID : 1);
|
||||
$this->view->generatedBugs = $this->bug->getProjectBugs($build->project, $build->id, '', 0, $type == 'newbug' ? $orderBy : 'status_desc,id_desc', $newBugPager);
|
||||
$this->view->newBugPager = $newBugPager;
|
||||
}
|
||||
|
||||
$this->executeHooks($buildID);
|
||||
@@ -247,6 +264,9 @@ class build extends control
|
||||
$this->view->link = $link;
|
||||
$this->view->param = $param;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->bugs = $bugs;
|
||||
$this->view->type = $type;
|
||||
$this->view->bugPager = $bugPager;
|
||||
$this->view->branchName = $build->productType == 'normal' ? '' : $this->loadModel('branch')->getById($build->branch);
|
||||
$this->display();
|
||||
}
|
||||
@@ -402,10 +422,13 @@ class build extends control
|
||||
* @param int $buildID
|
||||
* @param string $browseType
|
||||
* @param int $param
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkStory($buildID = 0, $browseType = '', $param = 0)
|
||||
public function linkStory($buildID = 0, $browseType = '', $param = 0, $recTotal = 0, $recPerPage = 100, $pageID = 1)
|
||||
{
|
||||
if(!empty($_POST['stories']))
|
||||
{
|
||||
@@ -421,6 +444,11 @@ class build extends control
|
||||
$this->loadModel('tree');
|
||||
$this->loadModel('product');
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
/* Build search form. */
|
||||
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
|
||||
unset($this->config->product->search['fields']['product']);
|
||||
@@ -447,11 +475,11 @@ class build extends control
|
||||
|
||||
if($browseType == 'bySearch')
|
||||
{
|
||||
$allStories = $this->story->getBySearch($build->product, $queryID, 'id', null, $build->project, $build->branch);
|
||||
$allStories = $this->story->getBySearch($build->product, $queryID, 'id', $pager, $build->project, $build->branch, 'story', $build->stories);
|
||||
}
|
||||
else
|
||||
{
|
||||
$allStories = $this->story->getProjectStories($build->project);
|
||||
$allStories = $this->story->getProjectStories($build->project, 't1.`order`_desc', 'byModule', 0, $pager, 'story', $build->stories);
|
||||
}
|
||||
|
||||
$this->view->allStories = $allStories;
|
||||
@@ -460,6 +488,7 @@ class build extends control
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->pager = $pager;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -512,10 +541,13 @@ class build extends control
|
||||
* @param int $buildID
|
||||
* @param string $browseType
|
||||
* @param int $param
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkBug($buildID = 0, $browseType = '', $param = 0)
|
||||
public function linkBug($buildID = 0, $browseType = '', $param = 0, $recTotal = 0, $recPerPage = 100, $pageID = 1)
|
||||
{
|
||||
if(!empty($_POST['bugs']))
|
||||
{
|
||||
@@ -529,6 +561,11 @@ class build extends control
|
||||
$product = $this->loadModel('product')->getByID($build->product);
|
||||
$this->loadModel('project')->setMenu($this->project->getPairs(), $build->project);
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
|
||||
/* Build the search form. */
|
||||
@@ -560,33 +597,19 @@ class build extends control
|
||||
|
||||
if($browseType == 'bySearch')
|
||||
{
|
||||
$allBugs = $this->bug->getBySearch($build->product, $queryID, 'id_desc', null, $build->branch);
|
||||
$allBugs = $this->bug->getBySearch($build->product, $queryID, 'id_desc', $pager, $build->branch, $build->bugs);
|
||||
}
|
||||
else
|
||||
{
|
||||
$projectBugs = $this->bug->getProjectBugs($build->project);
|
||||
$allBugs = array();
|
||||
foreach($projectBugs as $key => $bug)
|
||||
{
|
||||
if($bug->status == 'resolved')
|
||||
{
|
||||
$allBugs[$key] = $bug;
|
||||
unset($projectBugs[$key]);
|
||||
}
|
||||
elseif($bug->status == 'closed')
|
||||
{
|
||||
unset($projectBugs[$key]);
|
||||
}
|
||||
}
|
||||
$allBugs += $projectBugs;
|
||||
$allBugs = $this->bug->getProjectBugs($build->project, 0, 'noclosed', 0, 'status_desc,id_desc', $pager, $build->bugs);
|
||||
}
|
||||
|
||||
$this->view->allBugs = $allBugs;
|
||||
$this->view->buildBugs = empty($build->bugs) ? array() : $this->bug->getByList($build->bugs);
|
||||
$this->view->build = $build;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->pager = $pager;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
+33
-4
@@ -1,16 +1,45 @@
|
||||
function showLink(buildID, type, param)
|
||||
{
|
||||
var method = type == 'story' ? 'linkStory' : 'linkBug';
|
||||
$.get(createLink('build', method, 'buildID=' + buildID + (typeof(param) == 'undefined' ? '' : param)), function(data)
|
||||
loadURL(createLink('build', method, 'buildID=' + buildID + param), type);
|
||||
|
||||
$('.actions').find("a[href*='" + type + "']").addClass('hidden');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load URL.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function loadURL(url, type)
|
||||
{
|
||||
$.get(url, function(data)
|
||||
{
|
||||
var $pane = $(type == 'story' ? '#stories' : '#bugs');
|
||||
$pane.find('.main-table').hide();
|
||||
var $linkBox = $pane.find('.linkBox').html(data).removeClass('hidden');
|
||||
var $linkBox = $pane.find('.linkBox');
|
||||
$linkBox.html(data).removeClass('hidden');
|
||||
$linkBox.find('[data-ride="table"]').table();
|
||||
$linkBox.find('[data-ride="pager"]').pager();
|
||||
$linkBox.find('[data-ride="pager"] li a.pager-item').click(function()
|
||||
{
|
||||
loadURL($(this).attr('href'), type);
|
||||
return false;
|
||||
});
|
||||
$linkBox.find('[data-ride="pager"] .pager-size-menu a[data-size]').off('click');
|
||||
$linkBox.find('[data-ride="pager"] .pager-size-menu a[data-size]').click(function()
|
||||
{
|
||||
line = $linkBox.find('[data-ride="pager"]').attr('data-link-creator');
|
||||
line = line.replace('{recPerPage}', $(this).attr('data-size')).replace('{page}', $linkBox.find('[data-ride="pager"]').attr('data-page'));
|
||||
$.cookie($linkBox.find('[data-ride="pager"]').attr('data-page-cookie'), $(this).attr('data-size'), {expires:config.cookieLife, path:config.webRoot});
|
||||
loadURL(line, type);
|
||||
return false;
|
||||
});
|
||||
$.toggleQueryBox(true, $linkBox.find('#queryBox'));
|
||||
});
|
||||
|
||||
$('.actions').find("a[href*='" + type + "']").addClass('hidden');
|
||||
}
|
||||
|
||||
$(function()
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
<?php echo html::a(inlink('view', "buildID={$build->id}&type=bug"), $lang->goback, '', "class='btn'");?>
|
||||
</div>
|
||||
<div class='table-statistic'></div>
|
||||
<?php $pager->show('right', 'pagerjs');?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</form>
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
<?php echo html::a(inlink('view', "buildID={$build->id}&type=story"), $lang->goback, '', "class='btn'");?>
|
||||
</div>
|
||||
<div class='table-statistic'></div>
|
||||
<?php $pager->show('right', 'pagerjs');?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</form>
|
||||
|
||||
@@ -157,8 +157,8 @@ tbody tr td:first-child input{display:none;}
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if($countStories):?>
|
||||
<div class='table-footer'>
|
||||
<?php if($countStories):?>
|
||||
<?php if($canBatchUnlink):?>
|
||||
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
|
||||
<div class="table-actions btn-toolbar">
|
||||
@@ -166,8 +166,13 @@ tbody tr td:first-child input{display:none;}
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div class='table-statistic'><?php echo sprintf($lang->build->finishStories, $countStories);?></div>
|
||||
<?php endif;?>
|
||||
<?php
|
||||
$this->app->rawParams['type'] = 'story';
|
||||
$storyPager->show('right', 'pagerjs');
|
||||
$this->app->rawParams['type'] = $type;
|
||||
?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</form>
|
||||
</div>
|
||||
<div class='tab-pane <?php if($type == 'bug') echo 'active'?>' id='bugs'>
|
||||
@@ -231,8 +236,8 @@ tbody tr td:first-child input{display:none;}
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if($countBugs):?>
|
||||
<div class='table-footer'>
|
||||
<?php if($countBugs):?>
|
||||
<?php if($canBatchUnlink):?>
|
||||
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
|
||||
<div class="table-actions btn-toolbar">
|
||||
@@ -240,12 +245,17 @@ tbody tr td:first-child input{display:none;}
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div class='text'><?php echo sprintf($lang->build->resolvedBugs, $countBugs);?></div>
|
||||
<?php endif;?>
|
||||
<?php
|
||||
$this->app->rawParams['type'] = 'bug';
|
||||
$bugPager->show('right', 'pagerjs');
|
||||
$this->app->rawParams['type'] = $type;
|
||||
?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</form>
|
||||
</div>
|
||||
<div class='tab-pane <?php if($type == 'newbug') echo 'active'?>' id='newBugs'>
|
||||
<div class='main-table'>
|
||||
<div class='main-table' data-ride='table'>
|
||||
<table class='table has-sort-head'>
|
||||
<?php $vars = "buildID={$build->id}&type=newbug&link=$link¶m=$param&orderBy=%s";?>
|
||||
<thead>
|
||||
@@ -297,11 +307,16 @@ tbody tr td:first-child input{display:none;}
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if($countNewBugs):?>
|
||||
<div class='table-footer'>
|
||||
<?php if($countNewBugs):?>
|
||||
<div class='text'><?php echo sprintf($lang->build->createdBugs, $countNewBugs);?></div>
|
||||
<?php endif;?>
|
||||
<?php
|
||||
$this->app->rawParams['type'] = 'newbug';
|
||||
$newBugPager->show('right', 'pagerjs');
|
||||
$this->app->rawParams['type'] = $type;
|
||||
?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='tab-pane <?php if($type == 'buildInfo') echo 'active'?>' id='buildInfo'>
|
||||
|
||||
+45
-10
@@ -136,10 +136,13 @@ class release extends control
|
||||
* @param string $link
|
||||
* @param string $param
|
||||
* @param string $orderBy
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function view($releaseID, $type = 'story', $link = 'false', $param = '', $orderBy = 'id_desc')
|
||||
public function view($releaseID, $type = 'story', $link = 'false', $param = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 100, $pageID = 1)
|
||||
{
|
||||
if($type == 'story') $this->session->set('storyList', $this->app->getURI(true));
|
||||
if($type == 'bug' or $type == 'leftBug') $this->session->set('bugList', $this->app->getURI(true));
|
||||
@@ -147,24 +150,34 @@ class release extends control
|
||||
$this->loadModel('story');
|
||||
$this->loadModel('bug');
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
|
||||
|
||||
$release = $this->release->getById((int)$releaseID, true);
|
||||
if(!$release) die(js::error($this->lang->notFound) . js::locate('back'));
|
||||
|
||||
$storyPager = new pager($type == 'story' ? $recTotal : 0, $recPerPage, $type == 'story' ? $pageID : 1);
|
||||
$stories = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($release->stories)->andWhere('deleted')->eq(0)
|
||||
->beginIF($type == 'story')->orderBy($orderBy)->fi()
|
||||
->page($storyPager)
|
||||
->fetchAll('id');
|
||||
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'story');
|
||||
$stages = $this->dao->select('*')->from(TABLE_STORYSTAGE)->where('story')->in($release->stories)->andWhere('branch')->eq($release->branch)->fetchPairs('story', 'stage');
|
||||
foreach($stages as $storyID => $stage)$stories[$storyID]->stage = $stage;
|
||||
|
||||
$bugPager = new pager($type == 'bug' ? $recTotal : 0, $recPerPage, $type == 'bug' ? $pageID : 1);
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($release->bugs)->andWhere('deleted')->eq(0)
|
||||
->beginIF($type == 'bug')->orderBy($orderBy)->fi()
|
||||
->page($bugPager)
|
||||
->fetchAll();
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'linkedBug');
|
||||
|
||||
$leftBugPager = new pager($type == 'leftBug' ? $recTotal : 0, $recPerPage, $type == 'leftBug' ? $pageID : 1);
|
||||
$leftBugs = $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($release->leftBugs)->andWhere('deleted')->eq(0)
|
||||
->beginIF($type == 'leftBug')->orderBy($orderBy)->fi()
|
||||
->page($leftBugPager)
|
||||
->fetchAll();
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'leftBugs');
|
||||
|
||||
@@ -186,6 +199,9 @@ class release extends control
|
||||
$this->view->param = $param;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->branchName = $release->productType == 'normal' ? '' : $this->loadModel('branch')->getById($release->branch);
|
||||
$this->view->storyPager = $storyPager;
|
||||
$this->view->bugPager = $bugPager;
|
||||
$this->view->leftBugPager = $leftBugPager;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -349,10 +365,13 @@ class release extends control
|
||||
* @param int $releaseID
|
||||
* @param string $browseType
|
||||
* @param int $param
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkStory($releaseID = 0, $browseType = '', $param = 0)
|
||||
public function linkStory($releaseID = 0, $browseType = '', $param = 0, $recTotal = 0, $recPerPage = 100, $pageID = 1)
|
||||
{
|
||||
if(!empty($_POST['stories']))
|
||||
{
|
||||
@@ -368,6 +387,11 @@ class release extends control
|
||||
$this->loadModel('tree');
|
||||
$this->loadModel('product');
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
/* Build search form. */
|
||||
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
|
||||
unset($this->config->product->search['fields']['product']);
|
||||
@@ -394,11 +418,11 @@ class release extends control
|
||||
|
||||
if($browseType == 'bySearch')
|
||||
{
|
||||
$allStories = $this->story->getBySearch($release->product, $queryID, 'id', null, $build->project ? $build->project : '', $release->branch);
|
||||
$allStories = $this->story->getBySearch($release->product, $queryID, 'id', $pager, $build->project ? $build->project : '', $release->branch, 'story', $release->stories);
|
||||
}
|
||||
else
|
||||
{
|
||||
$allStories = $this->story->getProjectStories($build->project);
|
||||
$allStories = $this->story->getProjectStories($build->project, 't1.`order`_desc', 'byModule', 0, $pager, 'story', $release->stories);
|
||||
}
|
||||
|
||||
$this->view->allStories = $allStories;
|
||||
@@ -407,6 +431,7 @@ class release extends control
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->pager = $pager;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -459,10 +484,14 @@ class release extends control
|
||||
* @param int $releaseID
|
||||
* @param string $browseType
|
||||
* @param int $param
|
||||
* @param string $type
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function linkBug($releaseID = 0, $browseType = '', $param = 0, $type = 'bug')
|
||||
public function linkBug($releaseID = 0, $browseType = '', $param = 0, $type = 'bug', $recTotal = 0, $recPerPage = 100, $pageID = 1)
|
||||
{
|
||||
if(!empty($_POST['bugs']))
|
||||
{
|
||||
@@ -476,6 +505,11 @@ class release extends control
|
||||
$build = $this->loadModel('build')->getByID($release->build);
|
||||
$this->commonAction($release->product);
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
/* Build the search form. */
|
||||
$this->loadModel('bug');
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
@@ -502,24 +536,24 @@ class release extends control
|
||||
}
|
||||
$this->loadModel('search')->setSearchParams($this->config->bug->search);
|
||||
|
||||
$allBugs = array();
|
||||
$allBugs = array();
|
||||
$releaseBugs = $type == 'bug' ? $release->bugs : $release->leftBugs;
|
||||
if($browseType == 'bySearch')
|
||||
{
|
||||
$allBugs = $this->bug->getBySearch($release->product, $queryID, 'id_desc', null, $release->branch);
|
||||
$allBugs = $this->bug->getBySearch($release->product, $queryID, 'id_desc', $pager, $release->branch, $releaseBugs);
|
||||
}
|
||||
elseif($build->project)
|
||||
{
|
||||
if($type == 'bug')
|
||||
{
|
||||
$allBugs = $this->bug->getReleaseBugs($build->id, $release->product, $release->branch);
|
||||
$allBugs = $this->bug->getReleaseBugs($build->id, $release->product, $release->branch, $releaseBugs, $pager);
|
||||
}
|
||||
elseif($type == 'leftBug')
|
||||
{
|
||||
$allBugs = $this->bug->getProductLeftBugs($build->id, $release->product, $release->branch);
|
||||
$allBugs = $this->bug->getProductLeftBugs($build->id, $release->product, $release->branch, $releaseBugs, $pager);
|
||||
}
|
||||
}
|
||||
|
||||
$releaseBugs = $type == 'bug' ? $release->bugs : $release->leftBugs;
|
||||
$this->view->allBugs = $allBugs;
|
||||
$this->view->releaseBugs = empty($releaseBugs) ? array() : $this->bug->getByList($releaseBugs);
|
||||
$this->view->release = $release;
|
||||
@@ -527,6 +561,7 @@ class release extends control
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->type = $type;
|
||||
$this->view->pager = $pager;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,16 +3,45 @@ function showLink(releaseID, type, param)
|
||||
var method = type == 'story' ? 'linkStory' : 'linkBug';
|
||||
if(typeof(param) == 'undefined') param = '&browseType=' + type + '¶m=0';
|
||||
if(type == 'leftBug') param += '&type=leftBug';
|
||||
$.get(createLink('release', method, 'releaseID=' + releaseID + param), function(data)
|
||||
loadURL(createLink('release', method, 'releaseID=' + releaseID + param), type);
|
||||
|
||||
$('.actions').find("a[href*='" + type + "']").addClass('hidden');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load URL.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string$type
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function loadURL(url, type)
|
||||
{
|
||||
$.get(url, function(data)
|
||||
{
|
||||
var $pane = $(type == 'story' ? '#stories' : (type == 'leftBug' ? '#leftBugs' : '#bugs'));
|
||||
$pane.find('.main-table').hide();
|
||||
var $linkBox = $pane.find('.linkBox').html(data).removeClass('hidden');
|
||||
var $linkBox = $pane.find('.linkBox');
|
||||
$linkBox.html(data).removeClass('hidden');
|
||||
$linkBox.find('[data-ride="table"]').table();
|
||||
$linkBox.find('[data-ride="pager"]').pager();
|
||||
$linkBox.find('[data-ride="pager"] li a.pager-item').click(function()
|
||||
{
|
||||
loadURL($(this).attr('href'), type);
|
||||
return false;
|
||||
});
|
||||
$linkBox.find('[data-ride="pager"] .pager-size-menu a[data-size]').off('click');
|
||||
$linkBox.find('[data-ride="pager"] .pager-size-menu a[data-size]').click(function()
|
||||
{
|
||||
line = $linkBox.find('[data-ride="pager"]').attr('data-link-creator');
|
||||
line = line.replace('{recPerPage}', $(this).attr('data-size')).replace('{page}', $linkBox.find('[data-ride="pager"]').attr('data-page'));
|
||||
$.cookie($linkBox.find('[data-ride="pager"]').attr('data-page-cookie'), $(this).attr('data-size'), {expires:config.cookieLife, path:config.webRoot});
|
||||
loadURL(line, type);
|
||||
return false;
|
||||
});
|
||||
$.toggleQueryBox(true, $linkBox.find('#queryBox'));
|
||||
});
|
||||
|
||||
$('.actions').find("a[href*='" + type + "']").addClass('hidden');
|
||||
}
|
||||
|
||||
$(function()
|
||||
|
||||
@@ -69,6 +69,7 @@ $formID = $type == 'leftBug' ? 'unlinkedLeftBugsForm' : 'unlinkedBugsForm';
|
||||
<?php echo html::a(inlink('view', "releaseID=$release->id&type=$type"), $lang->goback, '', "class='btn'");?>
|
||||
</div>
|
||||
<div class='table-statistic'></div>
|
||||
<?php $pager->show('right', 'pagerjs');?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
<?php echo html::a(inlink('view', "releaseID=$release->id&type=story"), $lang->goback, '', "class='btn'");?>
|
||||
</div>
|
||||
<div class='table-statistic'></div>
|
||||
<?php $pager->show('right', 'pagerjs');?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -130,8 +130,8 @@
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if($countStories and $canBatchUnlink):?>
|
||||
<div class='table-footer'>
|
||||
<?php if($countStories and $canBatchUnlink):?>
|
||||
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
|
||||
<div class="table-actions btn-toolbar">
|
||||
<?php
|
||||
@@ -149,8 +149,13 @@
|
||||
?>
|
||||
</div>
|
||||
<div class='text'><?php echo sprintf($lang->release->finishStories, $countStories);?></div>
|
||||
<?php endif;?>
|
||||
<?php
|
||||
$this->app->rawParams['type'] = 'story';
|
||||
$storyPager->show('right', 'pagerjs');
|
||||
$this->app->rawParams['type'] = $type;
|
||||
?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</form>
|
||||
</div>
|
||||
<div class='tab-pane <?php if($type == 'bug') echo 'active'?>' id='bugs'>
|
||||
@@ -215,15 +220,20 @@
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if($countBugs and $canBatchUnlink):?>
|
||||
<div class='table-footer'>
|
||||
<?php if($countBugs and $canBatchUnlink):?>
|
||||
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
|
||||
<div class="table-actions btn-toolbar">
|
||||
<?php echo html::submitButton($lang->release->batchUnlink, '', 'btn');?>
|
||||
</div>
|
||||
<div class='text'><?php echo sprintf($lang->release->resolvedBugs, $countBugs);?></div>
|
||||
<?php endif;?>
|
||||
<?php
|
||||
$this->app->rawParams['type'] = 'bug';
|
||||
$bugPager->show('right', 'pagerjs');
|
||||
$this->app->rawParams['type'] = $type;
|
||||
?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</form>
|
||||
</div>
|
||||
<div class='tab-pane <?php if($type == 'leftBug') echo 'active'?>' id='leftBugs'>
|
||||
@@ -301,15 +311,20 @@
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if($countLeftBugs and $canBatchUnlink):?>
|
||||
<div class='table-footer'>
|
||||
<?php if($countLeftBugs and $canBatchUnlink):?>
|
||||
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
|
||||
<div class="table-actions btn-toolbar">
|
||||
<?php echo html::submitButton($lang->release->batchUnlink, '', 'btn');?>
|
||||
</div>
|
||||
<div class='text'><?php echo sprintf($lang->release->createdBugs, $countLeftBugs);?></div>
|
||||
<?php endif;?>
|
||||
<?php
|
||||
$this->app->rawParams['type'] = 'leftBug';
|
||||
$leftBugPager->show('right', 'pagerjs');
|
||||
$this->app->rawParams['type'] = $type;
|
||||
?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
+10
-2
@@ -1817,10 +1817,11 @@ class storyModel extends model
|
||||
* @param string $projectID
|
||||
* @param int $branch
|
||||
* @param string $type requirement|story
|
||||
* @param string $excludeStories
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBySearch($productID, $queryID, $orderBy, $pager = null, $projectID = '', $branch = 0, $type = 'story')
|
||||
public function getBySearch($productID, $queryID, $orderBy, $pager = null, $projectID = '', $branch = 0, $type = 'story', $excludeStories = '')
|
||||
{
|
||||
if($projectID != '')
|
||||
{
|
||||
@@ -1849,6 +1850,7 @@ class storyModel extends model
|
||||
$queryProductID = 'all';
|
||||
}
|
||||
$storyQuery = $storyQuery . ' AND `product` ' . helper::dbIN(array_keys($products));
|
||||
if($excludeStories) $storyQuery = $storyQuery . ' AND `product` NOT ' . helper::dbIN($excludeStories);
|
||||
if($projectID != '')
|
||||
{
|
||||
foreach($products as $product) $branches[$product->branch] = $product->branch;
|
||||
@@ -1927,10 +1929,12 @@ class storyModel extends model
|
||||
* @param string $type
|
||||
* @param int $param
|
||||
* @param object $pager
|
||||
* @param string $storyType
|
||||
* @param string $excludeStories
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectStories($projectID = 0, $orderBy = 't1.`order`_desc', $type = 'byModule', $param = 0, $pager = null)
|
||||
public function getProjectStories($projectID = 0, $orderBy = 't1.`order`_desc', $type = 'byModule', $param = 0, $pager = null, $storyType = 'story', $excludeStories = '')
|
||||
{
|
||||
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProjectStories();
|
||||
|
||||
@@ -1966,6 +1970,8 @@ class storyModel extends model
|
||||
->where($storyQuery)
|
||||
->andWhere('t1.project')->eq((int)$projectID)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->andWhere('t2.type')->eq($storyType)
|
||||
->beginIF($excludeStories)->andWhere('t2.id')->notIN($excludeStories)->fi()
|
||||
->orderBy($orderBy)
|
||||
->page($pager, 't2.id')
|
||||
->fetchAll('id');
|
||||
@@ -1986,6 +1992,8 @@ class storyModel extends model
|
||||
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t3')->on('t1.project = t3.project')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t4')->on('t2.product = t4.id')
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->andWhere('t2.type')->eq($storyType)
|
||||
->beginIF($excludeStories)->andWhere('t2.id')->notIN($excludeStories)->fi()
|
||||
->beginIF(!empty($productParam))->andWhere('t1.product')->eq($productParam)->fi()
|
||||
->beginIF(!empty($branchParam))->andWhere('t2.branch')->eq($branchParam)->fi()
|
||||
->beginIF($modules)->andWhere('t2.module')->in($modules)->fi()
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
<th><?php echo $lang->story->mailto;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::select('mailto[]', $users, str_replace(' ' , '', $story->mailto), "class='form-control' multiple");?>
|
||||
<?php echo html::select('mailto[]', $users, str_replace(' ' , '', $story->mailto), "class='form-control chosen' multiple");?>
|
||||
<?php echo $this->fetch('my', 'buildContactLists');?>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user