From 4b219ab7b1cb3a0c40c9bc86d40b6882e0202f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=BB=B6=E4=B9=89?= Date: Sat, 8 Oct 2022 16:59:02 +0800 Subject: [PATCH 1/4] * Reset page style. --- module/project/css/browse.css | 1 - 1 file changed, 1 deletion(-) diff --git a/module/project/css/browse.css b/module/project/css/browse.css index c565f44625..7f51feabce 100644 --- a/module/project/css/browse.css +++ b/module/project/css/browse.css @@ -18,7 +18,6 @@ th.c-name {min-width: 240px;} th.c-name {width: auto;} } [lang^='en'] .project-name > .label-warning {width: 55px !important;} -[lang^='en'] .c-status {width: 100px !important;} .table-responsive {overflow: auto !important;} .checkbox-primary {margin-right: 10px;} From 62cc57a8e7c57a5326131e8d7ed6b1e3644fb063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=BB=B6=E4=B9=89?= Date: Sat, 8 Oct 2022 17:04:34 +0800 Subject: [PATCH 2/4] * Finish task #71909. --- api/v1/entries/projectreleases.php | 4 +++- module/projectrelease/control.php | 15 +++++++++++++-- module/projectrelease/model.php | 3 ++- module/projectrelease/view/browse.html.php | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/api/v1/entries/projectreleases.php b/api/v1/entries/projectreleases.php index 21c9eb3b73..c3ca3a0f9a 100644 --- a/api/v1/entries/projectreleases.php +++ b/api/v1/entries/projectreleases.php @@ -23,8 +23,10 @@ class projectReleasesEntry extends entry if(empty($projectID)) $projectID = $this->param('project'); if(empty($projectID)) return $this->sendError(400, 'Need project id.'); + $page = intval($this->param('page', 1)); + $limit = intval($this->param('limit', 20)); $control = $this->loadController('projectrelease', 'browse'); - $control->browse($projectID, $this->param('execution', 0), $this->param('status', 'all'), $this->param('order', 't1.date_desc')); + $control->browse($projectID, $this->param('execution', 0), $this->param('status', 'all'), $this->param('order', 't1.date_desc'), 0, $limit, $page); /* Response */ $data = $this->getData(); diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php index 993f8fab5c..2429bb101a 100644 --- a/module/projectrelease/control.php +++ b/module/projectrelease/control.php @@ -61,10 +61,13 @@ class projectrelease extends control * @param int $executionID * @param string $type * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID * @access public * @return void */ - public function browse($projectID = 0, $executionID = 0, $type = 'all', $orderBy = 't1.date_desc') + public function browse($projectID = 0, $executionID = 0, $type = 'all', $orderBy = 't1.date_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) { $this->session->set('releaseList', $this->app->getURI(true), 'project'); $project = $this->project->getById($projectID); @@ -75,16 +78,24 @@ class projectrelease extends control $objectName = isset($project->name) ? $project->name : $execution->name; + /* Load pager. */ + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + $this->view->title = $objectName . $this->lang->colon . $this->lang->release->browse; $this->view->position[] = $this->lang->release->browse; $this->view->execution = $execution; $this->view->project = $project; $this->view->products = $this->loadModel('product')->getProducts($projectID); - $this->view->releases = $this->projectrelease->getList($projectID, $type, $orderBy); + $this->view->releases = $this->projectrelease->getList($projectID, $type, $orderBy, $pager); $this->view->projectID = $projectID; $this->view->executionID = $executionID; $this->view->type = $type; $this->view->from = $this->app->tab; + $this->view->recTotal = $recTotal; + $this->view->recPerPage = $recPerPage; + $this->view->pageID = $pageID; + $this->view->pager = $pager; $this->display(); } diff --git a/module/projectrelease/model.php b/module/projectrelease/model.php index ba8ff55508..442861fac7 100644 --- a/module/projectrelease/model.php +++ b/module/projectrelease/model.php @@ -49,7 +49,7 @@ class projectreleaseModel extends model * @access public * @return array */ - public function getList($projectID, $type = 'all', $orderBy = 't1.date_desc') + public function getList($projectID, $type = 'all', $orderBy = 't1.date_desc', $pager = null) { return $this->dao->select('t1.*, t2.name as productName, t3.id as buildID, t3.name as buildName, t3.execution, t4.name as executionName') ->from(TABLE_RELEASE)->alias('t1') @@ -61,6 +61,7 @@ class projectreleaseModel extends model ->beginIF($type == 'review')->andWhere("FIND_IN_SET('{$this->app->user->account}', t1.reviewers)")->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy($orderBy) + ->beginIF($pager)->page($pager)->fi() ->fetchAll(); } diff --git a/module/projectrelease/view/browse.html.php b/module/projectrelease/view/browse.html.php index f748053199..36de8640c2 100644 --- a/module/projectrelease/view/browse.html.php +++ b/module/projectrelease/view/browse.html.php @@ -82,6 +82,7 @@ + From 9e7e1f69692585e5bd5075e0fddfe8a50bbf0357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=BB=B6=E4=B9=89?= Date: Sat, 8 Oct 2022 17:17:42 +0800 Subject: [PATCH 3/4] * Finish task #71906. --- api/v1/entries/productprojects.php | 2 +- module/product/control.php | 15 +++++++++++++-- module/product/model.php | 19 +++++++++++-------- module/product/view/project.html.php | 1 + module/projectrelease/model.php | 2 +- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/api/v1/entries/productprojects.php b/api/v1/entries/productprojects.php index b493ed3fcd..c6540ea7a4 100644 --- a/api/v1/entries/productprojects.php +++ b/api/v1/entries/productprojects.php @@ -25,7 +25,7 @@ class productProjectsEntry extends entry $appendFields = $this->param('fields', ''); $control = $this->loadController('product', 'project'); - $control->project($this->param('status', 'all'), $productID, $this->param('branch', 0), $this->param('involved', 0), $this->param('order', 'order_desc')); + $control->project($this->param('status', 'all'), $productID, $this->param('branch', 0), $this->param('involved', 0), $this->param('order', 'order_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); $data = $this->getData(); if(isset($data->status) and $data->status == 'success') diff --git a/module/product/control.php b/module/product/control.php index 66833d346f..65847d39ff 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -73,10 +73,13 @@ class product extends control * @param int $branch * @param int $involved * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID * @access public * @return void */ - public function project($status = 'all', $productID = 0, $branch = '', $involved = 0, $orderBy = 'order_desc') + public function project($status = 'all', $productID = 0, $branch = '', $involved = 0, $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $this->app->loadLang('execution'); $this->loadModel('project'); @@ -87,9 +90,13 @@ class product extends control $this->product->setMenu($productID, $branch); + /* Load pager. */ + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + /* Get PM id list. */ $accounts = array(); - $projectStats = $this->product->getProjectStatsByProduct($productID, $status, $branch, $involved, $orderBy); + $projectStats = $this->product->getProjectStatsByProduct($productID, $status, $branch, $involved, $orderBy, $pager); $product = $this->product->getByID($productID); $projects = $this->project->getPairsByProgram($product->program, 'all', false, 'order_asc'); @@ -112,6 +119,10 @@ class product extends control $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->branchID = $branch; $this->view->branchStatus = $this->loadModel('branch')->getByID($branch, 0, 'status'); + $this->view->recTotal = $recTotal; + $this->view->recPerPage = $recPerPage; + $this->view->pageID = $pageID; + $this->view->pager = $pager; $this->display(); } diff --git a/module/product/model.php b/module/product/model.php index 1999ef3c02..4537e9b12d 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -1183,15 +1183,16 @@ class productModel extends model /** * Get project list by product. * - * @param int $productID - * @param string $browseType - * @param int $branch - * @param int $involved - * @param string $orderBy + * @param int $productID + * @param string $browseType + * @param int $branch + * @param int $involved + * @param string $orderBy + * @param object $pager * @access public * @return array */ - public function getProjectListByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc') + public function getProjectListByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc', $pager = null) { $projectList = $this->dao->select('t2.*')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') @@ -1210,6 +1211,7 @@ class productModel extends model ->beginIF($branch !== '' and $branch !== 'all')->andWhere('t1.branch')->in($branch)->fi() ->andWhere('t2.deleted')->eq('0') ->orderBy($orderBy) + ->page($pager) ->fetchAll('id'); /* Determine how to display the name of the program. */ @@ -1231,12 +1233,13 @@ class productModel extends model * @param int $branch * @param int $involved * @param string $orderBy + * @param object $pager * @access public * @return array */ - public function getProjectStatsByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc') + public function getProjectStatsByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc', $pager = null) { - $projects = $this->getProjectListByProduct($productID, $browseType, $branch, $involved, $orderBy); + $projects = $this->getProjectListByProduct($productID, $browseType, $branch, $involved, $orderBy, $pager); if(empty($projects)) return array(); $projectKeys = array_keys($projects); diff --git a/module/product/view/project.html.php b/module/product/view/project.html.php index c20a70ebfb..7e6c9a6fe5 100644 --- a/module/product/view/project.html.php +++ b/module/product/view/project.html.php @@ -107,6 +107,7 @@ + diff --git a/module/projectrelease/model.php b/module/projectrelease/model.php index 442861fac7..a976dbebc6 100644 --- a/module/projectrelease/model.php +++ b/module/projectrelease/model.php @@ -61,7 +61,7 @@ class projectreleaseModel extends model ->beginIF($type == 'review')->andWhere("FIND_IN_SET('{$this->app->user->account}', t1.reviewers)")->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy($orderBy) - ->beginIF($pager)->page($pager)->fi() + ->page($pager) ->fetchAll(); } From a923a0838d7422b7307ccbcea52a6c836e3da1b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=BB=B6=E4=B9=89?= Date: Sat, 8 Oct 2022 17:21:29 +0800 Subject: [PATCH 4/4] * Finish task #71884. --- module/testtask/view/browse.html.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/module/testtask/view/browse.html.php b/module/testtask/view/browse.html.php index 0a636ab293..3006fdf351 100644 --- a/module/testtask/view/browse.html.php +++ b/module/testtask/view/browse.html.php @@ -24,16 +24,6 @@ $status = $this->session->testTaskVersionStatus;