📄 admin_news_lm_move.asp
字号:
<!--#include file = admin_chk.asp -->
<%
If DataBaseType=0 then
If Not ChkAdmin("News_Class") Then
Call ArtErr("","")
End If
Response.Write "<html>"
Response.Write"<head>"
Response.Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
Response.Write"<link href=""../images/admin/style.css"" rel=""stylesheet"" type=""text/css"">"
Response.Write"</head><body>"
Response.write " <table cellpadding=2 cellspacing=1 border=0 width=98% class=tableBorder align=center>"
Response.Write"<tr align=center>"
Response.Write"<th height=25 align=center colspan=2><strong>栏目移动管理</strong></th>"
Response.Write"</tr>"
Response.Write" <tr>"
Response.Write" <td width=12% height=30 class=forumRow> <strong>管理导航:</strong></td>"
Response.Write" <td width=88% height=30 class=forumRow><a href='admin_news_lm.asp'>栏目管理</a> | <a href='admin_news_lm_move.asp'>栏目移动</a>"
Response.Write" </td>"
Response.Write " </tr>"
Response.Write"</TABLE>"
action=trim(request("action")) '取出操作参数
'if action="" then create_temp_table()
'if action="hao_up" then done_hao_up()
'if action="hao_down" then done_hao_down()
'if action="lm_up" then done_lm_up() '栏目位置上移
' if action="lm_down" then done_lm_down()
' if action="show" then show_lm_window() '栏目位置上移
' if action="Move_OK" then move_lm_ok() '同意进行移动时。
Select Case action
Case "hao_up" '栏目顺序上移
Call done_hao_up()
Case "hao_down" '栏目顺序上移
Call done_hao_down()
Case "lm_up" '栏目位置上移
Call done_lm_up()
Case "lm_down" '栏目位置上移
Call done_lm_down()
Case "show" '栏目位置上移
Call show_lm_window()
Case "Move_OK" '同意进行移动时。
Call move_lm_ok()
Case Else
Call create_temp_table() '第一次进入时
End Select
call CloseConn()
call AdminPageEnd()
Response.Write "</body></html>"
Else
Call ArtErr("<li>当前数据库类型为MSSQL,不支持此操作!</li>",1)
End If
'显示栏目的视图
sub show_lm_window()
move_after_id=clng(request("move_after_id"))
'对移动后的记录做个标识,以便用户清楚看到移动哪里去了。
if move_after_id<>0 then
move_icon="<font color='red'>←◆</font>"
else
move_icon=""
end if
%>
<table width="100%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#658BD8" bgcolor="#FFFFFF">
<form method="POST" action="admin_news_lm_move.asp?action=Move_OK" name="form1">
<tr align="center">
<td width="35%"> <!-- 大表格的第一列,大表格共一行,两列占35%和65%宽度,第1列包括旧栏目表的顺序和栏目名称,第二列包括新栏目的顺序操作,栏目移动,新栏目名称 -->
<!-- 旧栏目视图的记录输出 -->
<table width="100%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#658BD8" bgcolor="#FFFFFF">
<tr align="center">
<td height="25" background="../images/bg1.gif">
<font color="#FFFFFF">旧栏目视图</font>
</td>
</tr>
<%
'开始处理栏目移动程序.
sql = "select * from lm where lm<>'' order by id_desc,id"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
if rs.recordcount>0 then
do while not rs.eof
%>
<tr>
<!-- 旧栏目视图 -->
<td><B><font color="<%=rs("fontcolor")%>"><%=rs("lm")%></font></b></td>
</tr>
<!-- 判断第二级栏目 -->
<%
sql2= "select * from lm where lmid='"&rs("ID")&"' and lm2<>'' order by id_desc,id "
Set rs2 = Server.CreateObject("ADODB.RecordSet")
rs2.Open sql2,conn,1,1
do while not rs2.eof
%>
<tr>
<!-- 旧二级栏目视图 -->
<td><font color="<%=rs2("fontcolor")%>"> ├<%=rs2("lm2")%></font></td>
</tr>
<!-- 判断第三级栏目 -->
<%
sql3="select * from [lm] where lmid='"&rs2("id")&"' and lm3<>'' order by id_desc,id"
Set rs3 = Server.CreateObject("ADODB.RecordSet")
rs3.Open sql3,conn,1,1
do while not rs3.eof
%>
<tr>
<!-- 旧第三级子栏目视图 -->
<td><font color="<%=rs3("fontcolor")%>"> ├<%=rs3("lm3")%></font></td>
</tr>
<!-- 判断第二级栏目 -->
<%
rs3.movenext
loop '二级rs3循环
rs3.close
set rs3=nothing
rs2.movenext
loop '二级rs2循环
rs2.close
set rs2=nothing
rs.movenext
loop '一级rs循环
else '无一级栏目时。
%>
<tr><td >暂无栏目记录</td></tr>
<%
end if '旧栏目视图结束
rs.close
set rs=nothing
%>
</table>
<!-- 旧栏目的表格结束 -->
</td> <!-- table1的第一大列结束 -->
<td width="65%"> <!-- table1的第二大列开始 -->
<!-- 新栏目视图的记录输出 -->
<table width="100%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#658BD8" bgcolor="#FFFFFF">
<tr align="center">
<td width="45" height="25" background="../images/bg1.gif">
<font color="#FFFFFF">顺序号</font>
</td>
<td width="90" height="25" background="../images/bg1.gif">
<font color="#FFFFFF">改变顺序</font>
</td>
<td width="90" height="25" background="../images/bg1.gif">
<font color="#FFFFFF">栏目移动</font>
</td>
<td height="25" background="../images/bg1.gif">
<font color="#FFFFFF">新栏目视图</font>
</td>
</tr>
<%
'取
nhao=0 '顺序号
class1_hao=0 '第一级顺序号
temp_sql = "select * from _temp_lm where lm<>'' order by id_desc,id"
Set temp_rs = Server.CreateObject("ADODB.RecordSet")
temp_rs.Open temp_sql,conn,1,3
if temp_rs.recordcount>0 then
do while not temp_rs.eof
nhao=nhao+1
class1_hao=class1_hao+1 '第一级顺序号
%>
<tr>
<!-- 顺序号 -->
<td width="45" align="center"><%=nhao%></td>
<!-- 顺序移动 -->
<td width="90" align="center">
<% if class1_hao>1 then %>
<a href="?id=<%=temp_rs("id")%>&action=hao_up&class=1&lm=<%=temp_rs("lm")%>&lmid=0&id_desc=<%=class1_hao-1%>"><font color="green">↑上移</font></a>
<% else %>
<font color="#CCCCCC">↑上移</font>
<% end if %>
<% if class1_hao<temp_rs.recordcount then %>
<a href="?id=<%=temp_rs("id")%>&action=hao_down&class=1&lm=<%=temp_rs("lm")%>&lmid=0&id_desc=<%=class1_hao+1%>"><font color="green">下移↓</font></a>
<% else %>
<font color="#CCCCCC">下移↓</font>
<% end if %>
<%temp_rs("id_desc")=class1_hao%>
</td>
<!-- 一级栏目移动 -->
<td width="90" align="center" ><font color="#CCCCCC">↑上移 下移↓</font></a>
</td>
<!-- 新栏目视图 -->
<td>
<B><font color="<%=temp_rs("fontcolor")%>"><%=temp_rs("lm")%></font></b>
<% if temp_rs("id")=move_after_id then response.write move_icon %>
</td>
</tr>
<!-- 二级栏目 -->
<!-- 判断第二级栏目 -->
<%
'取下移的ID
if class1_hao+1<=temp_rs.recordcount then
temp_rs.movenext '先移下一记录,取得下一个ID号
dw1_id=temp_rs("id")
dw1_lmid=temp_rs("lmid")
temp_rs.MovePrevious '再移回原来的位置.
else
dw1_id=0
dw1_lmid=""
end if
class2_hao=0
temp_sql2= "select * from _temp_lm where lmid='"&temp_rs("ID")&"' and lm2<>'' order by id_desc,id "
Set temp_rs2 = Server.CreateObject("ADODB.RecordSet")
temp_rs2.Open temp_sql2,conn,1,3
do while not temp_rs2.eof
nhao=nhao+1
class2_hao=class2_hao+1
%>
<tr>
<!-- 顺序号 -->
<td width="45" align="center"><%=nhao%></td>
<!-- 顺序移动 -->
<td width="90" align="center">
<!-- 顺序上移 -->
<% if class2_hao>1 then %>
<a href="?id=<%=temp_rs2("id")%>&action=hao_up&class=2&lm=<%=temp_rs2("lm2")%>&lmid=<%=temp_rs2("lmid")%>&id_desc=<%=class2_hao-1%>"><font color="green">↑上移</font></a>
<% else %>
<font color="#CCCCCC">↑上移</font>
<% end if %>
<% if class2_hao<temp_rs2.recordcount then %>
<a href="?id=<%=temp_rs2("id")%>&action=hao_down&class=2&lm=<%=temp_rs2("lm2")%>&lmid=<%=temp_rs2("lmid")%>&id_desc=<%=class2_hao+1%>"><font color="green">下移↓</font></a>
<% else %>
<font color="#CCCCCC">下移↓</font>
<% end if %>
<%temp_rs2("id_desc")=class2_hao%>
</td>
<!-- 栏目移动 -->
<td width="90" align="center" >
<!--二级栏目上移 -->
<% if up1_id<>0 then %>
<a href="?action=lm_up&class=2&id=<%=temp_rs2("id")%>&lmid=<%=temp_rs2("lmid")%>&m_id=<%=up1_id%>&m_lmid=<%=up1_lmid%>"><font color="red">↑上移</font></a>
<%
else
%>
<font color="#CCCCCC">↑上移</font>
<% end if %>
<!--二级栏目下移 -->
<% if dw1_id<>0 then %>
<a href="?action=lm_down&class=2&id=<%=temp_rs2("id")%>&lmid=<%=temp_rs2("lmid")%>&m_id=<%=dw1_id%>&m_lmid=<%=dw1_lmid%>"><font color="red">下移↓</font></a>
<% else %>
<font color="#CCCCCC">下移↓</font>
<% end if %>
</td>
<!-- 新二级栏目视图 -->
<td>
<font color="<%=temp_rs2("fontcolor")%>"> ├<%=temp_rs2("lm2")%></font>
<% if temp_rs2("id")=move_after_id then response.write move_icon %>
</td>
</tr>
<!-- 判断第三级栏目 -->
<%
'取下移的ID
if class2_hao+1<=temp_rs2.recordcount then
temp_rs2.movenext '先移下一记录,取得下一个ID号
dw2_id=temp_rs2("id")
dw2_lmid=temp_rs2("lmid")
temp_rs2.MovePrevious '再移回原来的位置.
else
'调试难点:如果刚好某个最后的二级栏目有三级栏目存在时,会出错。正确是继续往后找到一个二级栏目。把最后的三级栏下移到下一个有二级栏目存在的ID上。
if class1_hao+1<temp_rs.recordcount then
temp_rs.movenext
temp_sql2_temp="select * from _temp_lm where lmid='"&temp_rs("ID")&"' and lm2<>'' order by id_desc,id "
Set temp_rs2_temp= Server.CreateObject("ADODB.RecordSet")
temp_rs2_temp.Open temp_sql2_temp,conn,1,3
if temp_rs2_temp.recordcount>0 then
dw2_id=temp_rs2_temp("id")
dw2_lmid=temp_rs2_temp("lmid")
else
dw2_id=0
dw2_lmid=""
end if
temp_rs.MovePrevious
else
dw2_id=0
dw2_lmid=""
end if
end if ''结束条件class1_hao+1<=temp_rs.recordcount then
'结束取出下一个二级栏目的ID.
class3_hao=0
temp_sql3="select * from _temp_lm where lmid='"&temp_rs2("id")&"' and lm3<>'' order by id_desc,id"
Set temp_rs3 = Server.CreateObject("ADODB.RecordSet")
temp_rs3.Open temp_sql3,conn,1,3
do while not temp_rs3.eof
nhao=nhao+1
class3_hao=class3_hao+1
%>
<tr>
<!-- 顺序号 -->
<td width="45" align="center"><%=nhao%></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -