source: trunk/guitools/smbmon/smbmon.vrx @ 925

Last change on this file since 925 was 925, checked in by Herwig Bauernfeind, 4 years ago

GUITools: EVFSGUI: more client settings, SMBMON: made rpm/yum aware, cosmetics

File size: 90.0 KB
Line 
1/*:VRX         Main
2*/
3/*  Main
4*/
5Main:
6/*  Process the arguments.
7    Get the parent window.
8*/
9    parse source . calledAs .
10    parent = ""
11    argCount = arg()
12    argOff = 0
13    if( calledAs \= "COMMAND" )then do
14        if argCount >= 1 then do
15            parent = arg(1)
16            argCount = argCount - 1
17            argOff = 1
18        end
19    end; else do
20        call VROptions 'ImplicitNames'
21        call VROptions 'NoEchoQuit'
22    end
23    InitArgs.0 = argCount
24    if( argCount > 0 )then do i = 1 to argCount
25        InitArgs.i = arg( i + argOff )
26    end
27    drop calledAs argCount argOff
28
29/*  Load the windows
30*/
31    call VRInit
32    parse source . . spec
33    _VREPrimaryWindowPath = ,
34        VRParseFileName( spec, "dpn" ) || ".VRW"
35    _VREPrimaryWindow = ,
36        VRLoad( parent, _VREPrimaryWindowPath )
37    drop parent spec
38    if( _VREPrimaryWindow == "" )then do
39        call VRMessage "", "Cannot load window:" VRError(), ,
40            "Error!"
41        _VREReturnValue = 32000
42        signal _VRELeaveMain
43    end
44
45/*  Process events
46*/
47    call Init
48    signal on halt
49    do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
50        _VREEvent = VREvent()
51        interpret _VREEvent
52    end
53_VREHalt:
54    _VREReturnValue = Fini()
55    call VRDestroy _VREPrimaryWindow
56_VRELeaveMain:
57    call VRFini
58exit _VREReturnValue
59
60VRLoadSecondary:
61    __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
62    if __vrlsWait then do
63        call VRFlush
64    end
65    __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
66    if __vrlsHWnd = '' then signal __vrlsDone
67    if __vrlsWait \= 1 then signal __vrlsDone
68    call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
69    __vrlsTmp = __vrlsWindows.0
70    if( DataType(__vrlsTmp) \= 'NUM' ) then do
71        __vrlsTmp = 1
72    end
73    else do
74        __vrlsTmp = __vrlsTmp + 1
75    end
76    __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
77    __vrlsWindows.0 = __vrlsTmp
78    do while( VRIsValidObject( VRWindow() ) = 1 )
79        __vrlsEvent = VREvent()
80        interpret __vrlsEvent
81    end
82    __vrlsTmp = __vrlsWindows.0
83    __vrlsWindows.0 = __vrlsTmp - 1
84    call VRWindow __vrlsWindows.__vrlsTmp
85    __vrlsHWnd = ''
86__vrlsDone:
87return __vrlsHWnd
88
89/*:VRX         __VXREXX____APPENDS__
90*/
91__VXREXX____APPENDS__:
92/*
93#append U:\Develop\Samba\trunk\guitools\shared\inittempdir.vrs
94#append U:\Develop\Samba\trunk\guitools\shared\sambainit.vrs
95#append U:\Develop\Samba\trunk\guitools\shared\nlv.vrs
96#append U:\Develop\Samba\trunk\guitools\shared\smbtree.vrs
97*/
98return
99/*:VRX         _ChkTDB
100*/
101_ChkTDB:
102
103ok = SysFileTree(etc'\samba\lock\*.TDB',tdb.,'FO')
104say etc'\samba\lock\*.TDB  'tdb.0
105
106error = 0
107ok = VRMethod("CN_CHKTDB", "RemoveRecord", "ALL")
108
109RecHandleArray.0 = 0
110ok = VRSet("CN_CHKTDB", "Painting", 0)
111
112do I = 1 to tdb.0
113    RecHandleArray.I = VRMethod("CN_CHKTDB", "Addrecord")
114end
115ok = VRSet("CN_CHKTDB", "Painting", 1)
116
117/* ok = VRSet("CN_CHKTDB", "Painting", 0) */
118
119do I = 1 to tdb.0
120    RecHandle = RecHandleArray.I
121    TDBFile =left(filespec('N',tdb.I), 22)
122    TDBSize = stream(tdb.I,'c','query size')
123    ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBFilesFH, TDBFile, ChkTDBIconFH, "$50", ChkTDBSizeFH, TDBSize||" Bytes" )
124    address cmd '@tdbtool 'tdb.I' check 2>'tdb.I'.err 1>'tdb.I'.out'
125    out = linein(tdb.I'.out')
126    ok = stream(tdb.I'.out','c','close')
127    say out
128    if pos('integrity is OK',out) > 0 then do /* integrity is ok */
129        ok = SysFileDelete(tdb.I'.err')
130        ok = SysFileDelete(tdb.I'.out')
131        out = left(out,length(out)-1)
132        TDBRecords = substr(out, pos("and has", out) + 7,)
133        ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBStatusFH, TDBRecords )
134
135        address cmd '@tdbbackup -s.bak 'tdb.I' 2>NUL 1>NUL'
136    end
137    else do /* tdb error */
138        ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBIconFH, "$51" )
139        error = 1
140        count = 0
141        out = ""
142        do while lines(tdb.I'.err') > 0 & count < 5
143            errline = linein(tdb.I'.err')
144            select
145                /* skip unnecessary lines of log */
146                when pos("bww ",errline) > 0 then iterate
147                when pos("fcntl",errline) > 0 then iterate
148                otherwise do
149                    out = out||errline'. '
150                    count = count + 1
151                end
152            end
153        end
154        ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBStatusFH, out )
155        ok = VRSet("CN_CHKTDB", "Painting", 1)
156        ok = VRSet("CN_CHKTDB", "Painting", 0)
157
158        ok = stream(tdb.I'.err','c','close')
159    end
160
161/*
162    call charout , left(filespec('N',tdb.I), 22)
163    address cmd '@tdbtool 'tdb.I' check 2>'tdb.I'.err 1>'tdb.I'.out'
164    out = linein(tdb.I'.out')
165    ok = stream(tdb.I'.out','c','close')
166    say out
167    if pos('integrity is OK',out) = 0 then do
168        call beep 880, 20
169        address cmd '@tdbbackup -s.bak -v 'tdb.I' 2>NUL 1>NUL'
170        error = 1
171        count = 0
172        do while lines(tdb.I'.err') > 0 & count < 5
173            errline = linein(tdb.I'.err')
174            select
175                /* skip unnecessary lines of log */
176                when pos("bww ",errline) > 0 then iterate
177                when pos("fcntl",errline) > 0 then iterate
178                otherwise do
179                    say right(copies(' ',22)'Cause: 'errline'!',min(length(errline)+22,79))
180                    count = count + 1
181                end
182            end
183        end
184        ok = stream(tdb.I'.err','c','close')
185    end
186    else do
187        ok = SysFileDelete(tdb.I'.err')
188        ok = SysFileDelete(tdb.I'.out')
189        address cmd '@tdbbackup -s.bak 'tdb.I' 2>NUL 1>NUL'
190    end */
191end
192
193ok = VRSet("CN_CHKTDB", "Painting", 1)
194
195return
196
197/*:VRX         _ColumnShow
198*/
199_ColumnShow:
200    userdata = VRGet(VRInfo("Object"),"Userdata")
201    parse var userdata Container '|' fieldh '|' VisStatus
202say userdata
203    ok = VRMethod(Container,"SetFieldAttr", fieldh, "Visible", \VisStatus )
204return
205
206/*:VRX         _ColumnsMenu
207*/
208_ColumnsMenu:
209    Container = arg(1)
210    ok = VRMethod(Container, "GetFieldList", "Fields." )
211
212    do I = 1 to 14
213        R2I = right("0"||I,2)
214        if I <= fields.0 then do
215/*          say "Columns_"||R2I' 'VRMethod(Container, "GetFieldAttr", fields.I, "Title" ) */
216            ok = VRset("Columns_"||R2I, "Visible", 1)
217            ok = VRset("Columns_"||R2I, "Caption", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
218            ok = VRset("Columns_"||R2I, "Checked", VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
219            ok = VRset("Columns_"||R2I, "Userdata", Container'|'fields.I'|'VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
220        end
221        else ok = VRset("Columns_"||R2I, "Visible", 0)
222    end
223    ok = VRMethod( "Columns", "Popup", , , "", "" )   
224return
225
226/*:VRX         _ContainerInit
227*/
228_ContainerInit:
229    say '_ContainerInit() started.'
230
231    /* Users */
232    UIconH     = VRMethod( "CN_Users", "AddField", "Icon",   NLVGetMessage(148) )
233    UsernameFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(131) )
234    GroupFH    = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(132) )
235    UMachineFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(133) )
236    UIPAdrFH   = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(147) )
237    UPIDFH     = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(130) ) 
238
239    /* Files */
240    FIconH     = VRMethod( "CN_Files", "AddField", "Icon",   NLVGetMessage(148) )
241    FileFH     = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(134) )
242    FUserFH    = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(131) )
243    FPIDFH     = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(130) )
244    DenyModeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(135) )
245    TimeFH     = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(136) )
246    DateFH     = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(149) )
247    AccessFH   = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(137) )
248    RWFH       = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(138) )
249    OplockFH   = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(139) )
250    UIDFH      = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(140) )
251    SharePathFH= VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(141) )
252    NameFH     = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(142) )
253
254    /* Service */
255    SIconH     = VRMethod( "CN_Service", "AddField", "Icon",   NLVGetMessage(148) )
256    SPIDFH     = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(130) )
257    ServiceFH  = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(143) )
258    SMachineFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(133) )
259    ConnectedFH= VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(144) )
260
261    /* Daemons */
262    DaemonFH   = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(145) )
263    DStatusFH  = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(146) )
264    DPidsFH    = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(130) )
265
266    smbdHandle = VRMethod("CN_Daemons", "Addrecord",, ,"smbd.exe","$41")
267    nmbdHandle = VRMethod("CN_Daemons", "Addrecord", ,,"nmbd.exe","$41")
268    winbHandle = VRMethod("CN_Daemons", "Addrecord",, ,"winbindd.exe","$41")
269
270    ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DaemonFH, "smbd.exe")
271    ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DaemonFH, "nmbd.exe")
272    ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DaemonFH, "winbindd.exe")
273    ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
274    ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
275    ok = VRMethod("CN_Daemons", "SetRecordAttr","All", "Collapsed", 0 )
276
277
278    /* SMBTree */
279    WorkgroupFH = VRMethod( "CN_smbtree", "AddField", "String", NLVGetMessage(150)  )
280    NBFH        = VRMethod( "CN_smbtree", "AddField", "String", "NetBIOS name" )
281    IpFH        = VRMethod( "CN_smbtree", "AddField", "String",  NLVGetMessage(147)  )
282    MBFH        = VRMethod( "CN_smbtree", "AddField", "String", "DMB/LMB" )   
283    OSFH        = VRMethod( "CN_smbtree", "AddField", "String", "OS" )
284 /* VersionFH   = VRMethod( "CN_SmbTree", "AddField", "String", "Version" ) */
285    CommentFH   = VRMethod( "CN_smbtree", "AddField", "String", NLVGetMessage(151) )
286    MacFH       = VRMethod( "CN_smbtree", "AddField", "String", "MAC" )
287
288    ok = VRMethod("CN_smbtree","SetfieldAttr",IPFH,       "ReadOnly", 1)
289    ok = VRMethod("CN_smbtree","SetfieldAttr",NBFH,       "ReadOnly", 1)
290    ok = VRMethod("CN_smbtree","SetfieldAttr",MBFH,       "ReadOnly", 1)
291    ok = VRMethod("CN_smbtree","SetfieldAttr",WorkGroupFH,"ReadOnly", 1)
292    ok = VRMethod("CN_smbtree","SetfieldAttr",OSFH,       "ReadOnly", 1)
293    ok = VRMethod("CN_smbtree","SetfieldAttr",MacFH,      "ReadOnly", 1)
294
295    /* ChkTdb */
296    ChkTDBFilesFH = VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(134) )
297    ChkTDBIconFH  = VRMethod( "CN_CHKTDB", "AddField", "Icon",   NLVGetMessage(146) )
298    ChkTDBSizeFH  = VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(152) )
299    ChkTDBStatusFH= VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(151) )
300
301    ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBIconFH,   "Justification","Center", "ReadOnly", 1)
302    ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBSizeFH,   "Justification","Right",  "ReadOnly", 1)
303    ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBStatusFH, "Justification","Right",  "ReadOnly", 1)
304
305    say '_ContainerInit() done.'
306return
307/*:VRX         _ContainerSort
308*/
309_ContainerSort:
310    ok = VRMethod( "LB_SortFields", "GetSelectedList", "SortFields." )
311    if Fields.0 = 0 then return
312    idx = SortFields.1
313    ok = VRset( Container, "DetailSort", Fields.idx )
314    ok = VRSet( Container, "Sort", SortOrder )
315    ok = VRMethod( Container, "SortRecords" )
316return
317
318/*:VRX         _CreateSmbStarter
319*/
320_CreateSmbStarter:
321ok = SysFileDelete(samba.!bin'\smbstarter.cmd')
322call lineout samba.!bin'\smbstarter.cmd', '/* REXX */'
323call lineout samba.!bin'\smbstarter.cmd', 'signal on failure name CLEANUP'
324call lineout samba.!bin'\smbstarter.cmd', 'signal on halt name CLEANUP'
325call lineout samba.!bin'\smbstarter.cmd', 'signal on syntax name CLEANUP'
326call lineout samba.!bin'\smbstarter.cmd', 'say "Samba Server Starter"'
327call lineout samba.!bin'\smbstarter.cmd', 'address cmd "@echo off"'
328call lineout samba.!bin'\smbstarter.cmd', 'home:'
329call lineout samba.!bin'\smbstarter.cmd', 'select'
330call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("smbstart") then do'
331call lineout samba.!bin'\smbstarter.cmd', 'say "Start"'
332call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd start"'
333call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("smbstart")'
334call lineout samba.!bin'\smbstarter.cmd', 'end'
335call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("smbstop") then do'
336call lineout samba.!bin'\smbstarter.cmd', 'say "Stop"'
337call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd stop"'
338call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("smbstop")'
339call lineout samba.!bin'\smbstarter.cmd', 'end'
340call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("restart") then do'
341call lineout samba.!bin'\smbstarter.cmd', 'say "Restart"'
342call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd restart"'
343call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("restart")'
344call lineout samba.!bin'\smbstarter.cmd', 'end'
345call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("reload") then do'
346call lineout samba.!bin'\smbstarter.cmd', 'say "Reload"'
347call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd reload"'
348call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("reload")'
349call lineout samba.!bin'\smbstarter.cmd', 'end'
350call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("quit") then do'
351call lineout samba.!bin'\smbstarter.cmd', 'say "Quit"'
352call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("quit")'
353call lineout samba.!bin'\smbstarter.cmd', 'signal cleanup'
354call lineout samba.!bin'\smbstarter.cmd', 'end'
355call lineout samba.!bin'\smbstarter.cmd', 'otherwise nop'
356call lineout samba.!bin'\smbstarter.cmd', 'end'
357call lineout samba.!bin'\smbstarter.cmd', 'ok = SysSleep(1)'
358call lineout samba.!bin'\smbstarter.cmd', 'signal home'
359call lineout samba.!bin'\smbstarter.cmd', 'cleanup:'
360call lineout samba.!bin'\smbstarter.cmd', 'say "Aborting..."'
361call lineout samba.!bin'\smbstarter.cmd', 'exit'
362ok = stream(samba.!bin'\smbstarter.cmd','c','close')
363
364Setup = 'NOPRINT=YES;DEFAULTVIEW=RUNNING;'||,
365        'EXENAME='samba.!bin'\smbstarter.cmd;'||,
366        'STARTUPDIR='samba.!bin';'||,
367        'TITLE=;'||,
368        'PROGTYPE=WINDOWABLEVIO;'||,
369        'MINIMIZED=YES;'||,
370        'VISIBLE=NO;'||,
371        'NOAUTOCLOSE=NO;'||,
372        'OBJECTID=<smbstarter>'
373
374rc = SysCreateObject('WPProgram', 'SMBSTARTER', '<WP_NOWHERE>', Setup, 'UPDATE' )
375If rc <> 1 Then Say ' > failed to create SMBSTARTER Object'
376else ok = SysOpenObject('<smbstarter>', 'DEFAULT', 1)
377
378
379return
380
381/*:VRX         _GuessIcon
382*/
383_GuessIcon: procedure
384    text = arg(1)
385    select /* Printer guessing */
386        when pos('LJ',text)      > 0 then res = '#65:PMWP.DLL'
387        when pos('LASER',text)   > 0 then res = '#65:PMWP.DLL'
388        when pos('EPSON',text)   > 0 then res = '#65:PMWP.DLL'
389        when pos('PRINT',text)   > 0 then res = '#65:PMWP.DLL'
390        when pos('PRT',text)     > 0 then res = '#65:PMWP.DLL'
391        when pos('CANON',text)   > 0 then res = '#65:PMWP.DLL'
392        when pos('MINOLTA',text) > 0 then res = '#65:PMWP.DLL'
393        when pos('FAX',text)     > 0 then res = '#65:PMWP.DLL'
394        when pos('LEXMARK',text) > 0 then res = '#65:PMWP.DLL'
395        when pos('IPC$',text)    > 0 then res = '#59:PMWP.DLL'
396        otherwise res = "#34:PMWP.DLL"
397    end
398return res
399
400/*:VRX         _GUIInit
401*/
402_GUIInit:
403    IF options.!debug == 1 then say time()' _GUIInit() started'
404
405    if datatype(Top) = 'NUM' then do
406        ok = VRset("Main","Top",Top)
407        ok = VRset("Main","Left",Left)
408        ok = VRset("Main","Width",Width)
409        ok = VRset("Main","Height",Height)
410    end
411
412    ok = VRSet("Main",        "Font", Font.!Main)
413    ok = VRSet("DT_StatusBar","Font", Font.!Status)
414    ok = VRSet("SW_Users",    "Font", Font.!Users)
415    ok = VRSet("SW_Files",    "Font", Font.!Files)
416    ok = VRSet("SW_Service",  "Font", Font.!Service)
417    ok = VRSet("SW_Daemons",  "Font", Font.!Daemons)
418    ok = VRSet("SW_SMBTree",  "Font", Font.!SMBTree)
419    ok = VRSet("SW_Settings", "Font", Font.!Settings)
420
421    ok = VRSet("CN_Users",    "Font", Font.!Users)
422    ok = VRSet("CN_Files",    "Font", Font.!Files)
423    ok = VRSet("CN_Service",  "Font", Font.!Service)
424    ok = VRSet("CN_Daemons",  "Font", Font.!Daemons)
425    ok = VRSet("CN_SMBTree",  "Font", Font.!SMBTree)
426
427    CALL NLVSetText 'DT_Refresh',      'Caption',  25
428    CALL NLVSetText 'DT_RefreshMin',   'Caption',  25
429    CALL NLVSetText 'DT_Intervall',    'Caption',  26
430    ok = VRSet("DT_IntervallMin",      "Caption", NLVGetMessage(26)' 'NLVGetMessage(28))
431    CALL NLVSetText 'CB_NoMsgBox',     'Caption',  27
432    CALL NLVSetText 'CB_WPSSTARTSTOP', 'Caption',  29
433    CALL NLVSetText 'CB_DetectZombies','Caption',  30
434
435    CALL NLVSetText 'ContextMenu_Daemons_Sort',   'Caption', 35
436    CALL NLVSetText 'ContextMenu_Daemons_Ping',   'Caption', 32
437    CALL NLVSetText 'ContextMenu_Daemons_Details','Caption', 118
438    CALL NLVSetText 'ContextMenu_Daemons_Tree',   'Caption', 120
439
440    CALL NLVSetText 'ContextMenu_Files_Sort',     'Caption', 35
441
442    CALL NLVSetText 'ContextMenu_Service_Sort',   'Caption', 35
443    CALL NLVSetText 'ContextMenu_Service_CloseSHare', 'Caption', 70
444
445    CALL NLVSetText 'ContextMenu_Users_SendMsg', 'Caption', 80
446    CALL NLVSetText 'ContextMenu_Users_Sort',    'Caption', 35   
447
448    CALL NLVSetText 'ContextMenu_Tree_SendMsg',  'Caption', 80
449    CALL NLVSetText 'ContextMenu_Tree_Sort',     'Caption', 35   
450    CALL NLVSetText 'ContextMenu_Tree_Tree',     'Caption', 120
451    CALL NLVSetText 'ContextMenu_Tree_Details',  'Caption', 118
452
453    Buttonwidth = VRMethod( "Screen", "PixelsToTwips", 32 )
454
455    ok = VRSet("SPIN_Intervall",   "Value", Intervall)
456    ok = VRSet("SPIN_IntervallMin","Value", IntervallMin)
457    ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
458   
459    ok = VRSet("PB_START",  "Enabled", VRFileExists(samba.!smbcmd))
460    ok = VRSet("PB_Restart","Enabled", VRFileExists(samba.!smbcmd))
461    ok = VRSet("PB_Reload", "Enabled", VRFileExists(samba.!smbcmd))
462
463    ok = VRSet("CN_Daemons",      "View", DaemonView)
464    ok = VRSet("CN_smbtree",      "View", TreeView)
465    ok = VRSet("CB_NoMsgBox",     "Set",  NoMsgBox)
466    ok = VRSet("CB_WPSStartStop", "Set",  WPSStartStop)
467    ok = VRSet("CB_DetectZombies","Set",  DetectZombies)
468
469    call _INILayoutRead "CN_Users"
470    call _INILayoutRead "CN_Files"
471    call _INILayoutRead "CN_Service"
472    call _INILayoutRead "CN_Daemons"
473    call _INILayoutRead "CN_smbtree"
474
475    ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons)
476    ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
477    ok = VRset("ContextMenu_Tree_MiniIcons",  "Checked", \advanced.!bigicons)
478    ok = VRset("ContextMenu_Daemons_MiniIcons",  "Checked", \advanced.!bigicons)
479    ok = VRSet("CB_Debug","set",options.!Debug)
480
481    if _ChkTempFreeSpace() < 262144 then do
482        Msg.Type = "W"
483        Msg.Text = NLVGetMessage(116, TempDir)
484        call _ShowMsg
485    end
486
487    /* Common margin around controls */
488    margin = ((VRGet("Main", "InteriorLeft") / 3) * 2) + 2
489
490    /* Statusbar */
491    ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
492
493    call Main_Resize
494
495   
496    ok = VRSet("Main", "Visible", 1)
497    IF options.!debug == 1 then say time()' _GUIInit() done'
498return
499
500/*:VRX         _INILayoutRead
501*/
502_INILayoutRead:
503    Container = arg(1)
504    ok = VRMethod(Container, "GetFieldList", "Fields." )
505    Layout = VRGetIni( "Layout", Container,  OurINI )
506    if Layout = "" then return
507    do I = 1 to Fields.0
508        ok = VRMethod(Container, "SetFieldAttr", fields.I,"Visible", substr(Layout,I,1))
509    end
510return
511
512/*:VRX         _INILayoutWrite
513*/
514_INILayoutWrite:
515    Container = arg(1)
516    ok = VRMethod(Container, "GetFieldList", "Fields." )
517    Layout = ""
518    do I = 1 to fields.0
519        Layout = Layout||VRMethod(Container, "GetFieldAttr", fields.I, "Visible" )       
520    end
521    ok = VRSetIni( "Layout", Container , Layout, OurINI, 'NoClose' )
522return
523
524/*:VRX         _INIRead
525*/
526_INIRead:
527    IF options.!debug == 1 then say time()' _INIRead() started'
528
529    OurINI = strip(VRParseFileName(VRget("Application","Program"),'DP')'\SMBSTATUS.INI',,'\')
530    ok = SysFileTree(OurINI, INIFound.,'FO')
531    if INIFound.0 = 1 then OurINI = VRParseFileName(INIFound.1,'DPNE')
532    IF options.!debug == 1 then say '  OurINI='OurINI
533
534    Top   = VRGetIni( "Pos", "Top",    OurINI , 'NoClose')
535    Left  = VRGetIni( "Pos", "Left",   OurINI , 'NoClose')
536    Width = VRGetIni( "Pos", "Width",  OurINI , 'NoClose')
537    Height= VRGetIni( "Pos", "Height", OurINI , 'NoClose')
538
539    Font.!Users   = VRGetIni( "Fonts", "SW_USERS",    OurINI , 'NoClose' )
540    Font.!Files   = VRGetIni( "Fonts", "SW_FILES",    OurINI , 'NoClose' )
541    Font.!Service = VRGetIni( "Fonts", "SW_SERVICE",  OurINI , 'NoClose' )
542    Font.!Daemons = VRGetIni( "Fonts", "SW_DAEMONS",  OurINI , 'NoClose' )
543    Font.!SMBTree = VRGetIni( "Fonts", "SW_SMBTREE",  OurINI , 'NoClose' )
544    Font.!Settings= VRGetIni( "Fonts", "SW_SETTINGS", OurINI , 'NoClose' )
545    Font.!Main    = VRGetIni( "Fonts", "Main",        OurINI , 'NoClose' )
546    Font.!Status  = VRGetIni( "Fonts", "Statusfont",  OurINI , 'NoClose' )
547
548    if Font.!Users    = "" then Font.!Users    = "9.WarpSans"
549    if Font.!Files    = "" then Font.!Files    = "9.WarpSans"
550    if Font.!Service  = "" then Font.!Service  = "9.WarpSans"
551    if Font.!Daemons  = "" then Font.!Daemons  = "9.WarpSans"
552    if Font.!SMBTree  = "" then Font.!SMBTree  = "9.WarpSans"
553    if Font.!Settings = "" then Font.!Settings = "9.WarpSans"
554    if Font.!Main     = "" then Font.!Main     = "9.WarpSans"
555    if Font.!Status   = "" then Font.!Status   = "9.WarpSans"
556
557    Intervall = VRGetIni( "Settings", "Intervall", OurINI,'NoClose')
558    if Intervall = "" then Intervall = 60
559
560    IntervallMin = VRGetIni( "Settings", "IntervallMin", OurINI,'NoClose')
561    if IntervallMin = "" then IntervallMin = 180
562
563    CurrentPageNr = VRGetIni( "Settings", "CurrentPageNr", OurINI,'NoClose')
564    if CurrentPageNr = "" then CurrentPageNr = 4
565
566    DaemonView = VRGetIni( "Settings", "DaemonView", OurINI,'NoClose')
567    if DaemonView = "" then DaemonView = "Detail"
568
569    TreeView = VRGetIni( "Settings", "TreeView", OurINI,'NoClose')
570    if TreeView = "" then TreeView = "IconTree"
571
572    NoMsgBox = VRGetIni( "Settings", "NoMsgBox", OurINI,'NoClose')
573    if NoMsgBox = "" then NoMsgBox = 1
574
575    WPSStartStop = VRGetIni( "Settings", "WPSStartStop", OurINI,'NoClose')
576    if WPSStartStop = "" then WPSStartStop = 1
577
578    DetectZombies = VRGetIni( "Settings", "DetectZombies", OurINI,'NoClose')
579    if DetectZombies = "" then DetectZombies = 0
580
581    options.!debug = VRGetIni( "Options", "Debug", OurINI)
582    if options.!debug = "" then options.!debug = 0
583
584    if options.!Debug then ok = VRRedirectStdIO("ON")
585                      else ok = VRRedirectStdIO("OFF")
586
587    advanced.!bigicons = VRGetIni( "Settings", "BigIcons", OurINI)
588    if advanced.!bigicons = "" then advanced.!bigicons = 0
589
590    /* For Browse page */
591    FirstRun = 1
592    /* For Users page in case connections.tdb is not initialised */
593    IgnoreSmbNoInit = 1
594
595    /* For Refresh tree display code */
596    RefreshMode =""
597
598    smbdpidhandle.0 = 0
599    nmbdpidhandle.0 = 0
600    winbpidhandle.0 = 0
601
602    prevsmbdct = 0
603    prevnmbdct = 0
604    prevwinbct = 0
605
606    smbdoutput = TempDir'smbd.out'
607    IF options.!debug == 1 then say time()' _INIRead() done'
608return
609
610/*:VRX         _INIWrite
611*/
612_INIWrite:
613    IF options.!debug == 1 then say time()' _INIWrite() started'
614    ok = VRSetIni( "Pos", "Top",          VRGet("Main","Top"),         OurINI, 'NoClose' )
615    ok = VRSetIni( "Pos", "Left",         VRGet("Main","Left"),        OurINI, 'NoClose' )
616    ok = VRSetIni( "Pos", "Width",        VRGet("Main","Width"),       OurINI, 'NoClose' )   
617    ok = VRSetIni( "Pos", "Height",       VRGet("Main","Height"),      OurINI, 'NoClose' )
618
619    ok = VRSetIni( "Settings", "Intervall",    VRGet("SPIN_Intervall","Value"),OurINI,'NoClose')
620    ok = VRSetIni( "Settings", "IntervallMin", VRGet("SPIN_IntervallMin","Value"),OurINI,'NoClose')
621    ok = VRSetIni( "Settings", "CurrentPageNr",CurrentPageNr,                  OurINI,'NoClose')
622    ok = VRSetIni( "Settings", "DaemonView",   VRGet("CN_Daemons","View"),     OurINI,'NoClose')
623    ok = VRSetIni( "Settings", "TreeView",     VRGet("CN_smbtree","View"),     OurINI,'NoClose')
624    ok = VRSetIni( "Settings", "NoMsgBox",     NoMsgBox,                       OurINI,'NoClose')
625    ok = VRSetIni( "Settings", "WPSStartStop", WPSStartStop,                   OurINI,'NoClose')
626    ok = VRSetIni( "Settings", "BigIcons",     \VRGet("CN_SMBTREE", "MiniIcons"),OurINI,'NoClose')
627    ok = VRSetIni( "Settings", "DetectZombies",DetectZombies,                  OurINI,'NoClose')
628
629    ok = VRSetIni( "Options",  "Debug",    options.!debug,             OurINI, 'NoClose' )     
630
631    call _INILayoutWrite "CN_Users"
632    call _INILayoutWrite "CN_Files"
633    call _INILayoutWrite "CN_Service"
634    call _INILayoutWrite "CN_Daemons"
635    call _INILayoutWrite "CN_smbtree"
636
637    if VRGet("CN_USERS",   "Font") <> "<default>" then ok = VRSet("SW_USERS",  "Font", VRGet("CN_USERS",  "Font"))
638    if VRGet("CN_FILES",   "Font") <> "<default>" then ok = VRSet("SW_FILES",  "Font", VRGet("CN_FILES",  "Font"))
639    if VRGet("CN_SERVICE", "Font") <> "<default>" then ok = VRSet("SW_SERVICE","Font", VRGet("CN_SERVICE","Font"))
640    if VRGet("CN_DAEMONS", "Font") <> "<default>" then ok = VRSet("SW_DAEMONS","Font", VRGet("CN_DAEMONS","Font"))
641    if VRGet("CN_SMBTREE", "Font") <> "<default>" then ok = VRSet("SW_SMBTREE","Font", VRGet("CN_SMBTREE","Font"))
642     
643    ok = VRSetIni( "Fonts", "SW_USERS",   VRGet("SW_USERS",   "Font"), OurINI, 'NoClose' )
644    ok = VRSetIni( "Fonts", "SW_FILES",   VRGet("SW_FILES",   "Font"), OurINI, 'NoClose' )
645    ok = VRSetIni( "Fonts", "SW_SERVICE", VRGet("SW_SERVICE", "Font"), OurINI, 'NoClose' )
646    ok = VRSetIni( "Fonts", "SW_DAEMONS", VRGet("SW_DAEMONS", "Font"), OurINI, 'NoClose' )
647    ok = VRSetIni( "Fonts", "SW_SMBTREE", VRGet("SW_SMBTREE", "Font"), OurINI, 'NoClose' )
648    ok = VRSetIni( "Fonts", "SW_SETTINGS",VRGet("SW_SETTINGS","Font"), OurINI, 'NoClose' )
649    ok = VRSetIni( "Fonts", "Statusfont", VRGet("DT_StatusBar","Font"),OurINI, 'NoClose' )
650    ok = VRSetIni( "Fonts", "Main",       VRGet("Main","Font"),        OurINI )
651    IF options.!debug == 1 then say time()' _INIWrite() done'
652return
653
654/*:VRX         _LoadotherFuncs
655*/
656_LoadotherFuncs:
657    IF options.!debug == 1 then say time()' _LoadotherFuncs() started'
658    SIGNAL ON SYNTAX NAME DLLMissing
659
660    call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
661    call SysLoadFuncs
662
663    call RxFuncAdd 'PRLoadFuncs',  'PR1UTIL', 'PRLoadFuncs'
664    call PRLoadFuncs
665
666    SIGNAL OFF SYNTAX
667    IF options.!debug == 1 then say time()' _LoadotherFuncs() done'
668return
669
670DLLMissing:
671    Fatal = 1
672    call VRMessage 'Main', 'REXX function library 'strip(translate(word(sourceline(SIGL-1),4),'  ',"',"))'.DLL is missing!', "EVFSGUI fatal error", "E"
673signal Quit
674/*:VRX         _MsgYesNo
675*/
676_MsgYesNo:
677    say "_MsgYesNo() started"
678    buttons.0 = 2
679    buttons.1 = NLVGetMessage(6)
680    buttons.2 = NLVGetMessage(7)
681    default = 2
682    buttons.default = NLVGetMessage(7)
683    esc = 2
684    buttons.esc = NLVGetMessage(7)
685    RC = VRMessage( VRWindow(), Msg.Text, Msg.Title,"Q","buttons.",default, esc )
686    say "_MsgYesNo() done, answer "RC
687return RC
688
689/*:VRX         _NLVSetup
690*/
691_NLVSetup:
692    settings.!messages = 1  /* language files exist(s) */
693    settings.!helpfile = "" /* helpfiles do not exist  */
694    settings.!nlv8dot3 = 0  /* NLV may have long filenames  */
695    call NLVSetup
696
697    Msg.Title = NLVGetMessage(1)
698    ok = VRSet("Main","helpFile", settings.!helpfile)
699
700    CALL NLVSetText 'PB_Refresh',  'Caption', 11
701    CALL NLVSetText 'PB_Cancel',   'Caption', 12
702    CALL NLVSetText 'PB_Help',     'Caption', 13
703    CALL NLVSetText 'PB_About',    'Caption', 14
704
705    CALL NLVSetText 'PB_Refresh',  'Hinttext', 51
706    CALL NLVSetText 'PB_Cancel',   'Hinttext', 54
707    CALL NLVSetText 'PB_Help',     'Hinttext', 52
708    CALL NLVSetText 'PB_About',    'Hinttext', 53
709
710/*  CALL NLVSetText 'TAB_1',       'Userdata', 15
711    CALL NLVSetText 'TAB_2',       'Userdata', 16
712    CALL NLVSetText 'TAB_3',       'Userdata', 17
713    CALL NLVSetText 'TAB_4',       'Userdata', 18
714    CALL NLVSetText 'TAB_5',       'Userdata', 19
715    CALL NLVSetText 'TAB_6',       'Userdata', 24
716
717    CALL NLVSetText 'TAB_1',       'Hinttext', 55
718    CALL NLVSetText 'TAB_2',       'Hinttext', 56
719    CALL NLVSetText 'TAB_3',       'Hinttext', 57
720    CALL NLVSetText 'TAB_4',       'Hinttext', 58
721    CALL NLVSetText 'TAB_5',       'Hinttext', 59
722    CALL NLVSetText 'TAB_6',       'Hinttext', 60 */
723
724/*  CALL NLVSetText 'Page_1',      'Hinttext', 55
725    CALL NLVSetText 'Page_2',      'Hinttext', 56
726    CALL NLVSetText 'Page_3',      'Hinttext', 57
727    CALL NLVSetText 'Page_4',      'Hinttext', 58
728    CALL NLVSetText 'Page_5',      'Hinttext', 59
729    CALL NLVSetText 'Page_6',      'Hinttext', 60  */
730
731
732return
733
734/*:VRX         _Refresh
735*/
736_Refresh:
737    IF options.!debug == 1 then say time()' _Refresh() started'
738    ok = VRSet("TM_refresh","Enabled", 0)
739    SmbNoInit = 0
740
741    refreshoutput = TempDir'refresh.out'
742    refresherr    = TempDir'refresh.err'
743
744    say '  'samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput
745    address cmd samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput
746
747    SambaVer = "Samba "||strip(linein(refreshoutput))
748    say '  smbd.exe:  "'SambaVer'"'
749    ok = stream(refreshoutput,'c','close')
750
751    say     '  'samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput
752    address cmd samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput
753
754    /* First line is usually empty */
755    Hdr      = linein(refreshoutput)
756    SambaStVer = strip(linein(refreshoutput)) /* we can detect version mismatches here */
757    say '  smbstatus: "'SambaStVer'"'
758
759    select
760        when pos('not initialised',SambaStVer) > 0 then do
761            SambaVer = SambaVer||" (Init)"
762            SmbNoInit = 1
763        end
764        when translate(SambaStVer) <> translate(SambaVer) then SambaVer = SambaVer||" (Hybrid)"
765        otherwise nop
766    end
767
768    Ok = VRSet("Main", "Caption", SambaVer' - 'NLVGetMessage(146))
769
770    /* Active User */
771    Hdr1 = linein(refreshoutput)
772/* say '  1:'hdr1 */
773    Hdr2 = linein(refreshoutput)
774/* say '  2:'hdr2 */
775    Zeile = linein(refreshoutput)
776    say '    'Zeile
777    if SmbNoInit then do
778        call lineout samba.!msg, SambaStVer
779        call lineout samba.!msg, Hdr1
780        call lineout samba.!msg, Hdr2
781        call lineout samba.!msg, Zeile
782        ok = stream(samba.!msg,'c','close')
783        if IgnoreSmbNoInit then do
784            call _SambaShowMsg
785            IgnoreSmbNoInit = 0
786        end
787    end
788
789    say '  SmbNoInit = 'SmbNoInit
790
791    /* Active users */
792    ok = VRSet("CN_Users","Painting", 0)
793    ok = VRMethod("CN_Users", "RemoveRecord", "ALL")
794    Username.0 = 0
795    IP.0 = 0
796    Group.0 = 0
797    I = 0
798    if \SmbNoInit then do
799        do while Zeile <> ''
800            parse var Zeile UPID Username Group Machine IP
801            I = I + 1
802            UPID.I = UPID
803            Username.I = Username
804            Group.I = Group
805            IP = strip(IP)
806            parse var IP '('IP.I')'
807            RecHandle = VRMethod("CN_Users", "Addrecord")
808            ok = VRMethod("CN_Users", "SetFieldData", RecHandle, UIconH, "$44", UPIDFH, UPID, UsernameFH, Username, GroupFH, Group, UMachineFH, Machine, UIPAdrFH, IP.I)
809            Zeile = linein(refreshoutput)
810        end   
811    end
812    Username.0 = I
813    Group.0 = I
814    UPID.0 = I
815    ok = VRSet("CN_Users","Painting", 1)
816
817    /* Active Services */
818    Hdr = linein(refreshoutput)
819    Hdr = linein(refreshoutput)
820    I = 0
821    Zeile = linein(refreshoutput)
822    ok = VRSet("CN_Service","Painting", 0)
823    ok = VRMethod("CN_Service", "RemoveRecord", "ALL")
824    do while Zeile <> ''
825        parse var Zeile Service SPId Machine Connected
826        I = I + 1
827        SPid.I = SPid
828        Machine.I = Machine
829        Service.I = Service
830        Icon = _GuessIcon(Service.I)
831
832        Connected = strip(Connected)
833        T. = ""
834        parse var Connected T.WDay T.Month T.DoM T.TimeoD T.Year
835        Connected = T.TimeoD', 'T.WDay' 'T.DoM' 'T.Month' 'T.Year
836
837        RecHandle = VRMethod("CN_Service", "Addrecord")
838        ok = VRMethod("CN_Service", "SetFieldData", RecHandle, SIconH, Icon, ServiceFH, Service, SPIDFH, SPID, SMachineFH, Machine, ConnectedFH, Connected)
839        Zeile = linein(refreshoutput)
840    end   
841    SPid.0    = I
842    Machine.0 = I
843    Service.0 = I
844
845    ok = VRSet("CN_Service","Painting", 1)
846
847    /* Open files */
848    Hdr = linein(refreshoutput)
849    Hdr = linein(refreshoutput)
850    Hdr = linein(refreshoutput)
851
852    Zeile = linein(refreshoutput)
853    ok = VRSet("CN_Files","Painting", 0)
854    ok = VRMethod("CN_Files", "RemoveRecord", "ALL")
855    File.0 = 0
856    FPID.0 = 0
857    do while Zeile <> ''
858        parse var Zeile FPid Uid DenyMode Access RW Oplock Sharepath Rest
859        TimeDate = right(rest,25)
860
861say 'Refreshcrash "'Rest'"'
862say 'Refreshcrash "'max(length(Rest)-25)'"'
863
864        Name = strip(left(Rest,max(length(Rest)-25,1)))
865        I = I + 1
866        sharepath = strip(translate(left(sharepath,1))||translate(substr(SharePath,2),'\','/'),'T','\')
867        Username = UID
868        do J = 1 to UPID.0
869            if FPID = UPID.J then do
870                Username = Username.J
871                leave
872            end
873        end
874        File = SharePath||'\'||translate(Name,'\','/')
875        File.I = File
876        FPID.I = FPID
877        TimeDate = strip(TimeDate)
878        say Timedate
879        T. = ""
880        parse var TimeDate T.WDay T.Month T.DoM T.TimeoD T.Year
881        FileTime = T.TimeoD
882        FileDate = T.WDay' 'T.DoM' 'T.Month' 'T.Year
883        RecHandle = VRMethod("CN_Files", "Addrecord")
884        ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FPidFH, FPid, FileFH, File, FUserFH, Username, UidFH, Uid, DenyModeFH, DenyMode,  AccessFH, Access, RWFH, RW)
885        ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FIconH, "$45", TimeFH, FileTime, DateFH, FileDate, OplockFH, Oplock, SharePathFH, Sharepath, NameFH, Name)
886        Zeile = linein(refreshoutput)
887    end   
888    File.0 = I
889    FPID.0 = I
890
891    ok = stream(refreshoutput, 'c','close')
892    ok = SysFileDelete(refreshoutput)
893    ok = stream(refresherr, 'c','close')
894    ok = SysFileDelete(refreshouterr)
895    if VRFileExists( samba.!bin"\smbsched.cmd" ) then do
896        address cmd samba.!bin"\smbsched.cmd"
897    end
898
899    call _RefreshDaemons
900    ok = VRSet("CN_Files","Painting", 1)
901    if VRGet("Main", "WindowState") = "Minimized" then do
902        ok = VRSet("TM_Refresh","Delay", IntervallMin * 1000)   
903    end
904    else do
905        ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
906    end
907    ok = VRSet("TM_refresh","Enabled", 1)
908
909    IF options.!debug == 1 then say time()' _Refresh() done'
910return
911/*:VRX         _RefreshDaemons
912*/
913_RefreshDaemons:
914    IF options.!debug == 1 then say time()' _RefreshDaemons() started'
915    ok = VRSet("TM_RefreshDaemons","Delay",3000)
916
917    ok = VRSet("CN_Daemons","Painting", 0 )
918    call VRSet VRWindow(), 'Pointer', 'Wait'
919
920    do I = 1 to smbdpidhandle.0
921        ok = VRMethod("CN_Daemons", "RemoveRecord", smbdpidhandle.I )
922    end
923
924    do I = 1 to nmbdpidhandle.0
925        ok = VRMethod("CN_Daemons", "RemoveRecord", nmbdpidhandle.I )
926    end
927
928    do I = 1 to winbpidhandle.0
929        ok = VRMethod("CN_Daemons", "RemoveRecord", winbpidhandle.I )
930    end
931
932    Running = _SambaRunning()
933
934    call VRSet VRWindow(), 'Pointer', '<default>'   
935
936    smbdpids = pids.!smbd
937    nmbdpids = pids.!nmbd
938    winbpids = pids.!nmbd
939
940    smbdRunning = running.!smbd
941    nmbdRunning = running.!nmbd
942    winbRunning = running.!winb
943
944    if smbdRunning then do
945        ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, smbdpids)
946        ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$46")
947        smbdpidhandle.0 = words(smbdpids)
948        if options.!debug = 1 then do
949            if smbdpidhandle.0 > prevsmbdct then do
950                prevsmbdct = smbdpidhandle.0
951                call beep 880*1, 10
952                call beep 880*2, 10
953                call beep 880*4, 10
954            end
955            if smbdpidhandle.0 < prevsmbdct then do
956                prevsmbdct = smbdpidhandle.0
957                call beep 880*4, 10
958                call beep 880*2, 10
959                call beep 880*1, 10
960            end
961        end
962
963        do I = 1 to words(smbdpids)
964            Username = ""
965            do J = 1 to UPID.0
966                if UPID.J = word(smbdpids,I) then do
967                    Username = ' 'Username.J
968                    leave
969                end
970            end
971            smbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", smbdhandle, , 'PID 'word(smbdpids,I)' ('d2x(word(smbdpids,I))'x)', "$48")
972            /* we ping all smbd.exe except the first one */
973            if DetectZombies = 1 & I > 1 then do
974                ok = VRSet("Main", 'Pointer', 'Wait' )
975                address cmd samba.!smbcontrolexe' 'word(smbdpids,I)' ping --timeout=2 --debuglevel=0 2>'samba.!error' 1>'samba.!msg
976                ok = VRSet("Main", 'Pointer', '<default>' )
977                response = linein(samba.!msg)
978                ok = stream(samba.!msg,'c','close')
979                if pos('PONG', response) = 0 then do /* we have a zombie */
980                    ok = VRMethod( "CN_Daemons", "SetRecordAttr", smbdpidhandle.I,"Icon", "$49")
981                    say "  Found Zombie "word(smbdpids,I)
982                end
983            end
984            if Username <> "" then do
985                smbdpidhandle.I.user = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I, , Username, "$44")
986                do J = 1 to FPID.0
987                    if FPID.J = word(smbdpids,I) then do
988                        dummyHandle = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I.user, , File.J, "$45")
989                    end
990                end
991            end
992        end
993    end
994    else do
995        ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
996        ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$47")
997        if options.!debug = 1 then do
998            if prevsmbdct > 0 then do
999                prevsmbdct = 0
1000                call beep 880*4, 10
1001                call beep 880*2, 10
1002                call beep 880*1, 10
1003            end
1004        end
1005    end
1006
1007    if nmbdRunning then do
1008        ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, nmbdpids)
1009        ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$46")
1010        nmbdpidhandle.0 = words(nmbdpids)
1011        do I = 1 to words(nmbdpids)
1012            nmbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", nmbdhandle, , 'PID 'word(nmbdpids,I)' ('d2x(word(nmbdpids,I))'x)', "$48")
1013        end
1014    end
1015    else do
1016        ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
1017        ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$47")
1018    end
1019
1020    if winbRunning then do
1021        ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(40), DPidsFH, winbpids)
1022        ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$46")
1023        winbpidhandle.0 = words(winbpids)
1024        do I = 1 to words(winbpids)
1025            winbpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", winbhandle, , 'PID 'word(winbpids,I)' ('d2x(word(winbpids,I))'x)', "$48")
1026        end
1027    end
1028    else do
1029        ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
1030        ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$47")
1031    end
1032
1033    if \(smbdrunning|nmbdrunning|winbrunning) then do
1034        ok = VRSet("PB_START",  "Enabled", 1)
1035        ok = VRSet("PB_STOP",   "Enabled", 0)
1036        ok = VRSet("PB_ReStart","Enabled", 0)
1037        ok = VRSet("PB_ReLoad", "Enabled", 0)
1038    end
1039    else do
1040        ok = VRSet("PB_START",  "Enabled", 0)
1041        ok = VRSet("PB_STOP",   "Enabled", 1)
1042        ok = VRSet("PB_ReStart","Enabled", 1)
1043        ok = VRSet("PB_ReLoad", "Enabled", 1)
1044    end
1045
1046    ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
1047    ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
1048    ok = VRSet("CN_Daemons","Painting", 1 )
1049    if Running then call _SambaUptime
1050
1051    IF options.!debug == 1 then say time()' _RefreshDaemons() done'
1052return
1053
1054/*
1055_pids: procedure
1056    pongfile = arg(1)
1057    pids = ''
1058    do until lines(pongfile) = 0
1059        pongline = linein(pongfile)
1060        if word(Pongline,1) = 'PONG' then do
1061            parse var pongline pong from tpid pid
1062            pids = pids||pid', '
1063        end
1064        else pids = pids||pongline
1065    end
1066    pids = strip(strip(pids),,',')
1067    ok = stream(pongfile,'c','close')
1068    ok = SysFileDelete(pongfile)
1069return pids
1070 */
1071
1072/*  pingout = 'ping.out'
1073    '@smbcontrol -t 2 smbd ping -d 0 1>'pingout
1074    if rc = 0 then smbdRunning = 1
1075    ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DPidsFH, _pids(pingout))
1076
1077    '@smbcontrol -t 2 nmbd ping -d 0 1>'pingout
1078    if rc = 0 then nmbdRunning = 1
1079    ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DPidsFH, _pids(pingout))
1080
1081    '@smbcontrol -t 1 winbindd ping -d 0 1>'pingout
1082    if rc = 0 then winbRunning = 1
1083    ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DPidsFH, _pids(pingout))
1084
1085    ok = SysFileDelete(PingOut)
1086*/
1087/*:VRX         _RefreshDaemonsDelay
1088*/
1089_RefreshDaemonsDelay:
1090    IF options.!debug == 1 then say time()' _RefreshDaemonsDelay() started'
1091    IF options.!debug == 1 then say "  Old intervall = "VRGet("TM_RefreshDaemons","Delay")
1092    ok = VRSet("TM_RefreshDaemons","Delay",   60000)
1093    IF options.!debug == 1 then say "  New Intervall = "VRGet("TM_RefreshDaemons","Delay")
1094    IF options.!debug == 1 then say time()' _RefreshDaemonsDelay() done'
1095return
1096
1097/*:VRX         _SambaFindPIDfile
1098*/
1099_SambaFindPIDfile:
1100    IF options.!debug == 1 then say time()' _SambaFindPIDfile() started'
1101
1102    ok = SysFileTree(ETC'\samba\pid\nmbd*pid',nmbdpid.,'FO')
1103    if nmbdpid.0 = 1
1104        then nmbdpidfile = nmbdpid.1;
1105        else nmbdpidfile = ""
1106
1107    IF options.!debug == 1 then say "  nmbdpidfile = "nmbdpidfile
1108
1109    IF options.!debug == 1 then say time()' _SambaFindPIDfile() done'
1110return
1111
1112/*:VRX         _SambaShowError
1113*/
1114_SambaShowError: procedure expose samba. settings. options.
1115    I = 0
1116    do while lines(samba.!error) <> 0
1117        I = I + 1
1118        smberr.I = linein(samba.!error)
1119    end
1120    ok = stream(Samba.!error,"c","close")
1121    smberr.0 = I
1122    Buttons.1 = "OK" /* NLVGetMessage(2) */
1123    Buttons.0 = 1
1124    id = VRMessageStem( VRWindow(), "smberr.", VRGet("Main", "Caption") , "Error", "Buttons.", buttons.1, buttons.1 )
1125    ok = SysFileDelete(Samba.!error)   
1126return
1127
1128/*:VRX         _SambaShowMsg
1129*/
1130_SambaShowMsg: procedure expose samba. settings. options.
1131    say "SambaShowMsg started"
1132    skipWords = arg(1)
1133    skip.0 = words(skipWords)
1134    do J = 1 to skip.0
1135        skip.J = translate(word(skipWords,J))
1136    end
1137    I = 0
1138    do while lines(samba.!msg) <> 0
1139        msgline = linein(samba.!msg)
1140        SkipIt = 0
1141        do J = 1 to skip.0
1142            if pos(skip.J,translate(msgline)) > 0 then do
1143                skipit = 1
1144                leave
1145            end
1146        end
1147        if \SkipIt then do
1148            I = I + 1
1149            smbmsg.I = strip(MsgLine)
1150        end
1151    end
1152    ok = stream(Samba.!msg,"c","close")
1153    say "  stream close "Samba.!msg" = "ok
1154    smbmsg.0 = I
1155    if smbmsg.0 > 0 then do
1156        Buttons.1 = "OK" /* NLVGetMessage(2) */
1157        Buttons.0 = 1
1158        id = VRMessageStem( VRWindow(), "smbmsg.", VRGet("Main", "Caption") , "I", "Buttons.", buttons.1, buttons.1 )
1159    end
1160    ok = SysFileDelete(Samba.!msg)
1161    say "  Delete "Samba.!msg" = "ok
1162    say "SambaShowMsg done"
1163return
1164/*:VRX         _SambaUptime
1165*/
1166_SambaUptime:
1167    IF options.!debug == 1 then say time()' _SambaUptime() started'
1168    call _SambaFindPIDfile
1169    if nmbdpidfile = "" then do
1170        ok = VRset("CN_Daemons", "Caption", NLVGetMessage(42)||" "||NLVGetMessage(41))
1171        return
1172    end
1173
1174    StartTime = SysGetFileDateTime(nmbdpidfile)
1175    if StartTime = -1 then return
1176
1177    NowTime   = substr(date('S'),1,4)'-'substr(date('S'),5,2)'-'substr(date('S'),7,2)' 'time()
1178
1179 /* StartTime = "2007-12-31 00:00:00"
1180    NowTime   = "2008-03-05 08:59:50" */
1181
1182    IF options.!debug == 1 then do
1183        say "  Start Time ='"StartTime"'"
1184        say "  Now   Time ='"NowTime"'"
1185    end
1186
1187    doM.0 = 12
1188    doM.1 = 31; doM.2 = 28; doM.3 = 31; doM.4 = 30; doM.5 = 31; doM.6 = 30;
1189    doM.7 = 31; doM.8 = 31; doM.9 = 30; doM.10= 31; doM.11= 30; doM.12= 31
1190
1191    parse var StartTime sY'-'sM'-'sD' 'sH':'sMi':'sS
1192    parse var NowTime nY'-'nM'-'nD' 'nH':'nMi':'nS
1193
1194    if nY//4 = 0 & nY//400 <> 0 then doM.2 = 29
1195
1196    /* say doM.2 */
1197
1198    uY =nY-sY
1199    uM =nM-sM
1200    uD =nD-sD
1201    uH =nH-sH
1202    uMi=nMi-sMi
1203    uS =nS-sS
1204
1205
1206
1207    if uS < 0 then do; uMi= uMi- 1; uS = uS + 60; end
1208    if uMi< 0 then do; uH = uH - 1; uMi= uMi+ 60; end
1209    if uH < 0 then do; uD = uD - 1; uH = uH + 24; end
1210    if uD < 0 then do;
1211        /* uM = uM - 1; */
1212        if uM < 0 then uMx = uM + 12; else uMx = uM
1213        uD = uD + doM.uMx - 1;
1214    end
1215    if uM < 0 then do; uY = uY - 1; uM = uM + 12; end
1216
1217    /* say uY uM uD uH uMi uS */
1218
1219    UpTimeStr = ' 'NlvGetMessage(43)':'
1220    if uY <> 0 then UpTimeStr = UpTimeStr' 'uY' 'NlvGetMessage(44)
1221    if uM <> 0 then UpTimeStr = UpTimeStr' 'uM' 'NlvGetMessage(45)
1222    if uD <> 0 then UpTimeStr = UpTimeStr' 'uD' 'NlvGetMessage(46)
1223    if uH <> 0 then UpTimeStr = UpTimeStr' 'uH' 'NlvGetMessage(47)
1224    if uMi<> 0 then UpTimeStr = UpTimeStr' 'uMi' 'NlvGetMessage(48)
1225    if uS <> 0 | UpTimeStr = ' 'NlvGetMessage(43)':' then UpTimeStr = UpTimeStr' 'uS' 'NlvGetMessage(49)
1226
1227    loggingfreespace = word(sysdriveinfo(left(samba.!log,2)),2)%1024%1024
1228
1229    ok = VRset("CN_Daemons", "Caption", UpTimeStr' 'loggingfreespace' MB')
1230
1231    select
1232        when loggingfreespace <  50 then ok = VRDeleteFile(samba.!log'\log.*')
1233        when loggingfreespace < 100 then ok = VRset("CN_Daemons","BackColor","Red")
1234        when loggingfreespace < 200 then ok = VRset("CN_Daemons","BackColor","Yellow")
1235        otherwise ok = VRset("CN_Daemons","BackColor","SystemWindow")       
1236    end
1237
1238    IF options.!debug == 1 then say time()' _SambaUptime() done'
1239return
1240
1241/*:VRX         _SendMsg
1242*/
1243_SendMsg:
1244    Buttons.1 = NLVGetMessage( 2 )
1245    Buttons.2 = NLVGetMessage( 3 )
1246    Buttons.0 = 2
1247    Message  = "Blurp!"
1248    id = VRPrompt( VRWindow(), NLVGetMessage( 85 , CurMachine), "Message", NLVGetMessage( 80 ), "Buttons.", buttons.1, buttons.2 )
1249
1250    MsgFile = SysTempFileName(TempDir'\smbmsg.'??? )
1251    call lineout MsgFile, Message
1252    ok = stream(MsgFile,'c','close')
1253say Message
1254    address cmd samba.!smbclientexe' --message='CurMachine' 'DebugLevel' <'MsgFile' 2>&1>'samba.!msg
1255    /* if rc <> 0 then call _SambaShowError; else */
1256    call _SambaShowMsg
1257    ok = SysFileDelete(MsgFile)
1258return
1259
1260/*:VRX         _ShowMsg
1261*/
1262_ShowMsg:
1263    Buttons.1 = NLVGetMessage(2)
1264    Buttons.0 = 1
1265    id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 )
1266return
1267
1268/*:VRX         _TabbedDialogSetup
1269*/
1270_TabbedDialogSetup:
1271    IF options.!debug == 1 THEN SAY time()' _TabbedDialogSetup started'
1272    w = VRLoad( "TDL_1", VRWindowPath(), "SW_DAEMONS" )
1273    ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(18)" ")
1274
1275    w = VRLoad( "TDL_1", VRWindowPath(), "SW_SMBTREE" )
1276    ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(19)" ")
1277
1278    w = VRLoad( "TDL_1", VRWindowPath(), "SW_USERS" )
1279    ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(15)" ")
1280
1281    w = VRLoad( "TDL_1", VRWindowPath(), "SW_FILES" )
1282    ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(16)" ")
1283
1284    w = VRLoad( "TDL_1", VRWindowPath(), "SW_SERVICE" )
1285    ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(17)" ")
1286
1287    w = VRLoad( "TDL_1", VRWindowPath(), "SW_CHKTDB" )
1288    ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(22)" ")
1289
1290    w = VRLoad( "TDL_1", VRWindowPath(), "SW_SETTINGS" )
1291    ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(24)" ")
1292
1293
1294    IF options.!debug == 1 THEN SAY time()' _TabbedDialogSetup done'
1295return
1296
1297/*:VRX         About_Close
1298*/
1299About_Close:
1300    call About_Fini
1301return
1302
1303/*:VRX         About_Create
1304*/
1305About_Create:
1306    call About_Init
1307    ok = VRSet("About","Caption", NLVGetMessage(20))
1308    ok = VRSet("PB_AboutOK","Caption", NLVGetMessage(2))
1309    SambaTeam.0 = 9
1310    SambaTeam.1 = 'Silvan Scherrer'
1311    SambaTeam.2 = 'Herwig Bauernfeind'
1312    SambaTeam.3 = 'Vitali Pelenyov'
1313    SambaTeam.4 = 'Paul Smedley'
1314    SambaTeam.5 = 'Yuri Dario'
1315    SambaTeam.6 = 'Alex Taylor'
1316    SambaTeam.7 = 'Nikolay Kolosov'
1317    SambaTeam.8 = 'All the Samba people'
1318    SambaTeam.9 = 'All the netlabs people'
1319    ok = VRSet("About","Font", VRGet("SW_SETTINGS","Font"))
1320    ok = VRMethod("LB_SambaTeam","AddStringList", "SambaTeam." )
1321    ok = VRSet("DT_SambaTeam","Caption", NLVGetMessage(21))
1322    ok = VRSet("MLE_Version","Value", NLVGetMessage(1)||'0D0A'x||VRGet("Main", "Hinttext")||'0D0A'x||'0D0A'x||SambaVer)
1323return
1324
1325/*:VRX         About_Fini
1326*/
1327About_Fini:
1328    window = VRInfo( "Window" )
1329    call VRDestroy window
1330    drop window
1331return
1332/*:VRX         About_Init
1333*/
1334About_Init:
1335    window = VRInfo( "Object" )
1336    if( \VRIsChildOf( window, "Notebook" ) ) then do
1337        call VRMethod window, "CenterWindow"
1338        call VRSet window, "Visible", 1
1339        call VRMethod window, "Activate"
1340    end
1341    drop window
1342return
1343
1344/*:VRX         Activate
1345*/
1346Activate:
1347    parse arg Nr
1348    /* call PushbackAll */
1349    CurrentPageNr = Nr
1350    /* ok = VRSet("PB_"Nr,"Font","9.WarpSans Bold") */
1351/*  ok = VRSet("TAB_"Nr,"Top", TabTop-8)
1352    ok = VRSet("TAB_"Nr,"Left",TabWidth*(Nr-1)+PageLeft)
1353    ok = VRSet("TAB_"Nr,"PicturePath", "#1"||Nr||";#1"||Nr)
1354    ok = VRset("DT_PageName", "Caption", VRGet("TAB_"Nr, "UserData"))
1355    ok = VRSet("Page_"Nr,"Visible", 1)
1356    select
1357        when Nr = 1 then ok = VRSet("IPB_paper","PicturePath","#4;#4")
1358        when Nr = Pages then ok = VRSet("IPB_paper","PicturePath","#6;#6")
1359        otherwise ok = VRSet("IPB_paper","PicturePath","#5;#5")
1360    end */
1361return
1362
1363/*:VRX         CB_Debug_Click
1364*/
1365CB_Debug_Click:
1366    options.!Debug = VRGet("CB_Debug","set")
1367    if options.!Debug then ok = VRREdirectStdIO("ON")
1368                      else ok = VRREdirectStdIO("OFF")
1369return
1370
1371/*:VRX         CB_DetectZombies_Click
1372*/
1373CB_DetectZombies_Click:
1374    DetectZombies = VRGet("CB_DetectZombies","set")
1375    say 'DetectZombies = "'DetectZombies'"'
1376return
1377
1378/*:VRX         CB_NoMsgBox_Click
1379*/
1380CB_NoMsgBox_Click:
1381    NoMsgBox = VRGet("CB_NoMsgBox","set")
1382    say 'NoMsgBox = "'NoMsgBox'"'
1383return
1384
1385/*:VRX         CB_WPSSTARTSTOP_Click
1386*/
1387CB_WPSSTARTSTOP_Click:
1388    WPSStartStop = VRGet("CB_WPSStartStop","set")
1389    say 'WPSStartStop = "'WPSStartStop'"'
1390return
1391
1392/*:VRX         CN_CHKTDB_ContextMenu
1393*/
1394CN_CHKTDB_ContextMenu:
1395    if VRInfo("Top") < 400 & VRGet("CN_Files", "View") = "Detail" then call _ColumnsMenu "CN_Files"
1396    else do
1397        RH = VRInfo("Record")
1398        OH = VRInfo("Object")
1399        if RH <> "" then do
1400            ok = VRMethod( "Contextmenu_Files", "Popup", , , "", "PositionOnItem" )
1401        end
1402    end
1403return
1404
1405/*:VRX         CN_Daemons_Click
1406*/
1407CN_Daemons_Click:
1408    IF options.!debug == 1 then say time()' CN_Daemons_Click() started'
1409    NowClickedRecord = VRInfo("Record")
1410    say "  NowRecord  = '"NowClickedRecord"'"
1411    say "  LastRecord = '"LastClickedRecord"'"
1412    if NowClickedRecord <> LastClickedRecord then call _RefreshDaemonsDelay
1413    LastClickedRecord = NowClickedRecord
1414    IF options.!debug == 1 then say time()' CN_Daemons_Click() done'
1415return
1416
1417/*:VRX         CN_Daemons_ContextMenu
1418*/
1419CN_Daemons_ContextMenu:
1420    IF options.!debug == 1 THEN SAY time()' CN_Daemons_ContextMenu() started'
1421    if VRInfo("Top") < 400 & VRGet("CN_Daemons", "View") = "Detail" then do
1422        say "  Going for column modification..."
1423        call _ColumnsMenu "CN_Daemons"
1424    end
1425    else do
1426        say "  Going for context menu, record = '"VRInfo("Record")"'"
1427
1428        call _RefreshDaemonsDelay
1429        DRH = VRInfo("Record")
1430        DaemonName = ""
1431
1432        OH = VRInfo("Object")
1433        ok = VRset("ContextMenu_Daemons_Details",   "Visible", 1 )
1434        ok = VRset("ContextMenu_Daemons_Tree",      "Visible", 1 )
1435        ok = VRset("MItem_9",                       "Visible", 1 )
1436        ok = VRset("ContextMenu_Daemons_Sort",      "Visible", 1 )
1437        ok = VRset("ContextMenu_Daemons_MiniIcons", "Visible", 1 )
1438        ok = VRset("MItem_13",                      "Visible", 1 )
1439        ok = VRset("ContextMenu_Daemons_Ping",      "Visible", 1 )
1440        ok = VRset("ContextMenu_Daemons_KillPID",   "Visible", 1 )
1441        ok = VRset("ContextMenu_Daemons_Start",     "Visible", 1 )
1442        ok = VRset("ContextMenu_Daemons_Shutdown",  "Visible", 1 )
1443
1444        if DRH <> "" then do
1445            DaemonName = VRMethod("CN_Daemons", "GetRecordAttr", DRH, "Caption")
1446            ok = VRset("ContextMenu_Daemons_Ping","Visible", 1 )
1447        end
1448
1449        select
1450            when Words(DaemonName) = 3 & pos("PID ",DaemonName) > 0 then do /* a child process with PID in name */
1451                DaemonName = word(DaemonName,2)
1452                ok = VRSet("ContextMenu_Daemons_KillPID", "Caption", NLVGetMessage( 38, DaemonName))
1453                ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1454            end
1455            when Words(DaemonName) = 1 & (pos("mbd.exe",Daemonname) > 0 | pos("winbindd.exe",Daemonname) > 0) then do /* on root process */
1456                parse var DaemonName DaemonName'.exe'
1457                if strip(VRMethod("CN_Daemons", "GetFieldData", DRH, DPidsFH)) <> "" then do
1458                    ok = VRSet("ContextMenu_Daemons_Shutdown",  "Caption", NLVGetMessage( 33, DaemonName))
1459                    ok = VRset("ContextMenu_Daemons_KillPID",   "Visible", 0 )
1460                    ok = VRset("ContextMenu_Daemons_Start",     "Visible", 0 )
1461                end
1462            end
1463            when pos("\", DaemonName) > 0 then do /* we are on a file */
1464                ok = VRset("MItem_13",                      "Visible", 0 )
1465                ok = VRset("ContextMenu_Daemons_Ping",      "Visible", 0 )
1466                ok = VRset("ContextMenu_Daemons_KillPID",   "Visible", 0 )
1467                ok = VRset("ContextMenu_Daemons_Start",     "Visible", 0 )
1468                ok = VRset("ContextMenu_Daemons_Shutdown",  "Visible", 0 )
1469            end
1470            otherwise do /* we are on a user */
1471                ok = VRset("MItem_13",                      "Visible", 0 )
1472                ok = VRset("ContextMenu_Daemons_Ping",      "Visible", 0 )
1473                ok = VRset("ContextMenu_Daemons_KillPID",   "Visible", 0 )
1474                ok = VRset("ContextMenu_Daemons_Start",     "Visible", 0 )
1475                ok = VRset("ContextMenu_Daemons_Shutdown",  "Visible", 0 )
1476            end
1477        end
1478        say '  Daemon is "'DaemonName'"'
1479        say '  DaemonView = "'DaemonView'"'
1480        if VRGet("CN_Daemons","View") = "Detail" then do
1481            ok = VRSet("ContextMenu_Daemons_Details", "Enabled", 0)
1482            ok = VRSet("ContextMenu_Daemons_Tree", "Enabled", 1)
1483        end
1484        else do
1485            ok = VRSet("ContextMenu_Daemons_Details", "Enabled", 1)
1486            ok = VRSet("ContextMenu_Daemons_Tree", "Enabled", 0)
1487        end
1488        DaemonView = VRGet("CN_Daemons","View")
1489
1490        ok = VRMethod( "ContextMenu_Daemons", "Popup", , , "", "" )
1491    end
1492    IF options.!debug == 1 THEN SAY time()' CN_Daemons_ContextMenu() done'
1493return
1494
1495/*:VRX         CN_Files_ContextMenu
1496*/
1497CN_Files_ContextMenu:
1498    if VRInfo("Top") < 400 & VRGet("CN_Files", "View") = "Detail" then call _ColumnsMenu "CN_Files"
1499    else do
1500        RH = VRInfo("Record")
1501        OH = VRInfo("Object")
1502        if RH <> "" then do
1503            ok = VRMethod( "Contextmenu_Files", "Popup", , , "", "PositionOnItem" )
1504        end
1505    end
1506return
1507
1508/*:VRX         CN_Service_ContextMenu
1509*/
1510CN_Service_ContextMenu:
1511    if VRInfo("Top") < 400 & VRGet("CN_Service", "View") = "Detail" then call _ColumnsMenu "CN_Service"
1512    else do
1513    ok = VRSet("TM_refresh","Enabled", 0)
1514        SRH = VRInfo("Record")
1515        OH = VRInfo("Object")
1516        if SRH <> "" then do
1517            Service = VRMethod("CN_Service", "GetFieldData", SRH, ServiceFH)
1518            say '  Service is "'Service'"'
1519            ok = VRMethod( "ContextMenu_Service", "Popup", , , "", "" )
1520        end
1521    end
1522return
1523
1524/*:VRX         CN_smbtree_Click
1525*/
1526CN_smbtree_Click:
1527    rh = VRInfo('Record')
1528    if VRMethod( 'CN_SMBTREE', "ValidateRecord", rh) <> 1 then return
1529    userdata = VRMethod('CN_smbtree', 'GetRecordAttr', rh, 'UserData')
1530    parse var userdata . '|' userdata
1531    ok = VRset("Main","StatusText", userdata)
1532 
1533
1534return
1535
1536/*:VRX         CN_smbtree_ContextMenu
1537*/
1538CN_smbtree_ContextMenu:
1539    if VRInfo("Top") < 400 & VRGet("CN_smbtree", "View") = "Detail" then call _ColumnsMenu "CN_smbtree"
1540    else do
1541        RH = VRInfo("Record")
1542        if RH <> "" then do
1543            CurMachine = word(VRMethod( "CN_smbtree", "GetRecordAttr", RH, "Caption" ),1)
1544            ok = VRMethod( "Contextmenu_Tree", "Popup", , , "", "PositionOnItem" )
1545        end
1546    end
1547return
1548
1549/*:VRX         CN_Users_ContextMenu
1550*/
1551CN_Users_ContextMenu:
1552    if VRInfo("Top") < 400 & VRGet("CN_users", "View") = "Detail" then call _ColumnsMenu "CN_users"
1553    else do
1554        RH = VRInfo("Record")
1555        OH = VRInfo("Object")
1556        if RH <> "" then do
1557            CurMachine = VRMethod( "CN_users", "GetFieldData", RH, UMachineFH )
1558            ok = VRMethod( "Contextmenu_Users", "Popup", , , "", "PositionOnItem" )
1559        end
1560    end
1561return
1562
1563/*:VRX         Columns_01_Click
1564*/
1565Columns_01_Click:
1566    call _ColumnShow
1567return
1568
1569/*:VRX         Columns_02_Click
1570*/
1571Columns_02_Click:
1572    call _ColumnShow
1573return
1574
1575/*:VRX         Columns_03_Click
1576*/
1577Columns_03_Click:
1578    call _ColumnShow
1579return
1580
1581/*:VRX         Columns_04_Click
1582*/
1583Columns_04_Click:
1584    call _ColumnShow
1585return
1586
1587/*:VRX         Columns_05_Click
1588*/
1589Columns_05_Click:
1590    call _ColumnShow
1591return
1592
1593/*:VRX         Columns_06_Click
1594*/
1595Columns_06_Click:
1596    call _ColumnShow
1597return
1598
1599/*:VRX         Columns_07_Click
1600*/
1601Columns_07_Click:
1602    call _ColumnShow
1603return
1604
1605/*:VRX         Columns_08_Click
1606*/
1607Columns_08_Click:
1608    call _ColumnShow
1609return
1610
1611/*:VRX         Columns_09_Click
1612*/
1613Columns_09_Click:
1614    call _ColumnShow
1615return
1616
1617/*:VRX         Columns_10_Click
1618*/
1619Columns_10_Click:
1620    call _ColumnShow
1621return
1622
1623/*:VRX         Columns_11_Click
1624*/
1625Columns_11_Click:
1626    call _ColumnShow
1627return
1628
1629/*:VRX         Columns_12_Click
1630*/
1631Columns_12_Click:
1632    call _ColumnShow
1633return
1634
1635/*:VRX         Columns_13_Click
1636*/
1637Columns_13_Click:
1638    call _ColumnShow
1639return
1640
1641/*:VRX         Columns_14_Click
1642*/
1643Columns_14_Click:
1644    call _ColumnShow
1645return
1646
1647/*:VRX         ContextMenu_Daemons_Details_Click
1648*/
1649ContextMenu_Daemons_Details_Click:
1650    IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() started'
1651    ok = VRset("CN_Daemons","View","Detail")
1652    ok = VRset("ContextMenu_Daemons_Tree","Enabled",1)
1653    ok = VRset("ContextMenu_Daemons_Details","Enabled",0)
1654    ok = VRSet("TM_refresh","Enabled", 1)
1655    IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() done'
1656return
1657
1658/*:VRX         ContextMenu_Daemons_KillPID_Click
1659*/
1660ContextMenu_Daemons_KillPID_Click:
1661    Msg.Text = NLVGetMessage(39, DaemonName)
1662    Msg.Type = 'Q'
1663    if _MsgYesNo() = 1 then do
1664        ok = PRKillProcess("1",DaemonName )
1665        if ok = 0 then say ", success!"; else say ", error "ok
1666
1667/*      say 'kill -9 'DaemonName
1668        address cmd 'kill -9 'DaemonName */
1669    end
1670    ok = VRSet("TM_Refresh","Enabled", 1)
1671return
1672
1673/*:VRX         ContextMenu_Daemons_MiniIcons_Click
1674*/
1675ContextMenu_Daemons_MiniIcons_Click:
1676    advanced.!bigicons = \advanced.!bigicons
1677    ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons)
1678    ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
1679    ok = VRset("ContextMenu_Tree_MiniIcons",  "Checked", \advanced.!bigicons)
1680    ok = VRset("ContextMenu_Daemons_MiniIcons",  "Checked", \advanced.!bigicons)
1681return
1682
1683/*:VRX         ContextMenu_Daemons_Ping_Click
1684*/
1685ContextMenu_Daemons_Ping_Click:
1686    ok = VRSet("Main", 'Pointer', 'Wait' )
1687    address cmd samba.!smbcontrolexe' 'DaemonName' ping --timeout=3 --debuglevel=0 2>'samba.!error' 1>'samba.!msg
1688    call _SambaShowMsg "section table registered"
1689
1690    ok = VRSet("Main", 'Pointer', '<default>' )
1691    ok = VRSet("TM_refresh","Enabled", 1)
1692return
1693
1694/*:VRX         ContextMenu_Daemons_Shutdown_Click
1695*/
1696ContextMenu_Daemons_Shutdown_Click:
1697    Msg.Text = NLVGetMessage(34, DaemonName)
1698    Msg.Type = 'Q'
1699    if _MsgYesNo() = 1 then do
1700        address cmd samba.!smbcontrolexe' 'DaemonName' shutdown 2>'samba.!error' 1>'samba.!msg
1701        call _SambaShowMsg "section table registered tdb"
1702    end
1703    ok = VRSet("TM_Refresh","Enabled", 1)
1704return
1705
1706/*:VRX         ContextMenu_Daemons_Sort_Click
1707*/
1708ContextMenu_Daemons_Sort_Click:
1709    window = VRLoadSecondary( "SW_SORT", "W" )
1710return
1711
1712/*:VRX         ContextMenu_Daemons_Start_Click
1713*/
1714ContextMenu_Daemons_Start_Click:
1715    Msg.Text = NLVGetMessage(37, DaemonName)
1716    Msg.Type = 'Q'
1717    if _MsgYesNo() = 1 then do
1718        say samba.!smbcmd' start 'DaemonName
1719        address cmd samba.!smbcmd' start 'DaemonName
1720    end
1721    ok = VRSet("TM_Refresh","Enabled", 1)
1722return
1723
1724/*:VRX         ContextMenu_Daemons_Tree_Click
1725*/
1726ContextMenu_Daemons_Tree_Click:
1727    IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() started'
1728    ok = VRset("CN_Daemons","View","IconTree")
1729    ok = VRset("ContextMenu_Daemons_Tree","Enabled",0)
1730    ok = VRset("ContextMenu_Daemons_Details","Enabled",1)
1731    ok = VRSet("TM_refresh","Enabled", 1)
1732    IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() done'
1733return
1734
1735/*:VRX         ContextMenu_Files_Sort_Click
1736*/
1737ContextMenu_Files_Sort_Click:
1738    window = VRLoadSecondary( "SW_SORT", "W" )
1739return
1740
1741/*:VRX         ContextMenu_Service_CloseShare_Click
1742*/
1743ContextMenu_Service_CloseShare_Click:
1744    Msg.Text = NLVGetMessage(75, Service)
1745    Msg.Type = 'Q'
1746    if _MsgYesNo() = 1 then do
1747        address cmd samba.!smbcontrolexe' smbd close-share 'Service' --debuglevel=0' /* ' 2>'samba.!error' 1>'samba.!msg */
1748        /* No usable output from Samba here ! */
1749        /* call _SambaShowMsg */
1750        Msg.Text = NLVGetMessage(76, Service)
1751        Msg.Type = 'I'
1752        call _ShowMsg
1753    end
1754    ok = VRSet("TM_refresh","Enabled", 1)
1755return
1756
1757/*:VRX         ContextMenu_Service_Sort_Click
1758*/
1759ContextMenu_Service_Sort_Click:
1760    window = VRLoadSecondary( "SW_SORT", "W" )
1761return
1762
1763/*:VRX         ContextMenu_Tree_Details_Click
1764*/
1765ContextMenu_Tree_Details_Click:
1766    ok = VRset("CN_smbtree","View","Detail")
1767    ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
1768    ok = VRset("ContextMenu_Tree_Details","Enabled",0)
1769    ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
1770    ok = VRset("TM_Throbber", "Enabled", 1)
1771    ok = VRset("Pict_Throbber", "Visible", 0)
1772    call _RefreshTree
1773return
1774
1775/*:VRX         ContextMenu_Tree_Icons_Click
1776*/
1777ContextMenu_Tree_Icons_Click:
1778    ok = VRset("CN_smbtree","View","Icon")
1779    ok = VRset("ContextMenu_Tree_Icons","Enabled",0)
1780    ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
1781    ok = VRset("ContextMenu_Tree_Details","Enabled",1)
1782    ok = VRset("TM_Throbber", "Enabled", 1)
1783    ok = VRset("Pict_Throbber", "Visible", 1)
1784    call _RefreshTree
1785return
1786
1787/*:VRX         ContextMenu_Tree_MiniIcons_Click
1788*/
1789ContextMenu_Tree_MiniIcons_Click:
1790    advanced.!bigicons = \advanced.!bigicons
1791    ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons)
1792    ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
1793    ok = VRset("ContextMenu_Tree_MiniIcons",  "Checked", \advanced.!bigicons)
1794    ok = VRset("ContextMenu_Daemons_MiniIcons",  "Checked", \advanced.!bigicons)
1795return
1796
1797/*:VRX         ContextMenu_Tree_SendMsg_Click
1798*/
1799ContextMenu_Tree_SendMsg_Click:
1800    call _SendMsg
1801return
1802
1803/*:VRX         ContextMenu_Tree_Sort_Click
1804*/
1805ContextMenu_Tree_Sort_Click:
1806    window = VRLoadSecondary( "SW_SORT", "W" )
1807return
1808
1809/*:VRX         ContextMenu_Tree_Tree_Click
1810*/
1811ContextMenu_Tree_Tree_Click:
1812    ok = VRset("CN_smbtree","View","IconTree")
1813    ok = VRset("ContextMenu_Tree_Tree","Enabled",0)
1814    ok = VRset("ContextMenu_Tree_Details","Enabled",1)
1815    ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
1816    ok = VRset("TM_Throbber", "Enabled", 1)
1817    ok = VRset("Pict_Throbber", "Visible", 1)
1818    call _RefreshTree
1819return
1820
1821/*:VRX         ContextMenu_Users_SendMsg_Click
1822*/
1823ContextMenu_Users_SendMsg_Click:
1824    call _SendMsg
1825return
1826
1827/*:VRX         ContextMenu_Users_Sort_Click
1828*/
1829ContextMenu_Users_Sort_Click:
1830    window = VRLoadSecondary( "SW_SORT", "W" )
1831return
1832
1833/*:VRX         DT_STATUSBAR_ContextMenu
1834*/
1835DT_STATUSBAR_ContextMenu:
1836    ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
1837return
1838
1839/*:VRX         Fini
1840*/
1841Fini:
1842    window = VRWindow()
1843    call VRSet window, "Visible", 0
1844    drop window
1845return 0
1846
1847/*:VRX         GetBootDrive
1848*/
1849GetBootDrive:
1850/* Use SysBootDrive if possible */
1851If Rxfuncadd('SysBootDrive', 'RexxUtil', 'SysBootDrive') Then
1852   Return Left(Value('RUNWORKPLACE',,'OS2ENVIRONMENT'),2)
1853Else
1854   Return SysBootDrive()
1855
1856
1857/*:VRX         Halt
1858*/
1859Halt:
1860    signal _VREHalt
1861return
1862
1863/*:VRX         Init
1864*/
1865Init:
1866window = VRWindow()
1867call VRMethod window, "CenterWindow"
1868call VRSet window, "Visible", 0
1869call VRMethod window, "Activate"
1870drop window
1871return
1872
1873/*:VRX         LB_SortFields_Click
1874*/
1875LB_SortFields_Click:
1876    call _ContainerSort
1877return
1878
1879/*:VRX         Main_Activate
1880*/
1881Main_Activate:
1882    call TM_Refresh_Trigger
1883    ok = VRset("TM_Refresh", "Enabled", 1)
1884return
1885
1886/*:VRX         Main_Close
1887*/
1888Main_Close:
1889    call Quit
1890return
1891
1892/*:VRX         Main_Create
1893*/
1894Main_Create:
1895    options.!debug    = 0
1896    if options.!debug == 1 then do
1897        ok = VRRedirectStdIO("ON")
1898        say time()' Main_Create started'
1899    end
1900    else ok = VRRedirectStdIO("OFF")
1901 
1902    call _LoadOtherFuncs
1903    call _InitTempDir
1904
1905    call _IniRead
1906    call _NLVSetup
1907
1908    call _TabbeddialogSetup
1909
1910    call _SambaInit
1911    if \WPSStartStop then call _CreateSmbStarter
1912    if _SambaRunning() then call _SambaFindPIDfile
1913    call _ContainerInit
1914    call _GUIInit
1915   
1916/*    str = 'call TAB_'CurrentPageNr'_Click';
1917say str
1918interpret str
1919say 'Done 'str
1920    if CurrentPageNr <> 5 then do
1921        ok = VRSet("TM_Throbber", "Enabled", 1)
1922        call _RefreshTree
1923    end */
1924    ok = VRMethod("PB_Refresh","SetFocus")
1925
1926    if options.!debug == 1 then say time()' Main_Create done'
1927return
1928/*:VRX         Main_Deactivate
1929*/
1930Main_Deactivate:
1931    ok = VRset("TM_Refresh", "Enabled", 0)
1932return
1933
1934/*:VRX         Main_Resize
1935*/
1936Main_Resize:
1937    IF options.!debug == 1 THEN SAY time()' Main_Resize started'
1938    ok = VRSet("Main","Painting", 0)
1939
1940 /* Basic measurements */
1941    main_iwidth  = VRGet("Main","InteriorWidth")                /* Width of window client-area */
1942    main_iheight = VRGet("Main","InteriorHeight")               /* Height of window client-area */
1943
1944    /* if main_iheight < 5500 then ok = VRSet("Main","Height",6200) */
1945    sbar_height  = 209                                          /* Height of status-bar */
1946    marginx2     = margin * 2                                   /* Common margin around controls */
1947
1948    pbtn_dist    = 980
1949    pbtn_nr      = 4
1950    pbtn_pos     = max((main_iwidth - pbtn_Dist * pbtn_Nr)%2, 0)+ margin
1951    pbtn_height  = 400                                          /* Height of the panels' internal button areas */
1952    pbtn_width   = 940
1953
1954    pane_height  = main_iheight- sbar_height - pbtn_height - margin * 7                   /* Height of notebook  */
1955    pane_width   = main_iwidth - marginx2              /* Width of the notebook panel */
1956
1957    /* Tabbed Dialog */
1958    ok = VRset("TDL_1", "Top",    marginx2    )
1959    ok = VRset("TDL_1", "Left",   margin      )
1960    ok = VRset("TDL_1", "Width",  pane_width  )
1961    ok = VRset("TDL_1", "Height", pane_height )
1962
1963    /* Statusbar */
1964    ok = VRSet("GB_STATUSBAR", "Left",  margin )
1965    ok = VRSet("GB_STATUSBAR", "Top",   main_iheight - sbar_height - margin )
1966    ok = VRSet("GB_STATUSBAR", "Height",sbar_height )
1967    ok = VRSet("GB_STATUSBAR", "Width", pane_width  )
1968
1969    ok = VRSet("DT_STATUSBAR", "Top",   12 )
1970    ok = VRSet("DT_STATUSBAR", "Left",  12 )
1971    ok = VRSet("DT_STATUSBAR", "Height",sbar_height- 24)
1972    ok = VRSet("DT_STATUSBAR", "Width", pane_width - 24)
1973
1974    ok = VRSet("PB_Refresh","top", pane_height + margin * 4 )
1975    ok = VRSet("PB_Help",   "top", pane_height + margin * 4 )
1976    ok = VRSet("PB_Cancel", "top", pane_height + margin * 4 )
1977    ok = VRSet("PB_About",  "top", pane_height + margin * 4 )
1978
1979    ok = VRSet("PB_Refresh","left",pbtn_pos + pbtn_dist * (pbtn_nr - 4))
1980    ok = VRSet("PB_Help",   "left",pbtn_pos + pbtn_dist * (pbtn_nr - 3))
1981    ok = VRSet("PB_About",  "left",pbtn_pos + pbtn_dist * (pbtn_nr - 2))
1982    ok = VRSet("PB_Cancel", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 1))
1983
1984    ok = VRset("GB_CHKTDB","Top",    margin  )
1985    ok = VRset("GB_CHKTDB","Left",   marginx2)
1986    ok = VRset("GB_CHKTDB","Width",  pane_width - 760)
1987    ok = VRset("GB_CHKTDB","Height", pane_height- 1020)
1988    ok = VRset("CN_CHKTDB","Top",    margin)
1989    ok = VRset("CN_CHKTDB","Left",   margin)
1990    ok = VRset("CN_CHKTDB","Width",  pane_width - 760 - marginx2 )
1991    ok = VRset("CN_CHKTDB","Height", pane_height- 1020- marginx2 )
1992
1993    ok = VRset("GB_USERS","Top",    margin  )
1994    ok = VRset("GB_USERS","Left",   marginx2)
1995    ok = VRset("GB_USERS","Width",  pane_width - 760)
1996    ok = VRset("GB_USERS","Height", pane_height- 1020)
1997    ok = VRset("CN_USERS","Top",    margin)
1998    ok = VRset("CN_USERS","Left",   margin)
1999    ok = VRset("CN_USERS","Width",  pane_width - 760 - marginx2 )
2000    ok = VRset("CN_USERS","Height", pane_height- 1020- marginx2 )
2001
2002    ok = VRset("GB_FILES","Top",    margin  )
2003    ok = VRset("GB_FILES","Left",   marginx2)
2004    ok = VRset("GB_FILES","Width",  pane_width - 760)
2005    ok = VRset("GB_FILES","Height", pane_height- 1020)
2006    ok = VRset("CN_FILES","Top",    margin)
2007    ok = VRset("CN_FILES","Left",   margin)
2008    ok = VRset("CN_FILES","Width",  pane_width - 760 - marginx2 )
2009    ok = VRset("CN_FILES","Height", pane_height- 1020- marginx2 )
2010
2011    ok = VRset("GB_SERVICE","Top",    margin  )
2012    ok = VRset("GB_SERVICE","Left",   marginx2)
2013    ok = VRset("GB_SERVICE","Width",  pane_width - 760)
2014    ok = VRset("GB_SERVICE","Height", pane_height- 1020)
2015    ok = VRset("CN_SERVICE","Top",    margin)
2016    ok = VRset("CN_SERVICE","Left",   margin)
2017    ok = VRset("CN_SERVICE","Width",  pane_width - 760 - marginx2 )
2018    ok = VRset("CN_SERVICE","Height", pane_height- 1020- marginx2 )
2019
2020    ok = VRset("GB_DAEMONS","Top",    margin  )
2021    ok = VRset("GB_DAEMONS","Left",   marginx2)
2022    ok = VRset("GB_DAEMONS","Width",  pane_width -  760)
2023    ok = VRset("GB_DAEMONS","Height", pane_height- 1020)
2024    ok = VRset("CN_DAEMONS","Top",    margin)
2025    ok = VRset("CN_DAEMONS","Left",   margin)
2026    ok = VRset("CN_DAEMONS","Width",  pane_width -  760 - margin*4 - pbtn_width)
2027    ok = VRset("CN_DAEMONS","Height", pane_height- 1020 - marginx2 )
2028
2029    ok = VRSet("PB_START",  "Top",    pbtn_height*2 - marginx2)
2030    ok = VRSet("PB_STOP",   "Top",    pbtn_height*3 - marginx2)
2031    ok = VRSet("PB_Restart","Top",    pbtn_height*4 - marginx2)
2032    ok = VRSet("PB_Reload", "Top",    pbtn_height*5 - marginx2)
2033    ok = VRSet("PB_DelLogs","Top",    pbtn_height*6 - marginx2)
2034
2035    ok = VRSet("PB_START",  "Left",   pane_width -  760 - marginx2 - pbtn_width)
2036    ok = VRSet("PB_STOP",   "Left",   pane_width -  760 - marginx2 - pbtn_width)
2037    ok = VRSet("PB_Restart","Left",   pane_width -  760 - marginx2 - pbtn_width)
2038    ok = VRSet("PB_Reload", "Left",   pane_width -  760 - marginx2 - pbtn_width)
2039    ok = VRSet("PB_DelLogs","Left",   pane_width -  760 - marginx2 - pbtn_width)
2040
2041    ok = VRset("GB_SMBTREE","Top",    margin  )
2042    ok = VRset("GB_SMBTREE","Left",   marginx2)
2043    ok = VRset("GB_SMBTREE","Width",  pane_width - 760)
2044    ok = VRset("GB_SMBTREE","Height", pane_height- 1020)
2045    ok = VRset("CN_SMBTREE","Top",    margin)
2046    ok = VRset("CN_SMBTREE","Left",   margin)
2047    ok = VRset("CN_SMBTREE","Width",  pane_width - 760 - marginx2 )
2048    ok = VRset("CN_SMBTREE","Height", pane_height- 1020- marginx2 )
2049
2050    ok = VRset("PICT_THROBBER", "Top",  VRGet("CN_SMBTREE","Height") % 2 - 100 )
2051    ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width")  % 2 - 200 )
2052
2053    ok = VRset("GB_SETTINGS","Top",    margin  )
2054    ok = VRset("GB_SETTINGS","Left",   marginx2)
2055    ok = VRset("GB_SETTINGS","Width",  pane_width - 760)
2056    ok = VRset("GB_SETTINGS","Height", pane_height- 1020)
2057
2058
2059    /* check and empty event queue, trash spurious resize events */
2060    EventString = ''
2061    TrashedResize = 0
2062    do until EventString = 'nop'
2063        EventString = VREvent('N')
2064        if EventString <> 'nop' then do
2065            if EventString = 'CALL Main_Resize' then TrashedResize = 1
2066                                                else interpret eventString
2067        end
2068    end
2069    if TrashedResize then CALL Main_Resize
2070    ok = VRSet("Main", "Painting", 1)
2071
2072    IF options.!debug == 1 THEN SAY time()' Main_Resize done'
2073return
2074
2075/*:VRX         Page1_Create
2076*/
2077Page1_Create:
2078
2079Return
2080
2081/*:VRX         Page1_Init
2082*/
2083Page1_Init:
2084    call _ContainerInit
2085return
2086
2087/*:VRX         Page2_Create
2088*/
2089Page2_create:
2090
2091Return
2092/*:VRX         Page2_init
2093*/
2094Page2_init:
2095
2096return
2097
2098/*:VRX         Page3_Create
2099*/
2100Page3_create:
2101
2102Return
2103/*:VRX         Page3_Init
2104*/
2105Page3_Init:
2106
2107return
2108
2109/*:VRX         Page4_Create
2110*/
2111Page4_Create:
2112
2113Return
2114/*:VRX         Page4_init
2115*/
2116Page4_init:
2117
2118return
2119
2120/*:VRX         Page5_Create
2121*/
2122Page5_Create:
2123
2124return
2125
2126/*:VRX         Page5_Init
2127*/
2128Page5_Init:
2129
2130return
2131
2132/*:VRX         Paper_Init
2133*/
2134Paper_Init:
2135    ok = VRSet("IPB_Paper","Width" ,VRMethod( "Screen", "PixelsToTwips", 32 ))
2136    ok = VRSet("IPB_Paper","Height",VRMethod( "Screen", "PixelsToTwips", 32 ))
2137    ok = VRset("IPB_Paper","Left",VRget("GB_Main2","width")-420)
2138return
2139
2140/*:VRX         PB_About_Click
2141*/
2142PB_About_Click:
2143    window = VRLoadSecondary( "About", "W" )
2144return
2145
2146/*:VRX         PB_AboutOK_Click
2147*/
2148PB_AboutOK_Click:
2149    call About_Close
2150return
2151
2152/*:VRX         PB_Cancel_Click
2153*/
2154PB_Cancel_Click:
2155    say 'start PB_Cancel_Click'
2156    Call Quit
2157    say 'done PB_Cancel_Click'
2158return
2159
2160/*:VRX         PB_DELLOGS_Click
2161*/
2162PB_DELLOGS_Click:
2163    call VRSet VRWindow(), 'Pointer', 'Wait'
2164
2165    /* Fixme - this needs to be read from smb.conf */
2166    samba.!logdir = ETC'\samba\log'
2167
2168    ok = SysFileTree(samba.!logdir'\log.*', logs.,'FO')
2169    do I = 1 to logs.0
2170        ok = VRMethod( "CN_Daemons", "GetRecordList", "All", "handle." )
2171        KeepLog = 0
2172        do J = 1 to handle.0
2173            CurPID = VRMethod("CN_Daemons", "GetFieldData", handle.J, DPidsFH)
2174            if pos(CurPID,logs.I) > 0 then KeepLog = 1
2175        end
2176        if KeepLog = 0 then ok = SysFileDelete(logs.I)
2177    end
2178
2179    call VRSet VRWindow(), 'Pointer', '<default>'
2180return
2181
2182/*:VRX         PB_Help_Click
2183*/
2184PB_Help_Click:
2185    ok = VRMethod("Main", "InvokeHelp" )
2186return
2187
2188/*:VRX         PB_Refresh_Click
2189*/
2190PB_Refresh_Click:
2191    IF options.!debug == 1 then say time()' PB_Refresh_Click() started'
2192    ok = SysSleep(0.3)
2193
2194    say "  CurrentPageNr = "CurrentPageNr
2195    select
2196        when CurrentPageNr = 2 then do
2197            ok = VRset("Pict_Throbber", "Visible", 1)
2198            ok = VRset("TM_Throbber", "Enabled", 1)
2199            call _RefreshTree
2200        end
2201        when CurrentPageNr = 6 then do
2202            call _ChkTDB
2203        end
2204        otherwise call _Refresh
2205    end
2206    IF options.!debug == 1 then say time()' PB_Refresh_Click() done'
2207return
2208
2209/*:VRX         PB_RELOAD_Click
2210*/
2211PB_RELOAD_Click:
2212    call VRSet VRWindow(), 'Pointer', 'Wait'
2213    if WPSStartStop then do
2214        ok = SysOpenObject('<smb_reload>', 'DEFAULT', 1)
2215    end
2216    else do
2217        call lineout samba.!bin"\smbstart", "reload"
2218        ok = stream(samba.!bin"\reload","c","close")
2219    end
2220    ok = VRSet("TM_Refresh","Delay", 2000)
2221    call VRSet VRWindow(), 'Pointer', '<default>'
2222return
2223
2224/*:VRX         PB_RESTART_Click
2225*/
2226PB_RESTART_Click:
2227    call VRSet VRWindow(), 'Pointer', 'Wait'
2228    if WPSStartStop then do
2229        ok = SysOpenObject('<smb_restart>', 'DEFAULT', 1)
2230    end
2231    else do
2232        call lineout samba.!bin"\restart", "restart"
2233        ok = stream(samba.!bin"\restart","c","close")
2234    end
2235    ok = VRSet("TM_Refresh","Delay", 1000)
2236    call VRSet VRWindow(), 'Pointer', '<default>'
2237return
2238
2239/*:VRX         PB_Sort_Cancel_Click
2240*/
2241PB_Sort_Cancel_Click:
2242    ok = VRset( Container, "DetailSort", Old.SortField )
2243    ok = VRSet( Container, "Sort", Old.SortOrder )
2244    ok = VRMethod( Container, "SortRecords" )
2245    drop Old.
2246    call SW_SORT_Close
2247return
2248
2249/*:VRX         PB_Sort_OK_Click
2250*/
2251PB_Sort_OK_Click:
2252    drop Old.
2253    call SW_SORT_Close
2254return
2255
2256/*:VRX         PB_START_Click
2257*/
2258PB_START_Click:
2259    say "IPB_Start_Click started"
2260    call VRSet VRWindow(), 'Pointer', 'Wait'
2261    if WPSStartStop then do
2262        ok = SysOpenObject('<smb_start>', 'DEFAULT', 1)
2263    end
2264    else do
2265        call lineout samba.!bin"\smbstart", "smbstart"
2266        ok = stream(samba.!bin"\smbstart","c","close")
2267    end
2268    ok = VRSet("TM_Refresh","Delay", 1000)
2269    call VRSet VRWindow(), 'Pointer', '<default>'
2270    say "IPB_Start_Click done"
2271return
2272/*:VRX         PB_STOP_Click
2273*/
2274PB_STOP_Click:
2275    say "IPB_Stop_Click started"
2276    call VRSet VRWindow(), 'Pointer', 'Wait'
2277    if WPSStartStop then do
2278        ok = SysOpenObject('<smb_stop>', 'DEFAULT', 1)
2279    end
2280    else do
2281        call lineout samba.!bin"\smbstop", "smbstop"
2282        ok = stream(samba.!bin"\smbstop","c","close")
2283    end
2284    ok = VRSet("TM_Refresh","Delay", 1000)
2285    call VRSet VRWindow(), 'Pointer', '<default>'
2286    say "IPB_Stop_Click done"
2287return
2288/*:VRX         PushbackAll
2289*/
2290PushbackAll:
2291    Pages = 6
2292    /* Tab distance from top */
2293    TabTop = 20
2294    TabWidth = VRMethod( "Screen", "PixelsToTwips", 78 )
2295    TabHeight= VRMethod( "Screen", "PixelsToTwips", 24 )
2296
2297    /* Page Position */
2298    PageLeft = 120
2299    PageTop = PageLeft + TabTop + 330
2300
2301    /* Page size */
2302    PageHeight = 3000
2303    PageWidth = 3000
2304    call beep 880, 20
2305/*  ok = VRset("DT_PageName", "Caption", "")
2306    ok = VRSet("GB_Main","Left", 0)
2307    ok = VRSet("GB_Main","Top", TabTop+230)
2308    do I = 1 to Pages
2309        ok = VRSet("TAB_"I,"Top", TabTop)
2310        ok = VRSet("TAB_"I,"PicturePath","#2"||I||";#2"||I)
2311        ok = VRSet("TAB_"I,"Left",TabWidth*(I-1)+PageLeft)
2312        ok = VRSet("TAB_"I,"Width",TabWidth)
2313        ok = VRSet("TAB_"I,"Height",TabHeight)
2314        ok = VRSet("Page_"I,"Height", max(PageHeight,VRget("GB_Main2","Height")-600))
2315        ok = VRSet("Page_"I,"Width", max(PageWidth,VRget("GB_Main2","Width")-450))
2316        ok = VRSet("Page_"I,"Left", PageLeft)
2317        ok = VRSet("Page_"I,"Top", PageTop)
2318        ok = VRSet("Page_"I,"Visible", 0)
2319        ok = VRSet("Page_"I,"BackColor", "<default>")
2320    end */
2321return
2322
2323/*:VRX         Quit
2324*/
2325Quit:
2326    call VRSet VRWindow(), 'Pointer', 'Wait'
2327    call _IniWrite
2328    ok = VRRedirectStdIO("OFF")
2329    call _SambaFinish
2330
2331    ok = SysFileDelete(smbdoutput)
2332
2333    call lineout samba.!bin"\quit", "quit"
2334    ok = stream(samba.!bin"\quit","c","close")
2335    ok = SysSleep(1)
2336    ok = SysDestroyObject('<smbstarter>')
2337    ok = SysFileDelete(samba.!bin'\smbstarter.cmd')
2338    ok = SysFileDelete(samba.!bin'\quit')
2339    call VRSet VRWindow(), 'Pointer', '<default>'
2340
2341    window = VRWindow()
2342    call VRSet window, "Shutdown", 1
2343    drop window
2344return
2345
2346/*:VRX         RB_Sort_Ascending_Click
2347*/
2348RB_Sort_Ascending_Click:
2349    SortOrder = "Ascending"
2350    call _ContainerSort
2351return
2352
2353/*:VRX         RB_Sort_Descending_Click
2354*/
2355RB_Sort_Descending_Click:
2356    SortOrder = "Descending"
2357    call _ContainerSort
2358return
2359
2360/*:VRX         RB_Sort_None_Click
2361*/
2362RB_Sort_None_Click:
2363    SortOrder = "None"
2364    call _ContainerSort
2365return
2366
2367/*:VRX         SPIN_Intervall_Change
2368*/
2369SPIN_Intervall_Change:
2370    Intervall = VRGet("SPIN_Intervall","Value")
2371    ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
2372return
2373
2374/*:VRX         SPIN_IntervallMin_Change
2375*/
2376SPIN_IntervallMin_Change:
2377    IntervallMin = VRGet("SPIN_IntervallMin","Value")
2378return
2379
2380/*:VRX         SW_CHKTDB_Close
2381*/
2382SW_CHKTDB_Close:
2383    call SW_CHKTDB_Fini
2384return
2385
2386/*:VRX         SW_CHKTDB_Create
2387*/
2388SW_CHKTDB_Create:
2389    call SW_CHKTDB_Init
2390return
2391
2392/*:VRX         SW_CHKTDB_Fini
2393*/
2394SW_CHKTDB_Fini:
2395    window = VRInfo( "Window" )
2396    call VRDestroy window
2397    drop window
2398return
2399/*:VRX         SW_CHKTDB_Init
2400*/
2401SW_CHKTDB_Init:
2402    window = VRInfo( "Object" )
2403    if( \VRIsChildOf( window, "Notebook" ) ) then do
2404        call VRMethod window, "CenterWindow"
2405        call VRSet window, "Visible", 1
2406        call VRMethod window, "Activate"
2407    end
2408    drop window
2409return
2410
2411/*:VRX         SW_DAEMONS_Close
2412*/
2413SW_DAEMONS_Close:
2414    call SW_DAEMONS_Fini
2415return
2416
2417/*:VRX         SW_DAEMONS_Create
2418*/
2419SW_DAEMONS_Create:
2420    call SW_DAEMONS_Init
2421return
2422
2423/*:VRX         SW_DAEMONS_Fini
2424*/
2425SW_DAEMONS_Fini:
2426    window = VRInfo( "Window" )
2427    call VRDestroy window
2428    drop window
2429return
2430/*:VRX         SW_DAEMONS_Init
2431*/
2432SW_DAEMONS_Init:
2433    window = VRInfo( "Object" )
2434    if( \VRIsChildOf( window, "Notebook" ) ) then do
2435        call VRMethod window, "CenterWindow"
2436        call VRSet window, "Visible", 1
2437        call VRMethod window, "Activate"
2438    end
2439    drop window
2440return
2441
2442/*:VRX         SW_FILES_Close
2443*/
2444SW_FILES_Close:
2445    call SW_FILES_Fini
2446return
2447
2448/*:VRX         SW_FILES_Create
2449*/
2450SW_FILES_Create:
2451    call SW_FILES_Init
2452return
2453
2454/*:VRX         SW_FILES_Fini
2455*/
2456SW_FILES_Fini:
2457    window = VRInfo( "Window" )
2458    call VRDestroy window
2459    drop window
2460return
2461/*:VRX         SW_FILES_Init
2462*/
2463SW_FILES_Init:
2464    window = VRInfo( "Object" )
2465    if( \VRIsChildOf( window, "TDL" ) ) then do
2466        call VRMethod window, "CenterWindow"
2467        call VRSet window, "Visible", 1
2468        call VRMethod window, "Activate"
2469    end
2470    drop window
2471return
2472
2473/*:VRX         SW_SERVICE_Close
2474*/
2475SW_SERVICE_Close:
2476    call SW_SERVICE_Fini
2477return
2478
2479/*:VRX         SW_SERVICE_Create
2480*/
2481SW_SERVICE_Create:
2482    call SW_SERVICE_Init
2483return
2484
2485/*:VRX         SW_SERVICE_Fini
2486*/
2487SW_SERVICE_Fini:
2488    window = VRInfo( "Window" )
2489    call VRDestroy window
2490    drop window
2491return
2492/*:VRX         SW_SERVICE_Init
2493*/
2494SW_SERVICE_Init:
2495    window = VRInfo( "Object" )
2496    if( \VRIsChildOf( window, "TDL" ) ) then do
2497        call VRMethod window, "CenterWindow"
2498        call VRSet window, "Visible", 1
2499        call VRMethod window, "Activate"
2500    end
2501    drop window
2502return
2503
2504/*:VRX         SW_SETTINGS_Close
2505*/
2506SW_SETTINGS_Close:
2507    call SW_SETTINGS_Fini
2508return
2509
2510/*:VRX         SW_SETTINGS_Create
2511*/
2512SW_SETTINGS_Create:
2513    call SW_SETTINGS_Init
2514return
2515
2516/*:VRX         SW_SETTINGS_Fini
2517*/
2518SW_SETTINGS_Fini:
2519    window = VRInfo( "Window" )
2520    call VRDestroy window
2521    drop window
2522return
2523/*:VRX         SW_SETTINGS_Init
2524*/
2525SW_SETTINGS_Init:
2526    window = VRInfo( "Object" )
2527    if( \VRIsChildOf( window, "TDL" ) ) then do
2528        call VRMethod window, "CenterWindow"
2529        call VRSet window, "Visible", 1
2530        call VRMethod window, "Activate"
2531    end
2532    drop window
2533return
2534
2535/*:VRX         SW_SMBTREE_Close
2536*/
2537SW_SMBTREE_Close:
2538    call SW_SMBTREE_Fini
2539return
2540
2541/*:VRX         SW_SMBTREE_Create
2542*/
2543SW_SMBTREE_Create:
2544    call SW_SMBTREE_Init
2545return
2546
2547/*:VRX         SW_SMBTREE_Fini
2548*/
2549SW_SMBTREE_Fini:
2550    window = VRInfo( "Window" )
2551    call VRDestroy window
2552    drop window
2553return
2554/*:VRX         SW_SMBTREE_Init
2555*/
2556SW_SMBTREE_Init:
2557    window = VRInfo( "Object" )
2558    if( \VRIsChildOf( window, "TDL" ) ) then do
2559        call VRMethod window, "CenterWindow"
2560        call VRSet window, "Visible", 1
2561        call VRMethod window, "Activate"
2562    end
2563    drop window
2564return
2565
2566/*:VRX         SW_SMBTREE_Init_Content
2567*/
2568SW_SMBTREE_Init_Content:
2569    ok = VRset("Pict_Throbber", "Visible", 1)
2570    ok = VRset("TM_Throbber", "Enabled", 1)
2571    call _RefreshTree
2572return
2573
2574/*:VRX         SW_SORT_Close
2575*/
2576SW_SORT_Close:
2577    call SW_SORT_Fini
2578return
2579
2580/*:VRX         SW_SORT_Create
2581*/
2582SW_SORT_Create:
2583    call SW_SORT_Init
2584
2585    CALL NLVSetText 'SW_SORT',              'Caption', 35
2586    CALL NLVSetText 'PB_Sort_OK',           'Caption', 2
2587    CALL NLVSetText 'PB_Sort_Cancel',       'Caption', 3
2588
2589    CALL NLVSetText 'RB_Sort_Ascending',    'Caption', 90
2590    CALL NLVSetText 'RB_Sort_Descending',   'Caption', 91
2591    CALL NLVSetText 'RB_Sort_None',         'Caption', 92
2592
2593    Container = OH
2594say OH
2595say Container
2596    ok = VRMethod(Container, "GetFieldList", "Fields." )
2597
2598    SortOrder = "None"
2599
2600    do I = 1 to Fields.0
2601        ok = VRMethod("LB_SortFields","AddString", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
2602    end   
2603    Old.SortField = VRGet( Container, "DetailSort" )
2604    Old.SortOrder = VRGet( Container, "Sort" )
2605say Old.SortField
2606say Old.SortOrder
2607return
2608
2609/*:VRX         SW_SORT_Fini
2610*/
2611SW_SORT_Fini:
2612    window = VRInfo( "Window" )
2613    call VRDestroy window
2614    drop window
2615return
2616/*:VRX         SW_SORT_Init
2617*/
2618SW_SORT_Init:
2619    window = VRInfo( "Object" )
2620    if( \VRIsChildOf( window, "Notebook" ) ) then do
2621        call VRMethod window, "CenterWindow"
2622        call VRSet window, "Visible", 1
2623        call VRMethod window, "Activate"
2624    end
2625    drop window
2626return
2627
2628/*:VRX         SW_USERS_Close
2629*/
2630SW_USERS_Close:
2631    call SW_USERS_Fini
2632return
2633
2634/*:VRX         SW_USERS_Create
2635*/
2636SW_USERS_Create:
2637    call SW_USERS_Init
2638return
2639
2640/*:VRX         SW_USERS_Fini
2641*/
2642SW_USERS_Fini:
2643    window = VRInfo( "Window" )
2644    call VRDestroy window
2645    drop window
2646return
2647/*:VRX         SW_USERS_Init
2648*/
2649SW_USERS_Init:
2650    window = VRInfo( "Object" )
2651    if( \VRIsChildOf( window, "Notebook" ) ) then do
2652        call VRMethod window, "CenterWindow"
2653        call VRSet window, "Visible", 1
2654        call VRMethod window, "Activate"
2655    end
2656    drop window
2657return
2658
2659/*:VRX         TDL_1_PageSelected
2660*/
2661TDL_1_PageSelected:
2662    page =  VRInfo("Page")
2663    CurrentPageNr = page
2664    ok = VRSet("TM_RefreshDaemons","Enabled", 0)
2665    ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
2666    /* call _TabsStrip */
2667    select
2668        when page = 1 then do /* daemons */
2669            ok = VRSet("TM_RefreshDaemons","Enabled", 1)
2670            ok = VRSet("TM_RefreshDaemons","Delay",   3000)
2671        end
2672        when page = 2 then do /* smbtree */
2673            ok = VRMethod( "CN_SMBTree", "GetRecordList", "All", "handle." )
2674            /* if the page is empty, populate it */
2675            if handle.0 = 0 then call PB_Refresh_Click
2676        end
2677        when page = 3 then do /* Users */
2678            nop
2679        end
2680        when page = 4 then do /* files */
2681            nop
2682        end
2683        when page = 5 then do /* service */
2684            nop
2685        end
2686        when page = 6 then do /* chkTDB */
2687            say "ChkTDB"
2688            call _ChkTDB
2689        end
2690        when page = 7 then do /* Settings */
2691            nop
2692        end
2693        otherwise nop
2694    end
2695return
2696
2697/*:VRX         TM_Refresh_Trigger
2698*/
2699TM_Refresh_Trigger:
2700/*  call beep 1200, 20 */
2701    ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
2702    call _Refresh
2703return
2704
2705/*:VRX         TM_RefreshDaemons_Trigger
2706*/
2707TM_RefreshDaemons_Trigger:
2708    ok = VRSet("TM_RefreshDaemons","Delay", 3000)
2709    call _RefreshDaemons
2710return
2711
2712/*:VRX         TM_RefreshTreeDisplay_Trigger
2713*/
2714TM_RefreshTreeDisplay_Trigger:
2715    select
2716        when RefreshMode = "TREE" then do
2717            call _RefreshTreeDisplay
2718        end
2719        when RefreshMode = "SHARE" then do
2720            call _AddSharesDisplay   
2721        end
2722        otherwise say "RefreshMode = "RefreshMode
2723    end
2724return
2725
2726/*:VRX         TM_Throbber_Trigger
2727*/
2728TM_Throbber_Trigger:
2729    pIdx = VRGet("Pict_Throbber","PicturePath")
2730    parse var pIdx '#' pidx
2731    pidx = pidx + 1
2732    if pidx = 122 then pidx = 111
2733    ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
2734return
2735
Note: See TracBrowser for help on using the repository browser.