Compile function NDW_ACTIVE_DIRECTORY_GROUPS_EVENTS(CtrlEntId, Event, @PARAMS) /*********************************************************************************************************************** This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written permission from Infineon. Name : NDW_Active_Directory_Groups_Events Description : This function acts as a commuter module for all events related to this window. Notes : Commuter Modules are automatically called from the Promoted_Events function which is called by the application-specific promoted event handler. This makes it possible to add QuickEvents that need to execute Basic+ logic without having use the Form Designer to make the association, although this is limited to the events which are currently promoted. If the form needs to call the commuter module directly then the QuickEvent parameters should be formatted like this: '@SELF','@EVENT',['@PARAM1','@PARAMx'] Parameters : CtrlEntId [in] -- The fully qualified name of the control calling the promoted event Event [in] -- The event being executed. See the Notes section regarding "PRE" events Param1-15 [in] -- Additional event parameter holders EventFlow [out] -- Set to 1 or 0 so the calling event knows whether or not to chain forward. See comments in EVENT_SETUP insert History : (Date, Initials, Notes) 10/01/24 djs Created initial commuter module. ***********************************************************************************************************************/ #pragma precomp SRP_PreCompiler #window NDW_ACTIVE_DIRECTORY_GROUPS $Insert EVENT_SETUP $Insert LOGICAL $Insert RTI_STYLE_EQUATES $Insert MSG_EQUATES Declare function Active_Directory_Services, Send_Message, SRP_Array Declare subroutine End_Dialog, Set_Property, Btree.Extract GoToEvent Event for CtrlEntId else // Event not implemented end Return EventFlow or 1 //----------------------------------------------------------------------------- // EVENT HANDLERS //----------------------------------------------------------------------------- Event WINDOW.CREATE(CreateParam) SelGroups = Field(CreateParam, @RM, 1, 1) GroupType = Field(CreateParam, @RM, 2, 1) Def = "" Def = -2 Def = -2 Def = "Loading groups..." Def = "U" MsgUp = Msg(@window, Def) ;* display the processing message ADGroupData = Active_Directory_Services('GetADGroupsByString', 'MES-Mesa*', 'INFINEON', '', GroupType) ADGroupData<-1> = Active_Directory_Services('GetADGroupsByString', 'IFX-IRF-Mesa*', 'INFINEON', '', GroupType) ADGroupData<-1> = Active_Directory_Services('GetADGroupsByString', 'KLU-Mesa*', 'INFINEON', '', GroupType) ADGroupData<-1> = Active_Directory_Services('GetADGroupsByString', 'MES-APP*', 'INFINEON', '', GroupType) ADGroupData = SRP_Array('Clean', ADGroupData, 'TrimAndMakeUnique', @FM) NumRows = DCount(ADGroupData, @FM) If NumRows GT 0 then For RowIndex = 1 to NumRows ThisGroupID = ADGroupData Selected = InList(SelGroups, ThisGroupID, @VM) ADGroupData = Insert(ADGroupData, RowIndex, 1, 0, Selected) Next RowIndex end Set_Property(@Window:'.EDT_AD_GROUPS', 'LIST', ADGroupData) ColStyles = Send_Message(@Window:'.EDT_AD_GROUPS','COLSTYLE',0,'') ColStyles<1> = BitOr(ColStyles<1>,DTCS_CHECKBOX$) ColStyles<1> = BitOr(ColStyles<1>,DTCS_CHECKBOXCENTER$) void = Send_Message(@Window:'.EDT_AD_GROUPS','COLSTYLE',0,ColStyles) Msg(@window, MsgUp) ;* take down the processing message End Event Event PUB_OK.CLICK() SelGroups = '' List = Get_Property(@Window:'.EDT_AD_GROUPS', 'LIST') If List NE '' then For each Row in List using @FM setting RowIndex RowSelected = Row<0, 1> If RowSelected then SelGroups<-1> = Row<0, 2> : @VM : Row<0, 3> : @VM : Row<0, 4> end Next Row end End_Dialog(@Window, SelGroups) end event Event PUB_CANCEL.CLICK() End_Dialog(@Window, '') end event Event EDT_AD_GROUPS.ROWSELCHANGED(SelRow, SelState) Def = "" Def = -2 Def = -2 Def = "Loading group data..." Def = "U" MsgUp = Msg(@window, Def) ;* display the processing message List = Get_Property(CtrlEntId, 'LIST') RowData = List GroupName = RowData<0, 2> Array = Get_Property(@Window, '@':GroupName) If Array EQ '' then MemberList = Active_Directory_Services('GetADGroupMembersByGroupName', GroupName, 'INFINEON') MemberList = SRP_Array('Rotate', MemberList, @FM, @VM) ADUserNames = MemberList<1> LSLUserNames = '' LSLNames = '' Open 'DICT.LSL_USERS' to hDict then For each ADUserName in ADUserNames using @VM setting vPos Query = 'DOMAIN_USERNAME':@VM:ADUserName:@FM Flag = '' LSLUsername = '' Btree.Extract(Query, 'LSL_USERS', hDict, LSLUsername, '', Flag) LSLUsernames<0, vPos> = LSLUsername<0, 1> LSLNames<0, vPos> = Xlate('LSL_USERS', LSLUserName<0, 1>, 'FIRST_LAST', 'X') Next ADUserName end Array = ADUsernames : @FM : LSLUsernames : @FM : LSLNames Set_Property(@Window, '@':GroupName, Array) end Set_Property(@Window:'.EDT_AD_MEMBERS', 'ARRAY', Array) Msg(@window, MsgUp) ;* take down the processing message end event