Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 ghuddy 1
<!-- #INCLUDE FILE="..\common\adovbs.inc" -->
2 rsolanki 2
<%
3
'=============================================================
4
'//
5
'//						Action Button Control
6
'//
7
'// version: 		1.0
8
'//	last modified: 	06-Aug-2004 13:38 by Sasha Vukovic
9
'=============================================================
10
%>
11
<%
12
'--------------- Global Constants ----------------
13
Const enumABTNCTRL_ON_READONLY_HIDE = 1
14
Const enumABTNCTRL_ON_READONLY_DISABLE = 2
15
'-------------------------------------------------
16
 
17
Class ActionButtonControl
4 ghuddy 18
 
2 rsolanki 19
	Private mArrAbtnDef()
20
	Private mobjNameDefMap			' Item can be accesed by name. Must be unique within one page
21
	Private mobjIdDefMap			' Item can be accesed by id. Must be unique within one page. If NULL, ubound is assigned to it
22
	Private mobjSeparator			' Has a name of item after separator is applied
4 ghuddy 23
 
2 rsolanki 24
	Private mnButtonSpacer
25
	Private mnButtonTextSpace
4 ghuddy 26
 
2 rsolanki 27
	Private mNumOfProperties
28
	Private mLastPropertyInx
4 ghuddy 29
 
2 rsolanki 30
	Private mbDisableAll
4 ghuddy 31
 
2 rsolanki 32
	Private mbIsReadonly
33
	Private mReadonlyActionBehaviour
4 ghuddy 34
 
2 rsolanki 35
	Private InxID
36
	Private InxName
37
	Private InxTxt
38
	Private InxLink
39
	Private InxEventHandler
40
	Private InxImg
41
	Private InxImgOff
42
	Private InxHint
43
	Private InxActive
44
	Private InxIsReadonlyAction
4 ghuddy 45
 
46
 
47
 
2 rsolanki 48
	Public Property Let AllActive ( cActive )
49
		If cActive = enumDB_NO Then
50
			mbDisableAll = TRUE
51
		Else
52
			mbDisableAll = FALSE
53
		End If
4 ghuddy 54
 
2 rsolanki 55
	End Property
4 ghuddy 56
 
2 rsolanki 57
	Public Property Let ButtonSpacer ( nWidth )
58
		mnButtonSpacer = nWidth
59
	End Property
4 ghuddy 60
 
2 rsolanki 61
	Public Property Let ButtonTextSpacer ( nWidth )
62
		mnButtonTextSpace = nWidth
63
	End Property
4 ghuddy 64
 
2 rsolanki 65
	Public Property Let IsReadonlyAction ( IsReadonly )
66
		If IsReadonly = enumDB_YES Then
67
			mbIsReadonly = TRUE
4 ghuddy 68
 
2 rsolanki 69
		ElseIf IsReadonly = enumDB_NO Then
70
			mbIsReadonly = FALSE
71
		Else
72
			mbIsReadonly = IsReadonly
4 ghuddy 73
 
2 rsolanki 74
		End If
4 ghuddy 75
 
2 rsolanki 76
	End Property
4 ghuddy 77
 
2 rsolanki 78
	Public Property Let ReadonlyActionBehaviour ( nEnum )
79
		mReadonlyActionBehaviour = nEnum
80
	End Property
4 ghuddy 81
 
2 rsolanki 82
	'-----------------------------------------------------------------------------------------------------------------
83
	Private Sub SetItemPropertyByIndex ( nInx, nProperty, Value )
4 ghuddy 84
		If nInx = ""  OR  nProperty = ""  OR  Value = "" Then Err.Raise 8, "Method SetItemPropertyByIndex", "Empty parameters found. nInx="& nInx &", nProperty="& nProperty &", Value="& Value
85
 
2 rsolanki 86
		mArrAbtnDef ( nProperty, nInx ) = Value
4 ghuddy 87
 
2 rsolanki 88
		'Response.write "mArrAbtnDef ( "& nProperty &", "& nInx &" ) = "& Value &"<br>"
89
	End Sub
90
	'-----------------------------------------------------------------------------------------------------------------
91
	Private Function LastItemInx ()
92
		 LastItemInx = UBound ( mArrAbtnDef, 2 )
93
	End Function
94
	'-----------------------------------------------------------------------------------------------------------------
95
	Public Sub AddActionButton ( sItemName, nItemID )
96
		Dim newArrayDim
4 ghuddy 97
 
