<!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
if not isNul(ID) then
	if isNum("^[1-9]+[0-9]*$",ID) = false then
		Response.Write ("<script type=""text/javascript"">alert('非法ID号');window.location.href='Control_Main.asp';</script>")
		Response.End
	end if
end if
set rs=server.CreateObject("adodb.recordset")
sql="select 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=Menu_ID
		Menu_Name=rs("Menu_Name")
	else
		set rs2=server.CreateObject("adodb.recordset")
		sql2="select ID,Menu_Name from Site_Menu where ID="&rs("Menu_TopParent_ID")&" and Menu_Type=2"
		rs2.open sql2,conn,1,1
		Menu_TopParent_ID=rs2("ID")
		Menu_Name=rs2("Menu_Name")
		rs2.Close
		set rs2=nothing
	end if
	if rs("Menu_ChildCount")=0 then
		ListAll_ID=Menu_ID
	else
		ListAll_ID=""
		set rs2=server.CreateObject("adodb.recordset")
		sql2="select ID from Site_Menu where ID="&Menu_ID&" or Menu_Parent_ID="&Menu_ID&" or Menu_Parent_Path like '%,"&Menu_ID&",%'"
		rs2.open sql2,conn,1,1
		if rs2.eof and rs2.bof then
			Response.Write ("<script type=""text/javascript"">alert('菜单ID不存在');window.location.href='Control_Main.asp';</script>")
			Response.End
		else
			do while not rs2.eof
			if isNul(ListAll_ID) then
				ListAll_ID=rs2("ID")
			else
				ListAll_ID=ListAll_ID & "," & rs2("ID")
			end if
			rs2.movenext
			loop
			rs2.Close
			set rs2=nothing
		end if
	end if
	rs.close
	set rs=nothing
end if
if Request("Action")="Info_Del" then
	sql="delete from "&Menu_MDB&" where ID="&ID&""
	conn.Execute(sql)
	conn.close
	set conn=nothing
	Response.Write ("<script type=""text/javascript"">window.location.href='?Menu_ID="&Menu_ID&"&page="&RequestPage&"';</script>")
	Response.End
end if
if Request("Action")="Info_DelAll" then
	ALLID=HTMLEncode(chk_sql(Trim(Request("ALLID"))))
	if isNul(ALLID) then
		Response.Write ("<script type=""text/javascript"">alert('请选择需要删除的信息');window.location.href=""javascript:history.back()"";</script>")
		Response.End
	end if
	sql="delete from "&Menu_MDB&" where ID in ("&ALLID&")"
	conn.Execute(sql)
	conn.close
	set conn=nothing
	'Response.Write ("<script type=""text/javascript"">window.location.href='?Menu_ID="&Menu_ID&"&page="&RequestPage&"';<script>")
	Response.End
end if
if Request("Action")="RecomB" then
	conn.Execute("update "&Menu_MDB&" set Time_Update='"& Now() &"',Recommend='0' where ID="&ID&"")
	conn.close
	set conn=nothing
	Response.Write ("<script type=""text/javascript"">window.location.href='?Menu_ID="&Menu_ID&"&page="&RequestPage&"';</script>")
	Response.End
end if
if Request("Action")="RecomT" then
	conn.Execute("update "&Menu_MDB&" set Time_Update='"& Now() &"',Recommend='1' where ID="&ID&"")
	conn.close
	set conn=nothing
	Response.Write ("<script type=""text/javascript"">window.location.href='?Menu_ID="&Menu_ID&"&page="&RequestPage&"';</script>")
	Response.End
end if
if Request("Action")="Change_HID" then
	Hand_ID=Trim(Request("Hand_ID"))
	Time_Update=Now()
	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
	conn.Execute("update "&Menu_MDB&" set Hand_ID='"& Hand_ID &"',Time_Update='"& Time_Update &"' where ID="&ID&"")
	conn.close
	set conn=nothing
	'Response.Write ("<script type=""text/javascript"">alert('修改成功');window.location.href='?Menu_ID="&Menu_ID&"&page="&RequestPage&"';<script>")
	Response.End
