{include file="head.html"}
<div id="maincontent">
  <div class="wrap">
    <form action="__URL__/auth_edit" id="form" method="post">
      <div class="infobox">
        <h3>{lang='修改管理权限'} - {$info['name']}</h3>
        <table class="form-table">
          <tr>
          <td>
          <?php if(!empty($list)) foreach($list as $vo){?>
            <fieldset class="source">
              <legend>{$vo['name']} </legend>
              <?php $czlist=module('admin_group')->getauth($vo['id']); if(!empty($czlist)) foreach($czlist as $val){?>
              <input name="auth[]" type="checkbox" value="{$val['id']}" <?php if(in_array($val['id'],$info['power_value']) || in_array(-1,$info['power_value'])) echo "checked"?>>
              {$val['name']} &nbsp;&nbsp;
              <?php }?>
            </fieldset>
          <?php }?>
          </td>
        </tr>
        <tr>
          <td><input type="radio" value="" onclick = "selectAll('auth[]');">
            {lang='全选'} &nbsp;&nbsp;
            <input type="radio" value="" onclick = "selectInvert('auth[]');">
            {lang='反选'} &nbsp;&nbsp;
            <input type="radio" value="" onclick = "selectNone('auth[]');">
            {lang='取消'} &nbsp;&nbsp; </td>
        </tr>
        <tr>
          <td>{lang='注意：设置权限后需要重新登录才能使权限生效。'}</td>
        </tr>
        </table>
      </div>
      <div class="submit_body">
        <input name="psot_do" id="psot_do" type="hidden" value="yes" />
        <input name="id" id="id" type="hidden" value="{$info['id']}" />
        <button class="regular-button" type="button" onclick="post()">{lang='修改'}</button>
      </div>
    </form>
  </div>
</div>
<script>
function selectAll(name){   
    $("[name='"+name+"']").attr("checked",'true');//全选 ,name为input标签name属性值
}

function selectNone(name){   
    $("[name='"+name+"']").removeAttr("checked");//取消全选   
}
function selectInvert(name){   
    $("[name='"+name+"']").each(function(){//反选   
    if($(this).attr("checked")){   
          $(this).removeAttr("checked");   
    }else{   
          $(this).attr("checked",'true');   
    }   
    })   
}
</script>
</body></html>