2 rsolanki 98
		If InStr( sItemName, " " ) > 0 Then	Err.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' cannot have spaces."
4 ghuddy 99
 
100
 
101
 
2 rsolanki 102
		If NOT mobjNameDefMap.Exists (CStr( sItemName )) Then
4 ghuddy 103
 
2 rsolanki 104
			newArrayDim = LastItemInx() + 1
4 ghuddy 105
 
2 rsolanki 106
			ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )
4 ghuddy 107
 
2 rsolanki 108
			' Store name
109
			Call SetItemPropertyByIndex ( newArrayDim, InxName, sItemName )
110
			mobjNameDefMap.Add Cstr( sItemName ), CStr( newArrayDim )
4 ghuddy 111
 
2 rsolanki 112
			If Not IsNull(nItemID) Then
113
				' Store ID
114
				Call SetItemPropertyByIndex ( newArrayDim, InxdbID, nItemID )
115
				mobjIdDefMap.Add Cstr( nItemID ), CStr( newArrayDim )
116
			End If
4 ghuddy 117
 
2 rsolanki 118
			' Set Defaults
119
			Call SetItemDefaults ( sItemName )
120
		Else
4 ghuddy 121
 
2 rsolanki 122
			Err.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' has been already defined."
4 ghuddy 123
 
2 rsolanki 124
		End If
4 ghuddy 125
 
2 rsolanki 126
	End Sub
127
	'-----------------------------------------------------------------------------------------------------------------
128
	Public Sub Render ( aAbtnList )
129
		Dim itemInx, itemName, nLastItemInx, btnImage, ButtonStr, ButtonStrDisabled
130
		Response.write "<table cellpadding='0' cellspacing='0' width='1'><tr>"
4 ghuddy 131
 
2 rsolanki 132
		For Each itemName in aAbtnList
4 ghuddy 133
 
2 rsolanki 134
			itemInx = mobjNameDefMap.Item (Cstr(itemName))
135
			'If itemInx = "" Then 	Err.Raise 8, "Method Render", "Definition for item name '"& itemName &"' not found."
4 ghuddy 136
 
137
 
2 rsolanki 138
			'-- Define Image
139
			btnImage = "<img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle' border='0'>"
140
			If (mArrAbtnDef( InxImg, itemInx ) <> "") Then
141
				btnImage = "<img src='"& mArrAbtnDef( InxImg, itemInx ) &"' hspace='"& mnButtonTextSpace &"' border='0' align='absmiddle'>"
142
			End If
4 ghuddy 143
 
144
 
2 rsolanki 145
			'-- Define Button
146
			ButtonStr = _
147
				"<td nowrap>"&_
148
				"<a id='"& mArrAbtnDef( InxName, itemInx ) &"' "&_
149
				" name='"& mArrAbtnDef( InxName, itemInx ) &"' href='"& Eval( mArrAbtnDef( InxLink, itemInx ) ) &"' "&_
150
				" "& Eval( mArrAbtnDef( InxEventHandler, itemInx ) ) &" class='menu_link' title='"& mArrAbtnDef( InxHint, itemInx )  &"'>"&_
151
				btnImage & mArrAbtnDef( InxTxt, itemInx ) &"</a>"&_
152
				"</td>"
4 ghuddy 153
 
154
 
2 rsolanki 155
			'-- Define Disabled Button
156
			ButtonStrDisabled = _
157
				"<td nowrap>"&_
158
				"<img src='"& mArrAbtnDef( InxImgOff, itemInx ) &"' hspace='2' border='0' align='absmiddle'>"&_
159
				"<label class='menu_txt'>"& mArrAbtnDef( InxTxt, itemInx ) &"</label>"&_
160
				"</td>"
4 ghuddy 161
 
162
 
163
 
164
 
2 rsolanki 165
			If  mbDisableAll OR ( mArrAbtnDef( InxActive, itemInx ) = enumDB_NO ) Then
166
				' --- Display DISABLED Button Item ---
167
				Response.write ButtonStrDisabled
4 ghuddy 168
 
2 rsolanki 169
			Else
4 ghuddy 170
 
2 rsolanki 171
				' --- Display Action Button Item ---
172
				If	( NOT mbIsReadonly )  OR _
173
				   	( mbIsReadonly  AND  mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_YES ) Then
4 ghuddy 174
 
2 rsolanki 175
					If InStr( itemName, "width=" ) > 0 Then
176
						Response.write "<td><img src='images/spacer.gif' "& itemName &" height='1' align='absmiddle'></td>"
