From d712c818ac131caf357363ffc52517d6f56fe754 Mon Sep 17 00:00:00 2001 From: Gatuno Date: Wed, 31 Jan 2024 16:04:48 -0600 Subject: New autojudge setting on interface per problem. (#41) * First obey the global 'autojudge' setting per site. * Next, check the setting per problem per answer type. * By default autoanswer is enabled on all problems. --- src/admin/problem.php | 200 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) (limited to 'src/admin/problem.php') diff --git a/src/admin/problem.php b/src/admin/problem.php index 33e887c..9024544 100644 --- a/src/admin/problem.php +++ b/src/admin/problem.php @@ -194,6 +194,21 @@ if (isset($_POST["Submit3"]) && isset($_POST["problemnumber"]) && is_numeric($_P $param['fake'] = 'f'; $param['colorname'] = trim($_POST["colorname"]); $param['color'] = trim($_POST["color"]); + $autojudge_value = 0; + if (isset ($_POST["autojudge_new_sel"]) && in_array ($_POST['autojudge_new_sel'], array ('all', 'custom', 'none'))) { + $all_answers = DBGetAnswers($_SESSION["usertable"]["contestnumber"]); + for ($g = 0; $g < count ($all_answers); $g++) { + if ($all_answers[$g]['fake'] == 't') continue; + $campo = 'autojudge_chc_new_'.$all_answers[$g]['number']; + + if ($_POST['autojudge_new_sel'] == 'all') { + $autojudge_value |= pow (2, $g); + } else if ($_POST['autojudge_new_sel'] == 'custom' && isset ($_POST[$campo]) && $_POST[$campo] == "1") { + $autojudge_value |= pow (2, $g); + } + } + } + $param['autojudge'] = $autojudge_value; DBNewProblem ($_SESSION["usertable"]["contestnumber"], $param); } } @@ -222,6 +237,36 @@ for ($i=0; $i
+"; + } else echo " "; + echo "\n"; + echo " \n"; } echo ""; @@ -438,6 +584,60 @@ To replace the data of a problem, proceed as if it did not exist (data will be r + + Autojudge Setting: + + + +\n"; + printf ('', $g, $g); + echo "\n\n"; + } + echo "\n"; + for ($g = 0; $g < count($all_answers); $g++) { + if ($all_answers[$g]['fake'] == 't') continue; + printf ('\n"; + } + echo "
\n"; + ?> + + +
-- cgit v1.2.3