open-insight/LSL2/STPROC/REACTOR_MODES_EVENTS.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

234 lines
11 KiB
Plaintext

Compile function REACTOR_MODES_EVENTS(CtrlEntId, Event, @PARAMS)
Declare function Get_Property, Database_Services, Dialog_Box, Memberof, Sec_Group_Services, Error_Services
Declare subroutine Set_Property, rlist, Send_Event, Reactor_Modes_Services, errmsg, Error_Services, msg, Database_Services
$Insert REACTOR_MODES_EQUATES
$Insert MSG_EQUATES
$INSERT LOGICAL
#pragma precomp SRP_PreCompiler
#window REACTOR_MODES_EVENTS
GoToEvent Event for CtrlEntId else
// Event not implemented
end
Return EventFlow or 1
//-----------------------------------------------------------------------------
// EVENT HANDLERS
//-----------------------------------------------------------------------------
Event WINDOW.CREATE(CreateParam)
//Security Check
If MemberOf(@USER4,'ENGINEERING') OR MemberOf(@USER4,'SUPERVISOR') OR MemberOf(@User4, 'OI_ADMIN') then
Set_Property(@WINDOW : '.BTN_NEW_PROB_CAT', 'ENABLED', 1)
Set_Property(@WINDOW : '.BTN_DELETE_CAT', 'ENABLED', 1)
end
EQU TARGET_ACTIVELIST$ to 5
//Get List of Reactor Modes
Statement = 'SELECT REACTOR_MODES BY DESCRIPTION'
rlist(Statement, target_activelist$, '', '', '' )
ModeList = ''
IF @RecCount then
EoF = 0
NumKeys = @RecCount
Cnt = 0
Loop
ReadNext ReactorModeID Else EoF = 1
until EoF
ModeList<-1> = ReactorModeID
Repeat
end
//Populate list of current modes
Set_Property(@Window : '.CMB_REACTOR_MODE', 'LIST', ModeList)
//Populate Security Group options
GroupOptions = SEC_Group_Services('GetAllSecGroups')
Set_Property(@Window : '.CMB_ENTER_OPTIONS', 'LIST', GroupOptions)
Set_Property(@Window : '.CMB_EXIT_OPTIONS', 'LIST', GroupOptions)
//Populate Notifcation Group Options
NotifGrpOpts = Database_Services('ReadDataRow', 'APP_INFO', 'USER_CLASSES')
Set_Property(@Window : '.CMB_NOTIFY_OPTIONS', 'LIST', NotifGrpOpts)
End Event
Event CMB_REACTOR_MODE.CHANGED
ReactorModeRecKey = Get_Property(@WINDOW : '.CMB_REACTOR_MODE', 'DEFPROP')
ReactorModeRec = Database_Services('ReadDataRow', 'REACTOR_MODES', ReactorModeRecKey)
E10State = ReactorModeRec<REACTOR_MODES_E10_STATE$>
Description = ReactorModeRec<REACTOR_MODES_DESCRIPTION$>
Security = ReactorModeRec<REACTOR_MODES_SECURITY_LEVEL$>
ServiceCategoryNames = ReactorModeRec<REACTOR_MODES_SERVICE_CATEGORIES$>
ServiceCategoryIds = ReactorModeRec<REACTOR_MODES_SERVICE_CATEGORY_ID$>
ModeCategory = ReactorModeRec<REACTOR_MODES_MODE_CATEGORY$>
EnterPermissions = ReactorModeRec<REACTOR_MODES_GROUPS_ENTER$>
swap @VM with @FM in EnterPermissions
ExitPermissions = ReactorModeRec<REACTOR_MODES_GROUPS_RELEASE$>
swap @VM with @FM in ExitPermissions
NotificationActive = ReactorModeRec<REACTOR_MODES_NOTIFICATION_ACTIVE$>
NotificationClasses = ReactorModeRec<REACTOR_MODES_NOTIFY_CLASS$>
swap @VM with @FM in NotificationClasses
Icon = ReactorModeRec<REACTOR_MODES_ICON$> : '.bmp'
ServiceCategoryArr = ''
ServiceCategoryArr<1> = ServiceCategoryIds
ServiceCategoryArr<2> = ServiceCategoryNames
Set_Property(@Window:'.EDT_E10_STATE', 'TEXT', E10State)
Set_Property(@Window:'.EDT_DESCRIPTION', 'TEXT', Description)
Set_Property(@Window:'.EDT_SECURITY', 'TEXT',Security)
Set_Property(@Window:'.EDT_MODE_CATEGORY', 'TEXT',ModeCategory)
Set_Property(@Window:'.TBL_SERVICE_CATS', 'ARRAY', ServiceCategoryArr)
Set_Property(@Window: '.EDT_ENTER_PERMISSIONS', 'LIST', EnterPermissions)
Set_Property(@Window: '.EDT_EXIT_PERMISSIONS', 'LIST', ExitPermissions)
Set_Property(@Window: '.CHK_NOTIFICATION_ACTIVE', 'CHECK', NotificationActive)
Set_Property(@Window: '.EDT_NOTIFICATION_CLASSES', 'LIST', NotificationClasses)
Set_Property(@Window: '.CMB_ENTER_OPTIONS', 'TEXT' , '')
Set_Property(@Window: '.CMB_EXIT_OPTIONS', 'TEXT' , '')
Set_Property(@Window: '.CMB_NOTIFY_OPTIONS', 'TEXT' , '')
end event
Event BTN_NEW_PROB_CAT.CLICK
If MemberOf(@USER4,'ENGINEERING') OR MemberOf(@USER4,'SUPERVISOR') OR MemberOf(@User4, 'OI_ADMIN') then
ReactorModeRecKey = Get_Property(@WINDOW : '.CMB_REACTOR_MODE', 'DEFPROP')
test = Dialog_Box('NDW_ADD_PROB_CAT',@WINDOW,ReactorModeRecKey)
END else
ErrMsg('You must be authorized to change reactor mode categories')
Return
end
Send_Event(@Window : '.CMB_REACTOR_MODE', 'CHANGED')
end event
Event BTN_DELETE_CAT.CLICK
If MemberOf(@USER4,'ENGINEERING') OR MemberOf(@USER4,'SUPERVISOR') OR MemberOf(@User4, 'OI_ADMIN') then
ReactorModeRecKey = Get_Property(@WINDOW : '.CMB_REACTOR_MODE', 'DEFPROP')
CatArray = Get_Property(@Window:'.TBL_SERVICE_CATS', 'ARRAY')
Selected = Get_Property(@Window: '.TBL_SERVICE_CATS', "SELPOS")<2>
CatId = CatArray<1,Selected>
Reactor_Modes_Services('DeleteServiceCategory',ReactorModeRecKey, CatId)
END else
ErrMsg('You must be authorized to change reactor mode categories')
Return
end
Send_Event(@Window : '.CMB_REACTOR_MODE', 'CHANGED')
end event
Event PUB_ADD_ENTER.CLICK
If MemberOf(@USER4,'ENGINEERING') OR MemberOf(@USER4,'SUPERVISOR') OR MemberOf(@User4, 'OI_ADMIN') then
ReactorModeRecKey = Get_Property(@WINDOW : '.CMB_REACTOR_MODE', 'DEFPROP')
Selected = Get_Property(@Window: '.CMB_ENTER_OPTIONS', "TEXT")
Reactor_Modes_Services('AddEnterPermission', ReactorModeRecKey, Selected)
if Error_Services('HasError') then
errorMsg = Error_Services('GetMessage')
msg( '', errorMsg )
end
end else
msg('', 'You must be authorized to change reactor mode records')
end
Send_Event(@Window : '.CMB_REACTOR_MODE', 'CHANGED')
end event
Event PUB_ADD_EXIT.CLICK
If MemberOf(@USER4,'ENGINEERING') OR MemberOf(@USER4,'SUPERVISOR') OR MemberOf(@User4, 'OI_ADMIN') then
ReactorModeRecKey = Get_Property(@WINDOW : '.CMB_REACTOR_MODE', 'DEFPROP')
Selected = Get_Property(@Window: '.CMB_EXIT_OPTIONS', "TEXT")
Reactor_Modes_Services('AddReleasePermission', ReactorModeRecKey, Selected)
if Error_Services('HasError') then
errorMsg = Error_Services('GetMessage')
msg( '', errorMsg )
end
end else
msg('', 'You must be authorized to change reactor mode records')
end
Send_Event(@Window : '.CMB_REACTOR_MODE', 'CHANGED')
end event
Event PUB_REMOVE_ENTER.CLICK
If MemberOf(@USER4,'ENGINEERING') OR MemberOf(@USER4,'SUPERVISOR') OR MemberOf(@User4, 'OI_ADMIN') then
ReactorModeRecKey = Get_Property(@WINDOW : '.CMB_REACTOR_MODE', 'DEFPROP')
EnterArray = Get_Property(@Window:'.EDT_ENTER_PERMISSIONS', 'ARRAY')
SelectedPos = Get_Property(@Window: '.EDT_ENTER_PERMISSIONS', "SELPOS")<2>
Selected = EnterArray<1,SelectedPos>
Reactor_Modes_Services('DeleteEnterPermission', ReactorModeRecKey, Selected)
if Error_Services('HasError') then
errorMsg = Error_Services('GetMessage')
msg( '', errorMsg )
end
end else
msg('', 'You must be authorized to change reactor mode records')
end
Send_Event(@Window : '.CMB_REACTOR_MODE', 'CHANGED')
end event
Event PUB_REMOVE_EXIT.CLICK
If MemberOf(@USER4,'ENGINEERING') OR MemberOf(@USER4,'SUPERVISOR') OR MemberOf(@User4, 'OI_ADMIN') then
ReactorModeRecKey = Get_Property(@WINDOW : '.CMB_REACTOR_MODE', 'DEFPROP')
ExitArray = Get_Property(@Window:'.EDT_EXIT_PERMISSIONS', 'ARRAY')
SelectedPos = Get_Property(@Window: '.EDT_EXIT_PERMISSIONS', "SELPOS")<2>
Selected = ExitArray<1,SelectedPos>
Reactor_Modes_Services('DeleteReleasePermission', ReactorModeRecKey, Selected)
if Error_Services('HasError') then
errorMsg = Error_Services('GetMessage')
msg( '', errorMsg )
end
end else
msg('', 'You must be authorized to change reactor mode records')
end
Send_Event(@Window : '.CMB_REACTOR_MODE', 'CHANGED')
end event
Event CHK_NOTIFICATION_ACTIVE.CLICK
If MemberOf(@USER4,'ENGINEERING') OR MemberOf(@USER4,'SUPERVISOR') OR MemberOf(@User4, 'OI_ADMIN') then
newNotify = Get_Property(@Window: '.CHK_NOTIFICATION_ACTIVE', 'CHECK')
ReactorModeRecKey = Get_Property(@WINDOW : '.CMB_REACTOR_MODE', 'DEFPROP')
ReactorModeRec = Database_Services('ReadDataRow', 'REACTOR_MODES', ReactorModeRecKey)
ReactorModeRec<REACTOR_MODES_NOTIFICATION_ACTIVE$> = newNotify
Database_Services('WriteDataRow', 'REACTOR_MODES', ReactorModeRecKey, ReactorModeRec)
end else
msg('', 'You must be authorized to change reactor mode records')
end
Send_Event(@Window : '.CMB_REACTOR_MODE', 'CHANGED')
end event
Event PUB_ADD_NOTIFY.CLICK
If MemberOf(@USER4,'ENGINEERING') OR MemberOf(@USER4,'SUPERVISOR') OR MemberOf(@User4, 'OI_ADMIN') then
ReactorModeRecKey = Get_Property(@WINDOW : '.CMB_REACTOR_MODE', 'DEFPROP')
Selected = Get_Property(@Window: '.CMB_NOTIFY_OPTIONS', "TEXT")
Reactor_Modes_Services('AddNotificationGroup', ReactorModeRecKey, Selected)
if Error_Services('HasError') then
errorMsg = Error_Services('GetMessage')
msg( '', errorMsg )
end
end else
msg('', 'You must be authorized to change reactor mode records')
end
Send_Event(@Window : '.CMB_REACTOR_MODE', 'CHANGED')
end event
Event PUB_DELETE_NOTIFY.CLICK
If MemberOf(@USER4,'ENGINEERING') OR MemberOf(@USER4,'SUPERVISOR') OR MemberOf(@User4, 'OI_ADMIN') then
ReactorModeRecKey = Get_Property(@WINDOW : '.CMB_REACTOR_MODE', 'DEFPROP')
NotifArray = Get_Property(@Window:'.EDT_NOTIFICATION_CLASSES', 'ARRAY')
SelectedPos = Get_Property(@Window: '.EDT_NOTIFICATION_CLASSES', "SELPOS")<2>
Selected = NotifArray<1,SelectedPos>
Reactor_Modes_Services('DeleteNotificationGroup', ReactorModeRecKey, Selected)
if Error_Services('HasError') then
errorMsg = Error_Services('GetMessage')
msg( '', errorMsg )
end
end else
msg('', 'You must be authorized to change reactor mode records')
end
Send_Event(@Window : '.CMB_REACTOR_MODE', 'CHANGED')
end event