Subversion Repositories DevTools

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 4
Line -... Line 1...
-
 
1
<!-- #INCLUDE FILE="..\common\adovbs.inc" -->
1
<%
2
<%
2
'=============================================================
3
'=============================================================
3
'//
4
'//
4
'//						Action Button Control
5
'//						Action Button Control
5
'//
6
'//
Line 12... Line 13...
12
Const enumABTNCTRL_ON_READONLY_HIDE = 1
13
Const enumABTNCTRL_ON_READONLY_HIDE = 1
13
Const enumABTNCTRL_ON_READONLY_DISABLE = 2
14
Const enumABTNCTRL_ON_READONLY_DISABLE = 2
14
'-------------------------------------------------
15
'-------------------------------------------------
15
 
16
 
16
Class ActionButtonControl
17
Class ActionButtonControl
17
	
18
 
18
	Private mArrAbtnDef()
19
	Private mArrAbtnDef()
19
	Private mobjNameDefMap			' Item can be accesed by name. Must be unique within one page
20
	Private mobjNameDefMap			' Item can be accesed by name. Must be unique within one page
20
	Private mobjIdDefMap			' Item can be accesed by id. Must be unique within one page. If NULL, ubound is assigned to it
21
	Private mobjIdDefMap			' Item can be accesed by id. Must be unique within one page. If NULL, ubound is assigned to it
21
	Private mobjSeparator			' Has a name of item after separator is applied
22
	Private mobjSeparator			' Has a name of item after separator is applied
22
	
23
 
23
	Private mnButtonSpacer
24
	Private mnButtonSpacer
24
	Private mnButtonTextSpace
25
	Private mnButtonTextSpace
25
	
26
 
26
	Private mNumOfProperties
27
	Private mNumOfProperties
27
	Private mLastPropertyInx
28
	Private mLastPropertyInx
28
	
29
 
29
	Private mbDisableAll
30
	Private mbDisableAll
30
	
31
 
31
	Private mbIsReadonly
32
	Private mbIsReadonly
32
	Private mReadonlyActionBehaviour
33
	Private mReadonlyActionBehaviour
33
	
34
 
34
	Private InxID
35
	Private InxID
35
	Private InxName
36
	Private InxName
36
	Private InxTxt
37
	Private InxTxt
37
	Private InxLink
38
	Private InxLink
38
	Private InxEventHandler
39
	Private InxEventHandler
39
	Private InxImg
40
	Private InxImg
40
	Private InxImgOff
41
	Private InxImgOff
41
	Private InxHint
42
	Private InxHint
42
	Private InxActive
43
	Private InxActive
43
	Private InxIsReadonlyAction
44
	Private InxIsReadonlyAction
44
	
45
 
45
	
46
 
46
	
47
 
47
	Public Property Let AllActive ( cActive )
48
	Public Property Let AllActive ( cActive )
48
		If cActive = enumDB_NO Then
49
		If cActive = enumDB_NO Then
49
			mbDisableAll = TRUE
50
			mbDisableAll = TRUE
50
		Else
51
		Else
51
			mbDisableAll = FALSE
52
			mbDisableAll = FALSE
52
		End If
53
		End If
53
		
54
 
54
	End Property
55
	End Property
55
	
56
 
56
	Public Property Let ButtonSpacer ( nWidth )
57
	Public Property Let ButtonSpacer ( nWidth )
57
		mnButtonSpacer = nWidth
58
		mnButtonSpacer = nWidth
58
	End Property
59
	End Property
59
	
60
 
60
	Public Property Let ButtonTextSpacer ( nWidth )
61
	Public Property Let ButtonTextSpacer ( nWidth )
61
		mnButtonTextSpace = nWidth
62
		mnButtonTextSpace = nWidth
62
	End Property
63
	End Property
63
	
64
 
64
	Public Property Let IsReadonlyAction ( IsReadonly )
65
	Public Property Let IsReadonlyAction ( IsReadonly )
65
		If IsReadonly = enumDB_YES Then
66
		If IsReadonly = enumDB_YES Then
