mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 06:34:40 +00:00
[dir view] check quota for fileupload
This commit is contained in:
@@ -111,6 +111,7 @@
|
||||
|
||||
<div id="cur-dir-ops" class="inline-block">
|
||||
<% if (user_perm == 'rw') { %>
|
||||
<% if (!no_quota) { %>
|
||||
<div id="basic-upload" class="inline-block">
|
||||
<button class="op-btn basic-upload-btn" >{% trans "Upload" %}</button>
|
||||
<input id="basic-upload-input" class="hide" type="file" name="file" multiple />
|
||||
@@ -130,6 +131,9 @@
|
||||
</ul>
|
||||
</div>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
<button class="op-btn btn-disabled" disabled="disabled" title="{% trans "Out of quota" %}">{% trans "Upload" %}</button>
|
||||
<% } %>
|
||||
<button id="add-new-dir" class="op-btn">{% trans "New Folder" %}</button>
|
||||
<button id="add-new-file" class="op-btn">{% trans "New File" %}</button>
|
||||
<% } %>
|
||||
|
@@ -330,6 +330,8 @@ def list_lib_dir(request, repo_id):
|
||||
result["is_virtual"] = repo.is_virtual
|
||||
result["repo_name"] = repo.name
|
||||
result["user_perm"] = user_perm
|
||||
# check quota for fileupload
|
||||
result["no_quota"] = True if seaserv.check_quota(repo.id) < 0 else False
|
||||
result["encrypted"] = repo.encrypted
|
||||
|
||||
dirent_list = []
|
||||
|
@@ -20,6 +20,7 @@ define([
|
||||
parse: function (data) {
|
||||
this.repo_name = data.repo_name;
|
||||
this.user_perm = data.user_perm;
|
||||
this.no_quota = data.no_quota;
|
||||
this.encrypted = data.encrypted;
|
||||
this.is_repo_owner = data.is_repo_owner;
|
||||
this.is_virtual = data.is_virtual;
|
||||
|
@@ -219,6 +219,9 @@ define([
|
||||
if (!dir.user_perm || dir.user_perm != 'rw') {
|
||||
return;
|
||||
}
|
||||
if (dir.no_quota) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $popup = this.fileUploadView.$el;
|
||||
|
||||
@@ -434,6 +437,7 @@ define([
|
||||
|
||||
this.$dir_op_bar.html($.trim(this.dir_op_bar_template({
|
||||
user_perm: dir.user_perm,
|
||||
no_quota: dir.no_quota,
|
||||
encrypted: dir.encrypted,
|
||||
mode: this.view_mode,
|
||||
path: dir.path,
|
||||
|
Reference in New Issue
Block a user