<!--#include file="../inc/Secure.htm"-->
<%dim ThisKey
ThisKey = "r"
%>
<!--#include file="../inc/permission.htm"-->
<!--#include file="../inc/conn.htm"-->
<!--#include file="../inc/dbtools.htm"-->
<%
ID=trim(request("ID"))
if ID="" then ID=0

if request("cmdUp")<>"" and ID="0" then	
	Name=replace(trim(request("Name")),"'","''")
	Body=replace(trim(request("Body")),"'","''")
	if Name<>"" then
		AddDocCheck()
		response.write "<BR><BR><p align=center>步骤添加成功！<a href=ManagePath.htm>[返回]</a></p>"
		oconn.close
		response.end
	else
		response.write "<p align=center><font color=red>填写不完整！</font></p>"
	end if
end if
if request("cmdUp")<>"" and ID<>"0" then	
	Name=replace(trim(request("Name")),"'","''")
	Body=replace(trim(request("Body")),"'","''")
	if Name<>""  then
	UpdateDocCheck(ID)
	response.write "<BR><BR><p align=center>步骤修改成功！<a href=ManagePath.htm>[返回]</a></p>"
	oconn.close
	response.end
	else
		response.write "<p align=center><font color=red>填写不完整！</font></p>"
	end if

end if

if ID<>0 then
	set rs=server.createobject("adodb.recordset")
	sql="select * from tblDocStep where ID="& ID
	rs.open sql,oConn
	if not rs.eof then
		strName=trim(rs("Name"))
		strBody=trim(rs("Body"))
	end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../CSS/main.css">
</head>
<script src="Popup.js"></script>
<body bgcolor="#FFFFFF">
<BR><BR>
<div align=center>
<form name="DocForm" method="post" action="">
<table border=1 cellpadding=3 cellspacing=1 width="90%" bgcolor=#EEEEEE bordercolordark="#FFFFFF" bordercolorlight="#999999">
<tr>
	<td align=center colspan=2>
	<%if id=0 then
	response.write "<b>添加新步骤</b>"
	else
	response.write "<b>修改步骤</b>"
	end if%>
	</td>
</tr>
<tr>
	<td align=right width="15%">步骤名</td>
	<td><input class="input" type="text" name="Name" size=20 maxlength=50 value="<%=strName%>"> <font color=#ff0000>*</font></td>
</tr>
<tr>
	<td align=right>步骤说明</td>
	<td>
	<input type="text" name="Body" value="<%=strBody%>" class="input" size=60>
	</td>
</tr>
<tr>
	<td>&nbsp;</td>
	<td>
		<INPUT TYPE="submit" name="cmdUp" value="保 存" onclick="return CheckData();" class="font9boldwhite">		
		<INPUT TYPE="button" name="cmdCancel" value="返  回" onclick="javascript:window.location.href='Managepath.htm'"  class="font9boldwhite">
	</td>

</tr>
</table>
<INPUT TYPE="hidden" name="ID" value="<%=ID%>">
</form>
</body>
<BR><BR>
</html>
<!--#include file="../inc/conn_close.htm"-->
<script language="JavaScript">
function OpenWindow(url,windowname)
{
window.open(url,windowname,'left=100,top=50,height=350,width=650,toolbar=no,menubar=no,scrollbars=yes')
}
function OpenWindow1(url,windowname)
{
window.open(url,windowname,'left=150,top=100,height=80,width=420,toolbar=no,menubar=no,scrollbars=yes')
}
function CheckData()
{
	if(jtrim(document.DocForm.Name.value)=="")
	{
		alert("您必须输入步骤名。")
		document.DocForm.Name.focus();
		return false;
	}
	
	return true;
}
</script>
<script language=javascript src="../inc/jtrim.js"></script>
<%
Function GetTableValue(TableName,Field,ValueField,Value)
	if TableName<>"" and Value<>"" then
		Set RsTmp = Server.Createobject("Adodb.recordset")
		strSql = "Select "& Field &" from "& TableName &" where "& ValueField &"='"& Value &"'"
		Rstmp.open strSql,oConn,1,1
		If not Rstmp.eof then
			GetTableValue=trim(Rstmp(Field))
		else
			GetTableValue=""
		end if
		Rstmp.close
		set RsTmp = Nothing
	else
		GetTableValue=""
	end if
End Function


Sub AddDocCheck()
	sql="INSERT INTO tblDocStep(Name,body) VALUES('" & Name & _
		"','"& body & _
		"')"		
		'response.write sql
		oConn.execute (sql)
end sub
Sub UpdateDocCheck(ID)
	sql="Update tblDocStep set Name='"& Name &"',body='"& body &"' where ID="& ID
	oConn.execute (sql)
end sub


%>