mirror of
https://github.com/haiwen/seahub.git
synced 2025-10-21 10:51:17 +00:00
Modify profile page
This commit is contained in:
@@ -12,14 +12,31 @@
|
||||
{% block right_panel %}
|
||||
<h2>当前设置</h2>
|
||||
<ul>
|
||||
{% if user_id %}
|
||||
<li><span class="bold">个人 ID:</span>{{ user_id }}</li>
|
||||
{% endif %}
|
||||
<li><span class="bold">提示:</span>如需上传配置文件,请在本地 seafile 界面 "配置" 标签下上传</li>
|
||||
</ur>
|
||||
|
||||
{% if profile_timestamp %}
|
||||
<li><span class="bold">帐号文件:</span>您的加密后的帐号文件上传于{{ profile_timestamp }} <a href="{{ SITE_ROOT }}profile/download/?user_id={{ user_id }}">点此下载</a></li>
|
||||
{% else %}
|
||||
<li><span class="bold">配置文件:</span>您的配置文件还未上传,如需上传,请在本地 seafile 界面 "帐号" 标签下上传</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<table class="profile-dict">
|
||||
<tr>
|
||||
<th width="33%">个人ID</th>
|
||||
<th width="67">配置文件上传时间</th>
|
||||
</tr>
|
||||
{% if profile_dict %}
|
||||
{% for user_id,profile_ts in profile_dict.items %}
|
||||
<tr>
|
||||
<td>{{ user_id }}</td>
|
||||
{% if profile_ts %}
|
||||
<td>上传于{{ profile_ts }} <a href="{{ SITE_ROOT }}profile/download/?user_id={{ user_id }}">点此下载</a></td>
|
||||
{% else %}
|
||||
<td>未上传</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>暂无</td>
|
||||
<td>—— ——</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
@@ -16,50 +16,23 @@ from seaserv import ccnet_rpc, translate_time_usec, get_binding_userids
|
||||
def show_profile(request):
|
||||
userid_list = get_binding_userids(request.user.username)
|
||||
|
||||
try:
|
||||
profile_timestamp = ccnet_rpc.get_user_profile_timestamp(profile.ccnet_user_id)
|
||||
profile_timestamp = translate_time_usec(profile_timestamp)
|
||||
except:
|
||||
profile_timestamp = None
|
||||
profile_dict = {}
|
||||
|
||||
for user_id in userid_list:
|
||||
try:
|
||||
profile_timestamp = ccnet_rpc.get_user_profile_timestamp(user_id)
|
||||
profile_timestamp = translate_time_usec(profile_timestamp)
|
||||
except:
|
||||
profile_timestamp = None
|
||||
profile_dict[user_id] = profile_timestamp
|
||||
|
||||
return render_to_response('profile/profile.html', {
|
||||
'userid_list': userid_list,
|
||||
'profile_timestamp': profile_timestamp},
|
||||
'profile_dict': profile_dict,
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
|
||||
#@login_required
|
||||
#def set_profile(request):
|
||||
# error_msg = None
|
||||
# origin_id = None
|
||||
# if request.method == 'POST':
|
||||
# ccnet_user_id = request.POST.get('ccnet_user_id', '').strip()
|
||||
# origin_id = ccnet_user_id
|
||||
# if not ccnet_user_id:
|
||||
# error_msg = "You must specify Key ID"
|
||||
# elif len(ccnet_user_id) != 40:
|
||||
# error_msg = "Key ID must be of length 40"
|
||||
# elif ccnet_rpc.get_binding_email(ccnet_user_id) != None:
|
||||
# email = ccnet_rpc.get_binding_email(ccnet_user_id)
|
||||
# # user id has been binded by an email
|
||||
# error_msg = ("Key ID has been used by %s" % email)
|
||||
# else:
|
||||
# try:
|
||||
# ccnet_rpc.add_client(ccnet_user_id)
|
||||
# except Exception, e:
|
||||
# error_msg = "Ccnet Daemon is not available, try again later"
|
||||
# else:
|
||||
# ccnet_rpc.add_binding(request.user.username, ccnet_user_id)
|
||||
# return HttpResponseRedirect(reverse(show_profile))
|
||||
# else:
|
||||
# origin_id = ccnet_rpc.get_binding_userid(request.user.username)
|
||||
#
|
||||
# return render_to_response('profile/set_profile.html',
|
||||
# { 'error_msg': error_msg,
|
||||
# 'origin_id': origin_id },
|
||||
# context_instance=RequestContext(request))
|
||||
|
||||
|
||||
@login_required
|
||||
def get_ccnet_profile(request):
|
||||
try:
|
||||
|
Reference in New Issue
Block a user