Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
129 ghuddy 1
<!-- #INCLUDE FILE="..\common\adovbs.inc" -->
119 ghuddy 2
<%
3
'=============================================================
4
'//
127 ghuddy 5
'//                  Action Button Control
119 ghuddy 6
'//
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
127 ghuddy 16
 
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
21
   Private mobjACActionsMap      ' Map of buttons to actions from access control
22
 
23
   Private mnButtonSpacer
24
   Private mnImageHspace
25
 
26
   Private mNumOfProperties
27
   Private mLastPropertyInx
28
 
29
   Private mbDisableAll
30
 
31
   Private mbIsReadonly
32
   Private mReadonlyActionBehaviour
33
 
34
   Private InxID
35
   Private InxName
36
   Private InxTxt
37
   Private InxLink
38
   Private InxEventHandler
39
   Private InxImg
40
   Private InxImgOff
41
   Private InxHint
42
   Private InxVisible
43
   Private InxActive
44
   Private InxIsReadonlyAction
45
 
46
 
47
   Public Property Let AllActive ( cActive )
48
      If cActive = enumDB_NO Then
49
         mbDisableAll = TRUE
50
      Else
51
         mbDisableAll = FALSE
52
      End If
53
 
54
   End Property
55
 
56
   Public Property Let ButtonSpacer ( nWidth )
57
      mnButtonSpacer = nWidth
58
   End Property
59
 
60
   Public Property Let ImageHspace ( nWidth )
61
      mnImageHspace = nWidth
62
   End Property
63
 
64
   Public Property Let IsReadonlyAction ( IsReadonly )
65
      If IsReadonly = enumDB_YES Then
66
         mbIsReadonly = TRUE
67
 
68
      ElseIf IsReadonly = enumDB_NO Then
69
         mbIsReadonly = FALSE
70
      Else
71
         mbIsReadonly = IsReadonly
72
 
73
      End If
74
 
75
   End Property
76
 
77
   Public Property Let ReadonlyActionBehaviour ( nEnum )
78
      mReadonlyActionBehaviour = nEnum
79
   End Property
80
 
81
   '-----------------------------------------------------------------------------------------------------------------
82
   Public Sub SetRelationship ( sButtonName, sActionName )
83
      Call mobjACActionsMap.Add ( sButtonName, sActionName )
84
   End Sub
85
   '-----------------------------------------------------------------------------------------------------------------
86
   Private Sub SetItemPropertyByIndex ( nInx, nProperty, Value )
87
      If nInx = "" Then Exit Sub   ' Exit sub if you don't find defined button
88
 
89
      If nProperty = ""  OR  Value = "" Then Err.Raise 8, "Method SetItemPropertyByIndex", "Empty parameters found. nInx="& nInx &", nProperty="& nProperty &", Value="& Value
90
 
91
      mArrAbtnDef ( nProperty, nInx ) = Value
92
 
93
      'Response.write "mArrAbtnDef ( "& nProperty &", "& nInx &" ) = "& Value &"<br>"
94
   End Sub
95
   '-----------------------------------------------------------------------------------------------------------------
96
   Private Function LastItemInx ()
97
       LastItemInx = UBound ( mArrAbtnDef, 2 )
98
   End Function
99
   '-----------------------------------------------------------------------------------------------------------------
100
   Public Sub AddActionButton ( sItemName, nItemID )
101
      Dim newArrayDim
102
 
103
      If InStr( sItemName, " " ) > 0 Then   Err.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' cannot have spaces."
104
 
105
 
106
 
107
      If NOT mobjNameDefMap.Exists (CStr( sItemName )) Then
108
 
109
         newArrayDim = LastItemInx() + 1
110
 
111
         ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )
112
 
113
         ' Store name
114
         Call SetItemPropertyByIndex ( newArrayDim, InxName, sItemName )
115
         mobjNameDefMap.Add Cstr( sItemName ), CStr( newArrayDim )
116
 
117
         If Not IsNull(nItemID) Then
118
            ' Store ID
119
            Call SetItemPropertyByIndex ( newArrayDim, InxdbID, nItemID )
120
            mobjIdDefMap.Add Cstr( nItemID ), CStr( newArrayDim )
121
         End If
122
 
123
         ' Set Defaults
124
         Call SetItemDefaults ( sItemName )
125
      Else
126
 
127
         Err.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' has been already defined."
128
 
129
      End If
130
 
131
   End Sub
132
   '-----------------------------------------------------------------------------------------------------------------
133
   Public Sub Render ( aAbtnList, ByRef oAccessControl )
134
      Dim itemInx, itemName, nLastItemInx, btnImage, ButtonStr, ButtonStrDisabled, bIsVisibleAC, bIsActiveAC
135
      Response.write "<table cellpadding='0' cellspacing='0' width='1'><tr>"
136
 
137
      For Each itemName in aAbtnList
138
 
139
         itemInx = mobjNameDefMap.Item (Cstr(itemName))
140
 
141
 
142
         '-- Define Image
143
         btnImage = "<img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle' border='0'>"
144
         If (mArrAbtnDef( InxImg, itemInx ) <> "") Then
145
            btnImage = "<img src='"& mArrAbtnDef( InxImg, itemInx ) &"' hspace='"& mnImageHspace &"' border='0' align='absmiddle'>"
146
         End If
147
 
148
         '-- Define Button
149
         ButtonStr = _
150
            "<td nowrap>"&_
151
            "<a id='"& mArrAbtnDef( InxName, itemInx ) &"' "&_
152
            " name='"& mArrAbtnDef( InxName, itemInx ) &"' href='"& Eval( mArrAbtnDef( InxLink, itemInx ) ) &"' "&_
