{include "header.inc.html"}

<table class="table-ca table-list roleTable" style="width:100%;">
<tr>
<th class="w100">用户</th><th>所有权限</th>
</tr>
{foreach from=$roles item=role}
<tr><td>{$role.userId}</td><td>
<form action="/qkadmin/role/" method="post" class="roleForm">
<button class="correct_btn"><span>确定</span></button>
<input type="hidden" name="inajax" value="1" /><input type="hidden" name="act" value="edit" /><input type="hidden" name="userId" value="{$role.userId}" />
{foreach from=$action item=item}{if $item.parentId==0}<dl><dt><input type="checkbox" name="action[]" value="{$item.id}" id="{$role.userId}action{$item.id}"{if $item.id|in_array:$role.action} checked{/if}><label for="{$role.userId}action{$item.id}">{$item.name}</label></dt>
	{foreach from=$menus item=menu}{if $menu.parentId==$item.id}<dd><input type="checkbox" name="action[]" value="{$menu.id}" id="{$role.userId}action{$menu.id}"{if $menu.id|in_array:$role.action} checked{/if}><label for="{$role.userId}action{$menu.id}">{$menu.name}</label></dd>{/if}{/foreach}
</dl>{/if}{/foreach}
</form>

</td></tr>
{/foreach}
</table>
<script type="text/javascript">
$(function(){
	$("button.correct_btn").click(function(){ $(this).parent("form.roleForm").submit();return false; });
	$("form.roleForm").ajaxForm({ dataType:'json',success:function(json){ if(json.success){ qlib.tips({ icon:'success',msg:json.message }); }else{ qlib.tips({ icon:'error',msg:json.message }); } }});
});
</script>

{include "footer.inc.html"}