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

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

EVFSGUI 2.5: Browsing enhancements

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