mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-27 14:06:19 +00:00
Compare commits
3 Commits
d63dea0c12
...
67c29e3add
Author | SHA1 | Date | |
---|---|---|---|
67c29e3add | |||
e0cffaa762 | |||
85c93c7073 |
@ -84,6 +84,30 @@
|
|||||||
updateContestPlayerNum($contest);
|
updateContestPlayerNum($contest);
|
||||||
};
|
};
|
||||||
$add_group_to_contest_form->runAtServer();
|
$add_group_to_contest_form->runAtServer();
|
||||||
|
|
||||||
|
$remove_user_from_contest_form = new UOJForm('remove_user_from_contest');
|
||||||
|
$remove_user_from_contest_form->addInput('remove_username', 'text', '用户名', '',
|
||||||
|
function ($x) {
|
||||||
|
global $contest;
|
||||||
|
if (!validateUsername($x)) {
|
||||||
|
return '用户名不合法';
|
||||||
|
}
|
||||||
|
if (!queryUser($x)) {
|
||||||
|
return '用户不存在';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
null
|
||||||
|
);
|
||||||
|
$remove_user_from_contest_form->submit_button_config['align'] = 'compressed';
|
||||||
|
$remove_user_from_contest_form->submit_button_config['text'] = '移除该用户';
|
||||||
|
$remove_user_from_contest_form->submit_button_config['class_str'] = 'mt-2 btn btn-danger';
|
||||||
|
$remove_user_from_contest_form->handle = function() {
|
||||||
|
global $contest;
|
||||||
|
DB::query("delete from contests_registrants where username = '{$_POST['remove_username']}' and contest_id = {$contest['id']}");
|
||||||
|
updateContestPlayerNum($contest);
|
||||||
|
};
|
||||||
|
$remove_user_from_contest_form->runAtServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
$has_contest_permission = hasContestPermission($myUser, $contest);
|
$has_contest_permission = hasContestPermission($myUser, $contest);
|
||||||
@ -170,6 +194,9 @@
|
|||||||
if (isset($add_group_to_contest_form)) {
|
if (isset($add_group_to_contest_form)) {
|
||||||
$add_group_to_contest_form->printHTML();
|
$add_group_to_contest_form->printHTML();
|
||||||
}
|
}
|
||||||
|
if (isset($remove_user_from_contest_form)) {
|
||||||
|
$remove_user_from_contest_form->printHTML();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
become403Page(UOJLocale::get('need login'));
|
become403Page(UOJLocale::get('need login'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isNormalUser($myUser)) {
|
if (!isNormalUser($myUser) && $_GET['type'] != 'attachment') {
|
||||||
become403Page();
|
become403Page();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($_GET['type']) {
|
switch ($_GET['type']) {
|
||||||
case 'problem':
|
case 'attachment':
|
||||||
if (!validateUInt($_GET['id']) || !($problem = queryProblemBrief($_GET['id']))) {
|
if (!validateUInt($_GET['id']) || !($problem = queryProblemBrief($_GET['id']))) {
|
||||||
become404Page();
|
become404Page();
|
||||||
}
|
}
|
||||||
@ -33,12 +33,96 @@
|
|||||||
$id = $_GET['id'];
|
$id = $_GET['id'];
|
||||||
|
|
||||||
$file_name = "/var/uoj_data/$id/download.zip";
|
$file_name = "/var/uoj_data/$id/download.zip";
|
||||||
$download_name = "problem_$id.zip";
|
$download_name = "problem_{$id}_attachment.zip";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'problem':
|
||||||
|
if (!validateUInt($_GET['id']) || !($problem = queryProblemBrief($_GET['id']))) {
|
||||||
|
become404Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isProblemVisibleToUser($problem, $myUser)) {
|
||||||
|
become404Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $_GET['id'];
|
||||||
|
$file_name = "/var/uoj_data/$id.zip";
|
||||||
|
$download_name = "problem_$id.zip";
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'testcase':
|
||||||
|
if (!validateUInt($_GET['id']) || !($problem = queryProblemBrief($_GET['id']))) {
|
||||||
|
become404Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isProblemVisibleToUser($problem, $myUser)) {
|
||||||
|
become404Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $_GET['id'];
|
||||||
|
$problem_conf = getUOJConf("/var/uoj_data/$id/problem.conf");
|
||||||
|
|
||||||
|
if ($problem_conf == -1 || $problem_conf == -2) {
|
||||||
|
become404Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!validateUInt($_GET['testcase_id'])) {
|
||||||
|
become404Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
$testcase_id = $_GET['testcase_id'];
|
||||||
|
$testcase_group = isset($_GET['testcase_group']) && $_GET['testcase_group'] == 'extra' ? 'extra' : 'normal';
|
||||||
|
|
||||||
|
if ($testcase_group == 'extra') {
|
||||||
|
$n_ex_tests = getUOJConfVal($problem_conf, 'n_ex_tests', 0);
|
||||||
|
|
||||||
|
if ($testcase_id < 1 || $testcase_id > $n_ex_tests) {
|
||||||
|
become404Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($_GET['testcase_type']) {
|
||||||
|
case 'input':
|
||||||
|
$file_name = "/var/uoj_data/$id/" . getUOJProblemExtraInputFileName($problem_conf, $testcase_id);
|
||||||
|
$download_name = getUOJProblemExtraInputFileName($problem_conf, $testcase_id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'output':
|
||||||
|
$file_name = "/var/uoj_data/$id/" . getUOJProblemExtraOutputFileName($problem_conf, $testcase_id);
|
||||||
|
$download_name = getUOJProblemExtraOutputFileName($problem_conf, $testcase_id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
become404Page();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$n_tests = getUOJConfVal($problem_conf, 'n_tests', 10);
|
||||||
|
|
||||||
|
if ($testcase_id < 1 || $testcase_id > $n_tests) {
|
||||||
|
become404Page();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($_GET['testcase_type']) {
|
||||||
|
case 'input':
|
||||||
|
$file_name = "/var/uoj_data/$id/" . getUOJProblemInputFileName($problem_conf, $testcase_id);
|
||||||
|
$download_name = getUOJProblemInputFileName($problem_conf, $testcase_id);
|
||||||
|
break;
|
||||||
|
case 'output':
|
||||||
|
$file_name = "/var/uoj_data/$id/" . getUOJProblemOutputFileName($problem_conf, $testcase_id);
|
||||||
|
$download_name = getUOJProblemOutputFileName($problem_conf, $testcase_id);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
become404Page();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case 'testlib.h':
|
case 'testlib.h':
|
||||||
$file_name = "/opt/uoj/judger/uoj_judger/include/testlib.h";
|
$file_name = "/opt/uoj/judger/uoj_judger/include/testlib.h";
|
||||||
$download_name = "testlib.h";
|
$download_name = "testlib.h";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
become404Page();
|
become404Page();
|
||||||
}
|
}
|
||||||
|
@ -198,8 +198,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p>如果你想出题、想办比赛、发现了BUG或者对网站有什么建议,可以通过下面的方式联系我们:</p>
|
<p>如果你想出题、想办比赛、发现了BUG或者对网站有什么建议,可以通过下面的方式联系我们:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>私信联系<?= UOJConfig::$data['profile']['administrator'] ?>。</li>
|
<li>邮件联系 <a href="/user/profile/baoshuo" class="uoj-username">baoshuo</a>(<a href="mailto:i@baoshuo.ren">i@baoshuo.ren</a>)或者 <a href="/user/profile/nekko" class="uoj-username">nekko</a>(<a href="mailto:1139855151@qq.com">1139855151@qq.com</a>)。</li>
|
||||||
<li>邮件联系<?= UOJConfig::$data['profile']['admin-email'] ?>。</li>
|
|
||||||
<?php if (UOJConfig::$data['profile']['QQ-group']!=''): ?>
|
<?php if (UOJConfig::$data['profile']['QQ-group']!=''): ?>
|
||||||
<li>你也可以进QQ群水水,群号是<?= UOJConfig::$data['profile']['QQ-group'] ?>。</li>
|
<li>你也可以进QQ群水水,群号是<?= UOJConfig::$data['profile']['QQ-group'] ?>。</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
@ -242,7 +242,10 @@ EOD
|
|||||||
<h1 class="col-md-7 text-center"><?= $problem_letter ?>. <?= $problem['title'] ?></h1>
|
<h1 class="col-md-7 text-center"><?= $problem_letter ?>. <?= $problem['title'] ?></h1>
|
||||||
<div class="col-md-2 text-right" id="contest-countdown"></div>
|
<div class="col-md-2 text-right" id="contest-countdown"></div>
|
||||||
</div>
|
</div>
|
||||||
<a role="button" class="btn btn-info float-right" href="/contest/<?= $contest['id'] ?>/problem/<?= $problem['id'] ?>/statistics"><span class="glyphicon glyphicon-stats"></span> <?= UOJLocale::get('problems::statistics') ?></a>
|
<div class="btn-group float-right" role="group">
|
||||||
|
<a role="button" class="btn btn-primary" href="<?= HTML::url("/download.php?type=attachment&id={$problem['id']}") ?>"><span class="glyphicon glyphicon-download-alt"></span> 附件下载</a>
|
||||||
|
<a role="button" class="btn btn-info" href="/contest/<?= $contest['id'] ?>/problem/<?= $problem['id'] ?>/statistics"><span class="glyphicon glyphicon-stats"></span> <?= UOJLocale::get('problems::statistics') ?></a>
|
||||||
|
</div>
|
||||||
<?php if ($contest['cur_progress'] <= CONTEST_IN_PROGRESS): ?>
|
<?php if ($contest['cur_progress'] <= CONTEST_IN_PROGRESS): ?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
checkContestNotice(<?= $contest['id'] ?>, '<?= UOJTime::$time_now_str ?>');
|
checkContestNotice(<?= $contest['id'] ?>, '<?= UOJTime::$time_now_str ?>');
|
||||||
@ -251,7 +254,11 @@ $('#contest-countdown').countdown(<?= $contest['end_time']->getTimestamp() - UOJ
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<h1 class="page-header text-center">#<?= $problem['id']?>. <?= $problem['title'] ?></h1>
|
<h1 class="page-header text-center">#<?= $problem['id']?>. <?= $problem['title'] ?></h1>
|
||||||
<a role="button" class="btn btn-info float-right" href="/problem/<?= $problem['id'] ?>/statistics"><span class="glyphicon glyphicon-stats"></span> <?= UOJLocale::get('problems::statistics') ?></a>
|
<div class="btn-group float-right" role="group">
|
||||||
|
<a role="button" class="btn btn-primary" href="<?= HTML::url("/download.php?type=problem&id={$problem['id']}") ?>"><span class="glyphicon glyphicon-tasks"></span> 测试数据</a>
|
||||||
|
<a role="button" class="btn btn-primary" href="<?= HTML::url("/download.php?type=attachment&id={$problem['id']}") ?>"><span class="glyphicon glyphicon-download-alt"></span> 附件下载</a>
|
||||||
|
<a role="button" class="btn btn-info" href="/problem/<?= $problem['id'] ?>/statistics"><span class="glyphicon glyphicon-stats"></span> <?= UOJLocale::get('problems::statistics') ?></a>
|
||||||
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
|
@ -125,7 +125,6 @@
|
|||||||
|
|
||||||
$info_form = new UOJForm('info');
|
$info_form = new UOJForm('info');
|
||||||
$http_host = HTML::escape(UOJContext::httpHost());
|
$http_host = HTML::escape(UOJContext::httpHost());
|
||||||
$download_url = HTML::url("/download.php?type=problem&id={$problem['id']}");
|
|
||||||
$info_form->appendHTML(<<<EOD
|
$info_form->appendHTML(<<<EOD
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<!--<label class="col-sm-3 control-label">zip上传数据</label>
|
<!--<label class="col-sm-3 control-label">zip上传数据</label>
|
||||||
@ -140,6 +139,19 @@
|
|||||||
</div>
|
</div>
|
||||||
EOD
|
EOD
|
||||||
);
|
);
|
||||||
|
$attachment_url = HTML::url("/download.php?type=attachment&id={$problem['id']}");
|
||||||
|
$info_form->appendHTML(<<<EOD
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-sm-3 control-label">problem_{$problem['id']}_attachment.zip</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<div class="form-control-static">
|
||||||
|
<a href="$attachment_url">$attachment_url</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
EOD
|
||||||
|
);
|
||||||
|
$download_url = HTML::url("/download.php?type=problem&id={$problem['id']}");
|
||||||
$info_form->appendHTML(<<<EOD
|
$info_form->appendHTML(<<<EOD
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-3 control-label">problem_{$problem['id']}.zip</label>
|
<label class="col-sm-3 control-label">problem_{$problem['id']}.zip</label>
|
||||||
|
@ -136,6 +136,9 @@
|
|||||||
<?php
|
<?php
|
||||||
$REQUIRE_LIB['shjs'] = "";
|
$REQUIRE_LIB['shjs'] = "";
|
||||||
?>
|
?>
|
||||||
|
<script>
|
||||||
|
var problem_id = parseInt('<?= $submission['problem_id'] ?>');
|
||||||
|
</script>
|
||||||
<?php echoUOJPageHeader(UOJLocale::get('problems::submission').' #'.$submission['id']) ?>
|
<?php echoUOJPageHeader(UOJLocale::get('problems::submission').' #'.$submission['id']) ?>
|
||||||
<?php echoSubmissionsListOnlyOne($submission, array(), $myUser) ?>
|
<?php echoSubmissionsListOnlyOne($submission, array(), $myUser) ?>
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@ class JudgementDetailsPrinter {
|
|||||||
if ($this->styler->collapse_in) {
|
if ($this->styler->collapse_in) {
|
||||||
$accordion_collapse_class .= ' in';
|
$accordion_collapse_class .= ' in';
|
||||||
}
|
}
|
||||||
echo '<div id="', $accordion_collapse, '" class="', $accordion_collapse_class, '">';
|
echo '<div id="', $accordion_collapse, '" class="uoj-testcase ', $accordion_collapse_class, '" data-test=' . $test_num . '>';
|
||||||
echo '<div class="card-body">';
|
echo '<div class="card-body">';
|
||||||
|
|
||||||
$this->_print_c($node);
|
$this->_print_c($node);
|
||||||
@ -680,11 +680,11 @@ class JudgementDetailsPrinter {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
} elseif ($node->nodeName == 'in') {
|
} elseif ($node->nodeName == 'in') {
|
||||||
echo "<h4>input:</h4><pre>\n";
|
echo "<h4>input: <a class=\"uoj-testcase-download-input\"></a></h4><pre>\n";
|
||||||
$this->_print_c($node);
|
$this->_print_c($node);
|
||||||
echo "\n</pre>";
|
echo "\n</pre>";
|
||||||
} elseif ($node->nodeName == 'out') {
|
} elseif ($node->nodeName == 'out') {
|
||||||
echo "<h4>output:</h4><pre>\n";
|
echo "<h4>output: <a class=\"uoj-testcase-download-output\"></a></h4><pre>\n";
|
||||||
$this->_print_c($node);
|
$this->_print_c($node);
|
||||||
echo "\n</pre>";
|
echo "\n</pre>";
|
||||||
} elseif ($node->nodeName == 'res') {
|
} elseif ($node->nodeName == 'res') {
|
||||||
|
@ -354,6 +354,23 @@ $.fn.countdown = function(rest, callback) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$.fn.uoj_testcase = function() {
|
||||||
|
return this.each(function() {
|
||||||
|
var id = parseInt($(this).data('test'));
|
||||||
|
|
||||||
|
if (id > 0 && problem_id) {
|
||||||
|
$('.uoj-testcase-download-input', this)
|
||||||
|
.html('<span class="glyphicon glyphicon-download-alt"></span> 下载')
|
||||||
|
.attr('href', '/download.php?type=testcase&id=' + problem_id + '&testcase_id=' + id + '&testcase_type=input')
|
||||||
|
.addClass('btn btn-secondary btn-sm float-right');
|
||||||
|
$('.uoj-testcase-download-output', this)
|
||||||
|
.html('<span class="glyphicon glyphicon-download-alt"></span> 下载')
|
||||||
|
.attr('href', '/download.php?type=testcase&id=' + problem_id + '&testcase_id=' + id + '&testcase_type=output')
|
||||||
|
.addClass('btn btn-secondary btn-sm float-right');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// update_judgement_status
|
// update_judgement_status
|
||||||
update_judgement_status_list = []
|
update_judgement_status_list = []
|
||||||
function update_judgement_status_details(id) {
|
function update_judgement_status_details(id) {
|
||||||
@ -388,6 +405,7 @@ $.fn.uoj_highlight = function() {
|
|||||||
return $(this).each(function() {
|
return $(this).each(function() {
|
||||||
$(this).find("span.uoj-username").each(replaceWithHighlightUsername);
|
$(this).find("span.uoj-username").each(replaceWithHighlightUsername);
|
||||||
$(this).find(".uoj-honor").uoj_honor();
|
$(this).find(".uoj-honor").uoj_honor();
|
||||||
|
$(this).find(".uoj-testcase").uoj_testcase();
|
||||||
$(this).find(".uoj-score").each(function() {
|
$(this).find(".uoj-score").each(function() {
|
||||||
var score = parseInt($(this).text());
|
var score = parseInt($(this).text());
|
||||||
var maxscore = parseInt($(this).data('max'));
|
var maxscore = parseInt($(this).data('max'));
|
||||||
|
Loading…
Reference in New Issue
Block a user