mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 18:08:42 +00:00
refactor(web/problem/manage/managers): update_uploader_form
This commit is contained in:
parent
0f4977727a
commit
4e1d7d8f1a
@ -32,26 +32,35 @@ $managers_form = newAddDelCmdForm(
|
|||||||
$managers_form->runAtServer();
|
$managers_form->runAtServer();
|
||||||
|
|
||||||
if (isSuperUser(Auth::user())) {
|
if (isSuperUser(Auth::user())) {
|
||||||
$update_uploader_form = new UOJBs4Form('update_uploader');
|
$update_uploader_form = new UOJForm('update_uploader');
|
||||||
|
$update_uploader_form->appendHTML(
|
||||||
|
HTML::tag(
|
||||||
|
'div',
|
||||||
|
['class' => 'col-auto'],
|
||||||
|
HTML::tag('label', ['class' => 'col-form-label'], '上传者')
|
||||||
|
)
|
||||||
|
);
|
||||||
$update_uploader_form->addInput(
|
$update_uploader_form->addInput(
|
||||||
'new_uploader_username',
|
'new_uploader_username',
|
||||||
'text',
|
[
|
||||||
'用户名',
|
'div_class' => 'col-auto',
|
||||||
UOJProblem::info('uploader') ?: 'root',
|
'default_value' => UOJProblem::info('uploader') ?: 'root',
|
||||||
function ($username, &$vdata) {
|
'validator_php' => function ($username, &$vdata) {
|
||||||
if (!UOJUser::query($username)) {
|
if (!UOJUser::query($username)) {
|
||||||
return '用户不存在';
|
return '用户不存在';
|
||||||
}
|
}
|
||||||
|
|
||||||
$vdata['username'] = $username;
|
$vdata['username'] = $username;
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
null
|
]
|
||||||
);
|
);
|
||||||
$update_uploader_form->submit_button_config['align'] = 'compressed';
|
$update_uploader_form->config['form']['class'] = 'mt-2 row g-3 align-items-center';
|
||||||
$update_uploader_form->submit_button_config['text'] = '修改上传者';
|
$update_uploader_form->config['submit_container']['class'] = 'col-auto';
|
||||||
$update_uploader_form->submit_button_config['class_str'] = 'mt-2 btn btn-warning';
|
$update_uploader_form->config['submit_button']['class'] = 'btn btn-warning';
|
||||||
|
$update_uploader_form->config['submit_button']['text'] = '修改上传者';
|
||||||
|
$update_uploader_form->config['confirm']['smart'] = true;
|
||||||
$update_uploader_form->handle = function (&$vdata) {
|
$update_uploader_form->handle = function (&$vdata) {
|
||||||
DB::update([
|
DB::update([
|
||||||
"update problems",
|
"update problems",
|
||||||
|
Loading…
Reference in New Issue
Block a user