From 02caeb1437ffad8a4c1c0f02281434725941f1ce Mon Sep 17 00:00:00 2001 From: z Date: Thu, 18 Jun 2020 14:48:00 +0800 Subject: [PATCH] * finish task #7256. --- module/bug/control.php | 2 +- module/bug/js/common.js | 3 +- module/bug/model.php | 22 ++++++-- module/build/control.php | 73 +++++++++++++++++--------- module/build/js/view.js | 37 +++++++++++-- module/build/view/linkbug.html.php | 1 + module/build/view/linkstory.html.php | 1 + module/build/view/view.html.php | 29 +++++++--- module/release/control.php | 55 +++++++++++++++---- module/release/js/view.js | 37 +++++++++++-- module/release/view/linkbug.html.php | 1 + module/release/view/linkstory.html.php | 1 + module/release/view/view.html.php | 27 +++++++--- module/story/model.php | 12 ++++- module/story/view/edit.html.php | 2 +- 15 files changed, 237 insertions(+), 66 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 2362b3ae81..807c763c4e 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -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. */ diff --git a/module/bug/js/common.js b/module/bug/js/common.js index b839693be8..a5d7c1c76d 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -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. diff --git a/module/bug/model.php b/module/bug/model.php index 4a48b6a936..86f2646022 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -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; diff --git a/module/build/control.php b/module/build/control.php index e283838191..5cd8f747ae 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -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(); } diff --git a/module/build/js/view.js b/module/build/js/view.js index a379d16039..ef33582dd2 100644 --- a/module/build/js/view.js +++ b/module/build/js/view.js @@ -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() diff --git a/module/build/view/linkbug.html.php b/module/build/view/linkbug.html.php index 218bf90bdd..5684a9bc2f 100644 --- a/module/build/view/linkbug.html.php +++ b/module/build/view/linkbug.html.php @@ -67,6 +67,7 @@ id}&type=bug"), $lang->goback, '', "class='btn'");?>
+ show('right', 'pagerjs');?> diff --git a/module/build/view/linkstory.html.php b/module/build/view/linkstory.html.php index f55673e272..975a46f740 100644 --- a/module/build/view/linkstory.html.php +++ b/module/build/view/linkstory.html.php @@ -76,6 +76,7 @@ id}&type=story"), $lang->goback, '', "class='btn'");?>
+ show('right', 'pagerjs');?> diff --git a/module/build/view/view.html.php b/module/build/view/view.html.php index 52163dc109..a4f9bbec2b 100644 --- a/module/build/view/view.html.php +++ b/module/build/view/view.html.php @@ -157,8 +157,8 @@ tbody tr td:first-child input{display:none;} - -
' id='bugs'> @@ -231,8 +236,8 @@ tbody tr td:first-child input{display:none;} - -
' id='newBugs'> -
+
id}&type=newbug&link=$link¶m=$param&orderBy=%s";?> @@ -297,11 +307,16 @@ tbody tr td:first-child input{display:none;}
- -
' id='buildInfo'> diff --git a/module/release/control.php b/module/release/control.php index 77ae66604e..03c56e6c5f 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -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(); } diff --git a/module/release/js/view.js b/module/release/js/view.js index 02e3f19d04..3fe9cdb5b1 100644 --- a/module/release/js/view.js +++ b/module/release/js/view.js @@ -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() diff --git a/module/release/view/linkbug.html.php b/module/release/view/linkbug.html.php index 1d6406dc1a..519e18948d 100644 --- a/module/release/view/linkbug.html.php +++ b/module/release/view/linkbug.html.php @@ -69,6 +69,7 @@ $formID = $type == 'leftBug' ? 'unlinkedLeftBugsForm' : 'unlinkedBugsForm'; id&type=$type"), $lang->goback, '', "class='btn'");?>
+ show('right', 'pagerjs');?>
diff --git a/module/release/view/linkstory.html.php b/module/release/view/linkstory.html.php index 923f5fbdaf..ec017cf2cd 100644 --- a/module/release/view/linkstory.html.php +++ b/module/release/view/linkstory.html.php @@ -77,6 +77,7 @@ id&type=story"), $lang->goback, '', "class='btn'");?>
+ show('right', 'pagerjs');?> diff --git a/module/release/view/view.html.php b/module/release/view/view.html.php index d46696709e..19e4d29698 100644 --- a/module/release/view/view.html.php +++ b/module/release/view/view.html.php @@ -130,8 +130,8 @@ - -
' id='bugs'> @@ -215,15 +220,20 @@ - -
' id='leftBugs'> @@ -301,15 +311,20 @@ - -
diff --git a/module/story/model.php b/module/story/model.php index e2fe939438..9821f27c86 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -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() diff --git a/module/story/view/edit.html.php b/module/story/view/edit.html.php index cb5769d9ff..3f82c05ae4 100644 --- a/module/story/view/edit.html.php +++ b/module/story/view/edit.html.php @@ -171,7 +171,7 @@ story->mailto;?>
- mailto), "class='form-control' multiple");?> + mailto), "class='form-control chosen' multiple");?> fetch('my', 'buildContactLists');?>