diff --git a/media/css/seahub.css b/media/css/seahub.css index f46f957b62..0fd1c4c633 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -12,6 +12,7 @@ ul > li { list-style:none; } .ovhd { overflow:hidden; } .bold { font-weight:bold; } .mgb10 { margin-bottom:10px; } +.mgt10 { margin-top:10px; } .center { text-align:center; } .label { color:#333; font-size:12px; font-style:normal; } a { color:#ee8833; text-decoration:none; font-weight:bold; } @@ -91,6 +92,9 @@ input { margin:2px 0; border: 1px solid #80B0B0; } +input[type=checkbox] { + height:auto; +} input[type=submit], button { color: #080; @@ -206,11 +210,30 @@ input.ccnet_id { width: 400px; } margin-bottom: 12px; } /*repo page*/ +#repo-page .side { + width:250px; +} +#repo-page .main { + width:680px; +} .repo-desc { margin:0; } -#repo-access-switch { - height:auto; +.recent-commit { + margin:0; +} +.recent-commit li { + padding:0; + background:none; + color:#444; +} +.recent-commit .author { + font-style:italic; + margin-left:4px; +} +.recent-commit .time { + color:#666; + margin-left:2px; } .tip { color:#808080; diff --git a/templates/repo.html b/templates/repo.html index 4856fa35c4..b128f84500 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -1,61 +1,76 @@ {% extends "myhome_base.html" %} {% load seahub_tags %} -{% block left_panel %} - -{% endblock %} - -{% block right_panel %} -

{{repo.props.name}}

-

{{repo.props.desc}}

-

大小:{{ repo_size|filesizeformat }}

-

- WEB匿名访问: - {% if is_owner %} +{% block main_panel %} +

+
+

{{repo.props.desc}}

+

大小:{{ repo_size|filesizeformat }}

+

+ WEB匿名访问: + {% if is_owner %} {% if repo_ap == 'public' %} - + {% else %} - + {% endif %} - 开启后,任何人都能够访问该目录 - {% else %} - 只有同步目录拥有者可设置 - {% endif %} -

+
开启后,任何人都能够访问该目录 + {% else %} + 只有同步目录拥有者可设置 + {% endif %} +

+
+
+

{{repo.props.name}}

+ + 更多... + +

子目录及文件

+ {% if repo.props.encrypted %} +

该同步目录已加密,不能在线查看。

+ {% else %} + + + + + -

文件及目录列表

-{% if dirs %} -
名字操作
- - - - - - {% for dirent in dirs %} - - {% if dirent.is_dir %} - - - {% else %} - - - {% endif %} - - {% endfor %} -
名字操作
{{ dirent.props.obj_name }}{{ dirent.props.obj_name }} - - -
-{% else %} -

暂无

-{% endif %} - -
-

确定要开启吗?

- - + {% for dirent in dirs %} + + {% if dirent.is_dir %} + {{ dirent.props.obj_name }} + + {% else %} + {{ dirent.props.obj_name }} + + + + + {% endif %} + + {% endfor %} + + {% endif %} +
+
+

确定要开启吗?

+ + +
{% endblock %} diff --git a/views.py b/views.py index edc48b171d..237626b221 100644 --- a/views.py +++ b/views.py @@ -171,6 +171,8 @@ def repo(request, repo_id): repo = get_repo(repo_id) + recent_commits = get_commits(repo_id, 0, 3) + token = "" is_owner = False repo_ap = "" @@ -182,17 +184,28 @@ def repo(request, repo_id): repo_ap = seafserv_threaded_rpc.repo_query_access_property(repo_id) repo_size = seafserv_threaded_rpc.server_repo_size(repo_id) - commit = seafserv_rpc.get_commit(repo.props.head_cmmt_id) - root_id = commit.props.root_id - dirs = seafserv_rpc.list_dir(root_id) - for dirent in dirs: - if stat.S_ISDIR(dirent.props.mode): - dirent.is_dir = True + dirs = [] + if not repo.props.encrypted: + if not request.GET.get('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: - dirent.is_dir = False + 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.html', { "repo": repo, + "recent_commits": recent_commits, "is_owner": is_owner, "repo_ap": repo_ap, "repo_size": repo_size,