<!--#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 NewsId,NewsTitle,NewsContent,NewsTypeId,Newsgood,newsdq,Newsly,Newswz

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")))
	Newsly = Qsite.chgStr(Trim(Request.Form("Newsly")))
	Newswz = Qsite.chgStr(Trim(Request.Form("Newswz")))
	NewsContent = Qsite.chgStrHtml(Trim(Request.Form("NewsContent")))
	Newsgood = Qsite.chgStrHtml(Trim(Request.Form("Newsgood")))
	if Newsgood = "" then 
	Newsgood=0 
	end if
	if Qsite.fenzhankg=1 then
	Newsdq = Qsite.Sitediqu
	else
	Newsdq = Qsite.chgStr(Trim(Request.Form("Newsdq")))
	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 , newsdq , newsly , newswz) values ('"& NewsTitle &"' , '"& NewsContent &"' , "& NewsTypeId &" , '"& Qsite.FormatDate(Now()) &"','"& Newsgood &"','"& Newsdq &"','"& Newsly &"','"& Newswz &"')")
	
	if Qsite.jingtaiqz=1 or Qsite.jingtaisy=0 then
	
	Qsite.ShowMsg "资讯添加成功" , "News_Add.asp"
	
	else
	
	Response.Redirect("../jingtai/zqznews.asp")
	
	end if
	
	
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="Newsly" type="text" class="input_1" id="Newsly" size="20"></td>
		</tr>
		<tr>
			<td height="23" class="td_content">资讯网址：</td>
			<td height="23" class="td_content"><input name="Newswz" type="text" class="input_1" id="Newswz" size="20"></td>
		</tr>
		<%if Qsite.fenzhankg=1 then%><%else%>
		<tr>
          <td height="23" class="td_content">地区选择：</td>
		  <td height="23" colspan="2" class="td_content">
		  <select name="newsdq" id="newsdq" style="width:150px; line-height:17px; border:#04477C 1px solid;">
						<option value="<%=Qsite.Sitediqu%>"><%=Qsite.Sitediqu%></option>
						<%
						Rs.Open "select * from myrcwwfenzhan where fenzhankg='1' order by fenzhanid asc" , Conn , 1 , 1
						Do While Not Rs.Eof%>
						<option value="<%=rs("fenzhandq")%>"><%=rs("fenzhandq")%></option>
						<%Rs.MoveNext
						Loop
						Rs.Close
						%>
		</select>
		  </td>
	  </tr>
	  <%end if%>
		<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.htm?id=NewsContent&style=standard550" 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>
