📄 eblank.asp
字号:
<%
'************************************************************************************************
' 文件名: blank.asp
' Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'
' 创建人 : 蔡晓燕
' 日 期 : 2002-11-10
'
' 修改历史 :
' ****年**月**日 ****** 修改内容:**************************************************
' 功能描述 : 空白文件,用于树结构生成,在sysmgr_main中使用。
' 版 本 :
'************************************************************************************************
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<!-- #include file="../include/common.inc" -->
<!-- #include file="../include/commonpage.inc" -->
<!-- #include file="sysmgr.inc" -->
<link rel="stylesheet" href="ftstyle.css">
<!-- Infrastructure code for the tree -->
<script language = "Javascript" src = "tree/myft_new.js"></script>
<script language = "Javascript" src = "tree/ftoptions.js"></script>
<script language = "Javascript">
//这是自己添加的function,用于添加子系统
function AddChildSys(pId)
{
parent.frames('basefrm').location.href= 'updatesys.asp?id='+ pId + '&addtype=addchild';
}
function AddRootSys(pId)
{
parent.frames('basefrm').location.href= 'updatesys.asp';
}
</script>
<script language="JavaScript">
//修改此处可以修改页面风格
defFolderFont = "<font><span style=\"font-family:宋体; font-size:9pt\">"
defDocFont = "<font><span style=\"font-family:宋体; font-size:9pt\">"
// styleSheetFile = "../include/common.css"
<%
response.write "fT = gFld(""设备系统树形结构"& "<span title=点击可增加根系统 onclick='return AddRootSys();' >" & "<img border=0 src='images/add.gif'></span>" &""", ""updatesys.asp"");"
dim rs, rs1, top, sql_text, stacktop, i, ParentLevel, conn
set conn=DBConnection
set rs = Server.CreateObject("ADODB.Recordset")
set rs1 = Server.CreateObject("ADODB.Recordset")
' 查找所有父节点为"0"的节点,即"根系统"
sql_text = "select * from t_sys where parent_id=0 order by sys_id asc"
' response.write sql_text
' response.end
rs.open sql_text, conn
' 定义堆栈。可根据实际情况定义大小。此处是10('6'是指每个栈元素分别存放6个字段值)
dim stack(100,8)
while not rs.eof
stack(0,0) = rs("sys_id")
stack(0,1) = rs("sys_desc")
stack(0,2) = rs("sys_level")
stack(0,3) = rs("parent_id")
stack(0,4) = rs("remark")
stack(0,5) = rs("has_child")
stack(0,6) = 0
top = 1
do until top = 0
stacktop = stack(top-1,0)
' 查找所有父节点为栈顶节点的记录
sql_text = "select * from t_sys where parent_id = " & StackTop & " order by sys_id desc"
rs1.open sql_text, conn
ParentLevel = stack(top-1,6)
' 清空栈顶之前获得父记录的层数
' 输出栈顶元素
' if stack(top-1,5) = 1 and stack(top-1,2) = 1 then'输出根枝节点
' Response.write "aux1 = insFld(fT, gFld("""& stack(top-1,1) & """, ""updatesys.asp?id="& stack(top-1,0)&" ""));"
' elseif stack(top-1,5) = 1 then'输出枝节点
' Response.write "aux"&stack(top-1,2)&"=insFld(aux"&stack(top-1,2)-1 & ", gFld("""&stack(top-1,1)&""", ""updatesys.asp?id="& stack(top-1,0)&" ""));"
' elseif stack(top-1,2) = 1 then'输出根页节点
' Response.write "insDoc(fT, gLnk("""&stack(top-1,1)&""", ""updatesys.asp?id="& stack(top-1,0)&" ""));"
' else '输出页节点
' Response.write "insDoc(aux"&stack(top-1,2)-1 & ", gLnk("""&stack(top-1,1)&""", ""updatesys.asp?id="& stack(top-1,0)&" ""));"
' end if
'
' 以下代码生成树状列表的内容,形似如下结构
' 根文件夹(即parent_id=0 and has_child=1): aux1 = insFld(fT, gFld("Europe", "ftbase2.htm"))
' 非根文件夹(即parent_id<>0 and has_child=1): aux2 = insFld(aux1, gFld("United Kingdom", "ftbase3.htm"))
' 根文件(即parent_id=0 and has_child=0): insDoc(fT, gLnk("Edinburgh", "ftbase2.htm"))
' 非根文件(即parent_id<>0 and has_child=0): insDoc(aux3, gLnk("Edinburgh", "ftbase2.htm"))
dim s1,s2,s3,s4,s5,s6,s7,s
s1 = "aux" & (ParentLevel + 1)
s2 = "aux" & ParentLevel
s3 = "<a target=basefrm href=updatesys.asp?id="&stack(top-1,0)&">"&stack(top-1,1)&"</a>"
s3 = s3 & "<span title=点击可在该系统下增加子系统 onclick='return AddChildSys("&stack(top-1,0)&");' >" & " <img border=0 src='images/add.gif'></span>"
s4 = "updatesys.asp?id="&stack(top-1,0)
s5 = "gFld("""& s3 &""","""& s4 &""")"
s7 = "gLnk("""& s3 &""","""& s4 &""")"
if ParentLevel = 0 and stack(top-1,5) = 1 then'输出根文件夹
' Response.write "aux1 = insFld(fT, gFld(""" & "<span title=点击可增加子系统 onclick='return AddChildSys("&stack(top-1,0)&");' >" & stack(top-1,1) & "</span>" &""", ""updatesys.asp?id="& stack(top-1,0)&" ""));"
s6 = "insFld("& "fT" &","& s5 &")"
s = s1 & "=" & s6 & ";"
response.write s
elseif stack(top-1,5) = 1 then'输出非根文件夹
s6 = "insFld("& s2 &","& s5 &")"
s = s1 & "=" & s6 & ";"
response.write s
elseif ParentLevel = 0 then'输出根文件
s6 = "insDoc("& "fT" &","& s7 &")"
s = s6 & ";"
response.write s
else '输出非根文件
s6 = "insDoc("& s2 &","& s7 &")"
s = s6 & ";"
response.write s
' Response.write "insDoc(aux"& ParentLevel & ", gLnk("""&s3&""", ""updatesys.asp?id="& stack(top-1,0)&" ""));"
end if
for i = 0 to 5
' 清空堆栈顶部
stack(top-1,i) = ""
next
' 栈顶向下移动一格
top = top - 1
while not rs1.eof
stack(top, 0) = rs1("sys_id")
stack(top, 1) = rs1("sys_desc")
stack(top, 2) = rs1("sys_level")
stack(top, 3) = rs1("parent_id")
stack(top, 4) = rs1("remark")
stack(top, 5) = rs1("has_child")
' 将查找到的栈顶节点"派生出"的全部子记录存入堆栈
stack(top, 6) = ParentLevel + 1
rs1.movenext
top = top + 1
wend
rs1.close
loop
rs.movenext
wend
rs.close
set rs = nothing
set rs1 = nothing
%>
</script>
</HEAD>
<BODY>
<script language="JavaScript">
self.rewritepage();
</script>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -