From 85485eda22e4db51e74fca925ad4d43bb404b847 Mon Sep 17 00:00:00 2001 From: llj Date: Thu, 10 Jan 2013 16:13:40 +0800 Subject: [PATCH] improved share_admin --- media/css/seahub.css | 1 + organizations/views.py | 6 +++--- share/templates/repo/share_admin.html | 30 ++++++++++++++------------- share/views.py | 6 +++--- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/media/css/seahub.css b/media/css/seahub.css index 05a82c6232..507cd313ec 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -906,6 +906,7 @@ textarea:-moz-placeholder {/* for FF */ .repo-op { text-align:right; } +#repo-setting-btn, #recycle-btn, .file-op button, #file-op button, diff --git a/organizations/views.py b/organizations/views.py index e62f7b4e02..28b0141106 100644 --- a/organizations/views.py +++ b/organizations/views.py @@ -773,7 +773,7 @@ def org_share_permission_admin(request, url_prefix): try: seafserv_threaded_rpc.set_share_permission(repo_id, from_email, email_or_group, permission) except: - return HttpResponse(json.dumps({'success': False}), content_type=content_type) + return HttpResponse(json.dumps({'success': False}), status=400, content_type=content_type) return HttpResponse(json.dumps({'success': True}), content_type=content_type) if share_type == 'group': @@ -781,14 +781,14 @@ def org_share_permission_admin(request, url_prefix): try: seafserv_threaded_rpc.set_org_group_repo_permission(org_id, group_id, repo_id, permission) except: - return HttpResponse(json.dumps({'success': False}), content_type=content_type) + return HttpResponse(json.dumps({'success': False}), status=400, content_type=content_type) return HttpResponse(json.dumps({'success': True}), content_type=content_type) if share_type == 'public': try: seafserv_threaded_rpc.set_org_inner_pub_repo(org_id, repo_id, permission) except: - return HttpResponse(json.dumps({'success': False}), content_type=content_type) + return HttpResponse(json.dumps({'success': False}), status=400, content_type=content_type) return HttpResponse(json.dumps({'success': True}), content_type=content_type) @login_required diff --git a/share/templates/repo/share_admin.html b/share/templates/repo/share_admin.html index 593deb2bbc..2a9dc0b62d 100644 --- a/share/templates/repo/share_admin.html +++ b/share/templates/repo/share_admin.html @@ -14,7 +14,7 @@

{% trans "Tips" %}

-

{% blocktrans %}If you don't want others to change contents of library, you may set share permission to "read-only" when sharing it.{% endblocktrans %}

+

{% blocktrans %}If you don't want others to change the contents of your shared libraries, you can set the share permission to "read-only" when sharing them.{% endblocktrans %}

{% endblock %} @@ -71,8 +71,8 @@ {% else %}
-

{% trans "You are not sharing any libraries" %}

-

{% blocktrans %}Share library to your friends and colleagues by clicking the "Share" icon near the library.{% endblocktrans %}

+

{% trans "You have not shared any library" %}

+

{% trans "You can share libraries to your friends and colleagues by clicking the share icon of your own libraries in your home page or creating a new library in groups you are in." %}

{% endif %} @@ -101,17 +101,18 @@ {% endfor %} - + {% else %}
-

{% trans "You don't have any file shared links"%}

-

{% blocktrans %}Share files to your friends and colleagues by clicking "Share link" button on file viewing page. {% endblocktrans %}

+

{% trans "You don't have any shared link"%}

+

{% trans "You can share a folder or a file when you view a library, or share a file when you view it." %}

{% endif %} {% endblock %} {% block extra_script %} {% endblock %} diff --git a/share/views.py b/share/views.py index bc90d15a3f..97e323c45e 100644 --- a/share/views.py +++ b/share/views.py @@ -279,21 +279,21 @@ def share_permission_admin(request): try: seafserv_threaded_rpc.set_share_permission(repo_id, from_email, email_or_group, permission) except: - return HttpResponse(json.dumps({'success': False}), content_type=content_type) + return HttpResponse(json.dumps({'success': False}), status=400, content_type=content_type) return HttpResponse(json.dumps({'success': True}), content_type=content_type) if share_type == 'group': try: seafserv_threaded_rpc.set_group_repo_permission(int(email_or_group), repo_id, permission) except: - return HttpResponse(json.dumps({'success': False}), content_type=content_type) + return HttpResponse(json.dumps({'success': False}), status=400, content_type=content_type) return HttpResponse(json.dumps({'success': True}), content_type=content_type) if share_type == 'public': try: seafserv_threaded_rpc.set_inner_pub_repo(repo_id, permission) except: - return HttpResponse(json.dumps({'success': False}), content_type=content_type) + return HttpResponse(json.dumps({'success': False}), status=400, content_type=content_type) return HttpResponse(json.dumps({'success': True}), content_type=content_type) # 2 views for anonymous share: