?? admin_menu.asp
字號:
<!-- #include file="Setup.asp" -->
<!-- #include file="CheckAdmin.asp" -->
<%
if RequestCookies("Userpass")="" or RequestCookies("Userpass")<>session("pass") then Response.Write ("<script>top.location.href='login.asp';</script>")
if UserRoleID <> 1 then Alert("您沒有權限進入后臺")
MenuID=RequestInt("MenuID")
SortNum=RequestInt("SortNum")
ParentID=RequestInt("ParentID")
Name=HTMLEncode(Request("Name"))
Url=HTMLEncode(Request("Url"))
select case Request("menu")
case ""
Show
case "add"
add
case "addok"
Rs.Open "[Wo_Menus]",Conn,1,3
Rs.addNew
Rs("name")=Name
Rs("url")=Url
Rs("ParentID")=ParentID
Rs("SortNum")=SortNum
Rs.update
Rs.close
Show
case "edit"
edit
case "editok"
editok
case "Del"
Conn.execute("Delete from [Wo_Menus] where MenuID="&MenuID&" ")
Show
end select
Sub Show
%>
群組菜單管理<br>
<form method="POST" action="?menu=addok" name=form>
<input type=hidden name=ParentID value=0>
<input type=hidden name=SortNum value=1>
<input type=hidden name=url value="#">
菜單名稱:(例如:插件)<input name="name"> <input type="submit" value="添加"></form>
<table cellspacing=1 cellpadding=5 width=70% border=0 id=CommonListArea align=center>
<%Adminmenu(0)%>
</table>
<br>
<%
End Sub
Sub add
%>
<form method="POST" action="?menu=addok" name=form>
<table cellspacing="1" width="60%" border="0" id=CommonListArea align="center">
<tr id=CommonListTitle3>
<td align="center" colspan="4">添加菜單</td>
</tr>
<tr id=CommonListCell>
<td align="right" width="10%">標題:</td>
<td width="40%"><input name="name"></td>
<td align="right" width="10%">分類:</td>
<td width="40%">
<select name="ParentID">
<option value="0">一級菜單</option>
<%
sql="Select * From [Wo_Menus] where ParentID=0 order by SortNum"
Set Rs1=Conn.Execute(sql)
do while not rs1.eof
%>
<option value="<%=rs1("MenuID")%>" <%if MenuID=Rs1("MenuID") then%>selected<%end if%>><%=rs1("name")%></option>
<%
rs1.Movenext
loop
Set Rs1 = Nothing
%>
</select>
</td>
</tr>
<tr id=CommonListCell>
<td align="right" width="10%">鏈接:</td>
<td width="40%"><input name="url"></td>
<td align="right" width="10%">排序:</td>
<td width="40%"><input size="2" value="1" name="SortNum"> 從小到大排序</td>
</tr>
<tr id=CommonListCell>
<td align="center" width="100%" colspan="4">
<input type="submit" value=" 添 加 "> <input type="reset" value=" 重 填 ">
</td>
</tr>
</table>
<%
End Sub
Sub editok
if MenuID=Request("ParentID") then Alert("設置錯誤")
Rs.Open "select * from [Wo_Menus] where MenuID="&MenuID&"",Conn,1,3
Rs("name")=name
Rs("url")=url
Rs("ParentID")=ParentID
Rs("SortNum")=SortNum
Rs.update
Rs.close
Response.Write("編 輯 成 功 !")
End Sub
Sub edit
sql="Select * From [Wo_Menus] where MenuID="&MenuID&""
Set Rs=Conn.Execute(sql)
%>
<form method="POST" action="?menu=editok" name=form>
<input type=hidden name=MenuID value=<%=MenuID%>>
<table cellspacing="1" width="60%" border="0" id=CommonListArea align="center">
<tr id=CommonListTitle3>
<td align="center" colspan="4">編輯菜單</td>
</tr>
<tr id=CommonListCell>
<td align="right" width="10%">標題:</td>
<td width="40%"><input name="name" value="<%=Rs("name")%>"></td>
<td align="right" width="10%">分類:</td>
<td width="40%">
<select name="ParentID">
<option value="0">一級菜單</option>
<%
sql="Select * From [Wo_Menus] where ParentID=0 order by SortNum"
Set Rs1=Conn.Execute(sql)
do while not rs1.eof
%>
<option value="<%=rs1("MenuID")%>" <%if Rs("ParentID")=rs1("MenuID") then%>selected<%end if%>><%=rs1("name")%></option>
<%
rs1.Movenext
loop
Set Rs1 = Nothing
%>
</select>
</td>
</tr>
<tr id=CommonListCell>
<td align="right" width="10%">鏈接:</td>
<td width="40%"><input name="url" value="<%=Rs("Url")%>" size="20"></td>
<td align="right" width="10%">排序:</td>
<td width="40%"><input size="2" value="<%=Rs("SortNum")%>" name="SortNum"> 從小到大排序</td>
</tr>
<tr id=CommonListCell>
<td align="center" width="100%" colspan="4">
<input type="submit" value=" 編 輯 ">
<input type="reset" value=" 重 填 "></td>
</tr>
</table>
<%
End Sub
Sub Adminmenu(selec)
sql="Select * From [Wo_Menus] where ParentID="&selec&" order by SortNum"
Set Rs1=Conn.Execute(sql)
do while not rs1.eof
if rs1("ParentID")=0 then
%>
<tr id=CommonListTitle3>
<td align=center><%=rs1("name")%></td>
<td align=right width=150><a href="Admin_Menu.asp?menu=add&MenuID=<%=rs1("MenuID")%>">添加</a> | <a href=Admin_Menu.asp?menu=edit&MenuID=<%=rs1("MenuID")%>>編輯</a> | <a href=Admin_Menu.asp?menu=Del&MenuID=<%=rs1("MenuID")%>>刪除</a></td>
</tr>
<%
else
response.write "<tr id=CommonListCell><td>"&rs1("name")&"(<a href="&rs1("url")&" target=_blank>"&rs1("url")&"</a>)</td><td align=right><a href=Admin_Menu.asp?menu=edit&MenuID="&rs1("MenuID")&">編輯</a> | <a href=Admin_Menu.asp?menu=Del&MenuID="&rs1("MenuID")&">刪除</a></td></tr>"
end if
Adminmenu(rs1("MenuID"))
rs1.Movenext
loop
Set Rs1 = Nothing
End Sub
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -