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