<%
if Request.Cookies("admindj")<>"1" then
   Response.Write "<BR><BR><BR><BR><center>权限不足，你没有此功能的管理权限"
   Response.end
end if
%>
<!--#include file = admin_chk.asp -->
<!--#include file = admin_conn.asp -->
<html>

<head>
<!--#include file = language.asp -->
<STYLE type="text/css">
<!--
a:link       {text-decoration: none; font-family: AdobeSm; color: #000000 }
a:visited    {text-decoration: none; color: #000000 }
A:hover      {COLOR: green; FONT-FAMILY: "宋体,MingLiU"; TEXT-DECORATION: underline}
body         {font-size: 9pt; font-family: 宋体,MingLiU, Arial;color: #000000}
TD           {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000;table-layout:fixed;word-break:break-all}
p            {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
input        {FONT-SIZE: 9pt; FONT-FAMILY: "宋体,MingLiU, Arial";color: #000000}
body         {margin-top: 0; margin-bottom: 0;margin-left:0;margin-right:0; color: #000000}
select       {FONT-SIZE: 9PT;}
option       {FONT-SIZE: 9pt;}
textarea     {FONT-SIZE: 9pt;}
-->
</STYLE>
</head>

<body topmargin="0" bgcolor="#ffffff" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<%
action=trim(request("action"))
lmid=trim(request("lmid"))
lmname=trim(request("lmname"))
delid=trim(request("delid"))

if action="lm2add" and lmid<>"" and lmname<>"" then
   conn.Execute "insert into [lm] ([lmid],[lm2]) values('"&lmid&"','"&lmname&"')"
   action=""
elseif action="lm3add" and lmid<>"" and lmname<>"" then
   conn.Execute "insert into [lm] ([lmid],[lm3]) values('"&lmid&"','"&lmname&"')"
   action=""
elseif delid<>"" then
   conn.Execute "delete from [news] where lm='"&delid&"' or lm2='"&delid&"' or lm3='"&delid&"' "
   conn.Execute "delete from [lm] where ID="&CInt(delid)
   conn.Execute "delete from [lm] where lmID='"&delid&"' "
end if
%>
<div align="center">
	<table border="0" cellpadding="0" cellspacing="0" width="760" >
		<tr>
			<td>
<center>
<table border="0" width="100%" id="table1" height="80" cellspacing="0" cellpadding="0">
	<tr>
		<td height=25>　</td>
	</tr>
	<tr>
		<td height=25 background="../images/bj3.jpg">
		<div align="center">
			<table border="0" cellpadding="0" cellspacing="0" width="744" id="table3">
				<form method="POST" action="admin_news_lm_hp.asp"><tr>
					<td width="744" height=20 align=center>
					<select size="1" name="lm21">
					  <%					  
					  sql = "select * from lm where lm<>'' order by id asc"
					  Set rs = Server.CreateObject("ADODB.RecordSet")
					  rs.Open sql,conn,1,1
					  while not rs.eof
					       response.write "<optgroup label=(ID:"&rs("id")&")"&rs("lm")&">"
							sql2 = "select * from lm where lmid='"&rs("id")&"' order by id asc"
							Set rs2 = Server.CreateObject("ADODB.RecordSet")
							rs2.Open sql2,conn,1,1
							while not rs2.eof
							%>
							   <option value='<%=rs("id")%>|<%=rs2("id")%>'>├(编号:<%=rs2("id")%>)<%=rs2("lm2")%></option>
							<%
							rs2.movenext
							wend
					  rs.movenext
					  wend 
					  rs.close
					  set rs=nothing
					 
					%>

					</select> 合并到 <select size="1" name="lm22">
					  <%
					  sql = "select * from lm where lm<>'' order by id asc"
					  Set rs = Server.CreateObject("ADODB.RecordSet")
					  rs.Open sql,conn,1,1
					  while not rs.eof
					       response.write "<optgroup label=(ID:"&rs("id")&")"&rs("lm")&">"
							sql2 = "select * from lm where lmid='"&rs("id")&"' order by id asc"
							Set rs2 = Server.CreateObject("ADODB.RecordSet")
							rs2.Open sql2,conn,1,1
							while not rs2.eof
							%>
							   <option value='<%=rs("id")%>|<%=rs2("id")%>'>├(编号:<%=rs2("id")%>)<%=rs2("lm2")%></option>
							<%
							rs2.movenext
							wend
					  rs.movenext
					  wend 
					  rs.close
					  set rs=nothing
					 
					%>
					</select><input type="submit" value="合并" name="B2"></td>
				</tr></form>
			</table>
		</div>
		</td>
	</tr>
	<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="VBScript" Type="text/vbscript"><!--
function FrontPage_Form2_onsubmit()
  Set theForm = document.FrontPage_Form2

  If (theForm.lm.value = "") Then
    MsgBox "请在 lm 域中输入值。", 0, "有效性验证错误"
    theForm.lm.focus()
    FrontPage_Form2_onsubmit = False
    Exit Function
  End If

  If (Len(theForm.lm.value) < 1) Then
    MsgBox "在 lm 域中，请至少输入 1 个字符。", 0, "有效性验证错误"
    theForm.lm.focus()
    FrontPage_Form2_onsubmit = False
    Exit Function
  End If

  If (Len(theForm.lm.value) > 12) Then
    MsgBox "在 lm 域中，请最多输入 12 个字符。", 0, "有效性验证错误"
    theForm.lm.focus()
    FrontPage_Form2_onsubmit = False
    Exit Function
  End If
  FrontPage_Form2_onsubmit = True 
End Function
--></script><!--webbot BOT="GeneratedScript" endspan --><form method="POST" action="admin_news_lm_add_save.asp" name="FrontPage_Form2"><tr>
		<td background="../images/bj3.jpg" height="25">
		
			<p align="center">
			<span style="font-size: 9pt">增加一级栏目</span>&nbsp;<!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="1" i-maximum-length="12" --><input type="text" name="lm" size="20" maxlength="12">&nbsp;&nbsp;
			<input type="submit" value="增加" name="B1"></p>
		
		</td>
	</tr></form>
<%
if trim(request("action"))<>"" then
%>
	<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="VBScript" Type="text/vbscript"><!--
function FrontPage_Form3_onsubmit()
  Set theForm = document.FrontPage_Form3

  If (theForm.lmname.value = "") Then
    MsgBox "请在 子栏目名称 域中输入值。", 0, "有效性验证错误"
    theForm.lmname.focus()
    FrontPage_Form3_onsubmit = False
    Exit Function
  End If

  If (Len(theForm.lmname.value) < 1) Then
    MsgBox "在 子栏目名称 域中，请至少输入 1 个字符。", 0, "有效性验证错误"
    theForm.lmname.focus()
    FrontPage_Form3_onsubmit = False
    Exit Function
  End If

  If (Len(theForm.lmname.value) > 40) Then
    MsgBox "在 子栏目名称 域中，请最多输入 40 个字符。", 0, "有效性验证错误"
    theForm.lmname.focus()
    FrontPage_Form3_onsubmit = False
    Exit Function
  End If
  FrontPage_Form3_onsubmit = True 
End Function
--></script><!--webbot BOT="GeneratedScript" endspan --><form method="POST" action="admin_news_lm.asp?lmid=<%=trim(request("lmid"))%>&action=<%=trim(request("action"))%>" name="FrontPage_Form3"><tr>
		<td background="../images/bj4.jpg" height="25">
			
				<p align="center">
				&nbsp;<%=trim(request("oldlm"))%>　<!--webbot bot="Validation" s-display-name="子栏目名称" b-value-required="TRUE" i-minimum-length="1" i-maximum-length="40" --><input type="text" name="lmname" size="20" maxlength="40">　　<input type="submit" value="添加子栏目" name="B3">&nbsp;
				<a href="admin_news_lm.asp">取消添加子栏目</a></p>
			
		</td>
	</tr></form>
<%
end if
%>
</table>
<div align="center">
<table border="1" width="100%" id="table2" cellpadding="3" style="border-collapse: collapse" cellspacing="0" bordercolor="#CCCCCC">
	<tr>
		<td align="center" width="331" background="../images/bj5.jpg" height="25">
		<font color="#FFFFFF">栏目名称</font></td>
		<td align="center" width="99" background="../images/bj5.jpg" height="25">
		<font color="#FFFFFF">子栏目</font></td>
		<td align="center" width="122" background="../images/bj5.jpg" height="25">
		<font color="#FFFFFF">模版(<a href="admin_mb.asp"><font color="#FFFFFF">管理</font></a>)</font></td>
		<td align="center" width="176" background="../images/bj5.jpg" height="25">
		<font color="#FFFFFF">操作</font></td>
	</tr>
<%
lll="<img src=../images/001.gif border=0 height=20 width=17>"

sql = "select * from lm where lm<>'' order by id asc"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1

if rs.recordcount<>0 then
 for i=0 to rs.recordcount
%>
	<tr>
		<td width="331" bgcolor="#EFEFEF">
		<%
		  response.write "<B><font color="&rs("fontcolor")&">"&rs("lm")&"</font></b>"

		%><font color=999999>[<a href=admin_news_lm.asp?lmid=<%=rs("id")%>&action=lm2add&oldlm=<%=rs("lm")%>><font color="#999999">添加二级栏目</font></a>]</font><font color="#0000FF">(</font><a href="rssnews.asp?lm=<%=rs("id")%>" target=_blank><font color="#0000FF">RSS</font></a><font color="#0000FF">)</font></td>
		<td width="99" bgcolor="#EFEFEF">
		<p align="center">
		<%
           sql2 = "select * from lm where lmid='"&rs("id")&"'"
           Set rs2 = Server.CreateObject("ADODB.RecordSet")
           rs2.Open sql2,conn,1,1
           response.write rs2.recordcount&"个"
		%>
		</td>
		<td width="122" bgcolor="#EFEFEF" align=center>
		  <%
		    mb=rs("mb")
		    if mb<>"" then
		    	sql5 = "select * from newsmb where id="&mb
		    	Set rs5 = Server.CreateObject("ADODB.RecordSet")
		    	rs5.Open sql5,conn,1,1
		    	if rs5.recordcount<>0 then
				    Response.Write rs5("title")
				else
					Response.Write "<font color=blue>模版没有或已删除</font>" 
				end if
				rs5.close
				set rs5=nothing
			else
				Response.Write "<font color=blue>模版不正确</font>" 
			end if
		  %>
		　</td>
		<td width="176" bgcolor="#EFEFEF">
		<p align="center">
		<%
		if Request.Cookies("admindj")="1" then
		%><a href="admin_lm_mb.asp?id=<%=rs("ID")%>&lmname=<%=rs("lm")%>">模版</a> <a href=../admin_htmlsc.asp?lm=<%=rs("id")%> title="将此栏目及子栏目所有文章生成静态HTML">静</a> <a href=../admin_htmlqx.asp?lm=<%=rs("id")%> title="将此栏目及子栏目所有文章取消静态HTML">动</a> <a href="admin_lm_edit.asp?id=<%=rs("id")%>&xwsl=<%=xwsl%>">修改</a> <a onclick='{if(confirm("您确定删除吗?此操作将不能恢复!")){return true;}return false;}' href="admin_news_lm.asp?delid=<%=rs("ID")%>&lm=<%=rs("lm")%>">删</a> <a href=admin_code.asp?lm=<%=rs("id")%>>调用</a></td>
		<%
		 end if
		%>
	</tr>
  <%
    sql3 = "select * from lm where lmid='"&rs("ID")&"' and lm2<>'' order by id asc"
    Set rs3 = Server.CreateObject("ADODB.RecordSet")
    rs3.Open sql3,conn,1,1
    while not rs3.eof
  %>	
	<tr>
		<td width="331">　├ <a href=admin_news_list.asp?lm=<%=rs3("id")%>><font color=<%=rs3("fontcolor")%>><%=rs3("lm2")%></font></a><font color="#999999">[<a href=admin_news_lm.asp?lmid=<%=rs3("id")%>&action=lm3add&oldlm=<%=rs3("lm2")%>><font color="#999999">添加三级栏目</font></a>]</font><font color="#0000FF">(</font><a href="rssnews.asp?lm=<%=rs3("id")%>" target=_blank><font color="#0000FF">RSS</font></a><font color="#0000FF">)</font></td>
		<td width="99">文章：
		  <%
		    sql4 = "select * from news where lm2='"&rs3("id")&"' order by id desc"
		    Set rs4 = Server.CreateObject("ADODB.RecordSet")
		    rs4.Open sql4,conn,1,1
		    response.write rs4.recordcount
		  
		  %>
		</td>
		<td width="122" align=center>
		  <%
		    mb=rs3("mb")
		    if mb<>"" then
		    	sql5 = "select * from newsmb where id="&mb
		    	Set rs5 = Server.CreateObject("ADODB.RecordSet")
		    	rs5.Open sql5,conn,1,1
		    	if rs5.recordcount<>0 then
				    Response.Write rs5("title")
				else
					Response.Write "<font color=blue>模版没有或已删除</font>" 
				end if
				rs5.close
				set rs5=nothing
			else
				Response.Write "<font color=blue>模版不正确</font>" 
			end if
		  %>
		</td>
		<td width="176">
		<p align="center">
		<%
		if Request.Cookies("admindj")="1" then
		%><a href="admin_lm_mb.asp?id=<%=rs3("ID")%>&lmname=<%=rs3("lm2")%>">模版</a> <a href=../admin_htmlsc.asp?lm=<%=rs3("id")%> title="将此栏目及子栏目所有文章生成静态HTML">静</a> <a href=../admin_htmlqx.asp?lm=<%=rs3("id")%> title="将此栏目及子栏目所有文章取消静态HTML">动</a> <a href="admin_lm_edit.asp?id=<%=rs3("id")%>&xwsl=<%=rs4.recordcount%>&lm1id=<%=trim(request("id"))%>&lmname=<%=trim(request("lm"))%>">修改</a> <a onclick='{if(confirm("您确定删除吗?此操作将不能恢复!")){return true;}return false;}' href="admin_news_lm.asp?delid=<%=rs3("ID")%>&lmid=<%=trim(request("id"))%>">删</a> <a href=admin_code.asp?lm=<%=rs("id")%>>调用</a></td>
		<%
		end if
		%>
	</tr>
<%
Set rs33 = Server.CreateObject("ADODB.RecordSet")
rs33.Open "select * from [lm] where lmid='"&rs3("id")&"' and lm3<>'' order by id asc",conn,1,1
while not rs33.eof
%>
	<tr style='background-color: #F4F4F4'>
		<td width="331">　　　├&nbsp;<a href=admin_news_list.asp?lm=<%=rs33("id")%>><font color=<%=rs33("fontcolor")%>><%=rs33("lm3")%></font></a><font color="#0000FF">(</font><a href="rssnews.asp?lm=<%=rs33("id")%>" target=_blank><font color="#0000FF">RSS</font></a><font color="#0000FF">)</font></td>
		<td width="99">
			<%
				Set rs331 = Server.CreateObject("ADODB.RecordSet")
				rs331.Open "select id,lm3 from [news] where lm3='"&rs33("id")&"' order by id desc",conn,1,1
				Response.Write "文章： "&rs331.recordcount
				
			%>
		</td>
		<td width="122" align=center>
				  <%
		    mb=rs33("mb")
		    if mb<>"" then
		    	sql5 = "select * from newsmb where id="&mb
		    	Set rs5 = Server.CreateObject("ADODB.RecordSet")
		    	rs5.Open sql5,conn,1,1
		    	if rs5.recordcount<>0 then
				    Response.Write rs5("title")
				else
					Response.Write "<font color=blue>模版没有或已删除</font>" 
				end if
				rs5.close
				set rs5=nothing
			else
				Response.Write "<font color=blue>模版不正确</font>" 
			end if
		  %>
		</td>
		<td width="176" align=center><a href="admin_lm_mb.asp?id=<%=rs33("ID")%>&lmname=<%=rs33("lm3")%>">模版</a> <a href=../admin_htmlsc.asp?lm=<%=rs33("id")%> title="将此栏目及子栏目所有文章生成静态HTML">静</a> <a href=../admin_htmlqx.asp?lm=<%=rs33("id")%> title="将此栏目及子栏目所有文章取消静态HTML">动</a> <a href="admin_lm_edit.asp?id=<%=rs33("id")%>&xwsl=<%=rs331.recordcount%>&lm1id=<%=trim(request("id"))%>&lmname=<%=trim(request("lm"))%>">修改</a> <a onclick='{if(confirm("您确定删除吗?此操作将不能恢复!")){return true;}return false;}' href="admin_news_lm.asp?delid=<%=rs33("id")%>">删</a> <a href=admin_code.asp?lm2=<%=rs("id")%>>调用</a></td>
	</tr>
<%
rs33.movenext
wend



rs3.movenext
wend


  rs.movenext
  if rs.eof then exit for
 next
end if
%>

	
</table>
</td>
		</tr>
		<tr>
			<td>
　</td>
		</tr>
	</table>
</div>
</div>

</body>

</html>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>