4 ghuddy 177
 
2 rsolanki 178
					ElseIf InStr( itemName, "height=" ) > 0 Then
179
						Response.write "<td><img src='images/bg_bage_2.gif' width='1' "& itemName &" align='absmiddle' hspace='4'></td>"
4 ghuddy 180
 
2 rsolanki 181
					Else
182
						'/* It is a button, i.e. Display Button */
183
						Response.write ButtonStr
4 ghuddy 184
 
2 rsolanki 185
						If mnButtonSpacer > 0 Then
186
						Response.write "<td><img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle'></td>"
187
						End If
4 ghuddy 188
 
2 rsolanki 189
					End If
4 ghuddy 190
 
191
 
2 rsolanki 192
				ElseIf ( mbIsReadonly  AND  mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_NO ) Then
4 ghuddy 193
 
194
 
195
 
2 rsolanki 196
					If mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_DISABLE Then
197
						Response.write ButtonStrDisabled
198
					End If
4 ghuddy 199
 
200
 
201
 
2 rsolanki 202
				End If
4 ghuddy 203
 
2 rsolanki 204
			End If
4 ghuddy 205
 
206
 
207
 
208
 
2 rsolanki 209
			' --- Separators added manually using  method AddSeparator or AddSeparatorAfter ---
210
			If mobjSeparator.Exists ( Cstr(mArrAbtnDef( InxName, itemInx )) ) Then
211
				Response.write "<td><img src='images/spacer.gif' width='"& mobjSeparator.Item ( Cstr(mArrAbtnDef( InxName, itemInx )) ) &"' height='1'></td>"
4 ghuddy 212
 
2 rsolanki 213
			End If
4 ghuddy 214
 
215
 
2 rsolanki 216
		Next
4 ghuddy 217
 
2 rsolanki 218
		Response.write "</tr></table>"
219
	End Sub
220
	'-----------------------------------------------------------------------------------------------------------------
4 ghuddy 221
   ' Return true if required_abtnName is one of the strings in the aAbtnList string array, else return false
222
   Private Function isAbtnRequired (aAbtnList, required_abtnName)
223
 
224
      Dim this_abtnName
225
 
226
      isAbtnRequired = FALSE
227
 
228
      For Each this_abtnName in aAbtnList
229
         If 0 = StrComp(this_abtnName, required_abtnName) Then
230
            isAbtnRequired = TRUE
231
            Exit Function
232
         End If
233
      Next
234
   End Function
235
	'-----------------------------------------------------------------------------------------------------------------
2 rsolanki 236
	Public Sub LoadActionButtons ( aAbtnList, ByRef objOraDatabase )
4 ghuddy 237
 
238
      ' The following code is now used in place of the earlier code to acquire action button records.
239
      '
240
      ' This code exploits the fact that in ADO 2.8 onwards, you can create ADO DB record sets
241
      ' without a connection to an actual database. So, to rid ourselves of the need for a DEF_ACTION_BUTTONS
242
      ' table in the database, we can simply take all of the table's rows and reproduce them here in row
243
      ' creation and field assignment statements. The rest of the website code will be ignorant of the fact
244
      ' that the data has not come from the actual database.
245
      '
246
      ' Complicating factors:
247
      ' 1) Some action button fields (action_link and event_handler) are to be EVAL'ed later on when used
248
      '    to render the HTML page. This can lead to some very complex looking strings that are difficult to
249
      '    understand. EVAL allows things like parRtag_id used in a string to be converted to an actual
250
      '    number (in string form) at time of HTML rendering. We have to use EVAL. There is no other option.
251
      '
252
      ' 2) The strings from the database must also be represented as VBScript strings in the assignments
253
      '    below. This means that where a string needs to have an embedded " char, two such chars must be
254
      '    used, and remember about EVAL mentioned above, meaning that sometimes """" has to be used to
255
      '    give a single " to the resulting string that pops out from EVAL.
256
      '    Remember also that whilst HTML doesn't care whether you use single or double quotes, javascript
257
      '    does (it must use single quotes) and VBScript does (it must use double quotes)
258
      '
259
      ' Possible Future Roadmap
260
      ' 1) Rid the code of ABTN_ID - I dont think we need this field now that we are free of the database
261
      '
262
      Dim rsQry
263
      Dim varFields
264
      Dim varValues
265
 
266
      ' Create the object and configure some of its properties
