<!--#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 Rs,iRs,Sql,i
Dim NewsId,NewsTitle,NewsContent,NewsTypeId,AddDate
Dim strNewsTitle,strNewsTypeId,strPage

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")))
	
	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 &" where NewsId = "& NewsId)
	
	Qsite.ShowMsg "资讯修改成功" , "News_List.asp?NewsTitle="& strNewsTitle &"&NewsTypeId="& strNewsTypeId &"&page="& strPage
End If

NewsId = Qsite.chgStr(Trim(Request.QueryString("NewsId")))
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

Set Rs = server.createobject("ADODB.Recordset")
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")
End If
Rs.Close
set rs = nothing
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>新闻管理</title>
<link href="../style.css" rel="stylesheet" type="text/css">
<!--文本编辑器部分start-->
<link href="kindeditor/themes/default/default.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="kindeditor/plugins/code/prettify.css" />
<script charset="utf-8" src="kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="kindeditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="kindeditor/plugins/code/prettify.js"></script>
	<script>
		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="NewsContent"]', {
				cssPath : 'kindeditor/plugins/code/prettify.css',
				uploadJson : 'kindeditor/upload_json.asp',
				fileManagerJson : 'kindeditor/file_manager_json.asp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						K('form[name=PosForm]')[0].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						K('form[name=PosForm]')[0].submit();
					});
				}
			});
			prettyPrint();
		});
	</script>
      
<!--文本编辑器部分end-->
</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="10%" height="23" class="td_content">资讯分类：</td>
			<td width="72%" height="23" class="td_content"><select name="NewsTypeId" class="input_1" id="NewsTypeId">
				<option value="">请选择资讯分类</option>
				<%
				Set Rs = server.createobject("ADODB.Recordset")
				Rs.Open "select * from NewsTypeTbl 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>")
					
				Rs.MoveNext
				Loop
				Rs.Close
				set rs = nothing
				%>
			</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"><%=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="width:750px;height:350px;visibility:hidden;"><%=NewsContent%></textarea>
			</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>

<%
set irs = nothing
Set Rs = Nothing
%>

</body>
</html>