end if
%><title></title>
<%Call Default_CssJs()%>
<%Call Default_Thickbox()%>
</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="6" class="content_list">
			<ul class="edit_menu">
				<li><a href="News_Add.asp?Menu_ID=<%=Menu_TopParent_ID%>" class="info_add">添加<%=Menu_Name%></a></li>
				<li><a href="LevelSingle_List.asp?Menu_ID=<%=Menu_TopParent_ID%>" class="edit_item">分类管理</a></li>
				<li>
				<form name="form" method="post" action="">
				<select name="SelectClass_List" id="SelectClass_List" onChange='window.location=form.SelectClass_List.options[form.SelectClass_List.selectedIndex].value'>
					<option value="?Menu_ID=<%=Menu_TopParent_ID%>">显示所有<%=Menu_Name%></option>
					<%=ListPage_Select(Menu_TopParent_ID,0,Menu_ID)%>
				</select>
				</form>
				</li>
			</ul>
			</td>
		</tr>
		<tr class="content_title">
			<td width="40">选择</td>
			<td width="40">推荐</td>
			<td width="115">手工序号</td>
			<td width="120">添加日期</td>
			<td>标题名称</td>
			<td width="120" style="background-image:none;">操作</td>
		</tr>
		<%
		Set Page = new Cls_Page
		Set Page.Conn = conn
		With Page
		.PageSize = 10
		.PageParm = "page"
		.Database = "ac"
		.Pkey="ID"
		.Field="ID,Time_Add,Hand_ID,Menu_ID,Title,Recommend"
		.Table=Menu_MDB
		.Condition="Menu_ID in ("&ListAll_ID&") or Menu_TopParent_ID="&Menu_ID&""
		.OrderBy="Recommend desc,Hand_ID desc,id desc"
		.RecordCount = 0
		.NumericJump = 5
		.Template = "<div class=""page_list""><div class=""list_info"">每页{$PageSize}个&nbsp;|&nbsp;共({$RecordCount}个/{$PageCount}页)&nbsp;|&nbsp;当前第{$PageIndex}页 {$FirstPage}{$PreviousPage}{$NumericPage}{$NextPage}{$LastPage}</div></div>"
		.FirstPage = "&nbsp;&lt;&lt;&nbsp;"
		.PreviousPage = "&nbsp;&lt;&nbsp;"
		.NextPage = "&nbsp;&gt;&nbsp;"
		.LastPage = "&nbsp;&gt;&gt;&nbsp;"
		.NumericPage = "{$PageNum}"
		End With
		rs = Page.ResultSet()
		nav = Page.Nav()
		If IsNull(rs) Then
		%>
		<tr>
			<td colspan="6" align="center" class="content_list">暂无信息</td>
		</tr>
		<%
		Else
			For i=0 To Ubound(rs,2)
		%>
		<tr class="content_list" onMouseOver="this.style.backgroundColor='#D3E1F6'" onMouseOut="this.style.backgroundColor=''">
			<td><input name="SelectID" type="checkbox" value="<%=rs(0,i)%>" /></td>
			<td><%if rs(5,i)=1 then%><a href="?Action=RecomB&Menu_ID=<%=Menu_ID%>&ID=<%=rs(0,i)%>&page=<%=RequestPage%>" title="取消推荐" class="RecomB">[<span>是</span>]</a><%else%><a href="?Action=RecomT&Menu_ID=<%=Menu_ID%>&ID=<%=rs(0,i)%>&page=<%=RequestPage%>" title="点击推荐" class="RecomT">[<span>否</span>]</a><%end if%></td>
			<td style="padding-left:10px">
			<ul class="list_input">
				<li class="input_l"></li>
				<li class="input_mb"><input onkeydown="EnterPress(event,'News_List.asp','<%=rs(0,i)%>','<%=Menu_ID%>','<%=RequestPage%>')" name="Hand_ID" type="text" id="Hand_ID<%=rs(0,i)%>" value="<%=rs(2,i)%>" maxlength="4" style="text-align:center" /></li>
				<li class="input_mn"><img src="images/info_num.gif" alt="修改手工序号" onClick="Change_HID('News_List.asp','<%=rs(0,i)%>','<%=Menu_ID%>','<%=RequestPage%>')" style="cursor:pointer;vertical-align:middle" /></li>
				<li class="input_r"></li>
			</ul>
			</td>
			<td><%=Format_Time(rs(1,i),2)%></td>
			<td><%=Cut_ShortTitle(rs(4,i),50)%></td>
			<td style="background-image:none;"><a href="News_Edit.asp?Menu_ID=<%=Menu_ID%>&ID=<%=rs(0,i)%>&page=<%=RequestPage%>"><img src="images/info_edit.gif" alt="编辑<%=rs(4,i)%>" /></a>|<a title="确认删除" href="News_Del.asp?height=105&width=380&Menu_ID=<%=Menu_ID%>&ID=<%=rs(0,i)%>&page=<%=RequestPage%>" class="thickbox"><img src="images/info_del.gif" alt="删除<%=rs(4,i)%>" /></a></td>
		</tr>
		<%
			Next
		End If
		%>
	</table>
	<div>
		<div class="foot_tool"><input type="checkbox" name="checkboxAll" id="checkboxAll" onclick="SelectAll(this,'SelectID')" /><img src="images/del_all.gif" alt="批量删除" onClick="del_select('News_List.asp','<%=Menu_ID%>','<%=RequestPage%>')" /></div>
		<%Response.Write nav%>
	</div>
</div>
</body>
</html>