267
      Set rsQry = Server.CreateObject("ADODB.Recordset")
268
      rsQry.CursorLocation = adUseClient
269
      rsQry.CursorType = adOpenKeyset
270
      rsQry.LockType = adLockOptimistic
271
 
272
      ' Based upon the original DEF_ACTION_BUTTONS table DDL, define the fields (ie. table columns) being simulated
273
      rsQry.Fields.Append "ABTN_ID",               adInteger
274
      rsQry.Fields.Append "ABTN_NAME",             adVarChar,   64
275
      rsQry.Fields.Append "TEXT",                  adVarChar,  128, adFldIsNullable
276
      rsQry.Fields.Append "ACTION_LINK",           adVarChar,  512, adFldIsNullable
277
      rsQry.Fields.Append "EVENT_HANDLER",         adVarChar,  512, adFldIsNullable
278
      rsQry.Fields.Append "IMG_ENABLED",           adVarChar,  128, adFldIsNullable
279
      rsQry.Fields.Append "IMG_DISABLED",          adVarChar,  128, adFldIsNullable
280
      rsQry.Fields.Append "HINT",                  adVarChar,  256, adFldIsNullable
281
      rsQry.Fields.Append "VISIBLE",               adChar,       1
282
      rsQry.Fields.Append "ACTIVE",                adChar,       1
283
      rsQry.Fields.Append "IS_READONLY_ACTION",    adChar,       1
284
 
285
      ' open the record set for updating
286
      rsQry.Open
287
 
288
      ' Specify the field order that we are going to use in our row creation statements
289
      varFields = Array("ABTN_ID", "ABTN_NAME", "TEXT",_
290
                        "ACTION_LINK",_
291
                        "EVENT_HANDLER",_
292
                        "IMG_ENABLED",_
293
                        "IMG_DISABLED",_
294
                        "HINT",_
295
                        "VISIBLE",_
296
                        "ACTIVE",_
297
                        "IS_READONLY_ACTION")
298
 
299
      ' Add the rows to the record set, but only for buttons specifed in the list supplied by the caller
300
 
301
      ' Remember, Field Ordering is... ID, name, text, link, event handler, en-img, dis-img, hint, visible, active, is readonly action
302
 
303
      If isAbtnRequired(aAbtnList, "btnNewRole") Then
304
         varValues = Array(1,"btnNewRole","New Role",_
305
                           """javascript:;""",_
306
                           """onClick=""""MM_openBrWindow('wAddRole.asp?rfile=RoleList.asp&""& objPMod.ComposeURL() &""','AddRole','scrollbars=yes,resizable=yes,width=600,height=350');""""""",_
307
                           "images/btn_new_role.gif",_
308
                           null,_
309
                           null,_
310
                           "Y",_
311
                           "Y",_
312
                           "N")
313
         rsQry.AddNew varFields, varValues
314
      End If
315
 
316
      If isAbtnRequired(aAbtnList, "btnRemoveRole") Then
317
         varValues = Array(2,"btnRemoveRole","Remove Role",_
318
                           """javascript:go_submit( document.FormName, """"btnRemoveRole"""" );ShowProgress();""",_
319
                           """onClick=""""return confirmAction('Are you sure you want to Remove Role(s) ?');""""""",_
320
                           "images/btn_remove.gif",_
321
                           null,_
322
                           null,_
323
                           "Y",_
324
                           "Y",_
325
                           "N")
326
         rsQry.AddNew varFields, varValues
327
      End If
328
 
329
      If isAbtnRequired(aAbtnList, "btnNewApplication") Then
330
         varValues = Array(3,"btnNewApplication","New Application",_
331
                           """javascript:;""",_
332
                           """onClick=""""MM_openBrWindow('wAddApplication.asp?rfile=ApplicationList.asp&""& objPMod.ComposeURL() &""','AddApplication','scrollbars=yes,resizable=yes,width=600,height=350');""""""",_
333
                           "images/btn_new_application.gif",_
334
                           null,_
335
                           null,_
336
                           "Y",_
337
                           "Y",_
338
                           "N")
339
         rsQry.AddNew varFields, varValues
340
      End If
341
 
342
      If isAbtnRequired(aAbtnList, "btnRemoveApplication") Then
343
         varValues = Array(4,"btnRemoveApplication","Remove Application",_
344
                           """javascript:go_submit( document.FormName, """"btnRemoveApplication"""" );ShowProgress();""",_
345
                           """onClick=""""return confirmAction('Are you sure you want to Remove Application(s) ?');""""""",_
346
                           "images/btn_remove.gif",_
347
                           null,_
348
                           null,_
349
                           "Y",_
350
                           "Y",_
351
                           "N")
