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

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

GUI-Tools: Changes in order to work around % issue

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