* Add gitlab browseuser page
This commit is contained in:
@@ -166,3 +166,32 @@ $config->gitlab->dtable->group->fieldList['actions']['list']['deleteGroup']['ico
|
||||
$config->gitlab->dtable->group->fieldList['actions']['list']['deleteGroup']['hint'] = $lang->gitlab->deleteGroup;
|
||||
$config->gitlab->dtable->group->fieldList['actions']['list']['deleteGroup']['url'] = helper::createLink('gitlab', 'deleteGroup', 'gitlabID={gitlabID}&groupID={id}');
|
||||
$config->gitlab->dtable->group->fieldList['actions']['list']['deleteGroup']['className'] = 'ajax-submit';
|
||||
|
||||
$config->gitlab->dtable->user = new stdclass();
|
||||
|
||||
$config->gitlab->dtable->user->fieldList['id']['title'] = $lang->gitlab->user->id;
|
||||
$config->gitlab->dtable->user->fieldList['id']['type'] = 'id';
|
||||
$config->gitlab->dtable->user->fieldList['id']['width'] = '80px';
|
||||
|
||||
$config->gitlab->dtable->user->fieldList['name']['title'] = $lang->gitlab->user->name;
|
||||
$config->gitlab->dtable->user->fieldList['name']['name'] = 'name';
|
||||
$config->gitlab->dtable->user->fieldList['name']['type'] = 'html';
|
||||
$config->gitlab->dtable->user->fieldList['name']['sortType'] = true;
|
||||
|
||||
$config->gitlab->dtable->user->fieldList['createOn']['title'] = $lang->gitlab->user->createOn;
|
||||
|
||||
$config->gitlab->dtable->user->fieldList['lastActivity']['title'] = $lang->gitlab->user->lastActivity;
|
||||
|
||||
$config->gitlab->dtable->user->fieldList['actions']['name'] = 'actions';
|
||||
$config->gitlab->dtable->user->fieldList['actions']['title'] = $lang->actions;
|
||||
$config->gitlab->dtable->user->fieldList['actions']['type'] = 'actions';
|
||||
$config->gitlab->dtable->user->fieldList['actions']['menu'] = array('editUser', 'deleteUser');
|
||||
|
||||
$config->gitlab->dtable->user->fieldList['actions']['list']['editUser']['icon'] = 'edit';
|
||||
$config->gitlab->dtable->user->fieldList['actions']['list']['editUser']['hint'] = $lang->gitlab->editUser;
|
||||
$config->gitlab->dtable->user->fieldList['actions']['list']['editUser']['url'] = helper::createLink('gitlab', 'editUser', 'gitlabID={gitlabID}&userID={id}');
|
||||
|
||||
$config->gitlab->dtable->user->fieldList['actions']['list']['deleteUser']['icon'] = 'trash';
|
||||
$config->gitlab->dtable->user->fieldList['actions']['list']['deleteUser']['hint'] = $lang->gitlab->deleteUser;
|
||||
$config->gitlab->dtable->user->fieldList['actions']['list']['deleteUser']['url'] = helper::createLink('gitlab', 'deleteUser', 'gitlabID={gitlabID}&userID={id}');
|
||||
$config->gitlab->dtable->user->fieldList['actions']['list']['deleteUser']['className'] = 'ajax-submit';
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
#userDropmenu .icon-angle-right {display: none;}
|
||||
.dtable-cell-html img {height: 40px; display: inline-block; margin-right: 10px;}
|
||||
@@ -0,0 +1,12 @@
|
||||
window.createSortLink = function(col)
|
||||
{
|
||||
var sort = col.name + '_asc';
|
||||
if(sort == orderBy) sort = col.name + '_desc';
|
||||
|
||||
return sortLink.replace('{orderBy}', sort);
|
||||
}
|
||||
|
||||
function searchUser()
|
||||
{
|
||||
loadPage({method:'post', data: {keyword: $('#keyword').val()}, target: '#table-gitlab-browseuser>*'});
|
||||
}
|
||||
@@ -3001,12 +3001,12 @@ class gitlabModel extends model
|
||||
* 判断按钮是否可点击。
|
||||
* Adjust the action clickable.
|
||||
*
|
||||
* @param object $instance
|
||||
* @param object $object
|
||||
* @param string $action
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isClickable(object $gitlab, string $action): bool
|
||||
public function isClickable(object $object, string $action): bool
|
||||
{
|
||||
if(!commonModel::hasPriv('space', 'browse')) return false;
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The browseuser view file of gitlab module of ZenTaoPMS.
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Zeng Gang<zenggang@easycorp.ltd>
|
||||
* @package gitlab
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
jsVar('orderBy', $orderBy);
|
||||
jsVar('sortLink', helper::createLink('gitlab', 'browseUser', "gitlabID={$gitlabID}&orderBy={orderBy}"));
|
||||
jsVar('gitlabUrl', $gitlab->url);
|
||||
|
||||
$canCreate = hasPriv('instance', 'manage');
|
||||
|
||||
$menus = $items = array();
|
||||
$gitlabs = $this->gitlab->getPairs();
|
||||
foreach($gitlabs as $id => $gitlabName)
|
||||
{
|
||||
$menus[] = array('text' => $gitlabName, 'id' => $id, 'keys' => zget(common::convert2Pinyin(array($gitlabName), $gitlabName), ''), 'url' => helper::createLink('gitlab', zget($config->gitlab->menus, 'user', 'user'), "gitlabID={$id}"));
|
||||
}
|
||||
foreach($config->gitlab->menus as $key => $method)
|
||||
{
|
||||
$langKey = 'browse' . ucwords($key);
|
||||
$items[] = li
|
||||
(
|
||||
setClass('nav-item'),
|
||||
a
|
||||
(
|
||||
setClass('' . ($key == 'user' ? 'active' : '')),
|
||||
set::href(createLink('gitlab', $method, "gitlabID={$gitlabID}")),
|
||||
$lang->gitlab->$langKey,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
foreach($gitlabUserList as $gitlabUser)
|
||||
{
|
||||
$gitlabUser->gitlabID = $gitlabID;
|
||||
$gitlabUser->createOn = substr($gitlabUser->createdAt, 0, 10);
|
||||
$gitlabUser->lastActivity = substr($gitlabUser->lastActivityOn, 0, 10);
|
||||
$gitlabUser->isAdmin = $isAdmin;
|
||||
$gitlabUser->name = html::image($gitlabUser->avatar, "height=40") . '<strong>' .$gitlabUser->realname . '</strong> ' . $gitlabUser->account . ' ' . $gitlabUser->email;
|
||||
}
|
||||
|
||||
$gitlabUserList = initTableData($gitlabUserList, $config->gitlab->dtable->user->fieldList, $this->gitlab);
|
||||
|
||||
featureBar
|
||||
(
|
||||
dropmenu
|
||||
(
|
||||
set::id('userDropmenu'),
|
||||
set::objectID($gitlabID),
|
||||
set::text($gitlabs[$gitlabID]),
|
||||
set::data(array('data' => array('user' => $menus), 'tabs' => array(array('name' => 'user', 'text' => '')))),
|
||||
),
|
||||
$items,
|
||||
form
|
||||
(
|
||||
set::id('searchForm'),
|
||||
set::actions(array()),
|
||||
formRow
|
||||
(
|
||||
input
|
||||
(
|
||||
set::placeholder($lang->gitlab->placeholderSearch),
|
||||
set::name('keyword'),
|
||||
set::value($keyword)
|
||||
),
|
||||
btn
|
||||
(
|
||||
setClass('primary'),
|
||||
$lang->gitlab->search,
|
||||
on::click('searchUser')
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
toolBar
|
||||
(
|
||||
$canCreate ? item(set(array
|
||||
(
|
||||
'text' => $lang->gitlab->user->create,
|
||||
'icon' => 'plus',
|
||||
'class' => 'btn primary',
|
||||
'url' => createLink('gitlab', 'createUser', "gitlabID={$gitlabID}"),
|
||||
))) : null,
|
||||
);
|
||||
|
||||
dtable
|
||||
(
|
||||
set::cols($config->gitlab->dtable->user->fieldList),
|
||||
set::data($gitlabUserList),
|
||||
set::sortLink(jsRaw('createSortLink')),
|
||||
set::onRenderCell(jsRaw('window.renderCell')),
|
||||
set::orderBy($orderBy),
|
||||
);
|
||||
|
||||
render();
|
||||
Reference in New Issue
Block a user