153
            " "& Eval( mArrAbtnDef( InxEventHandler, itemInx ) ) &" class='menu_link' title='"& mArrAbtnDef( InxHint, itemInx )  &"'>"&_
154
            btnImage & mArrAbtnDef( InxTxt, itemInx ) &"</a>"&_
155
            "</td>"
156
 
157
 
158
         '-- Define Disabled Button
159
         ButtonStrDisabled = _
160
            "<td nowrap>"&_
161
            "<img src='"& mArrAbtnDef( InxImgOff, itemInx ) &"' hspace='"& mnImageHspace &"' border='0' align='absmiddle'>"&_
162
            "<label class='menu_txt'>"& mArrAbtnDef( InxTxt, itemInx ) &"</label>"&_
163
            "</td>"
164
 
165
 
166
         'Response.write "HERE("&itemName & mArrAbtnDef( InxVisible, itemInx ) &")"
167
 
168
 
169
         '-- Get Access Control permissions --
170
         bIsVisibleAC = TRUE
171
         bIsActiveAC = TRUE
172
         If NOT IsNull( oAccessControl ) Then
173
            ' Access control object is supplied
174
 
175
            If mobjACActionsMap.Exists ( itemName ) Then
176
               ' Relationship supplied
177
               bIsVisibleAC = oAccessControl.IsVisible ( mobjACActionsMap.Item( itemName ) )
178
               bIsActiveAC = oAccessControl.IsActive ( mobjACActionsMap.Item( itemName ) )
179
               'Response.write itemName &":"& oAccessControl.IsVisible ( mobjACActionsMap.Item( itemName ) ) &"-"& oAccessControl.IsActive ( mobjACActionsMap.Item( itemName ) )
180
            End If
181
 
182
         End If
183
 
184
 
185
         If (  ( mArrAbtnDef( InxVisible, itemInx ) = enumDB_YES)   AND   bIsVisibleAC   ) _
186
            OR  (InStr( itemName, "width=" ) > 0)  _
187
            OR  (InStr( itemName, "height=" ) > 0) Then
188
 
189
            ' --- Display if Visible ---
190
 
191
            'AND  (NOT bIsActiveAC)
192
            '( mbDisableAll OR (  mArrAbtnDef( InxActive, itemInx ) = enumDB_NO )     )   AND ( itemInx <> "" )
193
            'Response.write itemName &":"& mbDisableAll &"-"& Eval( mArrAbtnDef( InxActive, itemInx ) = enumDB_NO ) &"-"& Eval( NOT bIsActiveAC ) &"-"& itemInx &"<br>"
194
            If  ( itemInx <> "" ) AND _
195
               ( mbDisableAll  OR _
196
                  (  ( mArrAbtnDef( InxActive, itemInx ) = enumDB_NO )  OR  (NOT bIsActiveAC)  ) _
197
               ) _
198
            Then
199
 
200
               ' --- Display DISABLED Button Item ---
201
               Response.write ButtonStrDisabled
202
 
203
               If mnButtonSpacer > 0 Then
204
                  Response.write "<td><img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle'></td>"
205
               End If
206
 
207
 
208
            Else
209
 
210
               ' --- Display Action Button Item ---
211
               If   ( NOT mbIsReadonly )  OR _
212
                     ( mbIsReadonly  AND  mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_YES ) Then
213
 
214
                  If InStr( itemName, "width=" ) > 0 Then
215
 
216
                     Response.write "<td><img src='images/spacer.gif' "& itemName &" height='1' align='absmiddle'></td>"
217
 
218
                  ElseIf InStr( itemName, "height=" ) > 0 Then
219
                     Response.write "<td><img src='images/bg_bage_2.gif' width='1' "& itemName &" align='absmiddle' hspace='4'></td>"
220
 
221
                  Else
222
                     '/* It is a button, i.e. Display Button */
223
 
224
                     ' Check if button is loaded from Database
225
                     If itemInx = "" Then    Err.Raise 8, "Method Render", "Definition for item name '"& itemName &"' not found."
226
 
227
                     Response.write ButtonStr
228
 
229
                     If mnButtonSpacer > 0 Then
230
                        Response.write "<td><img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle'></td>"
231
                     End If
232
 
233
                  End If
234
 
235
 
236
               ElseIf ( mbIsReadonly  AND  mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_NO ) Then
237
 
238
                  If mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_DISABLE Then
239
                     Response.write ButtonStrDisabled
240
                  End If
241
 
242
 
243
               End If
244
 
245
            End If
246
 
247
         End If
248
 
249
 
250
 
251
 
252
         ' --- Separators added manually using  method AddSeparator or AddSeparatorAfter ---
253
         If mobjSeparator.Exists ( Cstr(mArrAbtnDef( InxName, itemInx )) ) Then
254
            Response.write "<td><img src='images/spacer.gif' width='"& mobjSeparator.Item ( Cstr(mArrAbtnDef( InxName, itemInx )) ) &"' height='1'></td>"
255
 
256
         End If
257
 
258
 
259
      Next
260
 
261
      Response.write "</tr></table>"
262
   End Sub
119 ghuddy 263
	'-----------------------------------------------------------------------------------------------------------------
127 ghuddy 264
   ' Return true if required_abtnName is one of the strings in the aAbtnList string array, else return false
265
   Private Function isAbtnRequired (aAbtnList, required_abtnName)
266
      Dim this_abtnName
267
 
268
      isAbtnRequired = FALSE
269
 
270
      For Each this_abtnName in aAbtnList
271
         If 0 = StrComp(this_abtnName, required_abtnName) Then
272
            isAbtnRequired = TRUE
273
            Exit Function
274
         End If
275
      Next
276
   End Function
277
   '-----------------------------------------------------------------------------------------------------------------
278
   Public Sub LoadActionButtons ( aAbtnList, ByRef objOraDatabase )
279
 
