From 886fb1a2fa7304e13f2d12d050be77d83c448d31 Mon Sep 17 00:00:00 2001
From: Baoshuo
Date: Sun, 29 Jan 2023 22:31:02 +0800
Subject: [PATCH] feat(problems): remote problems tab
---
web/app/controllers/list.php | 2 +-
web/app/controllers/problem_set.php | 22 ++++++++++++++--------
web/app/locale/problems/en.php | 1 +
web/app/locale/problems/zh-cn.php | 1 +
web/app/route.php | 3 ++-
5 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/web/app/controllers/list.php b/web/app/controllers/list.php
index 87ca60e..8060b9e 100644
--- a/web/app/controllers/list.php
+++ b/web/app/controllers/list.php
@@ -21,7 +21,7 @@ function getProblemTR($info) {
$html .= ' ' . UOJLocale::get('problems::my problem') . ' ';
}
if ($info['type'] == 'remote') {
- $html .= ' ' . HTML::tag('span', ['class' => 'badge text-bg-success'], '远端评测题');
+ HTML::tag('a', ['class' => 'badge text-bg-success', 'href' => '/problems/remote'], '远端评测题');
}
if ($info['is_hidden']) {
$html .= ' ' . UOJLocale::get('hidden') . ' ';
diff --git a/web/app/controllers/problem_set.php b/web/app/controllers/problem_set.php
index 581860d..9bb2b2a 100644
--- a/web/app/controllers/problem_set.php
+++ b/web/app/controllers/problem_set.php
@@ -95,7 +95,7 @@ function getProblemTR($info) {
$html .= ' ' . UOJLocale::get('problems::my problem') . ' ';
}
if ($info['type'] == 'remote') {
- $html .= ' ' . HTML::tag('span', ['class' => 'badge text-bg-success'], '远端评测题');
+ $html .= ' ' . HTML::tag('a', ['class' => 'badge text-bg-success', 'href' => '/problems/remote'], '远端评测题');
}
if ($info['is_hidden']) {
$html .= ' ' . UOJLocale::get('hidden') . ' ';
@@ -144,6 +144,8 @@ $search_is_effective = false;
$cur_tab = UOJRequest::get('tab', 'is_string', 'all');
if ($cur_tab == 'template') {
$search_tag = "模板题";
+} else if ($cur_tab == 'remote') {
+ $cond['type'] = 'remote';
}
if (is_string($search_tag)) {
$cond[] = [
@@ -202,16 +204,20 @@ $header .= '
' . UOJLocale::get('probl
$header .= ' | ' . UOJLocale::get('appraisal') . ' | ';
$header .= '';
-$tabs_info = array(
- 'all' => array(
+$tabs_info = [
+ 'all' => [
'name' => UOJLocale::get('problems::all problems'),
'url' => "/problems"
- ),
- 'template' => array(
+ ],
+ 'template' => [
'name' => UOJLocale::get('problems::template problems'),
'url' => "/problems/template"
- )
-);
+ ],
+ 'remote' => [
+ 'name' => UOJLocale::get('problems::remote problems'),
+ 'url' => "/problems/remote"
+ ],
+];
$pag = new Paginator([
'col_names' => ['*'],
@@ -393,7 +399,7 @@ $pag = new Paginator([
printHTML() ?>
-
+
新建远端评测题目
diff --git a/web/app/locale/problems/en.php b/web/app/locale/problems/en.php
index a7c1884..98bdbd2 100644
--- a/web/app/locale/problems/en.php
+++ b/web/app/locale/problems/en.php
@@ -4,6 +4,7 @@ return [
'problem list' => 'Problem List',
'all problems' => 'All Problems',
'template problems' => 'Template Problems',
+ 'remote problems' => 'Remote Problems',
'add new' => 'Add new problem',
'add new list' => 'Add new problem list',
'my problem' => 'My problem',
diff --git a/web/app/locale/problems/zh-cn.php b/web/app/locale/problems/zh-cn.php
index 580882f..3041f75 100644
--- a/web/app/locale/problems/zh-cn.php
+++ b/web/app/locale/problems/zh-cn.php
@@ -4,6 +4,7 @@ return [
'problem list' => '题单',
'all problems' => '总题库',
'template problems' => '模板题库',
+ 'remote problems' => '远程题库',
'add new' => '添加新题',
'add new list' => '添加新题单',
'my problem' => '我的题目',
diff --git a/web/app/route.php b/web/app/route.php
index 4916464..7906c5a 100644
--- a/web/app/route.php
+++ b/web/app/route.php
@@ -17,7 +17,8 @@ Route::group(
Route::any('/', '/index.php');
Route::any('/problems', '/problem_set.php');
Route::any('/problems/template', '/problem_set.php?tab=template');
- Route::any('/problems/new/remote', '/new_remote_problem.php');
+ Route::any('/problems/remote', '/problem_set.php?tab=remote');
+ Route::any('/problems/remote/new', '/new_remote_problem.php');
Route::any('/problem/{id}', '/problem.php');
Route::any('/problem/{id}/solutions', '/problem_solutions.php');
Route::any('/problem/{id}/statistics', '/problem_statistics.php');