refactor(web/blog/self_reviews): bootstrap5
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-10-08 14:05:30 +08:00
parent 94ac59929e
commit edb8176f8f
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 21 additions and 15 deletions

View File

@ -9,26 +9,28 @@
requirePHPLib('form');
$username = UOJContext::user()['username'];
$username = UOJContext::userid();
$REQUIRE_LIB['bootstrap5'] = '';
$REQUIRE_LIB['mathjax'] = '';
?>
<?php echoUOJPageHeader(UOJLocale::get('contests::contest self reviews')) ?>
<h2 style="margin-top: 24px">
<h1 class="h2">
<?= $username ?> 的所有赛后总结
</h2>
</h1>
<?php
$col_names = array('contest_id');
$col_names = array('contest_id');
$from = 'contests_registrants a left join contests b on a.contest_id = b.id';
$cond = "username = '$username' and has_participated = 1";
$tail = 'order by start_time desc, id desc';
$config = array(
'pagination_table' => 'contests_registrants',
'page_len' => 10,
'table_classes' => array('table', 'table-bordered', 'table-text-center', 'table-vertical-middle'),
'div_classes' => ['card', 'card-default', 'table-responsive'],
'table_classes' => ['table', 'table-bordered', 'text-center', 'align-middle', 'uoj-table', 'mb-0'],
);
$header_row = '';
@ -48,7 +50,7 @@
$n_contest_problems = count($contest_problems);
$result = '';
$dom_sanitize_config = DOM_SANITIZE_CONFIG;
$purifier = HTML::pruifier();
for ($i = 0; $i < $n_contest_problems; $i++) {
$problem_id = $contest_problems[$i]['problem_id'];
@ -63,20 +65,14 @@
$problem_review_id = "review-$contest_id-$i";
$result .= '<td>' . chr(ord('A') + $i) . '. <a href="/problem/' . $problem_id . '">' . $problem['title'] . '</a></td>';
$result .= '<td><div id="' . $problem_review_id . '"></div></td>';
$result .= '<td>' . $purifier->purify($problem_self_review != null ? $problem_self_review['content'] : '') . '</td>';
$esc_problem_self_review = rawurlencode($problem_self_review != null ? $problem_self_review['content'] : '');
$result .= '<script type="text/javascript">'
. "(function() { $('#$problem_review_id').html(DOMPurify.sanitize(decodeURIComponent(\"{$esc_problem_self_review}\"), $dom_sanitize_config)); })();"
. '</script>';
if ($i == 0) {
$contest_review_id = "review-$contest_id-overall";
$contest_self_review = DB::selectFirst("select content from contests_reviews where contest_id = $contest_id and problem_id = -1 and poster = '$username'");
$esc_contest_self_review = rawurlencode($contest_self_review != null ? $contest_self_review['content'] : '');
$result .= '<td rowspan="' . $n_contest_problems . '"><div id="' . $contest_review_id . '"></div></td>';
$result .= '<script type="text/javascript">'
. "(function() { $('#$contest_review_id').html(DOMPurify.sanitize(decodeURIComponent(\"{$esc_contest_self_review}\"), $dom_sanitize_config)); })();"
. '</script>';
$result .= '<td rowspan="' . $n_contest_problems . '">' . $purifier->purify($problem_self_review != null ? $problem_self_review['content'] : '') . '</td>';
}
$result .= '</tr>';
@ -87,5 +83,5 @@
echoLongTable($col_names, $from, $cond, $tail, $header_row, $print_row, $config);
?>
<script>if (window.MathJax) MathJax.typeset();</script>
<?php echoUOJPageFooter() ?>

View File

@ -51,6 +51,16 @@ label {
border-bottom-color: transparent;
}
.uoj-table > thead > tr:first-child {
border-top-color: transparent;
}
.uoj-table > thead > tr,
.uoj-table > tbody > tr {
border-left-color: transparent;
border-right-color: transparent;
}
.uoj-click-zan-block {
display: inline-block;
min-width: 100px;