%
'=============================================================
'//
'// Action Button Control
'//
'=============================================================
%>
<%
'--------------- Global Constants ----------------
Const enumABTNCTRL_ON_READONLY_HIDE = 1
Const enumABTNCTRL_ON_READONLY_DISABLE = 2
'-------------------------------------------------
Class ActionButtonControl
Private mArrAbtnDef()
Private mobjNameDefMap ' Item can be accesed by name. Must be unique within one page
Private mobjIdDefMap ' Item can be accesed by id. Must be unique within one page. If NULL, ubound is assigned to it
Private mobjSeparator ' Has a name of item after separator is applied
Private mobjACActionsMap ' Map of buttons to actions from access control
Private mnButtonSpacer
Private mnImageHspace
Private mNumOfProperties
Private mLastPropertyInx
Private mbDisableAll
Private mbIsReadonly
Private mReadonlyActionBehaviour
Private InxID
Private InxName
Private InxTxt
Private InxLink
Private InxEventHandler
Private InxImg
Private InxImgOff
Private InxHint
Private InxVisible
Private InxActive
Private InxIsReadonlyAction
Public Property Let AllActive ( cActive )
If cActive = enumDB_NO Then
mbDisableAll = TRUE
Else
mbDisableAll = FALSE
End If
End Property
Public Property Let ButtonSpacer ( nWidth )
mnButtonSpacer = nWidth
End Property
Public Property Let ImageHspace ( nWidth )
mnImageHspace = nWidth
End Property
Public Property Let IsReadonlyAction ( IsReadonly )
If IsReadonly = enumDB_YES Then
mbIsReadonly = TRUE
ElseIf IsReadonly = enumDB_NO Then
mbIsReadonly = FALSE
Else
mbIsReadonly = IsReadonly
End If
End Property
Public Property Let ReadonlyActionBehaviour ( nEnum )
mReadonlyActionBehaviour = nEnum
End Property
'-----------------------------------------------------------------------------------------------------------------
Public Sub SetRelationship ( sButtonName, sActionName )
Call mobjACActionsMap.Add ( sButtonName, sActionName )
End Sub
'-----------------------------------------------------------------------------------------------------------------
Private Sub SetItemPropertyByIndex ( nInx, nProperty, Value )
If nInx = "" Then Exit Sub ' Exit sub if you don't find defined button
If nProperty = "" OR Value = "" Then Err.Raise 8, "Method SetItemPropertyByIndex", "Empty parameters found. nInx="& nInx &", nProperty="& nProperty &", Value="& Value
mArrAbtnDef ( nProperty, nInx ) = Value
'Response.write "mArrAbtnDef ( "& nProperty &", "& nInx &" ) = "& Value &"
"
End Sub
'-----------------------------------------------------------------------------------------------------------------
Private Function GetItemPropertyByIndex ( nInx, nProperty )
GetItemPropertyByIndex = ""
If nInx = "" Then Exit Function ' Exit sub if you don't find defined button
If nProperty = "" Then Err.Raise 8, "Method GetItemPropertyByIndex", "Empty parameters found. nInx="& nInx &", nProperty="& nProperty
GetItemPropertyByIndex = Cstr(mArrAbtnDef ( nProperty, nInx ))
End Function
'-----------------------------------------------------------------------------------------------------------------
Private Function LastItemInx ()
LastItemInx = UBound ( mArrAbtnDef, 2 )
End Function
'-----------------------------------------------------------------------------------------------------------------
Public Sub AddActionButton ( sItemName, nItemID )
Dim newArrayDim
If InStr( sItemName, " " ) > 0 Then Err.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' cannot have spaces."
If NOT mobjNameDefMap.Exists (CStr( sItemName )) Then
newArrayDim = LastItemInx() + 1
ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )
' Store name
Call SetItemPropertyByIndex ( newArrayDim, InxName, sItemName )
mobjNameDefMap.Add Cstr( sItemName ), CStr( newArrayDim )
If Not IsNull(nItemID) Then
' Store ID
Call SetItemPropertyByIndex ( newArrayDim, InxdbID, nItemID )
mobjIdDefMap.Add Cstr( nItemID ), CStr( newArrayDim )
End If
' Set Defaults
Call SetItemDefaults ( sItemName )
Else
Err.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' has been already defined."
End If
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Sub Render ( aAbtnList, ByRef oAccessControl )
Dim itemInx, itemName, nLastItemInx, btnImage, ButtonStr, ButtonStrDisabled, bIsVisibleAC, bIsActiveAC
Response.write "
"
For Each itemName in aAbtnList
itemInx = mobjNameDefMap.Item (Cstr(itemName))
'-- Define Image
btnImage = "
"
If (mArrAbtnDef( InxImg, itemInx ) <> "") Then
btnImage = "
"
End If
'-- Define Button
ButtonStr = _
""&_
""&_
" | "
'-- Define Disabled Button
ButtonStrDisabled = _
""&_
" "&_
""&_
" | "
'Response.write "HERE("&itemName & mArrAbtnDef( InxVisible, itemInx ) &")"
'-- Get Access Control permissions --
bIsVisibleAC = TRUE
bIsActiveAC = TRUE
If NOT IsNull( oAccessControl ) Then
' Access control object is supplied
If mobjACActionsMap.Exists ( itemName ) Then
' Relationship supplied
bIsVisibleAC = oAccessControl.IsVisible ( mobjACActionsMap.Item( itemName ) )
bIsActiveAC = oAccessControl.IsActive ( mobjACActionsMap.Item( itemName ) )
'Response.write "
" & itemName &":"& bIsVisibleAC &"-"& bIsActiveAC
End If
End If
If ( ( mArrAbtnDef( InxVisible, itemInx ) = enumDB_YES) AND bIsVisibleAC ) _
OR (InStr( itemName, "width=" ) > 0) _
OR (InStr( itemName, "height=" ) > 0) Then
' --- Display if Visible ---
'AND (NOT bIsActiveAC)
'( mbDisableAll OR ( mArrAbtnDef( InxActive, itemInx ) = enumDB_NO ) ) AND ( itemInx <> "" )
'Response.write itemName &":"& mbDisableAll &"-"& Eval( mArrAbtnDef( InxActive, itemInx ) = enumDB_NO ) &"-"& Eval( NOT bIsActiveAC ) &"-"& itemInx &"
"
If ( itemInx <> "" ) AND _
( mbDisableAll OR _
( ( mArrAbtnDef( InxActive, itemInx ) = enumDB_NO ) OR (NOT bIsActiveAC) ) _
) _
Then
'Response.Write "
"&itemName&" is disabled," & itemInx & "," & mbDisableAll & "," & mArrAbtnDef( InxActive, itemInx ) & "," & mArrAbtnDef( InxVisible, itemInx )
' --- Display DISABLED Button Item ---
Response.write ButtonStrDisabled
If mnButtonSpacer > 0 Then
Response.write " | "
End If
Else
' --- Display Action Button Item ---
If ( NOT mbIsReadonly ) OR _
( mbIsReadonly AND mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_YES ) Then
If InStr( itemName, "width=" ) > 0 Then
Response.write " | "
ElseIf InStr( itemName, "height=" ) > 0 Then
Response.write " | "
Else
'/* It is a button, i.e. Display Button */
' Check if button is loaded from Database
If itemInx = "" Then Err.Raise 8, "Method Render", "Definition for item name '"& itemName &"' not found."
Response.write ButtonStr
'Response.Write "
"&itemName&" is enabled"
If mnButtonSpacer > 0 Then
Response.write " | "
End If
End If
ElseIf ( mbIsReadonly AND mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_NO ) Then
If mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_DISABLE Then
Response.write ButtonStrDisabled
End If
End If
End If
End If
' --- Separators added manually using method AddSeparator or AddSeparatorAfter ---
If mobjSeparator.Exists ( Cstr(mArrAbtnDef( InxName, itemInx )) ) Then
Response.write " | "
End If
Next
Response.write "
"
End Sub
'-----------------------------------------------------------------------------------------------------------------
' Return true if required_abtnName is one of the strings in the aAbtnList string array, else return false
Private Function isAbtnRequired (aAbtnList, required_abtnName)
Dim this_abtnName
isAbtnRequired = FALSE
For Each this_abtnName in aAbtnList
If 0 = StrComp(this_abtnName, required_abtnName) Then
isAbtnRequired = TRUE
Exit Function
End If
Next
End Function
'-----------------------------------------------------------------------------------------------------------------
Public Sub LoadActionButtons ( aAbtnList, ByRef objOraDatabase )
' The following code is now used in place of the earlier code to acquire action button records.
'
' This code exploits the fact that in ADO 2.8 onwards, you can create ADO DB record sets
' without a connection to an actual database. So, to rid ourselves of the need for a DEF_ACTION_BUTTONS
' table in the database, we can simply take all of the table's rows and reproduce them here in row
' creation and field assignment statements. The rest of the website code will be ignorant of the fact
' that the data has not come from the actual database.
'
' Complicating factors:
' 1) Some action button fields (action_link and event_handler) are to be EVAL'ed later on when used
' to render the HTML page. This can lead to some very complex looking strings that are difficult to
' understand. EVAL allows things like parRtag_id used in a string to be converted to an actual
' number (in string form) at time of HTML rendering. We have to use EVAL. There is no other option.
'
' 2) The strings from the database must also be represented as VBScript strings in the assignments
' below. This means that where a string needs to have an embedded " char, two such chars must be
' used, and remember about EVAL mentioned above, meaning that sometimes """" has to be used to
' give a single " to the resulting string that pops out from EVAL.
' Remember also that whilst HTML doesn't care whether you use single or double quotes, javascript
' does (it must use single quotes) and VBScript does (it must use double quotes)
'
' Possible Future Roadmap
' 1) Rid the code of ABTN_ID - I dont think we need this field now that we are free of the database
'
'
Dim rsQry
Dim varFields
Dim varValues
' Create the object and configure some of its properties
Set rsQry = Server.CreateObject("ADODB.Recordset")
rsQry.CursorLocation = adUseClient
rsQry.CursorType = adOpenKeyset
rsQry.LockType = adLockOptimistic
' Based upon the original DEF_ACTION_BUTTONS table DDL, define the fields (ie. table columns) being simulated
rsQry.Fields.Append "ABTN_ID", adInteger
rsQry.Fields.Append "ABTN_NAME", adVarChar, 64
rsQry.Fields.Append "TEXT", adVarChar, 128, adFldIsNullable
rsQry.Fields.Append "ACTION_LINK", adVarChar, 512, adFldIsNullable
rsQry.Fields.Append "EVENT_HANDLER", adVarChar, 512, adFldIsNullable
rsQry.Fields.Append "IMG_ENABLED", adVarChar, 128, adFldIsNullable
rsQry.Fields.Append "IMG_DISABLED", adVarChar, 128, adFldIsNullable
rsQry.Fields.Append "HINT", adVarChar, 256, adFldIsNullable
rsQry.Fields.Append "VISIBLE", adChar, 1
rsQry.Fields.Append "ACTIVE", adChar, 1
rsQry.Fields.Append "IS_READONLY_ACTION", adChar, 1
' open the record set for updating
rsQry.Open
' Specify the field order that we are going to use in our row creation statements
varFields = Array("ABTN_ID", "ABTN_NAME", "TEXT",_
"ACTION_LINK",_
"EVENT_HANDLER",_
"IMG_ENABLED",_
"IMG_DISABLED",_
"HINT",_
"VISIBLE",_
"ACTIVE",_
"IS_READONLY_ACTION")
' Add the rows to the record set, but only for buttons specifed in the list supplied by the caller
' Remember, Field Ordering is... ID, name, text, link, event handler, en-img, dis-img, hint, visible, active, is readonly action
If isAbtnRequired(aAbtnList, "btnNewVersion") Then
varValues = Array( 1, "btnNewVersion", null,_
"""form_new_version.asp?""& objPMod.ComposeURL()",_
null,_
"images/abtn_new_version.gif",_
null,_
"Create new version of this package.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnVersionHistory") Then
varValues = Array( 2, "btnVersionHistory", null,_
"""javascript:;""",_
"""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 ) );""""""",_
"images/abtn_version_history.gif",_
null,_
"Show version history of this package.",_
"Y",_
"Y",_
"Y")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnRemovePackage") Then
varValues = Array( 3, "btnRemovePackage", null,_
"""_remove_package.asp?pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
"""onClick=""""return confirmAction('Are you sure you want to remove this package?');""""""",_
"images/abtn_remove_pkg.gif",_
null,_
"Remove the package from this Release.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnMakeRelease") Then
varValues = Array( 4, "btnMakeRelease", null,_
"""_make_released.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
"""onClick=""""return confirmAction('Making this package released will prevent any further changes. \nDo you want to proceed?');""""""",_
"icons/i_make_released.gif",_
"icons/i_make_released_off.gif",_
"Make this package released, so that other packages can use it.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnMakeUnrelease") Then
varValues = Array( 5, "btnMakeUnrelease", null,_
"""_make_unreleased.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
"""onClick=""""return confirmAction('You are going to unrelease this package. \nDo you want to proceed?');""""""",_
"icons/i_make_unreleased.gif",_
"icons/i_make_unreleased_off.gif",_
"Unrelease this package.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnMakePending") Then
varValues = Array( 6, "btnMakePending", null,_
"""_make_pending.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
"""onClick=""""return confirmAction('Making this package pending will prevent any further changes. \nDo you want to proceed?');""""""",_
"icons/i_make_pending.gif",_
"icons/i_make_pending_off.gif",_
"Make this package pending for build/release.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnRejectPackage") Then
varValues = Array( 7, "btnRejectPackage", null,_
"""_make_rejected.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
"""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?');""""""",_
"icons/i_reject_pending.gif",_
"icons/i_reject_pending_off.gif",_
"Reject this package from Pending.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnMoveToView") Then
varValues = Array( 8, "btnMoveToView", null,_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('_wform_change_group.asp?""& objPMod.ComposeURL() &""','MovePackage','resizable=yes,width=600,height=200');""""""",_
"images/abtn_move_package.gif",_
null,_
"Move this package to different Base View (Group).",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnReversionPackage") Then
varValues = Array( 9, "btnReversionPackage", null,_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('_wform_rename_version.asp?rfile=""& ScriptName & objPMod.ComposeURLWithout(""rfile"") &""','ReversionPackage','resizable=yes,width=600,height=200');""""""",_
"images/abtn_rename_version.gif",_
"images/abtn_rename_version_off.gif",_
"Reversion this package.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnStickyNotes") Then
varValues = Array(10, "btnStickyNotes", null,_
"""javascript:;""",_
"""onClick=""""showHideNote();""""""",_
"notemanager/images/note.gif",_
null,_
"Sticky notes",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnObsoletePatch") Then
varValues = Array(11, "btnObsoletePatch", null,_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('_wform_obsolete_patch.asp?rfile=""& ScriptName &""&""& objPMod.ComposeURL() &""','ObsoletePatch','resizable=yes,width=400,height=250');""""""",_
"images/abtn_obsolete_patch.gif",_
"images/abtn_obsolete_patch_off.gif",_
"Make this patch obsolete.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnUnobsoletePatch") Then
varValues = Array(12, "btnUnobsoletePatch", null,_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('_wform_obsolete_patch.asp?action=true&unobsolete=true&rfile=""& ScriptName &""&""& objPMod.ComposeURL() &""','ObsoletePatch','resizable=yes,width=400,height=250');""""""",_
"images/abtn_unobsolete_patch.gif",_
null,_
"Undo patch obsolete.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnApprovePackage") Then
varValues = Array(13, "btnApprovePackage", null,_
"""_make_approved.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
"""onClick=""""return confirmAction('You are about to approve this package for auto-build. \nDo you want to proceed?');""""""",_
"icons/i_submit_build.gif",_
"icons/i_submit_build_off.gif",_
"Make this package released for automated build.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnNewRelease") Then
varValues = Array(14, "btnNewRelease", null,_
"""javascript:go_submit( document.FormName, """"btnNewRelease"""" );""",_
null,_
"images/abtn_new_release.gif",_
"images/abtn_new_release_off.gif",_
"Create new release...",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnEditRelease") Then
varValues = Array(15, "btnEditRelease", null,_
"""javascript:go_submit( document.FormName, """"btnEditRelease"""" );""",_
null,_
"images/abtn_edit.gif",_
"images/abtn_edit_off.gif",_
"Edit selected release details...",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnDestroyRelease") Then
varValues = Array(16, "btnDestroyRelease", null,_
"""javascript:go_submit( document.FormName, """"btnDestroyRelease"""" );""",_
"""onClick=""""return confirmAction('You are about to destroy selected release.\nYou cannot undo this action.\nDo you want to proceed?');""""""",_
"images/abtn_destroy.gif",_
"images/abtn_destroy_off.gif",_
"Destroy selected release...",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnMergeManager") Then
varValues = Array(17, "btnMergeManager", null,_
"""javascript:go_submit( document.FormName, """"btnMergeManager"""" );""",_
null,_
"images/abtn_merge_manager.gif",_
"images/abtn_merge_manager_off.gif",_
"Select two releases to run merge manager...",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnMoveRelease") Then
varValues = Array(18, "btnMoveRelease", null,_
"""javascript:go_submit( document.FormName, """"btnMoveRelease"""" );""",_
null,_
"images/abtn_move_release.gif",_
"images/abtn_move_release_off.gif",_
"Move selected release vertically...",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
' NOTE: I do not think this one is ever used
If isAbtnRequired(aAbtnList, "btnPreviousVersions") Then
varValues = Array(19, "btnPreviousVersions", null,_
"""javascript:;""",_
"""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 ) );""""""",_
"images/abtn_version_history.gif",_
null,_
null,_
"Y",_
"Y",_
"Y")
rsQry.AddNew varFields, varValues
End If
' NOTE: I do not think this one is ever used
If isAbtnRequired(aAbtnList, "btnObsoleteAll") Then
varValues = Array(20, "btnObsoleteAll", null,_
"""javascript:go_submit( document.FormName, """"btnObsoleteAll"""" );ShowProgress();""",_
null,_
null,_
null,_
null,_
"Y",_
"Y",_
"Y")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnNewVersion-MASSREF") Then
varValues = Array(21, "btnNewVersion-MASSREF", null,_
"""form_new_version.asp?rtag_id=""& AssocMASSREFValue &""&pv_id=""& Request(""pv_id"")",_
null,_
"images/abtn_new_version_MassRef.gif",_
null,_
"Create new version of this package in associated MASS REF.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnRecycleBin") Then
varValues = Array(22, "btnRecycleBin", null,_
"""_destroy_package.asp?pv_id=""& pkgInfoHash.Item(""pv_id"") &""&bfile=""& ScriptName &""&pkg_id=""& parPkgId &""&listby=""& parListBy &""""",_
"""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?');""""""",_
"icons/i_destroy_package.gif",_
"i_destroy_package_off",_
null,_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnDeprecation") Then
varValues = Array(23, "btnDeprecation", null,_
"""javascript:;""",_
"""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.'""",_
"images/BombBorder.gif",_
null,_
"Deprecate this package in this release.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnUnDeprecation") Then
varValues = Array(24, "btnUnDeprecation", null,_
"""_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.""",_
"""onClick=""""return confirmAction('You are about to undeprecate package: ""& pkgInfoHash.Item (""pkg_name"") &"". \nDo you want to proceed?');""""""",_
"images/BombBorder.gif",_
null,_
null,_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnAdminView") Then
varValues = Array(25, "btnAdminView", null,_
"""javascript:go_submit( document.FormName, """"btnAdminView"""" );""",_
null,_
"images/view_admin.gif",_
null,_
"Administer the views in the project.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
' NOTE: I do not think this one is ever used
If isAbtnRequired(aAbtnList, "btnAddProc") Then
varValues = Array(26, "btnAddProc", "Add Process",_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('wAddProc.asp?rfile=""& SCRIPT_NAME &""&""& objPMod.ComposeURL() &""','AddProd','scrollbars=yes,resizable=yes,width=800,height=500');""""""",_
"icons/btn_add.gif",_
null,_
null,_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnEditGBE_Machtype") Then
varValues = Array(27, "btnEditGBE_Machtype", null,_
"""javascript:;""",_
"""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');""""""",_
"icons/i_edit.gif",_
"icons/i_edit_off.gif",_
"Edit this GBE MachType value",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnDeleteGBE_Machtype") Then
varValues = Array(28, "btnDeleteGBE_Machtype", null,_
"""_DeleteMachtype.asp?rfile=""& SCRIPT_NAME &""&gbe_id=""& gbe_id &""&""& objPMod.ComposeURL()",_
"""onClick=""""return confirmAction('Remove \'""& GBE_VALUE &""\' from this list?');""""""",_
"icons/i_remove.gif",_
null,_
"Delete this GBE MachType value",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnEditDaemon") Then
varValues = Array(29, "btnEditDaemon", null,_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('wAddDaemon.asp?type=edit&rcon_id=""& rcon_id &""&rfile=""& SCRIPT_NAME &""&""& objPMod.ComposeURL() &""','EditProd','scrollbars=yes,resizable=yes,width=860,height=240');""""""",_
"icons/i_edit.gif",_
"icons/i_edit_off.gif",_
"Edit Daemon",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnDeleteDaemon") Then
varValues = Array(30, "btnDeleteDaemon", null,_
"""_DeleteDaemon.asp?rcon_id=""& rcon_id &""&""& objPMod.ComposeURL()",_
"""onClick=""""return confirmAction('Remove Daemon: \'""& Daemon &""\' from this list?');""""""",_
"icons/i_remove.gif",_
null,_
"Delete Daemon",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnEditBuildMachine") Then
varValues = Array(29, "btnEditBuildMachine", null,_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('wAddBuildMachine.asp?type=edit&bmcon_id=""& bmcon_id &""&rfile=""& SCRIPT_NAME &""&""& objPMod.ComposeURL() &""','EditProd','scrollbars=yes,resizable=yes,width=600,height=330');""""""",_
"icons/i_edit.gif",_
"icons/i_edit_off.gif",_
"Edit Build Machine",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnDeleteBuildMachine") Then
varValues = Array(30, "btnDeleteBuildMachine", null,_
"""_DeleteBuildMachine.asp?rfile=""& SCRIPT_NAME &""&bmcon_id=""& bmcon_id &""&""& objPMod.ComposeURL()",_
"""onClick=""""return confirmAction('Remove Build Machine: \'""& machine_hostname &""\' from this list?');""""""",_
"icons/i_remove.gif",_
null,_
"Delete Build Machine",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnPendingIntegration") Then
varValues = Array(32, "btnPendingIntegration", null,_
"""_modify_product_state.asp?state_id=1&rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
"""onClick=""""return confirmAction('Do you want to proceed to make this product pending for INTEGRATION?');""""""",_
"icons/PendingIntegration.gif",_
null,_
"Make this product pending for Integration.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnPendingTest") Then
varValues = Array(33, "btnPendingTest", null,_
"""_modify_product_state.asp?state_id=2&rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
"""onClick=""""return confirmAction('Do you want to proceed to make this product pending for TEST?');""""""",_
"icons/PendingTest.gif",_
null,_
"Make this product pending for Test.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnPendingDeployment") Then
varValues = Array(34, "btnPendingDeployment", null,_
"""_modify_product_state.asp?state_id=3&rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
"""onClick=""""return confirmAction('Do you want to proceed to make this product pending for DEPLOYMENT?');""""""",_
"icons/PendingDeployment.gif",_
null,_
"Make this product pending for Deployment.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnRejectProduct") Then
varValues = Array(35, "btnRejectProduct", null,_
"""_modify_product_state.asp?state_id=4&rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
"""onClick=""""return confirmAction('Do you want to REJECT this product from DEPLOYMENT?');""""""",_
"icons/i_reject_pending.gif",_
null,_
"Reject this product from Deployment.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnPendingIntegrateAndDeploy") Then
varValues = Array(36, "btnPendingIntegrateAndDeploy", null,_
"""_modify_product_state.asp?state_id=5&rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
"""onClick=""""return confirmAction('Do you want to proceed to make this product pending for INTEGRATION and DEPLOYMENT?');""""""",_
"icons/PendingDeployment.gif",_
null,_
"Make this product pending for Integration and Deployment.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnDeleteSchedule") Then
varValues = Array(37, "btnDeleteSchedule", null,_
"""_DeleteSchedule.asp?scheduled_id=""& scheduled_id &""&""& objPMod.ComposeURL()",_
"""onClick=""""return confirmAction('Remove Schedule from this list?');""""""",_
"icons/i_remove.gif",_
"icons/i_remove_dis.gif",_
"Delete Schedule",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnApproveMerge") Then
varValues = Array(38, "btnApproveMerge", null,_
"""_approve_merge.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id",_
"""onClick=""""return confirmAction('The release will be updated by this merge operation. \nDo you want to proceed?');""""""",_
"icons/i_make_released.gif",_
"icons/i_make_released_off.gif",_
"Approve and carry out the pending merge operation",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnRejectAutobuildPackage") Then
varValues = Array( 39, "btnRejectAutobuildPackage", null,_
"""_make_rejected.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
"""onClick=""""return confirmAction('Rejecting a package already approved for autobuild will set it back to Work-In-Progress. \nDo you want to proceed?');""""""",_
"icons/i_reject_pending.gif",_
"icons/i_reject_pending_off.gif",_
"Unapprove autobuild, move back to Work-In-Progress.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnDeleteDaemonInst") Then
varValues = Array(40, "btnDeleteDaemonInst", null,_
"""_DeleteDaemonInstruction.asp?rfile=""& ScriptName &""&inst_id=""& daemonInstId &""&""& objPMod.ComposeURL()",_
"""onClick=""""return confirmAction('Delete the Daemon Instruction from this list?');""""""",_
"icons/i_remove.gif",_
null,_
"Delete this Daemon Instruction",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnEditDaemonInst") Then
varValues = Array(41, "btnEditDaemonInst", null,_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('wAddDaemonInstruction.asp?edit=true&inst_id=""& daemonInstId & ""&sort="" & parSortOrder & ""&rfile=""& ScriptName &""&""& objPMod.ComposeURL() &""','EditProd','scrollbars=yes,resizable=yes,width=800,height=350');""""""",_
"icons/i_edit.gif",_
"icons/i_edit_off.gif",_
"Edit this Daemon Instruction",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnAddDaemonInstRipplePackage") Then
varValues = Array(42, "btnAddDaemonInstRipplePackage", null,_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('wAddDaemonInstruction.asp?op_code=0"" &""&rfile=""& ScriptName &""&""& objPMod.ComposeURL() &""','EditProd','scrollbars=yes,resizable=yes,width=800,height=350');""""""",_
"images/ripplesquare.gif",_
"images/ripplesquaregrey.gif",_
"Request the Build Daemon to ripple this package version",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnAddDaemonInstTestBuildPackage") Then
varValues = Array(43, "btnAddDaemonInstTestBuildPackage", null,_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('wAddDaemonInstruction.asp?op_code=1"" &""&rfile=""& ScriptName &""&""& objPMod.ComposeURL() &""','EditProd','scrollbars=yes,resizable=yes,width=800,height=350');""""""",_
"images/abtn_test_build.gif",_
"images/abtn_test_build_off.gif",_
"Request the Build Daemon to test build this WIP package version",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnMoveWIPToRelease") Then
varValues = Array( 44, "btnMoveWIPToRelease", null,_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('_wform_move_wip.asp"" &""?rfile=""& ScriptName &""&""& objPMod.ComposeURL() &""','MoveWIP','resizable=yes,width=800,height=400');""""""",_
"images/abtn_move_wip_to_release.gif",_
null,_
"Move this WIP to another release.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnLockPackage") Then
varValues = Array( 45, "btnLockPackage", null,_
"""_s_lock_package.asp?pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
"""onClick=""""return confirmAction('You are going to lock this package. \nDo you want to proceed?');""""""",_
"icons/i_lock.gif",_
"icons/i_lock_off.gif",_
"Lock this package.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnUnLockPackage") Then
varValues = Array( 46, "btnUnLockPackage", null,_
"""_s_unlock_package.asp?pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_
"""onClick=""""return confirmAction('You are going to unlock this package. \nDo you want to proceed?');""""""",_
"icons/i_unlock.gif",_
"icons/i_unlock_off.gif",_
"Unlock this package.",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnEditProjectExtensions") Then
varValues = Array(29, "btnEditProjectExtensions", null,_
"""javascript:;""",_
"""onClick=""""MM_openBrWindow('wAddProjectExtension.asp?type=edit&ext=""& extName &""&rfile=""& SCRIPT_NAME &""&""& objPMod.ComposeURL() &""','EditProd','scrollbars=yes,resizable=yes,width=600,height=430');""""""",_
"icons/i_edit.gif",_
"icons/i_edit_off.gif",_
"Edit Project Extensions",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
If isAbtnRequired(aAbtnList, "btnDeleteProjectExtension") Then
varValues = Array(30, "btnDeleteProjectExtension", null,_
"""_DeleteProjectExtension.asp?rfile=""& SCRIPT_NAME &""&ext=""& extName &""&""& objPMod.ComposeURL()",_
"""onClick=""""return confirmAction('Remove Project Extension: \'""& extName &""\' from this list?');""""""",_
"icons/i_remove.gif",_
null,_
"Delete Project Extension",_
"Y",_
"Y",_
"N")
rsQry.AddNew varFields, varValues
End If
' Move cursor to the first record
rsQry.MoveFirst
If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then
Call LoadButtons ( rsQry.GetRows() )
End If
rsQry.Close
Set rsQry = Nothing
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Sub LoadButtons ( aRows )
Dim nProperty, newArrayDim, LastRow, rowNum
LastRow = UBound( aRows, 2 )
For rowNum = 0 To LastRow
' Increase array by 1
newArrayDim = LastRowInx() + 1
ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )
mobjNameDefMap.Item ( Cstr( aRows ( InxName, rowNum ) ) ) = newArrayDim
For nProperty = 0 To mLastPropertyInx
mArrAbtnDef ( nProperty, newArrayDim ) = aRows ( nProperty, rowNum )
Next
Next
End Sub
'-----------------------------------------------------------------------------------------------------------------
Private Function LastRowInx ()
LastRowInx = UBound ( mArrAbtnDef, 2 )
End Function
'-----------------------------------------------------------------------------------------------------------------
Public Sub AddSeparatorAfter ( sItemName, sSeparatorWidth )
If InStr( sItemName, " " ) > 0 Then Err.Raise 8, "Method AddSeparatorAfter", "Item Name '"& sItemName &"' cannot have spaces."
mobjSeparator.Add (Cstr(sItemName)), CStr(sSeparatorWidth)
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Sub AddSeparator ( sSeparatorWidth )
mobjSeparator.Add ( Cstr(mArrAbtnDef(InxName, LastItemInx())) ), CStr(sSeparatorWidth)
End Sub
'-----------------------------------------------------------------------------------------------------------------
Private Sub SetItemDefaults ( sItemName )
' Additional default setup
Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxActive, enumDB_YES ) ' Default Active = enumDB_YES
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Sub Text ( sItemName, Value )
Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxTxt, Value )
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Sub ItemID ( sItemName, Value )
Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxID, Value )
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Sub Image ( sItemName, Value )
Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImg, Value )
Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImgOff, Value ) ' Default image disable to be the same as image
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Sub ImageOff ( sItemName, Value )
Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxImgOff, Value )
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Sub Link ( sItemName, Value )
Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxLink, Value )
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Sub EventHandler ( sItemName, Value )
Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxEventHandler, Value )
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Sub Hint ( sItemName, Value )
Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxHint, Value )
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Sub Visible ( sItemName, Value )
'Response.write sItemName &"here"& mobjNameDefMap.Item (Cstr(sItemName))
Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxVisible, Value )
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Function IsVisible ( sItemName )
'Response.write sItemName &"here"& mobjNameDefMap.Item (Cstr(sItemName))
IsVisible = GetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxVisible )
End Function
'-----------------------------------------------------------------------------------------------------------------
Public Sub Active ( sItemName, Value )
'Response.write sItemName &"here"& mobjNameDefMap.Item (Cstr(sItemName))
Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxActive, Value )
End Sub
'-----------------------------------------------------------------------------------------------------------------
Public Function IsActive ( sItemName )
IsActive = GetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxActive )
End Function
'-----------------------------------------------------------------------------------------------------------------
Private Sub Class_Initialize()
'// Perform action on creation of object. e.g. Set myObj = New ThisClassName
Set mobjNameDefMap = CreateObject("Scripting.Dictionary")
Set mobjIdDefMap = CreateObject("Scripting.Dictionary")
Set mobjSeparator = CreateObject("Scripting.Dictionary")
Set mobjACActionsMap = CreateObject("Scripting.Dictionary")
'mbIsReadonly = FALSE ' Tell control that it should use only readonly action buttons (i.e. actions which will not alter database )
mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_HIDE ' Tell control what to do by default if mbIsReadonly = TRUE
mnButtonSpacer = 0
mnImageHspace = 4
mNumOfProperties = 11 ' Number of properties in array which define one menu item.
mLastPropertyInx = mNumOfProperties - 1
mbDisableAll = FALSE
ReDim mArrAbtnDef ( mNumOfProperties, -1 )
InxID = 0
InxName = 1
InxTxt = 2
InxLink = 3
InxEventHandler = 4
InxImg = 5
InxImgOff = 6
InxHint = 7
InxVisible = 8
InxActive = 9
InxIsReadonlyAction = 10
End Sub
'-----------------------------------------------------------------------------------------------------------------
Private Sub Class_Terminate()
'// Perform action on object disposal. e.g. Set myObj = Nothing
Set mobjNameDefMap = Nothing
Set mobjIdDefMap = Nothing
Set mobjSeparator = Nothing
Set mobjACActionsMap = Nothing
End Sub
'-----------------------------------------------------------------------------------------------------------------
End Class
%>