<%dim ThisKey
ThisKey = "z"
%>
<!--#include file="../inc/permission.htm"-->
<!--#include file="../inc/conn.htm"-->
<html>
<head>
<title>添加新权限</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel=stylesheet href="../css/main.css" type="text/css">
</head>
<%
if request("cmdUP")<>"" then
	FileName=replace(trim(request("FileName")),"'","''")
	Title=replace(trim(request("Title")),"'","''")
	Rkey=trim(request("Rkey"))
	set rs=server.createobject("adodb.recordset")
	sql="select * from tblRights where Rkey='"&Rkey&"'"
	rs.open sql,oConn
	if not rs.eof then
		bFind=true
	else
		bFind=false
	end if
	rs.close
	set rs=nothing
	if bFind then
		response.write "该权限代码已经存在 <a href=""javascript:history.back(-1);"">[返回]</a>"
		oConn.close
		set oConn=nothing
		response.end
	else
		oConn.execute "Insert tblRights(Title,FileName,Rkey) values('"&Title&"','"&fileName&"','"&Rkey&"')"
		oConn.close
		set oConn=nothing%>
		<form name="returnform" action="ManageRights.htm" method="post" target="FrmRight">
	    <Script language="JavaScript">
	      returnform.submit();
	    </Script>
	    </form>
		<%response.write "添加成功！<a href=# onclick=""javascript:window.close();"">[关闭窗口]</a>"
	end if
else
%>
<BODY BGCOLOR="#FFFFFF">
<form name="SubmitForm" method="post" action="AddRights.htm">
权&nbsp;限&nbsp;名：<INPUT TYPE="text" NAME="Title" value="<%=Title%>" class="input" size=30 maxlength=100> <font color=#ff0000>*</font><BR>
连接文件：<INPUT TYPE="text" NAME="FileName" value="<%=FileName%>" class="input" size=30 maxlength=100> <font color=#ff0000>*</font><BR>
权限代码：<INPUT TYPE="text" NAME="Rkey" value="<%=Rkey%>" class="input" size=4 maxlength=10> <font color=#ff0000>*</font>(输入一个字符，代码不能重复)<BR>
<div align=center><INPUT TYPE="submit" name="cmdUp" value="添 加" onclick="return CheckData();" class="font9boldwhite">
<input type="button" name="exit" value="退 出" class="font9boldwhite" onclick="javascript:window.close();"></div>
<INPUT TYPE="hidden" name="ID" value="<%=ID%>">
</form>
</BODY>
<%end if%>
</HTML>
<script language=javascript>
function CheckData()
{	
	if(jtrim(document.SubmitForm.Title.value)=="") 
	{
		alert("请输入权限名！");
		document.SubmitForm.Title.focus();
		return false;
	}
	if(jtrim(document.SubmitForm.FileName.value)=="") 
	{
		alert("请输入连接文件！");
		document.SubmitForm.FileName.focus();
		return false;
	}
	if(jtrim(document.SubmitForm.Rkey.value)=="") 
	{
		alert("请输入权限代码！");
		document.SubmitForm.Rkey.focus();
		return false;
	}
	
		

	return true;
}
</script>
<script language=javascript src="../inc/jtrim.js"></script>
