From 8b45b03225b174abd20531a244cfddd0bf96b137 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Fri, 17 Feb 2023 16:50:32 +0800 Subject: [PATCH] feat(submission): finish refactor --- web/app/controllers/submission.php | 60 ++++++++++++++---------------- web/app/models/UOJSubmission.php | 17 +-------- web/css/uoj-bs5.css | 23 ++++++++++++ 3 files changed, 53 insertions(+), 47 deletions(-) diff --git a/web/app/controllers/submission.php b/web/app/controllers/submission.php index 57fb422..a0ec0a9 100644 --- a/web/app/controllers/submission.php +++ b/web/app/controllers/submission.php @@ -41,7 +41,7 @@ if ($can_see_minor) { redirectTo(UOJSubmission::cur()->getUriForNewTID($tid)); }; $minor_rejudge_form->config['submit_button']['class'] = 'list-group-item list-group-item-action border-start-0 border-end-0 list-group-item-secondary'; - $minor_rejudge_form->config['submit_button']['text'] = '偷偷重新测试'; + $minor_rejudge_form->config['submit_button']['text'] = ' 偷偷重新测试'; $minor_rejudge_form->config['submit_container']['class'] = ''; $minor_rejudge_form->runAtServer(); } @@ -94,7 +94,7 @@ if (UOJSubmission::cur()->isLatest()) { UOJSubmission::rejudgeById(UOJSubmission::info('id')); }; $rejudge_form->config['submit_button']['class'] = 'list-group-item list-group-item-action border-start-0 border-end-0 list-group-item-secondary'; - $rejudge_form->config['submit_button']['text'] = '重新测试'; + $rejudge_form->config['submit_button']['text'] = ' 重新测试'; $rejudge_form->config['submit_container']['class'] = ''; $rejudge_form->runAtServer(); } @@ -105,7 +105,7 @@ if (UOJSubmission::cur()->isLatest()) { UOJSubmission::cur()->delete(); }; $delete_form->config['submit_button']['class'] = 'list-group-item list-group-item-action border-start-0 border-end-0 list-group-item-danger'; - $delete_form->config['submit_button']['text'] = '删除此提交记录'; + $delete_form->config['submit_button']['text'] = ' 删除此提交记录'; $delete_form->config['submit_container']['class'] = ''; $delete_form->config['confirm']['text'] = '你真的要删除这条提交记录吗?'; $delete_form->succ_href = "/submissions"; @@ -118,7 +118,7 @@ if (UOJSubmission::cur()->isLatest()) { UOJSubmission::cur()->deleteThisMinorVersion(); }; $delete_form->config['submit_button']['class'] = 'list-group-item list-group-item-action border-start-0 border-end-0 list-group-item-danger'; - $delete_form->config['submit_button']['text'] = '删除当前历史记录(保留其他历史记录)'; + $delete_form->config['submit_button']['text'] = ' 删除当前历史记录'; $delete_form->config['submit_container']['class'] = ''; $delete_form->config['confirm']['text'] = '你真的要删除这条历史记录吗?删除这条历史记录不会影响其他的历史记录。'; $delete_form->succ_href = UOJSubmission::cur()->getUriForLatest(); @@ -167,7 +167,12 @@ if (UOJSubmission::cur()->hasJudged()) { 'card_body' => false, ]; } else { - // TODO: 您当前无法查看详细信息 + $tabs['details'] = [ + 'name' => '详细信息', + 'displayer' => function () { + echo '
您无权查看当前提交的详细信息。
'; + }, + ]; } if ($perm['manager_view'] && isset($submission_result['final_result'])) { @@ -182,14 +187,29 @@ if (UOJSubmission::cur()->hasJudged()) { ]; } } else { - // TODO: move judge_status from UOJSubmission::echoStatusCard() to here + $show_status_details = UOJSubmission::cur()->viewerCanSeeStatusDetailsHTML(Auth::user()); + + $tabs['details'] = [ + 'name' => '详细信息', + 'displayer' => function () { + echo '
'; + echo ''; + echo ''; + echo UOJSubmission::cur()->getStatusDetailsHTML(); + echo ''; + echo ''; + echo '
'; + echo '
'; + }, + 'card_body' => false, + ]; } if ($perm['content'] || $perm['manager_view']) { $tabs['source'] = [ 'name' => '源代码', 'displayer' => function () { - echo '
'; + echo '
'; UOJSubmission::cur()->echoContent(['list_group' => true]); echo '
'; }, @@ -243,29 +263,6 @@ if (isset($hack_form)) { - -
echoStatusCard(['show_actual_score' => $perm['score'], 'id_hidden' => true], Auth::user()) ?> @@ -314,7 +311,6 @@ if (isset($hack_form)) {
- -
+
printHTML() ?> diff --git a/web/app/models/UOJSubmission.php b/web/app/models/UOJSubmission.php index 6938ce2..e5003b4 100644 --- a/web/app/models/UOJSubmission.php +++ b/web/app/models/UOJSubmission.php @@ -588,8 +588,6 @@ class UOJSubmission { $cfg['show_actual_score'] = $this->viewerCanSeeScore($viewer); } - $show_status_details = $this->viewerCanSeeStatusDetailsHTML($viewer); - $rows = [ 'id' => 'ID', 'submitter' => UOJLocale::get('problems::submitter'), @@ -624,8 +622,8 @@ class UOJSubmission { break; default: echo '
'; - echo '', $name, ''; - echo '', $this->echoStatusBarTD($id, $cfg), ''; + echo '', $name, ''; + echo '', $this->echoStatusBarTD($id, $cfg), ''; echo '
'; break; @@ -635,17 +633,6 @@ class UOJSubmission { echo '
'; echo '
'; - - if ($show_status_details) { - echo '
'; - echo ''; - echo 'info['id']}", '" class="">'; - echo $this->getStatusDetailsHTML(); - echo ''; - echo ''; - echo '
'; - echo '
'; - } } public function delete() { diff --git a/web/css/uoj-bs5.css b/web/css/uoj-bs5.css index 0b13cfd..d3737c0 100644 --- a/web/css/uoj-bs5.css +++ b/web/css/uoj-bs5.css @@ -502,3 +502,26 @@ form.form-horizontal { padding-right: 0 !important; } } + +/* Submission Page */ + +.submission-layout { + /* display: grid; */ + grid-template-columns: 75% 25%; + grid-template-rows: auto 1fr; +} + +.submission-left-col { + grid-column: 1; + grid-row: 1 / span 2; +} + +.submission-right-col { + grid-column: 2; + grid-row: 1; +} + +.submission-right-control-panel { + grid-column: 2; + grid-row: 2; +}