* Merge 18 devopos to 20
This commit is contained in:
@@ -20,6 +20,15 @@ class gitlab extends control
|
||||
{
|
||||
parent::__construct($moduleName, $methodName);
|
||||
|
||||
if(stripos($this->methodName, 'ajax') === false)
|
||||
{
|
||||
if(!commonModel::hasPriv('space', 'browse')) $this->loadModel('common')->deny('space', 'browse', false);
|
||||
|
||||
if(!in_array(strtolower(strtolower($this->methodName)), array('browseproject', 'browsegroup', 'browseuser', 'browsebranch', 'browsetag')))
|
||||
{
|
||||
if(!commonModel::hasPriv('instance', 'manage')) $this->loadModel('common')->deny('instance', 'manage', false);
|
||||
}
|
||||
}
|
||||
/* This is essential when changing tab(menu) from gitlab to repo. */
|
||||
/* Optional: common::setMenuVars('devops', $this->session->repoID); */
|
||||
$this->loadModel('ci')->setMenu();
|
||||
@@ -195,7 +204,9 @@ class gitlab extends control
|
||||
$this->loadModel('action')->create('gitlabuser', $openID, 'bind', '', sprintf($this->lang->gitlab->bindDynamic, $gitlabNames[$openID], $zentaoUsers[$account]->realname));
|
||||
}
|
||||
}
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('gitlab', 'browse')));
|
||||
|
||||
if(dao::isError()) return $this->sendError(dao::getError());
|
||||
return $this->sendSuccess(array('message' => $this->lang->saveSuccess, 'load' => helper::createLink('space', 'browse')));
|
||||
}
|
||||
|
||||
$userList = array();
|
||||
@@ -263,7 +274,7 @@ class gitlab extends control
|
||||
$changes = common::createChanges($oldGitLab, $gitLab);
|
||||
$this->loadModel('action')->logHistory($actionID, $changes);
|
||||
|
||||
$response['load'] = true;
|
||||
$response['load'] = $this->createLink('space', 'browse');
|
||||
$response['result'] = 'success';
|
||||
return $this->send($response);
|
||||
}
|
||||
@@ -618,7 +629,12 @@ class gitlab extends control
|
||||
{
|
||||
$this->gitlab->createUser($gitlabID);
|
||||
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
if(dao::isError())
|
||||
{
|
||||
$message = dao::getError();
|
||||
foreach($message as &$msg) if(is_string($msg)) $msg = zget($this->lang->gitlab->errorResonse, $msg, $msg);
|
||||
return $this->send(array('result' => 'fail', 'message' => $message));
|
||||
}
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browseUser', "gitlabID=$gitlabID")));
|
||||
}
|
||||
|
||||
@@ -725,7 +741,7 @@ class gitlab extends control
|
||||
if(!$this->app->user->admin)
|
||||
{
|
||||
$openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account);
|
||||
if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('space', 'browse')));
|
||||
}
|
||||
|
||||
$this->app->loadClass('pager', true);
|
||||
@@ -745,6 +761,7 @@ class gitlab extends control
|
||||
if(!$project->adminer and isset($project->owner) and $project->owner->id == $openID) $project->adminer = true;
|
||||
|
||||
$project->isMaintainer = $this->gitlab->checkUserAccess($gitlabID, $project->id, $project, $groupIDList, 'maintainer');
|
||||
$project->isDeveloper = $this->gitlab->checkUserAccess($gitlabID, $project->id, $project, $groupIDList, 'developer');
|
||||
}
|
||||
|
||||
$gitlab = $this->gitlab->getByID($gitlabID);
|
||||
|
||||
@@ -8,4 +8,17 @@ $(document).ready(function()
|
||||
$(this).parent().parent().find('.email').text(user.email)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.zentao-users .chosen-container', function()
|
||||
{
|
||||
var $obj = $(this).prev('select');
|
||||
var value = $obj.val();
|
||||
if($obj.hasClass('filled')) return false;
|
||||
|
||||
$obj.empty();
|
||||
$obj.append($('#userList').html());
|
||||
$obj.val(value);
|
||||
$obj.addClass('filled');
|
||||
$obj.trigger("chosen:updated");
|
||||
})
|
||||
});
|
||||
|
||||
@@ -14,3 +14,23 @@ window.renderGitlabUser = function(result, {row})
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
window.bindUser = function()
|
||||
{
|
||||
const myDTable = $('#table-gitlab-binduser').zui('dtable');
|
||||
const formData = myDTable.$.getFormData();
|
||||
|
||||
var bindData = $('#table-gitlab-binduser').zui('dtable').$.props.data;
|
||||
var postData = {};
|
||||
postData['gitlabUserNames[]'] = [];
|
||||
for(i in bindData)
|
||||
{
|
||||
postData['gitlabUserNames[]'].push(bindData[i].gitlabID);
|
||||
postData['zentaoUsers[' + bindData[i].gitlabID + ']'] = formData['zentaoUsers[' + bindData[i].gitlabID + ']'];
|
||||
}
|
||||
|
||||
$.ajaxSubmit({
|
||||
url: $.createLink('gitlab', 'bindUser', 'gitlabID=' + gitlabID + '&type=' + type),
|
||||
data: postData
|
||||
});
|
||||
}
|
||||
|
||||
@@ -108,7 +108,9 @@ $lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
@@ -116,7 +118,12 @@ $lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
|
||||
$lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[6] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = "Is invalid";
|
||||
|
||||
$lang->gitlab->errorResonse['Email has already been taken'] = 'Email has already been taken';
|
||||
$lang->gitlab->errorResonse['Username has already been taken'] = 'Username has already been taken';
|
||||
|
||||
$lang->gitlab->project = new stdclass;
|
||||
$lang->gitlab->project->id = "Project ID";
|
||||
|
||||
@@ -108,7 +108,9 @@ $lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
@@ -116,7 +118,12 @@ $lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
|
||||
$lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[6] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = "Is invalid";
|
||||
|
||||
$lang->gitlab->errorResonse['Email has already been taken'] = 'Email has already been taken';
|
||||
$lang->gitlab->errorResonse['Username has already been taken'] = 'Username has already been taken';
|
||||
|
||||
$lang->gitlab->project = new stdclass;
|
||||
$lang->gitlab->project->id = "Project ID";
|
||||
|
||||
@@ -108,7 +108,19 @@ $lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
|
||||
$lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = "Is invalid";
|
||||
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
@@ -118,6 +130,9 @@ $lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = $lang->gitlab->noAccess;
|
||||
|
||||
$lang->gitlab->errorResonse['Email has already been taken'] = 'Email has already been taken';
|
||||
$lang->gitlab->errorResonse['Username has already been taken'] = 'Username has already been taken';
|
||||
|
||||
$lang->gitlab->project = new stdclass;
|
||||
$lang->gitlab->project->id = "Project ID";
|
||||
$lang->gitlab->project->name = "Project name";
|
||||
|
||||
@@ -105,7 +105,19 @@ $lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
|
||||
$lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = "Is invalid";
|
||||
|
||||
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
|
||||
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
|
||||
@@ -115,6 +127,9 @@ $lang->gitlab->errorLang[4] = 'Branch already exists.';
|
||||
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
|
||||
$lang->gitlab->errorLang[6] = $lang->gitlab->noAccess;
|
||||
|
||||
$lang->gitlab->errorResonse['Email has already been taken'] = 'Email has already been taken';
|
||||
$lang->gitlab->errorResonse['Username has already been taken'] = 'Username has already been taken';
|
||||
|
||||
$lang->gitlab->project = new stdclass;
|
||||
$lang->gitlab->project->id = "Project ID";
|
||||
$lang->gitlab->project->name = "Project name";
|
||||
|
||||
@@ -108,7 +108,9 @@ $lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
|
||||
$lang->gitlab->errorLang[0] = '私有分组的项目,可见性级别不能设为内部。';
|
||||
$lang->gitlab->errorLang[1] = '私有分组的项目,可见性级别不能设为公开。';
|
||||
@@ -116,7 +118,12 @@ $lang->gitlab->errorLang[2] = '密码太短(最少8个字符)';
|
||||
$lang->gitlab->errorLang[3] = "只能包含字母、数字、'.'-'和'.'。不能以'-'开头、以'.git'结尾或以'.atom'结尾。";
|
||||
$lang->gitlab->errorLang[4] = '分支名已存在。';
|
||||
$lang->gitlab->errorLang[5] = '保存失败,群组URL路径已经被使用。';
|
||||
$lang->gitlab->errorLang[6] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[6] = '保存失败,群组URL路径已经被使用。';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = '格式错误';
|
||||
|
||||
$lang->gitlab->errorResonse['Email has already been taken'] = '邮箱已存在';
|
||||
$lang->gitlab->errorResonse['Username has already been taken'] = '用户名已存在';
|
||||
|
||||
$lang->gitlab->project = new stdclass;
|
||||
$lang->gitlab->project->id = "项目ID";
|
||||
|
||||
@@ -98,6 +98,9 @@ $lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
|
||||
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
|
||||
$lang->gitlab->apiError[4] = 'Branch already exists';
|
||||
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
|
||||
$lang->gitlab->apiError[6] = 'Failed to save group {:path=>["已经被使用"]}';
|
||||
$lang->gitlab->apiError[7] = '403 Forbidden';
|
||||
$lang->gitlab->apiError[8] = 'is invalid';
|
||||
|
||||
$lang->gitlab->errorLang[0] = '私有分組的項目,可見性級別不能設為內部。';
|
||||
$lang->gitlab->errorLang[1] = '私有分組的項目,可見性級別不能設為公開。';
|
||||
@@ -105,6 +108,12 @@ $lang->gitlab->errorLang[2] = '密碼太短(最少8個字元)';
|
||||
$lang->gitlab->errorLang[3] = "只能包含字母、數字、'.'-'和'.'。不能以'-'開頭、以'.git'結尾或以'.atom'結尾。";
|
||||
$lang->gitlab->errorLang[4] = '分支名已存在。';
|
||||
$lang->gitlab->errorLang[5] = '保存失敗,群組URL路徑已經被使用。';
|
||||
$lang->gitlab->errorLang[6] = '保存失敗,群組URL路徑已經被使用。';
|
||||
$lang->gitlab->errorLang[7] = $lang->gitlab->noAccess;
|
||||
$lang->gitlab->errorLang[8] = '格式错误';
|
||||
|
||||
$lang->gitlab->errorResonse['Email has already been taken'] = '邮箱已存在';
|
||||
$lang->gitlab->errorResonse['Username has already been taken'] = '用户名已存在';
|
||||
|
||||
$lang->gitlab->project = new stdclass;
|
||||
$lang->gitlab->project->id = "項目ID";
|
||||
|
||||
+58
-5
@@ -400,11 +400,11 @@ class gitlabModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getCommits($repo, $entry, $revision = 'HEAD', $type = 'dir', $pager = null, $begin = 0, $end = 0)
|
||||
public function getCommits($repo, $entry, $revision = 'HEAD', $type = 'dir', $pager = null, $begin = '', $end = '')
|
||||
{
|
||||
$scm = $this->app->loadClass('scm');
|
||||
$scm->setEngine($repo);
|
||||
$comments = $scm->engine->getCommitsByPath($entry, '', '', isset($pager->recPerPage) ? $pager->recPerPage : 10, isset($pager->pageID) ? $pager->pageID : 1);
|
||||
$comments = $scm->engine->getCommitsByPath($entry, '', '', isset($pager->recPerPage) ? $pager->recPerPage : 10, isset($pager->pageID) ? $pager->pageID : 1, false, $begin, $end);
|
||||
if(!is_array($comments)) return array();
|
||||
|
||||
if(isset($pager->recTotal)) $pager->recTotal = count($comments) < $pager->recPerPage ? $pager->recPerPage * $pager->pageID : $pager->recPerPage * ($pager->pageID + 1);
|
||||
@@ -441,6 +441,21 @@ class gitlabModel extends model
|
||||
return $this->loadModel('pipeline')->update($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置项目信息。
|
||||
* Set project data.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @param object $project
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function setProject(int $gitlabID, int $projectID, object $project): void
|
||||
{
|
||||
$this->projects[$gitlabID][$projectID] = $project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an api get request.
|
||||
*
|
||||
@@ -640,7 +655,7 @@ class gitlabModel extends model
|
||||
*/
|
||||
public function apiGetGroups($gitlabID, $orderBy = 'id_desc', $minRole = '', $keyword = '')
|
||||
{
|
||||
$apiRoot = $this->getApiRoot($gitlabID);
|
||||
$apiRoot = $this->getApiRoot($gitlabID, false);
|
||||
$url = sprintf($apiRoot, "/groups");
|
||||
if($minRole == 'owner')
|
||||
{
|
||||
@@ -1018,7 +1033,7 @@ class gitlabModel extends model
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function apiGetSingleProject($gitlabID, $projectID, $useUser = false)
|
||||
public function apiGetSingleProject($gitlabID, $projectID, $useUser = true)
|
||||
{
|
||||
if(isset($this->projects[$gitlabID][$projectID])) return $this->projects[$gitlabID][$projectID];
|
||||
|
||||
@@ -1252,12 +1267,13 @@ class gitlabModel extends model
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function addPushWebhook($repo)
|
||||
public function addPushWebhook($repo, $token = '')
|
||||
{
|
||||
$hook = new stdClass;
|
||||
$hook->url = common::getSysURL() . '/api.php/v1/gitlab/webhook?repoID='. $repo->id;
|
||||
$hook->push_events = true;
|
||||
$hook->merge_requests_events = true;
|
||||
if($token) $hook->token = $token;
|
||||
|
||||
/* Return an empty array if where is one existing webhook. */
|
||||
if($this->isWebhookExists($repo, $hook->url)) return array();
|
||||
@@ -2977,4 +2993,41 @@ class gitlabModel extends model
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断按钮是否可点击。
|
||||
* Adjust the action clickable.
|
||||
*
|
||||
* @param object $instance
|
||||
* @param string $action
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isClickable(object $gitlab, string $action): bool
|
||||
{
|
||||
return commonModel::hasPriv('space', 'browse');
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断按钮是否显示在列表页。
|
||||
* Judge an action is displayed in browse page.
|
||||
*
|
||||
* @param object $sonarqube
|
||||
* @param string $action
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public static function isDisplay(object $sonarqube, string $action): bool
|
||||
{
|
||||
$action = strtolower($action);
|
||||
|
||||
if(!commonModel::hasPriv('space', 'browse')) return false;
|
||||
|
||||
if(!in_array(strtolower(strtolower($action)), array('browseproject', 'browsegroup', 'browseuser', 'browsebranch', 'browsetag')))
|
||||
{
|
||||
if(!commonModel::hasPriv('instance', 'manage')) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ featureBar
|
||||
toolbar();
|
||||
|
||||
jsVar('zentaoUsers', $zentaoUsers);
|
||||
jsVar('gitlabID', $gitlabID);
|
||||
jsVar('type', $type);
|
||||
$config->gitlab->dtable->bindUser->fieldList['gitlabEmail']['onRenderCell'] = jsRaw('renderGitlabUser');
|
||||
$config->gitlab->dtable->bindUser->fieldList['zentaoUsers']['controlItems'] = $userPairs;
|
||||
form
|
||||
@@ -48,7 +50,7 @@ form
|
||||
array(
|
||||
'text' => $lang->save,
|
||||
'btnType' => 'primary',
|
||||
'onClick' => jsRaw("() => {\$('#bindForm').trigger('submit')}")
|
||||
'onClick' => jsRaw("() => {bindUser()}")
|
||||
),
|
||||
array(
|
||||
'text' => $lang->goback,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<?php js::set('zentaoUsers', $zentaoUsers);?>
|
||||
<div id="mainContent" class="main-content">
|
||||
<div class="main-header gitlab-bind">
|
||||
<?php
|
||||
<?php
|
||||
echo html::linkButton('<i class="icon icon-back icon-sm"></i> ' . $lang->goback, $browseLink, 'self', "data-app='{$app->tab}'", 'btn btn-secondary');
|
||||
|
||||
$allLink = $this->createLink('gitlab', 'binduser', "gitlabID={$gitlabID}&type=all");
|
||||
@@ -55,7 +55,6 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($gitlabUsers as $gitlabUser):?>
|
||||
<?php if(isset($gitlabUser->zentaoAccount)) continue;?>
|
||||
<?php echo html::hidden("gitlabUserNames[$gitlabUser->id]", $gitlabUser->realname);?>
|
||||
<tr>
|
||||
<td>
|
||||
@@ -63,30 +62,13 @@
|
||||
<?php echo $gitlabUser->realname . '@' . $gitlabUser->account;?>
|
||||
</td>
|
||||
<td><?php echo $gitlabUser->email;?></td>
|
||||
<td class="email"><?php echo !empty($matchedResult[$gitlabUser->email]) ? $matchedResult[$gitlabUser->email]['email'] : '';?></td>
|
||||
<td class='gitlab-user-select'><?php echo html::select("zentaoUsers[$gitlabUser->id]", $userPairs, '', "class='form-control select chosen gitlab-user-bind'" );?></td>
|
||||
<td><?php echo '<span class="text-red">' . $lang->gitlab->notBind . '</span>';?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php foreach($gitlabUsers as $gitlabUser):?>
|
||||
<?php if(!isset($gitlabUser->zentaoAccount)) continue;?>
|
||||
<?php echo html::hidden("gitlabUserNames[$gitlabUser->id]", $gitlabUser->realname);?>
|
||||
<tr>
|
||||
<td class="email"><?php echo !empty($gitlabUser->zentaoAccount) ? $zentaoUsers[$gitlabUser->zentaoAccount]->email : '';?></td>
|
||||
<td class='zentao-users'><?php echo html::select("zentaoUsers[$gitlabUser->id]", $gitlabUser->zentaoUsers, $gitlabUser->zentaoAccount, "class='form-control select chosen gitlab-user-bind'" );?></td>
|
||||
<td>
|
||||
<?php echo html::image($gitlabUser->avatar, "height=20 width=20 class='img-circle'");?>
|
||||
<?php echo $gitlabUser->realname . '@' . $gitlabUser->account;?>
|
||||
</td>
|
||||
<td><?php echo $gitlabUser->email;?></td>
|
||||
<td class="email"><?php echo !empty($matchedResult[$gitlabUser->email]) ? $matchedResult[$gitlabUser->email]['email'] : '';?></td>
|
||||
<td class='gitlab-user-select'><?php echo html::select("zentaoUsers[$gitlabUser->id]", $userPairs, $gitlabUser->zentaoAccount, "class='form-control select chosen gitlab-user-bind'" );?></td>
|
||||
<td>
|
||||
<?php if(in_array($gitlabUser->id, $bindedUsers)):?>
|
||||
<?php $zentaoAccount = zget($userPairs, $gitlabUser->zentaoAccount, '');?>
|
||||
<?php if(!empty($zentaoAccount)):?>
|
||||
<?php if($gitlabUser->binded === 1):?>
|
||||
<?php echo $lang->gitlab->binded;?>
|
||||
<?php else:?>
|
||||
<?php elseif($gitlabUser->binded === 2):?>
|
||||
<?php echo '<span class="text-red">' . $lang->gitlab->bindedError . '</span>';?>
|
||||
<?php endif;?>
|
||||
<?php else:?>
|
||||
<?php echo '<span class="text-red">' . $lang->gitlab->notBind . '</span>';?>
|
||||
<?php endif;?>
|
||||
@@ -106,4 +88,12 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="userList" class="hidden">
|
||||
<?php
|
||||
foreach($userPairs as $account => $realname)
|
||||
{
|
||||
echo "<option value='$account' title='$realname'>$realname</option>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php if(common::hasPriv('gitlab', 'create')) common::printLink('gitlab', 'createGroup', "gitlabID=$gitlabID", "<i class='icon icon-plus'></i> " . $lang->gitlab->group->create, '', "class='btn btn-primary'");?>
|
||||
<?php if(common::hasPriv('instance', 'manage')) common::printLink('gitlab', 'createGroup', "gitlabID=$gitlabID", "<i class='icon icon-plus'></i> " . $lang->gitlab->group->create, '', "class='btn btn-primary'");?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(empty($gitlabGroupList)):?>
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->noData;?></span>
|
||||
<?php if(common::hasPriv('gitlab', 'create')):?>
|
||||
<?php if(common::hasPriv('instance', 'manage')):?>
|
||||
<?php echo html::a($this->createLink('gitlab', 'createGroup', "gitlabID=$gitlabID"), "<i class='icon icon-plus'></i> " . $lang->gitlab->group->create, '', "class='btn btn-info'");?>
|
||||
<?php endif;?>
|
||||
</p>
|
||||
@@ -60,9 +60,9 @@
|
||||
<td class='c-actions text-left'>
|
||||
<?php
|
||||
$isAdmin = ($app->user->admin or in_array($gitlabGroup->id, $adminGroupIDList)) ? true : false;
|
||||
common::printLink('gitlab', 'manageGroupMembers', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", "<i class='icon icon-team'></i> ", '',"title='{$lang->gitlab->group->manageMembers}' class='btn'");
|
||||
echo common::buildIconButton('gitlab', 'editGroup', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", '', 'list', 'edit', '', '', false, '', '', 0, $isAdmin);
|
||||
echo common::buildIconButton('gitlab', 'deleteGroup', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", '', 'list', 'trash', 'hiddenwin', '', false, '', '', 0, $isAdmin);
|
||||
if($this->gitlab->isDisplay($gitlab, 'manageGroupMembers')) common::printLink('gitlab', 'manageGroupMembers', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", "<i class='icon icon-team'></i> ", '',"title='{$lang->gitlab->group->manageMembers}' class='btn'");
|
||||
if($this->gitlab->isDisplay($gitlab, 'editGroup')) echo common::buildIconButton('gitlab', 'editGroup', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", '', 'list', 'edit', '', '', false, '', '', 0, $isAdmin);
|
||||
if($this->gitlab->isDisplay($gitlab, 'deleteGroup')) echo common::buildIconButton('gitlab', 'deleteGroup', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", '', 'list', 'trash', 'hiddenwin', '', false, '', '', 0, $isAdmin);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php if(common::hasPriv('gitlab', 'createProject')) common::printLink('gitlab', 'createProject', "gitlabID=$gitlabID", "<i class='icon icon-plus'></i> " . $lang->gitlab->project->create, '', "class='btn btn-primary'");?>
|
||||
<?php if(common::hasPriv('instance', 'manage')) common::printLink('gitlab', 'createProject', "gitlabID=$gitlabID", "<i class='icon icon-plus'></i> " . $lang->gitlab->project->create, '', "class='btn btn-primary'");?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(empty($gitlabProjectList)):?>
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->noData;?></span>
|
||||
<?php if(empty($keyword) and common::hasPriv('gitlab', 'createProject')):?>
|
||||
<?php if(empty($keyword) and common::hasPriv('instance', 'manage')):?>
|
||||
<?php echo html::a($this->createLink('gitlab', 'createProject', "gitlabID=$gitlabID"), "<i class='icon icon-plus'></i> " . $lang->gitlab->project->create, '', "class='btn btn-info'");?>
|
||||
<?php endif;?>
|
||||
</p>
|
||||
@@ -60,19 +60,20 @@
|
||||
<td class='text' title='<?php echo substr($gitlabProject->last_activity_at, 0, 10);?>'><?php echo substr($gitlabProject->last_activity_at, 0, 10);?></td>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
$hasRepoClass = isset($repoPairs[$gitlabProject->id]) ? '' : 'disabled';
|
||||
$adminerClass = $gitlabProject->adminer ? '' : 'disabled';
|
||||
$maintainerClass = $gitlabProject->isMaintainer ? '' : 'disabled';
|
||||
$defaultBranchClass = $gitlabProject->adminer ? '' : 'disabled';
|
||||
echo common::printIcon('gitlab', 'browseBranch', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'treemap', '', $defaultBranchClass, false, '', $this->lang->gitlab->browseBranch);
|
||||
echo common::printIcon('gitlab', 'browseTag', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'tag', '', $defaultBranchClass, false, '', $this->lang->gitlab->browseTag);
|
||||
echo common::printIcon('gitlab', 'manageBranchPriv', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'branch-lock', '', $defaultBranchClass . ' ' . $maintainerClass, false, '', $this->lang->gitlab->browseBranchPriv);
|
||||
echo common::printIcon('gitlab', 'manageTagPriv', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'tag-lock', '', $defaultBranchClass . ' ' . $maintainerClass, false, '', $this->lang->gitlab->browseTagPriv);
|
||||
echo common::printIcon('gitlab', 'manageProjectMembers', 'repoID=' . zget($repoPairs, $gitlabProject->id), '', 'list', 'team', '', $hasRepoClass);
|
||||
echo common::printIcon('gitlab', 'createWebhook', 'repoID=' . zget($repoPairs, $gitlabProject->id), '', 'list', 'change', 'hiddenwin', $hasRepoClass);
|
||||
echo common::printIcon('gitlab', 'importIssue', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'link');
|
||||
echo common::printIcon('gitlab', 'editProject', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'edit', '', $adminerClass);
|
||||
echo common::printIcon('gitlab', 'deleteProject', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'trash', 'hiddenwin', $adminerClass);
|
||||
$hasRepoClass = isset($repoPairs[$gitlabProject->id]) ? '' : 'disabled';
|
||||
$maintainerClass = $gitlabProject->isMaintainer ? '' : 'disabled';
|
||||
$developerClass = $gitlabProject->isDeveloper ? '' : 'disabled';
|
||||
|
||||
$defaultBranchClass = $gitlabProject->adminer || $gitlabProject->isMaintainer ? '' : 'disabled';
|
||||
if($this->gitlab->isDisplay($gitlab, 'browseBranch')) echo common::printIcon('gitlab', 'browseBranch', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'treemap', '', $developerClass, false, '', $this->lang->gitlab->browseBranch);
|
||||
if($this->gitlab->isDisplay($gitlab, 'browseTag')) echo common::printIcon('gitlab', 'browseTag', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'tag', '', $developerClass, false, '', $this->lang->gitlab->browseTag);
|
||||
if($this->gitlab->isDisplay($gitlab, 'manageBranchPriv')) echo common::printIcon('gitlab', 'manageBranchPriv', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'branch-lock', '', $defaultBranchClass, false, '', $this->lang->gitlab->browseBranchPriv);
|
||||
if($this->gitlab->isDisplay($gitlab, 'manageTagPriv')) echo common::printIcon('gitlab', 'manageTagPriv', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'tag-lock', '', $defaultBranchClass, false, '', $this->lang->gitlab->browseTagPriv);
|
||||
if($this->gitlab->isDisplay($gitlab, 'manageProjectMembers')) echo common::printIcon('gitlab', 'manageProjectMembers', 'repoID=' . zget($repoPairs, $gitlabProject->id), '', 'list', 'team', '', $hasRepoClass);
|
||||
if($this->gitlab->isDisplay($gitlab, 'createWebhook')) echo common::printIcon('gitlab', 'createWebhook', 'repoID=' . zget($repoPairs, $gitlabProject->id), '', 'list', 'change', 'hiddenwin', $hasRepoClass);
|
||||
if($this->gitlab->isDisplay($gitlab, 'importIssue')) echo common::printIcon('gitlab', 'importIssue', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'link');
|
||||
if($this->gitlab->isDisplay($gitlab, 'editProject')) echo common::printIcon('gitlab', 'editProject', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'edit', '', $defaultBranchClass);
|
||||
if($this->gitlab->isDisplay($gitlab, 'deleteProject')) echo common::printIcon('gitlab', 'deleteProject', "gitlabID=$gitlabID&projectID=$gitlabProject->id", '', 'list', 'trash', 'hiddenwin', $defaultBranchClass);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user