352
         rsQry.AddNew varFields, varValues
353
      End If
354
 
355
      If isAbtnRequired(aAbtnList, "btnNewAccount") Then
356
         varValues = Array(5,"btnNewAccount","New Account",_
357
                           """javascript:;""",_
358
                           """onClick=""""MM_openBrWindow('wNewAccount.asp?rfile=UserAccounts.asp&""& objPMod.ComposeURL() &""','NewAccount','scrollbars=yes,resizable=yes,width=600,height=350');""""""",_
359
                           "images/btn_new_user.gif",_
360
                           null,_
361
                           null,_
362
                           "Y",_
363
                           "Y",_
364
                           "N")
365
         rsQry.AddNew varFields, varValues
366
      End If
367
 
368
      If isAbtnRequired(aAbtnList, "btnRemoveAccount") Then
369
         varValues = Array(6,"btnRemoveAccount","Remove Account",_
370
                           """javascript:go_submit( document.FormName, """"btnRemoveAccount"""" );ShowProgress();""",_
371
                           """onClick=""""return confirmAction('Are you sure you want to Remove selected User Account(s)?');""""""",_
372
                           "images/btn_remove.gif",_
373
                           null,_
374
                           null,_
375
                           "Y",_
376
                           "Y",_
377
                           "N")
378
         rsQry.AddNew varFields, varValues
379
      End If
380
 
381
      ' NOTE: This one doesn't seem to do anything useful - perhaps its implementation was never completed?
382
      If isAbtnRequired(aAbtnList, "btnDisableAccount") Then
383
         varValues = Array(7,"btnDisableAccount","Disable Account",_
384
                           """#""",_
385
                           null,_
386
                           null,_
387
                           null,_
388
                           null,_
389
                           "Y",_
390
                           "Y",_
391
                           "N")
392
         rsQry.AddNew varFields, varValues
393
      End If
394
 
395
      If isAbtnRequired(aAbtnList, "btnAddUser") Then
396
         varValues = Array(8,"btnAddUser","Add User",_
397
                           """javascript:;""",_
398
                           """onClick=""""MM_openBrWindow('wAddApplicationUser.asp?rfile=UserList.asp&""& objPMod.ComposeURL() &""','AddApplicationUser','scrollbars=yes,resizable=yes,width=650,height=800');""""""",_
399
                           "images/btn_add_user.gif",_
400
                           null,_
401
                           null,_
402
                           "Y",_
403
                           "Y",_
404
                           "N")
405
         rsQry.AddNew varFields, varValues
406
      End If
407
 
408
      If isAbtnRequired(aAbtnList, "btnSubUser") Then
409
         varValues = Array(9,"btnSubUser","Remove User",_
410
                           """javascript:go_submit( document.FormName, """"btnSubUser"""" );ShowProgress();""",_
411
                           """onClick=""""return confirmAction('Are you sure you want to Remove User(s) ?');""""""",_
412
                           "images/btn_sub_user.gif",_
413
                           null,_
414
                           null,_
415
                           "Y",_
416
                           "Y",_
417
                           "N")
418
         rsQry.AddNew varFields, varValues
419
      End If
420
 
421
      If isAbtnRequired(aAbtnList, "btnNewControl") Then
422
         varValues = Array(10,"btnNewControl","New Control",_
423
                           """javascript:;""",_
424
                           """onClick=""""MM_openBrWindow('wAddControl.asp?rfile=ControlList.asp&""& objPMod.ComposeURL() &""','AddControl','scrollbars=yes,resizable=yes,width=650,height=400');""""""",_
425
                           "images/btn_new_control.gif",_
426
                           null,_
427
                           null,_
428
                           "Y",_
429
                           "Y",_
430
                           "N")
431
         rsQry.AddNew varFields, varValues
432
      End If
433
 
434
      If isAbtnRequired(aAbtnList, "btnRemoveControl") Then
435
         varValues = Array(11,"btnRemoveControl","Remove Control",_
436
                           """javascript:go_submit( document.FormName, """"btnRemoveControl"""" );ShowProgress();""",_
437
                           """onClick=""""return confirmAction('Are you sure you want to Remove Control(s) ?');""""""",_
438
                           "images/btn_remove.gif",_
439
                           null,_
440
                           null,_
441
                           "Y",_
442
                           "Y",_
443
                           "N")
