mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-12-23 07:51:53 +00:00
refactor: blogs_list page with bs5
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b779362412
commit
27387a0dea
@ -8,11 +8,17 @@
|
||||
if (!isNormalUser($myUser)) {
|
||||
become403Page();
|
||||
}
|
||||
|
||||
|
||||
if (!isset($_COOKIE['bootstrap4'])) {
|
||||
$REQUIRE_LIB['bootstrap5'] = '';
|
||||
}
|
||||
|
||||
function echoBlogCell($blog) {
|
||||
global $REQUIRE_LIB;
|
||||
|
||||
echo '<tr>';
|
||||
if ($blog['is_hidden']) {
|
||||
echo '<td><span class="text-danger">[已隐藏]</span>' . getBlogLink($blog['id']) . '</td>';
|
||||
echo '<td><span class="text-danger">[已隐藏]</span> ' . getBlogLink($blog['id']) . '</td>';
|
||||
} else {
|
||||
echo '<td>' . getBlogLink($blog['id']) . '</td>';
|
||||
}
|
||||
@ -29,8 +35,21 @@
|
||||
EOD;
|
||||
$config = array();
|
||||
$config['table_classes'] = array('table', 'table-hover');
|
||||
|
||||
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||
$config['div_classes'] = array('card', 'my-3');
|
||||
$config['table_classes'] = array('table', 'uoj-table', 'mb-0');
|
||||
}
|
||||
?>
|
||||
<?php echoUOJPageHeader(UOJLocale::get('blogs')) ?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-9">
|
||||
<div class="d-flex flex-wrap justify-content-between">
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<?php if (Auth::check()): ?>
|
||||
<div class="float-right">
|
||||
<div class="btn-group">
|
||||
@ -39,6 +58,41 @@ EOD;
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
<h1 class="h2">
|
||||
<?= UOJLocale::get("blogs overview") ?>
|
||||
</h1>
|
||||
<div class="text-end">
|
||||
<div class="btn-group">
|
||||
<a href="<?= HTML::blog_url(Auth::id(), '/') ?>" class="btn btn-secondary btn-sm">
|
||||
我的博客首页
|
||||
</a>
|
||||
<a href="<?= HTML::blog_url(Auth::id(), '/post/new/write')?>" class="btn btn-primary btn-sm">
|
||||
<i class="bi bi-pencil"></i>
|
||||
写新博客
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<h3>博客总览</h3>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php echoLongTable(array('id', 'poster', 'title', 'post_time', 'zan', 'is_hidden'), 'blogs', isSuperUser($myUser) ? "1" : "is_hidden = 0 or poster = '{$myUser['username']}'", 'order by post_time desc', $header, 'echoBlogCell', $config); ?>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
||||
</div>
|
||||
|
||||
<aside class="col mt-3 mt-md-0">
|
||||
<?php uojIncludeView('sidebar', array()) ?>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php echoUOJPageFooter() ?>
|
||||
|
@ -145,9 +145,18 @@ function getContestProblemLink($problem, $contest_id, $problem_title = '!title_o
|
||||
return $result;
|
||||
}
|
||||
function getBlogLink($id) {
|
||||
global $REQUIRE_LIB;
|
||||
|
||||
$result = '';
|
||||
if (validateUInt($id) && $blog = queryBlog($id)) {
|
||||
return '<a href="/blogs/'.$id.'">'.$blog['title'].'</a>';
|
||||
$result = '<a ';
|
||||
if (isset($REQUIRE_LIB['bootstrap5'])) {
|
||||
$result .= ' class="text-decoration-none" ';
|
||||
}
|
||||
$result .= ' href="/blogs/'.$id.'">'.$blog['title'].'</a>';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
function getClickZanBlock($type, $id, $cnt, $val = null) {
|
||||
if ($val == null) {
|
||||
|
@ -18,6 +18,7 @@ return [
|
||||
'submissions' => 'Submissions',
|
||||
'hacks' => 'Hack!',
|
||||
'blogs' => 'Blogs',
|
||||
'blogs overview' => 'Blogs Overview',
|
||||
'announcements' => 'Announcements',
|
||||
'all the announcements' => 'All the Announcements……',
|
||||
'solved' => 'Solved',
|
||||
|
@ -18,6 +18,7 @@ return [
|
||||
'submissions' => '提交记录',
|
||||
'hacks' => 'Hack!',
|
||||
'blogs' => '博客',
|
||||
'blogs overview' => '博客总览',
|
||||
'announcements' => '公告',
|
||||
'all the announcements' => '所有公告……',
|
||||
'solved' => 'AC 数',
|
||||
|
Loading…
Reference in New Issue
Block a user