mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 01:48:41 +00:00
fix(support IOI competition system):#6 (#33)
This commit is contained in:
parent
ec54596ab4
commit
94fbfea97f
@ -507,8 +507,13 @@ EOD;
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<?php endif ?>
|
||||
<?php if (!isset($contest['extra_config']['contest_type']) || $contest['extra_config']['contest_type']=='OI'):?>
|
||||
<p>此次比赛为OI赛制。</p>
|
||||
<p><strong>注意:比赛时只显示测样例的结果。</strong></p>
|
||||
<?php elseif ($contest['extra_config']['contest_type']=='IOI'):?>
|
||||
<p>此次比赛为IOI赛制。</p>
|
||||
<p><strong>注意:比赛时显示测试所有数据的结果,但无法看到详细信息。</strong></p>
|
||||
<?php endif?>
|
||||
|
||||
<a href="/contest/<?=$contest['id']?>/registrants" class="btn btn-info btn-block"><?= UOJLocale::get('contests::contest registrants') ?></a>
|
||||
<?php if (isSuperUser($myUser)): ?>
|
||||
|
@ -171,6 +171,25 @@
|
||||
DB::update("update contests set extra_config = '$esc_extra_config' where id = {$contest['id']}");
|
||||
};
|
||||
$version_form->runAtServer();
|
||||
|
||||
$contest_type_form = new UOJForm('contest_type');
|
||||
$contest_type_form->addInput('contest_type', 'text', '赛制', $contest['extra_config']['contest_type'],
|
||||
function ($x) {
|
||||
if ($x != 'OI' && $x != 'ACM' && $x != 'IOI') {
|
||||
return '不是合法的赛制名';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
null
|
||||
);
|
||||
$contest_type_form->handle = function() {
|
||||
global $contest;
|
||||
$contest['extra_config']['contest_type'] = $_POST['contest_type'];
|
||||
$esc_extra_config = json_encode($contest['extra_config']);
|
||||
$esc_extra_config = DB::escape($esc_extra_config);
|
||||
DB::update("update contests set extra_config = '$esc_extra_config' where id = {$contest['id']}");
|
||||
};
|
||||
$contest_type_form->runAtServer();
|
||||
}
|
||||
|
||||
$time_form->runAtServer();
|
||||
@ -255,6 +274,10 @@
|
||||
<h3>版本控制</h3>
|
||||
<?php $version_form->printHTML(); ?>
|
||||
</div>
|
||||
<div class="col-sm-12 top-buffer-sm">
|
||||
<h3>赛制</h3>
|
||||
<?php $contest_type_form->printHTML(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
@ -87,7 +87,7 @@
|
||||
global $problem, $contest, $myUser, $is_in_contest;
|
||||
|
||||
$content['config'][] = array('problem_id', $problem['id']);
|
||||
if ($is_in_contest && !isset($contest['extra_config']["problem_{$problem['id']}"])) {
|
||||
if ($is_in_contest && $contest['extra_config']["contest_type"]!='IOI' && !isset($contest['extra_config']["problem_{$problem['id']}"])) {
|
||||
$content['final_test_config'] = $content['config'];
|
||||
$content['config'][] = array('test_sample_only', 'on');
|
||||
}
|
||||
|
@ -116,9 +116,12 @@
|
||||
|
||||
if ($should_show_all_details) {
|
||||
$styler = new SubmissionDetailsStyler();
|
||||
if (!$should_show_details) {
|
||||
if ((!$should_show_details || ($contest['extra_config']['contest_type']=='IOI' && $contest['cur_progress'] == CONTEST_IN_PROGRESS)) && !hasContestPermission($myUser, $contest)) {
|
||||
$styler->fade_all_details = true;
|
||||
$styler->show_small_tip = false;
|
||||
if ($contest['extra_config']['contest_type']=='IOI' && $contest['cur_progress'] == CONTEST_IN_PROGRESS) {
|
||||
$styler->ioi_contest_is_running = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -477,6 +477,9 @@ class JudgementDetailsPrinter {
|
||||
if ($this->styler->show_small_tip) {
|
||||
echo '<div class="text-right text-muted">', '小提示:点击横条可展开更详细的信息', '</div>';
|
||||
}
|
||||
elseif ($this->styler->ioi_contest_is_running) {
|
||||
echo '<div class="text-right text-muted">', 'IOI赛制比赛中不支持显示详细信息', '</div>';
|
||||
}
|
||||
$this->_print_c($node);
|
||||
echo '</div>';
|
||||
} elseif ($node->nodeName == 'subtask') {
|
||||
@ -721,6 +724,7 @@ class CustomTestSubmissionDetailsStyler {
|
||||
public $show_small_tip = false;
|
||||
public $collapse_in = true;
|
||||
public $fade_all_details = false;
|
||||
public $ioi_contest_is_running = false;
|
||||
public function getTestInfoClass($info) {
|
||||
if ($info == 'Success') {
|
||||
return 'panel-uoj-accepted';
|
||||
|
Loading…
Reference in New Issue
Block a user