280
      ' The following code is now used in place of the earlier code to acquire action button records.
281
      '
282
      ' This code exploits the fact that in ADO 2.8 onwards, you can create ADO DB record sets
283
      ' without a connection to an actual database. So, to rid ourselves of the need for a DEF_ACTION_BUTTONS
284
      ' table in the database, we can simply take all of the table's rows and reproduce them here in row
285
      ' creation and field assignment statements. The rest of the website code will be ignorant of the fact
286
      ' that the data has not come from the actual database.
287
      '
288
      ' Complicating factors:
289
      ' 1) Some action button fields (action_link and event_handler) are to be EVAL'ed later on when used
290
      '    to render the HTML page. This can lead to some very complex looking strings that are difficult to
291
      '    understand. EVAL allows things like parRtag_id used in a string to be converted to an actual
292
      '    number (in string form) at time of HTML rendering. We have to use EVAL. There is no other option.
293
      '
294
      ' 2) The strings from the database must also be represented as VBScript strings in the assignments
295
      '    below. This means that where a string needs to have an embedded " char, two such chars must be
296
      '    used, and remember about EVAL mentioned above, meaning that sometimes """" has to be used to
297
      '    give a single " to the resulting string that pops out from EVAL.
298
      '    Remember also that whilst HTML doesn't care whether you use single or double quotes, javascript
299
      '    does (it must use single quotes) and VBScript does (it must use double quotes)
300
      '
301
      ' Possible Future Roadmap
302
      ' 1) Rid the code of ABTN_ID - I dont think we need this field now that we are free of the database
303
      '
304
      '
305
      Dim rsQry
306
      Dim varFields
307
      Dim varValues
308
 
309
      ' Create the object and configure some of its properties
310
      Set rsQry = Server.CreateObject("ADODB.Recordset")
311
      rsQry.CursorLocation = adUseClient
312
      rsQry.CursorType = adOpenKeyset
313
      rsQry.LockType = adLockOptimistic
314
 
315
      ' Based upon the original DEF_ACTION_BUTTONS table DDL, define the fields (ie. table columns) being simulated
316
      rsQry.Fields.Append "ABTN_ID",               adInteger
317
      rsQry.Fields.Append "ABTN_NAME",             adVarChar,   64
318
      rsQry.Fields.Append "TEXT",                  adVarChar,  128, adFldIsNullable
319
      rsQry.Fields.Append "ACTION_LINK",           adVarChar,  512, adFldIsNullable
320
      rsQry.Fields.Append "EVENT_HANDLER",         adVarChar,  512, adFldIsNullable
321
      rsQry.Fields.Append "IMG_ENABLED",           adVarChar,  128, adFldIsNullable
322
      rsQry.Fields.Append "IMG_DISABLED",          adVarChar,  128, adFldIsNullable
323
      rsQry.Fields.Append "HINT",                  adVarChar,  256, adFldIsNullable
324
      rsQry.Fields.Append "VISIBLE",               adChar,       1
325
      rsQry.Fields.Append "ACTIVE",                adChar,       1
326
      rsQry.Fields.Append "IS_READONLY_ACTION",    adChar,       1
327
 
328
      ' open the record set for updating
329
      rsQry.Open
330
 
331
      ' Specify the field order that we are going to use in our row creation statements
332
      varFields = Array("ABTN_ID", "ABTN_NAME", "TEXT",_
333
                        "ACTION_LINK",_
334
                        "EVENT_HANDLER",_
335
                        "IMG_ENABLED",_
336
                        "IMG_DISABLED",_
337
                        "HINT",_
338
                        "VISIBLE",_
339
                        "ACTIVE",_
340
                        "IS_READONLY_ACTION")
341
 
342
      ' Add the rows to the record set, but only for buttons specifed in the list supplied by the caller
343
 
344
      ' Remember, Field Ordering is... ID, name, text, link, event handler, en-img, dis-img, hint, visible, active, is readonly action
345
 
346
      If isAbtnRequired(aAbtnList, "btnNewVersion") Then
347
         varValues = Array( 1, "btnNewVersion", null,_
348
                           """form_new_version.asp?""& objPMod.ComposeURL()",_
349
                           null,_
350
                           "images/abtn_new_version.gif",_
351
                           null,_
352
                           "Create new version of this package.",_
353
                           "Y",_
354
                           "Y",_
355
                           "N")
356
         rsQry.AddNew varFields, varValues
357
      End If
358
 
359
      If isAbtnRequired(aAbtnList, "btnVersionHistory") Then
360
         varValues = Array( 2, "btnVersionHistory", null,_
361
                           """javascript:;""",_
129 ghuddy 362
                           """onClick=""""MM_openBrWindow('_wform_versions_history_release_notes.asp?OLDpv_id=""& parPv_id &""&pkg_id=""& pkgInfoHash.Item (""pkg_id"") &""&FLpkg_version=*""& pkgInfoHash.Item(""v_ext"") &""&FLuser_name=*&rfile=""& scriptName &""&""& objPMod.ComposeURL() &""#ANC_""& parPv_id &""','History','resizable=yes,scrollbars=yes,width=850,height='+ ( screen.height - 100 )  );""""""",_
127 ghuddy 363
                           "images/abtn_version_history.gif",_
364
                           null,_
365
                           "Show version history of this package.",_
366
                           "Y",_
367
                           "Y",_
368
                           "Y")
369
         rsQry.AddNew varFields, varValues
370
      End If
371
 
372
      If isAbtnRequired(aAbtnList, "btnRemovePackage") Then
373
         varValues = Array( 3, "btnRemovePackage", null,_
374
                           """_remove_package.asp?pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
375
                           """onClick=""""return confirmAction('Are you sure you want to remove this package?');""""""",_
376
                           "images/abtn_remove_pkg.gif",_
377
                           null,_
378
                           "Remove the package from this Release.",_
379
                           "Y",_
380
                           "Y",_
381
                           "N")
