1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-01 23:38:37 +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; }
.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;

View File

@ -1,61 +1,76 @@
{% extends "myhome_base.html" %}
{% load seahub_tags %}
{% block left_panel %}
<ul>
<li><a href="{{ SITE_ROOT }}repo/history/{{repo.props.id}}/">历史</a></li>
</ul>
{% endblock %}
{% block right_panel %}
<h2>{{repo.props.name}}</h2>
<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 %}
{% block main_panel %}
<div id="repo-page" class="ovhd">
<div class="side fleft">
<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' %}
<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 %}
<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 %}
<span class="tip">开启后,任何人都能够访问该目录</span>
{% else %}
<span>只有同步目录拥有者可设置</span>
{% endif %}
</p>
<br /><span class="tip">开启后,任何人都能够访问该目录</span>
{% else %}
<span>只有同步目录拥有者可设置</span>
{% endif %}
</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 class="mgt10">子目录及文件</h3>
{% if repo.props.encrypted %}
<p>该同步目录已加密,不能在线查看。</p>
{% else %}
<table class="repo-list">
<tr>
<th width="60%">名字</th>
<th width="40%">操作</th>
</tr>
<h3>文件及目录列表</h3>
{% if dirs %}
<table class="repo-list default">
<tr>
<th width="70%">名字</th>
<th width="30%">操作</th>
</tr>
{% for dirent in dirs %}
<tr>
{% 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></td>
{% else %}
<td>{{ dirent.props.obj_name }}</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/download/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}" class="download-btn">下载</button>
</td>
{% endif %}
</tr>
{% endfor %}
</table>
{% else %}
<p>暂无</p>
{% endif %}
<div id="public-access-start-confirm" class="hide">
<p>确定要开启吗?</p>
<button id="public-access-start-btn">确定</button>
<button id="public-access-start-cancel-btn" class="simplemodal-close">取消</button>
{% for dirent in dirs %}
<tr>
{% if dirent.is_dir %}
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/?root_id={{ dirent.props.obj_id }}">{{ dirent.props.obj_name }}</a></td>
<td></td>
{% else %}
<td>{{ dirent.props.obj_name }}</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/download/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}" class="download-btn">下载</button>
</td>
{% endif %}
</tr>
{% endfor %}
</table>
{% endif %}
</div>
<div id="public-access-start-confirm" class="hide">
<p>确定要开启吗?</p>
<button id="public-access-start-btn">确定</button>
<button id="public-access-start-cancel-btn" class="simplemodal-close">取消</button>
</div>
</div>
{% endblock %}

View File

@ -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,