feat(problem/manage): move view_type_form, solution_view_type_form
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2023-01-19 12:37:36 +08:00
parent 8bf8f6c710
commit dd1d1150ff
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 111 additions and 101 deletions

View File

@ -466,93 +466,6 @@ $rejudgege97_form->submit_button_config['class_str'] = 'btn btn-danger d-block w
$rejudgege97_form->submit_button_config['text'] = '重测 >=97 的程序';
$rejudgege97_form->submit_button_config['smart_confirm'] = '';
$view_type_form = new UOJBs4Form('view_type');
$view_type_form->addVSelect(
'view_content_type',
array(
'NONE' => '禁止',
'ALL_AFTER_AC' => 'AC后',
'ALL' => '所有人'
),
'查看提交文件:',
$problem_extra_config['view_content_type']
);
$view_type_form->addVSelect(
'view_all_details_type',
array(
'NONE' => '禁止',
'SELF' => '仅自己',
'ALL_AFTER_AC' => 'AC后',
'ALL' => '所有人'
),
'查看全部详细信息:',
$problem_extra_config['view_all_details_type']
);
$view_type_form->addVSelect(
'view_details_type',
array(
'NONE' => '禁止',
'SELF' => '仅自己',
'ALL_AFTER_AC' => 'AC后',
'ALL' => '所有人'
),
'查看测试点详细信息:',
$problem_extra_config['view_details_type']
);
$view_type_form->handle = function () {
global $problem, $problem_extra_config;
$config = $problem_extra_config;
$config['view_content_type'] = $_POST['view_content_type'];
$config['view_all_details_type'] = $_POST['view_all_details_type'];
$config['view_details_type'] = $_POST['view_details_type'];
$esc_config = json_encode($config);
DB::update([
"update problems",
"set", ["extra_config" => $esc_config],
"where", ["id" => $problem['id']]
]);
};
$view_type_form->submit_button_config['class_str'] = 'btn btn-warning d-block w-100 mt-2';
$solution_view_type_form = new UOJBs4Form('solution_view_type');
$solution_view_type_form->addVSelect(
'view_solution_type',
array(
'NONE' => '禁止',
'ALL_AFTER_AC' => 'AC后',
'ALL' => '所有人'
),
'查看题解:',
$problem_extra_config['view_solution_type']
);
$solution_view_type_form->addVSelect(
'submit_solution_type',
array(
'NONE' => '禁止',
'ALL_AFTER_AC' => 'AC后',
'ALL' => '所有人'
),
'提交题解:',
$problem_extra_config['submit_solution_type']
);
$solution_view_type_form->handle = function () {
global $problem, $problem_extra_config;
$config = $problem_extra_config;
$config['view_solution_type'] = $_POST['view_solution_type'];
$config['submit_solution_type'] = $_POST['submit_solution_type'];
$esc_config = json_encode($config);
DB::update([
"update problems",
"set", ["extra_config" => $esc_config],
"where", ["id" => $problem['id']]
]);
};
$solution_view_type_form->submit_button_config['class_str'] = 'btn btn-warning d-block w-100 mt-2';
if ($problem['hackable']) {
$test_std_form = new UOJBs4Form('test_std');
$test_std_form->handle = function () use ($problem, $data_disp) {
@ -618,8 +531,6 @@ if ($problem['hackable']) {
}
$hackable_form->runAtServer();
$view_type_form->runAtServer();
$solution_view_type_form->runAtServer();
$data_form->runAtServer();
$clear_data_form->runAtServer();
$rejudge_form->runAtServer();
@ -753,18 +664,6 @@ $info_form->runAtServer();
<?php $test_std_form->printHTML() ?>
</div>
<?php endif ?>
<div class="mt-2">
<button id="button-display_view_type" type="button" class="btn btn-primary d-block w-100" onclick="$('#div-view_type').toggle('fast');">提交记录可视权限</button>
<div class="mt-2" id="div-view_type" style="display:none; padding-left:5px; padding-right:5px;">
<?php $view_type_form->printHTML(); ?>
</div>
</div>
<div class="mt-2">
<button id="button-solution_view_type" type="button" class="btn btn-primary d-block w-100" onclick="$('#div-solution_view_type').toggle('fast');">题解可视权限</button>
<div class="mt-2" id="div-solution_view_type" style="display:none; padding-left:5px; padding-right:5px;">
<?php $solution_view_type_form->printHTML(); ?>
</div>
</div>
<div class="mt-2">
<?php $data_form->printHTML(); ?>
</div>

View File

@ -83,6 +83,99 @@ $difficulty_form->handle = function () {
]);
};
$difficulty_form->runAtServer();
$view_type_form = new UOJForm('view_type');
$view_type_form->addSelect('view_content_type', [
'div_class' => 'row align-items-center g-0',
'label_class' => 'form-label col-auto m-0 flex-grow-1',
'select_class' => 'col-auto form-select w-auto',
'label' => '查看提交文件',
'options' => [
'NONE' => '禁止',
'ALL_AFTER_AC' => 'AC 后',
'ALL' => '所有人',
],
'default_value' => $problem_extra_config['view_content_type'],
]);
$view_type_form->addSelect('view_all_details_type', [
'div_class' => 'row align-items-center g-0 mt-3',
'label_class' => 'form-label col-auto m-0 flex-grow-1',
'select_class' => 'col-auto form-select w-auto',
'label' => '查看全部详细信息',
'options' => [
'NONE' => '禁止',
'SELF' => '仅自己',
'ALL_AFTER_AC' => 'AC 后',
'ALL' => '所有人'
],
'default_value' => $problem_extra_config['view_all_details_type'],
]);
$view_type_form->addSelect('view_details_type', [
'div_class' => 'row align-items-center g-0 mt-3',
'label_class' => 'form-label col-auto m-0 flex-grow-1',
'select_class' => 'col-auto form-select w-auto',
'label' => '查看测试点详细信息',
'options' => [
'NONE' => '禁止',
'SELF' => '仅自己',
'ALL_AFTER_AC' => 'AC 后',
'ALL' => '所有人',
],
'default_value' => $problem_extra_config['view_details_type'],
]);
$view_type_form->handle = function () {
$config = UOJProblem::cur()->getExtraConfig();
$config['view_content_type'] = $_POST['view_content_type'];
$config['view_all_details_type'] = $_POST['view_all_details_type'];
$config['view_details_type'] = $_POST['view_details_type'];
$esc_config = json_encode($config);
DB::update([
"update problems",
"set", ["extra_config" => $esc_config],
"where", ["id" => UOJProblem::info('id')]
]);
};
$view_type_form->runAtServer();
$solution_view_type_form = new UOJForm('solution_view_type');
$solution_view_type_form->addSelect('view_solution_type', [
'div_class' => 'row align-items-center g-0',
'label_class' => 'form-label col-auto m-0 flex-grow-1',
'select_class' => 'col-auto form-select w-auto',
'label' => '查看题解',
'options' => [
'NONE' => '禁止',
'ALL_AFTER_AC' => 'AC 后',
'ALL' => '所有人',
],
'default_value' => $problem_extra_config['view_solution_type'],
]);
$solution_view_type_form->addSelect('submit_solution_type', [
'div_class' => 'row align-items-center g-0 mt-3',
'label_class' => 'form-label col-auto m-0 flex-grow-1',
'select_class' => 'col-auto form-select w-auto',
'label' => '提交题解',
'options' => [
'NONE' => '禁止',
'ALL_AFTER_AC' => 'AC 后',
'ALL' => '所有人',
],
'default_value' => $problem_extra_config['submit_solution_type'],
]);
$solution_view_type_form->handle = function () {
$config = UOJProblem::cur()->getExtraConfig();
$config['view_solution_type'] = $_POST['view_solution_type'];
$config['submit_solution_type'] = $_POST['submit_solution_type'];
$esc_config = json_encode($config);
DB::update([
"update problems",
"set", ["extra_config" => $esc_config],
"where", ["id" => UOJProblem::info('id')]
]);
};
$solution_view_type_form->runAtServer();
?>
<?php echoUOJPageHeader('题面编辑 - ' . HTML::stripTags(UOJProblem::info('title'))) ?>
@ -264,6 +357,24 @@ $difficulty_form->runAtServer();
<?php $difficulty_form->printHTML() ?>
</div>
</div>
<div class="card mt-3">
<div class="card-header fw-bold">
提交记录可视权限
</div>
<div class="card-body">
<?php $view_type_form->printHTML() ?>
</div>
</div>
<div class="card mt-3">
<div class="card-header fw-bold">
题解可视权限
</div>
<div class="card-body">
<?php $solution_view_type_form->printHTML() ?>
</div>
</div>
</aside>
</div>