382
         rsQry.AddNew varFields, varValues
383
      End If
384
 
385
      If isAbtnRequired(aAbtnList, "btnMakeRelease") Then
386
         varValues = Array( 4, "btnMakeRelease", null,_
387
                           """_make_released.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
388
                           """onClick=""""return confirmAction('Making this package released will prevent any further changes. \nDo you want to proceed?');""""""",_
389
                           "icons/i_make_released.gif",_
390
                           "icons/i_make_released_off.gif",_
391
                           "Make this package released, so that other packages can use it.",_
392
                           "Y",_
393
                           "Y",_
394
                           "N")
395
         rsQry.AddNew varFields, varValues
396
      End If
397
 
398
      If isAbtnRequired(aAbtnList, "btnMakeUnrelease") Then
399
         varValues = Array( 5, "btnMakeUnrelease", null,_
400
                           """_make_unreleased.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
401
                           """onClick=""""return confirmAction('You are going to unrelease this package. \nDo you want to proceed?');""""""",_
402
                           "icons/i_make_unreleased.gif",_
403
                           "icons/i_make_unreleased_off.gif",_
404
                           "Unlock this package.",_
405
                           "Y",_
406
                           "Y",_
407
                           "N")
408
         rsQry.AddNew varFields, varValues
409
      End If
410
 
411
      If isAbtnRequired(aAbtnList, "btnMakePending") Then
412
         varValues = Array( 6, "btnMakePending", null,_
413
                           """_make_pending.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
414
                           """onClick=""""return confirmAction('Making this package pending for auto-build will prevent any further changes. \nDo you want to proceed?');""""""",_
415
                           "icons/i_make_pending.gif",_
416
                           "icons/i_make_pending_off.gif",_
417
                           "Make this package pending for build/release.",_
418
                           "Y",_
419
                           "Y",_
420
                           "N")
421
         rsQry.AddNew varFields, varValues
422
      End If
423
 
424
      If isAbtnRequired(aAbtnList, "btnRejectPackage") Then
425
         varValues = Array( 7, "btnRejectPackage", null,_
426
                           """_make_rejected.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
427
                           """onClick=""""return confirmAction('Rejecting a new package version will move it to Work-In-Progress. Rejecting a merge package version will simply remove it from pending. \nDo you want to proceed?');""""""",_
428
                           "icons/i_reject_pending.gif",_
429
                           "icons/i_reject_pending_off.gif",_
430
                           "Reject this package from Pending.",_
431
                           "Y",_
432
                           "Y",_
433
                           "N")
434
         rsQry.AddNew varFields, varValues
435
      End If
436
 
437
      If isAbtnRequired(aAbtnList, "btnMoveToView") Then
438
         varValues = Array( 8, "btnMoveToView", null,_
439
                           """javascript:;""",_
440
                           """onClick=""""MM_openBrWindow('_wform_change_group.asp?""& objPMod.ComposeURL() &""','MovePackage','resizable=yes,width=400,height=200');""""""",_
441
                           "images/abtn_move_package.gif",_
442
                           null,_
443
                           "Move this package to different Base View (Group).",_
444
                           "Y",_
445
                           "Y",_
446
                           "N")
447
         rsQry.AddNew varFields, varValues
448
      End If
449
 
450
      If isAbtnRequired(aAbtnList, "btnReversionPackage") Then
451
         varValues = Array( 9, "btnReversionPackage", null,_
452
                           """javascript:;""",_
453
                           """onClick=""""MM_openBrWindow('_wform_rename_version.asp?rfile=""& ScriptName & objPMod.ComposeURLWithout(""rfile"") &""','ReversionPackage','resizable=yes,width=600,height=200');""""""",_
454
                           "images/abtn_rename_version.gif",_
455
                           "images/abtn_rename_version_off.gif",_
456
                           "Reversion this package.",_
457
                           "Y",_
458
                           "Y",_
459
                           "N")
460
         rsQry.AddNew varFields, varValues
461
      End If
462
 
463
      If isAbtnRequired(aAbtnList, "btnStickyNotes") Then
464
         varValues = Array(10, "btnStickyNotes", null,_
465
                           """javascript:;""",_
466
                           """onClick=""""showHideNote();""""""",_
467
                           "notemanager/images/note.gif",_
468
                           null,_
469
                           "Sticky notes",_
470
                           "Y",_
471
                           "Y",_
472
                           "N")
473
         rsQry.AddNew varFields, varValues
474
      End If
475
 
476
      If isAbtnRequired(aAbtnList, "btnObsoletePatch") Then
477
         varValues = Array(11, "btnObsoletePatch", null,_
478
                           """javascript:;""",_
479
                           """onClick=""""MM_openBrWindow('_wform_obsolete_patch.asp?rfile=""& ScriptName &""&""& objPMod.ComposeURL() &""','ObsoletePatch','resizable=yes,width=400,height=250');""""""",_
480
                           "images/abtn_obsolete_patch.gif",_
481
                           "images/abtn_obsolete_patch_off.gif",_
482
                           "Make this patch obsolete.",_
483
                           "Y",_
484
                           "Y",_
485
                           "N")
486
         rsQry.AddNew varFields, varValues
487
      End If
488
 
489
      If isAbtnRequired(aAbtnList, "btnUnobsoletePatch") Then
490
         varValues = Array(12, "btnUnobsoletePatch", null,_
491
                           """javascript:;""",_
492
                           """onClick=""""MM_openBrWindow('_wform_obsolete_patch.asp?action=true&unobsolete=true&rfile=""& ScriptName &""&""& objPMod.ComposeURL() &""','ObsoletePatch','resizable=yes,width=400,height=250');""""""",_
493
                           "images/abtn_unobsolete_patch.gif",_
494
                           null,_
495
                           "Undo patch obsolete.",_
496
                           "Y",_
497
                           "Y",_
498
                           "N")
