You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

92 lines
3.5 KiB

<%
this.title = '测试数据';
function getIcon(filename) {
let a = {
'.cpp': 'file code outline',
'.c': 'file code outline',
'.cs': 'file code outline',
'.pas': 'file code outline',
'.py': 'file code outline',
'.js': 'file code outline',
'.java': 'file code outline',
'.hs': 'file code outline',
'.vala': 'file code outline',
'.lua': 'file code outline',
'.rb': 'file code outline',
'.vb': 'file code outline',
'.ml': 'file code outline',
'.in': 'file text outline',
'.out': 'file text outline',
'.ans': 'file text outline',
'.txt': 'file text outline',
'.md': 'file text outline',
'.md': 'file text outline',
'.docx': 'file word outline',
'.odt': 'file word outline',
'.xlsx': 'file excel outline',
'.ods': 'file excel outline',
'.pptx': 'file powerpoint outline',
'.odp': 'file powerpoint outline',
'.zip': 'file archive outline',
'.7z': 'file archive outline',
}
for (let x in a) if (filename.endsWith(x)) return a[x];
return 'file outline';
}
%>
<% include header %>
<div class="padding">
<div class="ui grid">
<div class="seven wide column">
<h3 style="text-align: center; ">测试点信息</h3>
<% include problem_testcases %>
</div>
<div class="nine wide column">
<h3 style="text-align: center; ">文件列表</h3>
<% if (testdata) { %>
<table class="ui very basic center aligned table">
<thead>
<tr>
<th class="left aligned">文件名</th>
<th style="width: 100px">文件大小</th>
<th style="width: 50px">操作</th>
</tr>
</thead>
<tbody>
<% if (testdata.zip) { %>
<tr>
<td class="left aligned"><i class="file archive outline icon"></i> 完整数据包</td>
<td><%= syzoj.utils.formatSize(testdata.zip.size) %></td>
<td><a style="color: #000; " href="<%= syzoj.utils.makeUrl(['problem', problem.id, 'testdata', 'download']) %>"><i class="download icon"></i></td>
</tr>
<% } %>
<% if (testdata.files) for (let file of testdata.files) { %>
<tr>
<td class="left aligned"><i class="<%= getIcon(file.filename) %> icon"></i> <%= file.filename %></td>
<td><%= syzoj.utils.formatSize(file.size) %></td>
<td><a style="color: #000; " href="<%= syzoj.utils.makeUrl(['problem', problem.id, 'testdata', 'download', file.filename]) %>"><i class="download icon"></i></td>
</tr>
<% } %>
</tbody>
</table>
<% } else { %>
<h4 style="text-align: center; ">无测试数据</h4>
<% } %>
<% if (problem.allowedEdit) { %>
<form class="ui form" action="<%= syzoj.utils.makeUrl(['problem', problem.id, 'testdata', 'upload']) %>" method="post" enctype="multipart/form-data">
<div class="inline fields">
<div class="field" style="margin: 0 auto; ">
<label for="answer">上传文件(可一次性上传多个)</label>
<input type="file" name="file" multiple>
<div class="ui center aligned vertical segment" style="padding-bottom: 0; ">
<button type="submit" class="ui button">提交</button>
<a href="<%= syzoj.utils.makeUrl(['problem', problem.id]) %>" class="ui blue button">返回题目</a>
</div>
</div>
</div>
</form>
<% } %>
</div>
</div>
</div>
<% include footer %>