Compare commits

...

3 Commits

Author SHA1 Message Date
4e1d156f0e
feat: group announcement
All checks were successful
continuous-integration/drone/push Build is passing
2022-09-23 21:36:14 +08:00
32caffc3ec
refactor: index with bs5 2022-09-23 21:00:17 +08:00
7d9b043cb9
feat: init bootstrap5 2022-09-23 20:59:22 +08:00
14 changed files with 469 additions and 94 deletions

View File

@ -442,6 +442,7 @@ UNLOCK TABLES;
CREATE TABLE `groups` ( CREATE TABLE `groups` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`title` text NOT NULL, `title` text NOT NULL,
`announcement` text NOT NULL DEFAULT '',
`is_hidden` tinyint(1) NOT NULL DEFAULT 0, `is_hidden` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;

View File

@ -176,6 +176,24 @@
DB::query("delete from assignments where list_id='{$list_id}' and group_id={$group_id}"); DB::query("delete from assignments where list_id='{$list_id}' and group_id={$group_id}");
}; };
$remove_assignment_form->runAtServer(); $remove_assignment_form->runAtServer();
$announcement_form = new UOJForm('announcement_form');
$announcement_form->addVTextArea('announcement_content', '公告', $group['announcement'],
function ($x) {
return '';
},
null
);
$announcement_form->submit_button_config['align'] = 'compressed';
$announcement_form->submit_button_config['text'] = '更新公告';
$announcement_form->handle = function() {
global $group_id, $myUser;
$content = $_POST['announcement_content'];
$esc_content = DB::escape($content);
DB::query("update groups set announcement = '{$esc_content}' where id = {$group_id}");
};
$announcement_form->runAtServer();
} }
?> ?>
@ -258,6 +276,11 @@
<?php $group_editor->printHTML(); ?> <?php $group_editor->printHTML(); ?>
</div> </div>
<h5>编辑小组公告</h5>
<div>
<?php $announcement_form->printHTML(); ?>
</div>
<h5>添加用户到小组</h5> <h5>添加用户到小组</h5>
<?php $add_new_user_form->printHTML(); ?> <?php $add_new_user_form->printHTML(); ?>

View File

