<%
Class clsMenuInfo
Public menuName ' 메뉴명
Public menuLink ' 메뉴 링크
Public menuStep ' 메뉴 단계
End Class
Dim XMLDOM, Rootnode, Currentnode, xml_filename, i,j,k, nCount
dim lowtree ' 하위 노드 여부
dim c_lowtree ' 하위 하위 노드 여부
nCount = 0
xml_filename = Request.ServerVariables("APPL_PHYSICAL_PATH")& "tree.xml"
Set XMLDOM = Server.CreateObject("Microsoft.XMLDOM")
XMLDOM.load xml_filename
'--------------------------------------------------
' 1 depth
'--------------------------------------------------
Set Rootnode = XMLDOM.DocumentElement
For i = 0 to Rootnode.Childnodes.length - 1
lowtree = Rootnode.Childnodes(i).Attributes(1).Text
if lowtree = "true" then
ReDim Preserve menuInfo(nCount + 1)
Set menuInfo(nCount) = New clsMenuInfo
menuInfo(nCount).menuName = Rootnode.Childnodes(i).Attributes(0).Text
menuInfo(nCount).menuLink = ""
menuInfo(nCount).menuStep = "1"
nCount = nCount + 1
'--------------------------------------------------
' 2 depth
'--------------------------------------------------
Set Childnode = Rootnode.Childnodes(i)
For j = 0 to Childnode.Childnodes.length - 1
c_lowtree = Childnode.Childnodes(j).Attributes(1).Text
if c_lowtree = "true" then
ReDim Preserve menuInfo(nCount + 1)
Set menuInfo(nCount) = New clsMenuInfo
menuInfo(nCount).menuName = Childnode.Childnodes(j).Attributes(0).Text
menuInfo(nCount).menuLink = ""
menuInfo(nCount).menuStep = "2"
nCount = nCount + 1
'--------------------------------------------------
' 3 depth
'--------------------------------------------------
Set ChildChildnode = Childnode.Childnodes(j)
For k = 0 to ChildChildnode.Childnodes.length - 1
ReDim Preserve menuInfo(nCount + 1)
Set menuInfo(nCount) = New clsMenuInfo
menuInfo(nCount).menuName = ChildChildnode.Childnodes(k).Attributes(0).Text
menuInfo(nCount).menuLink = ChildChildnode.Childnodes(k).Attributes(2).Text
menuInfo(nCount).menuStep = "3"
nCount = nCount + 1
next
else
ReDim Preserve menuInfo(nCount + 1)
Set menuInfo(nCount) = New clsMenuInfo
menuInfo(nCount).menuName = Childnode.Childnodes(j).Attributes(0).Text
menuInfo(nCount).menuLink = Childnode.Childnodes(j).Attributes(2).Text
menuInfo(nCount).menuStep = "2"
nCount = nCount + 1
end if
next
else
ReDim Preserve menuInfo(nCount + 1)
Set menuInfo(nCount) = New clsMenuInfo
menuInfo(nCount).menuName = Rootnode.Childnodes(i).Attributes(0).Text
menuInfo(nCount).menuLink = Rootnode.Childnodes(i).Attributes(2).Text
menuInfo(nCount).menuStep = "1"
nCount = nCount + 1
end if
Next
for i = 0 to UBound(menuInfo) - 1
strMenuName = menuInfo(i).menuName
strMenuLink = menuInfo(i).menuLink
strMenuStep = menuInfo(i).menuStep
for j = 2 to strMenuStep
strOut = strOut & " "
next
strOut = strOut & "<input type=""checkbox"" name=""auth_menu"" value=""" &strMenuLink& """ id=""id_" & i & """>"
strOut = strOut & "<label for=""id_" & i & """>" & strMenuName & "</label><br>" & vbCrLf
next
Response.Write strOut
Set Rootnode = nothing
Set Childnode = nothing
Set ChildChildnode = nothing
Set XMLDOM = nothing
%>
Class clsMenuInfo
Public menuName ' 메뉴명
Public menuLink ' 메뉴 링크
Public menuStep ' 메뉴 단계
End Class
Dim XMLDOM, Rootnode, Currentnode, xml_filename, i,j,k, nCount
dim lowtree ' 하위 노드 여부
dim c_lowtree ' 하위 하위 노드 여부
nCount = 0
xml_filename = Request.ServerVariables("APPL_PHYSICAL_PATH")& "tree.xml"
Set XMLDOM = Server.CreateObject("Microsoft.XMLDOM")
XMLDOM.load xml_filename
'--------------------------------------------------
' 1 depth
'--------------------------------------------------
Set Rootnode = XMLDOM.DocumentElement
For i = 0 to Rootnode.Childnodes.length - 1
lowtree = Rootnode.Childnodes(i).Attributes(1).Text
if lowtree = "true" then
ReDim Preserve menuInfo(nCount + 1)
Set menuInfo(nCount) = New clsMenuInfo
menuInfo(nCount).menuName = Rootnode.Childnodes(i).Attributes(0).Text
menuInfo(nCount).menuLink = ""
menuInfo(nCount).menuStep = "1"
nCount = nCount + 1
'--------------------------------------------------
' 2 depth
'--------------------------------------------------
Set Childnode = Rootnode.Childnodes(i)
For j = 0 to Childnode.Childnodes.length - 1
c_lowtree = Childnode.Childnodes(j).Attributes(1).Text
if c_lowtree = "true" then
ReDim Preserve menuInfo(nCount + 1)
Set menuInfo(nCount) = New clsMenuInfo
menuInfo(nCount).menuName = Childnode.Childnodes(j).Attributes(0).Text
menuInfo(nCount).menuLink = ""
menuInfo(nCount).menuStep = "2"
nCount = nCount + 1
'--------------------------------------------------
' 3 depth
'--------------------------------------------------
Set ChildChildnode = Childnode.Childnodes(j)
For k = 0 to ChildChildnode.Childnodes.length - 1
ReDim Preserve menuInfo(nCount + 1)
Set menuInfo(nCount) = New clsMenuInfo
menuInfo(nCount).menuName = ChildChildnode.Childnodes(k).Attributes(0).Text
menuInfo(nCount).menuLink = ChildChildnode.Childnodes(k).Attributes(2).Text
menuInfo(nCount).menuStep = "3"
nCount = nCount + 1
next
else
ReDim Preserve menuInfo(nCount + 1)
Set menuInfo(nCount) = New clsMenuInfo
menuInfo(nCount).menuName = Childnode.Childnodes(j).Attributes(0).Text
menuInfo(nCount).menuLink = Childnode.Childnodes(j).Attributes(2).Text
menuInfo(nCount).menuStep = "2"
nCount = nCount + 1
end if
next
else
ReDim Preserve menuInfo(nCount + 1)
Set menuInfo(nCount) = New clsMenuInfo
menuInfo(nCount).menuName = Rootnode.Childnodes(i).Attributes(0).Text
menuInfo(nCount).menuLink = Rootnode.Childnodes(i).Attributes(2).Text
menuInfo(nCount).menuStep = "1"
nCount = nCount + 1
end if
Next
for i = 0 to UBound(menuInfo) - 1
strMenuName = menuInfo(i).menuName
strMenuLink = menuInfo(i).menuLink
strMenuStep = menuInfo(i).menuStep
for j = 2 to strMenuStep
strOut = strOut & " "
next
strOut = strOut & "<input type=""checkbox"" name=""auth_menu"" value=""" &strMenuLink& """ id=""id_" & i & """>"
strOut = strOut & "<label for=""id_" & i & """>" & strMenuName & "</label><br>" & vbCrLf
next
Response.Write strOut
Set Rootnode = nothing
Set Childnode = nothing
Set ChildChildnode = nothing
Set XMLDOM = nothing
%>
'asp' 카테고리의 다른 글
오라클 clob타입 입력방법 (0) | 2007.05.02 |
---|---|
request.form, request.querystring 값 확인 하기 (0) | 2007.05.02 |
http://www.xx.xx/domain <ㅡ 이런식으로 주소 사용하기 (0) | 2007.05.02 |
asp로 이미지 사이즈(크기) 얻는 함수 (1) | 2007.05.02 |
글 읽을때 조회수 증가 체크(쿠키 이용) (1) | 2007.05.02 |