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

Last change on this file since 908 was 908, checked in by Herwig Bauernfeind, 5 years ago

GUITools: SMBMon (TDB Check page), shared library updates

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