urrDepth) = objWorkingNode
Else
colNodeStack.Add nCurrDepth, objWorkingNode
End If
Set objWorkingNode = objWorkingNode.CreateChild(szLine)
nCurrDepth = nCurrDepth + 1
ElseIf nNextDepth <= nCurrDepth Then
If nNextDepth > 1 Then
nNextDepth = nNextDepth - 1
While Not colNodeStack.Exists(nNextDepth) And nNextDepth > 1
nNextDepth = nNextDepth - 1
WEnd
Set objWorkingNode = colNodeStack.Item(nNextDepth)
Set objWorkingNode = objWorkingNode.CreateChild(szLine)
nNextDepth = nNextDepth + 1
Else
Set objWorkingNode = CreateChild(szLine)
End If
nCurrDepth = nNextDepth
End If
End If
End If
WEnd
tsObj.Close()
Set tsObj = Nothing
Set fsObj = Nothing
colNodeStack.RemoveAll()
Set colNodeStack = Nothing
End Sub
Public Sub Draw()
AddClientScript()
Response.Write "<div id=""treectrl"" style=""left: " & Left & "px; top: " & Top & "px; position: " & mszPosition & ";"">" & vbCrLf
Response.Write "<form name=""treectrlfrm"" action=""" & Request.ServerVariables("SCRIPT_NAME") & """ method=""get"">" & vbCrLf
Response.Write "<table border=""0"">" & vbCrLf
Response.Write "<tr><td>" & vbCrLf
For Each ChildNode In mcolChildren.Items
ChildNode.Draw()
Next
Response.Write "</td></tr>" & vbCrLf
Response.Write "</table>" & vbCrLf
Response.Write "<input type=""hidden"" name=""togglenode"" value="""">" & vbCrLf
Response.Write "</form>" & vbCrLf
Response.Write "</div>" & vbCrLf
End Sub
Private Sub AddClientScript()
%>
<script language="JavaScript">
function expandNode(szNodeName)
{
if(document.layers != null) {
document.treectrl.document.treectrlfrm.togglenode.value = szNodeName;
document.treectrl.document.treectrlfrm.submit();
}
else {
document.all["treectrlfrm"].togglenode.value = szNodeName;
document.all["treectrlfrm"].submit();
}
}
function collapseNode(szNodeName)
{
if(document.layers != null) {
document.treectrl.document.treectrlfrm.elements[szNodeName].value = -1;
document.treectrl.document.treectrlfrm.submit();
}
else {
document.treectrlfrm.elements[szNodeName].value = -1;
document.treectrlfrm.submit();
}
}
</script>
<%
End Sub
End Class
%>