Subversion Repositories DevTools

Rev

Rev 5512 | Details | Compare with Previous | 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();""",_
6049 dpurdie 386
                           """onClick=""""return confirmAction('Are you sure you want to Remove selected User Account(s)?<br>This will affect applications that reference the users Name and Email address.');""""""",_
4 ghuddy 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
      If isAbtnRequired(aAbtnList, "btnDisableAccount") Then
397
         varValues = Array(7,"btnDisableAccount","Disable Account",_
6049 dpurdie 398
                           """javascript:go_submit( document.FormName, """"btnDisableAccount"""" );ShowProgress();""",_
399
                           """onClick=""""return confirmAction('Are you sure you want to Disable selected User Account(s)?');""""""",_
400
                           "images/i_lock.gif",_
4 ghuddy 401
                           null,_
402
                           null,_
403
                           "Y",_
404
                           "Y",_
405
                           "N")
406
         rsQry.AddNew varFields, varValues
407
      End If
408
 
409
      If isAbtnRequired(aAbtnList, "btnAddUser") Then
410
         varValues = Array(8,"btnAddUser","Add User",_
411
                           """javascript:;""",_
412
                           """onClick=""""MM_openBrWindow('wAddApplicationUser.asp?rfile=UserList.asp&""& objPMod.ComposeURL() &""','AddApplicationUser','scrollbars=yes,resizable=yes,width=650,height=800');""""""",_
413
                           "images/btn_add_user.gif",_
414
                           null,_
415
                           null,_
416
                           "Y",_
417
                           "Y",_
418
                           "N")
419
         rsQry.AddNew varFields, varValues
420
      End If
421
 
422
      If isAbtnRequired(aAbtnList, "btnSubUser") Then
423
         varValues = Array(9,"btnSubUser","Remove User",_
424
                           """javascript:go_submit( document.FormName, """"btnSubUser"""" );ShowProgress();""",_
425
                           """onClick=""""return confirmAction('Are you sure you want to Remove User(s) ?');""""""",_
426
                           "images/btn_sub_user.gif",_
427
                           null,_
428
                           null,_
429
                           "Y",_
430
                           "Y",_
431
                           "N")
432
         rsQry.AddNew varFields, varValues
433
      End If
434
 
435
      If isAbtnRequired(aAbtnList, "btnNewControl") Then
436
         varValues = Array(10,"btnNewControl","New Control",_
437
                           """javascript:;""",_
438
                           """onClick=""""MM_openBrWindow('wAddControl.asp?rfile=ControlList.asp&""& objPMod.ComposeURL() &""','AddControl','scrollbars=yes,resizable=yes,width=650,height=400');""""""",_
439
                           "images/btn_new_control.gif",_
440
                           null,_
441
                           null,_
442
                           "Y",_
443
                           "Y",_
444
                           "N")
445
         rsQry.AddNew varFields, varValues
446
      End If
447
 
448
      If isAbtnRequired(aAbtnList, "btnRemoveControl") Then
449
         varValues = Array(11,"btnRemoveControl","Remove Control",_
450
                           """javascript:go_submit( document.FormName, """"btnRemoveControl"""" );ShowProgress();""",_
451
                           """onClick=""""return confirmAction('Are you sure you want to Remove Control(s) ?');""""""",_
452
                           "images/btn_remove.gif",_
453
                           null,_
454
                           null,_
455
                           "Y",_
456
                           "Y",_
457
                           "N")
458
         rsQry.AddNew varFields, varValues
459
      End If
460
 
461
      If isAbtnRequired(aAbtnList, "btnGrantRole") Then
462
         varValues = Array(14,"btnGrantRole","Grant Role",_
463
                           """javascript:;""",_
464
                           """onClick=""""MM_openBrWindow('wGrantRole.asp?rfile=User_Roles.asp&""& objPMod.ComposeURL() &""','GrantRole','scrollbars=yes,resizable=yes,width=650,height=700');""""""",_
465
                           "images/btn_add_role.gif",_
466
                           "images/btn_add_role_disabled.gif",_
467
                           "Grant Role to this User",_
468
                           "Y",_
469
                           "Y",_
470
                           "N")