66
			mbIsReadonly = TRUE
67
			mbIsReadonly = TRUE
67
			
68
 
68
		ElseIf IsReadonly = enumDB_NO Then
69
		ElseIf IsReadonly = enumDB_NO Then
69
			mbIsReadonly = FALSE
70
			mbIsReadonly = FALSE
70
		Else
71
		Else
71
			mbIsReadonly = IsReadonly
72
			mbIsReadonly = IsReadonly
72
			
73
 
73
		End If
74
		End If
74
		
75
 
75
	End Property
76
	End Property
76
	
77
 
77
	Public Property Let ReadonlyActionBehaviour ( nEnum )
78
	Public Property Let ReadonlyActionBehaviour ( nEnum )
78
		mReadonlyActionBehaviour = nEnum
79
		mReadonlyActionBehaviour = nEnum
79
	End Property
80
	End Property
80
	
81
 
81
	'-----------------------------------------------------------------------------------------------------------------
82
	'-----------------------------------------------------------------------------------------------------------------
82
	Private Sub SetItemPropertyByIndex ( nInx, nProperty, Value )
83
	Private Sub SetItemPropertyByIndex ( nInx, nProperty, Value )
83
		If nInx = ""  OR  nProperty = ""  OR  Value = "" Then Err.Raise 8, "Method SetItemPropertyByIndex", "Empty parameters found. nInx="& nInx &", nProperty="& nProperty &", Value="& Value 
84
		If nInx = ""  OR  nProperty = ""  OR  Value = "" Then Err.Raise 8, "Method SetItemPropertyByIndex", "Empty parameters found. nInx="& nInx &", nProperty="& nProperty &", Value="& Value
84
		
85
 
85
		mArrAbtnDef ( nProperty, nInx ) = Value
86
		mArrAbtnDef ( nProperty, nInx ) = Value
86
		
87
 
87
		'Response.write "mArrAbtnDef ( "& nProperty &", "& nInx &" ) = "& Value &"<br>"
88
		'Response.write "mArrAbtnDef ( "& nProperty &", "& nInx &" ) = "& Value &"<br>"
88
	End Sub
89
	End Sub
89
	'-----------------------------------------------------------------------------------------------------------------
90
	'-----------------------------------------------------------------------------------------------------------------
90
	Private Function LastItemInx ()
91
	Private Function LastItemInx ()
91
		 LastItemInx = UBound ( mArrAbtnDef, 2 )
92
		 LastItemInx = UBound ( mArrAbtnDef, 2 )
92
	End Function
93
	End Function
93
	'-----------------------------------------------------------------------------------------------------------------
94
	'-----------------------------------------------------------------------------------------------------------------
94
	Public Sub AddActionButton ( sItemName, nItemID )
95
	Public Sub AddActionButton ( sItemName, nItemID )
95
		Dim newArrayDim
96
		Dim newArrayDim
96
		
97
 
97
		If InStr( sItemName, " " ) > 0 Then	Err.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' cannot have spaces."
98
		If InStr( sItemName, " " ) > 0 Then	Err.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' cannot have spaces."
98
		
99
 
99
		
100
 
100
		
101
 
101
		If NOT mobjNameDefMap.Exists (CStr( sItemName )) Then
102
		If NOT mobjNameDefMap.Exists (CStr( sItemName )) Then
102
			
103
 
103
			newArrayDim = LastItemInx() + 1
104
			newArrayDim = LastItemInx() + 1
104
			
105
 
105
			ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )
106
			ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )
106
			
107
 
107
			' Store name
108
			' Store name
108
			Call SetItemPropertyByIndex ( newArrayDim, InxName, sItemName )
109
			Call SetItemPropertyByIndex ( newArrayDim, InxName, sItemName )
109
			mobjNameDefMap.Add Cstr( sItemName ), CStr( newArrayDim )
110
			mobjNameDefMap.Add Cstr( sItemName ), CStr( newArrayDim )
110
			
111
 
111
			If Not IsNull(nItemID) Then
112
			If Not IsNull(nItemID) Then
