Browse Source

Merge branch 'master' of github.com:syzoj/syzoj

pull/6/head
Menci 8 years ago
parent
commit
121b83fa7a
  1. 4
      models/problem.js
  2. 1
      modules/problem.js
  3. 15
      views/problem_data.ejs
  4. 12
      views/problems.ejs
  5. 2
      views/submission_content.ejs

4
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)));
}

1
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;

15
views/problem_data.ejs

@ -116,7 +116,7 @@ let subtaskType = {
</div>
<% } %>
<div class="field">
<label for="testdata">更新测试数据</label>
<label for="testdata"><% if (!problem.testdata_id) { %>上传测试数据<% } else { %>更新测试数据<% } %></label>
<input type="file" id="testdata" name="testdata">
</div>
<button type="submit" class="ui button">提交</button>
@ -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'));
}
});
});
</script>
<% include footer %>

12
views/problems.ejs

@ -1,13 +1,15 @@
<% this.title = '题库' %>
<% include header %>
<div class="padding">
<div class="ui grid">
<div class="row">
<div class="column">
<a href="<%= syzoj.utils.makeUrl(['problem', 0, 'edit']) %>" class="ui mini right floated button">添加题目</a>
<% if (user) { %>
<div class="ui grid">
<div class="row">
<div class="column">
<a href="<%= syzoj.utils.makeUrl(['problem', 0, 'edit']) %>" class="ui mini right floated button">添加题目</a>
</div>
</div>
</div>
</div>
<% } %>
<table class="ui very basic center aligned table">
<thead>
<tr>

2
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]; %>
<div class="title<% if (testcase.pending) { %> testcase.pending<% } %> auto_update"<% if (testcase.pending) { %> style="cursor: auto; "<% } %>>
<div class="title<% if (testcase.pending) { %> pending<% } %> auto_update"<% if (testcase.pending) { %> style="cursor: auto; "<% } %>>
<div class="ui grid">
<div class="three wide column"><i class="dropdown icon"></i>测试点 #<%= i + 1 %></div>
<div class="four wide column status status_detail <%= getStatusMeta(testcase.status).toLowerCase().split(' ').join('_') %>">

Loading…
Cancel
Save