mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-26 05:48:41 +00:00
feat(web/submissions_list): new search form
This commit is contained in:
parent
62941dbea5
commit
aeab23cc9a
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
requireLib('bootstrap5');
|
||||||
|
requirePHPLib('judger');
|
||||||
|
|
||||||
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
|
if (!Auth::check() && UOJConfig::$data['switch']['force-login']) {
|
||||||
redirectToLogin();
|
redirectToLogin();
|
||||||
}
|
}
|
||||||
@ -37,11 +40,6 @@
|
|||||||
} else {
|
} else {
|
||||||
$cond = '1';
|
$cond = '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!isset($_COOKIE['bootstrap4'])) {
|
|
||||||
$REQUIRE_LIB['bootstrap5'] = '';
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<?php echoUOJPageHeader(UOJLocale::get('submissions')) ?>
|
<?php echoUOJPageHeader(UOJLocale::get('submissions')) ?>
|
||||||
|
|
||||||
@ -49,67 +47,57 @@
|
|||||||
<?= UOJLocale::get('submissions') ?>
|
<?= UOJLocale::get('submissions') ?>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="d-none d-sm-block">
|
<div class="d-none d-sm-block mb-3">
|
||||||
<?php if ($myUser != null): ?>
|
<form id="form-search" class="row gy-2 gx-3 align-items-end mb-3" target="_self" method="GET">
|
||||||
<div class="float-right">
|
<div id="form-group-problem_id" class="col-auto">
|
||||||
<a href="/submissions?submitter=<?= $myUser['username'] ?>" class="btn btn-primary btn-sm"><?= UOJLocale::get('problems::my submissions') ?></a>
|
<label for="input-problem_id" class="form-label">
|
||||||
</div>
|
<?= UOJLocale::get('problems::problem id')?>:
|
||||||
<?php endif ?>
|
</label>
|
||||||
<form id="form-search" class="form-inline" method="get">
|
<input type="text" class="form-control form-control-sm" name="problem_id" id="input-problem_id" value="<?= $q_problem_id ?>" style="width:4em" />
|
||||||
<div id="form-group-problem_id" class="form-group
|
|
||||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
|
||||||
d-inline-block
|
|
||||||
<?php endif ?>
|
|
||||||
">
|
|
||||||
<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>
|
||||||
<div id="form-group-submitter" class="form-group
|
<div id="form-group-submitter" class="col-auto">
|
||||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
<label for="input-submitter" class="control-label">
|
||||||
d-inline-block
|
<?= UOJLocale::get('username')?>:
|
||||||
<?php endif ?>
|
</label>
|
||||||
">
|
<div class="input-group input-group-sm">
|
||||||
<label for="input-submitter" class="control-label"><?= UOJLocale::get('username')?>:</label>
|
<input type="text" class="form-control form-control-sm" name="submitter" id="input-submitter" value="<?= $q_submitter ?>" maxlength="20" style="width:10em" />
|
||||||
<input type="text" class="form-control input-sm" name="submitter" id="input-submitter" value="<?= $q_submitter ?>" maxlength="20" style="width:10em" />
|
<?php if (Auth::check()): ?>
|
||||||
|
<a id="my-submissions" href="/submissions?submitter=<?= Auth::id() ?>" class="btn btn-outline-secondary btn-sm">
|
||||||
|
我的
|
||||||
|
</a>
|
||||||
|
<?php endif ?>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$('#my-submissions').click(function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$('#input-submitter').val('<?= Auth::id() ?>');
|
||||||
|
$('#form-search').submit();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<div id="form-group-score" class="form-group
|
<div id="form-group-score" class="col-auto">
|
||||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
<label for="input-min_score" class="control-label">
|
||||||
d-inline-block
|
<?= UOJLocale::get('score range')?>:
|
||||||
<?php endif ?>
|
</label>
|
||||||
">
|
<div class="input-group input-group-sm">
|
||||||
<label for="input-min_score" class="control-label"><?= UOJLocale::get('score range')?>:</label>
|
<input type="text" class="form-control" name="min_score" id="input-min_score" value="<?= $q_min_score ?>" maxlength="3" style="width:4em" placeholder="0" />
|
||||||
<input type="text" class="form-control input-sm" name="min_score" id="input-min_score" value="<?= $q_min_score ?>" maxlength="3" style="width:4em" placeholder="0" />
|
<span class="input-group-text" id="basic-addon3">~</span>
|
||||||
<label for="input-max_score" class="control-label">~</label>
|
<input type="text" class="form-control" name="max_score" id="input-max_score" value="<?= $q_max_score ?>" maxlength="3" style="width:4em" placeholder="100" />
|
||||||
<input type="text" class="form-control input-sm" name="max_score" id="input-max_score" value="<?= $q_max_score ?>" maxlength="3" style="width:4em" placeholder="100" />
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="form-group-language" class="form-group
|
<div id="form-group-language" class="col-auto">
|
||||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
|
|
||||||
d-inline-block
|
|
||||||
<?php endif ?>
|
|
||||||
">
|
|
||||||
<label for="input-language" class="control-label"><?= UOJLocale::get('problems::language')?>:</label>
|
<label for="input-language" class="control-label"><?= UOJLocale::get('problems::language')?>:</label>
|
||||||
<input type="text" class="form-control input-sm" name="language" id="input-language" value="<?= $html_esc_q_language ?>" maxlength="10" style="width:8em" />
|
<select class="form-select form-select-sm" id="input-language" name="language">
|
||||||
|
<option value="">All</option>
|
||||||
|
<?php foreach ($uojSupportedLanguages as $lang): ?>
|
||||||
|
<option value="<?= HTML::escape($lang) ?>" <?= $lang == $q_language ? 'selected' : '' ?>><?= HTML::escape($lang) ?></option>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<button type="submit" id="submit-search" class="btn btn-secondary btn-sm ml-2"><?= UOJLocale::get('search')?></button>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" id="submit-search" class="btn btn-secondary btn-sm ml-2"><?= UOJLocale::get('search')?></button>
|
|
||||||
</form>
|
</form>
|
||||||
<script type="text/javascript">
|
|
||||||
$('#form-search').submit(function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
url = '/submissions';
|
|
||||||
qs = [];
|
|
||||||
$(['problem_id', 'submitter', 'min_score', 'max_score', 'language']).each(function () {
|
|
||||||
if ($('#input-' + this).val()) {
|
|
||||||
qs.push(this + '=' + encodeURIComponent($('#input-' + this).val()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (qs.length > 0) {
|
|
||||||
url += '?' + qs.join('&');
|
|
||||||
}
|
|
||||||
location.href = url;
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<div class="top-buffer-sm"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
Loading…
Reference in New Issue
Block a user