444
         rsQry.AddNew varFields, varValues
445
      End If
446
 
447
      If isAbtnRequired(aAbtnList, "btnGrantRole") Then
448
         varValues = Array(14,"btnGrantRole","Grant Role",_
449
                           """javascript:;""",_
450
                           """onClick=""""MM_openBrWindow('wGrantRole.asp?rfile=User_Roles.asp&""& objPMod.ComposeURL() &""','GrantRole','scrollbars=yes,resizable=yes,width=650,height=700');""""""",_
451
                           "images/btn_add_role.gif",_
452
                           "images/btn_add_role_disabled.gif",_
453
                           "Grant Role to this User",_
454
                           "Y",_
455
                           "Y",_
456
                           "N")
457
         rsQry.AddNew varFields, varValues
458
      End If
459
 
460
      If isAbtnRequired(aAbtnList, "btnRevokeRole") Then
461
         varValues = Array(15,"btnRevokeRole","Revoke Role",_
462
                           """javascript:go_submit( document.FormName, """"btnRevokeRole"""" );ShowProgress();""",_
463
                           """onClick=""""return confirmAction('Are you sure you want to Revoke Role(s) ?');""""""",_
464
                           "images/btn_sub_role.gif",_
465
                           "images/btn_sub_role_disabled.gif",_
466
                           "Revoke Role from this User",_
467
                           "Y",_
468
                           "Y",_
469
                           "N")
470
         rsQry.AddNew varFields, varValues
471
      End If
472
 
473
      If isAbtnRequired(aAbtnList, "btnAddMember") Then
474
         varValues = Array(16,"btnAddMember","Add Member",_
475
                           """javascript:;""",_
476
                           """onClick=""""MM_openBrWindow('wAddRoleMember.asp?rfile=Role_Members.asp&""& objPMod.ComposeURL() &""','AddRoleMember','scrollbars=yes,resizable=yes,width=650,height=800');""""""",_
477
                           "images/btn_add_user.gif",_
478
                           null,_
479
                           "Add Memeber to this Role",_
480
                           "Y",_
481
                           "Y",_
482
                           "N")
483
         rsQry.AddNew varFields, varValues
484
      End If
485
 
486
      If isAbtnRequired(aAbtnList, "btnSubMember") Then
487
         varValues = Array(17,"btnSubMember","Remove Member",_
488
                           """javascript:go_submit( document.FormName, """"btnSubMember"""" );ShowProgress();""",_
489
                           """onClick=""""return confirmAction('Are you sure you want to Remove Member(s) ?');""""""",_
490
                           "images/btn_sub_user.gif",_
491
                           null,_
492
                           "Remove Member from this Role",_
493
                           "Y",_
494
                           "Y",_
495
                           "N")
496
         rsQry.AddNew varFields, varValues
497
      End If
498
 
499
      If isAbtnRequired(aAbtnList, "btnNewDataTable") Then
500
         varValues = Array(18,"btnNewDataTable","New Data Table",_
501
                           """javascript:;""",_
502
                           """onClick=""""MM_openBrWindow('wAddDataTable.asp?rfile=Role_DataFiltering.asp&""& objPMod.ComposeURL() &""','AddDataTable','scrollbars=yes,resizable=yes,width=650,height=400');""""""",_
503
                           "images/btn_new_datatable.gif",_
504
                           null,_
505
                           "Add New Data Table",_
506
                           "Y",_
507
                           "Y",_
508
                           "N")
509
         rsQry.AddNew varFields, varValues
510
      End If
511
 
512
      If isAbtnRequired(aAbtnList, "btnRemoveDataTable") Then
