+ Add new page for gogs binduser.
This commit is contained in:
@@ -50,3 +50,27 @@ $config->gogs->dtable->fieldList['actions']['sortType'] = false;
|
||||
$config->gogs->dtable->fieldList['actions']['fixed'] = 'right';
|
||||
$config->gogs->dtable->fieldList['actions']['menu'] = array('edit', 'bindUser', 'delete');
|
||||
$config->gogs->dtable->fieldList['actions']['list'] = $config->gogs->actionList;
|
||||
|
||||
$config->gogs->dtable->bindUser = new stdclass();
|
||||
$config->gogs->dtable->bindUser->fieldList['gogsUser']['title'] = $lang->gogs->gogsAccount;
|
||||
$config->gogs->dtable->bindUser->fieldList['gogsUser']['type'] = 'avatarName';
|
||||
$config->gogs->dtable->bindUser->fieldList['gogsUser']['sortType'] = false;
|
||||
$config->gogs->dtable->bindUser->fieldList['gogsUser']['width'] = 300;
|
||||
|
||||
$config->gogs->dtable->bindUser->fieldList['gogsEmail']['title'] = $lang->gogs->gogsEmail;
|
||||
$config->gogs->dtable->bindUser->fieldList['gogsEmail']['type'] = 'text';
|
||||
$config->gogs->dtable->bindUser->fieldList['gogsEmail']['width'] = 200;
|
||||
|
||||
$config->gogs->dtable->bindUser->fieldList['email']['title'] = $lang->gogs->zentaoEmail;
|
||||
$config->gogs->dtable->bindUser->fieldList['email']['type'] = 'text';
|
||||
$config->gogs->dtable->bindUser->fieldList['email']['width'] = 200;
|
||||
|
||||
$config->gogs->dtable->bindUser->fieldList['zentaoUsers']['title'] = array('html' => $lang->gogs->zentaoAccount . "<span class='text-gray'>{$lang->gogs->accountDesc}</span>");
|
||||
$config->gogs->dtable->bindUser->fieldList['zentaoUsers']['type'] = 'control';
|
||||
$config->gogs->dtable->bindUser->fieldList['zentaoUsers']['control'] = 'picker';
|
||||
$config->gogs->dtable->bindUser->fieldList['zentaoUsers']['width'] = 300;
|
||||
|
||||
$config->gogs->dtable->bindUser->fieldList['status']['title'] = $lang->gogs->bindingStatus;
|
||||
$config->gogs->dtable->bindUser->fieldList['status']['type'] = 'html';
|
||||
$config->gogs->dtable->bindUser->fieldList['status']['width'] = 100;
|
||||
$config->gogs->dtable->bindUser->fieldList['status']['map'] = $lang->gogs->bindStatus;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#featureBar {display: flex; gap: 1rem;}
|
||||
@@ -0,0 +1,16 @@
|
||||
window.setUserEmail = function()
|
||||
{
|
||||
let email = '';
|
||||
const account = $(this).val();
|
||||
if(account && zentaoUsers[account]) email = zentaoUsers[account].email;
|
||||
|
||||
$(this).closest('.dtable-cell').prev().find('.dtable-cell-content').text(email);
|
||||
}
|
||||
|
||||
window.renderGitlabUser = function(result, {row})
|
||||
{
|
||||
const gitlabID = row.data.gitlabID;
|
||||
result.push({html: `<input type="hidden" name='gogsUserNames[]' value='${gitlabID}'>`});
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The bind user file of gogs 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 Yanyi Cao<caoyanyi@easycorp.ltd>
|
||||
* @package gogs
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
|
||||
namespace zin;
|
||||
|
||||
/* zin: Define the set::module('compile') feature bar on main menu. */
|
||||
featureBar
|
||||
(
|
||||
to::leading(array(backBtn(set::icon('back'), set::class('secondary'), $lang->goback))),
|
||||
set::current($type),
|
||||
set::link($this->createLink('gogs', 'binduser', "gogsID=$gogsID&type={key}")),
|
||||
);
|
||||
|
||||
/* zin: Define the toolbar on main menu. */
|
||||
toolbar();
|
||||
|
||||
jsVar('zentaoUsers', $zentaoUsers);
|
||||
$config->gogs->dtable->bindUser->fieldList['gogsEmail']['onRenderCell'] = jsRaw('renderGitlabUser');
|
||||
$config->gogs->dtable->bindUser->fieldList['zentaoUsers']['controlItems'] = $userPairs;
|
||||
form
|
||||
(
|
||||
setID('bindForm'),
|
||||
setClass('mb-4 h-full'),
|
||||
set::action(createLink('gogs', 'bindUser', "gogsID={$gogsID}")),
|
||||
set::actions(array()),
|
||||
on::change('input[name^="zentaoUsers"]', 'setUserEmail'),
|
||||
dtable
|
||||
(
|
||||
set::cols($config->gogs->dtable->bindUser->fieldList),
|
||||
set::data($userList),
|
||||
set::plugins(array('form')),
|
||||
set::rowHeight(50),
|
||||
set::showToolbarOnChecked(false),
|
||||
set::footer(array('toolbar')),
|
||||
set::rowKey('gogsID'),
|
||||
set::footToolbar(array(
|
||||
'className' => 'w-full form-actions form-group no-label',
|
||||
'items' => array(
|
||||
array(
|
||||
'text' => $lang->save,
|
||||
'btnType' => 'primary',
|
||||
'onClick' => jsRaw("() => {\$('#bindForm').trigger('submit')}")
|
||||
),
|
||||
array(
|
||||
'text' => $lang->goback,
|
||||
'btnType' => 'info',
|
||||
'onClick' => jsRaw('() => {goBack()}'),
|
||||
)
|
||||
)
|
||||
)),
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user