Compare commits

...

3 Commits

Author SHA1 Message Date
edef725860
feat: add page title
All checks were successful
continuous-integration/drone/push Build is passing
2022-09-24 13:39:55 +08:00
86ec60fa3a
refactor: groups with bs5 2022-09-24 13:39:45 +08:00
7ee809bd56
refactor: problem_lists with bs5 2022-09-24 13:24:48 +08:00
5 changed files with 128 additions and 34 deletions

View File

@ -68,6 +68,12 @@ EOD;
}
?>
<?php echoUOJPageHeader(UOJLocale::get('contests')) ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="d-flex justify-content-between">
<?php endif ?>
<h1 class="h2">
<?= UOJLocale::get('contests') ?>
</h1>
<?php
if (isSuperUser($myUser)) {
if (isset($REQUIRE_LIB['bootstrap5'])) {
@ -79,6 +85,10 @@ if (isSuperUser($myUser)) {
echo '</div>';
}
?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div>
<?php endif ?>
<h4><?= UOJLocale::get('contests::current or upcoming contests') ?></h4>
<?php
$table_header = '';

View File

@ -11,6 +11,10 @@
become403Page();
}
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
if (isSuperUser($myUser)) {
$new_group_form = new UOJForm('new_group');
$new_group_form->handle = function() {
@ -24,17 +28,25 @@
}
function echoGroup($group) {
global $myUser;
global $myUser, $REQUIRE_LIB;
echo '<tr class="text-center">';
echo '<td>';
echo '#', $group['group_id'], '</td>';
echo '<td class="text-left">';
if (isset($REQUIRE_LIB['bootstrap5'])) {
echo '<td class="text-start">';
} else {
echo '<td class="text-left">';
}
if ($group['is_hidden']) {
echo ' <span class="text-danger">[隐藏]</span> ';
}
echo '<a href="/group/', $group['group_id'], '">', $group['title'], '</a>';
echo '<a ';
if (isset($REQUIRE_LIB['bootstrap5'])) {
echo ' class="text-decoration-none" ';
}
echo ' href="/group/', $group['group_id'], '">', $group['title'], '</a>';
echo '</td>';
echo "<td>{$group['user_count']}</td>";
@ -45,6 +57,24 @@
<?php echoUOJPageHeader(UOJLocale::get('groups')) ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="d-flex justify-content-between">
<?php endif ?>
<h1 class="h2">
<?= UOJLocale::get('groups') ?>
</h1>
<?php if (isSuperUser($myUser)): ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="text-end mb-2">
<?php endif ?>
<?php $new_group_form->printHTML(); ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div>
</div>
<?php endif ?>
<?php endif ?>
<?php
$groups_caption = UOJLocale::get('groups');
$users_caption = UOJLocale::get('users count');
@ -64,23 +94,23 @@ EOD;
$from = "`groups` a left join groups_users b on a.id = b.group_id";
$table_config = array('page_len' => 40,
'table_classes' => array('table', 'table-bordered', 'table-hover', 'table-striped'),
'head_pagination' => true,
'pagination_table' => "`groups`"
);
if (isset($REQUIRE_LIB['bootstrap5'])) {
$table_config['div_classes'] = array('card', 'mb-3');
$table_config['table_classes'] = array('table', 'uoj-table', 'mb-0');
}
echoLongTable(
array('a.id as group_id', 'a.title as title', 'a.is_hidden as is_hidden', 'count(b.username) as user_count'),
$from, $cond, 'group by a.id order by a.id asc',
$header,
'echoGroup',
array('page_len' => 40,
'table_classes' => array('table', 'table-bordered', 'table-hover', 'table-striped'),
'print_after_table' => function() {
global $myUser;
if (isSuperUser($myUser)) {
global $new_group_form;
$new_group_form->printHTML();
}
},
'head_pagination' => true,
'pagination_table' => "`groups`"
)
$table_config
);
?>

View File

@ -3,6 +3,10 @@
become403Page(UOJLocale::get('need login'));
}
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
requirePHPLib('form');
requirePHPLib('judger');
requirePHPLib('data');
@ -21,7 +25,7 @@
}
function echoList($list) {
global $myUser;
global $myUser, $REQUIRE_LIB;
echo '<tr class="text-center">';
if ($list['problem_count'] == $list['accepted'] && $list['problem_count'] > 0) {
@ -31,13 +35,30 @@
}
echo '#', $list['list_id'], '</td>';
echo '<td class="text-left">';
if (isset($REQUIRE_LIB['bootstrap5'])) {
echo '<td class="text-start">';
} else {
echo '<td class="text-left">';
}
if ($list['is_hidden']) {
echo ' <span class="text-danger">[隐藏]</span> ';
}
echo '<a href="/problem_list/', $list['list_id'], '">', $list['title'], '</a>';
echo '<a ';
if (isset($REQUIRE_LIB['bootstrap5'])) {
echo ' class="text-decoration-none" ';
}
echo ' href="/problem_list/', $list['list_id'], '">', $list['title'], '</a>';
foreach (queryProblemListTags($list['list_id']) as $tag) {
echo '<a class="uoj-list-tag">', '<span class="badge badge-pill badge-secondary">', HTML::escape($tag), '</span>', '</a>';
if (isset($REQUIRE_LIB['bootstrap5'])) {
echo '<a class="uoj-list-tag my-1">';
echo '<span class="badge bg-secondary">';
} else {
echo '<a class="uoj-list-tag">';
echo '<span class="badge badge-pill badge-secondary">';
}
echo HTML::escape($tag), '</span>', '</a>';
}
echo '</td>';
@ -50,13 +71,27 @@
<?php echoUOJPageHeader(UOJLocale::get('problems lists')) ?>
<?php
if (isSuperUser($myUser)) {
global $new_list_form;
$new_list_form->printHTML();
}
$problem_list_caption = UOJLocale::get('problems::problem list');
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="d-flex justify-content-between">
<?php endif ?>
<h1 class="h2">
<?= UOJLocale::get('problems lists') ?>
</h1>
<?php if (isSuperUser($myUser)): ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="text-end mb-2">
<?php endif ?>
<?php $new_list_form->printHTML(); ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div>
</div>
<?php endif ?>
<?php endif ?>
<?php
$problem_list_caption = UOJLocale::get('problems::problem list');
$ac_caption = UOJLocale::get('problems::ac');
$total_caption = UOJLocale::get('problems::total');
$header = <<<EOD
@ -89,19 +124,24 @@ EOD;
$from = "lists a left join lists_problems b on a.id = b.list_id left join best_ac_submissions c on (b.problem_id = c.problem_id and c.submitter = '{$myUser['username']}')";
$table_config = array(
'page_len' => 40,
'table_classes' => array('table', 'table-bordered', 'table-hover', 'table-striped'),
'head_pagination' => true,
'pagination_table' => 'lists'
);
if (isset($REQUIRE_LIB['bootstrap5'])) {
$table_config['div_classes'] = array('card', 'mb-3');
$table_config['table_classes'] = array('table', 'uoj-table', 'mb-0');
}
echoLongTable(
array('a.id as list_id', 'a.title as title', 'a.is_hidden as is_hidden', 'count(b.problem_id) as problem_count', 'count(c.submitter) as accepted'),
$from, $cond, 'group by a.id order by a.id desc',
$header,
'echoList',
array('page_len' => 40,
'table_classes' => array('table', 'table-bordered', 'table-hover', 'table-striped'),
'print_after_table' => function() {
global $myUser;
},
'head_pagination' => true,
'pagination_table' => 'lists'
)
$table_config,
);
?>

View File

@ -158,6 +158,14 @@ EOD;
: array('table', 'table-bordered', 'table-hover', 'table-striped');
?>
<?php echoUOJPageHeader(UOJLocale::get('problems')) ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="d-flex justify-content-between">
<?php endif ?>
<h1 class="h2">
<?= UOJLocale::get('problems') ?>
</h1>
<?php if (isSuperUser($myUser) || isProblemManager($myUser) || isProblemUploader($myUser)): ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="text-end">
@ -165,7 +173,8 @@ EOD;
<?php $new_problem_form->printHTML(); ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div>
<?php endif ?>
</div>
<?php endif ?>
<?php endif ?>
<div class="row">
<div class="col-sm-4">

View File

@ -44,6 +44,11 @@
}
?>
<?php echoUOJPageHeader(UOJLocale::get('submissions')) ?>
<h1 class="h2">
<?= UOJLocale::get('submissions') ?>
</h1>
<div class="d-none d-sm-block">
<?php if ($myUser != null): ?>
<div class="float-right">