<link href="styles/general.css" rel="stylesheet" type="text/css" />
<link href="styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/utils.js"></script>
<body>
<h1>
<span class="action-span"><a href="?ctl=system&act=system_admin"><tpl>$system_admin_list</tpl><!--管理员列表--></a></span>
<span class="action-span1"><a href="?ctl=index&act=admin_main"><tpl>$common_admin_index</tpl><!--管理首页--></a> >> <tpl>$system_admin_power</tpl><!--管理员权限设置-->&nbsp;[<a href="index.php?ctl=system&act=system_admin_add&admin_id=<tpl>$admin_info['admin_id']</tpl>"><tpl>$admin_info['admin_name']</tpl></a>]</span>
<div style="clear:both"></div>
</h1>
<form method="POST" action="index.php?ctl=system&act=system_admin_power_save" name="theFrom">
<div class="list-div">
<table cellspacing='1' id="list-table">
<tpl>foreach $admin_power as $key => $val</tpl>
 <tr>
  <td width="18%" valign="top" class="first-cell">
    <input name="chkGroup" type="checkbox" value="checkbox" onClick="check('<tpl>implode(',',$val)</tpl>',this);" class="checkbox"><tpl>$$key</tpl>
  </td>
  <td>
    <tpl>foreach $val as $v</tpl>
    <div style="width:200px;float:left;">
    <label for="<tpl>$v</tpl>"><input type="checkbox" name="power_code[]" value="<tpl>$v</tpl>" id="<tpl>$v</tpl>" class="checkbox"<tpl>if in_array($v,$power_array)</tpl>checked="checked"<tpl>/if</tpl> />
    <tpl>$$v</tpl></label>
    </div>
    <tpl>/foreach</tpl>
</td></tr>
<tpl>/foreach</tpl>
  <tr>
    <td align="center" colspan="2" ><br>
      <input type="checkbox" name="checkall" value="checkbox" onClick="checkAll(this.form, this);" class="checkbox" /><tpl>$system_admin_power_select</tpl><!--全选-->
      &nbsp;&nbsp;&nbsp;&nbsp;
      <input type="submit"   name="Submit"   value="<tpl>$system_admin_power_save</tpl>" class="button" />
      <input type="hidden"   name="admin_id"    value="<tpl>$_GET['admin_id']</tpl>" />
    </td>
  </tr>
</table>
</div>
</form>
<script language="javascript">
function checkAll(frm, checkbox)
{
  for (i = 0; i < frm.elements.length; i++)
  {
    if (frm.elements[i].name == 'power_code[]' || frm.elements[i].name == 'chkGroup')
    {
      frm.elements[i].checked = checkbox.checked;
    }
  }
}

function check(list, obj)
{
  var frm = obj.form;

    for (i = 0; i < frm.elements.length; i++)
    {
      if (frm.elements[i].name == "power_code[]")
      {
          var regx = new RegExp(frm.elements[i].value + "(?!_)", "i");

          if (list.search(regx) > -1) frm.elements[i].checked = obj.checked;
      }
    }
}
</script>
<div id="footer">
<tpl>$common_copyright</tpl>
</div>
</body>