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