112
				' Store ID
113
				' Store ID
113
				Call SetItemPropertyByIndex ( newArrayDim, InxdbID, nItemID )
114
				Call SetItemPropertyByIndex ( newArrayDim, InxdbID, nItemID )
114
				mobjIdDefMap.Add Cstr( nItemID ), CStr( newArrayDim )
115
				mobjIdDefMap.Add Cstr( nItemID ), CStr( newArrayDim )
115
			End If
116
			End If
116
			
117
 
117
			' Set Defaults
118
			' Set Defaults
118
			Call SetItemDefaults ( sItemName )
119
			Call SetItemDefaults ( sItemName )
119
		Else
120
		Else
120
			
121
 
121
			Err.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' has been already defined."
122
			Err.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' has been already defined."
122
			
123
 
123
		End If
124
		End If
124
		
125
 
125
	End Sub
126
	End Sub
126
	'-----------------------------------------------------------------------------------------------------------------
127
	'-----------------------------------------------------------------------------------------------------------------
127
	Public Sub Render ( aAbtnList )
128
	Public Sub Render ( aAbtnList )
128
		Dim itemInx, itemName, nLastItemInx, btnImage, ButtonStr, ButtonStrDisabled
129
		Dim itemInx, itemName, nLastItemInx, btnImage, ButtonStr, ButtonStrDisabled
129
		Response.write "<table cellpadding='0' cellspacing='0' width='1'><tr>"
130
		Response.write "<table cellpadding='0' cellspacing='0' width='1'><tr>"
130
		
131
 
131
		For Each itemName in aAbtnList
132
		For Each itemName in aAbtnList
132
			
133
 
133
			itemInx = mobjNameDefMap.Item (Cstr(itemName))
134
			itemInx = mobjNameDefMap.Item (Cstr(itemName))
134
			'If itemInx = "" Then 	Err.Raise 8, "Method Render", "Definition for item name '"& itemName &"' not found."
135
			'If itemInx = "" Then 	Err.Raise 8, "Method Render", "Definition for item name '"& itemName &"' not found."
135
			
136
 
136
			
137
 
137
			'-- Define Image
138
			'-- Define Image
138
			btnImage = "<img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle' border='0'>"
139
			btnImage = "<img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle' border='0'>"
139
			If (mArrAbtnDef( InxImg, itemInx ) <> "") Then
140
			If (mArrAbtnDef( InxImg, itemInx ) <> "") Then
140
				btnImage = "<img src='"& mArrAbtnDef( InxImg, itemInx ) &"' hspace='"& mnButtonTextSpace &"' border='0' align='absmiddle'>"
141
				btnImage = "<img src='"& mArrAbtnDef( InxImg, itemInx ) &"' hspace='"& mnButtonTextSpace &"' border='0' align='absmiddle'>"
141
			End If
142
			End If
142
			
143
 
143
			
144
 
144
			'-- Define Button
145
			'-- Define Button
145
			
-
 
146
			ButtonStr = _
146
			ButtonStr = _
147
				"<td nowrap>"&_
147
				"<td nowrap>"&_
148
				"<a id='"& mArrAbtnDef( InxName, itemInx ) &"' "&_
148
				"<a id='"& mArrAbtnDef( InxName, itemInx ) &"' "&_
149
				" name='"& mArrAbtnDef( InxName, itemInx ) &"' href='"& Eval( mArrAbtnDef( InxLink, itemInx ) ) &"' "&_
149
				" name='"& mArrAbtnDef( InxName, itemInx ) &"' href='"& Eval( mArrAbtnDef( InxLink, itemInx ) ) &"' "&_
150
				" "& Eval( mArrAbtnDef( InxEventHandler, itemInx ) ) &" class='menu_link' title='"& mArrAbtnDef( InxHint, itemInx )  &"'>"&_
150
				" "& Eval( mArrAbtnDef( InxEventHandler, itemInx ) ) &" class='menu_link' title='"& mArrAbtnDef( InxHint, itemInx )  &"'>"&_
