1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-02 07:47:32 +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

View File

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

View File

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

View File

@ -24,7 +24,15 @@ def show_profile(request):
profile_timestamp = translate_time_usec(profile_timestamp) profile_timestamp = translate_time_usec(profile_timestamp)
except: except:
profile_timestamp = None 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', { return render_to_response('profile/profile.html', {
'userid_list': userid_list, 'userid_list': userid_list,
@ -90,6 +98,14 @@ def download_profile(request):
def list_userids(request): def list_userids(request):
userid_list = get_binding_userids(request.user.username) 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', return render_to_response('profile/user_ids.html',
{'userid_list': userid_list}, {'peer_list': peer_list},
context_instance=RequestContext(request)) context_instance=RequestContext(request))