<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<!--{$page_charset}-->" />

<title>管理员</title>
<!--{include file="<!--{$cptplpath}-->headerjs.tpl"}-->
<!--{assign var='pluginevent' value=XHook::doAction('adm_head')}-->
</head>
<body>
<!--{include file="<!--{$cptplpath}-->lang_all.tpl"}-->
<!--{assign var='pluginevent' value=XHook::doAction('adm_main_top')}-->
<!--{if $a eq "role"}-->
<div class="main-wrap">
  <div class="path"><p>当前位置：系统设置<span>&gt;&gt;</span>管理员设置<span>&gt;&gt;</span><a href="<!--{$cpfile}-->?c=admin&a=role">角色列表</a></p></div>
  <div class="main-cont">
    <h3 class="title"><a href="<!--{$cpfile}-->?c=admin&a=addrole" class="btn-general"><span>添加角色</span></a>角色列表</h3>
	<form action="<!--{$cpfile}-->?c=admin" method="post" name="myform" id="myform" style="margin:0">
	<input type="hidden" name="a" id="a" value="delrole" />
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table" align="center">
	  <thead class="tb-tit-bg">
	  <tr>
	    <th width="8%"><div class="th-gap">选择</div></th>
		<th width="10%"><div class="th-gap">ID</div></th>
		<th width="25%"><div class="th-gap">角色名称</div></th>
		<th width="30%"><div class="th-gap">描述</div></th>
		<th width="27%"><div class="th-gap">操作</div></th>
	  </tr>
	  </thead>
	  <tfoot class="tb-foot-bg"></tfoot>
	  <!--{foreach $admin as $volist}-->
	  <tr onMouseOver="overColor(this)" onMouseOut="outColor(this)">
	        <td  align="center"><input name="id[]" type="checkbox" value="<!--{$volist.groupid}-->" onClick="checkItem(this, 'chkAll')"></td>
		<td > <!--{$volist.groupid}--></td>
		
		<td><!--{$volist.groupname}--></td>
		<td ><!--{$volist.role_desc}--></td>
	
		<td align="center"><a href="<!--{$cpfile}-->?c=admin&a=editrole&id=<!--{$volist.groupid}-->&page=<!--{$page}-->" class="icon-edit">编辑</a>&nbsp;&nbsp;<a href="<!--{$cpfile}-->?c=admin&a=delrole&id[]=<!--{$volist.groupid}-->" onClick="{if(confirm('确定要删除吗?')){return true;} return false;}" class="icon-del">删除</a></td>
	  </tr>
	  <!--{foreachelse}-->
      <tr>
	    <td colspan="5" align="center">暂无信息</td>
	  </tr>
	  <!--{/foreach}-->
	  <!--{if $total>0}-->
	  <tr>
		<td align="center"><input name="chkAll" type="checkbox" id="chkAll" onClick="checkAll(this, 'id[]')" value="checkbox"></td>
		<td class="hback" colspan="7"><input class="button" name="btn_del" type="button" value="删 除" onClick="{if(confirm('确定删除选定吗!?')){$('#action').val('del');$('#myform').submit();return true;}return false;}" class="button">&nbsp;&nbsp;共[ <b><!--{$total}--></b> ]条记录</td>
	  </tr>
	  <!--{/if}-->
	</table>
	</form>
	<!--{if $pagecount>1}-->
	<table width='95%' border='0' cellspacing='0' cellpadding='0' align='center' style="margin-top:10px;">
	  <tr>
		<td align='center'><!--{$showpage}--></td>
	  </tr>
	</table>
	<!--{/if}-->
  </div>
</div>

<!--{/if}-->
<!--{if $a eq "addrole"}-->
<div class="main-wrap">
  <div class="path"><p>当前位置：系统设置<span>&gt;&gt;</span>管理员帐号<span>&gt;&gt;</span><a href="<!--{$cpfile}-->?c=admin&a=addrole">添加角色</a></p></div>
  <div class="main-cont">
	<h3 class="title"><a href="<!--{$cpfile}-->?c=admin&a=role" class="btn-general"><span>返回列表</span></a>添加角色</h3>
    <form name="myform" id="roleform" method="post" action="<!--{$cpfile}-->?c=admin" onsubmit='return checkform();' />
    <input type="hidden" name="a" value="saveaddrole" />
	<table cellpadding='3' cellspacing='3' class='tab'>
	  <tr>
		<td class='hback_1' width="15%">角色名称：<span class='f_red'>*</span></td>
		<td class='hback' width="85%"><input type="text" name="role_name" id="role_name" class="input-150" /> <span class='f_red' id="dadminname"></span> <font color="#999999"></font></td>
	  </tr>
	 
	  <tr>
		<td class='hback_1'>角色描述： </td>
		<td class='hback'><textarea name='desc' id='memo' style='width:50%;height:85px;overflow:auto;color:#444444;'></textarea></td>
	  </tr>
            <tr>
		<td class='hback_1'>权限分配： </td>
                <td class='hback' style="margin-top: 20px;">
                    				
					<div class="ncap-account-container" style="border-top:none; margin-left: 50px;">
						<h4>
							<input id="cls_full" onclick="choosebox(this)" type="checkbox">
							<label>全选</label>
						</h4>
					</div>
                                    <!--{foreach $modules as $key=>$volist}-->
                                                
                                                       <div style="border-top:none;line-height: 20px;display: block; min-height: 20px;padding: 15px 0 10px 0;">
                                                           <h4 style="font-size: 12px;
    width: 11%; float: left;
    ">
                                                                               <label> <!--{$key}--></label>
                                                                               <input value="1" cka="mod-<!--{$key}-->" type="checkbox">
                                                                               <label>全部</label>
                                                                       </h4>
                                                                       <ul style="width: 86%;padding-left: 1%;border-left: dotted 1px #CCC; float: left;">
                                                                            <!--{foreach $volist as $vo}-->
                                                                            <li style="font-size: 12px;line-height: 20px; color: #999;vertical-align: top;letter-spacing: normal;word-spacing: normal; display: inline-block; width: 150px; height: 20px;margin-bottom: 5px;">
                                                                                           <label>
                                                                                <input class="checkbox" name="right[]" value="<!--{$vo.id}-->"<!--{if $vv.enable eq "1"}-->checked<!--{/if}-->  ck="mod-<!--{$key}-->" type="checkbox">
                                                                                      <!--{$vo.name}-->
                                                                                </label>
                                                                            </li>
                                                                                     <!--{/foreach}-->
                                                                       </ul>
                                                               </div>
                                      <!--{/foreach}-->
					
				
                    </td>
	  </tr>
	  <tr>
		<td class='hback_none'></td>
		<td class='hback_none'><input type="submit" name="btn_save" class="button" value="添加保存" /></td>
	  </tr>
	</table>
	</form>
  </div>
  <div style="clear:both;"></div>
