mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 12:58:40 +00:00
refactor: submissions_list with bs5
This commit is contained in:
parent
02f181cc5b
commit
bd79eebb44
@ -37,6 +37,8 @@
|
|||||||
} else {
|
} else {
|
||||||
$cond = '1';
|
$cond = '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$REQUIRE_LIB['bootstrap5'] = '';
|
||||||
?>
|
?>
|
||||||
<?php echoUOJPageHeader(UOJLocale::get('submissions')) ?>
|
<?php echoUOJPageHeader(UOJLocale::get('submissions')) ?>
|
||||||
<div class="d-none d-sm-block">
|
<div class="d-none d-sm-block">
|
||||||
@ -46,21 +48,37 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<form id="form-search" class="form-inline" method="get">
|
<form id="form-search" class="form-inline" method="get">
|
||||||
<div id="form-group-problem_id" class="form-group">
|
<div id="form-group-problem_id" class="form-group
|
||||||
|
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||||
|
d-inline-block
|
||||||
|
<?php endif ?>
|
||||||
|
">
|
||||||
<label for="input-problem_id" class="control-label"><?= UOJLocale::get('problems::problem id')?>:</label>
|
<label for="input-problem_id" class="control-label"><?= UOJLocale::get('problems::problem id')?>:</label>
|
||||||
<input type="text" class="form-control input-sm" name="problem_id" id="input-problem_id" value="<?= $q_problem_id ?>" maxlength="4" style="width:4em" />
|
<input type="text" class="form-control input-sm" name="problem_id" id="input-problem_id" value="<?= $q_problem_id ?>" maxlength="4" style="width:4em" />
|
||||||
</div>
|
</div>
|
||||||
<div id="form-group-submitter" class="form-group">
|
<div id="form-group-submitter" class="form-group
|
||||||
|
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||||
|
d-inline-block
|
||||||
|
<?php endif ?>
|
||||||
|
">
|
||||||
<label for="input-submitter" class="control-label"><?= UOJLocale::get('username')?>:</label>
|
<label for="input-submitter" class="control-label"><?= UOJLocale::get('username')?>:</label>
|
||||||
<input type="text" class="form-control input-sm" name="submitter" id="input-submitter" value="<?= $q_submitter ?>" maxlength="20" style="width:10em" />
|
<input type="text" class="form-control input-sm" name="submitter" id="input-submitter" value="<?= $q_submitter ?>" maxlength="20" style="width:10em" />
|
||||||
</div>
|
</div>
|
||||||
<div id="form-group-score" class="form-group">
|
<div id="form-group-score" class="form-group
|
||||||
|
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||||
|
d-inline-block
|
||||||
|
<?php endif ?>
|
||||||
|
">
|
||||||
<label for="input-min_score" class="control-label"><?= UOJLocale::get('score range')?>:</label>
|
<label for="input-min_score" class="control-label"><?= UOJLocale::get('score range')?>:</label>
|
||||||
<input type="text" class="form-control input-sm" name="min_score" id="input-min_score" value="<?= $q_min_score ?>" maxlength="3" style="width:4em" placeholder="0" />
|
<input type="text" class="form-control input-sm" name="min_score" id="input-min_score" value="<?= $q_min_score ?>" maxlength="3" style="width:4em" placeholder="0" />
|
||||||
<label for="input-max_score" class="control-label">~</label>
|
<label for="input-max_score" class="control-label">~</label>
|
||||||
<input type="text" class="form-control input-sm" name="max_score" id="input-max_score" value="<?= $q_max_score ?>" maxlength="3" style="width:4em" placeholder="100" />
|
<input type="text" class="form-control input-sm" name="max_score" id="input-max_score" value="<?= $q_max_score ?>" maxlength="3" style="width:4em" placeholder="100" />
|
||||||
</div>
|
</div>
|
||||||
<div id="form-group-language" class="form-group">
|
<div id="form-group-language" class="form-group
|
||||||
|
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||||
|
d-inline-block
|
||||||
|
<?php endif ?>
|
||||||
|
">
|
||||||
<label for="input-language" class="control-label"><?= UOJLocale::get('problems::language')?>:</label>
|
<label for="input-language" class="control-label"><?= UOJLocale::get('problems::language')?>:</label>
|
||||||
<input type="text" class="form-control input-sm" name="language" id="input-language" value="<?= $html_esc_q_language ?>" maxlength="10" style="width:8em" />
|
<input type="text" class="form-control input-sm" name="language" id="input-language" value="<?= $html_esc_q_language ?>" maxlength="10" style="width:8em" />
|
||||||
</div>
|
</div>
|
||||||
@ -85,7 +103,21 @@
|
|||||||
</script>
|
</script>
|
||||||
<div class="top-buffer-sm"></div>
|
<div class="top-buffer-sm"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echoSubmissionsList($cond, 'order by id desc', array('judge_time_hidden' => ''), $myUser);
|
echoSubmissionsList($cond,
|
||||||
|
'order by id desc',
|
||||||
|
array(
|
||||||
|
'judge_time_hidden' => '',
|
||||||
|
'table_config' => (isset($REQUIRE_LIB['bootstrap5'])
|
||||||
|
? array(
|
||||||
|
'div_classes' => array('card', 'mb-3'),
|
||||||
|
'table_classes' => array('table', 'mb-0', 'uoj-submissions-table', 'text-center')
|
||||||
|
)
|
||||||
|
: array()
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$myUser);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php echoUOJPageFooter() ?>
|
<?php echoUOJPageFooter() ?>
|
||||||
|
@ -111,20 +111,36 @@ function getUserName($username, $realname = null) {
|
|||||||
|
|
||||||
|
|
||||||
function getProblemLink($problem, $problem_title = '!title_only') {
|
function getProblemLink($problem, $problem_title = '!title_only') {
|
||||||
|
global $REQUIRE_LIB;
|
||||||
|
|
||||||
if ($problem_title == '!title_only') {
|
if ($problem_title == '!title_only') {
|
||||||
$problem_title = $problem['title'];
|
$problem_title = $problem['title'];
|
||||||
} elseif ($problem_title == '!id_and_title') {
|
} elseif ($problem_title == '!id_and_title') {
|
||||||
$problem_title = "#${problem['id']}. ${problem['title']}";
|
$problem_title = "#${problem['id']}. ${problem['title']}";
|
||||||
}
|
}
|
||||||
return '<a href="/problem/'.$problem['id'].'">'.$problem_title.'</a>';
|
$result = '<a ';
|
||||||
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
$result .= ' class="text-decoration-none" ';
|
||||||
|
}
|
||||||
|
$result .= ' href="/problem/'.$problem['id'].'">'.$problem_title.'</a>';
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
function getContestProblemLink($problem, $contest_id, $problem_title = '!title_only') {
|
function getContestProblemLink($problem, $contest_id, $problem_title = '!title_only') {
|
||||||
|
global $REQUIRE_LIB;
|
||||||
|
|
||||||
if ($problem_title == '!title_only') {
|
if ($problem_title == '!title_only') {
|
||||||
$problem_title = $problem['title'];
|
$problem_title = $problem['title'];
|
||||||
} elseif ($problem_title == '!id_and_title') {
|
} elseif ($problem_title == '!id_and_title') {
|
||||||
$problem_title = "#{$problem['id']}. {$problem['title']}";
|
$problem_title = "#{$problem['id']}. {$problem['title']}";
|
||||||
}
|
}
|
||||||
return '<a href="/contest/'.$contest_id.'/problem/'.$problem['id'].'">'.$problem_title.'</a>';
|
$result = '<a ';
|
||||||
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
$result .= ' class="text-decoration-none" ';
|
||||||
|
}
|
||||||
|
$result .= ' href="/contest/'.$contest_id.'/problem/'.$problem['id'].'">'.$problem_title.'</a>';
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
function getBlogLink($id) {
|
function getBlogLink($id) {
|
||||||
if (validateUInt($id) && $blog = queryBlog($id)) {
|
if (validateUInt($id) && $blog = queryBlog($id)) {
|
||||||
@ -238,6 +254,8 @@ function getSubmissionStatusDetails($submission) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function echoSubmission($submission, $config, $user) {
|
function echoSubmission($submission, $config, $user) {
|
||||||
|
global $REQUIRE_LIB;
|
||||||
|
|
||||||
$problem = queryProblemBrief($submission['problem_id']);
|
$problem = queryProblemBrief($submission['problem_id']);
|
||||||
$submitterLink = getUserLink($submission['submitter']);
|
$submitterLink = getUserLink($submission['submitter']);
|
||||||
|
|
||||||
@ -259,7 +277,11 @@ function echoSubmission($submission, $config, $user) {
|
|||||||
echo '<tr class="warning">';
|
echo '<tr class="warning">';
|
||||||
}
|
}
|
||||||
if (!isset($config['id_hidden'])) {
|
if (!isset($config['id_hidden'])) {
|
||||||
echo '<td><a href="/submission/', $submission['id'], '">#', $submission['id'], '</a></td>';
|
echo '<td><a ';
|
||||||
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
echo ' class="text-decoration-none" ';
|
||||||
|
}
|
||||||
|
echo ' href="/submission/', $submission['id'], '">#', $submission['id'], '</a></td>';
|
||||||
}
|
}
|
||||||
if (!isset($config['problem_hidden'])) {
|
if (!isset($config['problem_hidden'])) {
|
||||||
if ($submission['contest_id']) {
|
if ($submission['contest_id']) {
|
||||||
@ -291,7 +313,11 @@ function echoSubmission($submission, $config, $user) {
|
|||||||
echo '<td>', $used_memory_str, '</td>';
|
echo '<td>', $used_memory_str, '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<td>', '<a href="/submission/', $submission['id'], '">', $submission['language'], '</a>', '</td>';
|
echo '<td>', '<a ';
|
||||||
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
echo ' class="text-decoration-none" ';
|
||||||
|
}
|
||||||
|
echo ' href="/submission/', $submission['id'], '">', $submission['language'], '</a>', '</td>';
|
||||||
|
|
||||||
if ($submission['tot_size'] < 1024) {
|
if ($submission['tot_size'] < 1024) {
|
||||||
$size_str = $submission['tot_size'] . 'b';
|
$size_str = $submission['tot_size'] . 'b';
|
||||||
@ -358,6 +384,8 @@ function echoSubmissionsListOnlyOne($submission, $config, $user) {
|
|||||||
|
|
||||||
|
|
||||||
function echoSubmissionsList($cond, $tail, $config, $user) {
|
function echoSubmissionsList($cond, $tail, $config, $user) {
|
||||||
|
global $REQUIRE_LIB;
|
||||||
|
|
||||||
$header_row = '<tr>';
|
$header_row = '<tr>';
|
||||||
$col_names = array();
|
$col_names = array();
|
||||||
$col_names[] = 'submissions.status_details';
|
$col_names[] = 'submissions.status_details';
|
||||||
|
@ -76,16 +76,44 @@ class Paginator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function pagination() {
|
public function pagination() {
|
||||||
|
global $REQUIRE_LIB;
|
||||||
|
|
||||||
if ($this->n_pages == 1) {
|
if ($this->n_pages == 1) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$html = '<ul class="pagination top-buffer-no bot-buffer-sm justify-content-center">';
|
$html = '<ul class="pagination top-buffer-no bot-buffer-sm justify-content-center">';
|
||||||
if ($this->cur_page > 1) {
|
if ($this->cur_page > 1) {
|
||||||
$html .= '<li class="page-item"><a class="page-link" href="'.$this->getPageUri(1).'"><span class="glyphicon glyphicon glyphicon-fast-backward"></span></a></li>';
|
$html .= '<li class="page-item">'
|
||||||
$html .= '<li class="page-item"><a class="page-link" href="'.$this->getPageUri($this->cur_page - 1).'"><span class="glyphicon glyphicon glyphicon-backward"></span></a></li>';
|
. '<a class="page-link" href="'.$this->getPageUri(1).'">';
|
||||||
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
$html .= '<i class="bi bi-chevron-double-left"></i>';
|
||||||
|
} else {
|
||||||
|
$html .= '<span class="glyphicon glyphicon glyphicon-fast-backward"></span>';
|
||||||
|
}
|
||||||
|
$html .= '</a></li>';
|
||||||
|
$html .= '<li class="page-item">'
|
||||||
|
. '<a class="page-link" href="'.$this->getPageUri($this->cur_page - 1).'">';
|
||||||
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
$html .= '<i class="bi bi-chevron-left"></i>';
|
||||||
|
} else {
|
||||||
|
$html .= '<span class="glyphicon glyphicon glyphicon-backward"></span>';
|
||||||
|
}
|
||||||
|
$html .= '</a></li>';
|
||||||
} else {
|
} else {
|
||||||
$html .= '<li class="page-item disabled"><a class="page-link"><span class="glyphicon glyphicon glyphicon-fast-backward"></span></a></li>';
|
$html .= '<li class="page-item disabled"><a class="page-link">';
|
||||||
$html .= '<li class="page-item disabled"><a class="page-link"><span class="glyphicon glyphicon glyphicon-backward"></span></a></li>';
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
$html .= '<i class="bi bi-chevron-double-left"></i>';
|
||||||
|
} else {
|
||||||
|
$html .= '<span class="glyphicon glyphicon glyphicon-fast-backward"></span>';
|
||||||
|
}
|
||||||
|
$html .= '</a></li>';
|
||||||
|
$html .= '<li class="page-item disabled"><a class="page-link">';
|
||||||
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
$html .= '<i class="bi bi-chevron-left"></i>';
|
||||||
|
} else {
|
||||||
|
$html .= '<span class="glyphicon glyphicon glyphicon-backward"></span>';
|
||||||
|
}
|
||||||
|
$html .= '</a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = max($this->cur_page - $this->max_extend, 1); $i <= min($this->cur_page + $this->max_extend, $this->n_pages); $i++) {
|
for ($i = max($this->cur_page - $this->max_extend, 1); $i <= min($this->cur_page + $this->max_extend, $this->n_pages); $i++) {
|
||||||
@ -96,11 +124,38 @@ class Paginator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->cur_page < $this->n_pages) {
|
if ($this->cur_page < $this->n_pages) {
|
||||||
$html .= '<li class="page-item"><a class="page-link" href="'.$this->getPageUri($this->cur_page + 1).'"><span class="glyphicon glyphicon glyphicon-forward"></span></a></li>';
|
$html .= '<li class="page-item">'
|
||||||
$html .= '<li class="page-item"><a class="page-link" href="'.$this->getPageUri($this->n_pages).'"><span class="glyphicon glyphicon glyphicon-fast-forward"></span></a></li>';
|
. '<a class="page-link" href="'.$this->getPageUri($this->cur_page + 1).'">';
|
||||||
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
$html .= '<i class="bi bi-chevron-right"></i>';
|
||||||
|
} else {
|
||||||
|
$html .= '<span class="glyphicon glyphicon glyphicon-forward"></span>';
|
||||||
|
}
|
||||||
|
$html .= '</a></li>';
|
||||||
|
|
||||||
|
$html .= '<li class="page-item">'
|
||||||
|
. '<a class="page-link" href="'.$this->getPageUri($this->n_pages).'">';
|
||||||
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
$html .= '<i class="bi bi-chevron-double-right"></i>';
|
||||||
|
} else {
|
||||||
|
$html .= '<span class="glyphicon glyphicon glyphicon-fast-forward"></span>';
|
||||||
|
}
|
||||||
|
$html .= '</a></li>';
|
||||||
} else {
|
} else {
|
||||||
$html .= '<li class="page-item disabled"><a class="page-link"><span class="glyphicon glyphicon glyphicon-forward"></span></a></li>';
|
$html .= '<li class="page-item disabled"><a class="page-link">';
|
||||||
$html .= '<li class="page-item disabled"><a class="page-link"><span class="glyphicon glyphicon glyphicon-fast-forward"></span></a></li>';
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
$html .= '<i class="bi bi-chevron-right"></i>';
|
||||||
|
} else {
|
||||||
|
$html .= '<span class="glyphicon glyphicon glyphicon-forward"></span>';
|
||||||
|
}
|
||||||
|
$html .= '</a></li>';
|
||||||
|
$html .= '<li class="page-item disabled"><a class="page-link">';
|
||||||
|
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||||
|
$html .= '<i class="bi bi-chevron-double-right"></i>';
|
||||||
|
} else {
|
||||||
|
$html .= '<span class="glyphicon glyphicon glyphicon-fast-forward"></span>';
|
||||||
|
}
|
||||||
|
$html .= '</a></li>';
|
||||||
}
|
}
|
||||||
$html .= '</ul>';
|
$html .= '</ul>';
|
||||||
return $html;
|
return $html;
|
||||||
|
@ -1,11 +1,48 @@
|
|||||||
|
/* S2OJ Bootstrap 5 Theme */
|
||||||
|
|
||||||
body {
|
body {
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uoj-username {
|
.uoj-username,
|
||||||
|
.uoj-score {
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
||||||
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji',
|
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji',
|
||||||
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-inline .form-control {
|
||||||
|
display: inline-block;
|
||||||
|
width: auto;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-row {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-right: -5px;
|
||||||
|
margin-left: -5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-row > .col {
|
||||||
|
padding-left: 5px;
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.float-right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uoj-submissions-table > tbody > tr:last-child {
|
||||||
|
border-bottom-color: transparent;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user