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

Last change on this file since 869 was 869, checked in by Herwig Bauernfeind, 11 years ago

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

File size: 83.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 options.!debug == 1 THEN SAY time()' CN_Daemons_ContextMenu() started'
1280 if VRInfo("Top") < 400 & VRGet("CN_Daemons", "View") = "Detail" then do
1281 say " Going for column modification..."
1282 call _ColumnsMenu "CN_Daemons"
1283 end
1284 else do
1285 say " Going for context menu, record = '"VRInfo("Record")"'"
1286
1287 call _RefreshDaemonsDelay
1288 DRH = VRInfo("Record")
1289 DaemonName = ""
1290
1291 OH = VRInfo("Object")
1292 ok = VRset("ContextMenu_Daemons_Details", "Visible", 1 )
1293 ok = VRset("ContextMenu_Daemons_Tree", "Visible", 1 )
1294 ok = VRset("MItem_9", "Visible", 1 )
1295 ok = VRset("ContextMenu_Daemons_Sort", "Visible", 1 )
1296 ok = VRset("ContextMenu_Daemons_MiniIcons", "Visible", 1 )
1297 ok = VRset("MItem_13", "Visible", 1 )
1298 ok = VRset("ContextMenu_Daemons_Ping", "Visible", 1 )
1299 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 1 )
1300 ok = VRset("ContextMenu_Daemons_Start", "Visible", 1 )
1301 ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 1 )
1302
1303 if DRH <> "" then do
1304 DaemonName = VRMethod("CN_Daemons", "GetRecordAttr", DRH, "Caption")
1305 ok = VRset("ContextMenu_Daemons_Ping","Visible", 1 )
1306 end
1307
1308 select
1309 when Words(DaemonName) = 3 & pos("PID ",DaemonName) > 0 then do /* a child process with PID in name */
1310 DaemonName = word(DaemonName,2)
1311 ok = VRSet("ContextMenu_Daemons_KillPID", "Caption", NLVGetMessage( 38, DaemonName))
1312 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1313 end
1314 when Words(DaemonName) = 1 & (pos("mbd.exe",Daemonname) > 0 | pos("winbindd.exe",Daemonname) > 0) then do /* on root process */
1315 parse var DaemonName DaemonName'.exe'
1316 if strip(VRMethod("CN_Daemons", "GetFieldData", DRH, DPidsFH)) <> "" then do
1317 ok = VRSet("ContextMenu_Daemons_Shutdown", "Caption", NLVGetMessage( 33, DaemonName))
1318 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 )
1319 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1320 end
1321 end
1322 when pos("\", DaemonName) > 0 then do /* we are on a file */
1323 ok = VRset("MItem_13", "Visible", 0 )
1324 ok = VRset("ContextMenu_Daemons_Ping", "Visible", 0 )
1325 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 )
1326 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1327 ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 0 )
1328 end
1329 otherwise do /* we are on a user */
1330 ok = VRset("MItem_13", "Visible", 0 )
1331 ok = VRset("ContextMenu_Daemons_Ping", "Visible", 0 )
1332 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 )
1333 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1334 ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 0 )
1335 end
1336 end
1337 say ' Daemon is "'DaemonName'"'
1338 say ' DaemonView = "'DaemonView'"'
1339 if VRGet("CN_Daemons","View") = "Detail" then do
1340 ok = VRSet("ContextMenu_Daemons_Details", "Enabled", 0)
1341 ok = VRSet("ContextMenu_Daemons_Tree", "Enabled", 1)
1342 end
1343 else do
1344 ok = VRSet("ContextMenu_Daemons_Details", "Enabled", 1)
1345 ok = VRSet("ContextMenu_Daemons_Tree", "Enabled", 0)
1346 end
1347 DaemonView = VRGet("CN_Daemons","View")
1348
1349 ok = VRMethod( "ContextMenu_Daemons", "Popup", , , "", "" )
1350 end
1351 IF options.!debug == 1 THEN SAY time()' CN_Daemons_ContextMenu() done'
1352return
1353
1354/*:VRX CN_Files_ContextMenu
1355*/
1356CN_Files_ContextMenu:
1357 if VRInfo("Top") < 400 & VRGet("CN_Files", "View") = "Detail" then call _ColumnsMenu "CN_Files"
1358 else do
1359 RH = VRInfo("Record")
1360 OH = VRInfo("Object")
1361 if RH <> "" then do
1362 ok = VRMethod( "Contextmenu_Files", "Popup", , , "", "PositionOnItem" )
1363 end
1364 end
1365return
1366
1367/*:VRX CN_Service_ContextMenu
1368*/
1369CN_Service_ContextMenu:
1370 if VRInfo("Top") < 400 & VRGet("CN_Service", "View") = "Detail" then call _ColumnsMenu "CN_Service"
1371 else do
1372 ok = VRSet("TM_refresh","Enabled", 0)
1373 SRH = VRInfo("Record")
1374 OH = VRInfo("Object")
1375 if SRH <> "" then do
1376 Service = VRMethod("CN_Service", "GetFieldData", SRH, ServiceFH)
1377 say ' Service is "'Service'"'
1378 ok = VRMethod( "ContextMenu_Service", "Popup", , , "", "" )
1379 end
1380 end
1381return
1382
1383/*:VRX CN_smbtree_Click
1384*/
1385CN_smbtree_Click:
1386 rh = VRInfo('Record')
1387 if VRMethod( 'CN_SMBTREE', "ValidateRecord", rh) <> 1 then return
1388 userdata = VRMethod('CN_smbtree', 'GetRecordAttr', rh, 'UserData')
1389 parse var userdata . '|' userdata
1390 ok = VRset("Main","StatusText", userdata)
1391
1392
1393return
1394
1395/*:VRX CN_smbtree_ContextMenu
1396*/
1397CN_smbtree_ContextMenu:
1398 if VRInfo("Top") < 400 & VRGet("CN_smbtree", "View") = "Detail" then call _ColumnsMenu "CN_smbtree"
1399 else do
1400 RH = VRInfo("Record")
1401 if RH <> "" then do
1402 CurMachine = word(VRMethod( "CN_smbtree", "GetRecordAttr", RH, "Caption" ),1)
1403 ok = VRMethod( "Contextmenu_Tree", "Popup", , , "", "PositionOnItem" )
1404 end
1405 end
1406return
1407
1408/*:VRX CN_Users_ContextMenu
1409*/
1410CN_Users_ContextMenu:
1411 if VRInfo("Top") < 400 & VRGet("CN_users", "View") = "Detail" then call _ColumnsMenu "CN_users"
1412 else do
1413 RH = VRInfo("Record")
1414 OH = VRInfo("Object")
1415 if RH <> "" then do
1416 CurMachine = VRMethod( "CN_users", "GetFieldData", RH, UMachineFH )
1417 ok = VRMethod( "Contextmenu_Users", "Popup", , , "", "PositionOnItem" )
1418 end
1419 end
1420return
1421
1422/*:VRX Columns_01_Click
1423*/
1424Columns_01_Click:
1425 call _ColumnShow
1426return
1427
1428/*:VRX Columns_02_Click
1429*/
1430Columns_02_Click:
1431 call _ColumnShow
1432return
1433
1434/*:VRX Columns_03_Click
1435*/
1436Columns_03_Click:
1437 call _ColumnShow
1438return
1439
1440/*:VRX Columns_04_Click
1441*/
1442Columns_04_Click:
1443 call _ColumnShow
1444return
1445
1446/*:VRX Columns_05_Click
1447*/
1448Columns_05_Click:
1449 call _ColumnShow
1450return
1451
1452/*:VRX Columns_06_Click
1453*/
1454Columns_06_Click:
1455 call _ColumnShow
1456return
1457
1458/*:VRX Columns_07_Click
1459*/
1460Columns_07_Click:
1461 call _ColumnShow
1462return
1463
1464/*:VRX Columns_08_Click
1465*/
1466Columns_08_Click:
1467 call _ColumnShow
1468return
1469
1470/*:VRX Columns_09_Click
1471*/
1472Columns_09_Click:
1473 call _ColumnShow
1474return
1475
1476/*:VRX Columns_10_Click
1477*/
1478Columns_10_Click:
1479 call _ColumnShow
1480return
1481
1482/*:VRX Columns_11_Click
1483*/
1484Columns_11_Click:
1485 call _ColumnShow
1486return
1487
1488/*:VRX Columns_12_Click
1489*/
1490Columns_12_Click:
1491 call _ColumnShow
1492return
1493
1494/*:VRX Columns_13_Click
1495*/
1496Columns_13_Click:
1497 call _ColumnShow
1498return
1499
1500/*:VRX Columns_14_Click
1501*/
1502Columns_14_Click:
1503 call _ColumnShow
1504return
1505
1506/*:VRX ContextMenu_Daemons_Details_Click
1507*/
1508ContextMenu_Daemons_Details_Click:
1509 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() started'
1510 ok = VRset("CN_Daemons","View","Detail")
1511 ok = VRset("ContextMenu_Daemons_Tree","Enabled",1)
1512 ok = VRset("ContextMenu_Daemons_Details","Enabled",0)
1513 ok = VRSet("TM_refresh","Enabled", 1)
1514 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() done'
1515return
1516
1517/*:VRX ContextMenu_Daemons_KillPID_Click
1518*/
1519ContextMenu_Daemons_KillPID_Click:
1520 Msg.Text = NLVGetMessage(39, DaemonName)
1521 Msg.Type = 'Q'
1522 if _MsgYesNo() = 1 then do
1523 ok = PRKillProcess("1",DaemonName )
1524 if ok = 0 then say ", success!"; else say ", error "ok
1525
1526/* say 'kill -9 'DaemonName
1527 address cmd 'kill -9 'DaemonName */
1528 end
1529 ok = VRSet("TM_Refresh","Enabled", 1)
1530return
1531
1532/*:VRX ContextMenu_Daemons_MiniIcons_Click
1533*/
1534ContextMenu_Daemons_MiniIcons_Click:
1535 advanced.!bigicons = \advanced.!bigicons
1536 ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons)
1537 ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
1538 ok = VRset("ContextMenu_Tree_MiniIcons", "Checked", \advanced.!bigicons)
1539 ok = VRset("ContextMenu_Daemons_MiniIcons", "Checked", \advanced.!bigicons)
1540return
1541
1542/*:VRX ContextMenu_Daemons_Ping_Click
1543*/
1544ContextMenu_Daemons_Ping_Click:
1545 ok = VRSet("Main", 'Pointer', 'Wait' )
1546 address cmd samba.!smbcontrolexe' 'DaemonName' ping --timeout=3 --debuglevel=0 2>'samba.!error' 1>'samba.!msg
1547 call _SambaShowMsg "section table registered"
1548
1549 ok = VRSet("Main", 'Pointer', '<default>' )
1550 ok = VRSet("TM_refresh","Enabled", 1)
1551return
1552
1553/*:VRX ContextMenu_Daemons_Shutdown_Click
1554*/
1555ContextMenu_Daemons_Shutdown_Click:
1556 Msg.Text = NLVGetMessage(34, DaemonName)
1557 Msg.Type = 'Q'
1558 if _MsgYesNo() = 1 then do
1559 address cmd samba.!smbcontrolexe' 'DaemonName' shutdown 2>'samba.!error' 1>'samba.!msg
1560 call _SambaShowMsg "section table registered tdb"
1561 end
1562 ok = VRSet("TM_Refresh","Enabled", 1)
1563return
1564
1565/*:VRX ContextMenu_Daemons_Sort_Click
1566*/
1567ContextMenu_Daemons_Sort_Click:
1568 window = VRLoadSecondary( "SW_SORT", "W" )
1569return
1570
1571/*:VRX ContextMenu_Daemons_Start_Click
1572*/
1573ContextMenu_Daemons_Start_Click:
1574 Msg.Text = NLVGetMessage(37, DaemonName)
1575 Msg.Type = 'Q'
1576 if _MsgYesNo() = 1 then do
1577 say samba.!smbcmd' start 'DaemonName
1578 address cmd samba.!smbcmd' start 'DaemonName
1579 end
1580 ok = VRSet("TM_Refresh","Enabled", 1)
1581return
1582
1583/*:VRX ContextMenu_Daemons_Tree_Click
1584*/
1585ContextMenu_Daemons_Tree_Click:
1586 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() started'
1587 ok = VRset("CN_Daemons","View","IconTree")
1588 ok = VRset("ContextMenu_Daemons_Tree","Enabled",0)
1589 ok = VRset("ContextMenu_Daemons_Details","Enabled",1)
1590 ok = VRSet("TM_refresh","Enabled", 1)
1591 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() done'
1592return
1593
1594/*:VRX ContextMenu_Files_Sort_Click
1595*/
1596ContextMenu_Files_Sort_Click:
1597 window = VRLoadSecondary( "SW_SORT", "W" )
1598return
1599
1600/*:VRX ContextMenu_Service_CloseShare_Click
1601*/
1602ContextMenu_Service_CloseShare_Click:
1603 Msg.Text = NLVGetMessage(75, Service)
1604 Msg.Type = 'Q'
1605 if _MsgYesNo() = 1 then do
1606 address cmd samba.!smbcontrolexe' smbd close-share 'Service' --debuglevel=0' /* ' 2>'samba.!error' 1>'samba.!msg */
1607 /* No usable output from Samba here ! */
1608 /* call _SambaShowMsg */
1609 Msg.Text = NLVGetMessage(76, Service)
1610 Msg.Type = 'I'
1611 call _ShowMsg
1612 end
1613 ok = VRSet("TM_refresh","Enabled", 1)
1614return
1615
1616/*:VRX ContextMenu_Service_Sort_Click
1617*/
1618ContextMenu_Service_Sort_Click:
1619 window = VRLoadSecondary( "SW_SORT", "W" )
1620return
1621
1622/*:VRX ContextMenu_Tree_Details_Click
1623*/
1624ContextMenu_Tree_Details_Click:
1625 ok = VRset("CN_smbtree","View","Detail")
1626 ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
1627 ok = VRset("ContextMenu_Tree_Details","Enabled",0)
1628 ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
1629 ok = VRset("TM_Throbber", "Enabled", 1)
1630 ok = VRset("Pict_Throbber", "Visible", 0)
1631 call _RefreshTree
1632return
1633
1634/*:VRX ContextMenu_Tree_Icons_Click
1635*/
1636ContextMenu_Tree_Icons_Click:
1637 ok = VRset("CN_smbtree","View","Icon")
1638 ok = VRset("ContextMenu_Tree_Icons","Enabled",0)
1639 ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
1640 ok = VRset("ContextMenu_Tree_Details","Enabled",1)
1641 ok = VRset("TM_Throbber", "Enabled", 1)
1642 ok = VRset("Pict_Throbber", "Visible", 1)
1643 call _RefreshTree
1644return
1645
1646/*:VRX ContextMenu_Tree_MiniIcons_Click
1647*/
1648ContextMenu_Tree_MiniIcons_Click:
1649 advanced.!bigicons = \advanced.!bigicons
1650 ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons)
1651 ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
1652 ok = VRset("ContextMenu_Tree_MiniIcons", "Checked", \advanced.!bigicons)
1653 ok = VRset("ContextMenu_Daemons_MiniIcons", "Checked", \advanced.!bigicons)
1654return
1655
1656/*:VRX ContextMenu_Tree_SendMsg_Click
1657*/
1658ContextMenu_Tree_SendMsg_Click:
1659 call _SendMsg
1660return
1661
1662/*:VRX ContextMenu_Tree_Sort_Click
1663*/
1664ContextMenu_Tree_Sort_Click:
1665 window = VRLoadSecondary( "SW_SORT", "W" )
1666return
1667
1668/*:VRX ContextMenu_Tree_Tree_Click
1669*/
1670ContextMenu_Tree_Tree_Click:
1671 ok = VRset("CN_smbtree","View","IconTree")
1672 ok = VRset("ContextMenu_Tree_Tree","Enabled",0)
1673 ok = VRset("ContextMenu_Tree_Details","Enabled",1)
1674 ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
1675 ok = VRset("TM_Throbber", "Enabled", 1)
1676 ok = VRset("Pict_Throbber", "Visible", 1)
1677 call _RefreshTree
1678return
1679
1680/*:VRX ContextMenu_Users_SendMsg_Click
1681*/
1682ContextMenu_Users_SendMsg_Click:
1683 call _SendMsg
1684return
1685
1686/*:VRX ContextMenu_Users_Sort_Click
1687*/
1688ContextMenu_Users_Sort_Click:
1689 window = VRLoadSecondary( "SW_SORT", "W" )
1690return
1691
1692/*:VRX DT_STATUSBAR_ContextMenu
1693*/
1694DT_STATUSBAR_ContextMenu:
1695 ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
1696return
1697
1698/*:VRX Fini
1699*/
1700Fini:
1701 window = VRWindow()
1702 call VRSet window, "Visible", 0
1703 drop window
1704return 0
1705
1706/*:VRX GetBootDrive
1707*/
1708GetBootDrive:
1709/* Use SysBootDrive if possible */
1710If Rxfuncadd('SysBootDrive', 'RexxUtil', 'SysBootDrive') Then
1711 Return Left(Value('RUNWORKPLACE',,'OS2ENVIRONMENT'),2)
1712Else
1713 Return SysBootDrive()
1714
1715
1716/*:VRX Halt
1717*/
1718Halt:
1719 signal _VREHalt
1720return
1721
1722/*:VRX Init
1723*/
1724Init:
1725window = VRWindow()
1726call VRMethod window, "CenterWindow"
1727call VRSet window, "Visible", 0
1728call VRMethod window, "Activate"
1729drop window
1730return
1731
1732/*:VRX LB_SortFields_Click
1733*/
1734LB_SortFields_Click:
1735 call _ContainerSort
1736return
1737
1738/*:VRX Main_Activate
1739*/
1740Main_Activate:
1741 call TM_Refresh_Trigger
1742 ok = VRset("TM_Refresh", "Enabled", 1)
1743return
1744
1745/*:VRX Main_Close
1746*/
1747Main_Close:
1748 call Quit
1749return
1750
1751/*:VRX Main_Create
1752*/
1753Main_Create:
1754 options.!debug = 0
1755 if options.!debug == 1 then do
1756 ok = VRRedirectStdIO("ON")
1757 say time()' Main_Create started'
1758 end
1759 else ok = VRRedirectStdIO("OFF")
1760
1761 call _LoadOtherFuncs
1762 call _InitTempDir
1763
1764 call _IniRead
1765 call NLVSetup
1766
1767 call _TabbeddialogSetup
1768 call _NLVSetup
1769 call _SambaInit
1770 if \WPSStartStop then call _CreateSmbStarter
1771 if _SambaRunning() then call _SambaFindPIDfile
1772 call _ContainerInit
1773 call _GUIInit
1774
1775/* str = 'call TAB_'CurrentPageNr'_Click';
1776say str
1777interpret str
1778say 'Done 'str
1779 if CurrentPageNr <> 5 then do
1780 ok = VRSet("TM_Throbber", "Enabled", 1)
1781 call _RefreshTree
1782 end */
1783 ok = VRMethod("PB_Refresh","SetFocus")
1784
1785 if options.!debug == 1 then say time()' Main_Create done'
1786return
1787/*:VRX Main_Deactivate
1788*/
1789Main_Deactivate:
1790 ok = VRset("TM_Refresh", "Enabled", 0)
1791return
1792
1793/*:VRX Main_Resize
1794*/
1795Main_Resize:
1796 IF options.!debug == 1 THEN SAY time()' Main_Resize started'
1797 ok = VRSet("Main","Painting", 0)
1798
1799 /* Basic measurements */
1800 main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */
1801 main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */
1802
1803 /* if main_iheight < 5500 then ok = VRSet("Main","Height",6200) */
1804 sbar_height = 209 /* Height of status-bar */
1805 marginx2 = margin * 2 /* Common margin around controls */
1806
1807 pbtn_dist = 980
1808 pbtn_nr = 4
1809 pbtn_pos = max((main_iwidth - pbtn_Dist * pbtn_Nr)%2, 0)+ margin
1810 pbtn_height = 400 /* Height of the panels' internal button areas */
1811 pbtn_width = 940
1812
1813 pane_height = main_iheight- sbar_height - pbtn_height - margin * 7 /* Height of notebook */
1814 pane_width = main_iwidth - marginx2 /* Width of the notebook panel */
1815
1816 /* Tabbed Dialog */
1817 ok = VRset("TDL_1", "Top", marginx2 )
1818 ok = VRset("TDL_1", "Left", margin )
1819 ok = VRset("TDL_1", "Width", pane_width )
1820 ok = VRset("TDL_1", "Height", pane_height )
1821
1822 /* Statusbar */
1823 ok = VRSet("GB_STATUSBAR", "Left", margin )
1824 ok = VRSet("GB_STATUSBAR", "Top", main_iheight - sbar_height - margin )
1825 ok = VRSet("GB_STATUSBAR", "Height",sbar_height )
1826 ok = VRSet("GB_STATUSBAR", "Width", pane_width )
1827
1828 ok = VRSet("DT_STATUSBAR", "Top", 12 )
1829 ok = VRSet("DT_STATUSBAR", "Left", 12 )
1830 ok = VRSet("DT_STATUSBAR", "Height",sbar_height- 24)
1831 ok = VRSet("DT_STATUSBAR", "Width", pane_width - 24)
1832
1833 ok = VRSet("PB_Refresh","top", pane_height + margin * 4 )
1834 ok = VRSet("PB_Help", "top", pane_height + margin * 4 )
1835 ok = VRSet("PB_Cancel", "top", pane_height + margin * 4 )
1836 ok = VRSet("PB_About", "top", pane_height + margin * 4 )
1837
1838 ok = VRSet("PB_Refresh","left",pbtn_pos + pbtn_dist * (pbtn_nr - 4))
1839 ok = VRSet("PB_Help", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 3))
1840 ok = VRSet("PB_About", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 2))
1841 ok = VRSet("PB_Cancel", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 1))
1842
1843 ok = VRset("GB_USERS","Top", margin )
1844 ok = VRset("GB_USERS","Left", marginx2)
1845 ok = VRset("GB_USERS","Width", pane_width - 760)
1846 ok = VRset("GB_USERS","Height", pane_height- 1020)
1847 ok = VRset("CN_USERS","Top", margin)
1848 ok = VRset("CN_USERS","Left", margin)
1849 ok = VRset("CN_USERS","Width", pane_width - 760 - marginx2 )
1850 ok = VRset("CN_USERS","Height", pane_height- 1020- marginx2 )
1851
1852 ok = VRset("GB_FILES","Top", margin )
1853 ok = VRset("GB_FILES","Left", marginx2)
1854 ok = VRset("GB_FILES","Width", pane_width - 760)
1855 ok = VRset("GB_FILES","Height", pane_height- 1020)
1856 ok = VRset("CN_FILES","Top", margin)
1857 ok = VRset("CN_FILES","Left", margin)
1858 ok = VRset("CN_FILES","Width", pane_width - 760 - marginx2 )
1859 ok = VRset("CN_FILES","Height", pane_height- 1020- marginx2 )
1860
1861 ok = VRset("GB_SERVICE","Top", margin )
1862 ok = VRset("GB_SERVICE","Left", marginx2)
1863 ok = VRset("GB_SERVICE","Width", pane_width - 760)
1864 ok = VRset("GB_SERVICE","Height", pane_height- 1020)
1865 ok = VRset("CN_SERVICE","Top", margin)
1866 ok = VRset("CN_SERVICE","Left", margin)
1867 ok = VRset("CN_SERVICE","Width", pane_width - 760 - marginx2 )
1868 ok = VRset("CN_SERVICE","Height", pane_height- 1020- marginx2 )
1869
1870 ok = VRset("GB_DAEMONS","Top", margin )
1871 ok = VRset("GB_DAEMONS","Left", marginx2)
1872 ok = VRset("GB_DAEMONS","Width", pane_width - 760)
1873 ok = VRset("GB_DAEMONS","Height", pane_height- 1020)
1874 ok = VRset("CN_DAEMONS","Top", margin)
1875 ok = VRset("CN_DAEMONS","Left", margin)
1876 ok = VRset("CN_DAEMONS","Width", pane_width - 760 - margin*4 - pbtn_width)
1877 ok = VRset("CN_DAEMONS","Height", pane_height- 1020 - marginx2 )
1878
1879 ok = VRSet("PB_START", "Top", pbtn_height*2 - marginx2)
1880 ok = VRSet("PB_STOP", "Top", pbtn_height*3 - marginx2)
1881 ok = VRSet("PB_Restart","Top", pbtn_height*4 - marginx2)
1882 ok = VRSet("PB_Reload", "Top", pbtn_height*5 - marginx2)
1883 ok = VRSet("PB_DelLogs","Top", pbtn_height*6 - marginx2)
1884
1885 ok = VRSet("PB_START", "Left", pane_width - 760 - marginx2 - pbtn_width)
1886 ok = VRSet("PB_STOP", "Left", pane_width - 760 - marginx2 - pbtn_width)
1887 ok = VRSet("PB_Restart","Left", pane_width - 760 - marginx2 - pbtn_width)
1888 ok = VRSet("PB_Reload", "Left", pane_width - 760 - marginx2 - pbtn_width)
1889 ok = VRSet("PB_DelLogs","Left", pane_width - 760 - marginx2 - pbtn_width)
1890
1891 ok = VRset("GB_SMBTREE","Top", margin )
1892 ok = VRset("GB_SMBTREE","Left", marginx2)
1893 ok = VRset("GB_SMBTREE","Width", pane_width - 760)
1894 ok = VRset("GB_SMBTREE","Height", pane_height- 1020)
1895 ok = VRset("CN_SMBTREE","Top", margin)
1896 ok = VRset("CN_SMBTREE","Left", margin)
1897 ok = VRset("CN_SMBTREE","Width", pane_width - 760 - marginx2 )
1898 ok = VRset("CN_SMBTREE","Height", pane_height- 1020- marginx2 )
1899
1900 ok = VRset("PICT_THROBBER", "Top", VRGet("CN_SMBTREE","Height") % 2 - 100 )
1901 ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width") % 2 - 200 )
1902
1903 ok = VRset("GB_SETTINGS","Top", margin )
1904 ok = VRset("GB_SETTINGS","Left", marginx2)
1905 ok = VRset("GB_SETTINGS","Width", pane_width - 760)
1906 ok = VRset("GB_SETTINGS","Height", pane_height- 1020)
1907
1908
1909 /* check and empty event queue, trash spurious resize events */
1910 EventString = ''
1911 TrashedResize = 0
1912 do until EventString = 'nop'
1913 EventString = VREvent('N')
1914 if EventString <> 'nop' then do
1915 if EventString = 'CALL Main_Resize' then TrashedResize = 1
1916 else interpret eventString
1917 end
1918 end
1919 if TrashedResize then CALL Main_Resize
1920 ok = VRSet("Main", "Painting", 1)
1921
1922 IF options.!debug == 1 THEN SAY time()' Main_Resize done'
1923return
1924
1925/*:VRX Page1_Create
1926*/
1927Page1_Create:
1928
1929Return
1930
1931/*:VRX Page1_Init
1932*/
1933Page1_Init:
1934 call _ContainerInit
1935return
1936
1937/*:VRX Page2_Create
1938*/
1939Page2_create:
1940
1941Return
1942/*:VRX Page2_init
1943*/
1944Page2_init:
1945
1946return
1947
1948/*:VRX Page3_Create
1949*/
1950Page3_create:
1951
1952Return
1953/*:VRX Page3_Init
1954*/
1955Page3_Init:
1956
1957return
1958
1959/*:VRX Page4_Create
1960*/
1961Page4_Create:
1962
1963Return
1964/*:VRX Page4_init
1965*/
1966Page4_init:
1967
1968return
1969
1970/*:VRX Page5_Create
1971*/
1972Page5_Create:
1973
1974return
1975
1976/*:VRX Page5_Init
1977*/
1978Page5_Init:
1979
1980return
1981
1982/*:VRX Paper_Init
1983*/
1984Paper_Init:
1985 ok = VRSet("IPB_Paper","Width" ,VRMethod( "Screen", "PixelsToTwips", 32 ))
1986 ok = VRSet("IPB_Paper","Height",VRMethod( "Screen", "PixelsToTwips", 32 ))
1987 ok = VRset("IPB_Paper","Left",VRget("GB_Main2","width")-420)
1988return
1989
1990/*:VRX PB_About_Click
1991*/
1992PB_About_Click:
1993 window = VRLoadSecondary( "About", "W" )
1994return
1995
1996/*:VRX PB_AboutOK_Click
1997*/
1998PB_AboutOK_Click:
1999 call About_Close
2000return
2001
2002/*:VRX PB_Cancel_Click
2003*/
2004PB_Cancel_Click:
2005 say 'start PB_Cancel_Click'
2006 Call Quit
2007 say 'done PB_Cancel_Click'
2008return
2009
2010/*:VRX PB_DELLOGS_Click
2011*/
2012PB_DELLOGS_Click:
2013 call VRSet VRWindow(), 'Pointer', 'Wait'
2014
2015 /* Fixme - this needs to be read from smb.conf */
2016 samba.!logdir = ETC'\samba\log'
2017
2018 ok = SysFileTree(samba.!logdir'\log.*', logs.,'FO')
2019 do I = 1 to logs.0
2020 ok = VRMethod( "CN_Daemons", "GetRecordList", "All", "handle." )
2021 KeepLog = 0
2022 do J = 1 to handle.0
2023 CurPID = VRMethod("CN_Daemons", "GetFieldData", handle.J, DPidsFH)
2024 if pos(CurPID,logs.I) > 0 then KeepLog = 1
2025 end
2026 if KeepLog = 0 then ok = SysFileDelete(logs.I)
2027 end
2028
2029 call VRSet VRWindow(), 'Pointer', '<default>'
2030return
2031
2032/*:VRX PB_Help_Click
2033*/
2034PB_Help_Click:
2035 ok = VRMethod("Main", "InvokeHelp" )
2036return
2037
2038/*:VRX PB_Refresh_Click
2039*/
2040PB_Refresh_Click:
2041 IF options.!debug == 1 then say time()' PB_Refresh_Click() started'
2042 ok = SysSleep(0.3)
2043
2044 say " CurrentPageNr = "CurrentPageNr
2045
2046 if CurrentPageNr = 2 then do
2047 ok = VRset("Pict_Throbber", "Visible", 1)
2048 ok = VRset("TM_Throbber", "Enabled", 1)
2049 call _RefreshTree
2050 end
2051 else call _Refresh
2052 IF options.!debug == 1 then say time()' PB_Refresh_Click() done'
2053return
2054
2055/*:VRX PB_RELOAD_Click
2056*/
2057PB_RELOAD_Click:
2058 call VRSet VRWindow(), 'Pointer', 'Wait'
2059 if WPSStartStop then do
2060 ok = SysOpenObject('<smb_reload>', 'DEFAULT', 1)
2061 end
2062 else do
2063 call lineout samba.!bin"\smbstart", "reload"
2064 ok = stream(samba.!bin"\reload","c","close")
2065 end
2066 ok = VRSet("TM_Refresh","Delay", 2000)
2067 call VRSet VRWindow(), 'Pointer', '<default>'
2068return
2069
2070/*:VRX PB_RESTART_Click
2071*/
2072PB_RESTART_Click:
2073 call VRSet VRWindow(), 'Pointer', 'Wait'
2074 if WPSStartStop then do
2075 ok = SysOpenObject('<smb_restart>', 'DEFAULT', 1)
2076 end
2077 else do
2078 call lineout samba.!bin"\restart", "restart"
2079 ok = stream(samba.!bin"\restart","c","close")
2080 end
2081 ok = VRSet("TM_Refresh","Delay", 1000)
2082 call VRSet VRWindow(), 'Pointer', '<default>'
2083return
2084
2085/*:VRX PB_Sort_Cancel_Click
2086*/
2087PB_Sort_Cancel_Click:
2088 ok = VRset( Container, "DetailSort", Old.SortField )
2089 ok = VRSet( Container, "Sort", Old.SortOrder )
2090 ok = VRMethod( Container, "SortRecords" )
2091 drop Old.
2092 call SW_SORT_Close
2093return
2094
2095/*:VRX PB_Sort_OK_Click
2096*/
2097PB_Sort_OK_Click:
2098 drop Old.
2099 call SW_SORT_Close
2100return
2101
2102/*:VRX PB_START_Click
2103*/
2104PB_START_Click:
2105 say "IPB_Start_Click started"
2106 call VRSet VRWindow(), 'Pointer', 'Wait'
2107 if WPSStartStop then do
2108 ok = SysOpenObject('<smb_start>', 'DEFAULT', 1)
2109 end
2110 else do
2111 call lineout samba.!bin"\smbstart", "smbstart"
2112 ok = stream(samba.!bin"\smbstart","c","close")
2113 end
2114 ok = VRSet("TM_Refresh","Delay", 1000)
2115 call VRSet VRWindow(), 'Pointer', '<default>'
2116 say "IPB_Start_Click done"
2117return
2118/*:VRX PB_STOP_Click
2119*/
2120PB_STOP_Click:
2121 say "IPB_Stop_Click started"
2122 call VRSet VRWindow(), 'Pointer', 'Wait'
2123 if WPSStartStop then do
2124 ok = SysOpenObject('<smb_stop>', 'DEFAULT', 1)
2125 end
2126 else do
2127 call lineout samba.!bin"\smbstop", "smbstop"
2128 ok = stream(samba.!bin"\smbstop","c","close")
2129 end
2130 ok = VRSet("TM_Refresh","Delay", 1000)
2131 call VRSet VRWindow(), 'Pointer', '<default>'
2132 say "IPB_Stop_Click done"
2133return
2134/*:VRX PushbackAll
2135*/
2136PushbackAll:
2137 Pages = 6
2138 /* Tab distance from top */
2139 TabTop = 20
2140 TabWidth = VRMethod( "Screen", "PixelsToTwips", 78 )
2141 TabHeight= VRMethod( "Screen", "PixelsToTwips", 24 )
2142
2143 /* Page Position */
2144 PageLeft = 120
2145 PageTop = PageLeft + TabTop + 330
2146
2147 /* Page size */
2148 PageHeight = 3000
2149 PageWidth = 3000
2150 call beep 880, 20
2151/* ok = VRset("DT_PageName", "Caption", "")
2152 ok = VRSet("GB_Main","Left", 0)
2153 ok = VRSet("GB_Main","Top", TabTop+230)
2154 do I = 1 to Pages
2155 ok = VRSet("TAB_"I,"Top", TabTop)
2156 ok = VRSet("TAB_"I,"PicturePath","#2"||I||";#2"||I)
2157 ok = VRSet("TAB_"I,"Left",TabWidth*(I-1)+PageLeft)
2158 ok = VRSet("TAB_"I,"Width",TabWidth)
2159 ok = VRSet("TAB_"I,"Height",TabHeight)
2160 ok = VRSet("Page_"I,"Height", max(PageHeight,VRget("GB_Main2","Height")-600))
2161 ok = VRSet("Page_"I,"Width", max(PageWidth,VRget("GB_Main2","Width")-450))
2162 ok = VRSet("Page_"I,"Left", PageLeft)
2163 ok = VRSet("Page_"I,"Top", PageTop)
2164 ok = VRSet("Page_"I,"Visible", 0)
2165 ok = VRSet("Page_"I,"BackColor", "<default>")
2166 end */
2167return
2168
2169/*:VRX Quit
2170*/
2171Quit:
2172 call VRSet VRWindow(), 'Pointer', 'Wait'
2173 call _IniWrite
2174 ok = VRRedirectStdIO("OFF")
2175 call _SambaFinish
2176
2177 ok = SysFileDelete(smbdoutput)
2178
2179 call lineout samba.!bin"\quit", "quit"
2180 ok = stream(samba.!bin"\quit","c","close")
2181 ok = SysSleep(1)
2182 ok = SysDestroyObject('<smbstarter>')
2183 ok = SysFileDelete(samba.!bin'\smbstarter.cmd')
2184 ok = SysFileDelete(samba.!bin'\quit')
2185 call VRSet VRWindow(), 'Pointer', '<default>'
2186
2187 window = VRWindow()
2188 call VRSet window, "Shutdown", 1
2189 drop window
2190return
2191
2192/*:VRX RB_Sort_Ascending_Click
2193*/
2194RB_Sort_Ascending_Click:
2195 SortOrder = "Ascending"
2196 call _ContainerSort
2197return
2198
2199/*:VRX RB_Sort_Descending_Click
2200*/
2201RB_Sort_Descending_Click:
2202 SortOrder = "Descending"
2203 call _ContainerSort
2204return
2205
2206/*:VRX RB_Sort_None_Click
2207*/
2208RB_Sort_None_Click:
2209 SortOrder = "None"
2210 call _ContainerSort
2211return
2212
2213/*:VRX SPIN_Intervall_Change
2214*/
2215SPIN_Intervall_Change:
2216 Intervall = VRGet("SPIN_Intervall","Value")
2217 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
2218return
2219
2220/*:VRX SPIN_IntervallMin_Change
2221*/
2222SPIN_IntervallMin_Change:
2223 IntervallMin = VRGet("SPIN_IntervallMin","Value")
2224return
2225
2226/*:VRX SW_DAEMONS_Close
2227*/
2228SW_DAEMONS_Close:
2229 call SW_DAEMONS_Fini
2230return
2231
2232/*:VRX SW_DAEMONS_Create
2233*/
2234SW_DAEMONS_Create:
2235 call SW_DAEMONS_Init
2236return
2237
2238/*:VRX SW_DAEMONS_Fini
2239*/
2240SW_DAEMONS_Fini:
2241 window = VRInfo( "Window" )
2242 call VRDestroy window
2243 drop window
2244return
2245/*:VRX SW_DAEMONS_Init
2246*/
2247SW_DAEMONS_Init:
2248 window = VRInfo( "Object" )
2249 if( \VRIsChildOf( window, "Notebook" ) ) then do
2250 call VRMethod window, "CenterWindow"
2251 call VRSet window, "Visible", 1
2252 call VRMethod window, "Activate"
2253 end
2254 drop window
2255return
2256
2257/*:VRX SW_FILES_Close
2258*/
2259SW_FILES_Close:
2260 call SW_FILES_Fini
2261return
2262
2263/*:VRX SW_FILES_Create
2264*/
2265SW_FILES_Create:
2266 call SW_FILES_Init
2267return
2268
2269/*:VRX SW_FILES_Fini
2270*/
2271SW_FILES_Fini:
2272 window = VRInfo( "Window" )
2273 call VRDestroy window
2274 drop window
2275return
2276/*:VRX SW_FILES_Init
2277*/
2278SW_FILES_Init:
2279 window = VRInfo( "Object" )
2280 if( \VRIsChildOf( window, "TDL" ) ) then do
2281 call VRMethod window, "CenterWindow"
2282 call VRSet window, "Visible", 1
2283 call VRMethod window, "Activate"
2284 end
2285 drop window
2286return
2287
2288/*:VRX SW_SERVICE_Close
2289*/
2290SW_SERVICE_Close:
2291 call SW_SERVICE_Fini
2292return
2293
2294/*:VRX SW_SERVICE_Create
2295*/
2296SW_SERVICE_Create:
2297 call SW_SERVICE_Init
2298return
2299
2300/*:VRX SW_SERVICE_Fini
2301*/
2302SW_SERVICE_Fini:
2303 window = VRInfo( "Window" )
2304 call VRDestroy window
2305 drop window
2306return
2307/*:VRX SW_SERVICE_Init
2308*/
2309SW_SERVICE_Init:
2310 window = VRInfo( "Object" )
2311 if( \VRIsChildOf( window, "TDL" ) ) then do
2312 call VRMethod window, "CenterWindow"
2313 call VRSet window, "Visible", 1
2314 call VRMethod window, "Activate"
2315 end
2316 drop window
2317return
2318
2319/*:VRX SW_SETTINGS_Close
2320*/
2321SW_SETTINGS_Close:
2322 call SW_SETTINGS_Fini
2323return
2324
2325/*:VRX SW_SETTINGS_Create
2326*/
2327SW_SETTINGS_Create:
2328 call SW_SETTINGS_Init
2329return
2330
2331/*:VRX SW_SETTINGS_Fini
2332*/
2333SW_SETTINGS_Fini:
2334 window = VRInfo( "Window" )
2335 call VRDestroy window
2336 drop window
2337return
2338/*:VRX SW_SETTINGS_Init
2339*/
2340SW_SETTINGS_Init:
2341 window = VRInfo( "Object" )
2342 if( \VRIsChildOf( window, "TDL" ) ) then do
2343 call VRMethod window, "CenterWindow"
2344 call VRSet window, "Visible", 1
2345 call VRMethod window, "Activate"
2346 end
2347 drop window
2348return
2349
2350/*:VRX SW_SMBTREE_Close
2351*/
2352SW_SMBTREE_Close:
2353 call SW_SMBTREE_Fini
2354return
2355
2356/*:VRX SW_SMBTREE_Create
2357*/
2358SW_SMBTREE_Create:
2359 call SW_SMBTREE_Init
2360return
2361
2362/*:VRX SW_SMBTREE_Fini
2363*/
2364SW_SMBTREE_Fini:
2365 window = VRInfo( "Window" )
2366 call VRDestroy window
2367 drop window
2368return
2369/*:VRX SW_SMBTREE_Init
2370*/
2371SW_SMBTREE_Init:
2372 window = VRInfo( "Object" )
2373 if( \VRIsChildOf( window, "TDL" ) ) then do
2374 call VRMethod window, "CenterWindow"
2375 call VRSet window, "Visible", 1
2376 call VRMethod window, "Activate"
2377 end
2378 drop window
2379return
2380
2381/*:VRX SW_SMBTREE_Init_Content
2382*/
2383SW_SMBTREE_Init_Content:
2384 ok = VRset("Pict_Throbber", "Visible", 1)
2385 ok = VRset("TM_Throbber", "Enabled", 1)
2386 call _RefreshTree
2387return
2388
2389/*:VRX SW_SORT_Close
2390*/
2391SW_SORT_Close:
2392 call SW_SORT_Fini
2393return
2394
2395/*:VRX SW_SORT_Create
2396*/
2397SW_SORT_Create:
2398 call SW_SORT_Init
2399
2400 CALL NLVSetText 'SW_SORT', 'Caption', 35
2401 CALL NLVSetText 'PB_Sort_OK', 'Caption', 2
2402 CALL NLVSetText 'PB_Sort_Cancel', 'Caption', 3
2403
2404 CALL NLVSetText 'RB_Sort_Ascending', 'Caption', 90
2405 CALL NLVSetText 'RB_Sort_Descending', 'Caption', 91
2406 CALL NLVSetText 'RB_Sort_None', 'Caption', 92
2407
2408 Container = OH
2409say OH
2410say Container
2411 ok = VRMethod(Container, "GetFieldList", "Fields." )
2412
2413 SortOrder = "None"
2414
2415 do I = 1 to Fields.0
2416 ok = VRMethod("LB_SortFields","AddString", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
2417 end
2418 Old.SortField = VRGet( Container, "DetailSort" )
2419 Old.SortOrder = VRGet( Container, "Sort" )
2420say Old.SortField
2421say Old.SortOrder
2422return
2423
2424/*:VRX SW_SORT_Fini
2425*/
2426SW_SORT_Fini:
2427 window = VRInfo( "Window" )
2428 call VRDestroy window
2429 drop window
2430return
2431/*:VRX SW_SORT_Init
2432*/
2433SW_SORT_Init:
2434 window = VRInfo( "Object" )
2435 if( \VRIsChildOf( window, "Notebook" ) ) then do
2436 call VRMethod window, "CenterWindow"
2437 call VRSet window, "Visible", 1
2438 call VRMethod window, "Activate"
2439 end
2440 drop window
2441return
2442
2443/*:VRX SW_USERS_Close
2444*/
2445SW_USERS_Close:
2446 call SW_USERS_Fini
2447return
2448
2449/*:VRX SW_USERS_Create
2450*/
2451SW_USERS_Create:
2452 call SW_USERS_Init
2453return
2454
2455/*:VRX SW_USERS_Fini
2456*/
2457SW_USERS_Fini:
2458 window = VRInfo( "Window" )
2459 call VRDestroy window
2460 drop window
2461return
2462/*:VRX SW_USERS_Init
2463*/
2464SW_USERS_Init:
2465 window = VRInfo( "Object" )
2466 if( \VRIsChildOf( window, "Notebook" ) ) then do
2467 call VRMethod window, "CenterWindow"
2468 call VRSet window, "Visible", 1
2469 call VRMethod window, "Activate"
2470 end
2471 drop window
2472return
2473
2474/*:VRX TDL_1_PageSelected
2475*/
2476TDL_1_PageSelected:
2477 page = VRInfo("Page")
2478 CurrentPageNr = page
2479 ok = VRSet("TM_RefreshDaemons","Enabled", 0)
2480 ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
2481 /* call _TabsStrip */
2482 select
2483 when page = 1 then do /* daemons */
2484 ok = VRSet("TM_RefreshDaemons","Enabled", 1)
2485 ok = VRSet("TM_RefreshDaemons","Delay", 3000)
2486 end
2487 when page = 2 then do /* smbtree */
2488 ok = VRMethod( "CN_SMBTree", "GetRecordList", "All", "handle." )
2489 /* if the page is empty, populate it */
2490 if handle.0 = 0 then call PB_Refresh_Click
2491 end
2492 when page = 3 then do /* Users */
2493 nop
2494 end
2495 when page = 4 then do /* files */
2496 nop
2497 end
2498 when page = 5 then do /* service */
2499 nop
2500 end
2501 when page = 6 then do /* Settings */
2502 nop
2503 end
2504 otherwise nop
2505 end
2506return
2507
2508/*:VRX TM_Refresh_Trigger
2509*/
2510TM_Refresh_Trigger:
2511/* call beep 1200, 20 */
2512 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
2513 call _Refresh
2514return
2515
2516/*:VRX TM_RefreshDaemons_Trigger
2517*/
2518TM_RefreshDaemons_Trigger:
2519 ok = VRSet("TM_RefreshDaemons","Delay", 3000)
2520 call _RefreshDaemons
2521return
2522
2523/*:VRX TM_RefreshTreeDisplay_Trigger
2524*/
2525TM_RefreshTreeDisplay_Trigger:
2526 select
2527 when RefreshMode = "TREE" then do
2528 call _RefreshTreeDisplay
2529 end
2530 when RefreshMode = "SHARE" then do
2531 call _AddSharesDisplay
2532 end
2533 otherwise say "RefreshMode = "RefreshMode
2534 end
2535return
2536
2537/*:VRX TM_Throbber_Trigger
2538*/
2539TM_Throbber_Trigger:
2540 pIdx = VRGet("Pict_Throbber","PicturePath")
2541 parse var pIdx '#' pidx
2542 pidx = pidx + 1
2543 if pidx = 136 then pidx = 111
2544 ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
2545return
2546
Note: See TracBrowser for help on using the repository browser.