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

Modify user ids to peer names in profile page

This commit is contained in:
xiez 2012-04-18 21:18:31 +08:00
parent b86d7e82a1
commit f3d1d364c7
3 changed files with 28 additions and 14 deletions
profile

View File

@ -5,7 +5,7 @@
<h3>操作</h3>
<ul>
<li><a href="{{ SITE_ROOT }}accounts/password/change/">修改网站帐号密码</a></li>
<li><a href="{{ SITE_ROOT}}profile/userids/">列出所有个人ID</a></li>
<li><a href="{{ SITE_ROOT}}profile/userids/">列出所有计算机</a></li>
</ul>
{% endblock %}
@ -17,13 +17,13 @@
<table class="profile-dict">
<tr>
<th width="33%">个人ID</th>
<th width="33%">计算机</th>
<th width="67">配置文件上传时间</th>
</tr>
{% if profile_dict %}
{% for user_id,profile_ts in profile_dict.items %}
{% for peername,profile_ts in profile_dict.items %}
<tr>
<td>{{ user_id }}</td>
<td>{{ peername }}</td>
{% if profile_ts %}
<td>上传于{{ profile_ts }} <a href="{{ SITE_ROOT }}profile/download/?user_id={{ user_id }}">点此下载</a></td>
{% else %}

View File

@ -5,23 +5,21 @@
<h3>操作</h3>
<ul>
<li><a href="{{ SITE_ROOT }}accounts/password/change/">修改网站帐号密码</a></li>
<li><a href="{{ SITE_ROOT}}profile/userids/">列出所有个人ID</a></li>
<li><a href="{{ SITE_ROOT}}profile/userids/">列出所有计算机</a></li>
</ul>
{% endblock %}
{% block right_panel %}
<h2>所有个人ID</h2>
{% if userid_list %}
<h2>所有计算机</h2>
{% if peer_list %}
<table class="userid-list">
<tr>
<th>ID</th>
<th>操作</th>
<th>计算机</th>
</tr>
{% for user_id in userid_list %}
{% for peer in peer_list %}
<tr>
<td>{{ user_id }}</td>
<td>查看详情</td>
<td>{{ peer }}</td>
</tr>
{% endfor %}
</table>

View File

@ -24,7 +24,15 @@ def show_profile(request):
profile_timestamp = translate_time_usec(profile_timestamp)
except:
profile_timestamp = None
profile_dict[user_id] = profile_timestamp
try:
peernames = ccnet_rpc.get_peernames_by_userid(user_id)
for peername in peernames.split('\n'):
if not peername:
continue
profile_dict[peername] = profile_timestamp
except:
pass
return render_to_response('profile/profile.html', {
'userid_list': userid_list,
@ -90,6 +98,14 @@ def download_profile(request):
def list_userids(request):
userid_list = get_binding_userids(request.user.username)
peer_list = []
for userid in userid_list:
peernames = ccnet_rpc.get_peernames_by_userid(userid)
for peername in peernames.split('\n'):
if not peername:
continue
peer_list.append(peername)
return render_to_response('profile/user_ids.html',
{'userid_list': userid_list},
{'peer_list': peer_list},
context_instance=RequestContext(request))