From 277e69f50727b85be03155ee5eb73255f95ce3ed Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sat, 22 Oct 2022 21:12:13 +0800 Subject: [PATCH] feat(web): drop bs4 --- web/app/controllers/announcements.php | 19 +-- web/app/controllers/blogs.php | 98 +++++++-------- web/app/controllers/contest_inside.php | 8 +- web/app/controllers/contest_members.php | 92 +++++++------- web/app/controllers/contests.php | 95 +++++++-------- web/app/controllers/index.php | 113 +++++------------- web/app/controllers/login.php | 7 +- web/app/controllers/problem.php | 106 ++-------------- .../controllers/problem_managers_manage.php | 41 +------ web/app/controllers/problem_solutions.php | 6 +- .../controllers/subdomain/blog/aboutme.php | 5 +- .../controllers/subdomain/blog/archive.php | 8 +- web/app/controllers/subdomain/blog/blog.php | 66 ++-------- .../subdomain/blog/blog_delete.php | 3 +- .../controllers/subdomain/blog/blog_write.php | 3 +- web/app/controllers/subdomain/blog/index.php | 45 ++----- .../subdomain/blog/self_reviews.php | 5 +- .../subdomain/blog/slide_write.php | 18 +-- web/app/controllers/submission.php | 60 +++------- web/app/controllers/submissions_list.php | 15 +-- web/app/libs/uoj-form-lib.php | 9 +- web/app/libs/uoj-html-lib.php | 4 +- web/app/views/contest-dashboard.php | 10 -- web/app/views/contest-question-table.php | 5 - 24 files changed, 236 insertions(+), 605 deletions(-) diff --git a/web/app/controllers/announcements.php b/web/app/controllers/announcements.php index 66c32c5..68cd74b 100644 --- a/web/app/controllers/announcements.php +++ b/web/app/controllers/announcements.php @@ -7,10 +7,7 @@ become403Page(); } - if (!isset($_COOKIE['bootstrap4'])) { - $REQUIRE_LIB['bootstrap5'] = ''; - } - + requireLib('bootstrap5'); requirePHPLib('form'); function echoBlogCell($blog) { @@ -45,22 +42,16 @@ EOD; $config = [ - 'table_classes' => ['table', 'table-hover'], - 'page_len' => 40 + 'page_len' => 40, + 'div_classes' => ['card', 'my-3'], + 'table_classes' => ['table', 'uoj-table', 'mb-0'], ]; - - if (isset($REQUIRE_LIB['bootstrap5'])) { - $config['div_classes'] = ['card', 'my-3']; - $config['table_classes'] = ['table', 'uoj-table', 'mb-0']; - } ?> -
-

@@ -68,7 +59,6 @@ EOD; -

@@ -79,6 +69,5 @@ EOD;
- diff --git a/web/app/controllers/blogs.php b/web/app/controllers/blogs.php index 9509269..33346e6 100644 --- a/web/app/controllers/blogs.php +++ b/web/app/controllers/blogs.php @@ -1,4 +1,5 @@ '; - if ($blog['is_hidden']) { - echo '[已隐藏] ' . getBlogLink($blog['id']) . ''; - } else { - echo '' . getBlogLink($blog['id']) . ''; - } - echo '' . getUserLink($blog['poster']) . ''; - echo '' . $blog['post_time'] . ''; - echo ''; - } - $header = << - 标题 - 发表者 - 发表日期 - -EOD; - $config = array(); - $config['table_classes'] = array('table', 'table-hover'); - - if (isset($REQUIRE_LIB['bootstrap5'])) { - $config['div_classes'] = array('card', 'my-3', 'table-responsive'); - $config['table_classes'] = array('table', 'uoj-table', 'mb-0'); - } ?> -
+ +
-
- - - - - - + +
-

+ - -

博客总览

- - -
- + - + + 标题 + 发表者 + 发表日期 + +EOD, + function($blog) { + echo ''; + echo ''; + echo getBlogLink($blog['id']); + if ($blog['is_hidden']) { + echo ' ', UOJLocale::get('hidden'), ' '; + } + echo ''; + echo '' . getUserLink($blog['poster']) . ''; + echo '' . $blog['post_time'] . ''; + echo ''; + }, + [ + 'page_len' => 10, + 'div_classes' => ['card', 'my-3', 'table-responsive'], + 'table_classes' => ['table', 'uoj-table', 'mb-0'], + ] +); + ?> -
+ +
- diff --git a/web/app/controllers/contest_inside.php b/web/app/controllers/contest_inside.php index c4fa823..a66ea91 100644 --- a/web/app/controllers/contest_inside.php +++ b/web/app/controllers/contest_inside.php @@ -1,9 +1,8 @@ $post_question, 'my_questions_pag' => $my_questions_pag, 'others_questions_pag' => $others_questions_pag, - 'REQUIRE_LIB' => $REQUIRE_LIB, ]); } diff --git a/web/app/controllers/contest_members.php b/web/app/controllers/contest_members.php index 031a910..e8d4e09 100644 --- a/web/app/controllers/contest_members.php +++ b/web/app/controllers/contest_members.php @@ -1,4 +1,5 @@ -

