2012-02-21 09:11:58 +00:00
|
|
|
|
{% extends "myhome_base.html" %}
|
|
|
|
|
|
2012-03-22 12:33:27 +00:00
|
|
|
|
{% block nav_useradmin_class %}class="cur"{% endblock %}
|
2012-03-09 02:31:35 +00:00
|
|
|
|
{% block left_panel %}
|
|
|
|
|
<ul>
|
|
|
|
|
<li><a href="{{ SITE_ROOT }}useradmin/add/">添加用户</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
2012-02-21 09:11:58 +00:00
|
|
|
|
{% block right_panel %}
|
|
|
|
|
|
|
|
|
|
<h2>所有用户</h2>
|
2012-03-22 12:33:27 +00:00
|
|
|
|
<table class="user-list">
|
2012-02-21 09:11:58 +00:00
|
|
|
|
<tr>
|
2012-03-22 12:33:27 +00:00
|
|
|
|
<th>邮箱</th>
|
|
|
|
|
<th>是否激活</th>
|
|
|
|
|
<th>个人 ID</th>
|
|
|
|
|
<th>角色</th>
|
|
|
|
|
<th>操作</th>
|
2012-02-21 09:11:58 +00:00
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
{% for user in users %}
|
|
|
|
|
<tr>
|
|
|
|
|
<td>{{ user.email }}</td>
|
2012-03-22 12:33:27 +00:00
|
|
|
|
{% if user.is_active %}
|
|
|
|
|
<td>已激活</td>
|
|
|
|
|
{% else %}
|
|
|
|
|
<td><button data="{{ SITE_ROOT }}useradmin/activate/{{ user.id }}/" class="activate">激活</button></td>
|
|
|
|
|
{% endif %}
|
2012-02-21 09:11:58 +00:00
|
|
|
|
{% if user.profile %}
|
|
|
|
|
<td>{{ user.profile.ccnet_user_id }}</td>
|
|
|
|
|
<td>
|
|
|
|
|
{% for role in user.role_list %}
|
2012-03-26 05:59:44 +00:00
|
|
|
|
{{ role }} <!--<button data="{{ SITE_ROOT }}useradmin/{{ user.profile.ccnet_user_id }}/role/remove/?role={{ role }}" class="role-delete-btn">删除</button>--><br />
|
2012-02-21 09:11:58 +00:00
|
|
|
|
{% endfor %}
|
|
|
|
|
</td>
|
2012-03-19 03:11:37 +00:00
|
|
|
|
{% else %}
|
|
|
|
|
<td></td>
|
|
|
|
|
<td></td>
|
|
|
|
|
{% endif %}
|
2012-03-17 06:05:21 +00:00
|
|
|
|
<td>
|
2012-03-19 03:11:37 +00:00
|
|
|
|
{% if user.profile %}
|
2012-03-26 05:59:44 +00:00
|
|
|
|
<!-- <button class="add-role-btn" userid="{{ user.profile.ccnet_user_id }}" email="{{ user.email }}">添加角色</button> -->
|
2012-03-19 03:11:37 +00:00
|
|
|
|
{% endif %}
|
2012-03-26 08:52:10 +00:00
|
|
|
|
<button class="remove-user-btn" data="{{ SITE_ROOT }}useradmin/{{ user.id }}/user/remove/">删除用户</button>
|
2012-03-17 06:05:21 +00:00
|
|
|
|
</td>
|
2012-02-21 09:11:58 +00:00
|
|
|
|
</tr>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</table>
|
|
|
|
|
|
2012-03-27 03:11:21 +00:00
|
|
|
|
<form id="add-role-form" action="" method="post" class="hide">
|
|
|
|
|
<p><span id="user_email"></span> 的新角色 (即 MyClient 等):</p>
|
|
|
|
|
<input id="id_role" type="text" name="role" /><br/>
|
|
|
|
|
<input id="id_summit" type="submit" value="提交" />
|
|
|
|
|
</form>
|
2012-03-18 12:43:51 +00:00
|
|
|
|
|
2012-03-26 08:52:10 +00:00
|
|
|
|
<div id="dialog-delete-confirm" class="center hide">
|
|
|
|
|
<p>确认要删除?</p>
|
|
|
|
|
<button id="yes-btn">删除</button>
|
2012-03-18 12:43:51 +00:00
|
|
|
|
<button class="simplemodal-close">取消</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
2012-02-21 09:11:58 +00:00
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
{% block extra_script %}
|
2012-03-22 12:33:27 +00:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$('.activate').each(function(){
|
|
|
|
|
$(this).click(function(){
|
|
|
|
|
location.href = $(this).attr('data');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
$(".add-role-btn").each(function() {
|
|
|
|
|
$(this).click(function() {
|
|
|
|
|
var url = "{{ SITE_ROOT }}useradmin/" + $(this).attr("userid") + "/role/add/";
|
|
|
|
|
$("#add-role-form").attr('action', url);
|
|
|
|
|
$("#add-role-form #user_email").html($(this).attr("email"));
|
2012-02-21 09:11:58 +00:00
|
|
|
|
$("#add-role-form").modal({appendTo: "#main"});
|
2012-03-22 12:33:27 +00:00
|
|
|
|
});
|
2012-02-21 09:11:58 +00:00
|
|
|
|
});
|
|
|
|
|
|
2012-03-26 08:52:10 +00:00
|
|
|
|
//delete confirm
|
|
|
|
|
var Del_url = "";
|
2012-03-22 12:33:27 +00:00
|
|
|
|
$(".remove-user-btn").each(function() {
|
|
|
|
|
$(this).click(function() {
|
2012-03-18 12:43:51 +00:00
|
|
|
|
$("#dialog-delete-confirm").modal({appendTo: "#main"});
|
2012-03-26 08:52:10 +00:00
|
|
|
|
Del_url = $(this).attr('data');
|
2012-03-22 12:33:27 +00:00
|
|
|
|
});
|
2012-03-17 06:05:21 +00:00
|
|
|
|
});
|
|
|
|
|
|
2012-03-26 08:52:10 +00:00
|
|
|
|
$('.role-delete-btn').each(function(){
|
|
|
|
|
$(this).click(function(){
|
|
|
|
|
$("#dialog-delete-confirm").modal({appendTo: "#main"});
|
|
|
|
|
Del_url = $(this).attr('data');
|
|
|
|
|
});
|
2012-03-18 12:43:51 +00:00
|
|
|
|
});
|
|
|
|
|
|
2012-03-26 08:52:10 +00:00
|
|
|
|
$('#yes-btn').click(function() {
|
|
|
|
|
location.href = Del_url;
|
2012-02-21 09:11:58 +00:00
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
{% endblock %}
|