📄 admin_menu.asp
字号:
<!-- #include file="AdminCls.asp" -->
<%
CheckLogin()
Log("")
MenuID=ChkNumeric(Request("MenuID"))
ParentID=ChkNumeric(Request("ParentID"))
Name=HTMLEncode(Request("Name"))
Url=HTMLEncode(Request("Url"))
XmlFilePath=Server.MapPath("Inc/Menu.xml")
XMLDOM.load(XmlFilePath)
Set XMLRoot = XMLDOM.documentElement
Select case Request("menu")
case ""
Show
case "add"
add
case "addok"
if ParentID>=0 Then
Set TempNode = XMLDOM.createNode("element","Menu","")
TempNode.text = Name
XMLRoot.childNodes(ParentID).appendChild(TempNode)
Else
Set TempNode = XMLDOM.createNode("element","Category","")
AppendNewAttribute "Name",Name
XMLRoot.appendChild(TempNode)
end if
AppendNewAttribute "Url",Url
XMLDOM.save(XmlFilePath)
Set TempNode = nothing
Show
case "Del"
Set ParentNode=XMLRoot.childNodes(ParentID)
if MenuID>=0 Then
ParentNode.removeChild ParentNode.childNodes(MenuID)
Else
XMLRoot.removeChild ParentNode
end if
XMLDOM.save(XmlFilePath)
Set ParentNode=nothing
Show
case "editok"
if MenuID=Request("ParentID") Then Error2("设置错误")
if ParentID<0 Then
Set EditNode=XMLRoot.childNodes(MenuID)
EditNode.setAttribute "Name",Name
ElseIf ParentID>=0 Then
Set ParentNode=XMLRoot.childNodes(ParentID)
Set EditNode=ParentNode.childNodes(MenuID)
EditNode.text=Name
end if
EditNode.setAttribute "Url",Url
XMLDOM.save(XmlFilePath)
Set EditNode=nothing
Show
case "edit"
if ParentID<0 Then
Set EditNode=XMLRoot.childNodes(MenuID)
MenuName=EditNode.getAttribute("Name")
ElseIf ParentID>=0 Then
Set ParentNode=XMLRoot.childNodes(ParentID)
Set EditNode=ParentNode.childNodes(MenuID)
MenuName=EditNode.text
end if%>
<form method="post" name="form" action="?menu=editok">
<input type="hidden" name="MenuID" value="<%=MenuID%>" />
<div class="tb dt">
<div id="tt">编辑菜单</div>
<div class="tc b cb">
<div class="fl r si w0">标题</div>
<div class="fl r si w4"><input name="name" value="<%=MenuName%>" /></div>
<div class="fl r si w0">分类</div>
<div class="fl si w3a">
<select name="ParentID">
<option value="-1">一级菜单</option><%
For NodeIndex=0 To XMLRoot.childNodes.length-1
Set childNode=XMLRoot.childNodes(NodeIndex)
%><option value="<%=NodeIndex%>" <%if ParentID=NodeIndex then%>selected<%end if%>><%=childNode.getAttribute("Name")%></option><%
Next
Set childNode=nothing%>
</select>
</div>
</div>
<div class="tc b cb">
<div class="fl r si w0">链接</div>
<div class="fl r si w4"><input name="url" value="<%=EditNode.getAttribute("Url")%>" size="50" /></div>
</div>
<div class="tc ac"><input type="submit" id="submit" value="编 辑" /></div>
</div>
</form><%
Set EditNode=nothing
case "incshow"
incshow
end Select
sub editok
if MenuID=Request("ParentID") Then Error2("设置错误")
if ParentID<0 Then
Set EditNode=XMLRoot.childNodes(MenuID)
EditNode.setAttribute "Name",Name
ElseIf ParentID>=0 Then
Set ParentNode=XMLRoot.childNodes(ParentID)
Set EditNode=ParentNode.childNodes(MenuID)
EditNode.text=Name
end if
EditNode.setAttribute "Url",Url
XMLDOM.save(XmlFilePath)
Set EditNode=nothing
Show
end sub
sub add
%>
<form method="post" name="form" action="?menu=addok">
<div class="tb dt">
<div id="tt">添加菜单</div>
<div class="tc b cb">
<div class="fl r si w0">标题</div>
<div class="fl r si w4"><input name="name" /></div>
<div class="fl r si w0">分类</div>
<div class="fl si w3a">
<select name="ParentID">
<option value="-1">一级菜单</option><%
For NodeIndex=0 To XMLRoot.childNodes.length-1
Set childNode=XMLRoot.childNodes(NodeIndex)%><option value="<%=NodeIndex%>"<%if ParentID=NodeIndex then%> selected="selected"<%end if%>><%=childNode.getAttribute("Name")%></option>
<%Next
Set childNode=nothing%>
</select>
</div>
</div>
<div class="tc b cb">
<div class="fl r si w0">链接</div>
<div class="fl r si w4"><input name="url" size="50" /></div>
</div>
<div class="tc ac"><input type="submit" id="submit" value="添 加" /></div>
</div>
<%
end sub
sub Show
%>
<form method="post" name="form" action="?menu=addok">
<input type="hidden" name="ParentID" value="-1" />
<input type="hidden" name="url" value="#" />
<div class="tb dt"><div id="tt">添加父级菜单</div><div class="tc ac">菜单名称:<input name="name" /> <input type="submit" id="submit" value="添加" /></div></div>
</form>
<div class="tb dt">
<%Adminmenu(0)%>
</div>
<%
end sub
sub Adminmenu(selec)
For NodeIndex=0 To XMLRoot.childNodes.length-1
Set ParentNode=XMLRoot.childNodes(NodeIndex)
%>
<div id="tt"><div class="fl"><%=ParentNode.getAttribute("Name")%></div>
<div class="fr">
<a href="?menu=add&ParentID=<%=NodeIndex%>">添加</a> |
<a href="?menu=edit&ParentID=-1&MenuID=<%=NodeIndex%>">编辑</a> |
<a href="?menu=Del&ParentID=<%=NodeIndex%>&MenuID=-1">删除</a>
</div>
</div><%
For j=0 To ParentNode.childNodes.length-1
Set childNode=ParentNode.childNodes(j)
%>
<div class="tc b cb">
<div class="fl"><%=childNode.text%>(<a href=<%=childNode.getAttribute("Url")%> target=_blank><%=childNode.getAttribute("Url")%></a>)</div>
<div class="fr">
<a href="?menu=edit&ParentID=<%=NodeIndex%>&MenuID=<%=j%>">编辑</a> |
<a href="?menu=Del&ParentID=<%=NodeIndex%>&MenuID=<%=j%>">删除</a>
</div>
</div>
<%
Next
Set childNode=nothing
Next
Set ParentNode=nothing
end sub
sub incshow
%><div class="tb dt">
<div id="tt">调用代码管理</div>
<%
XMLDOM.load(Server.MapPath(XmlPath&"CustomTransfer.xml"))
Set XMLRoot=XMLDOM.documentElement
i=0
for each child in XMLRoot.childNodes
set childsearch=XMLRoot.childnodes(i)
Name=childsearch.getAttributeNode("name").nodeValue
ID=childsearch.getAttributeNode("id").nodeValue
Html=childsearch.text
%><div class="tc b cb"><div class="fl r t w3"><b><%=Name%></b></div><div class="fl t"><textarea cols="1" rows="1"><script src="<%=Cache("SiteUrl")&"New.asp?id="&i%>"></script></textarea></div></div><%
i=i+1
next
set XMLRoot=nothing
%></div><%
end sub
AdminBottom%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -