mirror of
https://github.com/haiwen/seahub.git
synced 2025-10-21 02:42:26 +00:00
improved share_admin
This commit is contained in:
@@ -906,6 +906,7 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
.repo-op {
|
.repo-op {
|
||||||
text-align:right;
|
text-align:right;
|
||||||
}
|
}
|
||||||
|
#repo-setting-btn,
|
||||||
#recycle-btn,
|
#recycle-btn,
|
||||||
.file-op button,
|
.file-op button,
|
||||||
#file-op button,
|
#file-op button,
|
||||||
|
@@ -773,7 +773,7 @@ def org_share_permission_admin(request, url_prefix):
|
|||||||
try:
|
try:
|
||||||
seafserv_threaded_rpc.set_share_permission(repo_id, from_email, email_or_group, permission)
|
seafserv_threaded_rpc.set_share_permission(repo_id, from_email, email_or_group, permission)
|
||||||
except:
|
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)
|
return HttpResponse(json.dumps({'success': True}), content_type=content_type)
|
||||||
|
|
||||||
if share_type == 'group':
|
if share_type == 'group':
|
||||||
@@ -781,14 +781,14 @@ def org_share_permission_admin(request, url_prefix):
|
|||||||
try:
|
try:
|
||||||
seafserv_threaded_rpc.set_org_group_repo_permission(org_id, group_id, repo_id, permission)
|
seafserv_threaded_rpc.set_org_group_repo_permission(org_id, group_id, repo_id, permission)
|
||||||
except:
|
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)
|
return HttpResponse(json.dumps({'success': True}), content_type=content_type)
|
||||||
|
|
||||||
if share_type == 'public':
|
if share_type == 'public':
|
||||||
try:
|
try:
|
||||||
seafserv_threaded_rpc.set_org_inner_pub_repo(org_id, repo_id, permission)
|
seafserv_threaded_rpc.set_org_inner_pub_repo(org_id, repo_id, permission)
|
||||||
except:
|
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)
|
return HttpResponse(json.dumps({'success': True}), content_type=content_type)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
<div class="info-item">
|
<div class="info-item">
|
||||||
<h3 class="info-item-top">{% trans "Tips" %}</h3>
|
<h3 class="info-item-top">{% trans "Tips" %}</h3>
|
||||||
<div class="info-item-bottom">
|
<div class="info-item-bottom">
|
||||||
<p>{% blocktrans %}If you don't want others to change contents of library, you may set share permission to "read-only" when sharing it.{% endblocktrans %}</p>
|
<p>{% 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 %}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -71,8 +71,8 @@
|
|||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="empty-tips">
|
<div class="empty-tips">
|
||||||
<h2 class="center-contents">{% trans "You are not sharing any libraries" %}</h2>
|
<h2 class="center-contents">{% trans "You have not shared any library" %}</h2>
|
||||||
<p>{% blocktrans %}Share library to your friends and colleagues by clicking the "Share" icon near the library.{% endblocktrans %}</p>
|
<p>{% 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." %}</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -101,17 +101,18 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
<p id="link" class="hide"><input type="text" readonly="readonly" value="" id="shared-link" /></p>
|
<input type="text" readonly="readonly" value="" id="shared-link" class="hide" />
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="empty-tips">
|
<div class="empty-tips">
|
||||||
<h2 class="center-contents">{% trans "You don't have any file shared links"%}</h2>
|
<h2 class="center-contents">{% trans "You don't have any shared link"%}</h2>
|
||||||
<p>{% blocktrans %}Share files to your friends and colleagues by clicking "Share link" button on file viewing page. {% endblocktrans %}</p>
|
<p>{% trans "You can share a folder or a file when you view a library, or share a file when you view it." %}</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extra_script %}
|
{% block extra_script %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
{% if shared_repos %}
|
||||||
$('tr:gt(0)').hover(
|
$('tr:gt(0)').hover(
|
||||||
function() {
|
function() {
|
||||||
$(this).find('.share-permission-edit-icon').removeClass('vh');
|
$(this).find('.share-permission-edit-icon').removeClass('vh');
|
||||||
@@ -150,14 +151,12 @@ $('.share-permission-select').change(function() {
|
|||||||
if (data['success']) {
|
if (data['success']) {
|
||||||
feedback('{% trans "Edit succeeded" %}', 'success');
|
feedback('{% trans "Edit succeeded" %}', 'success');
|
||||||
select.prev().children('.share-permission-cur-value').html(select.children('option[value="' +select.val() + '"]').text());
|
select.prev().children('.share-permission-cur-value').html(select.children('option[value="' +select.val() + '"]').text());
|
||||||
} else {
|
|
||||||
feedback('{% trans "Edit failed" %}', 'error');
|
|
||||||
}
|
}
|
||||||
select.addClass('hide');
|
select.addClass('hide');
|
||||||
select.prev().removeClass('hide');
|
select.prev().removeClass('hide');
|
||||||
},
|
},
|
||||||
error: function(jqXHR, textStatus, errorThrown) {
|
error: function() {
|
||||||
feedback(textStatus + ',{% trans "edit failed" %}', 'error');
|
feedback('{% trans "Edit failed." %}', 'error');
|
||||||
select.addClass('hide');
|
select.addClass('hide');
|
||||||
select.prev().removeClass('hide');
|
select.prev().removeClass('hide');
|
||||||
}
|
}
|
||||||
@@ -175,17 +174,20 @@ $(document).click(function(e) {
|
|||||||
$('.cancel-share').click(function() {
|
$('.cancel-share').click(function() {
|
||||||
location.href = $(this).attr('data');
|
location.href = $(this).attr('data');
|
||||||
});
|
});
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if fileshares %}
|
||||||
$(".view-link").click(function() {
|
$(".view-link").click(function() {
|
||||||
var link = $(this).attr('data');
|
var link = $(this).attr('data');
|
||||||
$('#link').before('<p class="hide">' + link + '</p>');
|
$('#shared-link').before('<p class="hide">' + link + '</p>')
|
||||||
$('#shared-link').val(link).css('width', $('#link').prev().width() + 2);
|
.val(link).css('width', $('#shared-link').prev().width() + 2)
|
||||||
$("#link").modal({appendTo:'#main'});
|
.modal({focus:false});
|
||||||
$('#link').prev().remove();
|
$('#shared-link').prev().remove();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$('#shared-link').click(function() {
|
$('#shared-link').click(function() {
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -279,21 +279,21 @@ def share_permission_admin(request):
|
|||||||
try:
|
try:
|
||||||
seafserv_threaded_rpc.set_share_permission(repo_id, from_email, email_or_group, permission)
|
seafserv_threaded_rpc.set_share_permission(repo_id, from_email, email_or_group, permission)
|
||||||
except:
|
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)
|
return HttpResponse(json.dumps({'success': True}), content_type=content_type)
|
||||||
|
|
||||||
if share_type == 'group':
|
if share_type == 'group':
|
||||||
try:
|
try:
|
||||||
seafserv_threaded_rpc.set_group_repo_permission(int(email_or_group), repo_id, permission)
|
seafserv_threaded_rpc.set_group_repo_permission(int(email_or_group), repo_id, permission)
|
||||||
except:
|
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)
|
return HttpResponse(json.dumps({'success': True}), content_type=content_type)
|
||||||
|
|
||||||
if share_type == 'public':
|
if share_type == 'public':
|
||||||
try:
|
try:
|
||||||
seafserv_threaded_rpc.set_inner_pub_repo(repo_id, permission)
|
seafserv_threaded_rpc.set_inner_pub_repo(repo_id, permission)
|
||||||
except:
|
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)
|
return HttpResponse(json.dumps({'success': True}), content_type=content_type)
|
||||||
|
|
||||||
# 2 views for anonymous share:
|
# 2 views for anonymous share:
|
||||||
|
Reference in New Issue
Block a user