471
         rsQry.AddNew varFields, varValues
472
      End If
473
 
474
      If isAbtnRequired(aAbtnList, "btnRevokeRole") Then
475
         varValues = Array(15,"btnRevokeRole","Revoke Role",_
476
                           """javascript:go_submit( document.FormName, """"btnRevokeRole"""" );ShowProgress();""",_
477
                           """onClick=""""return confirmAction('Are you sure you want to Revoke Role(s) ?');""""""",_
478
                           "images/btn_sub_role.gif",_
479
                           "images/btn_sub_role_disabled.gif",_
480
                           "Revoke Role from this User",_
481
                           "Y",_
482
                           "Y",_
483
                           "N")
484
         rsQry.AddNew varFields, varValues
485
      End If
486
 
487
      If isAbtnRequired(aAbtnList, "btnAddMember") Then
488
         varValues = Array(16,"btnAddMember","Add Member",_
489
                           """javascript:;""",_
490
                           """onClick=""""MM_openBrWindow('wAddRoleMember.asp?rfile=Role_Members.asp&""& objPMod.ComposeURL() &""','AddRoleMember','scrollbars=yes,resizable=yes,width=650,height=800');""""""",_
491
                           "images/btn_add_user.gif",_
492
                           null,_
493
                           "Add Memeber to this Role",_
494
                           "Y",_
495
                           "Y",_
496
                           "N")
497
         rsQry.AddNew varFields, varValues
498
      End If
499
 
500
      If isAbtnRequired(aAbtnList, "btnSubMember") Then
501
         varValues = Array(17,"btnSubMember","Remove Member",_
502
                           """javascript:go_submit( document.FormName, """"btnSubMember"""" );ShowProgress();""",_
503
                           """onClick=""""return confirmAction('Are you sure you want to Remove Member(s) ?');""""""",_
504
                           "images/btn_sub_user.gif",_
505
                           null,_
506
                           "Remove Member from this Role",_
507
                           "Y",_
508
                           "Y",_
509
                           "N")
510
         rsQry.AddNew varFields, varValues
511
      End If
512
 
513
      If isAbtnRequired(aAbtnList, "btnNewDataTable") Then
514
         varValues = Array(18,"btnNewDataTable","New Data Table",_
515
                           """javascript:;""",_
516
                           """onClick=""""MM_openBrWindow('wAddDataTable.asp?rfile=Role_DataFiltering.asp&""& objPMod.ComposeURL() &""','AddDataTable','scrollbars=yes,resizable=yes,width=650,height=400');""""""",_
517
                           "images/btn_new_datatable.gif",_
518
                           null,_
519
                           "Add New Data Table",_
520
                           "Y",_
521
                           "Y",_
522
                           "N")
523
         rsQry.AddNew varFields, varValues
524
      End If
525
 
526
      If isAbtnRequired(aAbtnList, "btnRemoveDataTable") Then
