<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--#include file="Inc/Infile_Config.asp" -->
<%
Call CheckAdminLevel
Menu_MDB="Site_News"
if isNul(Menu_ID) or isNum("^[1-9]+[0-9]*$",Menu_ID) = false then
	Response.Write ("<script type=""text/javascript"">alert('非法菜单ID号');window.location.href='Control_Main.asp';</script>")
	Response.End
end if
set rs=server.CreateObject("adodb.recordset")
sql="select ID,Menu_Name,Menu_Lang,Menu_TopParent_ID,Menu_Parent_ID,Menu_ChildCount from Site_Menu where ID="&Menu_ID&" and Menu_Type=2"
rs.Open sql,conn,1,1
if rs.eof and rs.bof then
	Response.Write ("<script type=""text/javascript"">alert('菜单ID不存在');window.location.href='Control_Main.asp';</script>")
	Response.End
else
	Lang_ID=rs("Menu_Lang")
	if rs("Menu_Parent_ID")=0 then
		Menu_TopParent_ID=rs("ID")
		Menu_Name=rs("Menu_Name")
		Menu_ChildCount=rs("Menu_ChildCount")
	else
		Menu_TopParent_ID=rs("Menu_TopParent_ID")
		set rs2=server.CreateObject("adodb.recordset")
		sql2="select Menu_Name,Menu_ChildCount from Site_Menu where ID="&rs("Menu_TopParent_ID")&""
		rs2.open sql2,conn,1,1
		Menu_Name=rs2("Menu_Name")
		Menu_ChildCount=rs2("Menu_ChildCount")
		rs2.Close
		set rs2=nothing
	end if
rs.close
set rs=nothing
end if
if Request("Action")="Info_Edit" then
	ADD_MenuID=Trim(Request.form("ADD_MenuID"))
	Recommend=Trim(Request.form("Recommend"))
	Title=HTMLEncode(Trim(Request.form("Title")))
	Hand_ID=Trim(Request.form("Hand_ID"))
	if isNul(ADD_MenuID) or isNum("^[0-9]+[0-9]*$",ADD_MenuID) = false then
		Response.Write ("<script type=""text/javascript"">alert('非法分类ID号');window.location.href=""javascript:history.back()"";</script>")
		Response.End
	elseif ADD_MenuID=0 then
		Response.Write ("<script type=""text/javascript"">alert('请选择分类');window.location.href=""javascript:history.back()"";</script>")
		Response.End
	end if
	if isNul(Recommend) or isNum("^[0-9]+[0-9]*$",Recommend) = false then
		Response.Write ("<script type=""text/javascript"">alert('是否推荐非法');window.location.href=""javascript:history.back()"";</script>")
		Response.End
	end if
	if isNul(Title) then
		Response.Write ("<script type=""text/javascript"">alert('请填写标题名称');window.location.href=""javascript:history.back()"";</script>")
		Response.End
	end if
	if isNul(Hand_ID) then
		Response.Write ("<script type=""text/javascript"">alert('请填写手工序号');window.location.href=""javascript:history.back()"";</script>")
		Response.End
	elseif isNum("^[1-9]+[0-9]*$",Hand_ID) = false then
		Response.Write ("<script type=""text/javascript"">alert('手工序号必须是大于0的整数');window.location.href=""javascript:history.back()"";</script>")
		Response.End
	end if
	Content = ""
	For i = 1 To Request.Form("Content").Count
		Content = Content & Request.Form("Content")(i)
	Next
	set rs=server.CreateObject("adodb.recordset")
	rs.Open "select * from "&Menu_MDB&" where ID="&ID,conn,3,3
		rs("Time_Update")=Now()
		rs("Hand_ID")=Hand_ID
		rs("Menu_ID")=ADD_MenuID
		rs("Title")=Title
		rs("Content")=Content
		rs("Recommend")=Recommend
	rs.Update
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write ("<script type=""text/javascript"">alert('修改成功');window.location.href='News_List.asp?Menu_ID="&Menu_ID&"&page="&RequestPage&"';</script>")
	Response.End