</div>
<!--{/if}-->

<!--{if $a eq "editrole"}-->
<div class="main-wrap">
  <div class="path"><p>当前位置：系统设置<span>&gt;&gt;</span>管理员帐号<span>&gt;&gt;</span>编辑帐号</p></div>
  <div class="main-cont">
	<h3 class="title"><a href="<!--{$cpfile}-->?c=admin&<!--{$comeurl}-->" class="btn-general"><span>返回列表</span></a>编辑帐号</h3>
    <form name="myform" id="myform" method="post" action="<!--{$cpfile}-->?c=admin" />
    <input type="hidden" name="a" value="saveeditrole" />
	<input type="hidden" name="id" value="<!--{$detail.groupid}-->" />
	<table cellpadding='3' cellspacing='3' class='tab'>
	  <tr>
		<td class='hback_1' width="15%">角色名称：<span class='f_red'>*</span></td>
		<td class='hback' width="85%"><input type="text" name="role_name" id="role_name" class="input-150" value="<!--{$detail.groupname}-->" /> <span class='f_red' id="dadminname"></span> <font color="#999999"></font></td>
	  </tr>
	 
	  <tr>
		<td class='hback_1'>角色描述： </td>
		<td class='hback'><textarea name='desc' id='memo' style='width:50%;height:85px;overflow:auto;color:#444444;'><!--{$detail.role_desc}--></textarea></td>
	  </tr>
            <tr>
		<td class='hback_1'>权限分配： </td>
                <td class='hback' style="margin-top: 20px;">
                    				
					<div class="ncap-account-container" style="border-top:none; margin-left: 50px;">
						<h4>
							<input id="cls_full" onclick="choosebox(this)" type="checkbox">
							<label>全选</label>
						</h4>
					</div>
                                    <!--{foreach $modules as $key=>$volist}-->
                                                
                                                       <div style="border-top:none;line-height: 20px;display: block; min-height: 20px;padding: 15px 0 10px 0;">
                                                           <h4 style="font-size: 12px;
    width: 11%; float: left;
    ">
                                                                               <label> <!--{$key}--></label>
                                                                               <input value="1" cka="mod-<!--{$key}-->" type="checkbox">
                                                                               <label>全部</label>
                                                                       </h4>
                                                                       <ul style="width: 86%;padding-left: 1%;border-left: dotted 1px #CCC; float: left;">
                                                                            <!--{foreach $volist as $vo}-->
                                                                            <li style="font-size: 12px;line-height: 20px; color: #999;vertical-align: top;letter-spacing: normal;word-spacing: normal; display: inline-block; width: 150px; height: 20px;margin-bottom: 5px;">
                                                                                           <label>
                                                                                <input class="checkbox" name="right[]" value="<!--{$vo.id}-->"<!--{if $vo.enable eq "1"}-->checked<!--{/if}-->  ck="mod-<!--{$key}-->" type="checkbox">
                                                                                      <!--{$vo.name}-->
                                                                                </label>
                                                                            </li>
                                                                                     <!--{/foreach}-->
                                                                       </ul>
                                                               </div>
                                      <!--{/foreach}-->
					
				
                    </td>
	  </tr>
	  <tr>
		<td class='hback_none'></td>
		<td class='hback_none'><input type="submit" name="btn_save" class="button" value="添加保存" /></td>
	  </tr>
	</table>
	</form>
  </div>
  <div style="clear:both;"></div>
</div>
<!--{/if}-->

</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
		$(":checkbox[cka]").click(function(){
			var $cks = $(":checkbox[ck='"+$(this).attr("cka")+"']");
			if($(this).is(':checked')){
				$cks.each(function(){$(this).prop("checked",true);});
			}else{
				$cks.each(function(){$(this).removeAttr('checked');});
			}
		});
	});
function choosebox(o){
		var vt = $(o).is(':checked');
		if(vt){
			$('input[type=checkbox]').prop('checked',vt);
		}else{
			$('input[type=checkbox]').removeAttr('checked');
		}
	}
 function checkform(){
     		if($('#role_name').val() == '' ){
			layer.alert('角色名称不能为空', {icon: 2});
			return false;
		}
		$('#roleform').submit();
 }

</script>