527
         varValues = Array(19,"btnRemoveDataTable",null,_
528
                           """_RemoveDataTable.asp?rfile=""& SCRIPT_NAME &""&dt_id=""& DtId &""&""& objPMod.ComposeURL()",_
529
                           """onClick=""""return confirmAction('Remove \'""& DataTableName &""\' from this list?');""""""",_
5299 dpurdie 530
                           "images/i_remove_no_border.gif",_
4 ghuddy 531
                           null,_
532
                           "Remove this Data Table",_
533
                           "Y",_
534
                           "Y",_
535
                           "N")
536
         rsQry.AddNew varFields, varValues
537
      End If
538
 
539
      If isAbtnRequired(aAbtnList, "btnRoleMembers") Then
540
         varValues = Array(20,"btnRoleMembers","Show Members",_
541
                           """javascript:go_submit( document.FormName, """"btnRoleMembers"""" );ShowProgress();""",_
542
                           null,_
543
                           "images/i_user_lrg.gif",_
544
                           null,_
5299 dpurdie 545
                           "Show members common to all selected Roles",_
4 ghuddy 546
                           "Y",_
547
                           "Y",_
548
                           "Y")
549
         rsQry.AddNew varFields, varValues
550
      End If
551
 
8 brianf 552
      If isAbtnRequired(aAbtnList, "btnAddApplicationUser") Then
553
         varValues = Array(21,"btnAddApplicationUser","Add To Application",_
554
                           """javascript:;""",_
555
                           """onClick=""""MM_openBrWindow('wAddToApplication.asp?rfile=User_Applications.asp&""& objPMod.ComposeURL() &""','AddToApplication','scrollbars=yes,resizable=yes,width=450,height=350');""""""",_
556
                           "images/btn_add_application.gif",_
557
                           null,_
558
                           null,_
559
                           "Y",_
560
                           "Y",_
561
                           "N")
562
         rsQry.AddNew varFields, varValues
563
      End If
4 ghuddy 564
 
8 brianf 565
      If isAbtnRequired(aAbtnList, "btnSubApplicationUser") Then
566
         varValues = Array(22,"btnSubApplicationUser","Remove From Application",_
567
                           """javascript:;""",_
568
                           """onClick=""""MM_openBrWindow('wRemoveFromApplication.asp?rfile=User_Applications.asp&""& objPMod.ComposeURLWith(""user_id,tree"") &""','RemoveFromApplication','scrollbars=yes,resizable=yes,width=450,height=350');""""""",_
569
                           "images/btn_sub_application.gif",_
570
                           null,_
571
                           null,_
572
                           "Y",_
573
                           "Y",_
574
                           "N")
575
         rsQry.AddNew varFields, varValues
576
      End If
4 ghuddy 577
 
8 brianf 578
      ' NOTE: Jeremy may have intended to add another to allow access to the wEditAccount.asp
4 ghuddy 579
      ' file (on manager_suite_development_dump branch). It seemed like he never got around to it though.
580
 
581
 
582
      ' Move cursor to the first record
8 brianf 583
      If rsQry.RecordCount > 0 Then
584
         rsQry.MoveFirst
4 ghuddy 585
 
8 brianf 586
         If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
587
            Call LoadButtons ( rsQry.GetRows() )
588
         End If
589
      End If
4 ghuddy 590
 
3943 dpurdie 591
 
2 rsolanki 592
		rsQry.Close
593
		Set rsQry = Nothing
594
	End Sub
595
	'-----------------------------------------------------------------------------------------------------------------
596
	Public Sub LoadButtons ( aRows )
597
		Dim nProperty, newArrayDim, LastRow, rowNum
4 ghuddy 598
 
2 rsolanki 599
		LastRow = UBound( aRows, 2 )
4 ghuddy 600
 
2 rsolanki 601
		For rowNum = 0 To LastRow
602
			' Increase array by 1
603
			newArrayDim = LastRowInx() + 1
604
			ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )
4 ghuddy 605
 
606
 
2 rsolanki 607
			mobjNameDefMap.Item ( Cstr( aRows ( InxName, rowNum ) ) ) = newArrayDim
4 ghuddy 608
 
2 rsolanki 609
			For nProperty = 0 To mLastPropertyInx
610
				mArrAbtnDef ( nProperty, newArrayDim ) = aRows ( nProperty, rowNum )
4 ghuddy 611
 
2 rsolanki 612
			Next
4 ghuddy 613
 
2 rsolanki 614
		Next
4 ghuddy 615
 
2 rsolanki 616
	End Sub
617
	'-----------------------------------------------------------------------------------------------------------------
618
	Private Function LastRowInx ()
619
		 LastRowInx = UBound ( mArrAbtnDef, 2 )
620
	End Function
621
	'-----------------------------------------------------------------------------------------------------------------
622
	Public Sub AddSeparatorAfter ( sItemName, sSeparatorWidth )
623
		If InStr( sItemName, " " ) > 0 Then	Err.Raise 8, "Method AddSeparatorAfter", "Item Name '"& sItemName &"' cannot have spaces."
624
		mobjSeparator.Add (Cstr(sItemName)), CStr(sSeparatorWidth)
625
	End Sub
626
	'-----------------------------------------------------------------------------------------------------------------
627
	Public Sub AddSeparator ( sSeparatorWidth )
