diff --git a/web/app/controllers/problem_solutions.php b/web/app/controllers/problem_solutions.php index 590d5b5..d4cba7f 100644 --- a/web/app/controllers/problem_solutions.php +++ b/web/app/controllers/problem_solutions.php @@ -100,6 +100,29 @@ if (UOJProblem::cur()->userCanManage(Auth::user()) || UOJProblem::cur()->userPer ]); }; $add_new_solution_form->runAtServer(); + + if (UOJUser::checkPermission(Auth::user(), 'blogs.create')) { + $quick_add_new_solution_form = new UOJForm('quick_add_new_solution'); + $quick_add_new_solution_form->config['submit_container']['class'] = ''; + $quick_add_new_solution_form->config['submit_button']['class'] = 'btn btn-link text-decoration-none p-0'; + $quick_add_new_solution_form->config['submit_button']['text'] = '快速新建文章'; + $quick_add_new_solution_form->handle = function () { + DB::insert([ + "insert into blogs", + "(title, content, content_md, poster, is_hidden, post_time, active_time)", + "values", DB::tuple([ + '【题解】' . UOJProblem::cur()->getTitle(), '', '', + Auth::id(), false, DB::now(), DB::now() + ]) + ]); + + $blog_id = DB::insert_id(); + + redirectTo(HTML::blog_url(Auth::id(), "/post/{$blog_id}/write")); + die(); + }; + $quick_add_new_solution_form->runAtServer(); + } } $pag_config = [ @@ -261,18 +284,16 @@ $pag = new Paginator($pag_config); 您当前无法为本题新增题解。 -
+ + + - - + - +