151
				btnImage & mArrAbtnDef( InxTxt, itemInx ) &"</a>"&_
151
				btnImage & mArrAbtnDef( InxTxt, itemInx ) &"</a>"&_
152
				"</td>"
152
				"</td>"
153
			
153
 
154
			
154
 
155
			'-- Define Disabled Button
155
			'-- Define Disabled Button
156
			ButtonStrDisabled = _
156
			ButtonStrDisabled = _
157
				"<td nowrap>"&_
157
				"<td nowrap>"&_
158
				"<img src='"& mArrAbtnDef( InxImgOff, itemInx ) &"' hspace='2' border='0' align='absmiddle'>"&_
158
				"<img src='"& mArrAbtnDef( InxImgOff, itemInx ) &"' hspace='2' border='0' align='absmiddle'>"&_
159
				"<label class='menu_txt'>"& mArrAbtnDef( InxTxt, itemInx ) &"</label>"&_
159
				"<label class='menu_txt'>"& mArrAbtnDef( InxTxt, itemInx ) &"</label>"&_
160
				"</td>"
160
				"</td>"
161
			
161
 
162
			
162
 
163
			
163
 
164
			
164
 
165
			If  mbDisableAll OR ( mArrAbtnDef( InxActive, itemInx ) = enumDB_NO ) Then
165
			If  mbDisableAll OR ( mArrAbtnDef( InxActive, itemInx ) = enumDB_NO ) Then
166
				' --- Display DISABLED Button Item ---
166
				' --- Display DISABLED Button Item ---
167
				Response.write ButtonStrDisabled
167
				Response.write ButtonStrDisabled
168
				
168
 
169
			Else
169
			Else
170
				
170
 
171
				' --- Display Action Button Item ---
171
				' --- Display Action Button Item ---
172
				If	( NOT mbIsReadonly )  OR _
172
				If	( NOT mbIsReadonly )  OR _
173
				   	( mbIsReadonly  AND  mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_YES ) Then
173
				   	( mbIsReadonly  AND  mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_YES ) Then
174
					
174
 
175
					If InStr( itemName, "width=" ) > 0 Then
175
					If InStr( itemName, "width=" ) > 0 Then
176
						Response.write "<td><img src='images/spacer.gif' "& itemName &" height='1' align='absmiddle'></td>"
176
						Response.write "<td><img src='images/spacer.gif' "& itemName &" height='1' align='absmiddle'></td>"
177
						
177
 
178
					ElseIf InStr( itemName, "height=" ) > 0 Then
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>"
179
						Response.write "<td><img src='images/bg_bage_2.gif' width='1' "& itemName &" align='absmiddle' hspace='4'></td>"
180
						
180
 
181
					Else
181
					Else
182
						'/* It is a button, i.e. Display Button */
182
						'/* It is a button, i.e. Display Button */
183
						Response.write ButtonStr
183
						Response.write ButtonStr
184
						
184
 
185
						If mnButtonSpacer > 0 Then
185
						If mnButtonSpacer > 0 Then
186
						Response.write "<td><img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle'></td>"
186
						Response.write "<td><img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle'></td>"
187
						End If
187
						End If
188
						
188
 
189
					End If
189
					End If
190
					
190
 
191
					
191
 
192
				ElseIf ( mbIsReadonly  AND  mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_NO ) Then
192
				ElseIf ( mbIsReadonly  AND  mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_NO ) Then
193
					
193
 
194
					
194
 
195
					
195
 
196
					If mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_DISABLE Then
196
					If mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_DISABLE Then
197
						Response.write ButtonStrDisabled
197
						Response.write ButtonStrDisabled
198
					End If
198
					End If
199
					
199
 
200
					
200
 
201
					
201
 
202
				End If
202
				End If
203
				
203
 
204
			End If
204
			End If
205
			
205
 
206
			
206
 
207
			
207
 
208
			
208
 
209
			' --- Separators added manually using  method AddSeparator or AddSeparatorAfter ---
209
			' --- Separators added manually using  method AddSeparator or AddSeparatorAfter ---
