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

Last change on this file since 858 was 837, checked in by Herwig Bauernfeind, 12 years ago

GUITools: EVFSGUI (Ticket #231), SMBMon, shared library updates

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