<!--#include file="../../Inc/conn.asp"-->
<!--#include file="../admin.asp"-->
<!-- #include file="../Inc/Head.asp" -->
<%
ID=strToNum(Request("ID"))
title=ChkFormStr(Request("Title"))
author=ChkFormStr(Request("author"))
ComeFrom=ChkFormStr(Request("ComeFrom"))
DefaultPicUrl=ChkFormStr(Request("DefaultPicUrl"))
UploadFiles=ChkFormStr(Request("UploadFiles"))
IncludePic=strToNum(Request("IncludePic"))
Content=Trim(Request("Content"))
Elite=ChkFormStr(request.form("Elite"))
BigClass=strToNum(Request("BigClass"))
SmallClass=strToNum(Request("SmallClass"))
PostTime=trim(Request("PostTime"))
'response.Write(PostTime)
'response.End()
If BigClass=0 Then
		response.write "<script language='javascript'>" & chr(13)
				response.write "alert('请选择类别！');" & Chr(13)
				response.write "history.back(-1);;"&Chr(13)
				response.write "</script>" & Chr(13)
		Response.End
Else
	BigClassName=conn.execute("select BigClassName From BigClass_New Where BigClassID="&BigClass)(0)
End If
If SmallClass<>0 Then
	SmallClassName=conn.execute("select SmallClassName From SmallClass_New Where SmallClassID="&SmallClass)(0)
End If

If lcase(Request("Act"))="add" Then
		set rs=server.createobject("adodb.recordset")
		sql="select * from NEWS where (id is null)"
		rs.open sql,conn,1,3
		rs.addnew
		rs("title")=title
		rs("author")=author
		rs("ComeFrom")=ComeFrom
		rs("Content")=Content
		rs("BigClass")=BigClass
		rs("SmallClass")=SmallClass
		rs("UploadFiles")=UploadFiles
		rs("DefaultPicUrl")=DefaultPicUrl
		rs("IncludePic")=IncludePic
		rs("BigClassName")=Trim(BigClassName)
		rs("SmallClassName")=Trim(SmallClassName)
		if Elite="yes" then
			rs("Elite")=True
		else
			rs("Elite")=False
		end if
		rs("PostTime")=PostTime
		rs.update
		rs.close
		set rs=nothing
		conn.close  
		set conn=nothing
		response.write "<script language='javascript'>" & chr(13)
				response.write "alert('信息发布成功！');" & Chr(13)
				response.write "window.document.location.href='News_Manage.asp';"&Chr(13)
				response.write "</script>" & Chr(13)
		Response.End
Else
		set rs=server.createobject("adodb.recordset")
		sql="select * from NEWS where Id="&ID
		rs.open sql,conn,1,3
		rs("title")=title
		rs("author")=author
		rs("ComeFrom")=ComeFrom
		rs("Content")=Content
		rs("BigClass")=BigClass
		rs("SmallClass")=SmallClass
		rs("UploadFiles")=UploadFiles
		rs("DefaultPicUrl")=DefaultPicUrl
		rs("IncludePic")=IncludePic
		rs("BigClassName")=Trim(BigClassName)
		rs("SmallClassName")=Trim(SmallClassName)
		if Elite="yes" then
			rs("Elite")=True
		else
			rs("Elite")=False
		end if
		rs("PostTime")=PostTime
		rs.update
		rs.close
		set rs=nothing
		conn.close  
		set conn=nothing
		response.write "<script language='javascript'>" & chr(13)
				response.write "alert('信息修改成功！');" & Chr(13)
				response.write "window.document.location.href='News_Manage.asp';"&Chr(13)
				response.write "</script>" & Chr(13)
		Response.End
End If
%>
