* finish task #7256.
This commit is contained in:
+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'>
|
||||
|
||||
Reference in New Issue
Block a user