<?php
$job = 'add';
$title = '新增角色';

$role_name='';
$role_desc='';
$role_grade=0;
$role_id=0;

if(array_key_exists("job", $_REQUEST))
	$job = $_REQUEST['job'];

if($job=='mod')
{
	$title = '修改角色';
	$role_id=$_REQUEST['role_id'];
	require_once('../module/module.role.php');
	$role = new CModuleRole();
	$role->InitModule($role_id);
	if($role->module != '')
	{
		$role_grade = $role->module->role_grade;
		$role_name=$role->module->role_name;
		$role_desc=$role->module->role_desc;
	}
}
?>
<input type='hidden' id='role_id' value='<?php echo $role_id?>'>
<table border=0 cellspacing='1' cellpadding='0' width=100% bgcolor='#ffffff'>
	<tr bgcolor="#efefef" height=20>
		<td colspan=2>
			<b><span id="dept_form_desc"><?php echo $title?></span></b>
			<hr size=1>
		</td>
	</tr>
	<tr>
		<td align=right width=80>角色名称:</td>
		<td><input type=text id="role_name" class=box value='<?php echo $role_name?>'></td>
	</tr>
	<tr>
		<td align=right>角色描述:</td>
		<td><input type=text id="role_desc" class=box size=40 value='<?php echo $role_desc?>'></td>
	</tr>
	<tr>
		<td align=right>角色权限:</td>
		<td>
			<?php for($i=0; $i<sizeof($Config["sys_grade"]); $i++){?>
				<input type=checkbox value="<?php echo $Config["sys_grade"][$i];?>" <?php if($Config["sys_grade"][$i]&$role_grade) echo "checked"?>> <?php echo $Config["sys_grade_name"][$i]?>
				&nbsp;
			<?php 
				if(($i+1)%3==0) echo "<br>";
			}
			?>
		</td>
	</tr>
	<tr height=30>
		<td colspan=2 bgcolor="#efefef">
				&nbsp;&nbsp;&nbsp;&nbsp;
				<input type=button value=" 提交 " class=btn onclick="SubmitRole('<?php echo $job?>')">
				&nbsp;&nbsp;&nbsp;&nbsp;
				<input type=button value=" 取消 " class=btn onclick="CloseDialog(0)">
		</td>
	</tr>
</table>