<!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>
<title>vodcms.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link type="text/css" rel="stylesheet" href="<?php echo $this->basedir;?>images/admin/public.css" />
<link type="text/css" rel="stylesheet" href="<?php echo $this->basedir;?>images/admin/style.css" />
<link href="../../images/admin/public.css" rel="stylesheet" type="text/css" />
<link href="../../images/admin/style.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $this->basedir;?>js/jquery.js" language="javascript"></script>
<script language="javascript">
$(document).ready(function() {
     $("#ta tr").mouseover(function(){
      $(this).addClass("over");
     });
     $("#ta tr").mouseout(function(){
      $(this).removeClass("over");
     });
});
function selectAll(obj){
	var checked = obj.checked;
	var checkbox = obj.parentNode.parentNode.nextSibling.getElementsByTagName('input');
	for(i=0;i<checkbox.length;i++){
		checkbox[i].checked = checked;
	}
}
function showflag(v){
	if (v == 1){
		$('#myself').hide();
	}else{
		$('#myself').show();
	}
}
function check(){
	var obj = document.form1;
	if (obj.name.value == ''){
		alert('请填写组名称!');
		obj.name.focus();
		return false;
	}
	return true;
}
</script>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr align="center" valign="top">
  <td width="*" align="center" valign="top"><!-- ######### begin ######### -->
    <div class="Block">
      <div class="BlockBar">添加管理组</div>
      <form id="form1" name="form1" method="post" action="<?php echo $this->installdir;?>superman/add/" onsubmit="return check();">
        <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tab">
          <tr class="row">
            <td width="11%" align="right">组名称：</td>
            <td width="89%"><input name="name" type="text" id="name" />            </td>
          </tr>
          <tr class="row">
            <td align="right">管组类型：</td>
            <td><select name="flag" onchange="showflag(this.value)">
              <option value="1">超级管理</option>
              <option value="2">自定义权限</option>
            </select>
            </td>
          </tr>
          <tr class="row None" id="myself">
            <td align="right">权限控制：</td>
            <td>
              <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tab" id="ta">
                <?php
			foreach($this->parents as $row){?>
                <tr class="row">
                  <td width="126" align="left"><strong>
                    <input name="module[]" type="checkbox" class="checkbox" id="module[]" onclick="selectAll(this)" value="<?php echo $row['controller'];?>" />
                  <?php echo $row['name'];?></strong></td>
                  <td width="496" class="sd"><table width="98%" border="0" align="center" cellpadding="5" cellspacing="2" class="table2" style="border:1px dashed #EDEDED; margin:3px;">
                      <tr >
                        <td><?php
				foreach((array)$this->_Group->listMethod(" controller = '".$row['controller']."'") as $rs){?>
                          <input name="privileges[<?php echo $rs['controller'];?>][]" type="checkbox" class="checkbox" id="privileges[]  " value="<?php echo $rs['method'];?>" />
                          <?php echo $rs['comment'];?>
                          <?php
			  }?></td>
                      </tr>
                  </table></td>
                </tr>
                <?php
}?>
              </table>            </td>
          </tr>
          <tr class="row">
            <td align="right">&nbsp;</td>
            <td><input type="submit" class="btn" value="提交" /></td>
          </tr>
        </table>
      </form>
	   <div class="BlockBar">管理组列表</div>
      <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="tab">
        <tr class="sub">
          <td width="13%" align="center">编号</td>
          <td width="48%" align="center">组名</td>
          <td width="28%" align="center">权限</td>
          <td width="11%" align="center">管理</td>
        </tr>
        <?php foreach($this->listGroup as $row){
        	if ($row['name'] != 'Guest'){?>
        <tr class="row">
          <td><?php echo $row['id'];?></td>
          <td><?php echo $row['name'];?></td>
          <td><?php echo ($row['flag']==1) ? '超级权限' : '自定义权限';?></td>
          <td align="center"><a href="<?php echo $this->installdir;?>superman/modify/id/<?php echo $row['id'];?>/">修改</a> <a href="<?php echo $this->installdir;?>superman/delete/id/<?php echo $row['id'];?>/" onclick="return confirm('确认删除吗')">删除</a></td>
        </tr>
        <?php
        	}
        }?>
      </table>
      <div id="App-Version-Prompt" style="display:none;">
        <div class="space"></div>
        <div class="Block">
          <div class="BlockBar">版本更新信息</div>
          <div class="BlockContent" id="App-Version-Prompt-Body" style="padding:20px 5px 20px 5px; text-align:center; background:#FFFFCC;">loading...</div>
        </div>
      </div>
      <!-- ########## end ########## -->
    </td>
  </tr>
</table>
</body>
</html>
