This commit is contained in:
tianshujie98
2021-08-11 15:04:46 +08:00
30 changed files with 328 additions and 214 deletions
+3 -6
View File
@@ -10,12 +10,9 @@ class myEntry extends entry
{
public function get()
{
$myModel = $this->loadModel('my');
$info = $this->loadModel('my')->getInfo();
$data = $myModel->myInfo();
if(!$data) return $this->sendError(400, $data->message);
$this->send(200, $data);
if(!$info) return $this->sendError(400, $info->message);
$this->send(200, $info);
}
}
+1 -3
View File
@@ -33,7 +33,7 @@ $routes['/tasks/:id/finish'] = 'taskFinish';
$routes['/users'] = 'users';
$routes['/users/:id'] = 'user';
$routes['/user'] = 'user';
$routes['/my'] = 'my';
$routes['/programs'] = 'programs';
$routes['/programs/:id'] = 'program';
@@ -41,6 +41,4 @@ $routes['/programs/:id'] = 'program';
$routes['/issues/:issueID'] = 'projectIssue';
$routes['/projects/:projectID/issues'] = 'projectIssues';
$routes['/my'] = 'my';
$config->routes = $routes;
+2 -2
View File
@@ -98,8 +98,8 @@ $config->hourPointCommonList['vi'][0] = 'giờ';
$config->hourPointCommonList['vi'][1] = 'điểm';
$config->hourPointCommonList['vi'][2] = 'function point';
$config->manualUrl['home'] = 'https://www.zentao.net/book/zentaopmshelp.html?fullScreen=zentao';
$config->manualUrl['int'] = 'https://www.zentao.pm/book/zentaomanual/zentao-installation-11.html?fullScreen=zentao';
$config->manualUrl['home'] = 'https://www.zentao.net/book/zentaopmshelp.html?fullScreen=zentao&theme=' . $_COOKIE['theme'];
$config->manualUrl['int'] = 'https://www.zentao.pm/book/zentaomanual/zentao-installation-11.html?fullScreen=zentao&theme=' . $_COOKIE['theme'];
/* Supported charsets. */
$config->charsets['zh-cn']['utf-8'] = 'UTF-8';
+1 -1
View File
@@ -965,7 +965,7 @@ class actionModel extends model
$objectName = array();
$objectProject = array();
if(strpos($this->config->action->needGetProjectType, $objectType) !== false)
if(strpos(",{$this->config->action->needGetProjectType},", ",{$objectType},") !== false)
{
$objectInfo = $this->dao->select("id, project, $field AS name")->from($table)->where('id')->in($objectIds)->fetchAll();
foreach($objectInfo as $object)
+9 -6
View File
@@ -104,13 +104,16 @@ if(empty($type)) $type = 'product';
echo $html;
?>
<?php
if($type == 'book')
if(!empty($libs))
{
common::printLink('doc', 'manageBook', "bookID=$libID", $lang->doc->manageBook, '', "class='btn btn-info btn-wide'");
}
elseif(!empty($libs))
{
common::printLink('tree', 'browse', "rootID=$libID&view=doc", $lang->doc->manageType, '', "class='btn btn-info btn-wide iframe'", '', true);
if($type == 'book')
{
common::printLink('doc', 'manageBook', "bookID=$libID", $lang->doc->manageBook, '', "class='btn btn-info btn-wide'");
}
else
{
common::printLink('tree', 'browse', "rootID=$libID&view=doc", $lang->doc->manageType, '', "class='btn btn-info btn-wide iframe'", '', true);
}
}
?>
</div>
+4 -3
View File
@@ -2270,7 +2270,7 @@ class execution extends control
$currentMembers = $this->execution->getTeamMembers($executionID);
$members2Import = $this->execution->getMembers2Import($team2Import, array_keys($currentMembers));
$teams2Import = $this->execution->getTeams2Import($this->app->user->account, $executionID);
$teams2Import = $this->loadModel('personnel')->getCopyObjects($executionID, 'sprint');
$teams2Import = array('' => '') + $teams2Import;
/* Append users for get users. */
@@ -2927,10 +2927,11 @@ class execution extends control
*
* @param int $executionID
* @param int $deptID
* @param int $copyID
* @access public
* @return void
*/
public function addWhitelist($executionID = 0, $deptID = 0)
public function addWhitelist($executionID = 0, $deptID = 0, $copyID = 0)
{
/* use first execution if executionID does not exist. */
if(!isset($this->executions[$executionID])) $executionID = key($this->executions);
@@ -2938,7 +2939,7 @@ class execution extends control
/* Set the menu. If the executionID = 0, use the indexMenu instead. */
$this->execution->setMenu($executionID);
echo $this->fetch('personnel', 'addWhitelist', "objectID=$executionID&dept=$deptID&objectType=sprint&module=execution");
echo $this->fetch('personnel', 'addWhitelist', "objectID=$executionID&dept=$deptID&copyID=$copyID&objectType=sprint&module=execution");
}
/*
+1
View File
@@ -98,6 +98,7 @@ $lang->execution->noLinkProduct = "Stage not linked {$lang->productCommon}";
$lang->execution->recent = 'Recent visits: ';
$lang->execution->copyNoExecution = 'There are no ' . $lang->executionCommon . 'available to copy.';
$lang->execution->noTeam = 'No team members at the moment';
$lang->execution->or = ' or ';
if($this->config->systemMode == 'new') $lang->execution->copyTeamTip = "select Project/{$lang->execution->common} to copy its members";
if($this->config->systemMode == 'classic') $lang->execution->copyTeamTip = "select Project/{$lang->executionCommon} to copy its members";
+2 -1
View File
@@ -99,6 +99,7 @@ $lang->execution->noLinkProduct = "Stage not linked {$lang->productCommon}";
$lang->execution->recent = 'Recent visits: ';
$lang->execution->copyNoExecution = 'There are no ' . $lang->executionCommon . 'available to copy.';
$lang->execution->noTeam = 'No team members at the moment';
$lang->execution->or = ' or ';
if($this->config->systemMode == 'new') $lang->execution->copyTeamTip = "select Project/{$lang->execution->common} to copy its members";
if($this->config->systemMode == 'classic') $lang->execution->copyTeamTip = "select Project/{$lang->executionCommon} to copy its members";
@@ -296,7 +297,7 @@ $lang->execution->copyTeam = 'Copy Team';
$lang->execution->copyFromTeam = "Copy from {$lang->executionCommon} Team: <strong>%s</strong>";
$lang->execution->noMatched = "No $lang->executionCommon including '%s'can be found.";
$lang->execution->copyTitle = "Choose a {$lang->executionCommon} to copy.";
$lang->execution->copyTeamTitle = "Choose a {$lang->executionCommon} Team to copy.";
$lang->execution->copyTeamTitle = "Choose a {$lang->projectCommon} or {$lang->executionCommon} Team to copy.";
$lang->execution->copyNoExecution = "No {$lang->executionCommon} can be copied.";
$lang->execution->copyFromExecution = "Copy from {$lang->executionCommon} <strong>%s</strong>";
$lang->execution->cancelCopy = 'Cancel Copy';
+1
View File
@@ -98,6 +98,7 @@ $lang->execution->noLinkProduct = "Stage not linked {$lang->productCommon}";
$lang->execution->recent = 'Recent visits: ';
$lang->execution->copyNoExecution = 'There are no ' . $lang->executionCommon . 'available to copy.';
$lang->execution->noTeam = 'No team members at the moment';
$lang->execution->or = ' or ';
if($this->config->systemMode == 'new') $lang->execution->copyTeamTip = "select Project/{$lang->execution->common} to copy its members";
if($this->config->systemMode == 'classic') $lang->execution->copyTeamTip = "select Project/{$lang->executionCommon} to copy its members";
+1
View File
@@ -99,6 +99,7 @@ $lang->execution->noLinkProduct = "Stage not linked {$lang->productCommon}";
$lang->execution->recent = 'Recent visits: ';
$lang->execution->copyNoExecution = 'There are no ' . $lang->executionCommon . 'available to copy.';
$lang->execution->noTeam = 'No team members at the moment';
$lang->execution->or = ' or ';
if($this->config->systemMode == 'new') $lang->execution->copyTeamTip = "select Project/{$lang->execution->common} to copy its members";
if($this->config->systemMode == 'classic') $lang->execution->copyTeamTip = "select Project/{$lang->executionCommon} to copy its members";
+2 -1
View File
@@ -99,6 +99,7 @@ $lang->execution->noLinkProduct = "阶段没有关联{$lang->productCommon}";
$lang->execution->recent = '近期访问:';
$lang->execution->copyNoExecution = '没有可用的' . $lang->executionCommon . '来复制';
$lang->execution->noTeam = '暂时没有团队成员';
$lang->execution->or = '或';
if($this->config->systemMode == 'new') $lang->execution->copyTeamTip = "可以选择复制项目或{$lang->execution->common}团队的成员";
if($this->config->systemMode == 'classic') $lang->execution->copyTeamTip = "可以选择复制{$lang->executionCommon}团队的成员";
@@ -296,7 +297,7 @@ $lang->execution->copyTeam = '复制团队';
$lang->execution->copyFromTeam = "复制自{$lang->executionCommon}团队: <strong>%s</strong>";
$lang->execution->noMatched = "找不到包含'%s'的$lang->executionCommon";
$lang->execution->copyTitle = "请选择一个{$lang->executionCommon}来复制";
$lang->execution->copyTeamTitle = "选择一个{$lang->executionCommon}团队来复制";
$lang->execution->copyTeamTitle = "选择一个{$lang->projectCommon}或{$lang->executionCommon}团队来复制";
$lang->execution->copyNoExecution = "没有可用的{$lang->executionCommon}来复制";
$lang->execution->copyFromExecution = "复制自{$lang->executionCommon} <strong>%s</strong>";
$lang->execution->cancelCopy = '取消复制';
+1 -1
View File
@@ -2438,7 +2438,7 @@ class executionModel extends model
return $this->dao->select('account, role, hours')
->from(TABLE_TEAM)
->where('root')->eq($execution)
->andWhere('type')->eq('execution')
->andWhere('type')->in('project,execution')
->andWhere('account')->notIN($currentMembers)
->fetchAll('account');
}
+1 -1
View File
@@ -463,7 +463,7 @@
{
var $item = $(this);
var isDivider = $item.hasClass('divider');
var height = isDivider ? 17 : 40;
var height = isDivider ? 17 : $item.outerHeight();
currentHeight += height;
if(currentHeight > maxHeight)
{
+154 -131
View File
@@ -57,16 +57,155 @@ class myModel extends model
}
}
public function myInfo()
/**
* Get my info.
*
* @access public
* @return object
*/
public function getInfo()
{
$data = array();
$info = new stdclass();
$info->profile = $this->loadModel('user')->getById($this->app->user->account);
/* My count. */
$data['tasks'] = (int) $this->dao->select('count(*) AS count')->from(TABLE_TASK)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->fetch('count');
$data['stories'] = (int) $this->dao->select('count(*) AS count')->from(TABLE_STORY)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->andWhere('type')->eq('story')->fetch('count');
$data['bugs'] = (int) $this->dao->select('count(*) AS count')->from(TABLE_BUG)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->fetch('count');
/* My tasks. */
$info->task = new stdclass();
$info->task->total = (int) $this->dao->select('count(*) AS count')->from(TABLE_TASK)->where('assignedTo')->eq($this->app->user->account)->andWhere('status')->ne('closed')->andWhere('deleted')->eq(0)->fetch('count');
$info->task->dynamic = array();
/* Charge products. */
if(common::hasPriv('task', 'view'))
{
$tasks = $this->dao->select('*')->from(TABLE_TASK)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->andWhere('status')->ne('closed')
->orderBy('id_desc')
->limit(3)
->fetchAll();
$info->task->dynamic = $tasks;
}
/* My stories. */
$info->story = new stdclass();
$info->story->total = (int) $this->dao->select('count(*) AS count')->from(TABLE_STORY)->where('assignedTo')->eq($this->app->user->account)->andWhere('status')->ne('closed')->andWhere('deleted')->eq(0)->andWhere('type')->eq('story')->fetch('count');
$info->story->dynamic = array();
if(common::hasPriv('story', 'view'))
{
$stories = $this->dao->select('*')->from(TABLE_STORY)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->andWhere('status')->ne('closed')
->orderBy('id_desc')
->limit(3)
->fetchAll();
$info->story->dynamic = $stories;
}
/* My bugs. */
$info->bug = new stdclass();
$info->bug->total = (int) $this->dao->select('count(*) AS count')->from(TABLE_BUG)->where('assignedTo')->eq($this->app->user->account)->andWhere('status')->ne('closed')->andWhere('deleted')->eq(0)->fetch('count');
$info->bug->dynamic = array();
if(common::hasPriv('bug', 'view'))
{
$this->app->loadLang('bug');
$bugs = $this->dao->select('*')->from(TABLE_BUG)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->andWhere('status')->ne('closed')
->orderBy('id_desc')
->limit(3)
->fetchAll();
$info->bug->dynamic = $bugs;
}
/* My todos. */
$info->todo = new stdclass();
$info->todo->total = (int) $this->dao->select('count(*) AS count')->from(TABLE_TODO)->where('assignedTo')->eq($this->app->user->account)->andWhere('status')->ne('closed')->andWhere('deleted')->eq(0)->fetch('count');
$info->todo->dynamic = new stdclass();
if(common::hasPriv('todo', 'view'))
{
$todos = $this->dao->select('*')->from(TABLE_TODO)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('cycle')->eq(0)
->andWhere('deleted')->eq(0)
->andWhere('status')->eq('wait')
->orderBy('`date` desc')
->limit(3)
->fetchAll();
foreach($todos as $key => $todo)
{
if($todo->status == 'done' and $todo->finishedBy == $this->app->user->account)
{
unset($todos[$key]);
continue;
}
$todo->begin = date::formatTime($todo->begin);
$todo->end = date::formatTime($todo->end);
}
$info->todo->dynamic = $todos;
}
/* My risks. */
$info->risk = new stdclass();
$info->risk->total = 0;
$info->risk->dynamic = new stdclass();
if(common::hasPriv('risk', 'view') and isset($this->config->maxVersion))
{
$risks = $this->dao->select('*')->from(TABLE_RISK)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->andWhere('status')->ne('closed')
->orderBy('id_desc')
->limit(3)
->fetchAll();
$info->risk->total = (int) $this->dao->select('count(*) AS count')->from(TABLE_RISK)->where('assignedTo')->eq($this->app->user->account)->andWhere('status')->ne('closed')->andWhere('deleted')->eq(0)->fetch('count');
$info->risk->dynamic = $risks;
}
/* My meetings. */
$info->meeting = new stdclass();
$info->meeting->total = 0;
$info->meeting->dynamic = new stdclass();
if(common::hasPriv('meeting', 'view') and isset($this->config->maxVersion))
{
$today = helper::today();
$now = date('H:i:s', strtotime(helper::now()));
$meetings = $this->dao->select('*')->from(TABLE_MEETING)
->Where('deleted')->eq('0')
->andWhere('(date')->gt($today)
->orWhere('(begin')->gt($now)
->andWhere('date')->eq($today)
->markRight(2)
->andwhere('(host')->eq($this->app->user->account)
->orWhere('participant')->in($this->app->user->account)
->markRight(1)
->orderBy('id_desc')
->limit(3)
->fetchAll();
$info->meeting->total = (int) $this->dao->select('count(*) AS count')->from(TABLE_MEETING)->where('assignedTo')->eq($this->app->user->account)->andWhere('status')->ne('closed')->andWhere('deleted')->eq(0)->fetch('count');
$info->meeting->dynamic = $meetings;
}
/* My issues. */
$info->issue = new stdclass();
$info->issue->total = 0;
$info->issue->dynamic = new stdclass();
if(common::hasPriv('issue', 'view') and isset($this->config->maxVersion))
{
$issues = $this->dao->select('*')->from(TABLE_ISSUE)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->andWhere('status')->ne('closed')
->orderBy('id_desc')
->limit(3)
->fetchAll();
$info->issue->total = (int) $this->dao->select('count(*) AS count')->from(TABLE_ISSUE)->where('assignedTo')->eq($this->app->user->account)->andWhere('status')->ne('closed')->andWhere('deleted')->eq(0)->fetch('count');
$info->issue->dynamic = $issues;
}
/* My charged products. */
$products = $this->dao->select('t1.id as id,t1.*')->from(TABLE_PRODUCT)->alias('t1')
->leftJoin(TABLE_PROGRAM)->alias('t2')->on('t1.program = t2.id')
->where('t1.deleted')->eq(0)
@@ -76,6 +215,7 @@ class myModel extends model
->orderBy('t1.order_asc')
->fetchAll('id');
$productKeys = array_keys($products);
$stories = $this->dao->select('product, status, count(status) AS count')
->from(TABLE_STORY)
->where('deleted')->eq(0)
@@ -107,6 +247,7 @@ class myModel extends model
$execution = $this->loadModel('execution')->getById($execuData->id);
$executions[$key]->progress = ($execution->totalConsumed + $execution->totalLeft) ? floor($execution->totalConsumed / ($execution->totalConsumed + $execution->totalLeft) * 1000) / 1000 * 100 : 0;
}
foreach($products as $key => $product)
{
$product->plans = isset($plans[$product->id]) ? $plans[$product->id] : 0;
@@ -114,7 +255,7 @@ class myModel extends model
if(isset($stories[$product->id])) $product->stories = $stories[$product->id];
if(isset($executions[$product->id])) $product->executions = $executions[$product->id];
}
$data['chargeProducts'] = $products;
$info->products = array_values($products);
/* All projects. */
$projects = $this->loadModel('project')->getOverviewList('byStatus', 'all', 'order_asc');
@@ -126,119 +267,7 @@ class myModel extends model
$projects[$key]->progress = ($workhour->totalConsumed + $workhour->totalLeft) ? floor($workhour->totalConsumed / ($workhour->totalConsumed + $workhour->totalLeft) * 1000) / 1000 * 100 : 0;
}
}
$data['projects'] = $projects;
/* Todo list. */
if(common::hasPriv('todo', 'view')) $hasViewPriv['todo'] = true;
if(common::hasPriv('task', 'view')) $hasViewPriv['task'] = true;
if(common::hasPriv('bug', 'view')) $hasViewPriv['bug'] = true;
if(common::hasPriv('risk', 'view') and isset($this->config->maxVersion)) $hasViewPriv['risk'] = true;
if(common::hasPriv('issue', 'view') and isset($this->config->maxVersion)) $hasViewPriv['issue'] = true;
if(common::hasPriv('meeting', 'view') and isset($this->config->maxVersion)) $hasViewPriv['meeting'] = true;
if(common::hasPriv('story', 'view')) $hasViewPriv['story'] = true;
if(isset($hasViewPriv['todo']))
{
$this->app->loadClass('date');
$this->app->loadLang('todo');
$stmt = $this->dao->select('*')->from(TABLE_TODO)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('cycle')->eq(0)
->andWhere('deleted')->eq(0)
->andWhere('status')->eq('wait')
->orderBy('`date` desc')
->limit(3);
$todos = $stmt->fetchAll();
foreach($todos as $key => $todo)
{
if($todo->status == 'done' and $todo->finishedBy == $this->app->user->account)
{
unset($todos[$key]);
continue;
}
$todo->begin = date::formatTime($todo->begin);
$todo->end = date::formatTime($todo->end);
}
$data['todos'] = $todos;
}
if(isset($hasViewPriv['task']))
{
$this->app->loadLang('task');
$this->app->loadLang('execution');
$stmt = $this->dao->select('*')->from(TABLE_TASK)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->andWhere('status')->ne('closed')
->orderBy('id_desc')
->limit(3);
$data['toTasks'] = $stmt->fetchAll();
}
if(isset($hasViewPriv['bug']))
{
$this->app->loadLang('bug');
$stmt = $this->dao->select('*')->from(TABLE_BUG)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->andWhere('status')->ne('closed')
->orderBy('id_desc')
->limit(3);
$data['toBugs'] = $stmt->fetchAll();
}
if(isset($hasViewPriv['risk']))
{
$this->app->loadLang('risk');
$stmt = $this->dao->select('*')->from(TABLE_RISK)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->andWhere('status')->ne('closed')
->orderBy('id_desc')
->limit(3);
$data['toRisks'] = $stmt->fetchAll();
}
if(isset($hasViewPriv['meeting']))
{
$this->app->loadLang('meeting');
$today = helper::today();
$now = date('H:i:s', strtotime(helper::now()));
$meetings = $this->dao->select('*')->from(TABLE_MEETING)
->Where('deleted')->eq('0')
->andWhere('(date')->gt($today)
->orWhere('(begin')->gt($now)
->andWhere('date')->eq($today)
->markRight(2)
->andwhere('(host')->eq($this->app->user->account)
->orWhere('participant')->in($this->app->user->account)
->markRight(1)
->orderBy('id_desc')
->limit(3)
->fetchAll();
$data['toMeetings'] = $meetings;
}
if(isset($hasViewPriv['issue']))
{
$this->app->loadLang('issue');
$stmt = $this->dao->select('*')->from(TABLE_ISSUE)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->andWhere('status')->ne('closed')
->orderBy('id_desc')
->limit(3);
$data['toIssues'] = $stmt->fetchAll();
}
if(isset($hasViewPriv['story']))
{
$this->app->loadLang('story');
$stmt = $this->dao->select('*')->from(TABLE_STORY)
->where('assignedTo')->eq($this->app->user->account)
->andWhere('deleted')->eq('0')
->andWhere('status')->ne('closed')
->orderBy('id_desc')
->limit(3);
$data['toStories'] = $stmt->fetchAll();
}
$info->projects = array_values($projects);
/* Dynamic. */
$actions = $this->loadModel('action')->getDynamic('all', 'today', 'date_desc');
@@ -247,19 +276,13 @@ class myModel extends model
{
$actions[$key]->actor = $users[$action->actor];
}
$data['dynamic'] = $actions;
$info->dynamic = $actions;
/* User info. */
global $lang, $app;
$data['user'] = new stdclass();
$data['user']->score = $app->user->score;
$data['user']->avatar = !empty($app->user->avatar) ? $app->user->avatar : strtoupper($app->user->account[0]);
$data['user']->role = isset($lang->user->roleList[$app->user->role]) ? $lang->user->roleList[$app->user->role] : $app->user->role;
$data['user']->email = $app->user->email;
$data['participateProjectCount'] = count($data['projects']);
$data['createdDocs'] = $this->dao->select('count(*) AS count')->from(TABLE_DOC)->where('addedBy')->eq($this->app->user->account)->andWhere('deleted')->eq('0')->fetch('count');
$info->participateProjectCount = count($info->projects);
$info->createdDocs = $this->dao->select('count(*) AS count')->from(TABLE_DOC)->where('addedBy')->eq($this->app->user->account)->andWhere('deleted')->eq('0')->fetch('count');
return $data;
return $info;
}
}
+31 -12
View File
@@ -145,6 +145,7 @@ class personnel extends control
*
* @param int $objectID
* @param int $deptID
* @param int $copyID
* @param string $objectType program|project|product|sprint
* @param string $module
* @param int $programID
@@ -152,7 +153,7 @@ class personnel extends control
* @access public
* @return void
*/
public function addWhitelist($objectID = 0, $deptID = 0, $objectType = 'program', $module = 'personnel', $programID = 0, $from = '')
public function addWhitelist($objectID = 0, $deptID = 0, $copyID = 0, $objectType = 'program', $module = 'personnel', $programID = 0, $from = '')
{
if($this->app->openApp == 'program')
{
@@ -180,20 +181,38 @@ class personnel extends control
$this->loadModel('dept');
$deptUsers = empty($deptID) ? array() : $this->dept->getDeptUserPairs($deptID);
$copyObjectType = $objectType;
if($copyObjectType == 'sprint')
{
$object = $this->loadModel('project')->getByID($copyID);
if(!empty($object)) $copyObjectType = 'project';
}
$copyUsers = empty($copyID) ? array() : $this->personnel->getWhitelistAccount($copyID, $copyObjectType);
$appendUsers = array_unique($deptUsers + $copyUsers);
$objectName = $this->lang->projectCommon . $this->lang->execution->or . $this->lang->execution->common;
if($objectType == 'program') $objectName = $this->lang->program->common;
if($objectType == 'product') $objectName = $this->lang->productCommon;
if($objectType == 'project') $objectName = $this->lang->projectCommon;
$this->lang->personnel->selectObjectTips = sprintf($this->lang->personnel->selectObjectTips, $objectName);
$this->view->title = $this->lang->personnel->addWhitelist;
$this->view->position[] = $this->lang->personnel->addWhitelist;
$this->view->objectID = $objectID;
$this->view->objectType = $objectType;
$this->view->module = $module;
$this->view->deptID = $deptID;
$this->view->deptUsers = $deptUsers;
$this->view->whitelist = $this->personnel->getWhitelist($objectID, $objectType);
$this->view->depts = $this->dept->getOptionMenu();
$this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
$this->view->dept = $this->dept->getByID($deptID);
$this->view->programID = $programID;
$this->view->from = $from;
$this->view->objectID = $objectID;
$this->view->objectType = $objectType;
$this->view->objectName = $objectName;
$this->view->objects = array('' => '') + $this->personnel->getCopyObjects($objectID, $objectType);
$this->view->module = $module;
$this->view->deptID = $deptID;
$this->view->appendUsers = $appendUsers;
$this->view->whitelist = $this->personnel->getWhitelist($objectID, $objectType);
$this->view->depts = $this->dept->getOptionMenu();
$this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
$this->view->dept = $this->dept->getByID($deptID);
$this->view->programID = $programID;
$this->view->from = $from;
$this->view->copyID = $copyID;
$this->display();
}
+8 -7
View File
@@ -1,15 +1,16 @@
/**
* Users by department.
* Users by dept,execution,project,product or program.
*
* @param object dept
* @param object $object
* @access public
* @return void
*/
function setDeptUsers(dept)
function setObjectUsers()
{
var deptID = $(dept).val();
var link = createLink(module, moduleMethod, 'objectID=' + objectID + '&deptID=' + deptID + '&objectType=' + objectType + '&module=' + module);
if(module == 'program') link = createLink(module, moduleMethod, 'objectID=' + objectID + '&deptID=' + deptID + '&programID=' + programID + '&from=' + from);
var copyID = $('#object').val();
var deptID = $('#dept').val();
var link = createLink(module, moduleMethod, 'objectID=' + objectID + '&deptID=' + deptID + '&copyID=' + copyID + '&objectType=' + objectType + '&module=' + module);
if(module == 'program') link = createLink(module, moduleMethod, 'objectID=' + objectID + '&deptID=' + deptID + '&copyID=' + copyID + '&programID=' + programID + '&from=' + from);
location.href = link;
}
+6 -4
View File
@@ -30,9 +30,11 @@ $lang->personnel->resolved = 'Resolved';
$lang->personnel->UR = $lang->URCommon;
$lang->personnel->SR = $lang->SRCommon;
$lang->personnel->whitelist = 'Whitelist';
$lang->personnel->addWhitelist = 'Add Whitelist';
$lang->personnel->whitelist = 'Whitelist';
$lang->personnel->addWhitelist = 'Add Whitelist';
$lang->personnel->unbindWhitelist = 'Remove Whitelist';
$lang->personnel->confirmDelete = 'Confirm removal of the user from the whitelist?';
$lang->personnel->confirmDelete = 'Confirm removal of the user from the whitelist?';
$lang->personnel->copy = 'Copy Whitelist';
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
$lang->personnel->selectObjectTips = 'Select %s to copy its whitelist';
+6 -4
View File
@@ -30,9 +30,11 @@ $lang->personnel->resolved = 'Resolved';
$lang->personnel->UR = $lang->URCommon;
$lang->personnel->SR = $lang->SRCommon;
$lang->personnel->whitelist = 'Whitelist';
$lang->personnel->addWhitelist = 'Add Whitelist';
$lang->personnel->whitelist = 'Whitelist';
$lang->personnel->addWhitelist = 'Add Whitelist';
$lang->personnel->unbindWhitelist = 'Remove Whitelist';
$lang->personnel->confirmDelete = 'Confirm removal of the user from the whitelist?';
$lang->personnel->confirmDelete = 'Confirm removal of the user from the whitelist?';
$lang->personnel->copy = 'Copy Whitelist';
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
$lang->personnel->selectObjectTips = 'Select %s to copy its whitelist';
+6 -4
View File
@@ -30,9 +30,11 @@ $lang->personnel->resolved = 'Resolved';
$lang->personnel->UR = $lang->URCommon;
$lang->personnel->SR = $lang->SRCommon;
$lang->personnel->whitelist = 'Whitelist';
$lang->personnel->addWhitelist = 'Add Whitelist';
$lang->personnel->whitelist = 'Whitelist';
$lang->personnel->addWhitelist = 'Add Whitelist';
$lang->personnel->unbindWhitelist = 'Remove Whitelist';
$lang->personnel->confirmDelete = 'Confirm removal of the user from the whitelist?';
$lang->personnel->confirmDelete = 'Confirm removal of the user from the whitelist?';
$lang->personnel->copy = 'Copy Whitelist';
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
$lang->personnel->selectObjectTips = 'Select %s to copy its whitelist';
+6 -4
View File
@@ -30,9 +30,11 @@ $lang->personnel->resolved = 'Resolved';
$lang->personnel->UR = $lang->URCommon;
$lang->personnel->SR = $lang->SRCommon;
$lang->personnel->whitelist = 'Whitelist';
$lang->personnel->addWhitelist = 'Add Whitelist';
$lang->personnel->whitelist = 'Whitelist';
$lang->personnel->addWhitelist = 'Add Whitelist';
$lang->personnel->unbindWhitelist = 'Remove Whitelist';
$lang->personnel->confirmDelete = 'Confirm removal of the user from the whitelist?';
$lang->personnel->confirmDelete = 'Confirm removal of the user from the whitelist?';
$lang->personnel->copy = 'Copy Whitelist';
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
$lang->personnel->openedPGMTip = 'The program is public and can be accessed by users with Program privileges.';
$lang->personnel->selectObjectTips = 'Select %s to copy its whitelist';
+6 -4
View File
@@ -30,9 +30,11 @@ $lang->personnel->resolved = '解决';
$lang->personnel->UR = $lang->URCommon;
$lang->personnel->SR = $lang->SRCommon;
$lang->personnel->whitelist = '白名单列表';
$lang->personnel->addWhitelist = '添加白名单';
$lang->personnel->whitelist = '白名单列表';
$lang->personnel->addWhitelist = '添加白名单';
$lang->personnel->unbindWhitelist = '删除白名单';
$lang->personnel->confirmDelete = '确认将该用户移除白名单?';
$lang->personnel->confirmDelete = '确认将该用户移除白名单?';
$lang->personnel->copy = '复制白名单';
$lang->personnel->openedPGMTip = '该项目集是公开状态,有项目集视图权限的人员即可访问。';
$lang->personnel->openedPGMTip = '该项目集是公开状态,有项目集视图权限的人员即可访问。';
$lang->personnel->selectObjectTips = '请选择一个%s白名单来复制';
+52
View File
@@ -456,6 +456,58 @@ class personnelModel extends model
->fetchGroup('root', 'id');
}
/**
* Get objects to copy whitelist.
*
* @param int $objectID
* @param int $objectType
* @access public
* @return array
*/
public function getCopyObjects($objectID, $objectType)
{
$objects = array();
if($objectType == 'sprint')
{
$parentID = 0;
if($this->config->systemMode == 'new') $parentID = $this->dao->select('project')->from(TABLE_EXECUTION)->where('id')->eq($objectID)->fetch('project');
$objects = $this->dao->select('id,name')->from(TABLE_EXECUTION)
->where('(project')->eq($parentID)
->orWhere('id')->eq($parentID)
->markRight(1)
->andWhere('(id')->in($this->app->user->view->projects)
->orWhere('id')->in($this->app->user->view->sprints)
->markRight(1)
->andWhere('deleted')->eq(0)
->orderBy('type')
->fetchPairs();
foreach($objects as $id => &$object)
{
if($id == $parentID) $object = $this->lang->projectCommon . '-' . $object;
if($id != $parentID) $object = $this->lang->execution->common . '-' . $object;
}
}
elseif($objectType == 'project')
{
$parentID = $this->dao->select('parent')->from(TABLE_PROJECT)->where('id')->eq($objectID)->fetch('parent');
$objects = $this->loadModel('project')->getPairsByProgram($parentID);
}
elseif($objectType == 'product')
{
$parentID = $this->dao->select('program')->from(TABLE_PRODUCT)->where('id')->eq($objectID)->fetch('program');
$objects = $this->loadModel('product')->getPairs('', $parentID);
}
elseif($objectType == 'program')
{
$objects = $this->loadModel('program')->getPairs();
}
unset($objects[$objectID]);
return $objects;
}
/**
* Access to program set invest staff.
*
+11 -6
View File
@@ -13,18 +13,23 @@
<?php include '../../common/view/header.html.php';?>
<?php js::set('objectID', $objectID);?>
<?php js::set('objectType', $objectType);?>
<style>#object_chosen .chosen-single, #dept_chosen .chosen-single {width: 220px;}</style>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<span class='btn btn-link btn-active-text'>
<?php echo html::a("javascript:viod(0)", "<span class='text'> {$lang->personnel->addWhitelist}</span>");?>
</span>
<div class='input-group space w-200px'>
<span class='input-group-addon'><?php echo $lang->execution->selectDept?></span>
<?php echo html::select('dept', $depts, $deptID, "class='form-control chosen' onchange='setDeptUsers(this)' data-placeholder='{$lang->execution->selectDeptTitle}'");?>
<span class='input-group-addon'><?php echo $lang->execution->selectDept;?></span>
<?php echo html::select('dept', $depts, $deptID, "class='form-control chosen' onchange='setObjectUsers()' data-placeholder='{$lang->execution->selectDeptTitle}'");?>
<?php if(count($objects) > 1):?>
<span class='input-group-addon'><?php echo $lang->personnel->copy;?></span>
<?php echo html::select('object', $objects, $copyID, "class='form-control chosen' onchange='setObjectUsers()' data-placeholder='{$lang->personnel->selectObjectTips}'");?>
<?php endif;?>
</div>
</div>
</div>
<div id='mainContent' class='main-content'>
<div class="main-header">
<h2><?php echo $lang->personnel->addWhitelist;?></h2>
</div>
<form class='main-form form-ajax' method='post' target='hiddenwin' id="whitelistForm">
<table class='table table-form'>
<thead>
@@ -53,7 +58,7 @@
?>
<?php endforeach;?>
<?php foreach($deptUsers as $account => $realname):?>
<?php foreach($appendUsers as $account => $realname):?>
<?php if(isset($whitelistUsers[$account])) continue;?>
<tr id="whitelist<?php echo $i;?>" data-id="<?php echo $i;?>">
<td>
+1 -1
View File
@@ -19,7 +19,7 @@
<?php echo html::a($this->createLink($module, 'whitelist', $vars), '<span class="text">' . $lang->personnel->whitelist . '</span>', '', "class='btn btn-link btn-active-text' $openApp");?>
</div>
<div class="btn-toolbar pull-right">
<?php $vars = $module == 'program' ? "objectID=$objectID&deptID=0&programID=$programID&from=$from" : "objectID=$objectID";?>
<?php $vars = $module == 'program' ? "objectID=$objectID&deptID=0&copyID=0&programID=$programID&from=$from" : "objectID=$objectID";?>
<?php common::printLink($module, 'addWhitelist', $vars, "<i class='icon icon-plus'></i> " . $lang->personnel->addWhitelist, '', "class='btn btn-primary' $openApp");?>
</div>
</div>
+4 -3
View File
@@ -1186,16 +1186,17 @@ class product extends control
*
* @param int $productID
* @param int $deptID
* @param int $copyID
* @param string $branch
* @access public
* @return void
*/
public function addWhitelist($productID = 0, $deptID = 0, $branch = '')
public function addWhitelist($productID = 0, $deptID = 0, $copyID = 0)
{
$this->product->setMenu($productID, $branch);
$this->product->setMenu($productID);
$this->lang->modulePageNav = '';
echo $this->fetch('personnel', 'addWhitelist', "objectID=$productID&dept=$deptID&objectType=product&module=product");
echo $this->fetch('personnel', 'addWhitelist', "objectID=$productID&dept=$deptID&copyID=$copyID&objectType=product&module=product");
}
/*
+3 -2
View File
@@ -1504,14 +1504,15 @@ class project extends control
*
* @param int $projectID
* @param int $deptID
* @param int $copyID
* @param int $programID
* @param int $from
* @access public
* @return void
*/
public function addWhitelist($projectID = 0, $deptID = 0, $programID = 0, $from = 'project')
public function addWhitelist($projectID = 0, $deptID = 0, $copyID = 0, $programID = 0, $from = 'project')
{
echo $this->fetch('personnel', 'addWhitelist', "objectID=$projectID&dept=$deptID&objectType=project&module=project&programID=$programID&from=$from");
echo $this->fetch('personnel', 'addWhitelist', "objectID=$projectID&dept=$deptID&copyID=$copyID&objectType=project&module=project&programID=$programID&from=$from");
}
/*
+1 -3
View File
@@ -44,13 +44,11 @@ class projectreleaseModel extends model
* Get list of releases.
*
* @param int $projectID
* @param int $productID
* @param int $branch
* @param string $type
* @access public
* @return array
*/
public function getList($projectID, $productID, $branch = 0, $type = 'all')
public function getList($projectID, $type = 'all')
{
return $this->dao->select('t1.*, t2.name as productName, t3.id as buildID, t3.name as buildName, t3.execution, t4.name as executionName')
->from(TABLE_RELEASE)->alias('t1')
+1 -1
View File
@@ -701,7 +701,7 @@ class searchModel extends model
if(empty($savedDict)) $savedDict = $this->dao->select("`key`")->from(TABLE_SEARCHDICT)->fetchPairs('key', 'key');
foreach($dict as $key => $value)
{
if(!is_numeric($key) or empty($value) or strlen($key) != 5) continue;
if(!is_numeric($key) or empty($value) or strlen($key) != 5 or $key < 0) continue;
if(isset($savedDict[$key])) continue;
$this->dao->insert(TABLE_SEARCHDICT)->data(array('key' => $key, 'value' => $value))->exec();
+1 -1
View File
@@ -1090,7 +1090,7 @@ class task extends control
if(isonlybody()) die(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}"));
if(defined('RUN_MODE') && RUN_MODE == 'api')
{
die(array('status' => 'success', 'data' => $taskID));
return $this->send(array('status' => 'success', 'data' => $taskID));
}
else
{
+2 -2
View File
File diff suppressed because one or more lines are too long