%
'-------------------------------------------------------------------------
' Server Appliance Web Framework Tree Widget
' Copyright (c) Microsoft Corporation. All rights reserved.
'-------------------------------------------------------------------------
Call SAI_EnablePageCaching(TRUE)
%>
<%
If Len(Trim(Request.QueryString("TreeContainer"))) > 0 Then
Call SA_RenderTree(Request.QueryString("TreeContainer"))
End If
Function SA_RenderTree(ByVal sContainer)
Call SA_TreeEmitPageHeader()
Response.Write("
")
Call WriteLine("")
Response.Write("
")
Call SA_TreeEmitPageFooter()
End Function
Function SA_RenderTreeNodes(ByVal sContainer, ByVal sSelectedHelpTOC)
On Error Resume Next
Err.Clear
Dim oContainer
Dim oElement
Dim sHelpLoc
Dim bIsContainer
Dim sCurrentElementID
sCurrentElementID = Request.Form("fieldSelectedElement")
Set oContainer = GetElements(sContainer)
If ( Err.Number <> 0 ) Then
Call SA_TraceOut("SH_TREE", "GetElements("+sContainer+") returned error: " + CStr(Hex(Err.Number)) )
Err.Clear
Exit Function
End If
Call SA_GetHelpRootDirectory(sHelpLoc)
If ( oContainer.Count > 0 ) Then
WriteLine("
")
For each oElement in oContainer
Dim sImageURL
Dim sCaption
Dim sHelpURL
Dim sOnClickHandler
Dim sClassAttribute
Dim F_IsLeafSelected
Dim ElementID
ElementID = oElement.GetProperty("ElementID")
F_IsLeafSelected = Request.Form(ElementID)
If ( Trim(F_IsLeafSelected) <> "1" ) Then
F_IsLeafSelected = "0"
End If
sHelpURL = sHelpLoc+oElement.GetProperty("URL")
If ( SA_IsParentNode(ElementID) ) Then
bIsContainer = TRUE
If ( Int(F_IsLeafSelected) > 0 ) Then
sImageURL = GetImageParam("fieldImageNodeClosed")
Else
sImageURL = GetImageParam("fieldImageNodeOpened")
End If
sOnClickHandler = "onClick=""return SA_OnTreeClick('"+sHelpURL+"', '"+ElementID+"' );"" "
WriteLine("")
If ( (ElementID = sCurrentElementID) ) Then
sClassAttribute=" class='ActiveTreeNode' "
Else
sClassAttribute=" class='InActiveTreeNode' "
End If
Else
bIsContainer = FALSE
sImageURL = GetImageParam("fieldImageLeaf")
sOnClickHandler = "onClick=""return SA_OnTreeClick('"+sHelpURL+"', '"+ElementID+"' );"" "
WriteLine("")
If ( F_IsLeafSelected ) Then
sClassAttribute=" class='ActiveTreeNode' "
Else
sClassAttribute=" class='InActiveTreeNode' "
End If
End If
sCaption = GetLocString(oElement.GetProperty("Source"), oElement.GetProperty("CaptionRID"), "" )
WriteLine("")
WriteLine("")
WriteLine(sCaption)
WriteLine(" ")
If ( bIsContainer ) Then
If ( Int(F_IsLeafSelected) > 0 ) Then
Call SA_RenderTreeNodes(ElementID, "")
End If
End If
Next
WriteLine("
")
End If
End Function
Function SA_IsParentNode(ByVal sContainer)
On Error Resume Next
Err.Clear
SA_IsParentNode = FALSE
Dim oContainer
Set oContainer = GetElements(sContainer)
If ( Err.Number <> 0 ) Then
Call SA_TraceOut("SH_TREE", "GetElements("+sContainer+") returned error: " + CStr(Hex(Err.Number)) )
Err.Clear
Exit Function
End If
If ( oContainer.Count > 0 ) Then
'Call SA_TraceOut("SH_TREE", "Container: " + sContainer + " contains " + CStr(oContainer.Count) + " elements.")
SA_IsParentNode = TRUE
End If
Set oContainer = nothing
End Function
Function GetHelpLoc()
GetHelpLoc = "help" + "/"
End Function
Function SA_TreeEmitPageHeader()
%>
<%
Call SA_EmitAdditionalStyleSheetReferences("")
%>
<%
End Function
Function SA_TreeEmitPageFooter()
%>
<%
End Function
Function WriteLine(ByRef sLine)
Response.Write(sLine+vbCrLf)
End Function
Private Function GetImageParam(ByVal sWhichImage)
Dim sImage
Select Case (UCase(sWhichImage))
Case UCase("fieldImageLeaf")
sImage = Request("fieldImageLeaf")
If ( Len(sImage) <= 0 ) Then
sImage = "images/book_page.gif"
End If
Case UCase("fieldImageNodeOpened")
sImage = Request("fieldImageNodeOpened")
If ( Len(sImage) <= 0 ) Then
sImage = "images/book_closed.gif"
End If
Case UCase("fieldImageNodeClosed")
sImage = Request("fieldImageNodeClosed")
If ( Len(sImage) <= 0 ) Then
sImage = "images/book_opened.gif"
End If
Case Else
sImage = Request("fieldImageLeaf")
If ( Len(sImage) <= 0 ) Then
sImage = "images/book_page.gif"
End If
End Select
GetImageParam = sImage
End Function
%>