From ada3365e157fe458c7cd455fb5d82c846394a008 Mon Sep 17 00:00:00 2001 From: llj Date: Mon, 19 Sep 2016 18:24:28 +0800 Subject: [PATCH] [dir view] check quota for fileupload --- seahub/templates/js/templates.html | 4 ++++ seahub/views/ajax.py | 2 ++ static/scripts/app/collections/dirents.js | 1 + static/scripts/app/views/dir.js | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/seahub/templates/js/templates.html b/seahub/templates/js/templates.html index 98a51459f8..a8f1cf756d 100644 --- a/seahub/templates/js/templates.html +++ b/seahub/templates/js/templates.html @@ -111,6 +111,7 @@
<% if (user_perm == 'rw') { %> + <% if (!no_quota) { %>
@@ -130,6 +131,9 @@
<% } %> + <% } else { %> + + <% } %> <% } %> diff --git a/seahub/views/ajax.py b/seahub/views/ajax.py index c04576f285..7c9c550090 100644 --- a/seahub/views/ajax.py +++ b/seahub/views/ajax.py @@ -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 = [] diff --git a/static/scripts/app/collections/dirents.js b/static/scripts/app/collections/dirents.js index 065121650b..86f200dc16 100644 --- a/static/scripts/app/collections/dirents.js +++ b/static/scripts/app/collections/dirents.js @@ -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; diff --git a/static/scripts/app/views/dir.js b/static/scripts/app/views/dir.js index 28d440ace1..8ce0b488cc 100644 --- a/static/scripts/app/views/dir.js +++ b/static/scripts/app/views/dir.js @@ -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,