<% '=================================================================== ' _treeNavigation '=================================================================== %> <% '------------ VARIABLE DEFINITION ------------- Dim arrRoot Dim arrAppProperties Dim parTree Dim nLevel '------------ CONSTANTS DECLARATION ----------- Const UNDERLINE = "_" Const IMG_INDENT1 = "" Const IMG_INDENT2 = "" Const IMG_INDENT3 = "" Const IMG_APPLICATIONS = "" Const IMG_DISK = "" Const IMG_USER = "" Const IMG_USER_DISABLED = "" Const IMG_ROLE = "" Const IMG_CONTROL = "" Const IMG_PAGE = "" Const IMG_FOLDER = "" Const IMG_USER_ACCOUNTS = "" Const IMG_COMPUTERS = "" Const IMG_LOGIN = "" '------------ VARIABLE INIT ------------------- parTree = Request("tree") '[1] Name '[2] ID '[3] Link '[4] JavaScript Event e.g. "onClick='...'" '[5] Image Selected '[6] Child SQL statement Const inxTNName = 0 Const inxTNid = 1 Const inxTNLink = 2 Const inxTNEventHandler = 3 Const inxTNImage = 4 Const inxChildSQL = 5 Const nNumberofProperties = 6 arrRoot = Array ( "Applications", _ "1", _ "ApplicationList.asp", _ "", _ IMG_APPLICATIONS, _ "ApplicationsList.sql", _ "User Accounts", _ "2", _ "UserAccounts.asp", _ "", _ IMG_USER_ACCOUNTS, _ NULL, _ "Computers", _ "3", _ "ComputerList.asp", _ "", _ IMG_COMPUTERS, _ NULL, _ "Login Trail", _ "4", _ "LoginTrail.asp", _ "", _ IMG_LOGIN, _ NULL _ ) arrAppProperties = Array ( "Users", _ "1", _ "UserList.asp", _ "", _ IMG_FOLDER, _ "AppUserList.sql", _ "Roles", _ "2", _ "RoleList.asp", _ "", _ IMG_FOLDER, _ "AppRoleList.sql", _ "Actions", _ "3", _ "ControlList.asp", _ "", _ IMG_FOLDER, _ "AppControlList.sql" _ ) ', _ '"Pages", _ '"4", _ '"PageList.asp", _ '"", _ 'IMG_FOLDER, _ '"AppPageList.sql" _ '---------------------------------------------- %> <% '-------------------------------------------------------------------------------------------------------------------------------- Function LoadFromSQL ( sQuery ) Dim rsQry, tempArr(), rowCnt, newDim Set rsQry = OraDatabase.DbCreateDynaset( sQuery , ORADYN_DEFAULT ) ReDim tempArr( -1 ) ' Default empty array rowCnt = 1 While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) newDim = nNumberofProperties * rowCnt ReDim Preserve tempArr( newDim - 1 ) tempArr ( inxTNName + newDim - nNumberofProperties ) = rsQry("item_name") tempArr ( inxTNid + newDim - nNumberofProperties ) = rsQry("item_id") tempArr ( inxTNImage + newDim - nNumberofProperties ) = Eval(rsQry("item_image")) tempArr ( inxTNLink + newDim - nNumberofProperties ) = rsQry("file_name") &"?"& rsQry("param") rowCnt = rowCnt + 1 rsQry.MoveNext WEnd LoadFromSQL = tempArr rsQry.Close Set rsQry = Nothing End Function '-------------------------------------------------------------------------------------------------------------------------------- Sub RenderSQL ( sQuery, Indent, sParent ) Dim rsQry Set rsQry = OraDatabase.DbCreateDynaset( sQuery , ORADYN_DEFAULT ) While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Response.write "" Response.write " "& Indent &""& Eval(rsQry("item_image")) & rsQry("item_name") &"" Response.write "" rsQry.MoveNext WEnd rsQry.Close Set rsQry = Nothing End Sub '-------------------------------------------------------------------------------------------------------------------------------- Sub RenderList ( aList ) Dim nLastItem, item, i nLastItem = Ubound( aList ) For item = 0 To nLastItem Step nNumberofProperties ' Render Item Response.write "" Response.write " "& aList( inxTNImage + item ) & aList( inxTNName + item ) &"" Response.write "" Next End Sub '-------------------------------------------------------------------------------------------------------------------------------- Sub NodeRoot () Dim nLastItem, item, arrTree, aSQL, sqlINX, selected nLastItem = Ubound( arrRoot ) For item = 0 To nLastItem Step nNumberofProperties selected = FALSE If parTree = arrRoot( inxTNid + item ) Then selected = TRUE ' Render Item Response.write "" Response.write " "& Expander ( selected ) & arrRoot( inxTNImage + item ) &""& arrRoot( inxTNName + item ) &"" Response.write "" ' Render Kids If selected AND NOT IsNull( arrRoot( inxChildSQL + item ) ) Then aSQL = LoadFromSQL ( GetQuery( arrRoot( inxChildSQL + item ) ) ) For sqlINX = 0 To Ubound( aSQL ) Step nNumberofProperties Response.write "" Response.write " "& IMG_INDENT1 & Expander ( FALSE ) & aSQL( inxTNImage + sqlINX ) & aSQL( inxTNName + sqlINX ) &"" Response.write "" Next End If Next End Sub '-------------------------------------------------------------------------------------------------------------------------------- Sub NodeApplicationProperties () Dim rootINX, appINX, appPropINX, arrTree, selected Dim aAppList arrTree = Split( parTree, UNDERLINE ) aAppList = LoadFromSQL ( GetQuery("ApplicationsList.sql") ) For rootINX = 0 To Ubound( arrRoot ) Step nNumberofProperties selected = FALSE If arrTree( 0 ) = arrRoot( inxTNid + rootINX ) Then selected = TRUE ' Render Item Response.write "" Response.write " "& Expander ( selected ) & arrRoot( inxTNImage + rootINX ) & arrRoot( inxTNName + rootINX ) &"" Response.write "" If selected Then ' Applications List For appINX = 0 To Ubound( aAppList ) Step nNumberofProperties selected = FALSE If arrTree( 1 ) = aAppList( inxTNid + appINX ) Then selected = TRUE Response.write "" Response.write " "& IMG_INDENT1 & Expander ( selected ) & aAppList( inxTNImage + appINX ) &""& aAppList( inxTNName + appINX ) &"" Response.write "" If selected Then ' Application Properties For appPropINX = 0 To Ubound( arrAppProperties ) Step nNumberofProperties Response.write "" Response.write " "& IMG_INDENT2 & Expander ( FALSE ) & arrAppProperties( inxTNImage + appPropINX ) & arrAppProperties( inxTNName + appPropINX ) &"" Response.write "" Next End If Next End If Next End Sub '-------------------------------------------------------------------------------------------------------------------------------- Sub NodeApplicationProperty () Dim rootINX, appINX, appPropINX, arrTree, aSQL, sqlINX, selected, query Dim aAppList arrTree = Split( parTree, UNDERLINE ) aAppList = LoadFromSQL ( GetQuery("ApplicationsList.sql") ) For rootINX = 0 To Ubound( arrRoot ) Step nNumberofProperties selected = FALSE If arrTree( 0 ) = arrRoot( inxTNid + rootINX ) Then selected = TRUE ' Render Item Response.write "" Response.write " "& Expander ( selected ) & arrRoot( inxTNImage + rootINX ) & arrRoot( inxTNName + rootINX ) &"" Response.write "" If selected Then ' Applications List For appINX = 0 To Ubound( aAppList ) Step nNumberofProperties selected = FALSE If arrTree( 1 ) = aAppList( inxTNid + appINX ) Then selected = TRUE Response.write "" Response.write " "& IMG_INDENT1 & Expander ( selected ) & aAppList( inxTNImage + appINX ) & aAppList( inxTNName + appINX ) &"" Response.write "" If selected Then ' Application Properties For appPropINX = 0 To Ubound( arrAppProperties ) Step nNumberofProperties selected = FALSE If arrTree( 2 ) = arrAppProperties( inxTNid + appPropINX ) Then selected = TRUE Response.write "" Response.write " "& IMG_INDENT2 & Expander ( selected ) & arrAppProperties( inxTNImage + appPropINX ) &""& arrAppProperties( inxTNName + appPropINX ) &"" Response.write "" 'If selected Then ' query = GetQuery( arrAppProperties( inxChildSQL + appPropINX ) ) ' query = Replace( query, ":APP_ID", aAppList( inxTNid + appINX ) ) ' ' aSQL = LoadFromSQL ( query ) ' ' If Not IsNull( aSQL ) Then ' For sqlINX = 0 To Ubound( aSQL ) Step nNumberofProperties ' Response.write "" ' Response.write " "& IMG_INDENT3 & Expander ( NULL ) & aSQL( inxTNImage + sqlINX ) & aSQL( inxTNName + sqlINX ) &"" ' Response.write "" ' ' Next ' End If ' 'End If Next End If Next End If Next End Sub '-------------------------------------------------------------------------------------------------------------------------------- Function SelectorStyle ( bSelected ) SelectorStyle = "menu_link" If bSelected Then SelectorStyle = "menu_linkselect" End If End Function '-------------------------------------------------------------------------------------------------------------------------------- 'Sub RenderTree ( Node ) ' Select Case Node ' Case "ROOT" ' Call NodeRoot () ' Case "APPLICATION_PROPERTIES" ' Call NodeApplicationProperties () ' Case "PROPERTY" ' Call NodeApplicationProperty () ' ' End Select 'End Sub '-------------------------------------------------------------------------------------------------------------------------------- Sub RenderTree ( sParTree ) Select Case UBound( Split( sParTree, "_" ) ) Case 1 Call NodeApplicationProperties () Case 2, 3 Call NodeApplicationProperty () Case Else Call NodeRoot () End Select End Sub '-------------------------------------------------------------------------------------------------------------------------------- %> <% '------------ RUN BEFORE CONTROL RENDER ------- '---------------------------------------------- %> <%If LCASE(SCRIPT_NAME) = "userlist.asp" Then Response.Write("") Else Response.Write("") Call objPMod.StoreParameter("tree", "2") End If %> <%=objPMod.ComposeHiddenTagsWithout("user_id")%>
Find in Access Manager:
">
<%Call RenderTree ( parTree )%>
<% '------------ RUN AFTER CONTROL RENDER -------- '---------------------------------------------- %>