Subversion Repositories DevTools

Rev

Rev 5512 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 rsolanki 1
<%
2
'===================================================================
3
'						_treeNavigation
4
'===================================================================
5
%>
6
<%
7
'------------ VARIABLE DEFINITION -------------
8
Dim arrRoot
9
Dim arrAppProperties
10
Dim parTree
11
Dim nLevel
12
'------------ CONSTANTS DECLARATION -----------
13
Const UNDERLINE = "_"
14
Const IMG_INDENT1 = "<img src='images/spacer.gif' width='18' height='5' align='absmiddle' border='0'>"
15
Const IMG_INDENT2 = "<img src='images/spacer.gif' width='36' height='5' align='absmiddle' border='0'>"
16
Const IMG_INDENT3 = "<img src='images/spacer.gif' width='54' height='5' align='absmiddle' border='0'>"
17
Const IMG_APPLICATIONS = "<img src='images/i_application.gif' width='15' height='17' hspace='4' border='0' align='absmiddle'>"
18
Const IMG_DISK = "<img src='images/i_disk.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
19
Const IMG_USER = "<img src='images/i_user.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
20
Const IMG_USER_DISABLED = "<img src='images/i_user_disabled.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
21
Const IMG_ROLE = "<img src='images/i_role.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
22
Const IMG_CONTROL = "<img src='images/i_control.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
23
Const IMG_PAGE = "<img src='images/i_page.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
24
Const IMG_FOLDER = "<img src='images/i_folder.gif' width='16' height='16' hspace='4' border='0' align='absmiddle'>"
25
Const IMG_USER_ACCOUNTS = "<img src='images/i_accounts.gif' width='16' height='14' hspace='4' border='0' align='absmiddle'>"
26
Const IMG_COMPUTERS = "<img src='images/i_computer.gif' width='11' height='16' hspace='6' border='0' align='absmiddle'>"
27
Const IMG_LOGIN = "<img src='images/spacer.gif' width='5' height='16' hspace='1' border='0' align='absmiddle'>"
28
'------------ VARIABLE INIT -------------------
29
parTree = Request("tree")
30
	'[1] Name
31
	'[2] ID
32
	'[3] Link
33
	'[4] JavaScript Event e.g. "onClick='...'"
34
	'[5] Image Selected
35
	'[6] Child SQL statement
36
 
37
Const inxTNName = 0
38
Const inxTNid 	= 1
39
Const inxTNLink = 2
40
Const inxTNEventHandler = 3
41
Const inxTNImage = 4
42
Const inxChildSQL = 5
43
 
44
Const nNumberofProperties = 6
45
 
46
arrRoot = Array ( "Applications", _
47
				  "1", _
48
				  "ApplicationList.asp", _
49
				  "", _
50
				  IMG_APPLICATIONS, _
51
				  "ApplicationsList.sql", _
52
 
53
				  "User Accounts", _
54
				  "2", _
55
				  "UserAccounts.asp", _
56
				  "", _
57
				  IMG_USER_ACCOUNTS, _
58
				  NULL, _
59
 
60
				  "Computers", _
61
				  "3", _
62
				  "ComputerList.asp", _
63
				  "", _
64
				  IMG_COMPUTERS, _
65
				  NULL, _
66
 
67
				  "Login Trail", _
68
				  "4", _
69
				  "LoginTrail.asp", _
70
				  "", _
71
				  IMG_LOGIN, _
72
				  NULL _
73
				)
74
 
75
arrAppProperties = Array ( "Users", _
76
						   "1", _
77
						   "UserList.asp", _
78
						   "", _
79
						   IMG_FOLDER, _
80
						   "AppUserList.sql", _
81
 
82
						   "Roles", _
83
						   "2", _
84
						   "RoleList.asp", _
85
						   "", _
86
						   IMG_FOLDER, _
87
						   "AppRoleList.sql", _
88
 
89
						   "Actions", _
90
						   "3", _
91
						   "ControlList.asp", _
92
						   "", _
93
						   IMG_FOLDER, _
94
						   "AppControlList.sql" _
95
						   )
96
 
97
'----------------------------------------------
98
%>
99
<%
100
'--------------------------------------------------------------------------------------------------------------------------------
101
Function LoadFromSQL ( sQuery )
102
	Dim rsQry, tempArr(), rowCnt, newDim
103
 
104
	Set rsQry = OraDatabase.DbCreateDynaset( sQuery , ORADYN_DEFAULT )
105
 
106
	ReDim tempArr( -1 )		' Default empty array
107
	rowCnt = 1
108
	While ((NOT rsQry.BOF) AND (NOT rsQry.EOF))
109
		newDim = nNumberofProperties * rowCnt
110
 
111
		ReDim Preserve tempArr( newDim - 1 )
112
 
113
		tempArr ( inxTNName + newDim - nNumberofProperties ) 			= rsQry("item_name")
