108 lines
3.8 KiB
Plaintext
108 lines
3.8 KiB
Plaintext
compile function log_check(Params)
|
|
begin condition
|
|
pre:
|
|
post:
|
|
end condition
|
|
$insert msg_equates
|
|
$insert logical
|
|
declare function msg, set_property, send_event, start_window, utility, Get_Property
|
|
declare subroutine yield
|
|
Level = field( Params, '*', 1 )
|
|
LogLevel = field( Params, '*', 2 )
|
|
*
|
|
* LogLevel will be 1 for morning and 2 for evening
|
|
CurTime = time()
|
|
BegTime1 = iconv( '4:00AM', 'MTS' )
|
|
BegTime2 = iconv( '8:00PM', 'MTS' )
|
|
EndTime1 = iconv( '4:10AM', 'MTS' )
|
|
EndTime2 = iconv( '8:10PM', 'MTS' )
|
|
Ten = 60 * 10
|
|
Five = 60 * 5
|
|
|
|
If Get_Property('NDW_MAIN', 'VISIBLE') then
|
|
AppMain = 'NDW_MAIN'
|
|
end else
|
|
AppMain = 'LSL_MAIN2'
|
|
end
|
|
|
|
begin case
|
|
case Level = 1
|
|
SecsInFifteen = 60*15
|
|
Warn = false$
|
|
if LogLevel = 1 then
|
|
TimeToWarn = oconv( BegTime1 - Ten, 'MTS' )
|
|
if BegTime1 - CurTime >= (SecsInFifteen-59) then
|
|
Warn = true$
|
|
end
|
|
end else
|
|
TimeToWarn = oconv( BegTime2 - Ten, 'MTS' )
|
|
if (BegTime2 - CurTime) >= (SecsInFifteen-59) then
|
|
Warn = true$
|
|
end
|
|
end
|
|
Void = set_property( 'SYSTEM', 'IDLEPROC', 'LOG_CHECK':@fm:2:'*':LogLevel:@fm:TimeToWarn:@fm:'' )
|
|
if Warn then
|
|
Message = 'You have FIFTEEN MINUTES to save your work and log out...'
|
|
Void = start_window( 'LOG_CHECK_WARN', AppMain, '*CENTER', '', '' )
|
|
Void = set_property( 'LOG_CHECK_WARN.MSG', 'TEXT', Message )
|
|
Void = utility( 'BEEP' )
|
|
end
|
|
case Level = 2
|
|
SecsInTen = 60*10
|
|
Warn = false$
|
|
if LogLevel = 1 then
|
|
TimeToWarn = oconv( BegTime1 - Five, 'MTS' )
|
|
if (BegTime1 - CurTime) >= (SecsInTen-59) then
|
|
Warn = true$
|
|
end
|
|
end else
|
|
TimeToWarn = oconv( BegTime2 - Five, 'MTS' )
|
|
if (BegTime2 - CurTime) >= (SecsInTen-59) then
|
|
Warn = true$
|
|
end
|
|
end
|
|
Void = set_property( 'SYSTEM', 'IDLEPROC', 'LOG_CHECK':@fm:3:'*':LogLevel:@fm:TimeToWarn:@fm:'' )
|
|
if Warn then
|
|
Message = 'You have TEN MINUTES to save your work and log out...'
|
|
Void = start_window( 'LOG_CHECK_WARN', AppMain, '*CENTER', '', '' )
|
|
Void = set_property( 'LOG_CHECK_WARN.MSG', 'TEXT', Message )
|
|
Void = utility( 'BEEP' )
|
|
end
|
|
case Level = 3
|
|
SecsInFive = 60*5
|
|
Warn = false$
|
|
if LogLevel = 1 then
|
|
TimeToWarn = oconv( BegTime1 - 60, 'MTS' )
|
|
if (BegTime1 - CurTime) >= (SecsInFive-59) then
|
|
Warn = true$
|
|
end
|
|
end else
|
|
TimeToWarn = oconv( BegTime2 - 60, 'MTS' )
|
|
if (BegTime2 - CurTime) >= (SecsInFive-59) then
|
|
Warn = true$
|
|
end
|
|
end
|
|
Void = set_property( 'SYSTEM', 'IDLEPROC', 'LOG_CHECK':@fm:4:'*':LogLevel:@fm:TimeToWarn:@fm:'' )
|
|
Message = 'You have FIVE MINUTES to save your work and log out...'
|
|
Void = start_window( 'LOG_CHECK_WARN', AppMain, '*CENTER', '', '' )
|
|
Void = set_property( 'LOG_CHECK_WARN.MSG', 'TEXT', Message )
|
|
Void = utility( 'BEEP' )
|
|
case Level = 4
|
|
if LogLevel = 1 then
|
|
TimeToWarn = oconv( BegTime1, 'MTS' )
|
|
end else
|
|
TimeToWarn = oconv( BegTime2, 'MTS' )
|
|
end
|
|
Void = set_property( 'SYSTEM', 'IDLEPROC', 'LOG_CHECK':@fm:5:'*':LogLevel:@fm:TimeToWarn:@fm:'' )
|
|
Message = 'You have ONE MINUTE to save your work and log out...'
|
|
Void = start_window( 'LOG_CHECK_WARN', AppMain, '*CENTER', '', '' )
|
|
Void = set_property( 'LOG_CHECK_WARN.MSG', 'TEXT', Message )
|
|
Void = utility( 'BEEP' )
|
|
case Level = 5
|
|
Void = send_event( AppMain, 'CLOSE' )
|
|
case Otherwise$
|
|
* bad paramater do zipoid
|
|
end case
|
|
return 0
|
|
|