mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 14:08:42 +00:00
chore(web/contest/manage): move extra_registration to rule_form
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
85820d5b2c
commit
ff41b8761f
@ -373,6 +373,10 @@ EOD);
|
|||||||
1 => '所有人都可以自由报名',
|
1 => '所有人都可以自由报名',
|
||||||
0 => '只能由管理员帮选手报名'
|
0 => '只能由管理员帮选手报名'
|
||||||
], "报名方式", $contest['extra_config']['free_registration']);
|
], "报名方式", $contest['extra_config']['free_registration']);
|
||||||
|
$rule_form->addVCheckboxes('extra_registration', [
|
||||||
|
'0' => '禁止',
|
||||||
|
'1' => '允许'
|
||||||
|
], '是否允许额外报名', isset($contest['extra_config']['extra_registration']) ? $contest['extra_config']['extra_registration'] : '1');
|
||||||
$rule_form->addVSelect('individual_or_team', [
|
$rule_form->addVSelect('individual_or_team', [
|
||||||
'individual' => '个人赛',
|
'individual' => '个人赛',
|
||||||
'team' => '团体赛'
|
'team' => '团体赛'
|
||||||
@ -392,6 +396,7 @@ EOD);
|
|||||||
$contest['extra_config']['free_registration'] = (int)$_POST['free_registration'];
|
$contest['extra_config']['free_registration'] = (int)$_POST['free_registration'];
|
||||||
$contest['extra_config']['individual_or_team'] = $_POST['individual_or_team'];
|
$contest['extra_config']['individual_or_team'] = $_POST['individual_or_team'];
|
||||||
$contest['extra_config']['max_n_submissions_per_problem'] = (int)$_POST['max_n_submissions_per_problem'];
|
$contest['extra_config']['max_n_submissions_per_problem'] = (int)$_POST['max_n_submissions_per_problem'];
|
||||||
|
$contest['extra_config']['extra_registration'] = (int)$_POST['extra_registration'];
|
||||||
|
|
||||||
$esc_extra_config = json_encode($contest['extra_config']);
|
$esc_extra_config = json_encode($contest['extra_config']);
|
||||||
DB::update([
|
DB::update([
|
||||||
@ -521,39 +526,6 @@ function(res) {
|
|||||||
}
|
}
|
||||||
EOD);
|
EOD);
|
||||||
$blog_link_contests->runAtServer();
|
$blog_link_contests->runAtServer();
|
||||||
|
|
||||||
$extra_registration_form = new UOJBs4Form('extra_registration_form');
|
|
||||||
$extra_registration_form->addVCheckboxes('extra_registration', [
|
|
||||||
'0' => '禁止',
|
|
||||||
'1' => '允许'
|
|
||||||
], '是否允许额外报名', isset($contest['extra_config']['extra_registration']) ? $contest['extra_config']['extra_registration'] : '1');
|
|
||||||
$extra_registration_form->handle = function () use ($contest) {
|
|
||||||
$contest['extra_config']['extra_registration'] = $_POST['extra_registration'];
|
|
||||||
$esc_extra_config = DB::escape(json_encode($contest['extra_config']));
|
|
||||||
DB::update("UPDATE contests SET extra_config = '$esc_extra_config' WHERE id = {$contest['id']}");
|
|
||||||
|
|
||||||
dieWithJsonData(['status' => 'success', 'message' => $_POST['extra_registration'] ? '已允许额外报名' : '已禁止额外报名']);
|
|
||||||
};
|
|
||||||
$extra_registration_form->setAjaxSubmit(<<<EOD
|
|
||||||
function(res) {
|
|
||||||
if (res.status === 'success') {
|
|
||||||
$('#extra-registration-result-alert')
|
|
||||||
.html('操作成功!' + (res.message || ''))
|
|
||||||
.addClass('alert-success')
|
|
||||||
.removeClass('alert-danger')
|
|
||||||
.show();
|
|
||||||
} else {
|
|
||||||
$('#extra-registration-result-alert')
|
|
||||||
.html('操作失败。' + (res.message || ''))
|
|
||||||
.removeClass('alert-success')
|
|
||||||
.addClass('alert-danger')
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
$(window).scrollTop(0);
|
|
||||||
}
|
|
||||||
EOD);
|
|
||||||
$extra_registration_form->runAtServer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -567,7 +539,6 @@ EOD);
|
|||||||
<div class="row mt-4">
|
<div class="row mt-4">
|
||||||
<!-- left col -->
|
<!-- left col -->
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
|
|
||||||
<?= HTML::navListGroup($tabs_info, $cur_tab) ?>
|
<?= HTML::navListGroup($tabs_info, $cur_tab) ?>
|
||||||
|
|
||||||
<a class="btn btn-light d-block mt-2 w-100 text-start text-primary" style="--bs-btn-hover-bg: #d3d4d570; --bs-btn-hover-border-color: transparent;" href="<?= HTML::url("/contest/{$contest['id']}") ?>">
|
<a class="btn btn-light d-block mt-2 w-100 text-start text-primary" style="--bs-btn-hover-bg: #d3d4d570; --bs-btn-hover-border-color: transparent;" href="<?= HTML::url("/contest/{$contest['id']}") ?>">
|
||||||
@ -579,7 +550,6 @@ EOD);
|
|||||||
|
|
||||||
<!-- right col -->
|
<!-- right col -->
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
|
|
||||||
<?php if ($cur_tab == 'profile') : ?>
|
<?php if ($cur_tab == 'profile') : ?>
|
||||||
<div class="card mt-3 mt-md-0">
|
<div class="card mt-3 mt-md-0">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@ -618,13 +588,13 @@ EOD);
|
|||||||
"contest_id = '{$contest['id']}'",
|
"contest_id = '{$contest['id']}'",
|
||||||
'ORDER BY level, problem_id',
|
'ORDER BY level, problem_id',
|
||||||
<<<EOD
|
<<<EOD
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:3em">ID</th>
|
<th style="width:3em">ID</th>
|
||||||
<th>标题</th>
|
<th>标题</th>
|
||||||
<th style="width:8em">评测设置</th>
|
<th style="width:8em">评测设置</th>
|
||||||
<th style="width:6em">操作</th>
|
<th style="width:6em">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
EOD,
|
EOD,
|
||||||
function ($row) {
|
function ($row) {
|
||||||
$problem = UOJProblem::query($row['problem_id']);
|
$problem = UOJProblem::query($row['problem_id']);
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
@ -758,9 +728,6 @@ EOD,
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="#blogs" data-bs-toggle="tab" data-bs-target="#blogs">比赛资料</a>
|
<a class="nav-link" href="#blogs" data-bs-toggle="tab" data-bs-target="#blogs">比赛资料</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="#extra-registration" data-bs-toggle="tab" data-bs-target="#extra-registration">额外报名</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body tab-content">
|
<div class="card-body tab-content">
|
||||||
@ -812,20 +779,6 @@ EOD,
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="extra-registration">
|
|
||||||
<div id="extra-registration-result-alert" class="alert" role="alert" style="display: none"></div>
|
|
||||||
<div class="row row-cols-1 row-cols-md-2">
|
|
||||||
<div class="col">
|
|
||||||
<?php $extra_registration_form->printHTML(); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col mt-3 mt-md-0">
|
|
||||||
<h5>注意事项</h5>
|
|
||||||
<ul class="mb-0">
|
|
||||||
<li>如果允许额外报名,则比赛开始后选手也可以报名参赛。</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user