2012-02-21 09:11:58 +00:00
{% extends "myhome_base.html" %}
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 >
< table class = "user-list default" >
< tr >
< th > 邮件< / th >
2012-02-24 03:23:54 +00:00
< td > 是否激活< / td >
2012-03-19 06:47:34 +00:00
< td > 个人 ID< / td >
2012-02-21 09:11:58 +00:00
< td > 角色< / td >
< td > 操作< / td >
< / tr >
{% for user in users %}
< tr >
< td > {{ user.email }}< / td >
2012-02-24 03:23:54 +00:00
< td > {{ user.is_active }}
{% if not user.is_active %}
< span class = "small-action-link" > (< a href = "{{ SITE_ROOT }}useradmin/activate/{{ user.id }}/" > 激活< / a > )< / span >
{% endif %}
< / td >
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-02-24 03:23:54 +00:00
{{ role }}< span class = "small-action-link" > (< a href = "{{ SITE_ROOT }}useradmin/{{ user.profile.ccnet_user_id }}/role/remove/?role={{ role }}" > 删除< / a > )< / span >
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-17 06:05:21 +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 %}
< button class = "remove-user-btn" userid = "{{ user.id }}" > 删除用户< / button >
2012-03-17 06:05:21 +00:00
< / td >
2012-02-21 09:11:58 +00:00
< / tr >
{% endfor %}
< / table >
< div class = "hidden" >
< form id = "add-role-form" action = "" method = "post" >
< p > < span id = "user_email" > < / span > 的新角色 (即 MyClient 等): < / p >
< input id = "id_role" type = "text" name = "role" / > < br / >
< input id = "id_summit" type = "submit" value = "Submit" / >
< / form >
< / div >
2012-03-18 12:43:51 +00:00
< div id = "dialog-delete-confirm" class = "hide" >
< p > < span class = "ui-icon ui-icon-alert" style = "float:left; margin:0 7px 20px 0;" > < / span > 确认要删除该用户?< / p >
< button class = "remove-user-confirm-btn" data = "" > 删除< / button >
< button class = "simplemodal-close" > 取消< / button >
< / div >
2012-02-21 09:11:58 +00:00
{% endblock %}
{% block extra_script %}
< script >
$(function() {
$(".add-role-btn").each(function(index, item) {
item.onclick = function() {
url = "{{ SITE_ROOT }}useradmin/" + $(item).attr("userid") + "/role/add/";
$("#add-role-form").attr( { action: url } );
$("#add-role-form #user_email").html($(item).attr("email"));
$("#add-role-form").modal({appendTo: "#main"});
}
});
2012-03-18 12:43:51 +00:00
//delete user dialog
var del_user_id = "";
2012-03-17 06:05:21 +00:00
$(".remove-user-btn").each(function(index, item) {
item.onclick = function() {
2012-03-18 12:43:51 +00:00
del_user_id = $(item).attr("userid");
$("#dialog-delete-confirm").modal({appendTo: "#main"});
2012-03-17 06:05:21 +00:00
}
});
2012-03-18 12:43:51 +00:00
$("button.remove-user-confirm-btn").click(function() {
location.href = "{{ SITE_ROOT }}useradmin/" + del_user_id + "/user/remove/";
});
2012-02-21 09:11:58 +00:00
});
< / script >
{% endblock %}