628
		mobjSeparator.Add ( Cstr(mArrAbtnDef(InxName, LastItemInx())) ), CStr(sSeparatorWidth)
629
	End Sub
630
	'-----------------------------------------------------------------------------------------------------------------
631
	Private Sub SetItemDefaults ( sItemName )
632
		' Additional default setup
633
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxActive, enumDB_YES )			' Default Active = enumDB_YES
634
	End Sub
635
	'-----------------------------------------------------------------------------------------------------------------
636
	Public Sub Text ( sItemName, Value )
637
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxTxt, Value )
638
	End Sub
639
	'-----------------------------------------------------------------------------------------------------------------
640
	Public Sub ItemID ( sItemName, Value )
641
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxID, Value )
642
	End Sub
643
	'-----------------------------------------------------------------------------------------------------------------
644
	Public Sub Image ( sItemName, Value )
645
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImg, Value )
646
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImgOff, Value )			' Default image disable to be the same as image
647
	End Sub
648
	'-----------------------------------------------------------------------------------------------------------------
649
	Public Sub ImageOff ( sItemName, Value )
650
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImgOff, Value )
651
	End Sub
652
	'-----------------------------------------------------------------------------------------------------------------
653
	Public Sub Link ( sItemName, Value )
654
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxLink, Value )
655
	End Sub
656
	'-----------------------------------------------------------------------------------------------------------------
657
	Public Sub EventHandler ( sItemName, Value )
658
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxEventHandler, Value )
659
	End Sub
660
	'-----------------------------------------------------------------------------------------------------------------
661
	Public Sub Hint ( sItemName, Value )
662
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxHint, Value )
663
	End Sub
664
	'-----------------------------------------------------------------------------------------------------------------
665
	Public Sub Active ( sItemName, Value )
666
		'Response.write sItemName &"here"& mobjNameDefMap.Item (Cstr(sItemName))
667
		Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxActive, Value )
668
	End Sub
669
	'-----------------------------------------------------------------------------------------------------------------
670
	Private Sub Class_Initialize()
671
		'// Perform action on creation of object. e.g. Set myObj = New ThisClassName
672
		Set mobjNameDefMap = CreateObject("Scripting.Dictionary")
673
		Set mobjIdDefMap = CreateObject("Scripting.Dictionary")
674
		Set mobjSeparator = CreateObject("Scripting.Dictionary")
4 ghuddy 675
 
2 rsolanki 676
		'mbIsReadonly = FALSE	' Tell control that it should use only readonly action buttons (i.e. actions which will not alter database )
677
		mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_HIDE		' Tell control what to do by default if mbIsReadonly = TRUE
4 ghuddy 678
 
2 rsolanki 679
		mnButtonSpacer = 0
680
		mnButtonTextSpace = 4
4 ghuddy 681
 
2 rsolanki 682
		mNumOfProperties = 10  	' Number of properties in array which define one menu item.
683
		mLastPropertyInx = mNumOfProperties - 1
4 ghuddy 684
 
2 rsolanki 685
		mbDisableAll = FALSE
4 ghuddy 686
 
2 rsolanki 687
		ReDim mArrAbtnDef ( mNumOfProperties, -1 )
688
		InxID					= 0
689
		InxName					= 1
690
		InxTxt					= 2
691
		InxLink					= 3
692
		InxEventHandler			= 4
693
		InxImg					= 5
694
		InxImgOff				= 6
695
		InxHint					= 7
696
		InxActive				= 8
697
		InxIsReadonlyAction		= 9
4 ghuddy 698
 
2 rsolanki 699
	End Sub
700
	'-----------------------------------------------------------------------------------------------------------------
701
	Private Sub Class_Terminate()
702
		'// Perform action on object disposal. e.g. Set myObj = Nothing
703
		Set mobjNameDefMap = Nothing
704
		Set mobjIdDefMap = Nothing
705
		Set mobjSeparator = Nothing
4 ghuddy 706
 
707
 
2 rsolanki 708
	End Sub
709
	'-----------------------------------------------------------------------------------------------------------------
710
End Class
4 ghuddy 711
%>