mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 06:34:40 +00:00
fixed bug for 'syncable share' & 'private share'
This commit is contained in:
@@ -3,13 +3,17 @@
|
||||
<h3 class="hd">{% trans 'Share %(name)s' %}</h3>
|
||||
<div id="file-share-tabs">
|
||||
<ul id="file-share-tabs-nav">
|
||||
{% if is_repo_owner %}
|
||||
<li id="private-share-tab"><a href="#private-share">{% trans "Private Share" %}</a></li>
|
||||
{% endif %}
|
||||
<li><a href="#link-share">{% trans "Share Link" %}</a></li>
|
||||
{% if ENABLE_SUB_LIBRARY and not repo.is_virtual %}
|
||||
{% if ENABLE_SUB_LIBRARY and not repo.is_virtual and is_repo_owner %}
|
||||
<li id="syncable-share-tab"><a href="#syncable-share">{% trans "Syncable Share" %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
|
||||
{% if is_repo_owner %}
|
||||
<div id="private-share">
|
||||
<form id="private-share-form" method="post" action="{% url 'gen_private_file_share' repo.id %}">{% csrf_token %}
|
||||
<select name="emails" class="w100" multiple="multiple"></select>
|
||||
@@ -20,6 +24,7 @@
|
||||
<input type="submit" value="{% trans "Submit"%}" />
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="link-share">
|
||||
<button id="gen-link-btn" class="hide">{% trans "Generate"%}</button>
|
||||
<div id="share-link-body" class="hide">
|
||||
@@ -39,7 +44,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if ENABLE_SUB_LIBRARY and not repo.is_virtual %}
|
||||
{% if ENABLE_SUB_LIBRARY and not repo.is_virtual and is_repo_owner %}
|
||||
<div id="syncable-share">
|
||||
<p class="sub-repo-create-tip hide">{% trans "You need to create a sub-library from this directory to let others sync it." %}</p>
|
||||
<button class="create-sub-repo hide">{% trans "Create" %}</button>
|
||||
|
@@ -87,7 +87,15 @@ function showSharePopup(op, name, aj_url, type, cur_path) {
|
||||
}, 10);
|
||||
});
|
||||
},
|
||||
error: ajaxErrorHandler
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
var err;
|
||||
if (xhr.responseText) {
|
||||
err = jQuery.parseJSON(xhr.responseText).error;
|
||||
} else {
|
||||
err = "{% trans "Failed. Please check the network." %}";
|
||||
}
|
||||
$('#syncable-share').append('<p class="error">' + err + '</p>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -311,6 +311,9 @@ def view_file(request, repo_id):
|
||||
obj_id, path)
|
||||
if not user_perm:
|
||||
return render_permission_error(request, _(u'Unable to view file'))
|
||||
|
||||
# check if the user is the owner or not, for 'private share'
|
||||
is_repo_owner = seafile_api.is_repo_owner(username, repo.id)
|
||||
|
||||
# get file type and extension
|
||||
filetype, fileext = get_file_type_and_ext(u_filename)
|
||||
@@ -412,6 +415,7 @@ def view_file(request, repo_id):
|
||||
search_repo_id = repo.id
|
||||
return render_to_response(template, {
|
||||
'repo': repo,
|
||||
'is_repo_owner': is_repo_owner,
|
||||
'obj_id': obj_id,
|
||||
'filename': u_filename,
|
||||
'path': path,
|
||||
|
Reference in New Issue
Block a user