<?
session_start();
require_once "../init.php";
require_once "../authority.inc.php";

$SID = $POST['SID'];
$sql = "select * from secu_class";
$res = $DB->query($sql);
while($sesu_settings=$DB->fetch_array($res)){
  $class[$sesu_settings[ID]]=$sesu_settings[Name];
}
$hot="secu";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" 
/>
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/admin/lib/html5.js"></script>
<script type="text/javascript" src="/admin/lib/respond.min.js"></script>
<script type="text/javascript" src="/admin/lib/PIE_IE678.js"></script>
<![endif]-->

<link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/admin/lib/icheck/icheck.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css" />

<!--[if IE 6]>
<script type="text/javascript" src="/admin/static/h-ui.admin/js/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>权限设置</title>
<LINK href="../share/style.css" rel="stylesheet">
</style>
<script>
function checkKey(form){
  if(event.keyCode==13){
     checkadd(form);
  }
}
function checkadd(form){
   if(form.SName.value==""){
     alert("请输入权限名称");
	 form.SName.focus();
	 return ;
   }
   if(form.SPage.value==""){
     alert("请输入执行页面");
	 form.SPage.focus();
	 return ;
   }
   form.submit();
}
</script>
<script src="../share/global.js"></script>
</head>
<body>

<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 系统管理 <span class="c-gray en">&gt;</span> 系统设置 <span 
class="c-gray en">&gt;</span> 权限设置<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" 
href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
<!--子导航-->
<? include "nav.inc.php"; ?>

	<table width="100%"  border="0" cellspacing="0" cellpadding="0" id="table" class="table table-border table-bordered table-bg table-hover table-sort">
      <tr id="tr">
        <td>编号</td>
        <td style="padding:0 0 0 0;">类别
		      <select name='ClassID' onChange="location='<?=$_SERVER[PHP_SELF]?>?ClassID='+this.value">
          <option value=''>--全部--</option>
          <?
			foreach($class as $key => $val){
				if($key==$ClassID)$sel="selected";
				else $sel="";
				echo "<option value='$key' $sel>$val</option>";
			}
		  ?>
      </select>
		</td>
        <td>名称</td>
        <td>执行页面</td>
        <td>管理</td>
      </tr>
      <?
				  //具体设置
				  if($ClassID)$wheres=" where ClassID=$ClassID";
				  $sql="select * from security $wheres ORDER BY ClassID";
				  $res=$DB->query($sql);
				  while($sesu_settings=$DB->fetch_array($res)){
					$select_str="<select name='ClassID'>";
					foreach($class as $key => $val){
					    if($key==$sesu_settings[ClassID])$sel="selected";
						else $sel="";
						$select_str.="<option value='$key' $sel>$val</option>";
					}
					$select_str.="</select>";
					echo "<form method='post' action='secu_settings_modi.php'>
					      <tr id='td' >
					      <td><input type='text' name='SID' value='$sesu_settings[SID]' size='6' class='inputline' readonly></td>
						  <td>$select_str</td>
						  <td><input type='text' name='SName' value='$sesu_settings[SName]' size='25' class='inputline' onkeypress='checkKey(this.form)'></td>
						  <td><input type='text' name='SPage' value='$sesu_settings[SPage]' size='50' class='inputline' onkeypress='checkKey(this.form)'></td>
						  <td><input type='submit' class='bt2' value='修改' onclick='checkadd(this.form)'>
						      <input type='hidden' name='RClassID' value='$ClassID'>
							  <input type='button' class='bt2' value='删除' onclick='location=\"secu_settings_delete.php?SID=$sesu_settings[SID]&RClassID=$ClassID\"'>
						  </td>
						  </tr>
						  </form>";
				  }
				?>
      <tr>
        <td colspan='10'><hr size='1'></td>
      </tr>
      <form method='post' action='secu_settings_add.php'>
        <tr height='20'>
          <td></td>
          <td>
            <select name='ClassID'>
              <?
				foreach($class as $key => $val){
					if($key==$ClassID)$sel="selected";
					else $sel="";
					echo "<option $sel value='$key'>$val</option>";
				}
			  ?>
            </select>          </td>
          <td><input type='text' name='SName' size='25' class='inputline' onkeypress='checkKey(this.form)'></td>
          <td><input type='text' name='SPage' size='50' class='inputline' onkeypress='checkKey(this.form)'></td>
          <td><input name="button" type='button' class='button' onclick='checkadd(this.form)' value='新增'>
              <input type='hidden' name='RClassID' value='<?=$ClassID?>'>          </td>
        </tr>
      </form>
	  <tr>
		  <td colspan="6"><hr size="1"></td>
	  </tr>
      <tr>
	  <td colspan="6" style="padding-left:15px;">
注意:执行页面是指定的页面相对于代理平台管理目录的路径。<br>
例1:如果指定页面的URL是 <span class="fred">http://www.agent.com/admin/user/list.php</span>,那么执行页面应该是 <span class="fred">user/list.php</span>,也就是去掉管理目录URL <span class="fred">http://www.agent.com/admin/</span> 后的路径。<br>
例2:如果指定页面的URL是 <span class="fred">http://www.agent.com/admin/domain/list.php</span>,那么执行页面应该是 <span class="fred">domain/list.php</span>。</td>
	  </tr>
    </table></div>
<? 
$DB->close();
include "../share/bottom.php";
?>
</body>
</html>
