Subversion Repositories DevTools

Rev

Rev 6 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%
'===================================================================
'                                               _treeNavigation
'===================================================================
%>
<%
'------------ VARIABLE DEFINITION -------------
Dim arrRoot
Dim arrAppProperties
Dim parTree
Dim nLevel
'------------ CONSTANTS DECLARATION -----------
Const UNDERLINE = "_"
Const IMG_INDENT1 = "<img src='images/spacer.gif' width='18' height='5' align='absmiddle' border='0'>"
Const IMG_INDENT2 = "<img src='images/spacer.gif' width='36' height='5' align='absmiddle' border='0'>"
Const IMG_INDENT3 = "<img src='images/spacer.gif' width='54' height='5' align='absmiddle' border='0'>"
Const IMG_APPLICATIONS = "<img src='images/i_application.gif' width='15' height='17' hspace='4' border='0' align='absmiddle'>"
Const IMG_DISK = "<img src='images/i_disk.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
Const IMG_USER = "<img src='images/i_user.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
Const IMG_USER_DISABLED = "<img src='images/i_user_disabled.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
Const IMG_ROLE = "<img src='images/i_role.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
Const IMG_CONTROL = "<img src='images/i_control.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
Const IMG_PAGE = "<img src='images/i_page.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
Const IMG_FOLDER = "<img src='images/i_folder.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
Const IMG_USER_ACCOUNTS = "<img src='images/i_accounts.gif' width='16' height='14' hspace='4' border='0' align='absmiddle'>"
Const IMG_COMPUTERS = "<img src='images/i_computer.gif' width='11' height='16' hspace='6' border='0' align='absmiddle'>"
Const IMG_LOGIN = "<img src='images/spacer.gif' width='5' height='16' hspace='1' border='0' align='absmiddle'>"
'------------ 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 "<tr>"
        Response.write "        <td nowrap>"& Indent &"<a href='"& SCRIPT_NAME &"?tree="& sParent & UNDERLINE & rsQry("item_id") &"' class='menu_link'><img src='images/i_plus.gif' width='9' height='9' align='absmiddle' border='0'>"& Eval(rsQry("item_image"))  &  rsQry("item_name")  &"</a></td>"
        Response.write "</tr>"
                
                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 "<tr>"
        Response.write "        <td nowrap><a href='"& aList( inxTNLink + item ) &"' class='menu_link'>"& aList( inxTNImage + item )  &  aList( inxTNName + item )  &"</a></td>"
        Response.write "</tr>"
                
        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 "<tr>"
        Response.write "        <td nowrap><a href='"& arrRoot( inxTNLink + item ) &"?tree="& arrRoot( inxTNid + item ) &"' class='manu_link'>"& Expander ( selected )  &  arrRoot( inxTNImage + item )  &"<SPAN class='"& SelectorStyle( selected ) &"'>"&  arrRoot( inxTNName + item ) &"</SPAN></a></td>"
        Response.write "</tr>"
                
                ' 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 "<tr>"
                        Response.write "        <td nowrap><a href='"& aSQL( inxTNLink + sqlINX ) &"&tree="& arrRoot( inxTNid + item ) &"_"& aSQL( inxTNid + sqlINX ) &"' class='menu_link'>"& IMG_INDENT1  &  Expander ( FALSE )  &  aSQL( inxTNImage + sqlINX )  &  aSQL( inxTNName + sqlINX )  &"</a></td>"
                        Response.write "</tr>"
                                
                        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 "<tr>"
        Response.write "        <td nowrap><a href='"& arrRoot( inxTNLink + rootINX ) &"?tree="& arrRoot( inxTNid + rootINX ) &"' class='menu_link'>"& Expander ( selected )  &  arrRoot( inxTNImage + rootINX )  &  arrRoot( inxTNName + rootINX ) &"</a></td>"
        Response.write "</tr>"
                
                
                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 "<tr>"
                        Response.write "        <td nowrap><a href='Application_Default.asp?app_id="& aAppList( inxTNid + appINX ) &"&tree="& arrRoot( inxTNid + rootINX ) &"_"& aAppList( inxTNid + appINX ) &"' class='menu_link'>"& IMG_INDENT1  &  Expander ( selected )  &  aAppList( inxTNImage + appINX )    &"<SPAN class='"& SelectorStyle( selected ) &"'>"&  aAppList( inxTNName + appINX ) &"</SPAN></a></td>"
                        Response.write "</tr>"
                                
                                
                                If selected Then
                                        ' Application Properties
                                        For appPropINX = 0 To Ubound( arrAppProperties ) Step nNumberofProperties
                                                Response.write "<tr>"
                                        Response.write "        <td nowrap><a href='"& arrAppProperties( inxTNLink + appPropINX ) &"?app_id="& aAppList( inxTNid + appINX ) &"&tree="& arrRoot( inxTNid + rootINX ) &"_"& aAppList( inxTNid + appINX ) &"_"& arrAppProperties( inxTNid + appPropINX ) &"' class='menu_link'>"& IMG_INDENT2  &  Expander ( FALSE )  &  arrAppProperties( inxTNImage + appPropINX )   &  arrAppProperties( inxTNName + appPropINX ) &"</a></td>"
                                        Response.write "</tr>"
                                                
                                        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 "<tr>"
        Response.write "        <td nowrap><a href='"& arrRoot( inxTNLink + rootINX ) &"?tree="& arrRoot( inxTNid + rootINX ) &"' class='menu_link'>"& Expander ( selected )  &  arrRoot( inxTNImage + rootINX )  &  arrRoot( inxTNName + rootINX )  &"</a></td>"
        Response.write "</tr>"
                
                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 "<tr>"
                        Response.write "        <td nowrap><a href='Application_Default.asp?app_id="& aAppList( inxTNid + appINX ) &"&tree="& arrRoot( inxTNid + rootINX ) &"_"& aAppList( inxTNid + appINX ) &"' class='menu_link'>"& IMG_INDENT1  &  Expander ( selected )  &  aAppList( inxTNImage + appINX )  &  aAppList( inxTNName + appINX )  &"</a></td>"
                        Response.write "</tr>"
                                
                                
                                
                                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 "<tr>"
                                        Response.write "        <td nowrap><a href='"& arrAppProperties( inxTNLink + appPropINX ) &"?app_id="& aAppList( inxTNid + appINX ) &"&tree="& arrRoot( inxTNid + rootINX ) &"_"& aAppList( inxTNid + appINX ) &"_"& arrAppProperties( inxTNid + appPropINX ) &"' class='menu_link'>"& IMG_INDENT2  &  Expander ( selected )  &  arrAppProperties( inxTNImage + appPropINX )   &"<SPAN class='"& SelectorStyle( selected ) &"'>"&  arrAppProperties( inxTNName + appPropINX ) &"</SPAN></a></td>"
                                        Response.write "</tr>"
                                                
                                                '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 "<tr>"
                                                '               Response.write "        <td nowrap><a href='"& aSQL( inxTNLink + sqlINX ) &"&app_id="& aAppList( inxTNid + appINX ) &"&tree="& arrRoot( inxTNid + rootINX ) &"_"& aAppList( inxTNid + appINX ) &"_"& arrAppProperties( inxTNid + appPropINX ) &"_"& aSQL( inxTNid + sqlINX ) &"' class='menu_link'>"& IMG_INDENT3  &  Expander ( NULL )  &  aSQL( inxTNImage + sqlINX )  &  aSQL( inxTNName + sqlINX )  &"</a></td>"
                                                '               Response.write "</tr>"
                                                '                       
                                                '               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 -------
'----------------------------------------------
%>
<table width="100%"  border="0" cellspacing="0" cellpadding="8">
  <%If LCASE(SCRIPT_NAME) = "userlist.asp" Then
      Response.Write("<form name=""myform"" method=""get"" action="& SCRIPT_NAME &">")
    Else
      Response.Write("<form name=""myform"" method=""get"" action=""UserAccounts.asp"">")
      Call objPMod.StoreParameter("tree", "2")
    End If
  %>
  <tr>
    <td background="images/bg_drk_bage_pane.gif" nowrap><span class="fav_txt">Find in Access Manager:</span><br>
      <input name="filter" type="text" class="form_iname" size="22" value="<%=Request("filter")%>">
      <input name="btn" type="submit" class="form_iname" value="Find"></td>
  </tr>
  <%=objPMod.ComposeHiddenTagsWithout("user_id")%>
  </form>
</table>
<table width="100%"  border="0" cellspacing="5" cellpadding="0">
  <tr>
    <td>
                <table width="100%"  border="0" cellspacing="2" cellpadding="0">
                <%Call RenderTree ( parTree )%>
        </table>
        </td>
  </tr>
</table>
<%
'------------ RUN AFTER CONTROL RENDER --------
'----------------------------------------------
%>