@ -2,16 +2,27 @@
$blogs = DB::selectAll("select blogs.id, title, poster, post_time from important_blogs, blogs where is_hidden = 0 and important_blogs.blog_id = blogs.id order by level desc, important_blogs.blog_id desc limit 5"); $blogs = DB::selectAll("select blogs.id, title, poster, post_time from important_blogs, blogs where is_hidden = 0 and important_blogs.blog_id = blogs.id order by level desc, important_blogs.blog_id desc limit 5");
$countdowns = DB::selectAll("select * from countdowns order by endtime asc"); $countdowns = DB::selectAll("select * from countdowns order by endtime asc");
$friend_links = DB::selectAll("select * from friend_links order by level desc, id asc"); $friend_links = DB::selectAll("select * from friend_links order by level desc, id asc");
$REQUIRE_LIB['bootstrap5'] = '';
?> ?>
<?php echoUOJPageHeader(UOJConfig::$data['profile']['oj-name-short']) ?> <?php echoUOJPageHeader(UOJConfig::$data['profile']['oj-name-short']) ?>
<div class="row"> <div class="row">
<div class="col-sm-12 col-md-9"> <div class="col-sm-12 col-md-9">
<div class="card card-default"> <div class="card card-default">
<div class="card-body"> <div class="card-body">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<h4 class="card-title">
<?= UOJLocale::get('announcements') ?>
</h4>
<?php endif ?>
<table class="table table-sm"> <table class="table table-sm">
<thead> <thead>
<tr> <tr>
<th style="width:60%"><?= UOJLocale::get('announcements') ?></th> <th style="width:60%">
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<?= UOJLocale::get('announcements') ?>
<?php endif ?>
</th>
<th style="width:20%"></th> <th style="width:20%"></th>
<th style="width:20%"></th> <th style="width:20%"></th>
</tr> </tr>
@ -27,7 +38,14 @@
} }
?> ?>
<tr> <tr>
<td><a href="/blogs/<?= $blog['id'] ?>"><?= $blog['title'] ?></a><?= $new_tag ?></td> <td>
<a href="/blogs/<?= $blog['id'] ?>"
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
class="text-decoration-none"
<?php endif ?>
><?= $blog['title'] ?></a>
<?= $new_tag ?>
</td>
<td>by <?= getUserLink($blog['poster']) ?></td> <td>by <?= getUserLink($blog['poster']) ?></td>
<td><small><?= $blog['post_time'] ?></small></td> <td><small><?= $blog['post_time'] ?></small></td>
</tr> </tr>
@ -35,17 +53,28 @@
<?php for ($i = $now_cnt + 1; $i <= 5; $i++): ?> <?php for ($i = $now_cnt + 1; $i <= 5; $i++): ?>
<tr><td colspan="233">&nbsp;</td></tr> <tr><td colspan="233">&nbsp;</td></tr>
<?php endfor ?> <?php endfor ?>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<tr><td class="text-right" colspan="233"><a href="/announcements"><?= UOJLocale::get('all the announcements') ?></a></td></tr> <tr><td class="text-right" colspan="233"><a href="/announcements"><?= UOJLocale::get('all the announcements') ?></a></td></tr>
<?php endif ?>
</tbody> </tbody>
</table> </table>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="text-end">
<a class="text-decoration-none" href="/announcements"><?= UOJLocale::get('all the announcements') ?></a>
</div>
<?php endif ?>
</div> </div>
</div> </div>
<?php if (Auth::check() && isNormalUser($myUser)): ?> <?php if (Auth::check() && isNormalUser($myUser)): ?>
<div class="mt-4"> <div class="mt-4">
<h3><?= UOJLocale::get('top solver') ?></h3> <h4><?= UOJLocale::get('top solver') ?></h4>
<?php echoRanklist(array('echo_full' => true, 'top10' => true, 'by_accepted' => true)) ?> <?php echoRanklist(array('echo_full' => true, 'top10' => true, 'by_accepted' => true)) ?>
<div class="text-center"> <div class="text-center">
<a href="/solverlist"><?= UOJLocale::get('view all') ?></a> <a href="/solverlist"
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
class="text-decoration-none"
<?php endif ?>
><?= UOJLocale::get('view all') ?></a>
</div> </div>
</div> </div>
<?php else: ?> <?php else: ?>
@ -61,9 +90,16 @@
<img class="media-object img-thumbnail" src="/images/logo.png" alt="Logo" /> <img class="media-object img-thumbnail" src="/images/logo.png" alt="Logo" />
</div> </div>
<div class="card card-default mt-4"> <div class="card card-default mt-4">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="card-header">
<b>倒计时</b>
</div>
<?php endif ?>
<div class="card-body"> <div class="card-body">
<h3 class="card-title" style="font-size: 1.25rem">倒计时</h3> <?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<ul class="pl-4 mb-0"> <h4 class="card-title" style="font-size: 1.25rem">倒计时</h4>
<?php endif ?>
<ul class="list-unstyled mb-0">
<?php foreach ($countdowns as $countdown): ?> <?php foreach ($countdowns as $countdown): ?>
<?php <?php
$enddate = strtotime($countdown['endtime']); $enddate = strtotime($countdown['endtime']);
@ -79,18 +115,31 @@
</li> </li>
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>
<?php if (count($countdowns) == 0): ?>
<div class="text-center">(无)</div>
<?php endif ?>
</div> </div>
</div> </div>
<div class="card card-default mt-4"> <div class="card card-default mt-4">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="card-header">
<b>友情链接</b>
</div>
<?php endif ?>
<div class="card-body"> <div class="card-body">
<h3 class="card-title" style="font-size: 1.25rem">友情链接</h3> <?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<ul class="pl-4 mb-0"> <h4 class="card-title" style="font-size: 1.25rem">友情链接</h4>
<?php endif ?>
<ul class="list-unstyled mb-0">
<?php foreach ($friend_links as $friend_link): ?> <?php foreach ($friend_links as $friend_link): ?>
<li> <li>
<a href="<?= $friend_link['url'] ?>" target="_blank"><?= $friend_link['title'] ?></a> <a href="<?= $friend_link['url'] ?>" target="_blank"><?= $friend_link['title'] ?></a>
</li> </li>
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>
<?php if (count($friend_links) == 0): ?>
<div class="text-center">(无)</div>
<?php endif ?>
</div> </div>
</div> </div>
</div> </div>

