<!--#include file="../../Conn.asp" -->
<!--#include file="../../Comm/Site_Class.asp" -->
<%
PagePath = "../../"

Set Qsite = New Site_Class

Qsite.SiteConfig_Master()
%>
<!--#include file="../Check_Login.asp" -->
<%
Qsite.Check_AdminFlag(arrAdminFlag(4 , 1))

Dim iRs
Dim NewsId,NewsTitle,NewsContent,NewsTypeId,Newsgood

Set Rs = server.createobject("ADODB.Recordset")
Set iRs = server.createobject("ADODB.Recordset")

If Request.Form <> "" Then
	NewsTypeId = Qsite.chgStr(Trim(Request.Form("NewsTypeId")))
	NewsTitle = Qsite.chgStr(Trim(Request.Form("NewsTitle")))
	NewsContent = Qsite.chgStrHtml(Trim(Request.Form("NewsContent")))
	Newsgood = Qsite.chgStrHtml(Trim(Request.Form("Newsgood")))
	if Newsgood = "" then 
	Newsgood=0 
	end if
	
	If NewsTypeId = "" Or IsNull(NewsTypeId) Or Not IsNumeric(NewsTypeId) Then
		Qsite.ShowMsg "请选择资讯分类" , ""
	End If
	If NewsTitle = "" Or IsNull(NewsTitle) Then
		Qsite.ShowMsg "请输入资讯标题" , ""
	End If
	If NewsContent = "" Or IsNull(NewsContent) Then
		Qsite.ShowMsg "请输入资讯内容" , ""
	End If
	
	Conn.Execute("insert into NewsTbl (NewsTitle , NewsContent , NewsTypeId , AddDate , good) values ('"& NewsTitle &"' , '"& NewsContent &"' , "& NewsTypeId &" , '"& Qsite.FormatDate(Now()) &"','"& Newsgood &"')")
	
	Qsite.ShowMsg "资讯添加成功" , "News_Add.asp"
End If
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>新闻管理</title>
<link href="../skins/css/main.css" rel="stylesheet" type="text/css">
</head>

<body>
<form name="PosForm" method="post" action="News_Add.asp" style="margin:0">
	<table width="100%" border="0" cellspacing="1" cellpadding="5">
		<tr>
			<td height="25" colspan="2" class="td_title">资讯信息添加</td>
		</tr>
		<tr>
			<td width="18%" height="23" class="td_content">资讯分类：</td>
			<td width="82%" height="23" class="td_content"><select name="NewsTypeId" class="input_1" id="NewsTypeId">
				<option value="">请选择资讯分类</option>
				<%
				Rs.Open "select * from NewsTypeTbl where NewsTypeKey = 0 order by Px asc" , Conn , 1 , 1
				Do While Not Rs.Eof
					Response.Write("<option value="""& Rs("NewsTypeId") &""">"& Rs("NewsTypeName") &"</option>")
					iRs.Open "select * from NewsTypeTbl where NewsTypeKey = "& Rs("NewsTypeId") &" order by Px asc" , Conn , 1 , 1
					Do While Not iRs.Eof
						Response.Write("<option value="""& iRs("NewsTypeId") &""">&nbsp;&nbsp;--"& iRs("NewsTypeName") &"</option>")
					iRs.MoveNext
					Loop
					iRs.Close
					
				Rs.MoveNext
				Loop
				Rs.Close
				%>
			</select>			</td>
		</tr>
		<tr>
			<td height="23" class="td_content">资讯标题：</td>
			<td height="23" class="td_content"><input name="NewsTitle" type="text" class="input_1" id="NewsTitle" size="60"></td>
		</tr>
		<tr>
		  <td height="23" class="td_content">推荐：</td>
	      <td height="23" class="td_content"><input name="Newsgood" type="checkbox" id="good" value="1"></td>
	  </tr>
		<tr>
			<td height="23" class="td_content">资讯内容：</td>
			<td height="23" class="td_content"><textarea name="NewsContent" class="input_1" id="NewsContent" style="display:none"></textarea>
			<IFRAME ID="eWebEditor1" SRC="../html/ewebeditor.asp?id=NewsContent&style=s_blue_news" FRAMEBORDER="0" SCROLLING="no" WIDTH="550" HEIGHT="350"></IFRAME></td>
		</tr>
		<tr>
			<td height="23" class="td_content">&nbsp;</td>
			<td height="23" class="td_content"><input name="Submit" type="submit" class="input_1" value=" 添  加 "> &nbsp;
			<input name="Submit" type="reset" class="input_1" value=" 重  置 "></td>
		</tr>
	</table>
</form>
</body>
</html>
