<!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">
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>
<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/modify/">
          <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="tab">
            <tr class="row">
              <td width="11%" align="right">组名称：</td>
              <td width="89%"><input name="name" type="text" id="name" value="<?php echo $this->modify['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 <?php echo ($this->modify['flag'] == 1) ? 'None' : '';?>" id="myself">
              <td align="right">权限控制：</td>
              <td><table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="0" class="table2" id="ta" style="border-collapse:collapse">
                  <?php
				  foreach($this->parents as $row){?>
                  <tr>
                    <td width="126" align="left"><strong>
                      <input name="module[]" type="checkbox" class="checkbox" id="module[]" onclick="selectAll(this)" value="<?php echo $row['controller'];?>"  <?php if(in_array(strtolower($row['controller']), array_keys($this->modify['Permission']))) echo 'checked="checked"';?> />
                      <?php echo $row['name'];?></strong></td>
                    <td width="523" 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 if(in_array(strtolower($rs['method']), (array)$this->modify['Permission'][$row['controller']])) echo 'checked="checked"';?> />
                            <?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="提交" />
                <input name="Submit" type="button" class="btn" onclick="history.back();" value="返回" /></td>
            </tr>
          </table>
          <input type="hidden" name="id" value="<?php echo $this->modify['id'];?>"  />
          <input type="hidden" name="oldname" value="<?php echo $this->modify['oldname'];?>"  />
        </form>
      </div>
      <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>
<?php
echo $this->render('copyright');
?>
</body>
</html>
