refactor(web/hack): drop bootstrap4

This commit is contained in:
Baoshuo Ren 2022-10-21 06:58:32 +08:00
parent 6277a0c8c3
commit a06707335f
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 23 additions and 77 deletions

View File

@ -1,5 +1,7 @@
<?php
requirePHPLib('form');
requireLib('bootstrap5');
requireLib('hljs');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
redirectToLogin();
@ -13,10 +15,6 @@
become404Page();
}
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
$submission = querySubmission($hack['submission_id']);
$problem = queryProblemBrief($submission['problem_id']);
$problem_extra_config = getProblemExtraConfig($problem);
@ -66,13 +64,6 @@
}
}
?>
<?php
if (isset($REQUIRE_LIB['bootstrap5'])) {
$REQUIRE_LIB['hljs'] = '';
} else {
$REQUIRE_LIB['shjs'] = '';
}
?>
<?php echoUOJPageHeader(UOJLocale::get('problems::hack').' #'.$hack['id']) ?>
<h1 class="h3">
@ -85,18 +76,12 @@
<div class="card-header bg-info">
<h4 class="card-title"><?= UOJLocale::get('details') ?></h4>
</div>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="card-body">
<?php endif ?>
<?php echoJudgementDetails($hack['details'], $styler, 'details') ?>
<?php if ($should_show_details_to_me): ?>
<?php if ($styler->fade_all_details): ?>
<hr />
<?php echoHackDetails($hack['details'], 'final_details') ?>
<?php endif ?>
<?php echoJudgementDetails($hack['details'], $styler, 'details') ?>
<?php if ($should_show_details_to_me): ?>
<?php if ($styler->fade_all_details): ?>
<hr />
<?php echoHackDetails($hack['details'], 'final_details') ?>
<?php endif ?>
<?php if (!isset($REQUIRE_LIB['bootstrap5'])): ?>
</div>
<?php endif ?>
</div>
<?php endif ?>

View File

@ -1,4 +1,6 @@
<?php
requireLib('bootstrap5');
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
redirectToLogin();
}
@ -7,10 +9,6 @@
become403Page();
}
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
$conds = array();
$q_problem_id = isset($_GET['problem_id']) && validateUInt($_GET['problem_id']) ? $_GET['problem_id'] : null;
@ -61,60 +59,31 @@
<div class="d-none d-sm-block">
<?php if (Auth::check()): ?>
<div class="float-right
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
btn-group
<?php endif ?>">
<div class="float-right btn-group">
<a href="/hacks?hacker=<?= Auth::id() ?>" class="btn btn-success btn-sm"><?= UOJLocale::get('problems::hacks by me') ?></a>
<a href="/hacks?owner=<?= Auth::id() ?>" class="btn btn-danger btn-sm"><?= UOJLocale::get('problems::hacks to me') ?></a>
</div>
<?php endif ?>
<form id="form-search" class="form-inline" role="form">
<div id="form-group-submission_id" class="form-group
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
d-inline-block
<?php endif ?>
">
<div id="form-group-submission_id" class="form-group d-inline-block">
<label for="input-submission_id" class="control-label"><?= UOJLocale::get('problems::submission id') ?>:</label>
<input type="text" class="form-control input-sm" name="submission_id" id="input-submission_id" value="<?= $q_submission_id ?>" maxlength="6" style="width:5em" />
</div>
<div id="form-group-problem_id" class="form-group
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
d-inline-block
<?php endif ?>
">
<div id="form-group-problem_id" class="form-group d-inline-block">
<label for="input-problem_id" class="control-label"><?= UOJLocale::get('problems::problem id') ?>:</label>
<input type="text" class="form-control input-sm" name="problem_id" id="input-problem_id" value="<?= $q_problem_id ?>" maxlength="4" style="width:4em" />
</div>
<div id="form-group-hacker" class="form-group
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
d-inline-block
<?php endif ?>
">
<div id="form-group-hacker" class="form-group d-inline-block">
<label for="input-hacker" class="control-label"><?= UOJLocale::get('problems::hacker') ?>:</label>
<input type="text" class="form-control input-sm" name="hacker" id="input-hacker" value="<?= $q_hacker ?>" maxlength="100" style="width:10em" />
</div>
<div id="form-group-owner" class="form-group
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
d-inline-block
<?php endif ?>
">
<div id="form-group-owner" class="form-group d-inline-block">
<label for="input-owner" class="control-label"><?= UOJLocale::get('problems::owner') ?>:</label>
<input type="text" class="form-control input-sm" name="owner" id="input-owner" value="<?= $q_owner ?>" maxlength="100" style="width:10em" />
</div>
<div id="form-group-status" class="form-group
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
d-inline-block
<?php endif ?>
">
<div id="form-group-status" class="form-group d-inline-block">
<label for="input-status" class="control-label"><?= UOJLocale::get('problems::result') ?>:</label>
<select class="input-sm
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
form-select
<?php else: ?>
form-control
<?php endif ?>
" id="input-status" name="status">
<select class="input-sm form-select" id="input-status" name="status">
<option value=""<?= $selected_all?>>All</option>
<option value="1"<?= $selected_succ ?>>Success!</option>
<option value="2"<?= $selected_fail ?>>Failed.</option>
@ -139,27 +108,19 @@ d-inline-block
location.href = url;
});
</script>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="mt-3"></div>
<?php else: ?>
<div class="top-buffer-sm"></div>
<?php endif ?>
</div>
<?php echoHacksList($cond,
'order by id desc',
array(
[
'judge_time_hidden' => '',
'table_config' => (isset($REQUIRE_LIB['bootstrap5'])
? array(
'div_classes' => array('card', 'mb-3', 'table-responsive'),
'table_classes' => array('table', 'mb-0', 'uoj-table', 'text-center')
)
: array()
),
),
'table_config' => [
'div_classes' => ['card', 'mb-3', 'table-responsive'],
'table_classes' => ['table', 'mb-0', 'uoj-table', 'text-center'],
],
],
$myUser);
?>