1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-13 05:39:59 +00:00

Fix bug in browser empty repo and encrypted repo

This commit is contained in:
xiez
2012-05-04 14:07:33 +08:00
parent 1b898331c7
commit 9f0fb355d1
2 changed files with 24 additions and 13 deletions

View File

@@ -3,6 +3,9 @@
{% block nav_home_class %}class="cur"{% endblock %}
{% block right_panel %}
{% if encrypted %}
<p>该同步目录已加密,无法在线浏览</p>
{% else %}
<h3>文件及目录列表</h3>
{% if dirs %}
<table class="repo-list default">
@@ -29,6 +32,7 @@
{% else %}
<p>暂无</p>
{% endif %}
{% endif %}
{% endblock %}
{% block extra_script %}

View File

@@ -323,22 +323,31 @@ def repo_list_dir(request, repo_id):
raise Http404
repo = seafserv_threaded_rpc.get_repo(repo_id)
dirs = []
encrypted = repo.props.encrypted
if not encrypted:
if not request.GET.get('root_id'): # No root id..?
# ..use HEAD commit's root id
commit = seafserv_rpc.get_commit(repo.props.head_cmmt_id)
root_id = commit.props.root_id
else:
root_id = request.GET.get('root_id')
try:
dirs = seafserv_rpc.list_dir(root_id)
for dirent in dirs:
if stat.S_ISDIR(dirent.props.mode):
dirent.is_dir = True
else:
dirent.is_dir = False
except:
pass
return render_to_response('repo_dir.html', {
"repo_id": repo_id,
"dirs": dirs,
"encrypted": encrypted,
},
context_instance=RequestContext(request))
@@ -401,11 +410,9 @@ def repo_list_share(request):
username = request.user.username
out_repos = seafserv_threaded_rpc.list_share_repos(username, 'from_email', -1, -1)
# in_repos = seafserv_threaded_rpc.list_share_repos(username, 'to_email', -1, -1)
return render_to_response('share_repos.html', {
"out_repos": out_repos,
# "in_repos": in_repos,
}, context_instance=RequestContext(request))
@login_required