From e706560740977a94d6e66b397804dc6bd7b8578e Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Mon, 23 Aug 2021 16:49:07 +0800 Subject: [PATCH 1/7] * Add the product kanban privilege. --- module/group/lang/resource.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index f8bb63aa90..1117a05ab9 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -383,6 +383,7 @@ $lang->resource->product->dashboard = 'dashboard'; $lang->resource->product->close = 'closeAction'; $lang->resource->product->updateOrder = 'orderAction'; $lang->resource->product->all = 'list'; +$lang->resource->product->kanban = 'kanban'; $lang->resource->product->manageLine = 'manageLine'; $lang->resource->product->build = 'build'; $lang->resource->product->export = 'exportAction'; @@ -404,12 +405,13 @@ $lang->product->methodOrder[55] = 'dashboard'; $lang->product->methodOrder[60] = 'close'; $lang->product->methodOrder[65] = 'updateOrder'; $lang->product->methodOrder[70] = 'all'; -$lang->product->methodOrder[75] = 'manageLine'; -$lang->product->methodOrder[80] = 'build'; -$lang->product->methodOrder[85] = 'export'; -$lang->product->methodOrder[90] = 'whitelist'; -$lang->product->methodOrder[95] = 'addWhitelist'; -$lang->product->methodOrder[100] = 'unbindWhitelist'; +$lang->product->methodOrder[75] = 'kanban'; +$lang->product->methodOrder[80] = 'manageLine'; +$lang->product->methodOrder[85] = 'build'; +$lang->product->methodOrder[90] = 'export'; +$lang->product->methodOrder[95] = 'whitelist'; +$lang->product->methodOrder[100] = 'addWhitelist'; +$lang->product->methodOrder[105] = 'unbindWhitelist'; /* Branch. */ $lang->resource->branch = new stdclass(); From 2e2af2560b9820d54c7a2d277abc02bab5ba0a90 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Mon, 23 Aug 2021 16:55:44 +0800 Subject: [PATCH 2/7] * Fix bug #14567. --- module/upgrade/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 91a6899151..aacf260b20 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -4709,10 +4709,10 @@ class upgradeModel extends model { $projectMember = array_filter($projectMember); $project = zget($projects, $projectID, ''); - $users = implode(',', $projectMember); + $members = implode(',', $projectMember); $this->dao->update(TABLE_DOCLIB) - ->set('users')->eq($users) + ->set('users')->eq($members) ->where('project')->eq($projectID) ->andWhere('main')->eq(1) ->exec(); From 1e019a9e25470449dc6ab544b919e356e3b4aaec Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Mon, 23 Aug 2021 17:03:00 +0800 Subject: [PATCH 3/7] + Add configurations of api. --- api/v1/entries/config.php | 36 ++++++++++++++++++++++++++++++++++++ api/v1/entries/configs.php | 22 ++++++++++++++++++++++ config/routes.php | 3 +++ 3 files changed, 61 insertions(+) create mode 100644 api/v1/entries/config.php create mode 100644 api/v1/entries/configs.php diff --git a/api/v1/entries/config.php b/api/v1/entries/config.php new file mode 100644 index 0000000000..0e7c01f880 --- /dev/null +++ b/api/v1/entries/config.php @@ -0,0 +1,36 @@ + $name); + + switch($name) + { + case 'language': + $config['value'] = $this->config->default->lang; + break; + case 'version': + $config['value'] = $this->config->version; + break; + case 'charset': + $config['value'] = $this->config->charset; + break; + case 'timezone': + $config['value'] = $this->config->timezone; + break; + default: + $this->sendError(400, 'No configuration.'); + return; + } + + $this->send(200, $config); + } +} diff --git a/api/v1/entries/configs.php b/api/v1/entries/configs.php new file mode 100644 index 0000000000..b55bc5102f --- /dev/null +++ b/api/v1/entries/configs.php @@ -0,0 +1,22 @@ + 'language', 'value' => $this->config->default->lang); + $configs[] = array('key' => 'version', 'value' => $this->config->version); + $configs[] = array('key' => 'charset', 'value' => $this->config->charset); + $configs[] = array('key' => 'timezone', 'value' => $this->config->timezone); + + $this->send(200, $configs); + } +} diff --git a/config/routes.php b/config/routes.php index fe31f8b5ef..32ddd1ee81 100644 --- a/config/routes.php +++ b/config/routes.php @@ -6,6 +6,9 @@ $routes = array(); $routes['/tokens'] = 'tokens'; +$routes['/configurations'] = 'configs'; +$routes['/configurations/:name'] = 'config'; + $routes['/products'] = 'products'; $routes['/products/:id'] = 'product'; $routes['/productlines'] = 'productLines'; From 973e8be6cc778b9ad1e1fa8f87359e87f61faa88 Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Tue, 24 Aug 2021 07:58:16 +0800 Subject: [PATCH 4/7] * Finish task#41538. --- module/build/model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/build/model.php b/module/build/model.php index ad40595c6a..e90b602967 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -221,17 +221,17 @@ class buildModel extends model * @param int $productID * @param int $branch * @param string $params noempty|notrunk, can be a set of them - * @param string $buildIDList + * @param string $buildIdList * @access public * @return array */ - public function getExecutionBuildPairs($executionID, $productID, $branch = 0, $params = '', $buildIDList = '') + public function getExecutionBuildPairs($executionID, $productID, $branch = 0, $params = '', $buildIdList = '') { $sysBuilds = array(); $selectedBuilds = array(); if(strpos($params, 'noempty') === false) $sysBuilds = array('' => ''); if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => $this->lang->trunk); - if($buildIDList) $selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->in($buildIDList)->andWhere('execution')->eq($executionID)->fetchPairs(); + if($buildIdList) $selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->in($buildIdList)->andWhere('execution')->eq($executionID)->fetchPairs(); $executionBuilds = $this->dao->select('t1.id, t1.name, t1.execution, t2.status as executionStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName')->from(TABLE_BUILD)->alias('t1') ->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id') From b304b97f615692fa87414d60fd9ade062dbb98af Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Tue, 24 Aug 2021 08:50:28 +0800 Subject: [PATCH 5/7] * Finish task#41780. --- module/common/lang/en.php | 3 ++- module/common/lang/menu.php | 1 + module/common/lang/zh-cn.php | 3 ++- module/common/lang/zh-tw.php | 3 ++- module/group/lang/resource.php | 14 ++++++++------ module/project/control.php | 11 +++++++++++ 6 files changed, 26 insertions(+), 9 deletions(-) diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 3df792a7e0..842b57b74a 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -212,7 +212,8 @@ $lang->calendar = 'Calendar'; $lang->my->work = 'Work'; -$lang->project->list = 'Project List'; +$lang->project->list = 'Project List'; +$lang->project->kanban = 'Project Kanban'; $lang->execution->executionKanban = "{$lang->execution->common} Kanban"; $lang->execution->all = "{$lang->execution->common} List"; diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index 7b0a1921e9..0cade04f7a 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -180,6 +180,7 @@ $lang->product->dividerMenu = $config->URAndSR ? ',story,requirement,settings,' /* Project menu. */ $lang->project->homeMenu = new stdclass(); $lang->project->homeMenu->browse = array('link' => ($config->systemMode == 'new' ? $lang->project->list : $lang->executionCommon) . '|project|browse|', 'alias' => 'batchedit,create'); +if($config->systemMode == 'new') $lang->project->homeMenu->kanban = array('link' => "{$lang->project->kanban}|project|kanban|"); /* Scrum menu. */ $lang->scrum->menu = new stdclass(); diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index e122278fdd..69e9399599 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -212,7 +212,8 @@ $lang->calendar = '日程'; $lang->my->work = '待处理'; -$lang->project->list = '项目列表'; +$lang->project->list = '项目列表'; +$lang->project->kanban = '项目看板'; $lang->execution->executionKanban = "{$lang->execution->common}看板"; $lang->execution->all = "{$lang->execution->common}列表"; diff --git a/module/common/lang/zh-tw.php b/module/common/lang/zh-tw.php index b558571bd5..201c9e19a2 100644 --- a/module/common/lang/zh-tw.php +++ b/module/common/lang/zh-tw.php @@ -212,7 +212,8 @@ $lang->calendar = '日程'; $lang->my->work = '待處理'; -$lang->project->list = '項目列表'; +$lang->project->list = '項目列表'; +$lang->project->kanban = '項目看板'; $lang->execution->executionKanban = "{$lang->execution->common}看板"; $lang->execution->all = "{$lang->execution->common}列表"; diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 1117a05ab9..d38ec49132 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -204,6 +204,7 @@ if($config->systemMode == 'new') $lang->resource->project = new stdclass(); $lang->resource->project->index = 'index'; $lang->resource->project->browse = 'browse'; + $lang->resource->project->kanban = 'kanban'; $lang->resource->project->programTitle = 'moduleOpen'; $lang->resource->project->create = 'create'; $lang->resource->project->edit = 'edit'; @@ -241,12 +242,13 @@ if($config->systemMode == 'new') $lang->project->methodOrder[0] = 'index'; $lang->project->methodOrder[5] = 'browse'; - $lang->project->methodOrder[10] = 'projectTitle'; - $lang->project->methodOrder[15] = 'create'; - $lang->project->methodOrder[20] = 'edit'; - $lang->project->methodOrder[25] = 'batchEdit'; - $lang->project->methodOrder[30] = 'group'; - $lang->project->methodOrder[35] = 'createGroup'; + $lang->project->methodOrder[10] = 'kanban'; + $lang->project->methodOrder[15] = 'projectTitle'; + $lang->project->methodOrder[20] = 'create'; + $lang->project->methodOrder[25] = 'edit'; + $lang->project->methodOrder[30] = 'batchEdit'; + $lang->project->methodOrder[35] = 'group'; + $lang->project->methodOrder[40] = 'createGroup'; $lang->project->methodOrder[45] = 'managePriv'; $lang->project->methodOrder[50] = 'manageMembers'; $lang->project->methodOrder[55] = 'manageGroupMember'; diff --git a/module/project/control.php b/module/project/control.php index 7ce37c8087..52e11d0094 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -292,6 +292,17 @@ class project extends control $this->display(); } + /** + * Project kanban. + * + * @access public + * @return void + */ + public function kanban() + { + $this->display(); + } + /** * Set module display mode. * From 19463a9c5fa70ec81ccb583a981a5564ecd821c8 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 24 Aug 2021 09:46:05 +0800 Subject: [PATCH 6/7] * Finish task #41711. --- config/filter.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/config/filter.php b/config/filter.php index 2b07fbc15f..f5da683e22 100644 --- a/config/filter.php +++ b/config/filter.php @@ -28,6 +28,7 @@ $filter->default->cookie['fingerprint'] = 'reg::word'; $filter->default->cookie['hideMenu'] = 'equal::true'; $filter->default->cookie['openApp'] = 'reg::word'; +$filter->my = new stdclass(); $filter->bug = new stdclass(); $filter->caselib = new stdclass(); $filter->doc = new stdclass(); @@ -62,6 +63,8 @@ $filter->ci = new stdclass(); $filter->block->default = new stdclass(); $filter->block->main = new stdclass(); +$filter->my->work = new stdclass(); +$filter->my->contribute = new stdclass(); $filter->bug->batchcreate = new stdclass(); $filter->bug->browse = new stdclass(); $filter->bug->default = new stdclass(); @@ -138,6 +141,21 @@ $filter->gitlab->webhook = new stdclass(); $filter->gitlab->importissue = new stdclass(); $filter->ci->checkCompileStatus = new stdclass(); +$filter->my->work->cookie['pagerMyTask'] = 'int'; +$filter->my->work->cookie['pagerMyRequirement'] = 'int'; +$filter->my->work->cookie['pagerMyStory'] = 'int'; +$filter->my->work->cookie['pagerMyBug'] = 'int'; +$filter->my->work->cookie['pagerMyTestcase'] = 'int'; +$filter->my->work->cookie['pagerMyTesttask'] = 'int'; + +$filter->my->contribute->cookie['pagerMyTask'] = 'int'; +$filter->my->contribute->cookie['pagerMyRequirement'] = 'int'; +$filter->my->contribute->cookie['pagerMyStory'] = 'int'; +$filter->my->contribute->cookie['pagerMyBug'] = 'int'; +$filter->my->contribute->cookie['pagerMyTestcase'] = 'int'; +$filter->my->contribute->cookie['pagerMyTesttask'] = 'int'; +$filter->my->contribute->cookie['pagerMyDoc'] = 'int'; + $filter->bug->batchcreate->cookie['preBranch'] = 'int'; $filter->bug->browse->cookie['bugModule'] = 'int'; $filter->bug->browse->cookie['bugBranch'] = 'int'; From 199f1a48b061481e3cdbaa73941bdcaa2abea954 Mon Sep 17 00:00:00 2001 From: zenggang Date: Tue, 24 Aug 2021 10:20:09 +0800 Subject: [PATCH 7/7] + Add testtask api task#41480 --- api/v1/entries/testtask.php | 32 ++++++++++++++++++++++++++++++++ api/v1/entries/testtasks.php | 28 ++++++++++++++++++++++++++++ config/routes.php | 3 +++ module/testtask/control.php | 7 ++++++- 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 api/v1/entries/testtask.php create mode 100644 api/v1/entries/testtasks.php diff --git a/api/v1/entries/testtask.php b/api/v1/entries/testtask.php new file mode 100644 index 0000000000..c1af138a25 --- /dev/null +++ b/api/v1/entries/testtask.php @@ -0,0 +1,32 @@ +loadController('testtask', 'view'); + $control->view($testtaskID); + + $data = $this->getData(); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); + if(!isset($data->data->task)) $this->sendError(400, 'error'); + + $testtask = $data->data->task; + $this->send(200, $this->format($testtask, 'realFinishedDate:time')); + } + + public function delete($testtaskID) + { + $control = $this->loadController('testtask', 'delete'); + $control->delete($testtaskID, 'yes'); + + $this->getData(); + $this->sendSuccess(200, 'success'); + } +} diff --git a/api/v1/entries/testtasks.php b/api/v1/entries/testtasks.php new file mode 100644 index 0000000000..45ccf7ec10 --- /dev/null +++ b/api/v1/entries/testtasks.php @@ -0,0 +1,28 @@ +loadController('testtask', 'browse'); + $control->browse($this->param('productID', 0), $this->param('branch', ''), ($this->param('productID', 0) > 0 ? 'local' : 'all') . ',' . $this->param('status', 'totalStatus'), $this->param('order', 'date_desc'), $this->param('total', 0), $this->param('limit', 20), $this->param('page', 1), $this->param('begin', ''), $this->param('end', '')); + $data = $this->getData(); + + if(!isset($data->status)) return $this->sendError(400, 'error'); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); + + $pager = $data->data->pager; + $result = array(); + foreach($data->data->tasks as $testtask) + { + $result[] = $this->format($testtask, 'realFinishedDate:time'); + } + return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'testtasks' => $result)); + } +} diff --git a/config/routes.php b/config/routes.php index 32ddd1ee81..5d6cd0301c 100644 --- a/config/routes.php +++ b/config/routes.php @@ -48,4 +48,7 @@ $routes['/products/:productID/issues'] = 'productIssues'; $routes['/todos'] = 'todos'; $routes['/todos/:id'] = 'todo'; +$routes['/testtasks'] = 'testtasks'; +$routes['/testtasks/:id'] = 'testtask'; + $config->routes = $routes; diff --git a/module/testtask/control.php b/module/testtask/control.php index a7e2f92673..d0bee2406a 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -285,7 +285,11 @@ class testtask extends control /* Get test task, and set menu. */ $taskID = (int)$taskID; $task = $this->testtask->getById($taskID, true); - if(!$task) die(js::error($this->lang->notFound) . js::locate('back')); + if(!$task) + { + if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'message' => '404 Not found')); + die(js::error($this->lang->notFound) . js::locate('back')); + } /* When the session changes, you need to query the related products again. */ if($this->session->project != $task->project) $this->view->products = $this->products = $this->product->getProductPairsByProject($task->project); @@ -981,6 +985,7 @@ class testtask extends control $browseList = $this->createLink('testtask', 'browse', "productID=$task->product"); if($this->app->openApp == 'execution') $browseList = $this->createLink('execution', 'testtask', "executionID=$task->execution"); if($this->app->openApp == 'project') $browseList = $this->createLink('project', 'testtask', "projectID=$task->project"); + if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success')); die(js::locate($browseList, 'parent')); } }