Rev 127 | Blame | Last modification | View Log | RSS feed
<!-- #INCLUDE FILE="..\common\adovbs.inc" --><%'============================================================='//'// Action Button Control'//'=============================================================%><%'--------------- Global Constants ----------------Const enumABTNCTRL_ON_READONLY_HIDE = 1Const enumABTNCTRL_ON_READONLY_DISABLE = 2'-------------------------------------------------Class ActionButtonControlPrivate mArrAbtnDef()Private mobjNameDefMap ' Item can be accesed by name. Must be unique within one pagePrivate mobjIdDefMap ' Item can be accesed by id. Must be unique within one page. If NULL, ubound is assigned to itPrivate mobjSeparator ' Has a name of item after separator is appliedPrivate mobjACActionsMap ' Map of buttons to actions from access controlPrivate mnButtonSpacerPrivate mnImageHspacePrivate mNumOfPropertiesPrivate mLastPropertyInxPrivate mbDisableAllPrivate mbIsReadonlyPrivate mReadonlyActionBehaviourPrivate InxIDPrivate InxNamePrivate InxTxtPrivate InxLinkPrivate InxEventHandlerPrivate InxImgPrivate InxImgOffPrivate InxHintPrivate InxVisiblePrivate InxActivePrivate InxIsReadonlyActionPublic Property Let AllActive ( cActive )If cActive = enumDB_NO ThenmbDisableAll = TRUEElsembDisableAll = FALSEEnd IfEnd PropertyPublic Property Let ButtonSpacer ( nWidth )mnButtonSpacer = nWidthEnd PropertyPublic Property Let ImageHspace ( nWidth )mnImageHspace = nWidthEnd PropertyPublic Property Let IsReadonlyAction ( IsReadonly )If IsReadonly = enumDB_YES ThenmbIsReadonly = TRUEElseIf IsReadonly = enumDB_NO ThenmbIsReadonly = FALSEElsembIsReadonly = IsReadonlyEnd IfEnd PropertyPublic Property Let ReadonlyActionBehaviour ( nEnum )mReadonlyActionBehaviour = nEnumEnd 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 buttonIf nProperty = "" OR Value = "" Then Err.Raise 8, "Method SetItemPropertyByIndex", "Empty parameters found. nInx="& nInx &", nProperty="& nProperty &", Value="& ValuemArrAbtnDef ( nProperty, nInx ) = Value'Response.write "mArrAbtnDef ( "& nProperty &", "& nInx &" ) = "& Value &"<br>"End Sub'-----------------------------------------------------------------------------------------------------------------Private Function LastItemInx ()LastItemInx = UBound ( mArrAbtnDef, 2 )End Function'-----------------------------------------------------------------------------------------------------------------Public Sub AddActionButton ( sItemName, nItemID )Dim newArrayDimIf InStr( sItemName, " " ) > 0 Then Err.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' cannot have spaces."If NOT mobjNameDefMap.Exists (CStr( sItemName )) ThennewArrayDim = LastItemInx() + 1ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )' Store nameCall SetItemPropertyByIndex ( newArrayDim, InxName, sItemName )mobjNameDefMap.Add Cstr( sItemName ), CStr( newArrayDim )If Not IsNull(nItemID) Then' Store IDCall SetItemPropertyByIndex ( newArrayDim, InxdbID, nItemID )mobjIdDefMap.Add Cstr( nItemID ), CStr( newArrayDim )End If' Set DefaultsCall SetItemDefaults ( sItemName )ElseErr.Raise 8, "Method AddActionButton", "Item Name '"& sItemName &"' has been already defined."End IfEnd Sub'-----------------------------------------------------------------------------------------------------------------Public Sub Render ( aAbtnList, ByRef oAccessControl )Dim itemInx, itemName, nLastItemInx, btnImage, ButtonStr, ButtonStrDisabled, bIsVisibleAC, bIsActiveACResponse.write "<table cellpadding='0' cellspacing='0' width='1'><tr>"For Each itemName in aAbtnListitemInx = mobjNameDefMap.Item (Cstr(itemName))'-- Define ImagebtnImage = "<img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle' border='0'>"If (mArrAbtnDef( InxImg, itemInx ) <> "") ThenbtnImage = "<img src='"& mArrAbtnDef( InxImg, itemInx ) &"' hspace='"& mnImageHspace &"' border='0' align='absmiddle'>"End If'-- Define ButtonButtonStr = _"<td nowrap>"&_"<a id='"& mArrAbtnDef( InxName, itemInx ) &"' "&_" name='"& mArrAbtnDef( InxName, itemInx ) &"' href='"& Eval( mArrAbtnDef( InxLink, itemInx ) ) &"' "&_" "& Eval( mArrAbtnDef( InxEventHandler, itemInx ) ) &" class='menu_link' title='"& mArrAbtnDef( InxHint, itemInx ) &"'>"&_btnImage & mArrAbtnDef( InxTxt, itemInx ) &"</a>"&_"</td>"'-- Define Disabled ButtonButtonStrDisabled = _"<td nowrap>"&_"<img src='"& mArrAbtnDef( InxImgOff, itemInx ) &"' hspace='"& mnImageHspace &"' border='0' align='absmiddle'>"&_"<label class='menu_txt'>"& mArrAbtnDef( InxTxt, itemInx ) &"</label>"&_"</td>"'Response.write "HERE("&itemName & mArrAbtnDef( InxVisible, itemInx ) &")"'-- Get Access Control permissions --bIsVisibleAC = TRUEbIsActiveAC = TRUEIf NOT IsNull( oAccessControl ) Then' Access control object is suppliedIf mobjACActionsMap.Exists ( itemName ) Then' Relationship suppliedbIsVisibleAC = oAccessControl.IsVisible ( mobjACActionsMap.Item( itemName ) )bIsActiveAC = oAccessControl.IsActive ( mobjACActionsMap.Item( itemName ) )'Response.write itemName &":"& oAccessControl.IsVisible ( mobjACActionsMap.Item( itemName ) ) &"-"& oAccessControl.IsActive ( mobjACActionsMap.Item( itemName ) )End IfEnd IfIf ( ( 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 &"<br>"If ( itemInx <> "" ) AND _( mbDisableAll OR _( ( mArrAbtnDef( InxActive, itemInx ) = enumDB_NO ) OR (NOT bIsActiveAC) ) _) _Then' --- Display DISABLED Button Item ---Response.write ButtonStrDisabledIf mnButtonSpacer > 0 ThenResponse.write "<td><img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle'></td>"End IfElse' --- Display Action Button Item ---If ( NOT mbIsReadonly ) OR _( mbIsReadonly AND mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_YES ) ThenIf InStr( itemName, "width=" ) > 0 ThenResponse.write "<td><img src='images/spacer.gif' "& itemName &" height='1' align='absmiddle'></td>"ElseIf InStr( itemName, "height=" ) > 0 ThenResponse.write "<td><img src='images/bg_bage_2.gif' width='1' "& itemName &" align='absmiddle' hspace='4'></td>"Else'/* It is a button, i.e. Display Button */' Check if button is loaded from DatabaseIf itemInx = "" Then Err.Raise 8, "Method Render", "Definition for item name '"& itemName &"' not found."Response.write ButtonStrIf mnButtonSpacer > 0 ThenResponse.write "<td><img src='images/spacer.gif' width='"& mnButtonSpacer &"' height='1' align='absmiddle'></td>"End IfEnd IfElseIf ( mbIsReadonly AND mArrAbtnDef( InxIsReadonlyAction, itemInx ) = enumDB_NO ) ThenIf mReadonlyActionBehaviour = enumABTNCTRL_ON_READONLY_DISABLE ThenResponse.write ButtonStrDisabledEnd IfEnd IfEnd IfEnd If' --- Separators added manually using method AddSeparator or AddSeparatorAfter ---If mobjSeparator.Exists ( Cstr(mArrAbtnDef( InxName, itemInx )) ) ThenResponse.write "<td><img src='images/spacer.gif' width='"& mobjSeparator.Item ( Cstr(mArrAbtnDef( InxName, itemInx )) ) &"' height='1'></td>"End IfNextResponse.write "</tr></table>"End Sub'-----------------------------------------------------------------------------------------------------------------' Return true if required_abtnName is one of the strings in the aAbtnList string array, else return falsePrivate Function isAbtnRequired (aAbtnList, required_abtnName)Dim this_abtnNameisAbtnRequired = FALSEFor Each this_abtnName in aAbtnListIf 0 = StrComp(this_abtnName, required_abtnName) ThenisAbtnRequired = TRUEExit FunctionEnd IfNextEnd 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 rsQryDim varFieldsDim varValues' Create the object and configure some of its propertiesSet rsQry = Server.CreateObject("ADODB.Recordset")rsQry.CursorLocation = adUseClientrsQry.CursorType = adOpenKeysetrsQry.LockType = adLockOptimistic' Based upon the original DEF_ACTION_BUTTONS table DDL, define the fields (ie. table columns) being simulatedrsQry.Fields.Append "ABTN_ID", adIntegerrsQry.Fields.Append "ABTN_NAME", adVarChar, 64rsQry.Fields.Append "TEXT", adVarChar, 128, adFldIsNullablersQry.Fields.Append "ACTION_LINK", adVarChar, 512, adFldIsNullablersQry.Fields.Append "EVENT_HANDLER", adVarChar, 512, adFldIsNullablersQry.Fields.Append "IMG_ENABLED", adVarChar, 128, adFldIsNullablersQry.Fields.Append "IMG_DISABLED", adVarChar, 128, adFldIsNullablersQry.Fields.Append "HINT", adVarChar, 256, adFldIsNullablersQry.Fields.Append "VISIBLE", adChar, 1rsQry.Fields.Append "ACTIVE", adChar, 1rsQry.Fields.Append "IS_READONLY_ACTION", adChar, 1' open the record set for updatingrsQry.Open' Specify the field order that we are going to use in our row creation statementsvarFields = 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 actionIf isAbtnRequired(aAbtnList, "btnNewVersion") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnVersionHistory") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnRemovePackage") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnMakeRelease") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnMakeUnrelease") ThenvarValues = 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",_"Unlock this package.",_"Y",_"Y",_"N")rsQry.AddNew varFields, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnMakePending") ThenvarValues = Array( 6, "btnMakePending", null,_"""_make_pending.asp?rfile=""& ScriptName &""&pv_id=""& parPv_id &""&rtag_id=""& parRtag_id ",_"""onClick=""""return confirmAction('Making this package pending for auto-build 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnRejectPackage") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnMoveToView") ThenvarValues = Array( 8, "btnMoveToView", null,_"""javascript:;""",_"""onClick=""""MM_openBrWindow('_wform_change_group.asp?""& objPMod.ComposeURL() &""','MovePackage','resizable=yes,width=400,height=200');""""""",_"images/abtn_move_package.gif",_null,_"Move this package to different Base View (Group).",_"Y",_"Y",_"N")rsQry.AddNew varFields, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnReversionPackage") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnStickyNotes") ThenvarValues = Array(10, "btnStickyNotes", null,_"""javascript:;""",_"""onClick=""""showHideNote();""""""",_"notemanager/images/note.gif",_null,_"Sticky notes",_"Y",_"Y",_"N")rsQry.AddNew varFields, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnObsoletePatch") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnUnobsoletePatch") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnApprovePackage") ThenvarValues = 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_make_released.gif",_"icons/i_make_released_off.gif",_"Make this package released for automated build.",_"Y",_"Y",_"N")rsQry.AddNew varFields, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnNewRelease") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnEditRelease") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnDestroyRelease") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnMergeManager") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnMoveRelease") ThenvarValues = 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, varValuesEnd If' NOTE: I do not think this one is ever usedIf isAbtnRequired(aAbtnList, "btnPreviousVersions") ThenvarValues = 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, varValuesEnd If' NOTE: I do not think this one is ever usedIf isAbtnRequired(aAbtnList, "btnObsoleteAll") ThenvarValues = Array(20, "btnObsoleteAll", null,_"""javascript:go_submit( document.FormName, """"btnObsoleteAll"""" );ShowProgress();""",_null,_null,_null,_null,_"Y",_"Y",_"Y")rsQry.AddNew varFields, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnNewVersion-MASSREF") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnRecycleBin") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnDeprecation") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnUnDeprecation") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnAdminView") ThenvarValues = 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, varValuesEnd If' NOTE: I do not think this one is ever usedIf isAbtnRequired(aAbtnList, "btnAddProc") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnEditGBE_Machtype") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnDeleteGBE_Machtype") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnEditDaemon") ThenvarValues = 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=600,height=220');""""""",_"icons/i_edit.gif",_"icons/i_edit_off.gif",_"Edit Daemon",_"Y",_"Y",_"N")rsQry.AddNew varFields, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnDeleteDaemon") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnArchivedVersionHistory") ThenvarValues = Array(31, "btnArchivedVersionHistory", null,_"""javascript:;""",_"""onClick=""""MM_openBrWindow('_wform_archived_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_archived_history.gif",_null,_"Show archived version history of this package.",_"Y",_"Y",_"Y")rsQry.AddNew varFields, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnPendingIntegration") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnPendingTest") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnPendingDeployment") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnRejectProduct") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnPendingIntegrateAndDeploy") ThenvarValues = 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, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnDeleteSchedule") ThenvarValues = Array(37, "btnDeleteSchedule", null,_"""_DeleteSchedule.asp?scheduled_id=""& scheduled_id &""&""& objPMod.ComposeURL()",_"""onClick=""""return confirmAction('Remove Schedule from this list?');""""""",_"icons/i_remove.gif",_null,_"Delete Schedule",_"Y",_"Y",_"N")rsQry.AddNew varFields, varValuesEnd IfIf isAbtnRequired(aAbtnList, "btnApproveMerge") ThenvarValues = 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, varValuesEnd If' Move cursor to the first recordrsQry.MoveFirstIf ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) ThenCall LoadButtons ( rsQry.GetRows() )End IfrsQry.CloseSet rsQry = NothingEnd Sub'-----------------------------------------------------------------------------------------------------------------Public Sub LoadButtons ( aRows )Dim nProperty, newArrayDim, LastRow, rowNumLastRow = UBound( aRows, 2 )For rowNum = 0 To LastRow' Increase array by 1newArrayDim = LastRowInx() + 1ReDim Preserve mArrAbtnDef( mNumOfProperties, newArrayDim )mobjNameDefMap.Item ( Cstr( aRows ( InxName, rowNum ) ) ) = newArrayDimFor nProperty = 0 To mLastPropertyInxmArrAbtnDef ( nProperty, newArrayDim ) = aRows ( nProperty, rowNum )NextNextEnd 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 setupCall SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxActive, enumDB_YES ) ' Default Active = enumDB_YESEnd 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 imageEnd 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 Sub Active ( sItemName, Value )'Response.write sItemName &"here"& mobjNameDefMap.Item (Cstr(sItemName))Call SetItemPropertyByIndex ( mobjNameDefMap.Item (Cstr(sItemName)), InxActive, Value )End Sub'-----------------------------------------------------------------------------------------------------------------Private Sub Class_Initialize()'// Perform action on creation of object. e.g. Set myObj = New ThisClassNameSet 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 = TRUEmnButtonSpacer = 0mnImageHspace = 4mNumOfProperties = 11 ' Number of properties in array which define one menu item.mLastPropertyInx = mNumOfProperties - 1mbDisableAll = FALSEReDim mArrAbtnDef ( mNumOfProperties, -1 )InxID = 0InxName = 1InxTxt = 2InxLink = 3InxEventHandler = 4InxImg = 5InxImgOff = 6InxHint = 7InxVisible = 8InxActive = 9InxIsReadonlyAction = 10End Sub'-----------------------------------------------------------------------------------------------------------------Private Sub Class_Terminate()'// Perform action on object disposal. e.g. Set myObj = NothingSet mobjNameDefMap = NothingSet mobjIdDefMap = NothingSet mobjSeparator = NothingSet mobjACActionsMap = NothingEnd Sub'-----------------------------------------------------------------------------------------------------------------End Class%>