This commit is contained in:
lichengjun
2021-08-24 02:28:39 +00:00
15 changed files with 187 additions and 21 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
/**
* 禅道API的config资源类
* 版本V1
*
* The config entry point of zentaopms
* Version 1
*/
class configEntry extends entry
{
public function get($name)
{
$config = array('name' => $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);
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
/**
* 禅道API的configs资源类
* 版本V1
*
* The configs entry point of zentaopms
* Version 1
*/
class configsEntry extends entry
{
public function get()
{
$configs = array();
$configs[] = array('key' => '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);
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
/**
* 禅道API的todo资源类
* 版本V1
*
* The testtask entry point of zentaopms
* Version 1
*/
class testtaskEntry extends entry
{
public function get($testtaskID)
{
$control = $this->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');
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
/**
* 禅道API的testtasks资源类
* 版本V1
*
* The testtasks entry point of zentaopms
* Version 1
*/
class testtasksEntry extends entry
{
public function get()
{
$control = $this->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));
}
}
+18
View File
@@ -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';
+6
View File
@@ -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';
@@ -45,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;
+3 -3
View File
@@ -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')
+2 -1
View File
@@ -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";
+1
View File
@@ -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();
+2 -1
View File
@@ -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}列表";
+2 -1
View File
@@ -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}列表";
+16 -12
View File
@@ -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';
@@ -383,6 +385,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 +407,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();
+11
View File
@@ -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.
*
+6 -1
View File
@@ -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'));
}
}
+2 -2
View File
@@ -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();