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

Last change on this file since 642 was 642, checked in by Herwig Bauernfeind, 14 years ago

GUI-Tools: SMBMON 2.5.x: Initial commit

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