Merge branch 'master' of https://gitlab.zcorp.cc/easycorp/zentaopms
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* 禅道API的bug资源类
|
||||
* 版本V1
|
||||
*
|
||||
* The bug entry point of zentaopms
|
||||
* Version 1
|
||||
*/
|
||||
class bugEntry extends entry
|
||||
{
|
||||
public function get($bugID)
|
||||
{
|
||||
$control = $this->loadController('bug', 'view');
|
||||
$control->view($bugID);
|
||||
|
||||
$data = $this->getData();
|
||||
$bug = $data->data->bug;
|
||||
$this->send(200, $bug);
|
||||
}
|
||||
|
||||
public function put($bugID)
|
||||
{
|
||||
$oldBug = $this->loadModel('bug')->getByID($bugID);
|
||||
|
||||
/* Set $_POST variables. */
|
||||
$fields = 'title,project,execution,openedBuild,assignedTo,pri,severity,type,story,resolvedBy,closedBy,resolution,product,plan,task';
|
||||
$this->batchSetPost($fields, $oldBug);
|
||||
|
||||
$control = $this->loadController('bug', 'edit');
|
||||
$control->edit($bugID);
|
||||
|
||||
$data = $this->getData();
|
||||
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
if(!isset($data->status)) return $this->sendError(400, 'error');
|
||||
|
||||
$bug = $this->bug->getByID($bugID);
|
||||
$this->send(200, $bug);
|
||||
}
|
||||
|
||||
public function delete($bugID)
|
||||
{
|
||||
$control = $this->loadController('bug', 'delete');
|
||||
$control->delete($bugID, 'yes');
|
||||
|
||||
$this->getData();
|
||||
$this->sendSuccess(200, 'success');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* 禅道API的bugs资源类
|
||||
* 版本V1
|
||||
*
|
||||
* The bugs entry point of zentaopms
|
||||
* Version 1
|
||||
*/
|
||||
class bugsEntry extends entry
|
||||
{
|
||||
public function get($productID)
|
||||
{
|
||||
$control = $this->loadController('bug', 'browse');
|
||||
$control->browse($productID);
|
||||
$data = $this->getData();
|
||||
|
||||
if(isset($data->status) and $data->status == 'success')
|
||||
{
|
||||
$bugs = $data->data->bugs;
|
||||
$result = array();
|
||||
foreach($bugs as $bug)
|
||||
{
|
||||
$result[] = $bug;
|
||||
}
|
||||
return $this->send(200, $result);
|
||||
}
|
||||
if(isset($data->status) and $data->status == 'fail')
|
||||
{
|
||||
return $this->sendError(400, $data->message);
|
||||
}
|
||||
|
||||
return $this->sendError(400, 'error');
|
||||
}
|
||||
|
||||
public function post($productID)
|
||||
{
|
||||
$fields = 'title,project,execution,openedBuild,assignedTo,pri,severity,type,story';
|
||||
$this->batchSetPost($fields);
|
||||
|
||||
$this->setPost('product', $productID);
|
||||
|
||||
$control = $this->loadController('bug', 'create');
|
||||
$this->requireFields('title,pri,severity,type,openedBuild');
|
||||
|
||||
$control->create($productID);
|
||||
|
||||
$data = $this->getData();
|
||||
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message);
|
||||
|
||||
$bug = $this->loadModel('bug')->getByID($data->id);
|
||||
|
||||
$this->send(200, $bug);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* 禅道API的execution资源类
|
||||
* 版本V1
|
||||
*
|
||||
* The execution entry point of zentaopms
|
||||
* Version 1
|
||||
*/
|
||||
class executionEntry extends Entry
|
||||
{
|
||||
public function get($executionID)
|
||||
{
|
||||
$control = $this->loadController('execution', 'view');
|
||||
$control->view($executionID);
|
||||
|
||||
$data = $this->getData();
|
||||
$execution = $data->data->execution;
|
||||
$this->send(200, $execution);
|
||||
}
|
||||
|
||||
public function put($executionID)
|
||||
{
|
||||
$oldExecution = $this->loadModel('execution')->getByID($executionID);
|
||||
|
||||
/* Set $_POST variables. */
|
||||
$fields = 'project,code,name,begin,end,lifetime,desc,days,acl';
|
||||
$this->batchSetPost($fields, $oldExecution);
|
||||
|
||||
$this->setPost('whitelist', $this->request('whitelist', explode(',', $oldExecution->whitelist)));
|
||||
|
||||
$control = $this->loadController('execution', 'edit');
|
||||
$control->edit($executionID);
|
||||
|
||||
$data = $this->getData();
|
||||
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
if(!isset($data->result)) return $this->sendError(400, 'error');
|
||||
|
||||
$execution = $this->execution->getByID($executionID);
|
||||
$this->sendSuccess(200, $execution);
|
||||
}
|
||||
|
||||
public function delete($executionID)
|
||||
{
|
||||
$control = $this->loadController('execution', 'delete');
|
||||
$control->delete($executionID, 'true');
|
||||
|
||||
$this->getData();
|
||||
$this->sendSuccess(200, 'success');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* 禅道API的executions资源类
|
||||
* 版本V1
|
||||
*
|
||||
* The executions entry point of zentaopms
|
||||
* Version 1
|
||||
*/
|
||||
class executionsEntry extends entry
|
||||
{
|
||||
public function get($projectID = 0)
|
||||
{
|
||||
$control = $this->loadController('execution', 'all');
|
||||
$control->all($this->param('status', 'all'), $this->param('project', $projectID));
|
||||
$data = $this->getData();
|
||||
|
||||
if(isset($data->status) and $data->status == 'success') return $this->send(200, $data->data->executionStats);
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
return $this->sendError(400, 'error');
|
||||
}
|
||||
|
||||
public function post($projectID = 0)
|
||||
{
|
||||
$fields = 'project,code,name,begin,end,lifetime,desc,days';
|
||||
$this->batchSetPost($fields);
|
||||
|
||||
$projectID = $this->param('project', $projectID);
|
||||
$this->setPost('project', $projectID);
|
||||
$this->setPost('acl', $this->request('acl', 'private'));
|
||||
$this->setPost('whitelist', $this->request('whitelist', array()));
|
||||
$this->setPost('products', $this->request('products', array()));
|
||||
$this->setPost('plans', $this->request('plans', array()));
|
||||
|
||||
$control = $this->loadController('execution', 'create');
|
||||
$this->requireFields('name,code,begin,end,days');
|
||||
|
||||
$control->create($projectID);
|
||||
|
||||
$data = $this->getData();
|
||||
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
$execution = $this->loadModel('execution')->getByID($data->id);
|
||||
|
||||
$this->send(200, $execution);
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,8 @@ class taskEntry extends Entry
|
||||
$control->edit($taskID);
|
||||
|
||||
$this->getData();
|
||||
$this->sendSuccess(200, 'success');
|
||||
$task = $this->task->getByID($taskID);
|
||||
$this->send(200, $task);
|
||||
}
|
||||
|
||||
public function delete($taskID)
|
||||
|
||||
@@ -23,7 +23,7 @@ class taskAssignToEntry extends Entry
|
||||
$data = $this->getData();
|
||||
if($data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
$task = $this->loadModel('task')->getByID($dataID);
|
||||
$task = $this->loadModel('task')->getByID($taskID);
|
||||
|
||||
$this->send(200, $task);
|
||||
}
|
||||
|
||||
@@ -8,13 +8,31 @@
|
||||
*/
|
||||
class tasksEntry extends entry
|
||||
{
|
||||
public function get()
|
||||
public function get($executionID)
|
||||
{
|
||||
$control = $this->loadController('execution', 'task');
|
||||
$control->task($executionID);
|
||||
$data = $this->getData();
|
||||
|
||||
if(isset($data->status) and $data->status == 'success')
|
||||
{
|
||||
$tasks = $data->data->tasks;
|
||||
$result = array();
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
$result[] = $task;
|
||||
}
|
||||
return $this->send(200, $result);
|
||||
}
|
||||
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
return $this->sendError(400, 'error');
|
||||
}
|
||||
|
||||
public function post($executionID)
|
||||
{
|
||||
$fields = 'name,type,assignedTo,estimate,story,parent,execution,module';
|
||||
$fields = 'name,type,assignedTo,estimate,story,parent,execution,module,pri,desc';
|
||||
$this->batchSetPost($fields);
|
||||
|
||||
$control = $this->loadController('task', 'create');
|
||||
@@ -27,6 +45,6 @@ class tasksEntry extends entry
|
||||
|
||||
$task = $this->loadModel('task')->getByID($data->id);
|
||||
|
||||
$this->send(200, $task);
|
||||
$this->send(201, $task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class taskStartEntry extends Entry
|
||||
$data = $this->getData();
|
||||
if($data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
$task = $this->loadModel('task')->getByID($dataID);
|
||||
$task = $this->loadModel('task')->getByID($taskID);
|
||||
|
||||
$this->send(200, $task);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* 禅道API的user资源类
|
||||
* 版本V1
|
||||
*
|
||||
* The user entry point of zentaopms
|
||||
* Version 1
|
||||
*/
|
||||
class userEntry extends Entry
|
||||
{
|
||||
public function get($userID = 0)
|
||||
{
|
||||
$control = $this->loadController('user', 'profile');
|
||||
$control->profile($userID);
|
||||
|
||||
$data = $this->getData();
|
||||
$user = $data->data->user;
|
||||
unset($user->password);
|
||||
|
||||
$this->send(200, $user);
|
||||
}
|
||||
|
||||
public function put($userID)
|
||||
{
|
||||
$oldUser = $this->loadModel('user')->getByID($userID, 'id');
|
||||
|
||||
/* Set $_POST variables. */
|
||||
$fields = 'account,dept,realname,email,commiter,gender';
|
||||
$this->batchSetPost($fields, $oldUser);
|
||||
|
||||
$this->setPost('password1', $this->request('password', ''));
|
||||
$this->setPost('password2', $this->request('password', ''));
|
||||
$this->setPost('verifyPassword', md5($this->app->user->password . $this->app->session->rand));
|
||||
|
||||
$control = $this->loadController('user', 'edit');
|
||||
$control->edit($userID);
|
||||
|
||||
$this->getData();
|
||||
$user = $this->user->getByID($userID, 'id');
|
||||
unset($user->password);
|
||||
|
||||
$this->send(200, $user);
|
||||
}
|
||||
|
||||
public function delete($userID)
|
||||
{
|
||||
$this->setPost('verifyPassword', md5($this->app->user->password . $this->app->session->rand));
|
||||
|
||||
$control = $this->loadController('user', 'delete');
|
||||
$control->delete($userID);
|
||||
|
||||
$this->getData();
|
||||
$this->sendSuccess(200, 'success');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* 禅道API的users资源类
|
||||
* 版本V1
|
||||
*
|
||||
* The users entry point of zentaopms
|
||||
* Version 1
|
||||
*/
|
||||
class usersEntry extends entry
|
||||
{
|
||||
public function get()
|
||||
{
|
||||
$control = $this->loadController('company', 'browse');
|
||||
$control->browse();
|
||||
$data = $this->getData();
|
||||
|
||||
if(isset($data->status) and $data->status == 'success')
|
||||
{
|
||||
$users = $data->data->users;
|
||||
$result = array();
|
||||
foreach($users as $user)
|
||||
{
|
||||
$result[] = $user;
|
||||
}
|
||||
return $this->send(200, $result);
|
||||
}
|
||||
if(isset($data->status) and $data->status == 'fail')
|
||||
{
|
||||
return $this->sendError(400, $data->message);
|
||||
}
|
||||
|
||||
return $this->sendError(400, 'error');
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
$fields = 'account,dept,realname,email,commiter,gender';
|
||||
$this->batchSetPost($fields);
|
||||
|
||||
$this->setPost('password1', $this->request('password'));
|
||||
$this->setPost('password2', $this->request('password'));
|
||||
$this->setPost('passwordStrength', 3);
|
||||
$this->setPost('verifyPassword', md5($this->app->user->password . $this->app->session->rand));
|
||||
|
||||
$control = $this->loadController('user', 'create');
|
||||
$this->requireFields('account,password1,realname');
|
||||
|
||||
$control->create();
|
||||
|
||||
$data = $this->getData();
|
||||
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message);
|
||||
|
||||
$user = $this->loadModel('user')->getByID($data->id, 'id');
|
||||
unset($user->password);
|
||||
|
||||
$this->send(201, $user);
|
||||
}
|
||||
}
|
||||
+17
-6
@@ -6,12 +6,6 @@ $routes = array();
|
||||
|
||||
$routes['/tokens'] = 'tokens';
|
||||
|
||||
$routes['/programs'] = 'programs';
|
||||
$routes['/programs/:id'] = 'program';
|
||||
|
||||
$routes['/projects'] = 'projects';
|
||||
$routes['/projects/:id'] = 'project';
|
||||
|
||||
$routes['/products'] = 'products';
|
||||
$routes['/products/:id'] = 'product';
|
||||
$routes['/productlines'] = 'productLines';
|
||||
@@ -21,10 +15,27 @@ $routes['/products/:id/stories'] = 'stories';
|
||||
$routes['/stories/:id'] = 'story';
|
||||
$routes['/stories/:id/change'] = 'storyChange';
|
||||
|
||||
$routes['/products/:id/bugs'] = 'bugs';
|
||||
$routes['/bugs/:id'] = 'bug';
|
||||
|
||||
$routes['/projects'] = 'projects';
|
||||
$routes['/projects/:id'] = 'project';
|
||||
|
||||
$routes['/projects/:project/executions'] = 'executions';
|
||||
$routes['/executions'] = 'executions';
|
||||
$routes['/executions/:id'] = 'execution';
|
||||
|
||||
$routes['/executions/:execution/tasks'] = 'tasks';
|
||||
$routes['/tasks/:id'] = 'task';
|
||||
$routes['/tasks/:id/assignto'] = 'taskAssignTo';
|
||||
$routes['/tasks/:id/start'] = 'taskStart';
|
||||
$routes['/tasks/:id/finish'] = 'taskFinish';
|
||||
|
||||
$routes['/users'] = 'users';
|
||||
$routes['/users/:id'] = 'user';
|
||||
$routes['/user'] = 'user';
|
||||
|
||||
$routes['/programs'] = 'programs';
|
||||
$routes['/programs/:id'] = 'program';
|
||||
|
||||
$config->routes = $routes;
|
||||
|
||||
@@ -54,8 +54,8 @@ class baseEntry
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求数据(POST PUT)
|
||||
* Get request data(POST or PUT).
|
||||
* 获取请求数据(POST PUT)
|
||||
* Get request data(POST or PUT)
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $defaultValue
|
||||
@@ -68,6 +68,21 @@ class baseEntry
|
||||
return $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求参数
|
||||
* Get request params.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $defaultValue
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function param($key, $defaultValue = '')
|
||||
{
|
||||
if(isset($_GET[$key])) return $_GET[$key];
|
||||
return $defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析请求数据
|
||||
* Parse body of request data.
|
||||
|
||||
@@ -832,6 +832,7 @@ class baseControl
|
||||
* Parse the params, create the $module control object.
|
||||
*/
|
||||
$module = new $className($moduleName, $methodName, $appName);
|
||||
$module->viewType = $this->viewType;
|
||||
|
||||
/**
|
||||
* 调用对应方法,使用ob方法获取输出内容。
|
||||
|
||||
@@ -795,7 +795,7 @@ class bug extends control
|
||||
$files = array();
|
||||
if($comment == false)
|
||||
{
|
||||
$changes = $this->bug->update($bugID);
|
||||
$changes = $this->bug->update($bugID);
|
||||
if(dao::isError())
|
||||
{
|
||||
if(defined('RUN_MODE') && RUN_MODE == 'api')
|
||||
@@ -1591,6 +1591,7 @@ class bug extends control
|
||||
|
||||
$this->executeHooks($bugID);
|
||||
|
||||
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess));
|
||||
die(js::locate($this->session->bugList, 'parent'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,8 +656,8 @@ class bugModel extends model
|
||||
$this->dao->update(TABLE_BUG)->data($bug)
|
||||
->autoCheck()
|
||||
->batchCheck($this->config->bug->edit->requiredFields, 'notempty')
|
||||
->checkIF($bug->resolvedBy, 'resolution', 'notempty')
|
||||
->checkIF($bug->closedBy, 'resolution', 'notempty')
|
||||
->checkIF($bug->resolvedBy, 'resolution', 'notempty')
|
||||
->checkIF($bug->closedBy, 'resolution', 'notempty')
|
||||
->checkIF($bug->resolution == 'duplicate', 'duplicateBug', 'notempty')
|
||||
->checkIF($bug->resolution == 'fixed', 'resolvedBuild','notempty')
|
||||
->where('id')->eq((int)$bugID)
|
||||
|
||||
@@ -553,7 +553,7 @@ class custom extends control
|
||||
if($sprintConcept == 2) $this->setting->setItem('system.custom.sprintConcept', 1);
|
||||
die(js::locate($this->createLink('upgrade', 'mergeTips'), 'parent'));
|
||||
}
|
||||
if($mode == 'classic')
|
||||
else
|
||||
{
|
||||
if($sprintConcept == 1) $this->setting->setItem('system.custom.sprintConcept', 2);
|
||||
die(js::reload('top'));
|
||||
@@ -565,7 +565,6 @@ class custom extends control
|
||||
if(isset($this->config->global->upgradeStep) and $this->config->global->upgradeStep == 'mergeProgram') die(js::locate($this->createLink('upgrade', 'mergeProgram'), 'parent'));
|
||||
|
||||
unset($_SESSION['upgrading']);
|
||||
// $this->locate(inlink('index'));
|
||||
}
|
||||
|
||||
$this->app->loadLang('upgrade');
|
||||
|
||||
@@ -3,7 +3,7 @@ $(function()
|
||||
$('[name=mode]').change(function()
|
||||
{
|
||||
var mode = $(this).val();
|
||||
if(mode == 'classic') $('#modeTips').html(newTips);
|
||||
if(mode == 'new') $('#modeTips').html(classicTips);
|
||||
if(mode == 'new') $('#modeTips').html(newTips);
|
||||
if(mode == 'classic') $('#modeTips').html(classicTips);
|
||||
})
|
||||
})
|
||||
|
||||
@@ -216,7 +216,7 @@ $lang->custom->workingList['full'] = 'Full Management of Dev';
|
||||
$lang->custom->menuTip = 'Click to show/hide navigation bar. Drag to swtich display order.';
|
||||
$lang->custom->saveFail = 'Failed to save!';
|
||||
$lang->custom->page = ' Page';
|
||||
$lang->custom->changeClassicTip = 'The module of Program will be hidden, if you switch to Version 12.5.3 and below.';
|
||||
$lang->custom->changeClassicTip = 'The Program module will be hidden, if you switch to the classic mode.';
|
||||
|
||||
$lang->custom->scoreStatus[1] = 'On';
|
||||
$lang->custom->scoreStatus[0] = 'Off';
|
||||
|
||||
@@ -216,7 +216,7 @@ $lang->custom->workingList['full'] = 'Application Lifecycle Management';
|
||||
$lang->custom->menuTip = 'Click to show/hide the menu. Drag to switch display order.';
|
||||
$lang->custom->saveFail = 'Failed to save!';
|
||||
$lang->custom->page = ' Page';
|
||||
$lang->custom->changeClassicTip = 'The module of Program will be hidden, if you switch to Version 12.5.3 and below.';
|
||||
$lang->custom->changeClassicTip = 'The Program module will be hidden, if you switch to the classic mode.';
|
||||
|
||||
$lang->custom->scoreStatus[1] = 'On';
|
||||
$lang->custom->scoreStatus[0] = 'Off';
|
||||
|
||||
@@ -216,7 +216,7 @@ $lang->custom->workingList['full'] = 'Application Lifecycle Management';
|
||||
$lang->custom->menuTip = "Cliquez pour montrer/cacher le menu. Déplacez pour changer l'ordre d'affichage.";
|
||||
$lang->custom->saveFail = 'Echec de la sauvegarde !';
|
||||
$lang->custom->page = ' Page';
|
||||
$lang->custom->changeClassicTip = 'The module of Program will be hidden, if you switch to Version 12.5.3 and below.';
|
||||
$lang->custom->changeClassicTip = 'The Program module will be hidden, if you switch to the classic mode.';
|
||||
|
||||
$lang->custom->scoreStatus[1] = 'On';
|
||||
$lang->custom->scoreStatus[0] = 'Off';
|
||||
|
||||
@@ -216,7 +216,7 @@ $lang->custom->workingList['full'] = 'Quản lý vòng đời ứng dụng'
|
||||
$lang->custom->menuTip = 'Click để hiện/ẩn menu. Kéo thả để chuyển vị trí hiển thị.';
|
||||
$lang->custom->saveFail = 'Lưu thất bại!';
|
||||
$lang->custom->page = '';
|
||||
$lang->custom->changeClassicTip = 'The module of Program will be hidden, if you switch to Version 12.5.3 and below.';
|
||||
$lang->custom->changeClassicTip = 'The Program module will be hidden, if you switch to the classic mode.';
|
||||
|
||||
$lang->custom->scoreStatus[1] = 'On';
|
||||
$lang->custom->scoreStatus[0] = 'Off';
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
<label class="radio-inline"><input type="radio" name="mode" value="classic" <?php echo $mode == 'classic'? "checked='checked'" : ''; echo $isDisabled;?> id="modeclassic"><?php echo $lang->upgrade->to15Mode['classic'];?></label>
|
||||
<label class="radio-inline"><input type="radio" name="mode" value="new" <?php echo $mode == 'new'? "checked='checked'" : ''; echo $isDisabled;?> id="modenew"><?php echo $lang->upgrade->to15Mode['new'];?></label>
|
||||
</p>
|
||||
<p class='text-info' id='modeTips'><?php echo $mode == 'new' ? $lang->custom->changeClassicTip : $lang->upgrade->selectedModeTips['new'];?></p>
|
||||
<p class='text-info' id='modeTips'><?php echo $mode == 'classic' ? $lang->custom->changeClassicTip : $lang->upgrade->selectedModeTips['new'];?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php echo html::submitButton($lang->custom->switch, $changedMode == 'yes' ? 'disabled' : '');?></td>
|
||||
<td><?php if($changedMode != 'yes') echo html::submitButton($lang->custom->switch);?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
@@ -2147,6 +2147,8 @@ class execution extends control
|
||||
|
||||
$this->session->set('execution', '');
|
||||
$this->executeHooks($executionID);
|
||||
|
||||
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess));
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
@@ -2208,7 +2210,7 @@ class execution extends control
|
||||
$position[] = html::a($browseExecutionLink, $execution->name);
|
||||
$position[] = $this->lang->execution->manageProducts;
|
||||
|
||||
$allProducts = $this->product->getProductPairsByProject($execution->project);
|
||||
$allProducts = $this->config->systemMode == 'classic' ? $this->product->getPairs('noclosed') : $this->product->getProductPairsByProject($execution->project);
|
||||
$linkedProducts = $this->execution->getProducts($execution->id);
|
||||
$linkedBranches = array();
|
||||
|
||||
|
||||
@@ -340,6 +340,12 @@ class executionModel extends model
|
||||
|
||||
$sprint = $this->loadModel('file')->processImgURL($sprint, $this->config->execution->editor->create['id'], $this->post->uid);
|
||||
|
||||
/* Redefines the language entries for the fields in the project table. */
|
||||
foreach(explode(',', $this->config->execution->create->requiredFields) as $field)
|
||||
{
|
||||
if(isset($this->lang->execution->$field)) $this->lang->project->$field = $this->lang->execution->$field;
|
||||
}
|
||||
|
||||
/* Replace required language. */
|
||||
if($this->app->openApp == 'project')
|
||||
{
|
||||
@@ -484,7 +490,7 @@ class executionModel extends model
|
||||
}
|
||||
|
||||
/* Redefines the language entries for the fields in the project table. */
|
||||
foreach(explode(',', $this->config->execution->create->requiredFields) as $field)
|
||||
foreach(explode(',', $this->config->execution->edit->requiredFields) as $field)
|
||||
{
|
||||
if(isset($this->lang->execution->$field)) $this->lang->project->$field = $this->lang->execution->$field;
|
||||
}
|
||||
|
||||
+35
-15
@@ -505,6 +505,15 @@ class product extends control
|
||||
if($product->program) $lines = array('') + $this->product->getLinePairs($product->program);
|
||||
if($this->config->systemMode == 'classic') $lines = array('') + $this->product->getLinePairs();
|
||||
|
||||
/* Get programs. */
|
||||
$programs = $this->loadModel('program')->getTopPairs();
|
||||
if(!isset($programs[$product->program]) and $product->program)
|
||||
{
|
||||
$program = $this->program->getByID($product->program);
|
||||
$programs = array($product->program => $program->name);
|
||||
}
|
||||
|
||||
|
||||
$this->view->title = $this->lang->product->edit . $this->lang->colon . $product->name;
|
||||
$this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $product->name);
|
||||
$this->view->position[] = $this->lang->product->edit;
|
||||
@@ -517,7 +526,7 @@ class product extends control
|
||||
$this->view->qdUsers = $qdUsers;
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
|
||||
$this->view->programs = array('') + $this->loadModel('program')->getTopPairs();
|
||||
$this->view->programs = array('') + $programs;
|
||||
$this->view->lines = $lines;
|
||||
$this->view->URSRPairs = $this->loadModel('custom')->getURSRPairs();
|
||||
$this->view->canChangeProgram = $canChangeProgram;
|
||||
@@ -586,13 +595,23 @@ class product extends control
|
||||
$rdUsers = $this->user->getPairs('nodeleted|devfirst', $appendRdUsers);
|
||||
if(!empty($this->config->user->moreLink)) $this->config->moreLinks["RD"] = $this->config->user->moreLink;
|
||||
|
||||
$programs = array();
|
||||
$programs = array();
|
||||
$unauthorizedPrograms = array();
|
||||
if($this->config->systemMode == 'new')
|
||||
{
|
||||
/* Get product lines by programs.*/
|
||||
$programs = $this->program->getTopPairs();
|
||||
$lines = array(0 => '');
|
||||
foreach($programs as $id => $program)
|
||||
|
||||
/* Get unauthorized programs. */
|
||||
$programIDList = array();
|
||||
foreach($products as $product)
|
||||
{
|
||||
if($product->program and !isset($programs[$product->program]) and !in_array($product->program, $programIDList)) $programIDList[] = $product->program;
|
||||
}
|
||||
$unauthorizedPrograms = $this->program->getPairsByList($programIDList);
|
||||
|
||||
/* Get product lines by programs.*/
|
||||
$lines = array(0 => '');
|
||||
foreach($programs + $unauthorizedPrograms as $id => $program)
|
||||
{
|
||||
$lines[$id] = array('') + $this->product->getLinePairs($id);
|
||||
}
|
||||
@@ -602,16 +621,17 @@ class product extends control
|
||||
$lines = array('') + $this->product->getLinePairs();
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->product->batchEdit;
|
||||
$this->view->position[] = $this->lang->product->batchEdit;
|
||||
$this->view->lines = $lines;
|
||||
$this->view->productIDList = $productIDList;
|
||||
$this->view->products = $products;
|
||||
$this->view->poUsers = $poUsers;
|
||||
$this->view->qdUsers = $qdUsers;
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
$this->view->programID = $programID;
|
||||
$this->view->programs = array('' => '') + $programs;
|
||||
$this->view->title = $this->lang->product->batchEdit;
|
||||
$this->view->position[] = $this->lang->product->batchEdit;
|
||||
$this->view->lines = $lines;
|
||||
$this->view->productIDList = $productIDList;
|
||||
$this->view->products = $products;
|
||||
$this->view->poUsers = $poUsers;
|
||||
$this->view->qdUsers = $qdUsers;
|
||||
$this->view->rdUsers = $rdUsers;
|
||||
$this->view->programID = $programID;
|
||||
$this->view->programs = array('' => '') + $programs;
|
||||
$this->view->unauthorizedPrograms = $unauthorizedPrograms;
|
||||
|
||||
unset($this->lang->product->typeList['']);
|
||||
$this->display();
|
||||
|
||||
@@ -39,14 +39,11 @@ $(function()
|
||||
{
|
||||
setTimeout(function()
|
||||
{
|
||||
var checkedProduct = true;
|
||||
$("[id^='productIDList']").each(function()
|
||||
{
|
||||
if(!$(this).prop('checked')) checkedProduct = false;
|
||||
})
|
||||
console.log(checkedProduct);
|
||||
if(checkedProduct) $('.check-all').addClass('checked');
|
||||
if(!checkedProduct) $('.check-all').removeClass('checked');
|
||||
var allCount = $("[id^='productIDList']").length;
|
||||
var checkedCount = $("[id^='productIDList']:checked").length;
|
||||
|
||||
if(allCount == checkedCount) $('.check-all').addClass('checked');
|
||||
if(allCount != checkedCount) $('.check-all').removeClass('checked');
|
||||
}, 100)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -657,7 +657,7 @@ class productModel extends model
|
||||
|
||||
$productID = (int)$productID;
|
||||
$products[$productID] = new stdClass();
|
||||
if($this->config->systemMode == 'new') $products[$productID]->program = $data->programs[$productID];
|
||||
if($this->config->systemMode == 'new' and isset($data->programs[$productID])) $products[$productID]->program = $data->programs[$productID];
|
||||
$products[$productID]->name = $productName;
|
||||
$products[$productID]->line = (int)$data->lines[$productID];
|
||||
$products[$productID]->PO = $data->POs[$productID];
|
||||
|
||||
@@ -76,10 +76,15 @@
|
||||
<tr>
|
||||
<td><?php echo sprintf('%03d', $productID) . html::hidden("productIDList[$productID]", $productID);?></td>
|
||||
<?php if($this->config->systemMode == 'new'):?>
|
||||
<?php if(isset($unauthorizedPrograms[$products[$productID]->program])):?>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'program', ' hidden')?>' style='overflow:visible'><?php echo html::select("programs[$productID]", $unauthorizedPrograms, $products[$productID]->program, "class='form-control' disabled");?></td>
|
||||
<?php else:?>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'program', ' hidden')?>' style='overflow:visible'><?php echo html::select("programs[$productID]", $programs, $products[$productID]->program, "class='form-control picker-select' onchange='loadProductLines(this.value, $productID)'");?></td>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
<td title='<?php echo $products[$productID]->name?>'><?php echo html::input("names[$productID]", $products[$productID]->name, "class='form-control'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'line', ' hidden')?>' style='overflow:visible' id="line_<?php echo $productID;?>"><?php echo html::select("lines[$productID]", $this->config->systemMode == 'new' ? $lines[$products[$productID]->program] : $lines, $products[$productID]->line, "class='form-control picker-select'");?></td>
|
||||
<?php $productLines = isset($lines[$products[$productID]->program]) ? $lines[$products[$productID]->program] : '';?>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'line', ' hidden')?>' style='overflow:visible' id="line_<?php echo $productID;?>"><?php echo html::select("lines[$productID]", $this->config->systemMode == 'new' ? $productLines : $lines, $products[$productID]->line, "class='form-control picker-select'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'PO', ' hidden')?>' style='overflow:visible'><?php echo html::select("POs[$productID]", $poUsers, $products[$productID]->PO, "class='form-control picker-select'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'QD', ' hidden')?>' style='overflow:visible'><?php echo html::select("QDs[$productID]", $qdUsers, $products[$productID]->QD, "class='form-control picker-select'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'RD', ' hidden')?>' style='overflow:visible'><?php echo html::select("RDs[$productID]", $rdUsers, $products[$productID]->RD, "class='form-control picker-select'");?></td>
|
||||
|
||||
@@ -35,7 +35,9 @@
|
||||
<?php if($this->config->systemMode == 'new'):?>
|
||||
<tr>
|
||||
<th class='w-140px'><?php echo $lang->product->program;?></th>
|
||||
<td><?php echo html::select('program', $programs, $product->program, "class='form-control chosen'");?></td>
|
||||
<?php $attr = strpos(",{$this->app->user->view->programs},", ",{$product->program},") === false ? 'disabled' : '';?>
|
||||
<?php if($attr == 'disabled') echo html::hidden('program', $product->program);?>
|
||||
<td><?php echo html::select('program', $programs, $product->program, "class='form-control chosen' $attr");?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#mainMenu .pull-left .checkbox-primary {display: inline-block; margin-left: 10px;}
|
||||
.main-table tbody>tr>td:first-child, .main-table thead>tr>th:first-child {padding-left: 8px;}
|
||||
.table tbody>tr>td .dropdown {display: inline-block; line-height: 1;}
|
||||
tbody.sortable > tr > td.sort-handler .table-nest-toggle:before {cursor: pointer !important;}
|
||||
|
||||
@@ -101,6 +101,22 @@ class programModel extends model
|
||||
return $program;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get program pairs by id list.
|
||||
*
|
||||
* @param string|array $programIDList
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getPairsByList($programIDList = '')
|
||||
{
|
||||
return $this->dao->select('id, name')->from(TABLE_PROGRAM)
|
||||
->where('id')->in($programIDList)
|
||||
->andWhere('`type`')->eq('program')
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get program list.
|
||||
*
|
||||
@@ -728,7 +744,7 @@ class programModel extends model
|
||||
|
||||
/**
|
||||
* Get parent PM by programIdList.
|
||||
*
|
||||
*
|
||||
* @param array $programIdList
|
||||
* @access public
|
||||
* @return void
|
||||
@@ -739,24 +755,24 @@ class programModel extends model
|
||||
|
||||
$parents = array();
|
||||
foreach($objects as $object)
|
||||
{
|
||||
{
|
||||
if($object->parent == 0) continue;
|
||||
foreach(explode(',', $object->path) as $objectID)
|
||||
{
|
||||
{
|
||||
if(empty($objectID) || $objectID == $object->id) continue;
|
||||
$parents[$objectID][] = $object->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get all parent PM.*/
|
||||
$parentPM = $this->dao->select('id, PM')->from(TABLE_PROGRAM)->where('id')->in(array_keys($parents))->andWhere('deleted')->eq('0')->fetchAll();
|
||||
|
||||
$parentPMGroup = array();
|
||||
foreach($parentPM as $PM)
|
||||
{
|
||||
{
|
||||
$subPrograms = zget($parents, $PM->id, array());
|
||||
foreach($subPrograms as $subProgramID) $parentPMGroup[$subProgramID][$PM->PM] = $PM->PM;
|
||||
}
|
||||
}
|
||||
|
||||
return $parentPMGroup;
|
||||
}
|
||||
|
||||
@@ -416,7 +416,6 @@ class project extends control
|
||||
->where('t1.project')->eq($projectID)
|
||||
->andWhere('t2.plan')->in(array_keys($oldPlans))
|
||||
->fetchAll('story');
|
||||
$diffResult = array_diff($oldPlans, $_POST['plans']);
|
||||
|
||||
$changes = $this->project->update($projectID);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
@@ -428,6 +427,7 @@ class project extends control
|
||||
}
|
||||
|
||||
/* Link the plan stories. */
|
||||
$diffResult = array_diff($oldPlans, $_POST['plans']);
|
||||
if(!empty($_POST['plans']) and !empty($diffResult))
|
||||
{
|
||||
$this->loadModel('productplan')->linkProject($projectID, $_POST['plans'], $oldPlanStories);
|
||||
@@ -471,6 +471,7 @@ class project extends control
|
||||
$this->view->users = $this->user->getPairs('noclosed|nodeleted');
|
||||
$this->view->project = $project;
|
||||
$this->view->programList = $this->program->getParentPairs();
|
||||
$this->view->program = $this->program->getByID($project->parent);
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->allProducts = array('0' => '') + $allProducts;
|
||||
$this->view->productPlans = $productPlans;
|
||||
@@ -519,14 +520,23 @@ class project extends control
|
||||
$projectIdList = $this->post->projectIdList ? $this->post->projectIdList : die(js::locate($this->session->projectList, 'parent'));
|
||||
$projects = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->in($projectIdList)->fetchAll('id');
|
||||
|
||||
foreach($projects as $project) $appendPMUsers[$project->PM] = $project->PM;
|
||||
/* Get program list. */
|
||||
$programs = $this->loadModel('program')->getParentPairs();
|
||||
$unauthorizedIDList = array();
|
||||
foreach($projects as $project)
|
||||
{
|
||||
if(!isset($programs[$project->parent]) and !in_array($project->parent, $unauthorizedIDList)) $unauthorizedIDList[] = $project->parent;
|
||||
$appendPMUsers[$project->PM] = $project->PM;
|
||||
}
|
||||
$unauthorizedPrograms = $this->program->getPairsByList($unauthorizedIDList);
|
||||
|
||||
$this->view->title = $this->lang->project->batchEdit;
|
||||
$this->view->position[] = $this->lang->project->batchEdit;
|
||||
|
||||
$this->view->projects = $projects;
|
||||
$this->view->programList = $this->loadModel('program')->getParentPairs();
|
||||
$this->view->PMUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $appendPMUsers);
|
||||
$this->view->projects = $projects;
|
||||
$this->view->programs = $programs;
|
||||
$this->view->unauthorizedPrograms = $unauthorizedPrograms;
|
||||
$this->view->PMUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $appendPMUsers);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -976,8 +976,8 @@ class projectModel extends model
|
||||
$projectName = $data->names[$projectID];
|
||||
|
||||
$projects[$projectID] = new stdClass();
|
||||
if(isset($data->parents[$projectID])) $projects[$projectID]->parent = $data->parents[$projectID];
|
||||
$projects[$projectID]->name = $projectName;
|
||||
$projects[$projectID]->parent = $data->parents[$projectID];
|
||||
$projects[$projectID]->PM = $data->PMs[$projectID];
|
||||
$projects[$projectID]->begin = $data->begins[$projectID];
|
||||
$projects[$projectID]->end = isset($data->ends[$projectID]) ? $data->ends[$projectID] : LONG_TIME;
|
||||
|
||||
@@ -37,7 +37,11 @@
|
||||
<?php $aclList = $project->parent ? $lang->program->subAcls : $lang->project->acls;?>
|
||||
<tr>
|
||||
<td><?php echo sprintf('%03d', $projectID) . html::hidden("projectIdList[$projectID]", $projectID);?></td>
|
||||
<td><?php echo html::select("parents[$projectID]", $programList, $project->parent, "class='form-control chosen' data-id='$projectID' data-name='{$project->name}' data-parent='{$project->parent}'");?></td>
|
||||
<?php if(isset($unauthorizedPrograms[$project->parent])):?>
|
||||
<td><?php echo html::select("parents[$projectID]", $unauthorizedPrograms, $project->parent, "class='form-control chosen' data-id='$projectID' data-name='{$project->name}' data-parent='{$project->parent}' disabled");?></td>
|
||||
<?php else:?>
|
||||
<td><?php echo html::select("parents[$projectID]", $programs, $project->parent, "class='form-control chosen' data-id='$projectID' data-name='{$project->name}' data-parent='{$project->parent}'");?></td>
|
||||
<?php endif;?>
|
||||
<td title='<?php echo $project->name;?>'><?php echo html::input("names[$projectID]", $project->name, "class='form-control'");?></td>
|
||||
<td><?php echo html::select("PMs[$projectID]", $PMUsers, $project->PM, "class='form-control chosen'");?></td>
|
||||
<td>
|
||||
|
||||
@@ -32,7 +32,16 @@
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-120px'><?php echo $lang->program->parent;?></th>
|
||||
<td><?php echo html::select('parent', $programList, $project->parent, "class='form-control chosen'");?></td>
|
||||
<?php
|
||||
$attr = '';
|
||||
if(!isset($programList[$project->parent]))
|
||||
{
|
||||
echo html::hidden('parent', $project->parent);
|
||||
$attr = 'disabled';
|
||||
$programList = array($project->parent => $program->name);
|
||||
}
|
||||
?>
|
||||
<td><?php echo html::select('parent', $programList, $project->parent, "class='form-control chosen' $attr");?></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
+25
-29
@@ -129,12 +129,11 @@ class repo extends control
|
||||
|
||||
$this->app->loadLang('action');
|
||||
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->create;
|
||||
$this->view->position[] = $this->lang->repo->create;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
|
||||
$this->view->products = $this->loadModel('product')->getProductPairsByProject($objectID);
|
||||
$this->view->gitlabHosts = $this->loadModel('gitlab')->getPairs();
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->create;
|
||||
$this->view->position[] = $this->lang->repo->create;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
|
||||
$this->view->products = $this->loadModel('product')->getProductPairsByProject($objectID);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -177,16 +176,15 @@ class repo extends control
|
||||
$this->view->projects = $options;
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->edit;
|
||||
$repo->repoType = $repo->id . '-' . $repo->SCM;
|
||||
$this->view->repo = $repo;
|
||||
$this->view->repoID = $repoID;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
|
||||
$this->view->products = $objectID ? $this->loadModel('product')->getProductPairsByProject($objectID) : $this->loadModel('product')->getPairs();
|
||||
$this->view->gitlabHosts = $this->loadModel('gitlab')->getPairs();
|
||||
$repo->repoType = $repo->id . '-' . $repo->SCM;
|
||||
$this->view->repo = $repo;
|
||||
$this->view->repoID = $repoID;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
|
||||
$this->view->products = $objectID ? $this->loadModel('product')->getProductPairsByProject($objectID) : $this->loadModel('product')->getPairs();
|
||||
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->edit;
|
||||
$this->view->position[] = html::a(inlink('maintain'), $this->lang->repo->common);
|
||||
$this->view->position[] = $this->lang->repo->edit;
|
||||
|
||||
@@ -209,9 +207,6 @@ class repo extends control
|
||||
die(js::confirm($this->lang->repo->notice->delete, $this->repo->createLink('delete', "repoID=$repoID&objectID=$objectID&confirm=yes")));
|
||||
}
|
||||
|
||||
/* Delete project relation for gitlab type. */
|
||||
$this->loadModel('gitlab')->deleteProjectRelation($repoID);
|
||||
|
||||
$relationID = $this->dao->select('id')->from(TABLE_RELATION)->where('extra')->eq($repoID)->fetch();
|
||||
if($relationID)
|
||||
{
|
||||
@@ -1110,16 +1105,17 @@ class repo extends control
|
||||
die($reposHtml);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get gitlab projects.
|
||||
*
|
||||
* @param int $host
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetGitlabProjects($host, $token)
|
||||
{
|
||||
$host = helper::safe64decode($host);
|
||||
/**
|
||||
* Ajax get gitlab projects.
|
||||
*
|
||||
* @param string $host
|
||||
* @param string $token
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetGitlabProjects($host, $token)
|
||||
{
|
||||
$host = helper::safe64decode($host);
|
||||
$projects = $this->repo->getgitlabprojects($host, $token);
|
||||
|
||||
if(!$projects) $this->send(array('message' => array()));
|
||||
@@ -1129,8 +1125,8 @@ class repo extends control
|
||||
{
|
||||
$options .= "<option value='{$project->id}' data-name='{$project->name}'>{$project->name}:{$project->http_url_to_repo}</option>";
|
||||
}
|
||||
die($options);
|
||||
|
||||
die($options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -126,7 +126,6 @@ $lang->repo->encodingList['gbk'] = 'GBK';
|
||||
$lang->repo->scmList['Git'] = '本地 Git';
|
||||
$lang->repo->scmList['Gitlab'] = 'Gitlab';
|
||||
$lang->repo->scmList['Subversion'] = 'Subversion';
|
||||
$lang->repo->scmList['Gitlab'] = 'Gitlab';
|
||||
|
||||
$lang->repo->gitlabHost = 'GitLab Server';
|
||||
$lang->repo->gitlabToken = 'GitLab Token';
|
||||
|
||||
+7
-20
@@ -153,8 +153,6 @@ class repoModel extends model
|
||||
if(!$hasPriv) unset($repos[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
if($repo->SCM == 'Gitlab') $repo = $this->processGitlab($repo);
|
||||
}
|
||||
|
||||
return $repos;
|
||||
@@ -198,16 +196,15 @@ class repoModel extends model
|
||||
if(!$this->checkConnection()) return false;
|
||||
|
||||
$data = fixer::input('post')
|
||||
->setIf($this->post->SCM == 'Gitlab', 'password', '')
|
||||
->setIf($this->post->SCM == 'Gitlab', 'path', $this->post->gitlabProject)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'password', $this->post->gitlabToken)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'client', $this->post->gitlabHost)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'extra', $this->post->gitlabProject)
|
||||
->skipSpecial('path,client,account,password')
|
||||
->setDefault('product', '')
|
||||
->join('product', ',')
|
||||
->get();
|
||||
|
||||
/* see this file in 1783G: processGitlab::$repo->path */
|
||||
if($this->post->SCM == 'Gitlab') $data->path = $this->post->gitlabProject;
|
||||
if($this->post->SCM == 'Gitlab') $data->path = sprintf($this->config->repo->gitlab->apiPath, $data->gitlabHost, $this->post->gitlabProject);
|
||||
|
||||
$data->acl = empty($data->acl) ? '' : json_encode($data->acl);
|
||||
|
||||
@@ -229,14 +226,8 @@ class repoModel extends model
|
||||
->exec();
|
||||
|
||||
if(!dao::isError()) $this->rmClientVersionFile();
|
||||
$repoID = $this->dao->lastInsertID();
|
||||
|
||||
$this->loadModel('gitlab');
|
||||
if($this->post->SCM == 'Gitlab')
|
||||
{
|
||||
$this->gitlab->saveProjectRelation($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject);
|
||||
}
|
||||
return $repoID;
|
||||
return $this->dao->lastInsertID();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,9 +242,9 @@ class repoModel extends model
|
||||
$repo = $this->getRepoByID($id);
|
||||
|
||||
$data = fixer::input('post')
|
||||
->setIf($this->post->SCM == 'Gitlab', 'password', '')
|
||||
->setIf($this->post->SCM == 'Gitlab', 'path', $this->post->gitlabProject)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'password', $this->post->gitlabToken)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'client', $this->post->gitlabHost)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'extra', $this->post->gitlabProject)
|
||||
->setDefault('client', 'svn')
|
||||
->setDefault('prefix', $repo->prefix)
|
||||
->setDefault('product', '')
|
||||
@@ -261,6 +252,7 @@ class repoModel extends model
|
||||
->join('product', ',')
|
||||
->get();
|
||||
|
||||
if($this->post->SCM == 'Gitlab') $data->path = sprintf($this->config->repo->gitlab->apiPath, $data->gitlabHost, $this->post->gitlabProject);
|
||||
if($data->path != $repo->path) $data->synced = 0;
|
||||
|
||||
$data->acl = empty($data->acl) ? '' : json_encode($data->acl);
|
||||
@@ -281,7 +273,6 @@ class repoModel extends model
|
||||
if($data->client != $repo->client and !$this->checkClient()) return false;
|
||||
if(!$this->checkConnection()) return false;
|
||||
|
||||
|
||||
if($data->encrypt == 'base64') $data->password = base64_encode($data->password);
|
||||
$this->dao->update(TABLE_REPO)->data($data, $skip = 'gitlabHost,gitlabToken,gitlabProject')
|
||||
->batchCheck($this->config->repo->edit->requiredFields, 'notempty')
|
||||
@@ -292,15 +283,12 @@ class repoModel extends model
|
||||
|
||||
$this->rmClientVersionFile();
|
||||
|
||||
$this->loadModel('gitlab');
|
||||
if($repo->SCM == 'Gitlab') $this->gitlab->saveProjectRelation($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject);
|
||||
if($repo->path != $data->path)
|
||||
{
|
||||
$this->dao->delete()->from(TABLE_REPOHISTORY)->where('repo')->eq($id)->exec();
|
||||
$this->dao->delete()->from(TABLE_REPOFILES)->where('repo')->eq($id)->exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -384,7 +372,6 @@ class repoModel extends model
|
||||
if(!$repo) return false;
|
||||
|
||||
if($repo->encrypt == 'base64') $repo->password = base64_decode($repo->password);
|
||||
if($repo->SCM == 'Gitlab') $reps = $this->processGitlab($repo);
|
||||
$repo->acl = json_decode($repo->acl);
|
||||
return $repo;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class='text' title='<?php if(strtolower($repo->SCM) == "gitlab") echo $lang->repo->pathTipsForGitlab; else echo $repo->path; ?>'><?php echo $repo->path; ?></td>
|
||||
<td class='text' title='<?php echo $repo->path; ?>'><?php echo $repo->path; ?></td>
|
||||
<td class='text-left c-actions'>
|
||||
<?php
|
||||
common::printIcon('repo', 'edit', "repoID=$repo->id&objectID=$objectID", '', 'list', 'edit');
|
||||
|
||||
@@ -487,7 +487,7 @@ class task extends control
|
||||
if($executionID)
|
||||
{
|
||||
$execution = $this->execution->getById($executionID);
|
||||
$this->execution->setMenu($this->execution->getPairs(), $execution->id);
|
||||
$this->execution->setMenu($execution->id);
|
||||
|
||||
/* Set modules and members. */
|
||||
$showAllModule = isset($this->config->task->allModule) ? $this->config->task->allModule : '';
|
||||
@@ -564,14 +564,18 @@ class task extends control
|
||||
$this->loadModel('action');
|
||||
$changes = $this->task->assign($taskID);
|
||||
|
||||
if($this->viewType == 'json') return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
if(dao::isError())
|
||||
{
|
||||
if($this->viewType == 'json') return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
die(js::error(dao::getError()));
|
||||
}
|
||||
|
||||
$actionID = $this->action->create('task', $taskID, 'Assigned', $this->post->comment, $this->post->assignedTo);
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
|
||||
$this->executeHooks($taskID);
|
||||
|
||||
if($this->viewType == 'json') return $this->send(array('result' => 'success'));
|
||||
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
|
||||
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
|
||||
}
|
||||
@@ -787,6 +791,7 @@ class task extends control
|
||||
}
|
||||
}
|
||||
|
||||
if($this->viewType == 'json') return $this->send(array('result' => 'success'));
|
||||
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
|
||||
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
|
||||
}
|
||||
|
||||
@@ -935,7 +935,7 @@ class taskModel extends model
|
||||
foreach($teams as $member) $this->dao->insert(TABLE_TEAM)->data($member)->autoCheck()->exec();
|
||||
|
||||
/* Assign the left hours to zero who will be skipped. */
|
||||
$skipMembers = $this->loadModel('execution')->getTeamSkip($oldTask->team, $oldTask->assignedTo, $task->assignedTo);
|
||||
$skipMembers = $this->loadModel('execution')->getTeamSkip($oldTask->team, $oldTask->assignedTo, isset($task->assignedTo) ? $task->assignedTo : $oldTask->assignedTo);
|
||||
foreach($skipMembers as $account => $team) $this->dao->update(TABLE_TEAM)->set('left')->eq(0)->where('root')->eq($taskID)->andWhere('type')->eq('task')->andWhere('account')->eq($account)->exec();
|
||||
|
||||
$task = $this->computeHours4Multiple($oldTask, $task, array(), $autoStatus = false);
|
||||
@@ -1389,8 +1389,7 @@ class taskModel extends model
|
||||
->where('id')->eq($taskID)->exec();
|
||||
|
||||
$task = $this->getById($taskID);
|
||||
$this->loadModel('gitlab');
|
||||
$relation = $this->gitlab->getRelationByObject('task', $taskID);
|
||||
$relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID);
|
||||
if(!empty($relation)) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID);
|
||||
|
||||
if(!dao::isError()) return common::createChanges($oldTask, $task);
|
||||
|
||||
@@ -92,7 +92,7 @@ js::set('dittoNotice', $dittoNotice);
|
||||
<?php
|
||||
$members = array('' => '', 'ditto' => $this->lang->task->ditto);
|
||||
$teamAccounts = !empty($executionTeams[$tasks[$taskID]->execution]) ? array_keys($executionTeams[$tasks[$taskID]->execution]) : array();
|
||||
foreach($teamAccounts as $teamAccount) $members[$teamAccount] = $users[$teamAccount];
|
||||
foreach($teamAccounts as $teamAccount) $members[$teamAccount] = zget($users, $teamAccount);
|
||||
$members['closed'] = 'Closed';
|
||||
|
||||
$taskMembers = array();
|
||||
|
||||
@@ -289,11 +289,7 @@ class upgrade extends control
|
||||
}
|
||||
|
||||
/* When upgrading historical data as a project, handle products that are not linked with the project. */
|
||||
if(!empty($singleProducts))
|
||||
{
|
||||
$this->upgrade->computeProductAcl($singleProducts, $programID);
|
||||
$this->upgrade->computeObjectMembers($programID, 0, $singleProducts);
|
||||
}
|
||||
if(!empty($singleProducts)) $this->upgrade->computeProductAcl($singleProducts, $programID);
|
||||
|
||||
/* Process unlinked sprint and product. */
|
||||
foreach($linkedProducts as $productID => $product)
|
||||
@@ -348,11 +344,7 @@ class upgrade extends control
|
||||
}
|
||||
|
||||
/* When upgrading historical data as a project, handle products that are not linked with the project. */
|
||||
if(!empty($singleProducts))
|
||||
{
|
||||
$this->upgrade->computeProductAcl($singleProducts, $programID);
|
||||
$this->upgrade->computeObjectMembers($programID, 0, $singleProducts);
|
||||
}
|
||||
if(!empty($singleProducts)) $this->upgrade->computeProductAcl($singleProducts, $programID);
|
||||
}
|
||||
elseif($type == 'sprint')
|
||||
{
|
||||
@@ -398,6 +390,7 @@ class upgrade extends control
|
||||
/* When all products and projects merged then finish and locate afterExec page. */
|
||||
if(empty($noMergedProductCount) and empty($noMergedSprintCount))
|
||||
{
|
||||
$this->upgrade->computeObjectMembers();
|
||||
$this->upgrade->initUserView();
|
||||
$this->upgrade->setDefaultPriv();
|
||||
$this->dao->update(TABLE_CONFIG)->set('value')->eq('0_0')->where('`key`')->eq('productProject')->exec();
|
||||
|
||||
@@ -8,7 +8,7 @@ $(function()
|
||||
{
|
||||
$('[data-id=' + e.id + ']').prop('checked', true);
|
||||
|
||||
var lineID = $('.nav li.active').attr('lineid');
|
||||
var lineID = $('.nav li.currentPage').attr('lineid');
|
||||
var checkedLines = true;
|
||||
var checkedProduct = true;
|
||||
var checkedProject = true;
|
||||
@@ -19,7 +19,7 @@ $(function()
|
||||
{
|
||||
if($('.nav li.currentPage').find('[id^=productLines]').prop('checked'))
|
||||
{
|
||||
var lineID = $('.nav li.active').attr('lineid');
|
||||
var lineID = $('.nav li.currentPage').attr('lineid');
|
||||
$('#checkAllProducts').prop('checked', true);
|
||||
$('#checkAllProjects').prop('checked', true);
|
||||
$("[id^='products\[" + lineID + "\]']").prop('checked', true);
|
||||
@@ -118,6 +118,7 @@ $(function()
|
||||
$('[name^=products]').prop('checked', true);
|
||||
$('[name^=sprints]').prop('checked', true);
|
||||
$('.main-row .side-col .nav li').addClass('active');
|
||||
$('#programName').val($('.main-row .side-col .nav li.currentPage div a').text());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -127,6 +128,7 @@ $(function()
|
||||
$('[name^=products]').prop('checked', false);
|
||||
$('[name^=sprints]').prop('checked', false);
|
||||
$('.main-row .side-col .nav li').removeClass('active');
|
||||
$('#programName').val('');
|
||||
}
|
||||
|
||||
/* If the project is checked, the relevant form will be displayed according to the selected mode. */
|
||||
@@ -136,13 +138,14 @@ $(function()
|
||||
/* Select all product events. */
|
||||
$('#checkAllProducts').click(function()
|
||||
{
|
||||
var lineID = $('li.active').attr('lineid');
|
||||
var lineID = $('li.currentPage').attr('lineid');
|
||||
if($(this).is(':checked'))
|
||||
{
|
||||
$("[id^='productLines\[" + lineID + "\]']").prop('checked', true);
|
||||
$('#checkAllProjects').prop('checked', true);
|
||||
$('[name^=products]').prop('checked', true);
|
||||
$('[name^=sprints]').prop('checked', true);
|
||||
$('#programName').val($('.main-row .side-col .nav li.currentPage div a').text());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -150,6 +153,7 @@ $(function()
|
||||
$('#checkAllProjects').prop('checked', false);
|
||||
$('[name^=products]').prop('checked', false);
|
||||
$('[name^=sprints]').prop('checked', false);
|
||||
$('#programName').val('');
|
||||
}
|
||||
hiddenProject();
|
||||
})
|
||||
@@ -157,13 +161,14 @@ $(function()
|
||||
/* Select all project events. */
|
||||
$('#checkAllProjects').click(function()
|
||||
{
|
||||
var lineID = $('li.active').attr('lineid');
|
||||
var lineID = $('li.currentPage').attr('lineid');
|
||||
if($(this).is(':checked'))
|
||||
{
|
||||
$("[id^='productLines\[" + lineID + "\]']").prop('checked', true);
|
||||
$('#checkAllProducts').prop('checked', true);
|
||||
$('[name^=products]').prop('checked', true);
|
||||
$('[name^=sprints]').prop('checked', true);
|
||||
$('#programName').val($('.main-row .side-col .nav li.currentPage div a').text());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -171,6 +176,7 @@ $(function()
|
||||
$('#checkAllProducts').prop('checked', false);
|
||||
$('[name^=products]').prop('checked', false);
|
||||
$('[name^=sprints]').prop('checked', false);
|
||||
$('#programName').val('');
|
||||
}
|
||||
hiddenProject();
|
||||
})
|
||||
@@ -266,11 +272,12 @@ $(function()
|
||||
}
|
||||
|
||||
var currentLine = $(this).closest('li').attr('lineid');
|
||||
$(this).closest('ul').find('li').removeClass('currentPage');
|
||||
$(this).closest('li').addClass('currentPage');
|
||||
|
||||
/* Active current li and remove active before li. */
|
||||
$(this).closest('li').addClass('active');
|
||||
$(this).closest('ul').find('li').removeClass('currentPage');
|
||||
$(this).closest('li').addClass('currentPage');
|
||||
|
||||
$('[id^=productLines]').each(function()
|
||||
{
|
||||
var lineID = $(this).val();
|
||||
|
||||
@@ -86,8 +86,8 @@ $lang->upgrade->mergeProgramDesc = <<<EOD
|
||||
<p>You can set {$lang->projectCommon}s as one new project.</p>
|
||||
EOD;
|
||||
|
||||
$lang->upgrade->to15Mode['classic'] = 'Keep the old version';
|
||||
$lang->upgrade->to15Mode['new'] = 'New program management mode';
|
||||
$lang->upgrade->to15Mode['classic'] = 'Keep the classic mode';
|
||||
$lang->upgrade->to15Mode['new'] = 'Use the program mode';
|
||||
|
||||
$lang->upgrade->selectedModeTips['classic'] = 'You can also switch to the new program set management mode in the background-Customize in the future.';
|
||||
$lang->upgrade->selectedModeTips['new'] = 'Switching to the program management mode requires merging the previous data, and the system will guide you to complete this operation.';
|
||||
|
||||
+82
-69
@@ -4520,9 +4520,7 @@ class upgradeModel extends model
|
||||
|
||||
foreach($sprintCases as $projectCase)
|
||||
{
|
||||
$projectCase->order = $projectCase * 5;
|
||||
$this->dao->replace(TABLE_PROJECTCASE)->data($projectCase)->exec();
|
||||
|
||||
$projectCase->order = $projectCase * 5;
|
||||
$projectCase->project = $projectID;
|
||||
$this->dao->replace(TABLE_PROJECTCASE)->data($projectCase)->exec();
|
||||
}
|
||||
@@ -4531,7 +4529,7 @@ class upgradeModel extends model
|
||||
$project = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch();
|
||||
$sprints = $this->dao->select('id, type, acl, begin, end')->from(TABLE_PROJECT)->where('id')->in($sprintIdList)->fetchAll();
|
||||
$minBeginDate = $project->begin;
|
||||
$maxEndData = $project->end;
|
||||
$maxEndDate = $project->end;
|
||||
foreach($sprints as $sprint)
|
||||
{
|
||||
$data = new stdclass();
|
||||
@@ -4545,7 +4543,7 @@ class upgradeModel extends model
|
||||
$this->dao->update(TABLE_PROJECT)->data($data)->where('id')->eq($sprint->id)->exec();
|
||||
|
||||
$minBeginDate = ($sprint->begin < $minBeginDate) ? $sprint->begin : $minBeginDate;
|
||||
$maxEndData = $sprint->end > $maxEndData ? $sprint->end : $maxEndData;
|
||||
$maxEndDate = $sprint->end > $maxEndDate ? $sprint->end : $maxEndDate;
|
||||
}
|
||||
|
||||
/* Compute project date and status. */
|
||||
@@ -4564,10 +4562,10 @@ class upgradeModel extends model
|
||||
$data->closedDate = $maxRealEnd;
|
||||
}
|
||||
|
||||
if($minBeginDate != $project->begin or $maxEndData != $project->end)
|
||||
if($minBeginDate != $project->begin or $maxEndDate != $project->end)
|
||||
{
|
||||
$data->begin = $minBeginDate;
|
||||
$data->end = $maxEndData;
|
||||
$data->end = $maxEndDate;
|
||||
$data->days = $this->computeDaysDelta($data->begin, $data->end);
|
||||
}
|
||||
|
||||
@@ -4582,8 +4580,6 @@ class upgradeModel extends model
|
||||
|
||||
$this->dao->replace(TABLE_PROJECTPRODUCT)->data($data)->exec();
|
||||
}
|
||||
|
||||
$this->computeObjectMembers($programID, $projectID, $productIdList, $sprintIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4613,95 +4609,112 @@ class upgradeModel extends model
|
||||
/**
|
||||
* Compute program and project members.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param int $projectID
|
||||
* @param array $productIdList
|
||||
* @param array $sprintIdList
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function computeObjectMembers($programID, $projectID, $productIdList = array(), $sprintIdList = array())
|
||||
public function computeObjectMembers()
|
||||
{
|
||||
$projects = $this->dao->select('id,days')->from(TABLE_PROJECT)->where('type')->eq('project')->fetchAll('id');
|
||||
$projectIdList = array_keys($projects);
|
||||
|
||||
/* Get product and sprint team. */
|
||||
$teams = array();
|
||||
$products = $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->in($productIdList)->fetchAll('id');
|
||||
$sprints = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->in($sprintIdList)->fetchAll('id');
|
||||
foreach($products as $product)
|
||||
{
|
||||
$teams[$product->PO] = $product->PO;
|
||||
$teams[$product->QD] = $product->QD;
|
||||
$teams[$product->RD] = $product->RD;
|
||||
if(isset($product->feedback)) $teams[$product->feedback] = $product->feedback;
|
||||
}
|
||||
$teams = array();
|
||||
$productGroups = $this->dao->select('t1.project,t1.product,t3.*')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product=t3.id')
|
||||
->where('t2.id')->in($projectIdList)
|
||||
->fetchGroup('project', 'product');
|
||||
$sprintGroups = $this->dao->select('*')->from(TABLE_PROJECT)->where('project')->in($projectIdList)->fetchGroup('project', 'id');
|
||||
$teamGroups = $this->dao->select('root,account')->from(TABLE_TEAM)->where('type')->eq('execution')->fetchGroup('root', 'account');
|
||||
$users = $this->dao->select('*')->from(TABLE_USER)->where('deleted')->eq('0')->fetchAll('account');
|
||||
$groupAccounts = $this->dao->select('*')->from(TABLE_USERGROUP)->fetchGroup('group', 'account');
|
||||
|
||||
foreach($sprints as $sprint)
|
||||
$projectTeams = array();
|
||||
foreach($projectIdList as $projectID)
|
||||
{
|
||||
$teams[$sprint->PO] = $sprint->PO;
|
||||
$teams[$sprint->PM] = $sprint->PM;
|
||||
$teams[$sprint->QD] = $sprint->QD;
|
||||
$teams[$sprint->RD] = $sprint->RD;
|
||||
if(isset($sprint->feedback)) $teams[$sprint->feedback] = $sprint->feedback;
|
||||
}
|
||||
$teams = array();
|
||||
$products = zget($productGroups, $projectID, array());
|
||||
foreach($products as $product)
|
||||
{
|
||||
$teams[$product->PO] = $product->PO;
|
||||
$teams[$product->QD] = $product->QD;
|
||||
$teams[$product->RD] = $product->RD;
|
||||
if(isset($product->feedback)) $teams[$product->feedback] = $product->feedback;
|
||||
}
|
||||
|
||||
$teams += $this->dao->select('account')->from(TABLE_TEAM)->where('type')->eq('execution')->andWhere('root')->in($sprintIdList)->fetchPairs('account', 'account');
|
||||
$users = $this->dao->select('account')->from(TABLE_USER)->where('deleted')->eq('0')->fetchPairs('account', 'account');
|
||||
$sprints = zget($sprintGroups, $projectID, array());
|
||||
foreach($sprints as $sprint)
|
||||
{
|
||||
$teams[$sprint->PO] = $sprint->PO;
|
||||
$teams[$sprint->PM] = $sprint->PM;
|
||||
$teams[$sprint->QD] = $sprint->QD;
|
||||
$teams[$sprint->RD] = $sprint->RD;
|
||||
if(isset($sprint->feedback)) $teams[$sprint->feedback] = $sprint->feedback;
|
||||
|
||||
$sprintTeams = zget($teamGroups, $sprint->id, array());
|
||||
foreach($sprintTeams as $account => $team) $teams[$account] = $account;
|
||||
}
|
||||
|
||||
$projectTeams[$projectID] = $teams;
|
||||
}
|
||||
|
||||
/* Insert product and sprint team into project team. */
|
||||
$today = helper::today();
|
||||
$project = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch();
|
||||
$projectMember = $this->dao->select('*')->from(TABLE_TEAM)->where('account')->in($teams)->fetchAll('account');
|
||||
foreach($projectMember as $account => $user)
|
||||
$today = helper::today();
|
||||
foreach($projectTeams as $projectID => $projectMember)
|
||||
{
|
||||
if(empty($account)) continue;
|
||||
if(!isset($users[$account])) continue;
|
||||
$project = zget($projects, $projectID, '');
|
||||
foreach($projectMember as $account)
|
||||
{
|
||||
if(empty($account)) continue;
|
||||
if(!isset($users[$account])) continue;
|
||||
|
||||
$team = new stdclass();
|
||||
$team->root = $projectID;
|
||||
$team->type = 'project';
|
||||
$team->account = $account;
|
||||
$team->role = $user->role;
|
||||
$team->join = $today;
|
||||
$team->days = $project->days;
|
||||
$team->hours = '7.0';
|
||||
$this->dao->replace(TABLE_TEAM)->data($team)->exec();
|
||||
$user = $users[$account];
|
||||
$team = new stdclass();
|
||||
$team->root = $projectID;
|
||||
$team->type = 'project';
|
||||
$team->account = $account;
|
||||
$team->role = $user->role;
|
||||
$team->join = $today;
|
||||
$team->days = $project->days;
|
||||
$team->hours = '7.0';
|
||||
$this->dao->replace(TABLE_TEAM)->data($team)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
/* Get all actor in sprint and product. */
|
||||
foreach($productIdList as $productID) $productIdList[$productID] = ",{$productID},";
|
||||
$whiteList = $this->dao->select('actor')->from(TABLE_ACTION)->where('execution')->in($sprintIdList)->orWhere('product')->in($productIdList)->fetchPairs('actor', 'actor');
|
||||
$whiteList = array_diff($whiteList, $teams);
|
||||
|
||||
/* Get all white list in sprint and product. */
|
||||
$this->loadModel('group');
|
||||
$this->loadModel('personnel');
|
||||
|
||||
foreach($products as $product)
|
||||
$customProducts = $this->dao->select('*')->from(TABLE_PRODUCT)->where('whitelist')->ne('')->fetchAll('id');
|
||||
$whitelistACL = $this->dao->select('account')->from(TABLE_ACL)->where('objectID')->in(array_keys($customProducts))->andWhere('objectType')->eq('product')->andWhere('type')->eq('whitelist')->fetchPairs('account');
|
||||
foreach($customProducts as $productID => $product)
|
||||
{
|
||||
if($product->acl != 'private') continue;
|
||||
|
||||
$groups = explode(',', $product->whitelist);
|
||||
$groupAccounts = $this->group->getGroupAccounts($groups);
|
||||
$whitelist = array();
|
||||
foreach(explode(',', $product->whitelist) as $group)
|
||||
{
|
||||
foreach(zget($groupAccounts, $group, array()) as $account => $userGroup) $whitelist[$account] = $account;
|
||||
}
|
||||
|
||||
/* Get the whitelist data from the classic version mode upgrade. */
|
||||
$groupAccounts += $this->dao->select('account')->from(TABLE_ACL)->where('objectID')->eq($product->id)->andWhere('objectType')->eq('product')->andWhere('type')->eq('whitelist')->fetchPairs('account');
|
||||
$whitelist += zget($whitelistACL, $productID, array());
|
||||
|
||||
$whiteList += $groupAccounts;
|
||||
$this->personnel->updateWhitelist($groupAccounts, 'product', $product->id, 'whitelist', 'upgrade');
|
||||
$this->personnel->updateWhitelist($whitelist, 'product', $product->id, 'whitelist', 'upgrade');
|
||||
}
|
||||
|
||||
$this->personnel->updateWhitelist($whiteList, 'project', $projectID, 'whitelist', 'upgrade');
|
||||
|
||||
foreach($sprints as $sprint)
|
||||
$customSprints = $this->dao->select('*')->from(TABLE_PROJECT)->where('whitelist')->ne('')->andWhere('type')->in('sprint,stage')->fetchAll('id');
|
||||
$whitelistACL = $this->dao->select('account')->from(TABLE_ACL)->where('objectID')->in(array_keys($customSprints))->andWhere('objectType')->eq('sprint')->andWhere('type')->eq('whitelist')->fetchPairs('account');
|
||||
foreach($customSprints as $sprint)
|
||||
{
|
||||
if($sprint->acl != 'private') continue;
|
||||
|
||||
$groups = explode(',', $sprint->whitelist);
|
||||
$groupAccounts = $this->group->getGroupAccounts($groups);
|
||||
$whitelist = array();
|
||||
foreach(explode(',', $sprint->whitelist) as $group)
|
||||
{
|
||||
foreach(zget($groupAccounts, $group, array()) as $account => $userGroup) $whitelist[$account] = $account;
|
||||
}
|
||||
|
||||
/* Get the whitelist data from the classic version mode upgrade. */
|
||||
$groupAccounts += $this->dao->select('account')->from(TABLE_ACL)->where('objectID')->eq($sprint->id)->andWhere('objectType')->eq('sprint')->andWhere('type')->eq('whitelist')->fetchPairs('account');
|
||||
|
||||
$this->personnel->updateWhitelist($groupAccounts, 'sprint', $sprint->id, 'whitelist', 'upgrade');
|
||||
$this->personnel->updateWhitelist($whitelist, 'sprint', $sprint->id, 'whitelist', 'upgrade');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -701,7 +701,7 @@ class user extends control
|
||||
}
|
||||
|
||||
/* if ajax request, send result. */
|
||||
if($this->server->ajax)
|
||||
if($this->server->ajax or $this->viewType == 'json')
|
||||
{
|
||||
if(dao::isError())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user