210
			If mobjSeparator.Exists ( Cstr(mArrAbtnDef( InxName, itemInx )) ) Then
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>"
211
				Response.write "<td><img src='images/spacer.gif' width='"& mobjSeparator.Item ( Cstr(mArrAbtnDef( InxName, itemInx )) ) &"' height='1'></td>"
212
				
212
 
213
			End If
213
			End If
214
			
214
 
215
			
215
 
216
		Next
216
		Next
217
		
217
 
218
		Response.write "</tr></table>"
218
		Response.write "</tr></table>"
219
	End Sub
219
	End Sub
220
	'-----------------------------------------------------------------------------------------------------------------
220
	'-----------------------------------------------------------------------------------------------------------------
-
 
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
	'-----------------------------------------------------------------------------------------------------------------
221
	Public Sub LoadActionButtons ( aAbtnList, ByRef objOraDatabase )
236
	Public Sub LoadActionButtons ( aAbtnList, ByRef objOraDatabase )
-
 
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
222
		Dim rsQry, query
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
223
		
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
224
		query = _
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
225
		" SELECT "&_
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,_
226
		"        abd.abtn_id,"&_
336
                           "Y",_
227
		"        abd.abtn_name,"&_
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,_
228
		"        abd.text,"&_
349
                           "Y",_
229
		"        abd.action_link,"&_
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,_
230
		"        abd.event_handler,"&_
362
                           "Y",_
231
		"        abd.img_enabled,"&_
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,_
232
		"        abd.img_disabled,"&_
375
                           "Y",_
233
		"        abd.hint,"&_
376
                           "Y",_
