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

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

GUI-Tools: SMBMON 2.5 helpfile skeletaon for DE and EN, several minor things

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