513
         varValues = Array(19,"btnRemoveDataTable",null,_
514
                           """_RemoveDataTable.asp?rfile=""& SCRIPT_NAME &""&dt_id=""& DtId &""&""& objPMod.ComposeURL()",_
515
                           """onClick=""""return confirmAction('Remove \'""& DataTableName &""\' from this list?');""""""",_
516
                           "images/i_remove.gif",_
517
                           null,_
518
                           "Remove this Data Table",_
519
                           "Y",_
520
                           "Y",_
521
                           "N")
522
         rsQry.AddNew varFields, varValues
523
      End If
524
 
525
      If isAbtnRequired(aAbtnList, "btnRoleMembers") Then
526
         varValues = Array(20,"btnRoleMembers","Show Members",_
527
                           """javascript:go_submit( document.FormName, """"btnRoleMembers"""" );ShowProgress();""",_
528
                           null,_
529
                           "images/i_user_lrg.gif",_
530
                           null,_
531
                           null,_
532
                           "Y",_
533
                           "Y",_
534
                           "Y")
535
         rsQry.AddNew varFields, varValues
536
      End If
537
 
538
      ' NOTE: Jeremy added this one as part of a change that never got released and can be seen by looking at the manager_suite_development_dump
539
      ' branch and/or MANAGER_SUITE_DEVELOPMENT_DUMP label.
540
      'If isAbtnRequired(aAbtnList, "btnAddApplicationUser") Then
541
      '   varValues = Array(21,"btnAddApplicationUser","Add To Application",_
542
      '                     """javascript:;""",_
543
      '                     """onClick=""""MM_openBrWindow('wAddToApplication.asp?rfile=User_Applications.asp&""& objPMod.ComposeURL() &""','AddToApplication','scrollbars=yes,resizable=yes,width=450,height=350');""""""",_
544
      '                     "images/btn_add_application.gif",_
545
      '                     null,_
546
      '                     null,_
547
      '                     "Y",_
548
      '                     "Y",_
549
      '                     "N")
550
      '   rsQry.AddNew varFields, varValues
551
      'End If
552
 
553
      ' NOTE: Jeremy added this one as part of a change that never got released and can be seen by looking at the manager_suite_development_dump
554
      ' branch and/or MANAGER_SUITE_DEVELOPMENT_DUMP label.
555
      'If isAbtnRequired(aAbtnList, "btnSubApplicationUser") Then
556
      '   varValues = Array(22,"btnSubApplicationUser","Remove From Application",_
557
      '                     """javascript:;""",_
558
      '                     """onClick=""""MM_openBrWindow('wRemoveFromApplication.asp?rfile=User_Applications.asp&""& objPMod.ComposeURLWith(""user_id,tree"") &""','RemoveFromApplication','scrollbars=yes,resizable=yes,width=450,height=350');""""""",_
559
      '                     "images/btn_sub_application.gif",_
560
      '                     null,_
561
      '                     null,_
562
      '                     "Y",_
563
      '                     "Y",_
564
      '                     "N")
565
      '   rsQry.AddNew varFields, varValues
566
      'End If
567
 
568
      ' NOTE: Along with the two commented out action buttons above, Jeremy may have intended to add another to allow access to the wEditAccount.asp
569
      ' file (on manager_suite_development_dump branch). It seemed like he never got around to it though.
570
 
571
 
572
      ' Move cursor to the first record
573
      rsQry.MoveFirst
574
 
2 rsolanki 575
		If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
576
			Call LoadButtons ( rsQry.GetRows() )
4 ghuddy 577
 
2 rsolanki 578
		End If
4 ghuddy 579
 
2 rsolanki 580
		rsQry.Close
581
		Set rsQry = Nothing
582
	End Sub
583
	'-----------------------------------------------------------------------------------------------------------------
584
	Public Sub LoadButtons ( aRows )
585
		Dim nProperty, newArrayDim, LastRow, rowNum
4 ghuddy 586
 
2 rsolanki 587
		LastRow = UBound( aRows, 2 )
4 ghuddy 588
 
2 rsolanki 589
		For rowNum = 0 To LastRow
590
			' Increase array by 1
591
			newArrayDim = LastRowInx() + 1
592
			ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )
4 ghuddy 593
 
594
 
2 rsolanki 595
			mobjNameDefMap.Item ( Cstr( aRows ( InxName, rowNum ) ) ) = newArrayDim
4 ghuddy 596
 
2 rsolanki 597
			For nProperty = 0 To mLastPropertyInx
598
				mArrAbtnDef ( nProperty, newArrayDim ) = aRows ( nProperty, rowNum )
4 ghuddy 599
 
2 rsolanki 600
			Next
4 ghuddy 601
 
2 rsolanki 602
		Next
4 ghuddy 603
 
2 rsolanki 604
	End Sub
605
	'-----------------------------------------------------------------------------------------------------------------
606
	Private Function LastRowInx ()
607
		 LastRowInx = UBound ( mArrAbtnDef, 2 )
608
	End Function
609
	'-----------------------------------------------------------------------------------------------------------------
610
	Public Sub AddSeparatorAfter ( sItemName, sSeparatorWidth )