234
		"        abd.active,"&_
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",_
235
		"        abd.is_readonly_action "&_
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();""",_
236
		"   FROM DEF_ACTION_BUTTONS abd  WHERE abd.abtn_name IN ('"& Join ( aAbtnList, "','") &"')"
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
237
		
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
238
		Set rsQry = OraDatabase.DbCreateDynaset( query , ORADYN_DEFAULT )
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
239
		
574
 
240
		If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
575
		If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
241
			Call LoadButtons ( rsQry.GetRows() )
576
			Call LoadButtons ( rsQry.GetRows() )
242
			
577
 
243
		End If
578
		End If
244
		
579
 
245
		rsQry.Close
580
		rsQry.Close
246
		Set rsQry = Nothing
581
		Set rsQry = Nothing
247
	End Sub
582
	End Sub
248
	'-----------------------------------------------------------------------------------------------------------------
583
	'-----------------------------------------------------------------------------------------------------------------
249
	Public Sub LoadButtons ( aRows )
584
	Public Sub LoadButtons ( aRows )
250
		Dim nProperty, newArrayDim, LastRow, rowNum
585
		Dim nProperty, newArrayDim, LastRow, rowNum
251
		
586
 
252
		LastRow = UBound( aRows, 2 )
587
		LastRow = UBound( aRows, 2 )
253
		
588
 
254
		For rowNum = 0 To LastRow
589
		For rowNum = 0 To LastRow
255
			' Increase array by 1
590
			' Increase array by 1
256
			newArrayDim = LastRowInx() + 1
591
			newArrayDim = LastRowInx() + 1
257
			ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )
592
			ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )
258
			
593
 
259
			
594
 
260
			mobjNameDefMap.Item ( Cstr( aRows ( InxName, rowNum ) ) ) = newArrayDim
595
			mobjNameDefMap.Item ( Cstr( aRows ( InxName, rowNum ) ) ) = newArrayDim
261
			
596
 
262
			For nProperty = 0 To mLastPropertyInx
597
			For nProperty = 0 To mLastPropertyInx
263
				mArrAbtnDef ( nProperty, newArrayDim ) = aRows ( nProperty, rowNum )
598
				mArrAbtnDef ( nProperty, newArrayDim ) = aRows ( nProperty, rowNum )
264
				
599
 
265
			Next
600
			Next
266
			
601
 
267
		Next
602
		Next
268
		
603
 
269
	End Sub
604
	End Sub
270
	'-----------------------------------------------------------------------------------------------------------------
605
	'-----------------------------------------------------------------------------------------------------------------
271
	Private Function LastRowInx ()
606
	Private Function LastRowInx ()
272
		 LastRowInx = UBound ( mArrAbtnDef, 2 )
607
		 LastRowInx = UBound ( mArrAbtnDef, 2 )
273
	End Function
608
	End Function
Line 323... Line 658...
323
	Private Sub Class_Initialize()
658
	Private Sub Class_Initialize()
324
		'// Perform action on creation of object. e.g. Set myObj = New ThisClassName
659
		'// Perform action on creation of object. e.g. Set myObj = New ThisClassName
325
		Set mobjNameDefMap = CreateObject("Scripting.Dictionary")
660
		Set mobjNameDefMap = CreateObject("Scripting.Dictionary")
326
		Set mobjIdDefMap = CreateObject("Scripting.Dictionary")
661
		Set mobjIdDefMap = CreateObject("Scripting.Dictionary")
327
		Set mobjSeparator = CreateObject("Scripting.Dictionary")
662
		Set mobjSeparator = CreateObject("Scripting.Dictionary")
328
		
663
 
329
		'mbIsReadonly = FALSE	' Tell control that it should use only readonly action buttons (i.e. actions which will not alter database )
664
		'mbIsReadonly = FALSE	' Tell control that it should use only readonly action buttons (i.e. actions which will not alter database )
330
		mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_HIDE		' Tell control what to do by default if mbIsReadonly = TRUE
665
		mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_HIDE		' Tell control what to do by default if mbIsReadonly = TRUE
331
		
666
 
332
		mnButtonSpacer = 0
667
		mnButtonSpacer = 0
333
		mnButtonTextSpace = 4
668
		mnButtonTextSpace = 4
334
		
669
 
335
		mNumOfProperties = 10  	' Number of properties in array which define one menu item.
670
		mNumOfProperties = 10  	' Number of properties in array which define one menu item.
336
		mLastPropertyInx = mNumOfProperties - 1
671
		mLastPropertyInx = mNumOfProperties - 1
337
		
672
 
338
		mbDisableAll = FALSE
673
		mbDisableAll = FALSE
339
		
674
 
340
		ReDim mArrAbtnDef ( mNumOfProperties, -1 )
675
		ReDim mArrAbtnDef ( mNumOfProperties, -1 )
341
		InxID					= 0
676
		InxID					= 0
342
		InxName					= 1
677
		InxName					= 1
343
		InxTxt					= 2
678
		InxTxt					= 2
344
		InxLink					= 3
679
		InxLink					= 3
Line 346... Line 681...
346
		InxImg					= 5
681
		InxImg					= 5
347
		InxImgOff				= 6
682
		InxImgOff				= 6
348
		InxHint					= 7
683
		InxHint					= 7
349
		InxActive				= 8
684
		InxActive				= 8
350
		InxIsReadonlyAction		= 9
685
		InxIsReadonlyAction		= 9
351
		
686
 
352
	End Sub
687
	End Sub
353
	'-----------------------------------------------------------------------------------------------------------------
688
	'-----------------------------------------------------------------------------------------------------------------
354
	Private Sub Class_Terminate()
689
	Private Sub Class_Terminate()
355
		'// Perform action on object disposal. e.g. Set myObj = Nothing
690
		'// Perform action on object disposal. e.g. Set myObj = Nothing
356
		Set mobjNameDefMap = Nothing
691
		Set mobjNameDefMap = Nothing
357
		Set mobjIdDefMap = Nothing
692
		Set mobjIdDefMap = Nothing
358
		Set mobjSeparator = Nothing
693
		Set mobjSeparator = Nothing
359
		
694
 
360
		
695
 
361
	End Sub
696
	End Sub
362
	'-----------------------------------------------------------------------------------------------------------------
697
	'-----------------------------------------------------------------------------------------------------------------
363
End Class
698
End Class
364
%>
-
 
365
699
%>
-
 
700