+

+ +

+
-
+
printHTML(); ?>
-
当前尚未报名,您可以报名
+
当前尚未报名,您可以 报名
-
+
'; - $config = array('page_len' => 100, - 'get_row_index' => '', - 'print_after_table' => function() { - global $add_new_contestant_form, - $add_group_to_contest_form, - $remove_user_from_contest_form, - $force_set_user_participated_form; - - if (isset($add_new_contestant_form)) { - $add_new_contestant_form->printHTML(); - } - if (isset($add_group_to_contest_form)) { - $add_group_to_contest_form->printHTML(); - } - if (isset($remove_user_from_contest_form)) { - $remove_user_from_contest_form->printHTML(); - } - if (isset($force_set_user_participated_form)) { - $force_set_user_participated_form->printHTML(); - } - } - ); - - if (isset($REQUIRE_LIB['bootstrap5'])) { - $config['div_classes'] = array('card', 'mb-3'); - $config['table_classes'] = array('table', 'uoj-table', 'mb-0', 'text-center'); - } - - echoLongTable(array('*'), 'contests_registrants', "contest_id = {$contest['id']}", 'order by username desc', + echoLongTable( + ['*'], + 'contests_registrants', + "contest_id = {$contest['id']}", + 'order by username desc', $header_row, - function($contest, $num) { - global $myUser; - global $has_contest_permission, $show_ip, $ip_owner, $has_participated; - - $user = queryUser($contest['username']); - $user_link = getUserLink($contest['username']); + function($contestant, $num) use ($myUser, $has_contest_permission, $show_ip, $ip_owner, $has_participated) { + $user = queryUser($contestant['username']); + if (!$show_ip) { echo ''; } else { if ($ip_owner[$user['remote_addr']] != $user['username'] || $forwarded_ip_owner[$user['http_x_forwarded_for']] != $user['username']) { - echo ''; + echo ''; } else { echo ''; } } echo ''.$num.''; - echo ''.$user_link.''; + echo ''.getUserLink($contestant['username']).''; if ($show_ip) { echo ''.$user['remote_addr'].''; echo ''.$user['http_x_forwarded_for'].''; } if ($has_contest_permission) { - echo ''.($has_participated[$user['username']] ? 'Yes' : 'No').''; + echo ''.($contestant['has_participated'] ? 'Yes' : 'No').''; } echo ''; }, - $config + [ + 'page_len' => 50, + 'get_row_index' => '', + 'div_classes' => ['table-responsive', 'card', 'mb-3'], + 'table_classes' => ['table', 'uoj-table', 'mb-0', 'text-center'], + ] ); ?> + +printHTML(); + } + if (isset($add_group_to_contest_form)) { + $add_group_to_contest_form->printHTML(); + } + if (isset($remove_user_from_contest_form)) { + $remove_user_from_contest_form->printHTML(); + } + if (isset($force_set_user_participated_form)) { + $force_set_user_participated_form->printHTML(); + } + ?> diff --git a/web/app/controllers/contests.php b/web/app/controllers/contests.php index 94397d3..cd80ef5 100644 --- a/web/app/controllers/contests.php +++ b/web/app/controllers/contests.php @@ -1,28 +1,19 @@ {$contest['name']} +{$contest['name']} EOD; genMoreContestInfo($contest); if ($contest['cur_progress'] == CONTEST_NOT_STARTED) { @@ -33,18 +24,18 @@ EOD; $rest_second = $cur_rest_second; } if ($myUser != null && hasRegistered($myUser, $contest)) { - $contest_name_link .= ''.UOJLocale::get('contests::registered').''; + $contest_name_link .= ''.UOJLocale::get('contests::registered').''; } else { - $contest_name_link .= ''.UOJLocale::get('contests::register').''; + $contest_name_link .= ''.UOJLocale::get('contests::register').''; } } elseif ($contest['cur_progress'] == CONTEST_IN_PROGRESS) { - $contest_name_link .= ''.UOJLocale::get('contests::in progress').''; + $contest_name_link .= ''.UOJLocale::get('contests::in progress').''; } elseif ($contest['cur_progress'] == CONTEST_PENDING_FINAL_TEST) { - $contest_name_link .= ''.UOJLocale::get('contests::pending final test').''; + $contest_name_link .= ''.UOJLocale::get('contests::pending final test').''; } elseif ($contest['cur_progress'] == CONTEST_TESTING) { - $contest_name_link .= ''.UOJLocale::get('contests::final testing').''; + $contest_name_link .= ''.UOJLocale::get('contests::final testing').''; } elseif ($contest['cur_progress'] == CONTEST_FINISHED) { - $contest_name_link .= ''.UOJLocale::get('contests::ended').''; + $contest_name_link .= ''.UOJLocale::get('contests::ended').''; } $last_hour = round($contest['last_min'] / 60, 2); @@ -52,44 +43,33 @@ EOD; $click_zan_block = getClickZanBlock('C', $contest['id'], $contest['zan']); echo ''; echo '', $contest_name_link, ''; - echo '', ' $contest['last_min'])).'">'.$contest['start_time_str'].'', ''; + echo '', ''.$contest['start_time_str'].'', ''; echo '', UOJLocale::get('hours', $last_hour), ''; - echo '', ''; - - if (isset($REQUIRE_LIB['bootstrap5'])) { - echo ''; - } else { - echo ''; - } - - echo ' ×'.$contest['player_num'].'', ''; + echo '', '', '', ' ×'.$contest['player_num'].'', ''; echo '', '
'.$click_zan_block.'
', ''; echo ''; } ?> - + +
-

