mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 13:28:41 +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 => '所有人都可以自由报名',
|
||||
0 => '只能由管理员帮选手报名'
|
||||
], "报名方式", $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', [
|
||||
'individual' => '个人赛',
|
||||
'team' => '团体赛'
|
||||
@ -392,6 +396,7 @@ EOD);
|
||||
$contest['extra_config']['free_registration'] = (int)$_POST['free_registration'];
|
||||
$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']['extra_registration'] = (int)$_POST['extra_registration'];
|
||||
|
||||
$esc_extra_config = json_encode($contest['extra_config']);
|
||||
DB::update([
|
||||
@ -521,39 +526,6 @@ function(res) {
|
||||
}
|
||||
EOD);
|
||||
$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">
|
||||
<!-- left col -->
|
||||
<div class="col-md-3">
|
||||
|
||||
<?= 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']}") ?>">
|
||||
@ -579,7 +550,6 @@ EOD);
|
||||
|
||||
<!-- right col -->
|
||||
<div class="col-md-9">
|
||||
|
||||
<?php if ($cur_tab == 'profile') : ?>
|
||||
<div class="card mt-3 mt-md-0">
|
||||
<div class="card-body">
|
||||
@ -758,9 +728,6 @@ EOD,
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#blogs" data-bs-toggle="tab" data-bs-target="#blogs">比赛资料</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#extra-registration" data-bs-toggle="tab" data-bs-target="#extra-registration">额外报名</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-body tab-content">
|
||||
@ -812,20 +779,6 @@ EOD,
|
||||
</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>
|
||||
<?php endif ?>
|
||||
|
Loading…
Reference in New Issue
Block a user