114
		tempArr ( inxTNid + newDim - nNumberofProperties ) 				= rsQry("item_id")
115
		tempArr ( inxTNImage + newDim - nNumberofProperties ) 			= Eval(rsQry("item_image"))
116
		tempArr ( inxTNLink + newDim - nNumberofProperties ) 			= rsQry("file_name") &"?"& rsQry("param")
117
 
118
		rowCnt = rowCnt + 1
119
		rsQry.MoveNext
120
	WEnd
121
 
122
	LoadFromSQL = tempArr
123
 
124
	rsQry.Close
125
	Set rsQry = Nothing
126
End Function
127
'--------------------------------------------------------------------------------------------------------------------------------
128
Sub RenderSQL ( sQuery, Indent, sParent )
129
	Dim rsQry
130
 
131
	Set rsQry = OraDatabase.DbCreateDynaset( sQuery , ORADYN_DEFAULT )
132
 
133
	While ((NOT rsQry.BOF) AND (NOT rsQry.EOF))
134
		Response.write "<tr>"
135
        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>"
136
      	Response.write "</tr>"
137
 
138
		rsQry.MoveNext
139
	WEnd
140
 
141
	rsQry.Close
142
	Set rsQry = Nothing
143
End Sub
144
'--------------------------------------------------------------------------------------------------------------------------------
145
Sub RenderList ( aList )
146
	Dim nLastItem, item, i
147
	nLastItem = Ubound( aList )
148
 
149
	For item = 0 To nLastItem Step nNumberofProperties
150
 
151
		' Render Item
152
		Response.write "<tr>"
153
        Response.write "	<td nowrap><a href='"& aList( inxTNLink + item ) &"' class='menu_link'>"& aList( inxTNImage + item )  &  aList( inxTNName + item )  &"</a></td>"
154
      	Response.write "</tr>"
155
 
156
	Next
157
 
158
End Sub
159
'--------------------------------------------------------------------------------------------------------------------------------
160
Sub NodeRoot ()
161
	Dim nLastItem, item, arrTree, aSQL, sqlINX, selected
162
	nLastItem = Ubound( arrRoot )
163
 
164
 
165
	For item = 0 To nLastItem Step nNumberofProperties
166
		selected = FALSE
167
		If parTree = arrRoot( inxTNid + item ) Then  selected = TRUE
168
		' Render Item
169
		Response.write "<tr>"
170
        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>"
171
      	Response.write "</tr>"
172
 
173
		' Render Kids
174
		If selected AND NOT IsNull( arrRoot( inxChildSQL + item ) ) Then
175
 
176
			aSQL = LoadFromSQL ( GetQuery( arrRoot( inxChildSQL + item ) ) )
177
 
178
			For sqlINX = 0 To Ubound( aSQL ) Step nNumberofProperties
179
				Response.write "<tr>"
180
		        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>"
181
		      	Response.write "</tr>"
182
 
183
			Next
184
 
185
 
186
		End If
187
 
188
 
189
 
190
	Next
191
 
192
End Sub
193
'--------------------------------------------------------------------------------------------------------------------------------
194
Sub NodeApplicationProperties ()
195
	Dim rootINX, appINX, appPropINX, arrTree, selected
196
	Dim aAppList
197
	arrTree = Split( parTree, UNDERLINE ) 
198
	aAppList = LoadFromSQL ( GetQuery("ApplicationsList.sql") )
199
 
200
	For rootINX = 0 To Ubound( arrRoot ) Step nNumberofProperties
201
		selected = FALSE
202
		If arrTree( 0 ) = arrRoot( inxTNid + rootINX ) Then  selected = TRUE
203
 
204
 
205
		' Render Item
206
		Response.write "<tr>"
207
        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>"
208
      	Response.write "</tr>"
209
 
210
 
211
		If selected Then
212
			' Applications List
213
			For appINX = 0 To Ubound( aAppList ) Step nNumberofProperties
214
				selected = FALSE
215
				If arrTree( 1 ) = aAppList( inxTNid + appINX ) Then  selected = TRUE
216
 
217
				Response.write "<tr>"
218
		        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>"
219
		      	Response.write "</tr>"
220
 
221
 
222
				If selected Then
223
					' Application Properties
224
					For appPropINX = 0 To Ubound( arrAppProperties ) Step nNumberofProperties
225
						Response.write "<tr>"
226
				        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>"
227
				      	Response.write "</tr>"
228
 
229
					Next
230
 
231
 
232
				End If
233
 
234
 
235
			Next
236
 
237
		End If
238
 
239
 
240
	Next
241
End Sub
242
'--------------------------------------------------------------------------------------------------------------------------------
243
Sub NodeApplicationProperty ()
244
	Dim rootINX, appINX, appPropINX, arrTree, aSQL, sqlINX, selected, query
245
	Dim aAppList
246
	arrTree = Split( parTree, UNDERLINE ) 
247
	aAppList = LoadFromSQL ( GetQuery("ApplicationsList.sql") )
