<!--#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 , 2))

Dim iRs,Newsgood
Dim NewsId,NewsTitle,NewsContent,NewsTypeId,AddDate
Dim strNewsTitle,strNewsTypeId,strPage

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

If Request.Form <> "" Then
	NewsId = Qsite.chgStr(Trim(Request.Form("NewsId")))
	NewsTypeId = Qsite.chgStr(Trim(Request.Form("NewsTypeId")))
	NewsTitle = Qsite.chgStr(Trim(Request.Form("NewsTitle")))
	NewsContent = Qsite.chgStrHtml(Trim(Request.Form("NewsContent")))
	strNewsTitle = Qsite.chgStr(Trim(Request.Form("strNewsTitle")))
	strNewsTypeId = Qsite.chgStr(Trim(Request.Form("strNewsTypeId")))
	strPage = Qsite.chgStr(Trim(Request.Form("strPage")))
	Newsgood  = Qsite.chgStr(Trim(Request.Form("Newsgood")))
	if Newsgood="" then Newsgood=0 end if
	
	If NewsId = "" Or IsNull(NewsId) Or Not IsNumeric(NewsId) Then
		Qsite.ShowMsg "非法参数" , ""
	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
	
	If strNewsTypeId = "" Or IsNull(strNewsTypeId) Or Not IsNumeric(strNewsTypeId) Then strNewsTypeId = 0
	If strPage = "" Or IsNull(strPage) Or Not IsNumeric(strPage) Then strPage = 1
	
	Conn.Execute("update NewsTbl set NewsTitle = '"& NewsTitle &"' , NewsContent = '"& NewsContent &"' , NewsTypeId = "& NewsTypeId &"  , good = "& Newsgood &"  where NewsId = "& NewsId)
	
	Qsite.ShowMsg "资讯修改成功" , "News_List.asp?NewsTitle="& strNewsTitle &"&NewsTypeId="& strNewsTypeId &"&page="& strPage
End If

NewsId = Qsite.chgStr(Trim(Request.QueryString("NewsId")))
Newsgood = Qsite.chgStr(Trim(Request.QueryString("Newsgood")))
strNewsTitle = Qsite.chgStr(Trim(Request.QueryString("strNewsTitle")))
strNewsTypeId = Qsite.chgStr(Trim(Request.QueryString("strNewsTypeId")))
strPage = Qsite.chgStr(Trim(Request.QueryString("strPage")))

If NewsId = "" Or IsNull(NewsId) Or Not IsNumeric(NewsId) Then NewsId = 0
If strNewsTypeId = "" Or IsNull(strNewsTypeId) Or Not IsNumeric(strNewsTypeId) Then strNewsTypeId = 0
If strPage = "" Or IsNull(strPage) Or Not IsNumeric(strPage) Then strPage = 1

Rs.Open "select * from NewsTbl where NewsId = "& NewsId , Conn , 1 , 1
If Rs.Eof Then
	Qsite.ShowMsg "非法参数" , ""
Else
	NewsTitle = Rs("NewsTitle")
	NewsContent = Rs("NewsContent")
	NewsTypeId = Rs("NewsTypeId")
	AddDate = Rs("AddDate")
	Newsgood = Rs("Good")
End If
Rs.Close
%>
<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_Edit.asp" style="margin:0">
	<table width="100%" border="0" cellspacing="1" cellpadding="5">
		<tr>
			<td height="25" colspan="2" class="td_title">资讯信息修改
			<input name="NewsId" type="hidden" id="NewsId" value="<%=NewsId%>">
			<input name="strNewsTitle" type="hidden" id="strNewsTitle" value="<%=strNewsTitle%>">
			<input name="strNewsTypeId" type="hidden" id="strNewsTypeId" value="<%=strNewsTypeId%>">
			<input name="strPage" type="hidden" id="strPage" value="<%=strPage%>"></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") &""" ")
					If Cint(Rs("NewsTypeId")) = Cint(NewsTypeId) Then Response.Write("selected")
					Response.Write(">"& 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") &""" ")
						If Cint(iRs("NewsTypeId")) = Cint(NewsTypeId) Then Response.Write("selected")
						Response.Write(">&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" value="<%=NewsTitle%>"></td>
		</tr>
		<tr>
		  <td height="23" class="td_content">推荐：</td>
	      <td height="23" class="td_content"><input name="Newsgood" type="checkbox" value="1" <%if Newsgood=1 then%>checked<%end if%>></td>
	  </tr>
		<tr>
			<td height="23" class="td_content">发布时间：</td>
			<td height="23" class="td_content"><%=AddDate%></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"><%=NewsContent%></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=" 重  置 ">
			&nbsp;
			<input name="Submit" type="button" class="input_1" value=" 返  回 " onClick="javascript:history.back();"></td>
		</tr>
	</table>
</form>
</body>
</html>