-'; - } else { - echo ''; -} - ?> - + +
+
-

+ +
+ + +

+ +

'; @@ -100,12 +80,18 @@ if (isSuperUser($myUser)) { $table_header .= ''.UOJLocale::get('appraisal').''; $table_header .= ''; - $table_config = array('page_len' => 40); - if (isset($REQUIRE_LIB['bootstrap5'])) { - $table_config['div_classes'] = array('card', 'mb-3'); - $table_config['table_classes'] = array('table', 'uoj-table', 'mb-0', 'text-center'); - } - echoLongTable(array('*'), 'contests', "status != 'finished'", 'order by start_time asc, id asc', $table_header, + $table_config = [ + 'page_len' => 40, + 'div_classes' => ['card', 'mb-3'], + 'table_classes' => ['table', 'uoj-table', 'mb-0', 'text-center'], + ]; + + echoLongTable( + ['*'], + 'contests', + "status != 'finished'", + 'order by start_time asc, id asc', + $table_header, echoContest, $table_config ); @@ -128,9 +114,16 @@ EOD; } ?> -

+

+ +

- -

- -

- +

+ +

- + @@ -41,11 +33,7 @@ ?> @@ -55,51 +43,33 @@ - - -
- - - -
- - class="text-decoration-none" - - > + by
 
- -
- -
- +
+ + + +
-
- - +

- -

- - true, 'top10' => true, 'by_accepted' => true, - 'table_classes' => isset($REQUIRE_LIB['bootstrap5']) - ? array('table', 'text-center') - : array('table', 'table-bordered', 'table-hover', 'table-striped', 'table-text-center'), - )) ?> + 'table_classes' => ['table', 'text-center'], + ]) ?> -
-
@@ -115,23 +85,11 @@ Logo
-
-
- -

- -

- -
    +
      - - '', 'groups_hidden' => '']) ?> - + '', 'groups_hidden' => '']) ?>
      - -
      - -
      - +
      + +
      - -

      - -

      - -
        + diff --git a/web/app/controllers/login.php b/web/app/controllers/login.php index da3e244..24cf370 100644 --- a/web/app/controllers/login.php +++ b/web/app/controllers/login.php @@ -1,6 +1,9 @@ -