end if
%><title></title>
<%Call Default_CssJs()%>
<%Call Default_HtmlEditor()%>
</head>
<body>
<div id="cms_main">
	<div class="main_title"><span class="page_content">
	<%
	set rs=server.CreateObject("adodb.recordset")
	sql="select Lang_ControlName from Site_Language where Lang_ID="&Lang_ID&""
	rs.Open sql,conn,1,1
	if rs.eof and rs.bof then
		Response.Write ("<script type=""text/javascript"">alert('语言ID不存在');window.location.href='Control_Main.asp';</script>")
		Response.End
	else
		Response.Write (""&rs("Lang_ControlName")&"内容管理－"&Menu_Name&"")
	rs.close
	set rs=nothing
	end if
	%></span></div>
	<div class="height5"></div>
	<table id="main_content">
		<tr>
			<td colspan="4" class="content_list">
			<ul class="edit_menu">
				<li><a href="News_List.asp?Menu_ID=<%=Menu_ID%>&page=<%=RequestPage%>" class="edit_manage"><strong>返回</strong><%=MenuName(Menu_ID,0)%></a></li>
				<li><a href="LevelSingle_List.asp?Menu_ID=<%=Menu_ID%>" class="edit_item">分类管理</a></li>
			</ul>
			</td>
		</tr>
	</table>
	<div class="height5"></div>
	<%
	set rs=server.CreateObject("adodb.recordset")
	sql="select * from "&Menu_MDB&" where ID="&ID&""
	rs.Open sql,conn,1,1
	if rs.eof and rs.bof then
		Response.Write ("<script type=""text/javascript"">alert('不存在此信息');window.location.href='Control_Main.asp';</script>")
		Response.End
	else
	%>
	<div class="mc_title"><span class="mc_titlel">编辑【<%=rs("Title")%>】</span><span class="mc_titler"></span></div>
	<form name="Info_Edit" method="post" action="?Action=Info_Edit&Menu_ID=<%=Menu_ID%>&ID=<%=rs("ID")%>&page=<%=RequestPage%>" onSubmit="return Info_Edit_Check()">
	<table class="mc_table">
		<tr>
			<td class="mc_table_title">选择分类</td>
			<td>
			<ul class="list_input">
				<li><select name="ADD_MenuID" id="ADD_MenuID">
				<%if Menu_ChildCount=0 then%>
					<option value="<%=Menu_TopParent_ID%>"<%if cint(Menu_TopParent_ID)=cint(rs("Menu_ID")) then%> selected="selected"<%end if%>><%=Menu_Name%></option>
				<%else%>
					<option value="0" selected="selected">请选择分类</option>
					<%=AddEditPage_Select(Menu_TopParent_ID,0,rs("Menu_ID"))%>
				<%end if%>
				</select></li>
				<li class="input_ltext">　是否推荐</li>
				<li><label for="Recommend"></label>
				<select name="Recommend" id="Recommend">
					<option value="0"<%if rs("Recommend")=0 then%> selected="selected"<%end if%>>不推荐</option>
					<option value="1"<%if rs("Recommend")=1 then%> selected="selected"<%end if%>>推荐</option>
				</select></li>
			</ul>
			</td>
		</tr>
		<tr>
			<td width="60" class="mc_table_title">标题名称</td>
			<td>
			<ul class="list_input">
				<li class="input_l"></li>
				<li class="input_ma"><input name="Title" type="text" id="Title" value="<%=rs("Title")%>" /></li>
				<li class="input_r"></li>
				<li class="input_ltext">　手工序号</li>
				<li class="input_l"></li>
				<li class="input_mb"><input name="Hand_ID" type="text" id="Hand_ID" value="<%=rs("Hand_ID")%>" maxlength="4" style="text-align:center" /></li>
				<li class="input_r"></li>
			</ul>
			</td>
		</tr>
		<tr>
			<td colspan="2"><textarea id="Content" name="Content" rows="24" cols="80" style="width:100%"><%=server.htmlencode(rs("Content"))%></textarea></td>
		</tr>
	</table>
	<div class="mc_submit"><input type="image" name="imageField" id="imageField" src="images/submit.gif"></div>
	</form>
	<%
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
end if
%>
</div>
</body>
</html>