diff --git a/models/problem.js b/models/problem.js
index 79be434..1f15fa0 100644
--- a/models/problem.js
+++ b/models/problem.js
@@ -223,8 +223,8 @@ class Problem extends Model {
is_public: false,
file_io: false,
- file_io_input_name: 'data.in',
- file_io_output_name: 'data.out'
+ file_io_input_name: '',
+ file_io_output_name: ''
}, val)));
}
diff --git a/modules/problem.js b/modules/problem.js
index ddc4028..6766fb6 100644
--- a/modules/problem.js
+++ b/modules/problem.js
@@ -84,6 +84,7 @@ app.get('/problem/:id/edit', async (req, res) => {
let problem = await Problem.fromID(id);
if (!problem) {
+ if (!res.locals.user) throw 'Permission denied.';
problem = await Problem.create();
problem.id = id;
problem.allowedEdit = true;
diff --git a/views/problem_data.ejs b/views/problem_data.ejs
index 2e086a7..81c1a31 100644
--- a/views/problem_data.ejs
+++ b/views/problem_data.ejs
@@ -116,7 +116,7 @@ let subtaskType = {
<% } %>
-
+
@@ -134,5 +134,18 @@ function goDisable() {
document.getElementById('file-io-input-name').disabled = true;
document.getElementById('file-io-output-name').disabled = true;
}
+
+$(document).ready(function () {
+ $('#file-io-input-name').on('input keyup change', function (e) {
+ var prob = $('#file-io-input-name').val();
+ if (prob.lastIndexOf('.') !== -1) prob = prob.substring(0, prob.lastIndexOf('.'));
+ $('#file-io-output-name').attr('placeholder', prob + '.out');
+ });
+ $('#file-io-output-name').focus(function (e) {
+ if (!$('#file-io-output-name').val()) {
+ $('#file-io-output-name').val($('#file-io-output-name').attr('placeholder'));
+ }
+ });
+});
<% include footer %>
diff --git a/views/problems.ejs b/views/problems.ejs
index c253b53..bbbf7e2 100644
--- a/views/problems.ejs
+++ b/views/problems.ejs
@@ -1,13 +1,15 @@
<% this.title = '题库' %>
<% include header %>
-
-
-
-
添加题目
+ <% if (user) { %>
+
-
+ <% } %>
diff --git a/views/submission_content.ejs b/views/submission_content.ejs
index e913645..9477ce4 100644
--- a/views/submission_content.ejs
+++ b/views/submission_content.ejs
@@ -106,7 +106,7 @@ for (let s of judge.result.subtasks) {
<% } %>
<% for (let i = 0; i < subtask_cases.case_num; i++) { %>
<% let testcase = subtask_cases[i]; %>
- style="cursor: auto; "<% } %>>
+
style="cursor: auto; "<% } %>>