1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-17 14:37:58 +00:00

modified repo

This commit is contained in:
llj 2012-05-04 21:36:36 +08:00
parent 14932fce0d
commit 4c24151f04
3 changed files with 111 additions and 60 deletions

View File

@ -12,6 +12,7 @@ ul > li { list-style:none; }
.ovhd { overflow:hidden; } .ovhd { overflow:hidden; }
.bold { font-weight:bold; } .bold { font-weight:bold; }
.mgb10 { margin-bottom:10px; } .mgb10 { margin-bottom:10px; }
.mgt10 { margin-top:10px; }
.center { text-align:center; } .center { text-align:center; }
.label { color:#333; font-size:12px; font-style:normal; } .label { color:#333; font-size:12px; font-style:normal; }
a { color:#ee8833; text-decoration:none; font-weight:bold; } a { color:#ee8833; text-decoration:none; font-weight:bold; }
@ -91,6 +92,9 @@ input {
margin:2px 0; margin:2px 0;
border: 1px solid #80B0B0; border: 1px solid #80B0B0;
} }
input[type=checkbox] {
height:auto;
}
input[type=submit], input[type=submit],
button { button {
color: #080; color: #080;
@ -206,11 +210,30 @@ input.ccnet_id { width: 400px; }
margin-bottom: 12px; margin-bottom: 12px;
} }
/*repo page*/ /*repo page*/
#repo-page .side {
width:250px;
}
#repo-page .main {
width:680px;
}
.repo-desc { .repo-desc {
margin:0; margin:0;
} }
#repo-access-switch { .recent-commit {
height:auto; 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 { .tip {
color:#808080; color:#808080;

View File

@ -1,61 +1,76 @@
{% extends "myhome_base.html" %} {% extends "myhome_base.html" %}
{% load seahub_tags %} {% load seahub_tags %}
{% block left_panel %} {% block main_panel %}
<ul> <div id="repo-page" class="ovhd">
<li><a href="{{ SITE_ROOT }}repo/history/{{repo.props.id}}/">历史</a></li> <div class="side fleft">
</ul> <p class="repo-desc">{{repo.props.desc}}</p>
{% endblock %} <p class="repo-size">大小:{{ repo_size|filesizeformat }}</p>
<p>
{% block right_panel %} <span class="item-name">WEB匿名访问:</span>
<h2>{{repo.props.name}}</h2> {% if is_owner %}
<p class="repo-desc">{{repo.props.desc}}</p>
<p class="repo-size">大小:{{ repo_size|filesizeformat }}</p>
<p>
<span class="item-name">WEB匿名访问:</span>
{% if is_owner %}
{% if repo_ap == 'public' %} {% if repo_ap == 'public' %}
<input type="checkbox" name="repo-access-switch" id="repo-access-switch" checked="checked" autocomplete="off" /><label for="repo-access-switch">开启</label> <input type="checkbox" name="repo-access-switch" id="repo-access-switch" checked="checked" autocomplete="off" /><label for="repo-access-switch">开启</label>
{% else %} {% else %}
<input type="checkbox" name="repo-access-switch" id="repo-access-switch" autocomplete="off" /><label for="repo-access-switch">开启</label> <input type="checkbox" name="repo-access-switch" id="repo-access-switch" autocomplete="off" /><label for="repo-access-switch">开启</label>
{% endif %} {% endif %}
<span class="tip">开启后,任何人都能够访问该目录</span> <br /><span class="tip">开启后,任何人都能够访问该目录</span>
{% else %} {% else %}
<span>只有同步目录拥有者可设置</span> <span>只有同步目录拥有者可设置</span>
{% endif %} {% endif %}
</p> </p>
</div>
<div class="main fright">
<h2>{{repo.props.name}}</h2>
<ul class="recent-commit">
{% for commit in recent_commits %}
<li>
{{ commit.props.desc }}
<span class="author">
{% if commit.props.creator_name %}
by {{ commit.props.creator_name }}
{% else %}
未知
{% endif %}
</span>
<span class="time">{{ commit.props.ctime|tsstr_sec }}</span>
</li>
{% endfor %}
</ul>
<a href="{{ SITE_ROOT }}repo/history/{{repo.props.id}}/" style="font-weight:normal;font-size:12px;color:#333;">更多...</a>
<h3>文件及目录列表</h3> <h3 class="mgt10">子目录及文件</h3>
{% if dirs %} {% if repo.props.encrypted %}
<table class="repo-list default"> <p>该同步目录已加密,不能在线查看。</p>
<tr> {% else %}
<th width="70%">名字</th> <table class="repo-list">
<th width="30%">操作</th> <tr>
</tr> <th width="60%">名字</th>
<th width="40%">操作</th>
</tr>
{% for dirent in dirs %} {% for dirent in dirs %}
<tr> <tr>
{% if dirent.is_dir %} {% if dirent.is_dir %}
<td><a href="{{ SITE_ROOT }}repo/dir/{{ repo.props.id }}/?root_id={{ dirent.props.obj_id }}">{{ dirent.props.obj_name }}</a></td> <td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/?root_id={{ dirent.props.obj_id }}">{{ dirent.props.obj_name }}</a></td>
<td></td> <td></td>
{% else %} {% else %}
<td>{{ dirent.props.obj_name }}</td> <td>{{ dirent.props.obj_name }}</td>
<td> <td>
<button data="{{ SITE_ROOT }}repo/view/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}" class="view-btn">查看</button> <button data="{{ SITE_ROOT }}repo/view/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}" class="view-btn">查看</button>
<button data="{{ SITE_ROOT }}repo/download/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}" class="download-btn">下载</button> <button data="{{ SITE_ROOT }}repo/download/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}" class="download-btn">下载</button>
</td> </td>
{% endif %} {% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% else %} {% endif %}
<p>暂无</p> </div>
{% endif %} <div id="public-access-start-confirm" class="hide">
<p>确定要开启吗?</p>
<div id="public-access-start-confirm" class="hide"> <button id="public-access-start-btn">确定</button>
<p>确定要开启吗?</p> <button id="public-access-start-cancel-btn" class="simplemodal-close">取消</button>
<button id="public-access-start-btn">确定</button> </div>
<button id="public-access-start-cancel-btn" class="simplemodal-close">取消</button>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -171,6 +171,8 @@ def repo(request, repo_id):
repo = get_repo(repo_id) repo = get_repo(repo_id)
recent_commits = get_commits(repo_id, 0, 3)
token = "" token = ""
is_owner = False is_owner = False
repo_ap = "" repo_ap = ""
@ -182,17 +184,28 @@ def repo(request, repo_id):
repo_ap = seafserv_threaded_rpc.repo_query_access_property(repo_id) repo_ap = seafserv_threaded_rpc.repo_query_access_property(repo_id)
repo_size = seafserv_threaded_rpc.server_repo_size(repo_id) repo_size = seafserv_threaded_rpc.server_repo_size(repo_id)
commit = seafserv_rpc.get_commit(repo.props.head_cmmt_id) dirs = []
root_id = commit.props.root_id if not repo.props.encrypted:
dirs = seafserv_rpc.list_dir(root_id) if not request.GET.get('root_id'):
for dirent in dirs: # ..use HEAD commit's root id
if stat.S_ISDIR(dirent.props.mode): commit = seafserv_rpc.get_commit(repo.props.head_cmmt_id)
dirent.is_dir = True root_id = commit.props.root_id
else: 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', { return render_to_response('repo.html', {
"repo": repo, "repo": repo,
"recent_commits": recent_commits,
"is_owner": is_owner, "is_owner": is_owner,
"repo_ap": repo_ap, "repo_ap": repo_ap,
"repo_size": repo_size, "repo_size": repo_size,