248
 
249
	For rootINX = 0 To Ubound( arrRoot ) Step nNumberofProperties
250
		selected = FALSE
251
		If arrTree( 0 ) = arrRoot( inxTNid + rootINX ) Then  selected = TRUE
252
 
253
 
254
		' Render Item
255
		Response.write "<tr>"
256
        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>"
257
      	Response.write "</tr>"
258
 
259
		If selected Then
260
			' Applications List
261
			For appINX = 0 To Ubound( aAppList ) Step nNumberofProperties
262
				selected = FALSE
263
				If arrTree( 1 ) = aAppList( inxTNid + appINX ) Then  selected = TRUE
264
 
265
 
266
				Response.write "<tr>"
267
		        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>"
268
		      	Response.write "</tr>"
269
 
270
 
271
 
272
				If selected Then
273
					' Application Properties
274
					For appPropINX = 0 To Ubound( arrAppProperties ) Step nNumberofProperties
275
						selected = FALSE
276
						If arrTree( 2 ) = arrAppProperties( inxTNid + appPropINX ) Then  selected = TRUE
277
 
278
						Response.write "<tr>"
279
				        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>"
280
				      	Response.write "</tr>"
281
 
282
						'If selected Then
283
						'	query = GetQuery( arrAppProperties( inxChildSQL + appPropINX ) )
284
						'	query = Replace( query, ":APP_ID", aAppList( inxTNid + appINX ) )
285
						'	
286
						'	aSQL = LoadFromSQL ( query )
287
						'	
288
						'	If Not IsNull( aSQL ) Then
289
						'		For sqlINX = 0 To Ubound( aSQL ) Step nNumberofProperties
290
						'			Response.write "<tr>"
291
						'	        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>"
292
						'	      	Response.write "</tr>"
293
						'			
294
						'		Next
295
						'	End If
296
						'	
297
						'End If
298
 
299
 
300
					Next
301
 
302
 
303
				End If
304
 
305
 
306
			Next
307
 
308
		End If
309
 
310
 
311
	Next
312
End Sub
313
'--------------------------------------------------------------------------------------------------------------------------------
314
Function SelectorStyle ( bSelected )
315
 
316
	SelectorStyle = "menu_link"
317
 
318
	If bSelected Then
319
		SelectorStyle = "menu_linkselect"
320
	End If
321
 
322
End Function
323
'--------------------------------------------------------------------------------------------------------------------------------
324
'Sub RenderTree ( Node )
325
'	Select Case Node
326
'		Case "ROOT"
327
'			Call NodeRoot ()
328
'		Case "APPLICATION_PROPERTIES"
329
'			Call NodeApplicationProperties ()
330
'		Case "PROPERTY"
331
'			Call NodeApplicationProperty ()
332
'		
333
'	End Select
334
'End Sub
335
'--------------------------------------------------------------------------------------------------------------------------------
336
Sub RenderTree ( sParTree )
337
	Select Case UBound( Split( sParTree, "_" ) )
338
		Case 1
339
			Call NodeApplicationProperties ()
340
		Case 2, 3
341
			Call NodeApplicationProperty ()
342
		Case Else
343
			Call NodeRoot ()
344
	End Select
345
End Sub
346
'--------------------------------------------------------------------------------------------------------------------------------
347
%>
348
<%
349
'------------ RUN BEFORE CONTROL RENDER -------
350
'----------------------------------------------
351
%>
352
<table width="100%"  border="0" cellspacing="0" cellpadding="8">
6 ghuddy 353
  <%If LCASE(SCRIPT_NAME) = "userlist.asp" Then
354
      Response.Write("<form name=""myform"" method=""get"" action="& SCRIPT_NAME &">")
355
    Else
356
      Response.Write("<form name=""myform"" method=""get"" action=""UserAccounts.asp"">")
5299 dpurdie 357
      'Call objPMod.StoreParameter("tree", "2")
6 ghuddy 358
    End If
359
  %>
2 rsolanki 360
  <tr>
361
    <td background="images/bg_drk_bage_pane.gif" nowrap><span class="fav_txt">Find in Access Manager:</span><br>
362
      <input name="filter" type="text" class="form_iname" size="22" value="<%=Request("filter")%>">
363
      <input name="btn" type="submit" class="form_iname" value="Find"></td>
364
  </tr>
6 ghuddy 365
  <%=objPMod.ComposeHiddenTagsWithout("user_id")%>
2 rsolanki 366
  </form>
367
</table>
368
<table width="100%"  border="0" cellspacing="5" cellpadding="0">
369
  <tr>
370
    <td>
371
		<table width="100%"  border="0" cellspacing="2" cellpadding="0">
372
		<%Call RenderTree ( parTree )%>
373
    	</table>
374
	</td>
375
  </tr>
376
</table>
377
<%
378
'------------ RUN AFTER CONTROL RENDER --------
379
'----------------------------------------------
380
%>