499
         rsQry.AddNew varFields, varValues
500
      End If
501
 
502
      If isAbtnRequired(aAbtnList, "btnApprovePackage") Then
503
         varValues = Array(13, "btnApprovePackage", null,_
504
                           """_make_approved.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
505
                           """onClick=""""return confirmAction('You are about to approve this package for auto-build. \nDo you want to proceed?');""""""",_
506
                           "icons/i_make_released.gif",_
507
                           "icons/i_make_released_off.gif",_
508
                           "Make this package released for automated build.",_
509
                           "Y",_
510
                           "Y",_
511
                           "N")
512
         rsQry.AddNew varFields, varValues
513
      End If
514
 
515
      If isAbtnRequired(aAbtnList, "btnNewRelease") Then
516
         varValues = Array(14, "btnNewRelease", null,_
517
                           """javascript:go_submit( document.FormName, """"btnNewRelease"""" );""",_
518
                           null,_
519
                           "images/abtn_new_release.gif",_
520
                           "images/abtn_new_release_off.gif",_
521
                           "Create new release...",_
522
                           "Y",_
523
                           "Y",_
524
                           "N")
525
         rsQry.AddNew varFields, varValues
526
      End If
527
 
528
      If isAbtnRequired(aAbtnList, "btnEditRelease") Then
529
         varValues = Array(15, "btnEditRelease", null,_
530
                           """javascript:go_submit( document.FormName, """"btnEditRelease"""" );""",_
531
                           null,_
532
                           "images/abtn_edit.gif",_
533
                           "images/abtn_edit_off.gif",_
534
                           "Edit selected release details...",_
535
                           "Y",_
536
                           "Y",_
537
                           "N")
538
         rsQry.AddNew varFields, varValues
539
      End If
540
 
541
      If isAbtnRequired(aAbtnList, "btnDestroyRelease") Then
542
         varValues = Array(16, "btnDestroyRelease", null,_
543
                           """javascript:go_submit( document.FormName, """"btnDestroyRelease"""" );""",_
544
                           """onClick=""""return confirmAction('You are about to destroy selected release.\nYou cannot undo this action.\nDo you want to proceed?');""""""",_
545
                           "images/abtn_destroy.gif",_
546
                           "images/abtn_destroy_off.gif",_
547
                           "Destroy selected release...",_
548
                           "Y",_
549
                           "Y",_
550
                           "N")
551
         rsQry.AddNew varFields, varValues
552
      End If
553
 
554
      If isAbtnRequired(aAbtnList, "btnMergeManager") Then
555
         varValues = Array(17, "btnMergeManager", null,_
556
                           """javascript:go_submit( document.FormName, """"btnMergeManager"""" );""",_
557
                           null,_
558
                           "images/abtn_merge_manager.gif",_
559
                           "images/abtn_merge_manager_off.gif",_
560
                           "Select two releases to run merge manager...",_
561
                           "Y",_
562
                           "Y",_
563
                           "N")
564
         rsQry.AddNew varFields, varValues
565
      End If
566
 
567
      If isAbtnRequired(aAbtnList, "btnMoveRelease") Then
568
         varValues = Array(18, "btnMoveRelease", null,_
569
                           """javascript:go_submit( document.FormName, """"btnMoveRelease"""" );""",_
570
                           null,_
571
                           "images/abtn_move_release.gif",_
572
                           "images/abtn_move_release_off.gif",_
573
                           "Move selected release vertically...",_
574
                           "Y",_
575
                           "Y",_
576
                           "N")
577
         rsQry.AddNew varFields, varValues
578
      End If
579
 
580
      ' NOTE: I do not think this one is ever used
581
      If isAbtnRequired(aAbtnList, "btnPreviousVersions") Then
582
         varValues = Array(19, "btnPreviousVersions", null,_
583
                           """javascript:;""",_
584
                           """onClick=""""MM_openBrWindow('_wform_previous_versions_history_release_notes.asp?OLDpv_id=""& parPv_id &""&pkg_id=""& pkgInfoHash.Item (""pkg_id"") &""&FLpkg_version=*""& pkgInfoHash.Item(""v_ext"") &""&FLuser_name=*&rfile=""& scriptName &""&""& objPMod.ComposeURL() &""#ANC_""& parPv_id &""','Previous Versions','resizable=yes,width=850,height='+ ( screen.height - 100 )  );""""""",_
585
                           "images/abtn_version_history.gif",_
586
                           null,_
587
                           null,_
588
                           "Y",_
589
                           "Y",_
590
                           "Y")
591
         rsQry.AddNew varFields, varValues
592
      End If
593
 
594
      ' NOTE: I do not think this one is ever used
595
      If isAbtnRequired(aAbtnList, "btnObsoleteAll") Then
596
         varValues = Array(20, "btnObsoleteAll", null,_
597
                           """javascript:go_submit( document.FormName, """"btnObsoleteAll"""" );ShowProgress();""",_
598
                           null,_
599
                           null,_
600
                           null,_
601
                           null,_
602
                           "Y",_
603
                           "Y",_
604
                           "Y")
605
         rsQry.AddNew varFields, varValues
606
      End If
607
 
608
      If isAbtnRequired(aAbtnList, "btnNewVersion-MASSREF") Then
609
         varValues = Array(21, "btnNewVersion-MASSREF", null,_
610
                           """form_new_version.asp?rtag_id=""& AssocMASSREFValue &""&pv_id=""& Request(""pv_id"")",_
611
                           null,_
612
                           "images/abtn_new_version_MassRef.gif",_
613
                           null,_
614
                           "Create new version of this package in associated MASS REF.",_
615
                           "Y",_
616
                           "Y",_
617
                           "N")
618
         rsQry.AddNew varFields, varValues
619
      End If
620
 
621
      If isAbtnRequired(aAbtnList, "btnRecycleBin") Then
622
         varValues = Array(22, "btnRecycleBin", null,_
623
                           """_destroy_package.asp?pv_id=""& pkgInfoHash.Item(""pv_id"") &""&bfile=""& ScriptName &""&pkg_id=""& parPkgId &""&listby=""& parListBy &""""",_
624
                           """onClick=""""return confirmAction('You are about to destroy ""& pkgInfoHash.Item (""pkg_name"") &"" ""& pkgInfoHash.Item (""pkg_version"") &"". You cannot undo this operation.\nDo you want to proceed?');""""""",_
625
                           "icons/i_destroy_package.gif",_
626
                           "i_destroy_package_off",_
627
                           null,_
628
                           "Y",_
629
                           "Y",_
630
                           "N")
631
         rsQry.AddNew varFields, varValues
632
      End If
633
 
634
      If isAbtnRequired(aAbtnList, "btnDeprecation") Then
635
         varValues = Array(23, "btnDeprecation", null,_
636
                           """javascript:;""",_
637
                           """onClick='MM_openBrWindow(""""_wform_deprecate_package.asp?rfile=""& scriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id &"""""",""""DeprecatePackage"""",""""resizable=yes,width=600,height=300"""")' class='body_txt' title='Deprecate the package.'""",_
638
                           "images/BombBorder.gif",_
639
                           null,_
640
                           "Deprecate this package in this release.",_
641
                           "Y",_
642
                           "Y",_
643
                           "N")
644
         rsQry.AddNew varFields, varValues
645
      End If
646
 
647
      If isAbtnRequired(aAbtnList, "btnUnDeprecation") Then
648
         varValues = Array(24, "btnUnDeprecation", null,_
649
                           """_wform_undeprecate_package.asp?rfile=""& scriptName &""&pkg_id=""& pkgInfoHash.Item(""pkg_id"") &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id &""' class='body_txt' title='Undeprecate the package.""",_
650
                           """onClick=""""return confirmAction('You are about to undeprecate package: ""& pkgInfoHash.Item (""pkg_name"") &"". \nDo you want to proceed?');""""""",_
651
                           "images/BombBorder.gif",_
652
                           null,_
653
                           null,_
654
                           "Y",_
655
                           "Y",_
656
                           "N")
657
         rsQry.AddNew varFields, varValues
658
      End If
659
 
660
      If isAbtnRequired(aAbtnList, "btnAdminView") Then
661
         varValues = Array(25, "btnAdminView", null,_
662
                           """javascript:go_submit( document.FormName, """"btnAdminView"""" );""",_
663
                           null,_
664
                           "images/view_admin.gif",_
665
                           null,_
666
                           "Administer the views in the project.",_
667
                           "Y",_
668
                           "Y",_
669
                           "N")
670
         rsQry.AddNew varFields, varValues
671
      End If
672
 
673
      ' NOTE: I do not think this one is ever used
674
      If isAbtnRequired(aAbtnList, "btnAddProc") Then
675
         varValues = Array(26, "btnAddProc", "Add Process",_
676
                           """javascript:;""",_
677
                           """onClick=""""MM_openBrWindow('wAddProc.asp?rfile=""& SCRIPT_NAME &""&""& objPMod.ComposeURL() &""','AddProd','scrollbars=yes,resizable=yes,width=800,height=500');""""""",_
678
                           "icons/btn_add.gif",_
679
                           null,_
680
                           null,_
681
                           "Y",_
682
                           "Y",_
683
                           "N")
684
         rsQry.AddNew varFields, varValues
685
      End If
686
 
687
      If isAbtnRequired(aAbtnList, "btnEditGBE_Machtype") Then
688
         varValues = Array(27, "btnEditGBE_Machtype", null,_
689
                           """javascript:;""",_
690
                           """onClick=""""MM_openBrWindow('wAddMachtype.asp?type=edit&gbe_id=""& gbe_id &""&rfile=""& SCRIPT_NAME &""&""& objPMod.ComposeURL() &""','EditProd','scrollbars=yes,resizable=yes,width=600,height=220');""""""",_
691
                           "icons/i_edit.gif",_
692
                           "icons/i_edit_off.gif",_
693
                           "Edit this GBE MachType value",_
694
                           "Y",_
695
                           "Y",_
696
                           "N")
697
         rsQry.AddNew varFields, varValues
698
      End If
699
 
700
      If isAbtnRequired(aAbtnList, "btnDeleteGBE_Machtype") Then
701
         varValues = Array(28, "btnDeleteGBE_Machtype", null,_
702
                           """_DeleteMachtype.asp?rfile=""& SCRIPT_NAME &""&gbe_id=""& gbe_id &""&""& objPMod.ComposeURL()",_
703
                           """onClick=""""return confirmAction('Remove \'""& GBE_VALUE &""\' from this list?');""""""",_
704
                           "icons/i_remove.gif",_
705
                           null,_
706
                           "Delete this GBE MachType value",_
707
                           "Y",_
708
                           "Y",_
709
                           "N")
710
         rsQry.AddNew varFields, varValues
711
      End If
712
 
713
      If isAbtnRequired(aAbtnList, "btnEditDaemon") Then
714
         varValues = Array(29, "btnEditDaemon", null,_
715
                           """javascript:;""",_
716
                           """onClick=""""MM_openBrWindow('wAddDaemon.asp?type=edit&rcon_id=""& rcon_id &""&rfile=""& SCRIPT_NAME &""&""& objPMod.ComposeURL() &""','EditProd','scrollbars=yes,resizable=yes,width=600,height=220');""""""",_
717
                           "icons/i_edit.gif",_
718
                           "icons/i_edit_off.gif",_
719
                           "Edit Daemon",_
720
                           "Y",_
721
                           "Y",_
722
                           "N")
723
         rsQry.AddNew varFields, varValues
724
      End If
725
 
726
      If isAbtnRequired(aAbtnList, "btnDeleteDaemon") Then
727
         varValues = Array(30, "btnDeleteDaemon", null,_
728
                           """_DeleteDaemon.asp?rcon_id=""& rcon_id &""&""& objPMod.ComposeURL()",_
729
                           """onClick=""""return confirmAction('Remove Daemon:  \'""& Daemon &""\' from this list?');""""""",_
730
                           "icons/i_remove.gif",_
731
                           null,_
732
                           "Delete Daemon",_
733
                           "Y",_
734
                           "Y",_
735
                           "N")
736
         rsQry.AddNew varFields, varValues
737
      End If
738
 
739
      If isAbtnRequired(aAbtnList, "btnPendingIntegration") Then
740
         varValues = Array(32, "btnPendingIntegration", null,_
741
                           """_modify_product_state.asp?state_id=1&rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
742
                           """onClick=""""return confirmAction('Do you want to proceed to make this product pending for INTEGRATION?');""""""",_
743
                           "icons/PendingIntegration.gif",_
744
                           null,_
745
                           "Make this product pending for Integration.",_
746
                           "Y",_
747
                           "Y",_
748
                           "N")
749
         rsQry.AddNew varFields, varValues
750
      End If
751
 
752
      If isAbtnRequired(aAbtnList, "btnPendingTest") Then
753
         varValues = Array(33, "btnPendingTest", null,_
754
                           """_modify_product_state.asp?state_id=2&rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
755
                           """onClick=""""return confirmAction('Do you want to proceed to make this product pending for TEST?');""""""",_
756
                           "icons/PendingTest.gif",_
757
                           null,_
758
                           "Make this product pending for Test.",_
759
                           "Y",_
760
                           "Y",_
761
                           "N")
762
         rsQry.AddNew varFields, varValues
763
      End If
764
 
765
      If isAbtnRequired(aAbtnList, "btnPendingDeployment") Then
766
         varValues = Array(34, "btnPendingDeployment", null,_
767
                           """_modify_product_state.asp?state_id=3&rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
768
                           """onClick=""""return confirmAction('Do you want to proceed to make this product pending for DEPLOYMENT?');""""""",_
769
                           "icons/PendingDeployment.gif",_
770
                           null,_
771
                           "Make this product pending for Deployment.",_
772
                           "Y",_
773
                           "Y",_
774
                           "N")
775
         rsQry.AddNew varFields, varValues
776
      End If
777
 
778
      If isAbtnRequired(aAbtnList, "btnRejectProduct") Then
779
         varValues = Array(35, "btnRejectProduct", null,_
780
                           """_modify_product_state.asp?state_id=4&rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
781
                           """onClick=""""return confirmAction('Do you want to REJECT this product from DEPLOYMENT?');""""""",_
782
                           "icons/i_reject_pending.gif",_
783
                           null,_
784
                           "Reject this product from Deployment.",_
785
                           "Y",_
786
                           "Y",_
787
                           "N")
788
         rsQry.AddNew varFields, varValues
789
      End If
790
 
791
      If isAbtnRequired(aAbtnList, "btnPendingIntegrateAndDeploy") Then
792
         varValues = Array(36, "btnPendingIntegrateAndDeploy", null,_
793
                           """_modify_product_state.asp?state_id=5&rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
794
                           """onClick=""""return confirmAction('Do you want to proceed to make this product pending for INTEGRATION and DEPLOYMENT?');""""""",_
795
                           "icons/PendingDeployment.gif",_
796
                           null,_
797
                           "Make this product pending for Integration and Deployment.",_
798
                           "Y",_
799
                           "Y",_
800
                           "N")
801
         rsQry.AddNew varFields, varValues
802
      End If
803
 
804
      If isAbtnRequired(aAbtnList, "btnDeleteSchedule") Then
805
         varValues = Array(37, "btnDeleteSchedule", null,_
806
                           """_DeleteSchedule.asp?scheduled_id=""& scheduled_id &""&""& objPMod.ComposeURL()",_
807
                           """onClick=""""return confirmAction('Remove Schedule from this list?');""""""",_
808
                           "icons/i_remove.gif",_
809
                           null,_
810
                           "Delete Schedule",_
811
                           "Y",_
812
                           "Y",_
813
                           "N")
814
         rsQry.AddNew varFields, varValues
815
      End If
816
 
817
      If isAbtnRequired(aAbtnList, "btnApproveMerge") Then
818
         varValues = Array(38, "btnApproveMerge", null,_
819
                           """_approve_merge.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
820
                           """onClick=""""return confirmAction('The release will be updated by this merge operation. \nDo you want to proceed?');""""""",_
821
                           "icons/i_make_released.gif",_
822
                           "icons/i_make_released_off.gif",_
823
                           "Approve and carry out the pending merge operation",_
824
                           "Y",_
825
                           "Y",_
826
                           "N")
827
         rsQry.AddNew varFields, varValues
828
      End If
829
 
830
      ' Move cursor to the first record
831
      rsQry.MoveFirst
832
 
833
      If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
834
         Call LoadButtons ( rsQry.GetRows() )
835
      End If
836
 
837
      rsQry.Close
838
      Set rsQry = Nothing
839
   End Sub
840
   '-----------------------------------------------------------------------------------------------------------------
841
   Public Sub LoadButtons ( aRows )
842
      Dim nProperty, newArrayDim, LastRow, rowNum
843
 
844
      LastRow = UBound( aRows, 2 )
845
 
846
      For rowNum = 0 To LastRow
847
         ' Increase array by 1
848
         newArrayDim = LastRowInx() + 1
849
         ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )
850
 
851
 
852
         mobjNameDefMap.Item ( Cstr( aRows ( InxName, rowNum ) ) ) = newArrayDim
853
 
854
         For nProperty = 0 To mLastPropertyInx
855
            mArrAbtnDef ( nProperty, newArrayDim ) = aRows ( nProperty, rowNum )
856
 
857
         Next
858
 
859
      Next
860
 
861
   End Sub
862
   '-----------------------------------------------------------------------------------------------------------------
863
   Private Function LastRowInx ()
864
       LastRowInx = UBound ( mArrAbtnDef, 2 )
865
   End Function
866
   '-----------------------------------------------------------------------------------------------------------------
867
   Public Sub AddSeparatorAfter ( sItemName, sSeparatorWidth )
868
      If InStr( sItemName, " " ) > 0 Then   Err.Raise 8, "Method AddSeparatorAfter", "Item Name '"& sItemName &"' cannot have spaces."
869
      mobjSeparator.Add (Cstr(sItemName)), CStr(sSeparatorWidth)
870
   End Sub
871
   '-----------------------------------------------------------------------------------------------------------------
872
   Public Sub AddSeparator ( sSeparatorWidth )
873
      mobjSeparator.Add ( Cstr(mArrAbtnDef(InxName, LastItemInx())) ), CStr(sSeparatorWidth)
874
   End Sub
875
   '-----------------------------------------------------------------------------------------------------------------
876
   Private Sub SetItemDefaults ( sItemName )
877
      ' Additional default setup
878
      Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxActive, enumDB_YES )         ' Default Active = enumDB_YES
879
   End Sub
880
   '-----------------------------------------------------------------------------------------------------------------
881
   Public Sub Text ( sItemName, Value )
882
      Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxTxt, Value )
883
   End Sub
884
   '-----------------------------------------------------------------------------------------------------------------
885
   Public Sub ItemID ( sItemName, Value )
886
      Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxID, Value )
887
   End Sub
888
   '-----------------------------------------------------------------------------------------------------------------
889
   Public Sub Image ( sItemName, Value )
890
      Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImg, Value )
891
      Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImgOff, Value )         ' Default image disable to be the same as image
892
   End Sub
893
   '-----------------------------------------------------------------------------------------------------------------
894
   Public Sub ImageOff ( sItemName, Value )
895
      Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImgOff, Value )
896
   End Sub
897
   '-----------------------------------------------------------------------------------------------------------------
898
   Public Sub Link ( sItemName, Value )
899
      Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxLink, Value )
900
   End Sub
901
   '-----------------------------------------------------------------------------------------------------------------
902
   Public Sub EventHandler ( sItemName, Value )
903
      Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxEventHandler, Value )
904
   End Sub
905
   '-----------------------------------------------------------------------------------------------------------------
906
   Public Sub Hint ( sItemName, Value )
907
      Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxHint, Value )
908
   End Sub
909
   '-----------------------------------------------------------------------------------------------------------------
910
   Public Sub Visible ( sItemName, Value )
911
      'Response.write sItemName &"here"& mobjNameDefMap.Item (Cstr(sItemName))
912
      Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxVisible, Value )
913
   End Sub
914
   '-----------------------------------------------------------------------------------------------------------------
915
   Public Sub Active ( sItemName, Value )
916
      'Response.write sItemName &"here"& mobjNameDefMap.Item (Cstr(sItemName))
917
      Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxActive, Value )
918
   End Sub
919
   '-----------------------------------------------------------------------------------------------------------------
920
   Private Sub Class_Initialize()
921
      '// Perform action on creation of object. e.g. Set myObj = New ThisClassName
922
      Set mobjNameDefMap = CreateObject("Scripting.Dictionary")
923
      Set mobjIdDefMap = CreateObject("Scripting.Dictionary")
924
      Set mobjSeparator = CreateObject("Scripting.Dictionary")
925
      Set mobjACActionsMap = CreateObject("Scripting.Dictionary")
926
 
927
      'mbIsReadonly = FALSE   ' Tell control that it should use only readonly action buttons (i.e. actions which will not alter database )
928
      mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_HIDE      ' Tell control what to do by default if mbIsReadonly = TRUE
929
 
930
      mnButtonSpacer = 0
931
      mnImageHspace = 4
932
 
933
      mNumOfProperties = 11     ' Number of properties in array which define one menu item.
934
      mLastPropertyInx = mNumOfProperties - 1
935
 
936
      mbDisableAll = FALSE
937
 
938
      ReDim mArrAbtnDef ( mNumOfProperties, -1 )
939
      InxID                = 0
940
      InxName               = 1
941
      InxTxt               = 2
942
      InxLink               = 3
943
      InxEventHandler      = 4
944
      InxImg               = 5
945
      InxImgOff            = 6
946
      InxHint               = 7
947
      InxVisible            = 8
948
      InxActive            = 9
949
      InxIsReadonlyAction      = 10
950
 
951
   End Sub
952
   '-----------------------------------------------------------------------------------------------------------------
953
   Private Sub Class_Terminate()
954
      '// Perform action on object disposal. e.g. Set myObj = Nothing
955
      Set mobjNameDefMap = Nothing
956
      Set mobjIdDefMap = Nothing
957
      Set mobjSeparator = Nothing
958
      Set mobjACActionsMap = Nothing
959
 
960
 
961
   End Sub
962
   '-----------------------------------------------------------------------------------------------------------------
119 ghuddy 963
End Class
127 ghuddy 964
%>