611
		If InStr( sItemName, " " ) > 0 Then	Err.Raise 8, "Method AddSeparatorAfter", "Item Name '"& sItemName &"' cannot have spaces."
612
		mobjSeparator.Add (Cstr(sItemName)), CStr(sSeparatorWidth)
613
	End Sub
614
	'-----------------------------------------------------------------------------------------------------------------
615
	Public Sub AddSeparator ( sSeparatorWidth )
616
		mobjSeparator.Add ( Cstr(mArrAbtnDef(InxName, LastItemInx())) ), CStr(sSeparatorWidth)
617
	End Sub
618
	'-----------------------------------------------------------------------------------------------------------------
619
	Private Sub SetItemDefaults ( sItemName )
620
		' Additional default setup
621
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxActive, enumDB_YES )			' Default Active = enumDB_YES
622
	End Sub
623
	'-----------------------------------------------------------------------------------------------------------------
624
	Public Sub Text ( sItemName, Value )
625
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxTxt, Value )
626
	End Sub
627
	'-----------------------------------------------------------------------------------------------------------------
628
	Public Sub ItemID ( sItemName, Value )
629
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxID, Value )
630
	End Sub
631
	'-----------------------------------------------------------------------------------------------------------------
632
	Public Sub Image ( sItemName, Value )
633
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImg, Value )
634
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImgOff, Value )			' Default image disable to be the same as image
635
	End Sub
636
	'-----------------------------------------------------------------------------------------------------------------
637
	Public Sub ImageOff ( sItemName, Value )
638
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImgOff, Value )
639
	End Sub
640
	'-----------------------------------------------------------------------------------------------------------------
641
	Public Sub Link ( sItemName, Value )
642
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxLink, Value )
643
	End Sub
644
	'-----------------------------------------------------------------------------------------------------------------
645
	Public Sub EventHandler ( sItemName, Value )
646
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxEventHandler, Value )
647
	End Sub
648
	'-----------------------------------------------------------------------------------------------------------------
649
	Public Sub Hint ( sItemName, Value )
650
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxHint, Value )
651
	End Sub
652
	'-----------------------------------------------------------------------------------------------------------------
653
	Public Sub Active ( sItemName, Value )
654
		'Response.write sItemName &"here"& mobjNameDefMap.Item (Cstr(sItemName))
655
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxActive, Value )
656
	End Sub
657
	'-----------------------------------------------------------------------------------------------------------------
658
	Private Sub Class_Initialize()
659
		'// Perform action on creation of object. e.g. Set myObj = New ThisClassName
660
		Set mobjNameDefMap = CreateObject("Scripting.Dictionary")
661
		Set mobjIdDefMap = CreateObject("Scripting.Dictionary")
662
		Set mobjSeparator = CreateObject("Scripting.Dictionary")
4 ghuddy 663
 
2 rsolanki 664
		'mbIsReadonly = FALSE	' Tell control that it should use only readonly action buttons (i.e. actions which will not alter database )
665
		mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_HIDE		' Tell control what to do by default if mbIsReadonly = TRUE
4 ghuddy 666
 
2 rsolanki 667
		mnButtonSpacer = 0
668
		mnButtonTextSpace = 4
4 ghuddy 669
 
2 rsolanki 670
		mNumOfProperties = 10  	' Number of properties in array which define one menu item.
671
		mLastPropertyInx = mNumOfProperties - 1
4 ghuddy 672
 
2 rsolanki 673
		mbDisableAll = FALSE
4 ghuddy 674
 
2 rsolanki 675
		ReDim mArrAbtnDef ( mNumOfProperties, -1 )
676
		InxID					= 0
677
		InxName					= 1
678
		InxTxt					= 2
679
		InxLink					= 3
680
		InxEventHandler			= 4
681
		InxImg					= 5
682
		InxImgOff				= 6
683
		InxHint					= 7
684
		InxActive				= 8
685
		InxIsReadonlyAction		= 9
4 ghuddy 686
 
2 rsolanki 687
	End Sub
688
	'-----------------------------------------------------------------------------------------------------------------
689
	Private Sub Class_Terminate()
690
		'// Perform action on object disposal. e.g. Set myObj = Nothing
691
		Set mobjNameDefMap = Nothing
692
		Set mobjIdDefMap = Nothing
693
		Set mobjSeparator = Nothing
4 ghuddy 694
 
695
 
2 rsolanki 696
	End Sub
697
	'-----------------------------------------------------------------------------------------------------------------
698
End Class
4 ghuddy 699
%>