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

1141 lines
41 KiB
Plaintext

Function NDW_Audit_Trail_Events(CtrlEntId, Event, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15)
////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
//
// 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 SRP Computer Solutions, Inc.
//
// Name : NDW_Audit_Trail_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)
// 07/23/98 dmb Original programmer
// 11/17/05 dmb Use LoadTextW method instead of LoadText for UTF8 compatibility
// 03/30/06 axf Replaced application.dll to application.img added logic to accommodate
// that change
//
////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
$insert APP_INSERTS
$insert EVENT_SETUP
$insert MSG_EQUATES
Equ WM_USER$ To 1024
Equ WM_SETREADONLY$ To WM_USER$ + 31
Equ DLL$ to Drive():"\application.img#" ; // Application.Png is locate at the root of OI
AuditManagerTable = "APP_INFO"
Declare Subroutine Msg, Send_Event, V119, SRP_Set_Prop_Array, Utility, SRP_Show_Window, Start_Window, Send_Message, Get_SysInfo, Set_Property
Declare Function GetPointer, GetSystemInfo, Str_Unicode, Get_Property, Start_MDIChild, Start_Window, Popup
Begin Case
Case Control EQ Window
// This event is window specific.
Begin Case
Case Event EQ "CREATE" ; GoSub CREATE
Case Event EQ "CLEAR" ; GoSub CLEAR
End Case
Case Control EQ "COB_TABLE"
Begin Case
Case Event EQ "GOTFOCUS" ; GoSub GOTFOCUS.COB_TABLE
Case Event EQ "CHANGED" ; GoSub CHANGED.COB_TABLE
Case Event EQ "LOSTFOCUS" ; GoSub LOSTFOCUS.COB_TABLE
Case Event EQ "CHANGED" ; GoSub CHANGED.COB_TABLE
End Case
Case Control EQ "EDL_ID"
Begin Case
Case Event EQ "GOTFOCUS" ; GoSub GOTFOCUS.EDL_ID
Case Event EQ "OPTIONS" ; GoSub OPTIONS.EDL_ID
Case Event EQ "LOSTFOCUS" ; GoSub LOSTFOCUS.EDL_ID
End Case
Case Control EQ "EDT_AUDIT_INFO"
Begin Case
Case Event EQ "OnHeaderClick" ; GoSub OnHeaderClick.EDT_AUDIT_INFO
Case Event EQ "OnClick" ; GoSub OnClick.EDT_AUDIT_INFO
Case Event EQ "PosChanged" ; GoSub PosChanged.EDT_AUDIT_INFO
Case Event EQ "BeforeDeleteRecords" ; GoSub BeforeDeleteRecords.EDT_AUDIT_INFO
Case Event EQ "BeforeInsertRecords" ; GoSub BeforeInsertRecords.EDT_AUDIT_INFO
End Case
Case Control EQ "OLE_SUBCLASS"
Begin Case
Case Event EQ "OnOptionClick" ; GoSub OnOptionClick.OLE_SUBCLASS
End Case
Case EventType EQ "CLICK"
Begin Case
Case Control EQ "PUB_ALL_IDS" ; GoSub PUB_ALL_IDS_CLICK
Case Control EQ "PUB_RESTORE" ; GoSub PUB_RESTORE_CLICK
Case Control EQ "PUB_VIEW" ; GoSub PUB_VIEW_CLICK
End Case
End Case
If Assigned(EventFlow) else EventFlow = EVENT_CONTINUE$
Return EventFlow
CREATE:
*-------------------------------------------------------------------------------------------------------------------
* 1. Generates Outline using the SRP.Tab.1 and Contructs the OLE Edit Table
* 2. Sorts the Available Tables
*-------------------------------------------------------------------------------------------------------------------
Color = "3D Face L=90"
PropArray = @Window:".OLE_TAB"
PropArray<-1> = "OLE.TabCount" :@VM: 0
PropArray<-1> = "OLE.Height" :@VM: "-43"
PropArray<-1> = "OLE.AllowXPTheme" :@VM: Yes$
SRP_Set_Prop_Array(PropArray)
PropArray = @Window:".EDT_AUDIT_INFO"
PropArray<-1> = "OLE.WorkspaceBkColor" :@VM: "Window"
PropArray<-1> = "OLE.BorderType" :@VM: "XP"
PropArray<-1> = "OLE.Dimension<1>" :@VM: 8 ;* number of columns
PropArray<-1> = "OLE.Dimension<2>" :@VM: 15 ;* number of rows
PropArray<-1> = "OLE.HeaderColumn[1]<1>" :@VM: 20
PropArray<-1> = "OLE.HeaderColumn[1]<2>" :@VM: 1 ;* Visable (Column Numbers?)
PropArray<-1> = "OLE.AutoNumbers<1,1>" :@VM: "I"
PropArray<-1> = "OLE.AutoNumbers<1,2>" :@VM: 1
PropArray<-1> = "OLE.TitleList<1,1>" :@VM: "Date" ;* Date Column 1
PropArray<-1> = "OLE.TitleList<1,2>" :@VM: "Time" ;* Time Column 2
PropArray<-1> = "OLE.TitleList<1,3>" :@VM: "User Name" ;* User Column 3
PropArray<-1> = "OLE.TitleList<1,4>" :@VM: "Station" ;* Station Id Column 4
PropArray<-1> = "OLE.TitleList<1,5>" :@VM: "MAC Address" ;* Mac Address
PropArray<-1> = "OLE.TitleList<1,6>" :@VM: "Program Name"
PropArray<-1> = "OLE.TitleList<1,7>" :@VM: "Marker"
PropArray<-1> = "OLE.TitleList<1,8>" :@VM: "Activity" ;* Activity Type
PropArray<-1> = "OLE.CellProtection[1; All]" :@VM: "Selectable"
PropArray<-1> = "OLE.CellProtection[2; All]" :@VM: "Full"
PropArray<-1> = "OLE.CellProtection[3; All]" :@VM: "Full"
PropArray<-1> = "OLE.CellProtection[4; All]" :@VM: "Full"
PropArray<-1> = "OLE.CellProtection[5; All]" :@VM: "Full"
PropArray<-1> = "OLE.CellProtection[6; All]" :@VM: "Full"
PropArray<-1> = "OLE.CellProtection[7; All]" :@VM: "Full"
PropArray<-1> = "OLE.CellProtection[8; All]" :@VM: "Full"
PropArray<-1> = "OLE.QuickTabOut" :@VM: 1
PropArray<-1> = "OLE.DataColumn[1]<1>" :@VM: 70
PropArray<-1> = "OLE.DataColumn[1]<2>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[1]<3>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[2]<1>" :@VM: 70
PropArray<-1> = "OLE.DataColumn[2]<2>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[2]<3>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[3]<1>" :@VM: 105
PropArray<-1> = "OLE.DataColumn[3]<2>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[3]<3>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[4]<1>" :@VM: 105
PropArray<-1> = "OLE.DataColumn[4]<2>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[4]<3>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[4]<4>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[5]<1>" :@VM: 110
PropArray<-1> = "OLE.DataColumn[5]<2>" :@VM: 0
PropArray<-1> = "OLE.DataColumn[5]<3>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[6]<1>" :@VM: 150
PropArray<-1> = "OLE.DataColumn[6]<2>" :@VM: 0
PropArray<-1> = "OLE.DataColumn[6]<3>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[7]<1>" :@VM: 80
PropArray<-1> = "OLE.DataColumn[7]<2>" :@VM: 0
PropArray<-1> = "OLE.DataColumn[7]<3>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[8]<1>" :@VM: 55
PropArray<-1> = "OLE.DataColumn[8]<2>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[8]<3>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[8]<4>" :@VM: 1
PropArray<-1> = "OLE.MinCellSize" :@VM: 16
SRP_Set_Prop_Array(PropArray)
cWin$ = Window
Gosub ResetTabOrder
Qualifier = ""
Qualifier<1> = Yes$
Qualifier<4> = Yes$
Send_Message(@Window:".EDT_AUDIT_INFO", "QUALIFY_EVENT", "ALL_OLES", Qualifier)
Send_Message(@Window:".OLE_SUBCLASS", "QUALIFY_EVENT", "ALL_OLES", Qualifier)
Handle = Get_Property(@Window:".EDL_ID", "HANDLE")
Set_Property(@Window:".OLE_SUBCLASS", "OLE.CurrentWindow", @Window)
Send_Message(@Window:".OLE_SUBCLASS", "OLE.Subclass", Handle, @Window:".EDL_ID")
* Set_Property(@Window:".OLE_SUBCLASS", "OLE.OptionButton[EDL_ID]", Yes$)
Gosub Get_AuditM_Settings
Set_Property(@Window:".PUB_RESTORE", "ENABLED", No$)
Parent = Get_Property(@Window, "PARENT")
SRP_Show_Window(@Window, "", "L", "T", Yes$, "", No$, No$)
Size = Get_Property(@Window, "SIZE")
Set_Property(@Window:".EDL_SIZE", "INVALUE", Size)
return
GOTFOCUS.COB_TABLE:
*----------------------------------------------------------------------------------------------------
* Activates the Option Button
*----------------------------------------------------------------------------------------------------
GoSub Check_For_Options_Event
return
CHANGED.COB_TABLE:
*----------------------------------------------------------------------------------------------------
* Clears info in .EDL_ID field
*----------------------------------------------------------------------------------------------------
Ctrls = @Window:".EDL_ID":@RM:@Window:".EDT_AUDIT_INFO"
Props = "DEFPROP":@RM:"OLE.Array"
Vals = "":@RM:""
Set_Property(Ctrls, Props, Vals)
Ctrls = @Window:".COB_TABLE":@RM:@Window:".EDT_SETTINGS"
Props = "INVALUE":@RM:"ARRAY"
rv = Get_Property(Ctrls, Props)
Table = Field(rv, @RM, 1, 1)
Tracker = Field(rv, @RM, 2, 1)
Locate Table in Tracker<1> Using @VM Setting Pos Then
PropArray = @Window:".EDT_AUDIT_INFO"
If Tracker<6,Pos> = Yes$ Then
Size = Get_Property(@Window:".EDL_SIZE", "INVALUE")
Size<3> = Size<3> + 180
PropArray<-1> = "OLE.DataColumn[1]<1>" :@VM: 70
PropArray<-1> = "OLE.DataColumn[2]<1>" :@VM: 70
PropArray<-1> = "OLE.DataColumn[3]<1>" :@VM: 105
PropArray<-1> = "OLE.DataColumn[4]<1>" :@VM: 105
PropArray<-1> = "OLE.DataColumn[4]<4>" :@VM: 0
PropArray<-1> = "OLE.DataColumn[6]<1>" :@VM: 150
PropArray<-1> = "OLE.DataColumn[6]<2>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[6]<3>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[6]<4>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[7]<1>" :@VM: 80
PropArray<-1> = "OLE.DataColumn[7]<2>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[7]<3>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[8]<1>" :@VM: 55
End Else
Size = Get_Property(@Window:".EDL_SIZE", "INVALUE")
PropArray<-1> = "OLE.DataColumn[1]<1>" :@VM: 70
PropArray<-1> = "OLE.DataColumn[2]<1>" :@VM: 70
PropArray<-1> = "OLE.DataColumn[3]<1>" :@VM: 105
PropArray<-1> = "OLE.DataColumn[4]<1>" :@VM: 105
PropArray<-1> = "OLE.DataColumn[4]<4>" :@VM: 1
PropArray<-1> = "OLE.DataColumn[6]<2>" :@VM: 0
PropArray<-1> = "OLE.DataColumn[6]<4>" :@VM: 0
PropArray<-1> = "OLE.DataColumn[7]<2>" :@VM: 0
PropArray<-1> = "OLE.DataColumn[8]<1>" :@VM: 55
End
Set_Property(@Window, "SIZE", Size)
SRP_Set_Prop_Array(PropArray)
End
// KRF - 11/26/14 - Populate IDs with quick-list if available
Table = Get_Property(@Window:".COB_TABLE", "DEFPROP")
RecentlyUpdatedList = Xlate("AUDIT_":Table, "%RECENTLY_UPDATED%", "", "X")
If Len(RecentlyUpdatedList) then
Convert @FM to @TM in RecentlyUpdatedList
ComboDropDown = 1
ComboDropDown<2, 1> = ""
* ComboDropDown<2, 2> =
ComboDropDown<2, 3> = RecentlyUpdatedList
ComboDropDown<2, 4> = 2 ;// column 2 contains the values we care about
ComboDropDown<2, 5> = 1 ;// auto fill on
ComboDropDown<2, 6> = 0 ;// case sensitive off
ComboDropDown<2, 7> = 10 ;// 10 visible rows max
ComboDropDown<2, 8> = 0 ;// Don't fire the OnOptionClick
ComboDropDown<2, 9> = 1 ;// Reduce the list to partial matches
ComboDropDown<2, 10> = 0 ;// Only show the drop down when the user types
ComboDropDown<2, 11> = 1 ;// Do not use LIST Format
ComboDropDown<2, 12> = 1 ;// Autofill on first names
ComboDropDown<2, 13> = 1 ;// Hide dropdown when user clears cell
ComboDropDown<2, 14> = 0 ;// Let navigation keys show the drop down
ComboDropDown<2, 15> = 0 ;// Show the drop down regardless of the contents
ComboDropDown<2, 16> = 0 ;// Show the drop down during autofill
ComboDropDown<2, 17> = 1 ;// Remove selection when user backspaces/deletes
ComboDropDown<2, 18> = 0 ;// Show Popup while in read only mode
ComboDropDown<2, 19> = 1 ;// Show Popup When Navigating
ComboDropDown<2, 20> = 1 ;// Always Tab Out on Enter
ComboDropDown<2, 21> = -1 ;// Always show the dropdown above when close to the screen bottom
Set_Property(@Window:".OLE_SUBCLASS", "OLE.Combo[EDL_ID]", ComboDropDown)
end else
Set_Property(@Window:".OLE_SUBCLASS", "OLE.Combo[EDL_ID]", No$)
end
return
LOSTFOCUS.COB_TABLE:
*----------------------------------------------------------------------------------------------------
* Disables Option Button
*----------------------------------------------------------------------------------------------------
GoSub Check_For_Options_Event
return
GOTFOCUS.EDL_ID:
*----------------------------------------------------------------------------------------------------
* Activates the Option Button
*----------------------------------------------------------------------------------------------------
Set_Property(Get_Property(@Window, "MDIFRAME"):".PUB_TB_OPTIONS", "ENABLED", Yes$)
return
OPTIONS.EDL_ID:
*----------------------------------------------------------------------------------------------------
* Activates the Option Button
*----------------------------------------------------------------------------------------------------
rv = Get_Property(@Window:".COB_TABLE", "INVALUE")
If rv NE "" Then
GoSub Get_Table_Name
Gosub Get_Record_Ids
If Assigned(ID) Else ID = ""
If ID then
Locate ID In List Using @VM Setting Pos Then
tEDL = Get_Property(@Window:".EDL_ID", "INVALUE")
If ID NE tEDL Then
Set_Property(@Window:".EDT_INFO_BAK", "ARRAY", "")
Gosub ReInitialize
End
OrigId = OrigList<Pos>
Set_Property(@Window:".EDL_ID", "DEFPROP", ID)
End
Send_Event(@Window:".EDL_ID", "LOSTFOCUS")
End
End Else
ErrorMsg = "NOTABLE"
Gosub MsgAlert
Set_Property("SYSTEM", "FOCUS", @Window:".COB_TABLE")
End
return
CHANGED.EDL_ID:
*----------------------------------------------------------------------------------------------------
* Clears OLE Table if the EDL ID field Being is blank
*----------------------------------------------------------------------------------------------------
rv = Get_Property(@Window:".EDT_AUDIT_INFO", "OLE.Array")
If rv<1,1> NE "" And Trim(Param1) EQ "" Then
Set_Property(@Window:".EDT_AUDIT_INFO", "OLE.Array", "")
Set_Property(@Window:".EDT_INFO_BAK", "ARRAY", "")
Gosub Reinitialize
End
return
LOSTFOCUS.EDL_ID:
*----------------------------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------------------------------
ByPassFlag = No$
tVal = Get_Property(@Window:".COB_TABLE", "INVALUE")
eVal = Get_Property(@Window:".EDL_ID", "INVALUE")
Begin Case
Case Assigned(ErrorMsg)
ByPassFlag = Yes$
Case tVal = ""
ByPassFlag = Yes$
Case eVal = ""
ByPassFlag = Yes$
End Case
If ByPassFlag EQ No$ Then
Parent = Get_Property(@Window, "PARENT")
Parent = Field(Parent, ".", 1, 1)
CurControl = Get_Property(Parent, "FOCUS")
If CurControl = Parent:".PUB_TB_OPTIONS" else
GoSub Get_Table_Name
* Test to see if client manually entered in an Id
ID = Get_Property(@Window:".EDL_ID", "INVALUE")
v.IdOrig = ID
v.IdVis = Get_Property(@Window:".EDL_ID", "INVALUE")
If ID = "" Then Gosub Get_Record_Ids
Tracker = Get_Property(@Window:".EDT_SETTINGS", "ARRAY")
Locate Table In Tracker<1> Using @VM Setting Pos Then
AuditTable = "AUDIT_":Table
Open AuditTable to Handle then
ReadO Record from Handle, ID then
Array = ""
Begin Case
Case Tracker<6,Pos> EQ Yes$
For X = 1 to 8
Begin Case
Case X = 1
Array<1> = OConv(Record<1>, "D/4")
Case X = 2
Array<2> = OConv(Record<2>, "MTHS")
Case Otherwise$
Array<-1> = Record<X>
End Case
Next X
Case Record<10> EQ ""
For X = 1 to 8
Begin Case
Case X = 1
Array<1> = OConv(Record<1>, "D/4")
Case X = 2
Array<2> = OConv(Record<2>, "MTHS")
Case Otherwise$
Array<-1> = Record<X>
End Case
Next X
Case Otherwise$
MaxRecs = Count(Record<1>, @VM) + (Record<1> NE "")
For X = 1 to MaxRecs
If Record<6,X> EQ "" Then
For Y = 1 To 8
Begin Case
Case Y = 1
Array<1,-1> = OConv(Record<1,X>, "D/4")
Case Y = 2
Array<2,-1> = OConv(Record<2,X>, "MTHS")
Case Otherwise$
Array<Y,-1> = Record<Y,X>
End Case
Next Y
End
Next X
End Case
Set_Property(@Window:".EDT_AUDIT_INFO", "OLE.Array", Array)
Set_Property(Get_Property(@Window, "MDIFRAME"):".PUB_TB_OPTIONS", "ENABLED", No$)
testFocus = Get_Property(@Window, "FOCUS")
If testFocus EQ @Window:".EDL_ID" Then Set_Property(@Window:".EDT_AUDIT_INFO", "FOCUS", Yes$)
End Else
Set_Property(@Window:".EDT_AUDIT_INFO", "OLE.Array", "")
Set_Property(@Window:".EDT_INFO_BAK", "ARRAY", "")
Gosub ReInitialize
End
End Else
ErrorMsg = "OPEN"
TableName = AuditTable
Gosub MsgAlert
Set_Property(@Window:".EDL_ID", "INVALUE", "")
Set_Property(@Window:".EDT_AUDIT_INFO", "OLE.Array", "")
Set_Property(@Window:".EDT_INFO_BAK", "ARRAY", "")
Gosub ReInitialize
End
End
End
GoSub Check_For_Options_Event
End Else
Set_Property(@Window:".EDT_AUDIT_INFO", "OLE.Array", "")
Set_Property(@Window:".EDT_INFO_BAK", "ARRAY", "")
Gosub ReInitialize
End
return
OnHeaderClick.EDT_AUDIT_INFO:
HeaderPos = Field(Param1, ";", 1)
RowPos = Field(Param1, ";", 2)
ColPos = HeaderPos - 1
Begin Case
Case HeaderPos = 1
Case Otherwise$
PropArray = CtrlEntId
Set_Property(PropArray, "OLE.ImageList", DLL$:"#EDT_HEADER.BMP":@FM:3)
For Pass = 1 to 9
Begin Case
Case HeaderPos = Pass
PropArray<-1> = "OLE.HeaderImage[":Param1:"]" :@VM: 2
PropArray<-1> = "OLE.HeaderAlignment[":Param1:"]<3>" :@VM: "R"
Case Otherwise$
PropArray<-1> = "OLE.HeaderImage[":Pass:";":1:"]" :@VM: 0
End Case
Next Pass
SRP_Set_Prop_Array(PropArray)
Utility("CURSOR", "H")
/* User clicked on the column label, so a sort will be performed on this column */
Invalue = Get_Property(CtrlEntId, "OLE.Array")
If Invalue<1,1> NE "" Then
Numb_cols = Count(Invalue, @FM) + (Invalue NE "")
Numb_rows = Count(Invalue<1>, @VM) + (Invalue<1> NE "")
Dim ClickCols(Numb_cols)
Work = ""
Flag = ""
Just = "L"
ClickCols(1) = ColPos
For Loop = 2 to Numb_cols
ClickCols(Loop) = Loop
Next Loop
ClickCols(ColPos) = 1
For Row = 1 to Numb_rows
For Col = 1 to Numb_cols
Work := Invalue<ClickCols(Col), Row>:@FM
Next Col
Work[-1, 1] = @RM
Next Row
V119("S", "", "A", Just, Work, Flag)
Invalue = ""
For Row = 1 to Numb_rows
Line = Field(Work, @RM, Row, 1)
For Col = 1 to Numb_cols
Invalue<Col, Row> = Line<ClickCols(Col)>
Next Col
Next Row
Set_Property(CtrlEntId, "OLE.Array", Invalue)
Utility("CURSOR", "A")
End
End Case
return
OnClick.EDT_AUDIT_INFO:
*----------------------------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------------------------------
RowPos = Field(Param1, ";", 2)
If RowPos EQ 0 Else
Ctrls = @Window:".EDL_ID":@RM:CtrlEntId:@RM:CtrlEntId:@RM:CtrlEntId:@RM:CtrlEntId:@RM:CtrlEntId:@RM:@Window:".COB_TABLE":@RM:@Window:".EDT_SETTINGS"
Props = "INVALUE":@RM:"OLE.CellText[4;":RowPos:"]":@RM:"OLE.CellText[1;":RowPos:"]":@RM:"OLE.CellText[2;":RowPos:"]":@RM:"OLE.CellText[6;":RowPos:"]":@RM:"OLE.CellText[8;":RowPos:"]":@RM:"INVALUE":@RM:"ARRAY"
rv = Get_Property(Ctrls, Props)
ID = Field(rv, @RM, 1, 1)
Station = Field(rv, @RM, 2, 1)
DateIn = Iconv(Field(rv, @RM, 3, 1), "D")
TimeIn = Iconv(Field(rv, @RM, 4, 1), "MTHS")
pRec = Field(rv, @RM, 5, 1)
vRec = Field(rv, @RM, 6, 1)
TableId = Field(rv, @RM, 7, 1)
Settings = Field(rv, @RM, 8, 1)
Convert @Lower_Case to @Upper_Case in TableId
Locate TableId in Settings<1> Using @VM Setting iPos Then
If pRec NE "" Then
tRec = Settings<6,iPos>
End Else
tRec = 0
End
If tRec EQ "" Then tRec = 0
If tRec EQ No$ And vRec EQ "Read" Else
RecId = ID:"*":Station:"*":DateIn:"*":TimeIn
Open "AUDIT_":TableId to Handle Then
ReadO StoredRec From Handle, RecId Then
Pos = Field(Param1, ";", 2)
sVal = ""
ColorInfo = "OLE.CellColors[":Param1:"]"
rv = Get_Property(@Window:".EDT_AUDIT_INFO", ColorInfo)
Color = "Select L=80"
CHB_None = "3D Face L=90"
CHB_Color = "3D Face L=80"
rVal = Get_Property(@Window:".EDT_INFO_BAK", "ARRAY")
If rv<2> NE Color Then
PropArray = @Window:".EDT_AUDIT_INFO"
PropArray<-1> = "OLE.CellColors[1;":Pos:"]<2>" :@VM:Color
PropArray<-1> = "OLE.CellColors[2;":Pos:"]<2>" :@VM:Color
PropArray<-1> = "OLE.CellColors[3;":Pos:"]<2>" :@VM:Color
PropArray<-1> = "OLE.CellColors[4;":Pos:"]<2>" :@VM:Color
PropArray<-1> = "OLE.CellColors[5;":Pos:"]<2>" :@VM:Color
PropArray<-1> = "OLE.CellColors[6;":Pos:"]<2>" :@VM:Color
PropArray<-1> = "OLE.CellColors[7;":Pos:"]<2>" :@VM:Color
PropArray<-1> = "OLE.CellColors[8;":Pos:"]<2>" :@VM:Color
SRP_Set_Prop_Array(PropArray)
TestCol = rVal
Convert @FM to "" In TestCol
Convert @VM to "" In TestCol
If Trim(TestCol) = "" Then rVal = ""
MaxR = Count(rVal<1>, @VM) + (rVal NE "") + 1
rVal = Insert(rVal, 1, -1, 0, RecId)
Swap @VM:@VM With @VM in rVal
If MaxR EQ 1 Then
Set_Property(@Window:".PUB_RESTORE", "ENABLED", Yes$)
End Else
Set_Property(@Window:".PUB_RESTORE", "ENABLED", No$)
End
Set_Property(@Window:".PUB_VIEW", "ENABLED", Yes$)
End Else
PropArray = @Window:".EDT_AUDIT_INFO"
PropArray<-1> = "OLE.CellColors[1;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[2;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[3;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[4;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[5;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[6;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[7;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[8;":Pos:"]<2>" :@VM:"None"
SRP_Set_Prop_Array(PropArray)
Locate RecId in rVal<1> Using @VM Setting xPos Then
rVal = Delete(rVal, 1, xPos, 0)
Swap @VM:@VM With @VM in rVal
Convert @VM to " " in rVal
rVal = Trim(rVal)
MaxR = Count(rVal, " ") + (rVal NE "")
Begin Case
Case MaxR EQ 0
Set_Property(@Window:".PUB_RESTORE", "ENABLED", No$)
Set_Property(@Window:".PUB_VIEW", "ENABLED", No$)
Case MaxR EQ 1
Set_Property(@Window:".PUB_RESTORE", "ENABLED", Yes$)
Set_Property(@Window:".PUB_VIEW", "ENABLED", Yes$)
Case Otherwise$
Set_Property(@Window:".PUB_VIEW", "ENABLED", Yes$)
End Case
Convert " " to @VM in rVal
End
End
Set_Property(@Window:".EDT_INFO_BAK", "ARRAY", rVal)
End
End
End
End
End
return
PosChanged.EDT_AUDIT_INFO:
*----------------------------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------------------------------
Pos = Field(Param1, ";", 2)
PropArray = @Window:".EDT_AUDIT_INFO"
rv = Get_Property(PropArray, "OLE.CellText[1;":Pos:"]")
If rv EQ "" Then
PropArray<-1> = "OLE.CellColors[1;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[2;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[3;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[4;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[5;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[6;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[7;":Pos:"]<2>" :@VM:"None"
PropArray<-1> = "OLE.CellColors[8;":Pos:"]<2>" :@VM:"None"
SRP_Set_Prop_Array(PropArray)
End
return
BeforeDeleteRecords.EDT_AUDIT_INFO:
*----------------------------------------------------------------------------------------------------
* Process does not allow rows to be deleted
*----------------------------------------------------------------------------------------------------
Set_Property(CtrlEntId, "OLE.Cancel", Yes$)
return
BeforeInsertRecords.EDT_AUDIT_INFO:
*----------------------------------------------------------------------------------------------------
* Process does not allow rows to be inserted
*----------------------------------------------------------------------------------------------------
Set_Property(CtrlEntId, "OLE.Cancel", Yes$)
return
OnOptionClick.OLE_SUBCLASS:
*----------------------------------------------------------------------------------------------------
* KRF - 11/26/14 - No longer needed because we switched from an option button to a regular button
*----------------------------------------------------------------------------------------------------
* Gosub OPTIONS.EDL_ID
return
PUB_ALL_IDS_CLICK:
*----------------------------------------------------------------------------------------------------
* KEF - 11/26/14 - New button for the popup since the ID dropdown now only contains 500 most recent
*----------------------------------------------------------------------------------------------------
GoSub OPTIONS.EDL_ID
return
PUB_RESTORE_CLICK:
*----------------------------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------------------------------
Begin Case
Case Window = "NDW_AUDIT_TRAIL"
Win$ = @Window
Case Otherwise$
Win$ = Get_Property(@Window:".EDL_WINDOW", "INVALUE")
End Case
TableName = Get_Property(Win$:".COB_TABLE", "INVALUE")
Convert @Lower_Case to @Upper_Case in TableName
rVal = Get_Property(Win$:".EDT_INFO_BAK", "ARRAY")
Convert @VM to " " in rVal
rVal = Trim(rVal)
TestVal = Count(rVal, " ")
If TestVal GT 0 Then
ErrorMsg = "TOOMANY"
Gosub MsgAlert
End Else
ErrorMsg = "RESTORE"
Gosub MsgAlert
If rv = Yes$ Then
AuditId = rVal
OrigId = Get_Property(Win$:".EDL_ID", "INVALUE")
Begin Case
Case AuditId = ""
ErrorMsg = "ID"
IdName = "Audit Primary Key"
Gosub MsgAlert
Case OrigId = ""
ErorMsg = "ID"
IdName = "Primary Key"
Gosub MsgAlert
Case Otherwise$
Open TableName To hORT Then
Open "AUDIT_":TableName To hADT Then
ReadO Record From hADT, AuditId Then
Write Record To hORT, OrigId Then
ErrorMsg = "RESTORED"
Gosub MsgAlert
End Else
RecId = OrigId
ErrorMsg = "WRITE"
Gosub MsgAlert
End
End Else
ErrorMsg = "READ"
RecId = AuditId
Gosub MsgAlert
End
End Else
ErrorMsg = "OPEN"
Gosub MsgAlert
End
End Else
ErrorMsg = "OPEN"
Gosub MsgAlert
End
End Case
End
End
return
PUB_VIEW_CLICK:
*----------------------------------------------------------------------------------------------------
* Generates the Audit Viewer Windows
*----------------------------------------------------------------------------------------------------
TableName = Get_Property(@Window:".COB_TABLE", "INVALUE")
Convert @Lower_Case to @Upper_Case In TableName
RecId = Get_Property(@Window:".EDT_INFO_BAK", "ARRAY")
Win$ = @Window
Open "AUDIT_":TableName to hAGT Then
MaxRecs = Count(RecId, @VM) + (RecId NE "")
For X = 1 to MaxRecs
ReadO RecInfo From hAGT, RecId<1,X> Then
Parent = @Window
Frame = Get_Property(Parent, "MDIFRAME")
If Len(Frame) Then Parent = Frame
Begin Case
Case Parent = "FRW_MAIN"
LStartPt = 20
TStartPt = 10
rv = Start_MDIChild("NDW_AUDIT_VIEWER", Parent)
Case Otherwise$
LStartPt = 20
TStartPt = 10
rv = Start_Window("NDW_AUDIT_VIEWER", Parent)
End Case
Qualifier = ""
Qualifier<1> = Yes$
Qualifier<4> = Yes$
Send_Message(rv:".OLE_VIEWER", "QUALIFY_EVENT", "ALL_OLES", 1)
Send_Message(rv:".OLE_ARCHIVE", "QUALIFY_EVENT", "ALL_OLES", 1)
Send_Message(rv:".OLE_ORIGINAL", "QUALIFY_EVENT", "ALL_OLES", 1)
MxAs = Count(RecID<1,X>, "*") + (RecId<1,X> NE "")
oId = MxAs - 3
Date = Oconv(Field(RecId<1,X>, "*", MxAs - 1), "D/4")
Time = Oconv(Field(RecId<1,X>, "*", MxAs), "MTHS")
RecTitle = "Table: ":TableName:" - ID: ":Field(RecId<1,X>, "*", 1, oId):" - ":Date:" - ":Time
Title = Get_Property(rv, "TEXT")
Title = Title:" - ":RecTitle
ViewerCtrl = rv:".OLE_VIEWER"
Ctrls = rv:".EDL_WINDOW":@RM:rv:".EDL_AREC_ID":@RM:rv
Props = "INVALUE":@RM:"INVALUE":@RM:"TEXT"
Vals = Win$:@RM:RecId<1,X>:@RM:Title
Set_Property(Ctrls, Props, Vals)
* Send_Message(ViewerCtrl, "OLE.LoadText", GetPointer(RecInfo), Len(RecInfo), 1)
LenData = Len(RecInfo)
RecInfo = Str_Unicode(RecInfo)
LockVariable RecInfo as Char
Send_Message(ViewerCtrl, "OLE.LoadTextW", GetPointer(RecInfo), LenData, 1)
Set_Property(ViewerCtrl, "OLE.ReadOnly", Yes$)
ViewerCtrl = rv:".OLE_ARCHIVE"
* Send_Message(ViewerCtrl, "OLE.LoadText", GetPointer(RecInfo), Len(RecInfo), 1)
Send_Message(ViewerCtrl, "OLE.LoadTextW", GetPointer(RecInfo), LenData, 1)
UnlockVariable Data
Set_Property(ViewerCtrl, "OLE.ReadOnly", Yes$)
Set_Property(rv:".PUB_RESTORE", "PAGELIST", -1)
Set_Property(rv:".PUB_CANCEL", "PAGELIST", -1)
oRecId = Get_Property(Win$:".EDL_ID", "INVALUE")
Open TableName to hORT Then
ReadO RecInfo From hORT, oRecId Then
ViewerCtrl = rv:".OLE_ORIGINAL"
* Send_Message(ViewerCtrl, "OLE.LoadText", GetPointer(RecInfo), Len(RecInfo), 1)
LenData = Len(RecInfo)
RecInfo = Str_Unicode(RecInfo)
LockVariable RecInfo as Char
Send_Message(ViewerCtrl, "OLE.LoadTextW", GetPointer(RecInfo), LenData, 1)
UnlockVariable Data
Set_Property(ViewerCtrl, "OLE.ReadOnly", Yes$)
End
cWin$ = rv
Page = 1
Gosub ResetTabOrder
End
SRP_Show_Window(rv, "", "L":(LStartPt) + (X*10),"T":(TStartPt) + (X*20), Yes$)
End
Next X
End
return
CLEAR:
*----------------------------------------------------------------------------------------------------
* This Gosub clears the viewable Audit Trail Information
*----------------------------------------------------------------------------------------------------
Ctrls = @Window:".EDT_AUDIT_INFO":@RM:@Window:".EDT_INFO_BAK":@RM:@Window:".COB_TABLE":@RM:@Window:".EDL_ID"
Props = "OLE.Array":@RM:"ARRAY":@RM:"INVALUE":@RM:"INVALUE"
Vals = "":@RM:"":@RM:"":@RM:""
Set_Property(Ctrls, Props, Vals)
Gosub ReInitialize
return
*------------------------
* Internal Processes
*------------------------
Check_For_Options_Event:
Temp = Get_Property(@Window, "FOCUS")
Events = Get_Property(Temp, "ORIG_STRUCT")<1, 21>
If Index(Events, "OPTIONS*", 1) then
Set_Property(Get_Property(@Window, "MDIFRAME"):".PUB_TB_OPTIONS", "ENABLED", Yes$)
end else
Set_Property(Get_Property(@Window, "MDIFRAME"):".PUB_TB_OPTIONS", "ENABLED", No$)
end
return
First_Caps:
*----------------------------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------------------------------
FM_Count = Count(List, @FM) + (List NE "")
For FM = 1 to FM_Count
VM_Count = Count(List<FM>, @VM) + (List<FM> NE "")
For VM = 1 to VM_Count
Temp = List<FM, VM>
Convert "_" to " " in Temp
Convert @Upper_case to @Lower_case in Temp
Len_temp = Len(Temp)
For Pos = 1 to Len_temp
Cur_char = Temp[Pos, 1]
If (Pos EQ 1) OR (Temp[(Pos - 1), 1] EQ " ") then
Convert @Lower_case to @Upper_case in Cur_char
end
Temp[Pos, 1] = Cur_char
Next Pos
List<FM, VM> = Temp
Next VM
Next FM
return
Get_Table_Name:
*----------------------------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------------------------------
Gosub Get_AuditM_Settings
TableList = Get_Property(@Window, "@TABLE_LIST")
SelectedRow = Get_Property(@Window:".COB_TABLE", "SELPOS")
Table = TableList<SelectedRow>
return
Get_Record_Ids:
*----------------------------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------------------------------
Open "AUDIT_":Table to hADT Then
List = ""
cPos = 0
Done = No$
Select hADT
Loop
ReadNext aID Else Done = Yes$
Until Done = Yes$
ReadO TempRec From hADT, aID Then
If TempRec<9> EQ "AUDIT TRACKING RECORD" Then
List<-1> = aID
End
End Else
ErrorMsg = "READ"
RecId = aID
Gosub MsgAlert
End
Repeat
If List GT "" Then
Flag = ""
Swap @FM with @RM in List
List := @RM
V119("S", "", "A", "L", List, Flag)
List[-1, 1] = ""
Swap @RM with @FM in List
OrigList = List
* GoSub First_Caps
Convert @FM to @VM in List
Begin Case
Case Event = "OPTIONS.EDL_ID" or EventAction = "OnOptionClick.OLE_SUBCLASS" or EventAction = "CLICK.PUB_ALL_IDS"
PopupStats = ""
PopupStats<1> = -2
PopupStats<2> = -2
PopupStats<3> = -1
PopupStats<4> = -1
PopupStats<5> = 16777215
PopupStats<6> = "MS Sans Serif":@SVM:-11:@SVM:400:@SVM:0:@SVM:0:@SVM:6:@SVM:0:@SVM:33:@SVM:0:@SVM:0:@SVM:0:@SVM:0:@SVM:11:@SVM:2:@SVM:0:@SVM:12
PopupStats<8> = List
PopupStats<9> = @SVM:30:@SVM:"L":@SVM:"L":@SVM:@SVM:"Record IDs"
PopupStats<10> = "L"
PopupStats<11> = 1
PopupStats<12> = "Record IDs"
PopupStats<13> = 1
PopupStats<14> = "F"
PopupStats<15> = 0
PopupStats<16> = 0
PopupStats<17> = 0
PopupStats<18> = 1
PopupStats<19> = 1
PopupStats<20> = 1
PopupStats<21> = 1
PopupStats<22> = 1
ID = PopUp(@Window, PopupStats)
Case Otherwise$
rv = Get_Property(@Window:".EDL_ID", "INVALUE")
End Case
End Else
ErrorMsg = "NOIDS"
TableName = Table
Gosub MsgAlert
End
End Else
ErrorMsg = "OPEN"
TableName = "AUDIT_":Table
Gosub MsgAlert
End
return
CompareValues:
*----------------------------------------------------------------------------------------------------
*
*----------------------------------------------------------------------------------------------------
dRow = ""
MxORows = Count(RecInfo, @FM) + (RecInfo NE "")
MxARows = Count(ARecINfo, @FM) + (ARecInfo NE "")
If MxORows GE MxARows Then
MxRows = MxORows
End Else
MxRows = MxARows
End
For X = 1 to MxRows
If RecInfo<X> NE ARecInfo<X> Then
dRow<-1> = X
End
Next X
If dRow NE "" Then
Ctrls = @Window:".OLE_ARCHIVE":@RM:@Window:".OLE_ORIGINAL":@RM:@Window:".OLE_VIEWER"
Props = "OLE.ErrorLines":@RM:"OLE.ErrorLines":@RM:"OLE.ErrorLines"
Vals = dRow:@RM:dRow:@RM:dRow
Set_Property(Ctrls, Props, Vals)
End
return
Get_AuditM_Settings:
Open AuditManagerTable to hAIT then
AppID = "AUDIT_MANAGER_SETTINGS"
ReadO AppRec from hAIT, AppID then
tableVal = Get_Property(@Window:".COB_TABLE", "INVALUE")
List = AppRec<1>
Flag = ""
Swap @VM with @RM in List
List := @RM
V119("S", "", "A", "L", List, Flag)
List[-1, 1] = ""
Swap @RM with @FM in List
Set_Property(@Window, "@TABLE_LIST", List)
* GoSub First_Caps
Ctrls = @Window:".COB_TABLE":@RM:@Window:".COB_TABLE":@RM:@Window:".EDT_SETTINGS"
Props = "LIST":@RM:"INVALUE":@RM:"ARRAY"
Vals = List:@RM:tableVal:@RM:AppRec
Set_Property(Ctrls, Props, Vals)
end
end
return
ReInitialize:
*-------------------------------------------------------------------------------------------------------------------------------------
* Disables the View and Restore Buttons and returns the Cell to our default color.
*-------------------------------------------------------------------------------------------------------------------------------------
Ctrls = @Window:".PUB_VIEW":@RM:@Window:".PUB_RESTORE"
Props = "ENABLED":@RM:"ENABLED"
Vals = 0:@RM:0
Set_Property(Ctrls, Props, Vals)
PropArray = @Window:".EDT_AUDIT_INFO"
PropArray<-1> = "OLE.CellColors[All;All]<2>" :@VM:"None"
SRP_Set_Prop_Array(PropArray)
return
MsgAlert:
*-------------------------------------------------------------------------------------------------------------------------------------
*
*-------------------------------------------------------------------------------------------------------------------------------------
Mess = ""
Mess<MTYPE$> = "BO"
Mess<MICON$> = "!"
Mess<MCAPTION$> = "Audit Trail"
Error = "An undefined error has occurred with this process"
Begin Case
Case ErrorMsg = "OPEN"
Error = "Unable to Open the ": TableName: " table."
Case ErrorMsg = "READ"
Error = "Unable to Read ": RecId:" record."
Case ErrorMsg = "WRITE"
Error = "Unable to Write ": RecId:" record."
Case ErrorMsg = "NOIDS"
Error = "There are no audit records for the ":TableName:" table."
Case ErrorMsg = "ID"
Error = IdName: " is Null."
Case ErrorMsg = "RESTORED"
Error = "Record ":OrigId:" has been restored to the ":TableName:" table."
Case ErrorMsg = "TOOMANY"
Error = "You only restore one record at a time."
Case ErrorMsg = "RESTORE"
Mess<MICON$> = "?"
Mess<MTYPE$> = "BNY"
Error = "Would you like to restore this entry?"
Case ErrorMsg = "NOTABLE"
Error = "No Table Selected"
End Case
Mess<MTEXT$> = Error
rv = Msg("",Mess)
return
ResetTabOrder:
*-------------------------------------------------------------------------------------------------------------------------
* Resets Tab Order
*-------------------------------------------------------------------------------------------------------------------------
LastPageCtrl = ""
LastCtrl = ""
FirstCtrl = ""
rVal = ""
PCtrls = ""
NCtrls = ""
NProps = ""
Begin Case
Case cWin$ EQ "NDW_AUDIT_TRAIL"
rVal<1> = @Window:".COB_TABLE"
rVal<2> = @Window:".EDL_ID"
rVal<3> = @Window:".EDT_AUDIT_INFO"
rVal<4> = @Window:".PUB_RESTORE"
rVal<5> = @Window:".PUB_VIEW"
Case Otherwise$
Begin Case
Case Page EQ 1
Set_Property("SYSTEM", "FOCUS", cWin$:".OLE_VIEWER")
rVal<1> = cWin$:".OLE_VIEWER"
rVal<2> = cWin$:".PUB_RESTORE"
rVal<3> = cWin$:".PUB_COMPARE"
rVal<4> = cWin$:".PUB_CLOSE"
Case Page EQ 2
Set_Property("SYSTEM", "FOCUS", cWin$:".OLE_ARCHIVE")
rVal<1> = cWin$:".OLE_ARCHIVE"
rVal<2> = cWin$:".OLE_ORIGINAL"
rVal<3> = cWin$:".PUB_RESTORE"
rVal<4> = cWin$:".PUB_RETURN"
rVal<5> = cWin$:".PUB_CLOSE"
End Case
End Case
MxC = Count(rVal,@FM) + (rVal NE "")
For i = 1 to MxC
If i = MxC Then
nVal = 1
End Else
nVal = i + 1
End
PCtrls<-1> = rVal<i>
NCtrls<-1> = rVal<nVal>
NProps<-1> = "NEXT"
Next i
Convert @FM to @RM in PCtrls
Convert @FM to @RM in NCtrls
Convert @FM to @RM in NProps
Set_Property(PCtrls, NProps, NCtrls)
return