Merge pull request #142 from wuxianucw/master

ui: fix upload permission
This commit is contained in:
undefined authored and GitHub committed 2021-05-19 09:02:02 +08:00
commit cf57516bb8
4 files changed
+20 -10

No files matched your search

+10
View File
@@ -132,6 +132,7 @@ Confirm deleting the selected roles?: 您确定删除所选角色吗?
Confirm deleting this comment? Its replies will be deleted as well.: 确认删除这个评论吗?回复会被同时删除。
Confirm deleting this reply?: 确认删除这个回复吗?
Confirm removing the selected users?: 您确定将所选用户移除吗?
Confirm to delete the selected files?: 确认删除所选文件吗?
Confirmation mail has been sent to your new email.: 确认邮件已经发送到您的新电子邮箱。
Congratulations! Your submission is accepted.: 恭喜!您的递交已评测通过。
Contact Us: 联系我们
@@ -306,6 +307,8 @@ Failed to join the domain. You are already a member.: 加入域失败,您已
Feedback: 反馈
Field {0} or {1} validation failed.: 字段 {0} 或 {1} 验证失败。
Field {0} validation failed.: 字段 {0} 验证失败。
File saved.: 文件已成功保存。
file too large: 文件过大
File uploaded successfully.: 上传文件成功
File: 文件
Filename: 文件名
@@ -406,6 +409,8 @@ Links: 链接
List View: 列表视图
Live: 正在进行
Live...: 正在进行…
Loading editor...: 正在加载编辑器...
Loading file...: 正在加载文件内容...
Location: 位置
Login to Attend Contest: 登录后参加比赛
Login to Claim Homework: 登录后认领作业
@@ -525,6 +530,7 @@ Pick a problem randomly based on current filter: 根据当前过滤条件随机
Plan: 计划
Please attend contest to see the problems.: 请参加比赛来查看题目。
Please claim the assignment to see the problems.: 认领作业后才可以查看作业内容。
Please select at least one file to perform this operation.: 请选择至少一个文件来执行此操作。
Please select at least one role to perform this operation.: 请选择至少一个角色来进行操作。
Please select at least one user to perform this operation.: 请选择至少一个用户来进行操作。
Preference Settings: 偏好设置
@@ -560,6 +566,7 @@ problem.import.output_format: '## 输出格式'
problem.import.problem_description: '## 题目描述'
Problems Sets: 题库
Problems: 题目
Processing...: 处理中...
Profile Background Image: 背景图片
Progress: 进度
Properties: 属性
@@ -625,6 +632,7 @@ Sample Input: 输入数据
Sample Output: 输出数据
Save All Changes: 保存所有修改
Saved session: 已保存的会话
Saving file...: 正在保存文件...
score canceled: 成绩取消
Score: 分数
Scoreboard (Hidden): 成绩表 (隐藏)
@@ -638,6 +646,7 @@ Security: 安全
Select a node to create discussion.: 选择一个节点来发表讨论。
Select a role: 选择一个角色
Select User: 选择用户
Selected files have been deleted.: 所选文件已被删除。
Selected roles have been deleted.: 所选角色已删除。
Selected users have been removed from the domain.: 所选用户已从此域中移除。
Send Code after acceptance: 通过题目后发送源代码
@@ -835,6 +844,7 @@ You can create your own training plans and share with others.: 您可以创建
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.: 该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
You cannot submit for this problem because the homework's deadline is due.: 作业已超过截止时间,您无法递交本题目。
You cannot visit this domain.: 您不能访问此域。
You don't have permission to upload file.: 您没有权限上传文件。
You don't have the required permission ({0}) in this domain.: 您在该域中无相应权限 ({0})。
You don't have the required privilege.: 您没有相应的特权。
You don't own any domain and don't have privilege to create domain.: 您不拥有任何域也没有创建域的特权。
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.8.27",
"version": "4.8.28",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",
@@ -88,12 +88,12 @@ const page = new NamedPage('problem_files', () => {
Notification.info(i18n('Uploading files...'));
window.addEventListener('beforeunload', onBeforeUnload);
const dialog = new Dialog({
$body: `\
<div class="file-label" style="text-align: center;margin: 5px 0;color: gray;font-size: small;"></div>
$body: `
<div class="file-label" style="text-align: center; margin-bottom: 5px; color: gray; font-size: small;"></div>
<div class="bp3-progress-bar bp3-intent-primary bp3-no-stripes">
<div class="file-progress bp3-progress-meter" style="width: 0"></div>
</div>
<div class="upload-label" style="text-align: center;margin-bottom: 8px;color: gray;"></div>
<div class="upload-label" style="text-align: center; margin: 5px 0; color: gray; font-size: small;"></div>
<div class="bp3-progress-bar bp3-intent-primary bp3-no-stripes">
<div class="upload-progress bp3-progress-meter" style="width: 0"></div>
</div>`,
@@ -185,11 +185,11 @@ const page = new NamedPage('problem_files', () => {
* @param {JQuery.DropEvent<HTMLElement, undefined, HTMLElement, HTMLElement>} ev
*/
function handleDrop(type, ev) {
if (!$('[name="remove_selected_testdata"]').length) {
ev.preventDefault();
if (!$('[name="upload_testdata"]').length) {
Notification.error(i18n("You don't have permission to upload file."));
return;
}
ev.preventDefault();
ev = ev.originalEvent;
const files = [];
if (ev.dataTransfer.items) {
@@ -261,7 +261,7 @@ const page = new NamedPage('problem_files', () => {
await pjax.request({ push: false });
}
if ($('[name="remove_selected_testdata"]').length) {
if ($('[name="upload_testdata"]').length) {
$('.problem-files-testdata .col--name').on('click', (ev) => handleEdit('testdata', ev));
$('.problem-files-additional_file .col--name').on('click', (ev) => handleEdit('additional_file', ev));
$('[name="upload_testdata"]').on('click', () => handleClickUpload('testdata'));
@@ -186,9 +186,9 @@ async function handleOperation(operation) {
if (operation === 'delete') {
const action = await new ConfirmDialog({
$body: tpl`
<div class="typo">
<p>${i18n('Confirm to delete the selected problems?')}</p>
</div>`,
<div class="typo">
<p>${i18n('Confirm to delete the selected problems?')}</p>
</div>`,
}).open();
if (action !== 'yes') return;
}