-
-
-
用户名 |
-
操作 |
-
- EOD,
- function ($row) {
- $user = UOJUser::query($row['username']);
+
+
+
用户名 |
+
+ EOD,
+ function ($row) {
+ $user = UOJUser::query($row['username']);
- echo HTML::tag_begin('tr');
- echo HTML::tag('td', [], UOJUser::getLink($user));
- echo HTML::tag('td', [], [
- HTML::tag('form', [
- 'method' => 'POST',
- 'target' => '_self',
- 'class' => 'd-inline-block',
- 'onsubmit' => "return confirm('你确定要将 {$user['username']} 从比赛管理员列表中移除吗?');",
- ], [
- HTML::hiddenToken(),
- HTML::empty_tag('input', [
- 'type' => 'hidden',
- 'name' => 'username',
- 'value' => $user['username'],
- ]),
- HTML::tag('button', [
- 'type' => 'submit',
- 'class' => 'btn btn-link text-danger text-decoration-none p-0',
- 'name' => 'submit-remove_manager',
- 'value' => 'remove_manager',
- ], '移除'),
- ]),
- ]);
- echo HTML::tag_end('tr');
- },
- [
- 'echo_full' => true,
- 'div_classes' => ['table-responsive'],
- 'table_classes' => ['table'],
- ]
- );
- ?>
-
-
-
-
-
- printHTML(); ?>
-
-
-
注意事项
-
- - 添加管理者前请确认用户名是否正确以免带来不必要的麻烦。
- - 比赛管理者如果报名了比赛仍可以正常参赛,但不报名比赛也可以查看并管理本场比赛。
-
-
-
-
+ echo HTML::tag_begin('tr');
+ echo HTML::tag('td', [], UOJUser::getLink($user));
+ echo HTML::tag_end('tr');
+ },
+ [
+ 'echo_full' => true,
+ 'div_classes' => ['table-responsive'],
+ 'table_classes' => ['table'],
+ ]
+ );
+ ?>
+
+ printHTML() ?>
diff --git a/web/app/controllers/problem_permissions_manage.php b/web/app/controllers/problem_permissions_manage.php
index 3451be2..0c8bde3 100644
--- a/web/app/controllers/problem_permissions_manage.php
+++ b/web/app/controllers/problem_permissions_manage.php
@@ -46,7 +46,11 @@ $managers_form = newAddDelCmdForm(
]
]);
}
- }
+ },
+ null,
+ [
+ 'help' => '命令格式:命令一行一个,
从管理者中移除。',
+ ]
);
$managers_form->runAtServer();
diff --git a/web/app/libs/uoj-form-lib.php b/web/app/libs/uoj-form-lib.php
index ddde655..333f4c9 100644
--- a/web/app/libs/uoj-form-lib.php
+++ b/web/app/libs/uoj-form-lib.php
@@ -1,13 +1,13 @@
;window.location = window.location.origin + window.location.pathname + (window.location.search.length ? window.location.search + "&" : "?") + "_refresh_" + (+new Date()) + "=" + (+new Date()) + window.location.hash;');
-function newAddDelCmdForm($form_name, $validate, $handle, $final = null) {
+function newAddDelCmdForm($form_name, $validate, $handle, $final = null, $cfg = []) {
$form = new UOJForm($form_name);
$form->addTextArea("{$form_name}_cmds", [
'label' => '命令',
'input_class' => 'form-control font-monospace',
'validator_php' => function ($str, &$vdata) use ($validate) {
- $cmds = array();
+ $cmds = [];
foreach (explode("\n", $str) as $line_id => $raw_line) {
$line = trim($raw_line);
if ($line == '') {
@@ -26,8 +26,8 @@ function newAddDelCmdForm($form_name, $validate, $handle, $final = null) {
$vdata['cmds'] = $cmds;
return '';
},
- ]);
- if (!isset($final)) {
+ ] + $cfg);
+ if (!isset($final) || !$final) {
$form->handle = function (&$vdata) use ($handle) {
foreach ($vdata['cmds'] as $cmd) {
$handle($cmd['type'], $cmd['obj'], $vdata);