* Add gitlab user avatar
This commit is contained in:
4
module/gitlab/css/createuser.css
Normal file
4
module/gitlab/css/createuser.css
Normal file
@@ -0,0 +1,4 @@
|
||||
#avatarUpload {display: inline-block; width: 50px; height: 50px; position: relative;}
|
||||
#avatarUploadBtn {display: block; position: absolute; top: 0; left: 0; right: 0; bottom: 0;}
|
||||
#avatarUploadBtn {opacity: 0; color: #fff; border-radius: 50%; line-height: 50px;}
|
||||
#avatarUploadBtn:hover {opacity: 1; background-color: rgba(0,0,0,.5);}
|
||||
17
module/gitlab/js/createuser.js
Normal file
17
module/gitlab/js/createuser.js
Normal file
@@ -0,0 +1,17 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#avatarUploadBtn').on('click', function()
|
||||
{
|
||||
$('#files').click();
|
||||
});
|
||||
$("#files").change(function(){
|
||||
var files = this.files;
|
||||
if(!files.length)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$(".avatar img").attr("src", window.URL.createObjectURL(files[0]));
|
||||
$(".avatar").removeClass('hidden');
|
||||
});
|
||||
});
|
||||
@@ -85,6 +85,7 @@ $lang->gitlab->user->canCreateGroup = "Can create group";
|
||||
$lang->gitlab->user->external = "External";
|
||||
$lang->gitlab->user->externalTip = "External users cannot see internal or private projects unless access is explicitly granted. Also, external users cannot create projects, groups, or personal snippets.";
|
||||
$lang->gitlab->user->bind = "Bind Zentao user";
|
||||
$lang->gitlab->user->avatar = "Avatar";
|
||||
$lang->gitlab->user->skype = "Skype";
|
||||
$lang->gitlab->user->linkedin = "Linkedin";
|
||||
$lang->gitlab->user->twitter = "Twitter";
|
||||
|
||||
@@ -85,6 +85,7 @@ $lang->gitlab->user->canCreateGroup = "可创建组";
|
||||
$lang->gitlab->user->external = "外部人员";
|
||||
$lang->gitlab->user->externalTip = "除非明确授予访问权限,否则外部用户无法查看内部或私有项目。另外,外部用户无法创建项目,群组或个人代码片段。";
|
||||
$lang->gitlab->user->bind = "绑定禅道用户";
|
||||
$lang->gitlab->user->avatar = "头像";
|
||||
$lang->gitlab->user->skype = "Skype";
|
||||
$lang->gitlab->user->linkedin = "Linkedin";
|
||||
$lang->gitlab->user->twitter = "Twitter";
|
||||
|
||||
@@ -1691,6 +1691,7 @@ class gitlabModel extends model
|
||||
public function createUser($gitlabID)
|
||||
{
|
||||
$user = fixer::input('post')->get();
|
||||
if($_FILES['avatar']) $user->avatar = curl_file_create($_FILES['avatar']['tmp_name'], $_FILES['avatar']['type'], $_FILES['avatar']['name']);
|
||||
|
||||
if(empty($user->name)) dao::$errors['name'][] = $this->lang->gitlab->user->name . $this->lang->gitlab->user->emptyError;
|
||||
if(empty($user->username)) dao::$errors['username'][] = $this->lang->gitlab->user->username . $this->lang->gitlab->user->emptyError;
|
||||
|
||||
@@ -49,8 +49,8 @@
|
||||
$disabled = !empty($gitlab->isAdminToken) ? '' : 'disabled';
|
||||
common::printLink('gitlab', 'projectBrowse', "gitlabID=$id", "<i class='icon icon-project'></i> ", '',"title={$lang->gitlab->browseProject} class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'edit', "gitlabID=$id", "<i class='icon icon-edit'></i> ", '',"title={$lang->gitlab->edit} class='btn btn-primary'");
|
||||
common::printLink('gitlab', 'userBrowse', "gitlabID=$id", "<i class='icon icon-group'></i> ", '', "title={$lang->gitlab->browseUser} class='btn {$disabled}' ,'disabled'");
|
||||
common::printLink('gitlab', 'bindUser', "id=$id", "<i class='icon icon-group'></i> ", '', "title={$lang->gitlab->bindUser} class='btn {$disabled}' ,'disabled'");
|
||||
common::printLink('gitlab', 'userBrowse', "gitlabID=$id", "<i class='icon icon-team'></i> ", '', "title={$lang->gitlab->browseUser} class='btn {$disabled}' ,'disabled'");
|
||||
common::printLink('gitlab', 'bindUser', "id=$id", "<i class='icon icon-link'></i> ", '', "title={$lang->gitlab->bindUser} class='btn {$disabled}' ,'disabled'");
|
||||
if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'delete', "gitlabID=$id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->delete}' class='btn'");
|
||||
?>
|
||||
</td>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->gitlab->user->create;?></h2>
|
||||
</div>
|
||||
<form id='gitlabForm' method='post' class='form-ajax'>
|
||||
<form id='gitlabForm' method='post' class='form-ajax' enctype="multipart/form-data">
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->gitlab->user->name;?></th>
|
||||
@@ -68,6 +68,18 @@
|
||||
<th><?php echo $lang->gitlab->user->bind;?></th>
|
||||
<td><?php echo html::select('bind', $userPairs, '', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<?php if(function_exists('curl_file_create')):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->gitlab->user->avatar;?></th>
|
||||
<td>
|
||||
<div id="avatarUpload" class="text-center">
|
||||
<?php echo html::avatar(array('avatar'=>' ', 'account'=>''), 50); ?>
|
||||
<input type="file" name="avatar" id="files" class="form-control hidden">
|
||||
<?php echo html::a('javascript:void(0);', '<i class="icon icon-pencil icon-2x"></i>', '', "class='btn-avatar' id='avatarUploadBtn' data-toggle='tooltip' data-container='body' data-placement='bottom' title='{$lang->gitlab->user->avatar}'");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->gitlab->user->skype;?></th>
|
||||
<td><?php echo html::input('skype', '', "class='form-control' placeholder='{$lang->gitlab->user->skype}'");?></td>
|
||||
@@ -92,7 +104,7 @@
|
||||
<th></th>
|
||||
<td class='text-center form-actions'>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php if(!isonlybody()) echo html::a(inlink('projectbrowse', "gitlabID=$gitlabID"), $lang->goback, '', 'class="btn btn-wide"');?>
|
||||
<?php if(!isonlybody()) echo html::a(inlink('userbrowse', "gitlabID=$gitlabID"), $lang->goback, '', 'class="btn btn-wide"');?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user