View File

@ -156,6 +156,8 @@ function getLongTablePageUri($page) {
} }
function echoLongTable($col_names, $table_name, $cond, $tail, $header_row, $print_row, $config) { function echoLongTable($col_names, $table_name, $cond, $tail, $header_row, $print_row, $config) {
global $REQUIRE_LIB;
$pag_config = $config; $pag_config = $config;
$pag_config['col_names'] = $col_names; $pag_config['col_names'] = $col_names;
$pag_config['table_name'] = $table_name; $pag_config['table_name'] = $table_name;
@ -164,7 +166,11 @@ function echoLongTable($col_names, $table_name, $cond, $tail, $header_row, $prin
$pag = new Paginator($pag_config); $pag = new Paginator($pag_config);
$div_classes = isset($config['div_classes']) ? $config['div_classes'] : array('table-responsive'); $div_classes = isset($config['div_classes']) ? $config['div_classes'] : array('table-responsive');
$table_classes = isset($config['table_classes']) ? $config['table_classes'] : array('table', 'table-bordered', 'table-hover', 'table-striped', 'table-text-center'); $table_classes = isset($config['table_classes'])
? $config['table_classes']
: isset($REQUIRE_LIB['bootstrap5'])
? array('table', 'table-bordered', 'table-striped', 'text-center')
: array('table', 'table-bordered', 'table-hover', 'table-striped', 'table-text-center');
if (isset($config['head_pagination']) && $config['head_pagination']) { if (isset($config['head_pagination']) && $config['head_pagination']) {
echo $pag->pagination(); echo $pag->pagination();
@ -967,10 +973,15 @@ function echoUOJPageHeader($page_title, $extra_config = array()) {
uojIncludeView('page-header', $config); uojIncludeView('page-header', $config);
} }
function echoUOJPageFooter($config = array()) { function echoUOJPageFooter($config = array()) {
global $REQUIRE_LIB;
$config['REQUIRE_LIB'] = $REQUIRE_LIB;
uojIncludeView('page-footer', $config); uojIncludeView('page-footer', $config);
} }
function echoRanklist($config = array()) { function echoRanklist($config = array()) {
global $REQUIRE_LIB;
$header_row = ''; $header_row = '';
$header_row .= '<tr>'; $header_row .= '<tr>';
$header_row .= '<th style="width: 5em;">#</th>'; $header_row .= '<th style="width: 5em;">#</th>';

View File

@ -115,7 +115,7 @@ function queryGroup($id) {
function queryUserInGroup($group_id, $username) { function queryUserInGroup($group_id, $username) {
return DB::selectFirst("select * from groups_users where username='$username' and group_id='$group_id'", MYSQLI_ASSOC); return DB::selectFirst("select * from groups_users where username='$username' and group_id='$group_id'", MYSQLI_ASSOC);
} }
function queryGroupOfUser($username) { function queryGroupsOfUser($username) {
return DB::selectAll("select b.title as title, b.id as id from groups_users a inner join groups b on a.group_id = b.id where a.username = '$username' and b.is_hidden = 0 order by id", MYSQLI_ASSOC); return DB::selectAll("select b.title as title, b.id as id from groups_users a inner join groups b on a.group_id = b.id where a.username = '$username' and b.is_hidden = 0 order by id", MYSQLI_ASSOC);
} }
function queryGroupmateCurrentAC($username) { function queryGroupmateCurrentAC($username) {

View File

@ -1,29 +1,216 @@
<?php
if (isset($REQUIRE_LIB['bootstrap5'])) {
$new_user_msg_num = DB::selectCount("select count(*) from user_msg where receiver = '".Auth::id()."' and read_time is null");
$new_system_msg_num = DB::selectCount("select count(*) from user_system_msg where receiver = '".Auth::id()."' and read_time is null");
$new_msg_tot = $new_user_msg_num + $new_system_msg_num;
}
?>
<div class="navbar navbar-light navbar-expand-md bg-light mb-4" role="navigation"> <div class="navbar navbar-light navbar-expand-md bg-light mb-4" role="navigation">
<a class="navbar-brand" href="<?= HTML::url('/') ?>"><?= UOJConfig::$data['profile']['oj-name-short'] ?></a> <?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="container">
<?php endif ?>
<a class="navbar-brand" href="<?= HTML::url('/') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<img src="<?= HTML::url('/images/logo_small.png') ?>" alt="Logo" width="24" height="24" class="d-inline-block align-text-top"/>
<?php endif ?>
<?= UOJConfig::$data['profile']['oj-name-short'] ?>
</a>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<?php else: ?>
<button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target=".navbar-collapse"> <button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<?php endif ?>
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="nav navbar-nav mr-auto"> <ul class="nav navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/contests') ?>"><span class="glyphicon glyphicon-stats"></span> <?= UOJLocale::get('contests') ?></a></li> <li class="nav-item">
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/problems') ?>"><span class="glyphicon glyphicon-th-list"></span> <?= UOJLocale::get('problems') ?></a></li> <a class="nav-link" href="<?= HTML::url('/contests') ?>">
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/groups') ?>"><span class="glyphicon glyphicon-education"></span> <?= UOJLocale::get('groups') ?></a></li> <?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/problem_lists') ?>"><span class="glyphicon glyphicon-list-alt"></span> <?= UOJLocale::get('problems lists') ?></a></li> <i class="bi bi-bar-chart-line-fill"></i>
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/submissions') ?>"><span class="glyphicon glyphicon-tasks"></span> <?= UOJLocale::get('submissions') ?></a></li> <?php else: ?>
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/hacks') ?>"><span class="glyphicon glyphicon-flag"></span> <?= UOJLocale::get('hacks') ?></a></li> <span class="glyphicon glyphicon-stats"></span>
<li class="nav-item"><a class="nav-link" href="<?= HTML::blog_list_url() ?>"><span class="glyphicon glyphicon-edit"></span> <?= UOJLocale::get('blogs') ?></a></li> <?php endif ?>
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/faq') ?>"><span class="glyphicon glyphicon-info-sign"></span> <?= UOJLocale::get('help') ?></a></li> <?= UOJLocale::get('contests') ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/problems') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<i class="bi bi-list-task"></i>
<?php else: ?>
<span class="glyphicon glyphicon-th-list"></span>
<?php endif ?>
<?= UOJLocale::get('problems') ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/groups') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<i class="bi bi-people-fill"></i>
<?php else: ?>
<span class="glyphicon glyphicon-education"></span>
<?php endif ?>
<?= UOJLocale::get('groups') ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/problem_lists') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<i class="bi bi-card-list"></i>
<?php else: ?>
<span class="glyphicon glyphicon-list-alt"></span>
<?php endif ?>
<?= UOJLocale::get('problems lists') ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/submissions') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<i class="bi bi-pie-chart-fill"></i>
<?php else: ?>
<span class="glyphicon glyphicon-tasks"></span>
<?php endif ?>
<?= UOJLocale::get('submissions') ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/hacks') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<i class="bi bi-flag-fill"></i>
<?php else: ?>
<span class="glyphicon glyphicon-flag"></span>
<?php endif ?>
<?= UOJLocale::get('hacks') ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::blog_list_url() ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<i class="bi bi-pencil-square"></i>
<?php else: ?>
<span class="glyphicon glyphicon-edit"></span>
<?php endif ?>
<?= UOJLocale::get('blogs') ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/faq') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<i class="bi bi-question-circle-fill"></i>
<?php else: ?>
<span class="glyphicon glyphicon-info-sign"></span>
<?php endif ?>
<?= UOJLocale::get('help') ?>
</a>
</li>
</ul> </ul>
<form id="form-search-problem" class="form-inline my-2 my-lg-0" method="get"> <?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="input-group"> <hr class="d-lg-none text-white-50">
<input type="text" class="form-control" name="search" id="input-search" placeholder="<?= UOJLocale::get('search')?>" /> <ul class="nav navbar-nav ms-md-auto">
<div class="input-group-append"> <li class="nav-item dropdown">
<button type="submit" class="btn btn-search btn-outline-primary" id="submit-search"><span class="glyphicon glyphicon-search"></span></button> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-translate"></i>
<?= UOJLocale::get('_common_name') ?>
</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="<?= HTML::url(UOJContext::requestURI(), array('params' => array('locale' => 'zh-cn'))) ?>">
中文
</a>
</li>
<li>
<a class="dropdown-item" href="<?= HTML::url(UOJContext::requestURI(), array('params' => array('locale' => 'en'))) ?>">
English
</a>
</li>
</ul>
</li>
<?php if (Auth::check()): ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-person-fill"></i>
<span class="position-relative">
<?= Auth::id() ?>
<?php if ($new_msg_tot): ?>
<span class="badge bg-danger rounded-pill">
<?= $new_msg_tot > 99 ? "99+" : $new_msg_tot ?>
</span>
<?php endif ?>
</span>
</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="<?= HTML::url('/user/profile/' . Auth::id()) ?>">
<?= UOJLocale::get('my profile') ?>
</a>
</li>
<li>
<a class="dropdown-item" href="<?= HTML::url('/user/msg') ?>">
<?= UOJLocale::get('private message') ?>
<?php if ($new_user_msg_num): ?>
<span class="badge bg-danger rounded-pill">
<?= $new_user_msg_num > 99 ? "99+" : $new_user_msg_num ?>
</span>
<?php endif ?>
</a>
</li>
<li>
<a class="dropdown-item" href="<?= HTML::url('/user/system-msg') ?>">
<?= UOJLocale::get('system message') ?>
<?php if ($new_system_msg_num): ?>
<span class="badge bg-danger rounded-pill">
<?= $new_system_msg_num > 99 ? "99+" : $new_system_msg_num ?>
</span>
<?php endif ?>
</a>
</li>
<?php if (isSuperUser(Auth::user())): ?>
<li>
<a class="dropdown-item" href="<?= HTML::url('/super-manage') ?>">
<?= UOJLocale::get('system manage') ?>
</a>
</li>
<?php endif ?>
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item" href="<?= HTML::url('/logout?_token=' . crsf_token()) ?>">
<?= UOJLocale::get('logout') ?>
</a>
</li>
</ul>
</li>
<?php else: ?>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/login') ?>">
<i class="bi bi-box-arrow-in-right"></i>
<?= UOJLocale::get('login') ?>
</a>
</li>
<?php if (!DB::selectCount("SELECT COUNT(*) FROM user_info")): ?>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/register') ?>">
<i class="bi bi-person-plus-fill"></i>
<?= UOJLocale::get('register') ?>
</a>
</li>
<?php endif ?>
<?php endif ?>
</ul>
<?php endif ?>
</div> </div>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div> </div>
</form> <?php endif ?>
</div><!--/.nav-collapse -->
</div> </div>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<script type="text/javascript"> <script type="text/javascript">
var zan_link = ''; var zan_link = '';
$('#form-search-problem').submit(function(e) { $('#form-search-problem').submit(function(e) {
@ -42,3 +229,4 @@
location.href = url; location.href = url;
}); });
</script> </script>
<?php endif ?>

View File

@ -5,6 +5,26 @@
?> ?>
</div> </div>
<?php if ($ShowPageFooter): ?> <?php if ($ShowPageFooter): ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<footer class="bg-light text-muted pt-3 pb-4" style="font-size: 0.9em">
<div class="container d-lg-flex justify-content-lg-between">
<p>
&copy; <?= date('Y') ?>
<a class="text-decoration-none" href="https://github.com/renbaoshuo/S2OJ<?= UOJConfig::$data['profile']['s2oj-version'] == "dev" ? '' : '/tree/' . UOJConfig::$data['profile']['s2oj-version'] ?>">S2OJ</a>
(build: <?= UOJConfig::$data['profile']['s2oj-version'] ?>)
<?= UOJLocale::get('server time') ?>: <?= UOJTime::$time_now_str ?>
</p>
<p>
Based on
<a class="text-decoration-none" href="https://uoj.ac" target="_blank">UOJ</a>,
modified by
<a class="text-decoration-none" href="https://baoshuo.ren" target="_blank">Baoshuo</a>
for
<a class="text-decoration-none" href="http://www.sjzez.com">SJZEZ</a>.
</p>
</div>
</footer>
<?php else: ?>
<div class="uoj-footer"> <div class="uoj-footer">
<div class="btn-group dropright mb-3"> <div class="btn-group dropright mb-3">
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle" data-toggle="dropdown">
@ -25,6 +45,7 @@
</p> </p>
</div> </div>
<?php endif ?> <?php endif ?>
<?php endif ?>
</div> </div>
<!-- /container --> <!-- /container -->
</body> </body>

View File

@ -1,4 +1,5 @@
<?php <?php
if (!isset($REQUIRE_LIB['bootstrap5'])) {
$new_user_msg_num = DB::selectCount("select count(*) from user_msg where receiver = '".Auth::id()."' and read_time is null"); $new_user_msg_num = DB::selectCount("select count(*) from user_msg where receiver = '".Auth::id()."' and read_time is null");
$new_system_msg_num = DB::selectCount("select count(*) from user_system_msg where receiver = '".Auth::id()."' and read_time is null"); $new_system_msg_num = DB::selectCount("select count(*) from user_system_msg where receiver = '".Auth::id()."' and read_time is null");
$new_msg_tot = $new_user_msg_num + $new_system_msg_num; $new_msg_tot = $new_user_msg_num + $new_system_msg_num;
@ -18,6 +19,7 @@
} else { } else {
$new_msg_tot_html = '<sup><span class="badge badge-pill badge-secondary">'.$new_msg_tot.'</span></sup>'; $new_msg_tot_html = '<sup><span class="badge badge-pill badge-secondary">'.$new_msg_tot.'</span></sup>';
} }
}
if (!isset($PageMainTitle)) { if (!isset($PageMainTitle)) {
$PageMainTitle = UOJConfig::$data['profile']['oj-name']; $PageMainTitle = UOJConfig::$data['profile']['oj-name'];
@ -41,13 +43,24 @@
<script type="text/javascript">uojHome = ''; // '<?= HTML::url('/') ?>'</script> <script type="text/javascript">uojHome = ''; // '<?= HTML::url('/') ?>'</script>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<!-- Bootstrap 5 (CSS) -->
<?= HTML::css_link('/css/bootstrap5.min.css?v=5.2.1') ?>
<!-- Bootstrap Icons -->
<?= HTML::css_link('/css/bootstrap-icons.min.css?v=2022.9.23') ?>
<?php else: ?>
<!-- Bootstrap core CSS --> <!-- Bootstrap core CSS -->
<?= HTML::css_link('/css/bootstrap.min.css?v=2019.5.31') ?> <?= HTML::css_link('/css/bootstrap.min.css?v=2019.5.31') ?>
<!-- Bootstrap Glyphicons CSS--> <!-- Bootstrap Glyphicons CSS-->
<?= HTML::css_link('/css/bootstrap-glyphicons.min.css?v=2019.5.31') ?> <?= HTML::css_link('/css/bootstrap-glyphicons.min.css?v=2019.5.31') ?>
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<?= HTML::css_link('/css/uoj-bs5.css?v=' . UOJConfig::$data['profile']['css-version']) ?>
<?php else: ?>
<!-- Custom styles for this template --> <!-- Custom styles for this template -->
<?= HTML::css_link('/css/uoj-theme.css?v=' . UOJConfig::$data['profile']['s2oj-version']) ?> <?= HTML::css_link('/css/uoj-theme.css?v=' . UOJConfig::$data['profile']['s2oj-version']) ?>
<?php endif ?>
<!-- jQuery (necessary for Bootstrap\'s JavaScript plugins) --> <!-- jQuery (necessary for Bootstrap\'s JavaScript plugins) -->
<?= HTML::js_src('/js/jquery.min.js') ?> <?= HTML::js_src('/js/jquery.min.js') ?>
@ -71,9 +84,13 @@
<?= HTML::js_src('/js/jquery.tagcanvas.min.js') ?> <?= HTML::js_src('/js/jquery.tagcanvas.min.js') ?>
<?php endif ?> <?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<?= HTML::js_src('/js/bootstrap5.bundle.min.js?v=2022.9.23') ?>
<?php else: ?>
<!-- Include all compiled plugins (below), or include individual files as needed --> <!-- Include all compiled plugins (below), or include individual files as needed -->
<?= HTML::js_src('/js/popper.min.js?v=2019.5.31') ?> <?= HTML::js_src('/js/popper.min.js?v=2019.5.31') ?>
<?= HTML::js_src('/js/bootstrap.min.js?v=2019.5.31') ?> <?= HTML::js_src('/js/bootstrap.min.js?v=2019.5.31') ?>
<?php endif ?>
<!-- Color converter --> <!-- Color converter -->
<?= HTML::js_src('/js/color-converter.min.js') ?> <?= HTML::js_src('/js/color-converter.min.js') ?>
@ -219,9 +236,16 @@
}); });
</script> </script>
</head> </head>
<body role="document"> <?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<body class="d-flex flex-column min-vh-100">
<?php else: ?>
<body>
<?php endif ?>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="container theme-showcase" role="main"> <div class="container theme-showcase" role="main">
<?php endif ?>
<?php if ($ShowPageHeader): ?> <?php if ($ShowPageHeader): ?>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<div> <div>
<ul class="nav nav-pills float-right" role="tablist"> <ul class="nav nav-pills float-right" role="tablist">
<?php if (Auth::check()): ?> <?php if (Auth::check()): ?>
@ -255,8 +279,49 @@
</h1> </h1>
<h1 class="d-block d-sm-none"><?= $PageMainTitleOnSmall ?></h1> <h1 class="d-block d-sm-none"><?= $PageMainTitleOnSmall ?></h1>
</div> </div>
<?php uojIncludeView($PageNav) ?>
<?php endif ?> <?php endif ?>
<?php uojIncludeView($PageNav, array('REQUIRE_LIB' => $REQUIRE_LIB)) ?>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<?php if (Auth::check()): ?>
<?php $groups = queryGroupsOfUser(Auth::id()); ?>
<?php if (count($groups)): ?>
<div class="card card-default mb-2" id="group-user-announcements">
<div class="card-header">
小组公告
</div>
<ul class="list-group list-group-flush">
<?php foreach ($groups as $group): ?>
<?php
$group_detail = DB::selectFirst("select * from groups where id = {$group['id']}");
$group_announcement = $group_detail['announcement'];
?>
<li class="list-group-item">
<a href="<?= HTML::url('/group/'.$group['id']) ?>">
<b><?= $group['title'] ?></b>
</a>
<?php if ($group_announcement): ?>
<div id="announcement-content-<?= $group['id'] ?>"></div>
<script>(function(){
$('#announcement-content-<?= $group['id'] ?>')
.html(DOMPurify.sanitize(decodeURIComponent("<?= urlencode($group_announcement) ?>"), <?= DOM_SANITIZE_CONFIG ?>));
})();</script>
<?php else: ?>
<div>(暂无公告)</div>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>
</div>
<?php endif ?>
<?php endif ?>
<?php endif ?>
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="uoj-content container flex-fill">
<?php else: ?>
<div class="uoj-content"> <div class="uoj-content">
<?php endif ?>

1
web/css/bootstrap-icons.min.css vendored Normal file

File diff suppressed because one or more lines are too long

6
web/css/bootstrap5.min.css vendored Normal file

File diff suppressed because one or more lines are too long

4
web/css/uoj-bs5.css Normal file
View File

@ -0,0 +1,4 @@
.uoj-username {
font-weight: 800;
text-decoration: none;
}

Binary file not shown.

Binary file not shown.

6
web/js/bootstrap5.bundle.min.js vendored Normal file

File diff suppressed because one or more lines are too long