mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +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>
|
<h3 class="hd">{% trans 'Share %(name)s' %}</h3>
|
||||||
<div id="file-share-tabs">
|
<div id="file-share-tabs">
|
||||||
<ul id="file-share-tabs-nav">
|
<ul id="file-share-tabs-nav">
|
||||||
|
{% if is_repo_owner %}
|
||||||
<li id="private-share-tab"><a href="#private-share">{% trans "Private Share" %}</a></li>
|
<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>
|
<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>
|
<li id="syncable-share-tab"><a href="#syncable-share">{% trans "Syncable Share" %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
{% if is_repo_owner %}
|
||||||
<div id="private-share">
|
<div id="private-share">
|
||||||
<form id="private-share-form" method="post" action="{% url 'gen_private_file_share' repo.id %}">{% csrf_token %}
|
<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>
|
<select name="emails" class="w100" multiple="multiple"></select>
|
||||||
@@ -20,6 +24,7 @@
|
|||||||
<input type="submit" value="{% trans "Submit"%}" />
|
<input type="submit" value="{% trans "Submit"%}" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div id="link-share">
|
<div id="link-share">
|
||||||
<button id="gen-link-btn" class="hide">{% trans "Generate"%}</button>
|
<button id="gen-link-btn" class="hide">{% trans "Generate"%}</button>
|
||||||
<div id="share-link-body" class="hide">
|
<div id="share-link-body" class="hide">
|
||||||
@@ -39,7 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</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">
|
<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>
|
<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>
|
<button class="create-sub-repo hide">{% trans "Create" %}</button>
|
||||||
|
@@ -87,7 +87,15 @@ function showSharePopup(op, name, aj_url, type, cur_path) {
|
|||||||
}, 10);
|
}, 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>');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -312,6 +312,9 @@ def view_file(request, repo_id):
|
|||||||
if not user_perm:
|
if not user_perm:
|
||||||
return render_permission_error(request, _(u'Unable to view file'))
|
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
|
# get file type and extension
|
||||||
filetype, fileext = get_file_type_and_ext(u_filename)
|
filetype, fileext = get_file_type_and_ext(u_filename)
|
||||||
|
|
||||||
@@ -412,6 +415,7 @@ def view_file(request, repo_id):
|
|||||||
search_repo_id = repo.id
|
search_repo_id = repo.id
|
||||||
return render_to_response(template, {
|
return render_to_response(template, {
|
||||||
'repo': repo,
|
'repo': repo,
|
||||||
|
'is_repo_owner': is_repo_owner,
|
||||||
'obj_id': obj_id,
|
'obj_id': obj_id,
|
||||||
'filename': u_filename,
|
'filename': u_filename,
|
||||||
'path': path,
|
'path': path,
|
||||||
|
Reference in New Issue
Block a user