source: branches/guitools-1.0/smbmon/smbmon.vrx

Last change on this file was 451, checked in by Herwig Bauernfeind, 15 years ago

GUI-Tools: SSCC 1.0.0, SMBUsers 0.9.8 several fixes, rest

File size: 58.3 KB
Line 
1/*:VRX Main
2*/
3/* Main
4*/
5Main:
6/* Process the arguments.
7 Get the parent window.
8*/
9 parse source . calledAs .
10 parent = ""
11 argCount = arg()
12 argOff = 0
13 if( calledAs \= "COMMAND" )then do
14 if argCount >= 1 then do
15 parent = arg(1)
16 argCount = argCount - 1
17 argOff = 1
18 end
19 end; else do
20 call VROptions 'ImplicitNames'
21 call VROptions 'NoEchoQuit'
22 end
23 InitArgs.0 = argCount
24 if( argCount > 0 )then do i = 1 to argCount
25 InitArgs.i = arg( i + argOff )
26 end
27 drop calledAs argCount argOff
28
29/* Load the windows
30*/
31 call VRInit
32 parse source . . spec
33 _VREPrimaryWindowPath = ,
34 VRParseFileName( spec, "dpn" ) || ".VRW"
35 _VREPrimaryWindow = ,
36 VRLoad( parent, _VREPrimaryWindowPath )
37 drop parent spec
38 if( _VREPrimaryWindow == "" )then do
39 call VRMessage "", "Cannot load window:" VRError(), ,
40 "Error!"
41 _VREReturnValue = 32000
42 signal _VRELeaveMain
43 end
44
45/* Process events
46*/
47 call Init
48 signal on halt
49 do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
50 _VREEvent = VREvent()
51 interpret _VREEvent
52 end
53_VREHalt:
54 _VREReturnValue = Fini()
55 call VRDestroy _VREPrimaryWindow
56_VRELeaveMain:
57 call VRFini
58exit _VREReturnValue
59
60VRLoadSecondary:
61 __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
62 if __vrlsWait then do
63 call VRFlush
64 end
65 __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
66 if __vrlsHWnd = '' then signal __vrlsDone
67 if __vrlsWait \= 1 then signal __vrlsDone
68 call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
69 __vrlsTmp = __vrlsWindows.0
70 if( DataType(__vrlsTmp) \= 'NUM' ) then do
71 __vrlsTmp = 1
72 end
73 else do
74 __vrlsTmp = __vrlsTmp + 1
75 end
76 __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
77 __vrlsWindows.0 = __vrlsTmp
78 do while( VRIsValidObject( VRWindow() ) = 1 )
79 __vrlsEvent = VREvent()
80 interpret __vrlsEvent
81 end
82 __vrlsTmp = __vrlsWindows.0
83 __vrlsWindows.0 = __vrlsTmp - 1
84 call VRWindow __vrlsWindows.__vrlsTmp
85 __vrlsHWnd = ''
86__vrlsDone:
87return __vrlsHWnd
88
89/*:VRX __VXREXX____APPENDS__
90*/
91__VXREXX____APPENDS__:
92/*
93#append U:\Develop\Samba\guitools-1.0\shared\InitTempDir.VRS
94#append U:\Develop\Samba\guitools-1.0\shared\SambaInit.vrs
95#append U:\Develop\Samba\guitools-2.0\shared\nlv.vrs
96*/
97return
98/*:VRX _ColumnShow
99*/
100_ColumnShow:
101 userdata = VRGet(VRInfo("Object"),"Userdata")
102 parse var userdata Container '|' fieldh '|' VisStatus
103say userdata
104 ok = VRMethod(Container,"SetFieldAttr", fieldh, "Visible", \VisStatus )
105return
106
107/*:VRX _ColumnsMenu
108*/
109_ColumnsMenu:
110 Container = arg(1)
111 ok = VRMethod(Container, "GetFieldList", "Fields." )
112
113 do I = 1 to 12
114 if I <= fields.0 then do
115/* say "Columns_"||right("0"||I,2)' 'VRMethod(Container, "GetFieldAttr", fields.I, "Title" ) */
116 ok = VRset("Columns_"||right("0"||I,2), "Visible", 1)
117 ok = VRset("Columns_"||right("0"||I,2), "Caption", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
118 ok = VRset("Columns_"||right("0"||I,2), "Checked", VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
119 ok = VRset("Columns_"||right("0"||I,2), "Userdata", Container'|'fields.I'|'VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
120 end
121 else ok = VRset("Columns_"||right("0"||I,2), "Visible", 0)
122 end
123 ok = VRMethod( "Columns", "Popup", , , "", "" )
124return
125
126/*:VRX _ContainerInit
127*/
128_ContainerInit:
129 say '_ContainerInit() started.'
130
131 /* User */
132 UIconH = VRMethod( "CN_Users", "AddField", "Icon", NLVGetMessage(148) )
133 UsernameFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(131) )
134 GroupFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(132) )
135 UMachineFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(133) )
136 UIPAdrFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(147) )
137 UPIDFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(130) )
138
139 /* Files */
140 FIconH = VRMethod( "CN_Files", "AddField", "Icon", NLVGetMessage(148) )
141 FileFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(134) )
142 FUserFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(131) )
143 FPIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(130) )
144 DenyModeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(135) )
145 TimeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(136) )
146 DateFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(149) )
147 AccessFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(137) )
148 RWFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(138) )
149 OplockFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(139) )
150 UIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(140) )
151 SharePathFH= VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(141) )
152 NameFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(142) )
153
154 /* service */
155 SIconH = VRMethod( "CN_Service", "AddField", "Icon", NLVGetMessage(148) )
156 SPIDFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(130) )
157 ServiceFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(143) )
158 SMachineFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(133) )
159 ConnectedFH= VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(144) )
160
161 /* daemons */
162 DaemonFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(145) )
163 DStatusFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(146) )
164 DPidsFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(130) )
165
166 /* Browse tree */
167 IpFH = VRMethod( "CN_Tree", "AddField", "String", "IP Address" )
168 NBFH = VRMethod( "CN_Tree", "AddField", "String", "NetBIOS name" )
169 MBFH = VRMethod( "CN_Tree", "AddField", "String", "DMB/LMB" )
170 WorkgroupFH= VRMethod( "CN_Tree", "AddField", "String", "Workgroup" )
171 OSFH = VRMethod( "CN_Tree", "AddField", "String", "OS" )
172 VersionFH = VRMethod( "CN_Tree", "AddField", "String", "Version" )
173 CommentFH = VRMethod( "CN_Tree", "AddField", "String", "Comment" )
174
175 ok = VRMethod("CN_Tree","SetfieldAttr",IPFH, "ReadOnly", 1)
176 ok = VRMethod("CN_Tree","SetfieldAttr",NBFH, "ReadOnly", 1)
177 ok = VRMethod("CN_Tree","SetfieldAttr",MBFH, "ReadOnly", 1)
178 ok = VRMethod("CN_Tree","SetfieldAttr",WorkGroupFH,"ReadOnly", 1)
179 ok = VRMethod("CN_Tree","SetfieldAttr",OSFH, "ReadOnly", 1)
180
181
182 /* add records for the 3 daemons */
183 smbdHandle = VRMethod("CN_Daemons", "Addrecord",, ,"smbd.exe","$41")
184 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DaemonFH, "smbd.exe")
185 nmbdHandle = VRMethod("CN_Daemons", "Addrecord", ,,"nmbd.exe","$41")
186 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DaemonFH, "nmbd.exe")
187 winbHandle = VRMethod("CN_Daemons", "Addrecord",, ,"winbindd.exe","$41")
188 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DaemonFH, "winbindd.exe")
189 ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
190 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
191
192 ok = VRMethod("CN_Daemons","SetRecordAttr","All", "Collapsed", 0 )
193
194 say '_ContainerInit() done.'
195return
196/*:VRX _GuessIcon
197*/
198_GuessIcon: procedure
199 text = arg(1)
200 select /* Printer guessing */
201 when pos('LJ',text) > 0 then res = '#65:PMWP.DLL'
202 when pos('LASER',text) > 0 then res = '#65:PMWP.DLL'
203 when pos('EPSON',text) > 0 then res = '#65:PMWP.DLL'
204 when pos('PRINT',text) > 0 then res = '#65:PMWP.DLL'
205 when pos('PRT',text) > 0 then res = '#65:PMWP.DLL'
206 when pos('CANON',text) > 0 then res = '#65:PMWP.DLL'
207 when pos('MINOLTA',text) > 0 then res = '#65:PMWP.DLL'
208 when pos('FAX',text) > 0 then res = '#65:PMWP.DLL'
209 when pos('LEXMARK',text) > 0 then res = '#65:PMWP.DLL'
210 when pos('IPC$',text) > 0 then res = '#59:PMWP.DLL'
211 otherwise res = "#34:PMWP.DLL"
212 end
213return res
214
215/*:VRX _GUIInit
216*/
217_GUIInit:
218 say '_GUIInit() started'
219
220 call Paper_Init
221
222 if datatype(Top) = 'NUM' then do
223 ok = VRset("Main","Top",Top)
224 ok = VRset("Main","Left",Left)
225 ok = VRset("Main","Width",Width)
226 ok = VRset("Main","Height",Height)
227 end
228 ok = VRSet("Main","Font", Font_Main)
229 ok = VRSet("Main","Statusfont", Font_Status)
230 ok = VRSet("Page_1","Font", Font_Page_1)
231 ok = VRSet("Page_2","Font", Font_Page_2)
232 ok = VRSet("Page_3","Font", Font_Page_3)
233 ok = VRSet("Page_4","Font", Font_Page_4)
234 ok = VRSet("Page_5","Font", Font_Page_5)
235 ok = VRSet("Page_6","Font", Font_Page_6)
236 Buttonwidth = VRMethod( "Screen", "PixelsToTwips", 32 )
237
238 ok = VRSet("SPIN_Intervall", "Value", Intervall)
239 ok = VRSet("SPIN_IntervallMin","Value", IntervallMin)
240 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
241
242 ok = VRSet("IPB_Start", "Enabled", VRFileExists(samba.!smbcmd))
243 ok = VRSet("IPB_Stop", "Enabled", VRFileExists(samba.!smbcmd))
244 ok = VRSet("IPB_Restart","Enabled", VRFileExists(samba.!smbcmd))
245 ok = VRSet("IPB_Reload", "Enabled", VRFileExists(samba.!smbcmd))
246
247 ok = VRSet("CN_Daemons", "View", DaemonView)
248 ok = VRSet("CB_NoMsgBox","Set", NoMsgBox)
249
250 call _INILayoutRead "CN_Users"
251 call _INILayoutRead "CN_Files"
252 call _INILayoutRead "CN_Service"
253 call _INILayoutRead "CN_Daemons"
254
255 if _ChkTempFreeSpace() < 262144 then do
256 Msg.Type = "W"
257 Msg.Text = NLVGetMessage(116, TempDir)
258 call _ShowMsg
259 end
260
261 call Main_Resize
262
263
264 ok = VRSet("Main", "Visible", 1)
265 say '_GUIInit() done'
266return
267
268/*:VRX _INILayoutRead
269*/
270_INILayoutRead:
271 Container = arg(1)
272 ok = VRMethod(Container, "GetFieldList", "Fields." )
273 Layout = VRGetIni( "Layout", Container, OurINI )
274 if Layout = "" then return
275 do I = 1 to Fields.0
276 ok = VRMethod(Container, "SetFieldAttr", fields.I,"Visible", substr(Layout,I,1))
277 end
278return
279
280/*:VRX _INILayoutWrite
281*/
282_INILayoutWrite:
283 Container = arg(1)
284 ok = VRMethod(Container, "GetFieldList", "Fields." )
285 Layout = ""
286 do I = 1 to fields.0
287 Layout = Layout||VRMethod(Container, "GetFieldAttr", fields.I, "Visible" )
288 end
289 ok = VRSetIni( "Layout", Container , Layout, OurINI, 'NoClose' )
290return
291
292/*:VRX _INIRead
293*/
294_INIRead:
295 say '_INIRead() started.'
296
297 OurINI = strip(VRParseFileName(VRget("Application","Program"),'DP')'\SMBSTATUS.INI',,'\')
298 ok = SysFileTree(OurINI, INIFound.,'FO')
299 if INIFound.0 = 1 then OurINI = VRParseFileName(INIFound.1,'DPNE')
300 say 'OurINI='OurINI
301 HelpFIle = VRParseFileName(OurINI,'DPN')'.HLP'
302say 'HelpFile='HelpFile
303
304 Top = VRGetIni( "Pos", "Top", OurINI , 'NoClose')
305 Left = VRGetIni( "Pos", "Left", OurINI , 'NoClose')
306 Width = VRGetIni( "Pos", "Width", OurINI , 'NoClose')
307 Height= VRGetIni( "Pos", "Height", OurINI , 'NoClose')
308
309 Font_Page_1 = VRGetIni( "Fonts", "Page_1", OurINI , 'NoClose' )
310 Font_Page_2 = VRGetIni( "Fonts", "Page_2", OurINI , 'NoClose' )
311 Font_Page_3 = VRGetIni( "Fonts", "Page_3", OurINI , 'NoClose' )
312 Font_Page_4 = VRGetIni( "Fonts", "Page_4", OurINI , 'NoClose' )
313 Font_Page_5 = VRGetIni( "Fonts", "Page_5", OurINI , 'NoClose' )
314 Font_Page_6 = VRGetIni( "Fonts", "Page_6", OurINI , 'NoClose' )
315 Font_Main = VRGetIni( "Fonts", "Main", OurINI , 'NoClose' )
316 Font_Status = VRGetIni( "Fonts", "Statusfont", OurINI , 'NoClose' )
317
318 if Font_Page_1 = "" then Font_Page_1 = "8.Helv"
319 if Font_Page_2 = "" then Font_Page_2 = "8.Helv"
320 if Font_Page_3 = "" then Font_Page_3 = "8.Helv"
321 if Font_Page_4 = "" then Font_Page_4 = "8.Helv"
322 if Font_Page_5 = "" then Font_Page_5 = "8.Helv"
323 if Font_Main = "" then Font_Main = "8.Helv"
324 if Font_Status = "" then Font_Status = "8.Helv"
325
326 Intervall = VRGetIni( "Settings", "Intervall", OurINI)
327 if Intervall = "" then Intervall = 60
328
329 IntervallMin = VRGetIni( "Settings", "IntervallMin", OurINI)
330 if IntervallMin = "" then IntervallMin = 180
331
332 CurrentPageNr = VRGetIni( "Settings", "CurrentPageNr", OurINI)
333 if CurrentPageNr = "" then CurrentPageNr = 4
334
335 DaemonView = VRGetIni( "Settings", "DaemonView", OurINI)
336 if DaemonView = "" then DaemonView = "Detail"
337
338 NoMsgBox = VRGetIni( "Settings", "NoMsgBox", OurINI)
339 if NoMsgBox = "" then NoMsgBox = 0
340
341 options.!debug = VRGetIni( "Options", "Debug", OurINI)
342 if options.!debug = "" then options.!debug = 0
343
344 ok = VRSet("CB_Debug","set",options.!Debug)
345 if options.!Debug then ok = VRREdirectStdIO("ON")
346 else ok = VRREdirectStdIO("OFF")
347
348 /* For Browse page */
349 FirstRun = 1
350 /* For Users page in case connections.tdb is not initialised */
351 IgnoreSmbNoInit = 1
352
353 smbdpidhandle.0 = 0
354 nmbdpidhandle.0 = 0
355 winbpidhandle.0 = 0
356
357 prevsmbdct = 0
358 prevnmbdct = 0
359 prevwinbct = 0
360
361 smbdoutput = TempDir'smbd.out'
362 say '_INIRead() done.'
363return
364
365/*:VRX _INIWrite
366*/
367_INIWrite:
368 say 'start _INIWrite()'
369 ok = VRSetIni( "Pos", "Top", VRGet("Main","Top"), OurINI, 'NoClose' )
370 ok = VRSetIni( "Pos", "Left", VRGet("Main","Left"), OurINI, 'NoClose' )
371 ok = VRSetIni( "Pos", "Width", VRGet("Main","Width"), OurINI, 'NoClose' )
372 ok = VRSetIni( "Pos", "Height", VRGet("Main","Height"), OurINI, 'NoClose' )
373
374 ok = VRSetIni( "Settings", "Intervall", VRGet("SPIN_Intervall","Value"),OurINI,'NoClose')
375 ok = VRSetIni( "Settings", "IntervallMin", VRGet("SPIN_IntervallMin","Value"),OurINI,'NoClose')
376 ok = VRSetIni( "Settings", "CurrentPageNr",CurrentPageNr, OurINI,'NoClose')
377 ok = VRSetIni( "Settings", "DaemonView", VRGet("CN_Daemons","View"), OurINI,'NoClose')
378 ok = VRSetIni( "Settings", "NoMsgBox", NoMsgBox, OurINI,'NoClose')
379
380 ok = VRSetIni( "Options", "Debug", options.!debug, OurINI, 'NoClose' )
381
382 call _INILayoutWrite "CN_Users"
383 call _INILayoutWrite "CN_Files"
384 call _INILayoutWrite "CN_Service"
385 call _INILayoutWrite "CN_Daemons"
386
387 ok = VRSetIni( "Fonts", "Page_1", VRGet("Page_1","Font"), OurINI, 'NoClose' )
388 ok = VRSetIni( "Fonts", "Page_2", VRGet("Page_2","Font"), OurINI, 'NoClose' )
389 if VRget("CN_Users", "Font") <> "<default>" then ok = VRset("Page_1", "Font", VRget("CN_Users", "Font"))
390 if VRget("CN_Files", "Font") <> "<default>" then ok = VRset("Page_2", "Font", VRget("CN_Files", "Font"))
391 if VRget("CN_Service", "Font") <> "<default>" then ok = VRset("Page_3", "Font", VRget("CN_Service", "Font"))
392 if VRget("CN_Daemons", "Font") <> "<default>" then ok = VRset("Page_4", "Font", VRget("CN_Daemons", "Font"))
393 ok = VRSetIni( "Fonts", "Page_3", VRGet("Page_3","Font"), OurINI, 'NoClose' )
394 ok = VRSetIni( "Fonts", "Page_4", VRGet("Page_4","Font"), OurINI, 'NoClose' )
395 ok = VRSetIni( "Fonts", "Page_5", VRGet("Page_5","Font"), OurINI, 'NoClose' )
396 ok = VRSetIni( "Fonts", "Page_6", VRGet("Page_6","Font"), OurINI, 'NoClose' )
397 ok = VRSetIni( "Fonts", "Statusfont", VRGet("Main","Statusfont"), OurINI, 'NoClose' )
398 ok = VRSetIni( "Fonts", "Main", VRGet("Main","Font"), OurINI )
399 say 'done _INIWrite()'
400return
401
402/*:VRX _LoadotherFuncs
403*/
404_LoadotherFuncs:
405 ok = VRRedirectStdIO("OFF")
406
407 call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
408 call SysLoadFuncs
409
410 call RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
411 call PRLoadFuncs
412
413return
414
415/*:VRX _MsgYesNo
416*/
417_MsgYesNo:
418 say "_MsgYesNo() started"
419 buttons.0 = 2
420 buttons.1 = NLVGetMessage(6)
421 buttons.2 = NLVGetMessage(7)
422 default = 2
423 buttons.default = NLVGetMessage(7)
424 esc = 2
425 buttons.esc = NLVGetMessage(7)
426 RC = VRMessage( VRWindow(), Msg.Text, Msg.Title,"Q","buttons.",default, esc )
427 say "_MsgYesNo() done, answer "RC
428return RC
429
430/*:VRX _NLVSetup
431*/
432_NLVSetup:
433 call NLVSetup
434 Msg.Title = NLVGetMessage(1)
435 ok = VRSet("Main","helpFile", settings.!helpfile)
436
437 CALL NLVSetText 'PB_Refresh', 'Caption', 11
438 CALL NLVSetText 'PB_Cancel', 'Caption', 12
439 CALL NLVSetText 'PB_Help', 'Caption', 13
440 CALL NLVSetText 'PB_About', 'Caption', 14
441
442 CALL NLVSetText 'PB_Refresh', 'Hinttext', 51
443 CALL NLVSetText 'PB_Cancel', 'Hinttext', 54
444 CALL NLVSetText 'PB_Help', 'Hinttext', 52
445 CALL NLVSetText 'PB_About', 'Hinttext', 53
446
447 CALL NLVSetText 'TAB_1', 'Userdata', 15
448 CALL NLVSetText 'TAB_2', 'Userdata', 16
449 CALL NLVSetText 'TAB_3', 'Userdata', 17
450 CALL NLVSetText 'TAB_4', 'Userdata', 18
451 CALL NLVSetText 'TAB_5', 'Userdata', 19
452 CALL NLVSetText 'TAB_6', 'Userdata', 24
453
454 CALL NLVSetText 'TAB_1', 'Hinttext', 55
455 CALL NLVSetText 'TAB_2', 'Hinttext', 56
456 CALL NLVSetText 'TAB_3', 'Hinttext', 57
457 CALL NLVSetText 'TAB_4', 'Hinttext', 58
458 CALL NLVSetText 'TAB_5', 'Hinttext', 59
459 CALL NLVSetText 'TAB_6', 'Hinttext', 60
460
461 CALL NLVSetText 'Page_1', 'Hinttext', 55
462 CALL NLVSetText 'Page_2', 'Hinttext', 56
463 CALL NLVSetText 'Page_3', 'Hinttext', 57
464 CALL NLVSetText 'Page_4', 'Hinttext', 58
465 CALL NLVSetText 'Page_5', 'Hinttext', 59
466 CALL NLVSetText 'Page_6', 'Hinttext', 60
467
468 CALL NLVSetText 'DT_Refresh', 'Caption', 25
469 CALL NLVSetText 'DT_RefreshMin', 'Caption', 25
470 CALL NLVSetText 'DT_Intervall', 'Caption', 26
471 ok = VRSet("DT_IntervallMin","Caption", NLVGetMessage(26)' 'NLVGetMessage(28))
472 CALL NLVSetText 'CB_NoMsgBox', 'Caption', 27
473
474 CALL NLVSetText 'ContextMenu_Daemons_View', 'Caption', 31
475 CALL NLVSetText 'ContextMenu_Daemons_Ping', 'Caption', 32
476 CALL NLVSetText 'ContextMenu_Daemons_Details','Caption', 118
477 CALL NLVSetText 'ContextMenu_Daemons_Tree', 'Caption', 120
478
479 CALL NLVSetText 'ContextMenu_Service_CloseSHare', 'Caption', 70
480
481 CALL NLVSetText 'ContextMenu_Users_SendMsg', 'Caption', 80
482 CALL NLVSetText 'ContextMenu_Tree_SendMsg', 'Caption', 80
483return
484
485/*:VRX _Refresh
486*/
487_Refresh:
488 say "_Refresh() started"
489 ok = VRSet("TM_refresh","Enabled", 0)
490 SmbNoInit = 0
491
492 refreshoutput = TempDir'refresh.out'
493 refresherr = TempDir'refresh.err'
494
495 say ' 'samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput
496 address cmd samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput
497
498 SambaVer = "Samba "||strip(linein(refreshoutput))
499 say ' smbd.exe: "'SambaVer'"'
500 ok = stream(refreshoutput,'c','close')
501
502 say ' 'samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput
503 address cmd samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput
504
505 /* First line is usually empty */
506 Hdr = linein(refreshoutput)
507 SambaStVer = strip(linein(refreshoutput)) /* we can detect version mismatches here */
508 say ' smbstatus: "'SambaStVer'"'
509
510 select
511 when pos('not initialised',SambaStVer) > 0 then do
512 SambaVer = SambaVer||" (Init)"
513 SmbNoInit = 1
514 end
515 when translate(SambaStVer) <> translate(SambaVer) then SambaVer = SambaVer||" (Hybrid)"
516 otherwise nop
517 end
518
519 Ok = VRSet("Main", "Caption", SambaVer' - 'NLVGetMessage(146))
520
521 /* Active User */
522 Hdr1 = linein(refreshoutput)
523/* say ' 1:'hdr1 */
524 Hdr2 = linein(refreshoutput)
525/* say ' 2:'hdr2 */
526 Zeile = linein(refreshoutput)
527 say ' 'Zeile
528 if SmbNoInit then do
529 call lineout samba.!msg, SambaStVer
530 call lineout samba.!msg, Hdr1
531 call lineout samba.!msg, Hdr2
532 call lineout samba.!msg, Zeile
533 ok = stream(samba.!msg,'c','close')
534 if IgnoreSmbNoInit then do
535 call _SambaShowMsg
536 IgnoreSmbNoInit = 0
537 end
538 end
539
540 say 'SmbNoInit = 'SmbNoInit
541
542 ok = VRSet("CN_Users","Painting", 0)
543 ok = VRMethod("CN_Users", "RemoveRecord", "ALL")
544 Username.0 = 0
545 IP.0 = 0
546 Group.0 = 0
547 I = 0
548 if \SmbNoInit then do
549 do while Zeile <> ''
550 parse var Zeile UPID Username Group Machine IP
551 I = I + 1
552 UPID.I = UPID
553 Username.I = Username
554 Group.I = Group
555 IP = strip(IP)
556 parse var IP '('IP.I')'
557 RecHandle = VRMethod("CN_Users", "Addrecord")
558 ok = VRMethod("CN_Users", "SetFieldData", RecHandle, UIconH, "$44", UPIDFH, UPID, UsernameFH, Username, GroupFH, Group, UMachineFH, Machine, UIPAdrFH, IP.I)
559 Zeile = linein(refreshoutput)
560 end
561 end
562 Username.0 = I
563 Group.0 = I
564 UPID.0 = I
565 ok = VRSet("CN_Users","Painting", 1)
566
567 /* Active Services */
568 Hdr = linein(refreshoutput)
569 Hdr = linein(refreshoutput)
570 I = 0
571 Zeile = linein(refreshoutput)
572 ok = VRSet("CN_Service","Painting", 0)
573 ok = VRMethod("CN_Service", "RemoveRecord", "ALL")
574 do while Zeile <> ''
575 parse var Zeile Service SPId Machine Connected
576 I = I + 1
577 SPid.I = SPid
578 Machine.I = Machine
579 Service.I = Service
580 Icon = _GuessIcon(Service.I)
581
582 Connected = strip(Connected)
583 T. = ""
584 parse var Connected T.WDay T.Month T.DoM T.TimeoD T.Year
585 Connected = T.TimeoD', 'T.WDay' 'T.DoM' 'T.Month' 'T.Year
586
587 RecHandle = VRMethod("CN_Service", "Addrecord")
588 ok = VRMethod("CN_Service", "SetFieldData", RecHandle, SIconH, Icon, ServiceFH, Service, SPIDFH, SPID, SMachineFH, Machine, ConnectedFH, Connected)
589 Zeile = linein(refreshoutput)
590 end
591 SPid.0 = I
592 Machine.0 = I
593 Service.0 = I
594
595 ok = VRSet("CN_Service","Painting", 1)
596
597 /* Active Services */
598 Hdr = linein(refreshoutput)
599 Hdr = linein(refreshoutput)
600 Hdr = linein(refreshoutput)
601
602 Zeile = linein(refreshoutput)
603 ok = VRSet("CN_Files","Painting", 0)
604 ok = VRMethod("CN_Files", "RemoveRecord", "ALL")
605 File.0 = 0
606 FPID.0 = 0
607 do while Zeile <> ''
608 parse var Zeile FPid Uid DenyMode Access RW Oplock Sharepath Rest
609 TimeDate = right(rest,25)
610 Name = strip(left(Rest,length(Rest)-25))
611 I = I + 1
612 sharepath = strip(translate(left(sharepath,1))||translate(substr(SharePath,2),'\','/'),'T','\')
613 Username = UID
614 do J = 1 to UPID.0
615 if FPID = UPID.J then do
616 Username = Username.J
617 leave
618 end
619 end
620 File = SharePath||'\'||translate(Name,'\','/')
621 File.I = File
622 FPID.I = FPID
623 TimeDate = strip(TimeDate)
624 say Timedate
625 T. = ""
626 parse var TimeDate T.WDay T.Month T.DoM T.TimeoD T.Year
627 FileTime = T.TimeoD
628 FileDate = T.WDay' 'T.DoM' 'T.Month' 'T.Year
629 RecHandle = VRMethod("CN_Files", "Addrecord")
630 ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FPidFH, FPid, FileFH, File, FUserFH, Username, UidFH, Uid, DenyModeFH, DenyMode, AccessFH, Access, RWFH, RW)
631 ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FIconH, "$45", TimeFH, FileTime, DateFH, FileDate, OplockFH, Oplock, SharePathFH, Sharepath, NameFH, Name)
632 Zeile = linein(refreshoutput)
633 end
634 File.0 = I
635 FPID.0 = I
636
637 ok = stream(refreshoutput, 'c','close')
638 ok = SysFileDelete(refreshoutput)
639 ok = stream(refresherr, 'c','close')
640 ok = SysFileDelete(refreshouterr)
641
642 call _RefreshDaemons
643 ok = VRSet("CN_Files","Painting", 1)
644 if VRGet("Main", "WindowState") = "Minimized" then do
645 ok = VRSet("TM_Refresh","Delay", IntervallMin * 1000)
646 end
647 else do
648 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
649 end
650 ok = VRSet("TM_refresh","Enabled", 1)
651 say "_Refresh() done"
652return
653/*:VRX _RefreshDaemons
654*/
655_RefreshDaemons:
656 say "_RefreshDaemons() started"
657 ok = VRSet("CN_Daemons","Painting", 0 )
658
659 call VRSet VRWindow(), 'Pointer', 'Wait'
660
661 do I = 1 to smbdpidhandle.0
662 ok = VRMethod("CN_Daemons", "RemoveRecord", smbdpidhandle.I )
663 end
664
665 do I = 1 to nmbdpidhandle.0
666 ok = VRMethod("CN_Daemons", "RemoveRecord", nmbdpidhandle.I )
667 end
668
669 do I = 1 to winbpidhandle.0
670 ok = VRMethod("CN_Daemons", "RemoveRecord", winbpidhandle.I )
671 end
672
673 Running = _SambaRunning()
674
675 call VRSet VRWindow(), 'Pointer', '<default>'
676
677 smbdpids = pids.!smbd
678 nmbdpids = pids.!nmbd
679 winbpids = pids.!nmbd
680
681 smbdRunning = running.!smbd
682 nmbdRunning = running.!nmbd
683 winbRunning = running.!winb
684
685 if smbdRunning then do
686 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, smbdpids)
687 ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$46")
688 smbdpidhandle.0 = words(smbdpids)
689 if options.!debug = 1 then do
690 if smbdpidhandle.0 > prevsmbdct then do
691 prevsmbdct = smbdpidhandle.0
692 call beep 880*1, 10
693 call beep 880*2, 10
694 call beep 880*4, 10
695 end
696 if smbdpidhandle.0 < prevsmbdct then do
697 prevsmbdct = smbdpidhandle.0
698 call beep 880*4, 10
699 call beep 880*2, 10
700 call beep 880*1, 10
701 end
702 end
703
704 do I = 1 to words(smbdpids)
705 Username = ""
706 do J = 1 to UPID.0
707 if UPID.J = word(smbdpids,I) then do
708 Username = ' 'Username.J
709 leave
710 end
711 end
712 smbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", smbdhandle, , 'PID 'word(smbdpids,I)' ('d2x(word(smbdpids,I))'x)', "$48")
713 if Username <> "" then do
714 smbdpidhandle.I.user = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I, , Username, "$44")
715 do J = 1 to FPID.0
716 if FPID.J = word(smbdpids,I) then do
717 dummyHandle = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I.user, , File.J, "$45")
718 end
719 end
720 end
721 end
722 end
723 else do
724 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
725 ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$47")
726 if options.!debug = 1 then do
727 if prevsmbdct > 0 then do
728 prevsmbdct = 0
729 call beep 880*4, 10
730 call beep 880*2, 10
731 call beep 880*1, 10
732 end
733 end
734 end
735
736 if nmbdRunning then do
737 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, nmbdpids)
738 ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$46")
739 nmbdpidhandle.0 = words(nmbdpids)
740 do I = 1 to words(nmbdpids)
741 nmbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", nmbdhandle, , 'PID 'word(nmbdpids,I)' ('d2x(word(nmbdpids,I))'x)', "$48")
742 end
743 end
744 else do
745 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
746 ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$47")
747 end
748
749 if winbRunning then do
750 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(40), DPidsFH, winbpids)
751 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$46")
752 winbpidhandle.0 = words(winbpids)
753 do I = 1 to words(winbpids)
754 winbpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", winbhandle, , 'PID 'word(winbpids,I)' ('d2x(word(winbpids,I))'x)', "$48")
755 end
756 end
757 else do
758 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
759 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$47")
760 end
761
762 if \(smbdrunning|nmbdrunning|winbrunning) then do
763 ok = VRSet("IPB_Start", "Visible", 1)
764 ok = VRSet("IPB_Stop", "Visible", 0)
765 ok = VRSet("IPB_ReStart", "Enabled", 0)
766 ok = VRSet("IPB_ReLoad", "Enabled", 0)
767 end
768 else do
769 ok = VRSet("IPB_Start", "Visible", 0)
770 ok = VRSet("IPB_Stop", "Visible", 1)
771 ok = VRSet("IPB_ReStart", "Enabled", 1)
772 ok = VRSet("IPB_ReLoad", "Enabled", 1)
773 end
774
775 ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
776 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
777 ok = VRSet("CN_Daemons","Painting", 1 )
778 if Running then call _SambaUptime
779 say "_RefreshDaemons() done"
780return
781
782/*
783_pids: procedure
784 pongfile = arg(1)
785 pids = ''
786 do until lines(pongfile) = 0
787 pongline = linein(pongfile)
788 if word(Pongline,1) = 'PONG' then do
789 parse var pongline pong from tpid pid
790 pids = pids||pid', '
791 end
792 else pids = pids||pongline
793 end
794 pids = strip(strip(pids),,',')
795 ok = stream(pongfile,'c','close')
796 ok = SysFileDelete(pongfile)
797return pids
798 */
799
800/* pingout = 'ping.out'
801 '@smbcontrol -t 2 smbd ping -d 0 1>'pingout
802 if rc = 0 then smbdRunning = 1
803 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DPidsFH, _pids(pingout))
804
805 '@smbcontrol -t 2 nmbd ping -d 0 1>'pingout
806 if rc = 0 then nmbdRunning = 1
807 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DPidsFH, _pids(pingout))
808
809 '@smbcontrol -t 1 winbindd ping -d 0 1>'pingout
810 if rc = 0 then winbRunning = 1
811 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DPidsFH, _pids(pingout))
812
813 ok = SysFileDelete(PingOut)
814*/
815/*:VRX _RefreshTree
816*/
817_RefreshTree:
818 say "_RefreshTree() started"
819 FirstRun = 0
820 ok = VRSet("Main", "StatusText", NLVGetMessage(50))
821 ok = VRSet("Main", 'Enabled', 0 )
822 ok = VRSet("Main", 'Pointer', 'Wait' )
823
824 address cmd samba.!smbtreeexe' 'debuglevel' -N >'samba.!msg
825
826 ok = VRMethod("CN_Tree", "RemoveRecord", "ALL")
827
828 drop smbtree.
829
830 sl = 0
831
832 do until lines(samba.!msg) = 0
833 sl = sl + 1
834 smbtreeline.sl = linein(samba.!msg)
835 end
836 smbtreeline.0 = sl
837
838 do sl = 1 to smbtreeline.0
839 Header = c2x(left(smbtreeline.sl,3))
840 select
841 when Header = "09095C" then do /* share */
842 smbtreeline.sl = strip(smbtreeline.sl,,'09'x)
843 parse var smbtreeline.sl '\\'machine'\'share '09'x comment
844 machine = strip(machine)
845 share = left(strip(share),10)
846 comment = strip(comment)
847 text = translate(share' 'comment)
848 res = _GuessIcon(text)
849 smbtree.!share = VRMethod( "CN_Tree", "AddRecord",smbtree.!machine,, share||'0D0A'x||comment, res)
850 end
851 when Header = "095C5C" then do /* Machine */
852 smbtreeline.sl = strip(smbtreeline.sl,,'09'x)
853 parse var smbtreeline.sl '\\'machine '0909'x comment
854 machine = left(strip(machine),13)
855 comment = strip(comment)
856 smbtree.!machine = VRMethod( "CN_Tree", "AddRecord",smbtree.!workgroup,, machine||'0D0A'x||comment,"#35:PMWP.DLL")
857 ok = VRMethod( "CN_Tree", "SetFieldData", smbtree.!machine, NBFH, machine, CommentFH, Comment, WorkGroupFH, CurWG)
858 end
859 otherwise do
860 say "Workgroup: "smbtreeline.sl
861 if pos("RECEIVING",translate(smbtreeline.sl)) > 0 then do
862 Msg.Type = "W"
863 Msg.Text = smbtreeline.sl
864 call _ShowMsg
865 end
866 else do
867 smbtree.!workgroup = VRMethod( "CN_Tree", "AddRecord",,, smbtreeline.sl,"#62:PMWP.DLL")
868 ok = VRMethod( "CN_Tree", "SetFieldData", smbtree.!workgroup, WorkGroupFH, smbtreeline.sl)
869 CurWG = smbtreeline.sl
870 end
871 end
872 end
873 end
874 ok = stream(samba.!msg,'c','close')
875
876 ok = VRSet("Main", 'Pointer', '<default>' )
877 ok = VRSet("Main", 'Enabled', 1 )
878 say "_RefreshTree() done"
879return
880
881/*:VRX _SambaFindPIDfile
882*/
883_SambaFindPIDfile:
884 say "_SambaFindPIDfile() started"
885 ok = SysFileTree(ETC'\samba\pid\nmbd*pid',nmbdpid.,'FO')
886 if nmbdpid.0 = 1 then nmbdpidfile = nmbdpid.1; else nmbdpidfile = ""
887 say " nmbdpidfile = "nmbdpidfile
888 say "_SambaFindPIDfile() done"
889return
890
891/*:VRX _SambaShowError
892*/
893_SambaShowError: procedure expose samba. settings. options.
894 I = 0
895 do while lines(samba.!error) <> 0
896 I = I + 1
897 smberr.I = linein(samba.!error)
898 end
899 ok = stream(Samba.!error,"c","close")
900 smberr.0 = I
901 Buttons.1 = "OK" /* NLVGetMessage(2) */
902 Buttons.0 = 1
903 id = VRMessageStem( VRWindow(), "smberr.", VRGet("Main", "Caption") , "Error", "Buttons.", buttons.1, buttons.1 )
904 ok = SysFileDelete(Samba.!error)
905return
906
907/*:VRX _SambaShowMsg
908*/
909_SambaShowMsg: procedure expose samba. settings. options.
910 say "SambaShowMsg started"
911 skipWords = arg(1)
912 skip.0 = words(skipWords)
913 do J = 1 to skip.0
914 skip.J = translate(word(skipWords,J))
915 end
916 I = 0
917 do while lines(samba.!msg) <> 0
918 msgline = linein(samba.!msg)
919 SkipIt = 0
920 do J = 1 to skip.0
921 if pos(skip.J,translate(msgline)) > 0 then do
922 skipit = 1
923 leave
924 end
925 end
926 if \SkipIt then do
927 I = I + 1
928 smbmsg.I = strip(MsgLine)
929 end
930 end
931 ok = stream(Samba.!msg,"c","close")
932 say " stream close "Samba.!msg" = "ok
933 smbmsg.0 = I
934 if smbmsg.0 > 0 then do
935 Buttons.1 = "OK" /* NLVGetMessage(2) */
936 Buttons.0 = 1
937 id = VRMessageStem( VRWindow(), "smbmsg.", VRGet("Main", "Caption") , "I", "Buttons.", buttons.1, buttons.1 )
938 end
939 ok = SysFileDelete(Samba.!msg)
940 say " Delete "Samba.!msg" = "ok
941 say "SambaShowMsg done"
942return
943/*:VRX _SambaUptime
944*/
945_SambaUptime:
946 say "_SambaUptime() started"
947 call _SambaFindPIDfile
948 if nmbdpidfile = "" then do
949 ok = VRset("CN_Daemons", "Caption", NLVGetMessage(42)||" "||NLVGetMessage(41))
950 return
951 end
952
953 StartTime = SysGetFileDateTime(nmbdpidfile)
954 if StartTime = -1 then return
955
956 NowTime = substr(date('S'),1,4)'-'substr(date('S'),5,2)'-'substr(date('S'),7,2)' 'time()
957
958 /* StartTime = "2007-12-31 00:00:00"
959 NowTime = "2008-03-05 08:59:50" */
960
961 say StartTime
962 say NowTime
963
964 doM.0 = 12
965 doM.1 = 31; doM.2 = 28; doM.3 = 31; doM.4 = 30; doM.5 = 31; doM.6 = 30;
966 doM.7 = 31; doM.8 = 31; doM.9 = 30; doM.10= 31; doM.11= 30; doM.12= 31
967
968 parse var StartTime sY'-'sM'-'sD' 'sH':'sMi':'sS
969 parse var NowTime nY'-'nM'-'nD' 'nH':'nMi':'nS
970
971 if nY//4 = 0 & nY//400 <> 0 then doM.2 = 29
972
973 say doM.2
974
975 uY =nY-sY
976 uM =nM-sM
977 uD =nD-sD
978 uH =nH-sH
979 uMi=nMi-sMi
980 uS =nS-sS
981
982
983
984 if uS < 0 then do; uMi= uMi- 1; uS = uS + 60; end
985 if uMi< 0 then do; uH = uH - 1; uMi= uMi+ 60; end
986 if uH < 0 then do; uD = uD - 1; uH = uH + 24; end
987 if uD < 0 then do;
988 /* uM = uM - 1; */
989 if uM < 0 then uMx = uM + 12; else uMx = uM
990 uD = uD + doM.uMx - 1;
991 end
992 if uM < 0 then do; uY = uY - 1; uM = uM + 12; end
993
994 say uY uM uD uH uMi uS
995
996 UpTimeStr = ' 'NlvGetMessage(43)':'
997 if uY <> 0 then UpTimeStr = UpTimeStr' 'uY' 'NlvGetMessage(44)
998 if uM <> 0 then UpTimeStr = UpTimeStr' 'uM' 'NlvGetMessage(45)
999 if uD <> 0 then UpTimeStr = UpTimeStr' 'uD' 'NlvGetMessage(46)
1000 if uH <> 0 then UpTimeStr = UpTimeStr' 'uH' 'NlvGetMessage(47)
1001 if uMi<> 0 then UpTimeStr = UpTimeStr' 'uMi' 'NlvGetMessage(48)
1002 if uS <> 0 | UpTimeStr = ' 'NlvGetMessage(43)':' then UpTimeStr = UpTimeStr' 'uS' 'NlvGetMessage(49)
1003
1004 ok = VRset("CN_Daemons", "Caption", UpTimeStr)
1005 say "_SambaUptime() done"
1006return
1007
1008/*:VRX _SendMsg
1009*/
1010_SendMsg:
1011 Buttons.1 = NLVGetMessage( 2 )
1012 Buttons.2 = NLVGetMessage( 3 )
1013 Buttons.0 = 2
1014 Message = "Blurp!"
1015 id = VRPrompt( VRWindow(), NLVGetMessage( 85 , CurMachine), "Message", NLVGetMessage( 80 ), "Buttons.", buttons.1, buttons.2 )
1016
1017 MsgFile = SysTempFileName(TempDir'\smbmsg.'??? )
1018 call lineout MsgFile, Message
1019 ok = stream(MsgFile,'c','close')
1020say Message
1021 address cmd samba.!smbclientexe' --message='CurMachine' 'DebugLevel' <'MsgFile' 2>&1>'samba.!msg
1022 /* if rc <> 0 then call _SambaShowError; else */
1023 call _SambaShowMsg
1024 ok = SysFileDelete(MsgFile)
1025return
1026
1027/*:VRX _ShowMsg
1028*/
1029_ShowMsg:
1030 Buttons.1 = NLVGetMessage(2)
1031 Buttons.0 = 1
1032 id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 )
1033return
1034
1035/*:VRX About_Close
1036*/
1037About_Close:
1038 call About_Fini
1039return
1040
1041/*:VRX About_Create
1042*/
1043About_Create:
1044 call About_Init
1045 ok = VRSet("About","Caption", NLVGetMessage(20))
1046 ok = VRSet("PB_AboutOK","Caption", NLVGetMessage(2))
1047 SambaTeam.0 = 8
1048 SambaTeam.1 = 'Paul Smedley'
1049 SambaTeam.2 = 'Yuri Dario'
1050 SambaTeam.3 = 'Herwig Bauernfeind'
1051 SambaTeam.4 = 'Silvan Scherrer'
1052 SambaTeam.5 = 'Alex Taylor'
1053 SambaTeam.6 = 'Nikolay Kolosov'
1054 SambaTeam.7 = 'All the Samba people'
1055 SambaTeam.8 = 'All the netlabs people'
1056 ok = VRSet("About","Font", VRGet("Page_6","Font"))
1057 ok = VRMethod("LB_SambaTeam","AddStringList", "SambaTeam." )
1058 ok = VRSet("DT_SambaTeam","Caption", NLVGetMessage(21))
1059 ok = VRSet("MLE_Version","Value", NLVGetMessage(1)||'0D0A'x||VRGet("Main", "Hinttext")||'0D0A'x||'0D0A'x||SambaVer)
1060return
1061
1062/*:VRX About_Fini
1063*/
1064About_Fini:
1065 window = VRInfo( "Window" )
1066 call VRDestroy window
1067 drop window
1068return
1069/*:VRX About_Init
1070*/
1071About_Init:
1072 window = VRInfo( "Object" )
1073 if( \VRIsChildOf( window, "Notebook" ) ) then do
1074 call VRMethod window, "CenterWindow"
1075 call VRSet window, "Visible", 1
1076 call VRMethod window, "Activate"
1077 end
1078 drop window
1079return
1080
1081/*:VRX Activate
1082*/
1083Activate:
1084 parse arg Nr
1085 call PushbackAll
1086 CurrentPageNr = Nr
1087 /* ok = VRSet("PB_"Nr,"Font","9.WarpSans Bold") */
1088 ok = VRSet("TAB_"Nr,"Top", TabTop-8)
1089 ok = VRSet("TAB_"Nr,"Left",TabWidth*(Nr-1)+PageLeft)
1090 ok = VRSet("TAB_"Nr,"PicturePath", "#1"||Nr||";#1"||Nr)
1091 ok = VRset("DT_PageName", "Caption", VRGet("TAB_"Nr, "UserData"))
1092 ok = VRSet("Page_"Nr,"Visible", 1)
1093 select
1094 when Nr = 1 then ok = VRSet("IPB_paper","PicturePath","#4;#4")
1095 when Nr = Pages then ok = VRSet("IPB_paper","PicturePath","#6;#6")
1096 otherwise ok = VRSet("IPB_paper","PicturePath","#5;#5")
1097 end
1098return
1099
1100/*:VRX CB_Debug_Click
1101*/
1102CB_Debug_Click:
1103 options.!Debug = VRGet("CB_Debug","set")
1104 if options.!Debug then ok = VRREdirectStdIO("ON")
1105 else ok = VRREdirectStdIO("OFF")
1106return
1107
1108/*:VRX CB_NoMsgBox_Click
1109*/
1110CB_NoMsgBox_Click:
1111 NoMsgBox = VRGet("CB_NoMsgBox","set")
1112 say 'NoMsgBox = "'NoMsgBox'"'
1113return
1114
1115/*:VRX CN_Daemons_ContextMenu
1116*/
1117CN_Daemons_ContextMenu:
1118 if VRInfo("Top") < 1325 & VRGet("CN_Daemons", "View") = "Detail" then call _ColumnsMenu "CN_Daemons"
1119 else do
1120 ok = VRSet("TM_refresh","Enabled", 0)
1121 DRH = VRInfo("Record")
1122 ok = VRset("ContextMenu_Daemons_Sep1","Visible", 0 )
1123 ok = VRset("ContextMenu_Daemons_Ping","Visible", (DRH <> "") )
1124 ok = VRset("ContextMenu_Daemons_Shutdown","Visible", 0 )
1125 RecCap = ""
1126 if DRH <> "" then RecCap = VRMethod("CN_Daemons", "GetRecordAttr", DRH, "Caption")
1127 select
1128 when Words(RecCap) = 3 then do
1129 RecCap = word(RecCap,2)
1130 ok = VRset("ContextMenu_Daemons_Sep1","Visible", 1 )
1131 end
1132 when Words(RecCap) = 1 then do
1133 parse var RecCap RecCap'.exe'
1134 if strip(VRMethod("CN_Daemons", "GetFieldData", DRH, DPidsFH)) <> "" then do
1135 ok = VRSet("ContextMenu_Daemons_Shutdown", "Caption", NLVGetMessage( 33, RecCap))
1136 ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 1 )
1137 ok = VRset("ContextMenu_Daemons_Sep1","Visible", 1 )
1138 end
1139 else ok = VRset("ContextMenu_Daemons_Ping","Visible", 0 )
1140 end
1141 otherwise nop
1142 end
1143 say ' Daemon is "'RecCap'"'
1144 ok = VRMethod( "ContextMenu_Daemons", "Popup", , , "", "" )
1145 end
1146return
1147
1148/*:VRX CN_Files_ContextMenu
1149*/
1150CN_Files_ContextMenu:
1151 if VRInfo("Top") < 1325 & VRGet("CN_Files", "View") = "Detail" then call _ColumnsMenu "CN_Files"
1152 else do
1153 RH = VRInfo("Record")
1154 if RH <> "" then do
1155 /* Does not exist yet
1156 ok = VRMethod( "Contextmenu_Files", "Popup", , , "", "PositionOnItem" ) */
1157 end
1158 end
1159return
1160
1161/*:VRX CN_Service_ContextMenu
1162*/
1163CN_Service_ContextMenu:
1164 if VRInfo("Top") < 1325 & VRGet("CN_Service", "View") = "Detail" then call _ColumnsMenu "CN_Service"
1165 else do
1166 ok = VRSet("TM_refresh","Enabled", 0)
1167 SRH = VRInfo("Record")
1168 if SRH <> "" then do
1169 Service = VRMethod("CN_Service", "GetFieldData", SRH, ServiceFH)
1170 say ' Service is "'Service'"'
1171 ok = VRMethod( "ContextMenu_Service", "Popup", , , "", "" )
1172 end
1173 end
1174return
1175
1176/*:VRX CN_Tree_ContextMenu
1177*/
1178CN_Tree_ContextMenu:
1179 RH = VRInfo("Record")
1180 if RH <> "" then do
1181 CurMachine = word(VRMethod( "CN_Tree", "GetRecordAttr", RH, "Caption" ),1)
1182 ok = VRMethod( "Contextmenu_Tree", "Popup", , , "", "PositionOnItem" )
1183 end
1184return
1185
1186/*:VRX CN_Users_ContextMenu
1187*/
1188CN_Users_ContextMenu:
1189 if VRInfo("Top") < 1325 & VRGet("CN_users", "View") = "Detail" then call _ColumnsMenu "CN_users"
1190 else do
1191 RH = VRInfo("Record")
1192 if RH <> "" then do
1193 CurMachine = VRMethod( "CN_users", "GetFieldData", RH, UMachineFH )
1194 ok = VRMethod( "Contextmenu_Users", "Popup", , , "", "PositionOnItem" )
1195 end
1196 end
1197return
1198
1199/*:VRX Columns_01_Click
1200*/
1201Columns_01_Click:
1202 call _ColumnShow
1203return
1204
1205/*:VRX Columns_02_Click
1206*/
1207Columns_02_Click:
1208 call _ColumnShow
1209return
1210
1211/*:VRX Columns_03_Click
1212*/
1213Columns_03_Click:
1214 call _ColumnShow
1215return
1216
1217/*:VRX Columns_04_Click
1218*/
1219Columns_04_Click:
1220 call _ColumnShow
1221return
1222
1223/*:VRX Columns_05_Click
1224*/
1225Columns_05_Click:
1226 call _ColumnShow
1227return
1228
1229/*:VRX Columns_06_Click
1230*/
1231Columns_06_Click:
1232 call _ColumnShow
1233return
1234
1235/*:VRX Columns_07_Click
1236*/
1237Columns_07_Click:
1238 call _ColumnShow
1239return
1240
1241/*:VRX Columns_08_Click
1242*/
1243Columns_08_Click:
1244 call _ColumnShow
1245return
1246
1247/*:VRX Columns_09_Click
1248*/
1249Columns_09_Click:
1250 call _ColumnShow
1251return
1252
1253/*:VRX Columns_10_Click
1254*/
1255Columns_10_Click:
1256 call _ColumnShow
1257return
1258
1259/*:VRX Columns_11_Click
1260*/
1261Columns_11_Click:
1262 call _ColumnShow
1263return
1264
1265/*:VRX Columns_12_Click
1266*/
1267Columns_12_Click:
1268 call _ColumnShow
1269return
1270
1271/*:VRX ContextMenu_Daemons_Details_Click
1272*/
1273ContextMenu_Daemons_Details_Click:
1274 ok = VRset("CN_Daemons","View","Detail")
1275 ok = VRset("ContextMenu_Daemons_Tree","Enabled",1)
1276 ok = VRset("ContextMenu_Daemons_Details","Enabled",0)
1277 ok = VRSet("TM_refresh","Enabled", 1)
1278return
1279
1280/*:VRX ContextMenu_Daemons_Ping_Click
1281*/
1282ContextMenu_Daemons_Ping_Click:
1283 ok = VRSet("Main", 'Pointer', 'Wait' )
1284 address cmd samba.!smbcontrolexe' 'RecCap' ping --timeout=3 --debuglevel=0 2>'samba.!error' 1>'samba.!msg
1285 call _SambaShowMsg "section table registered"
1286
1287 ok = VRSet("Main", 'Pointer', '<default>' )
1288 ok = VRSet("TM_refresh","Enabled", 1)
1289return
1290
1291/*:VRX ContextMenu_Daemons_Shutdown_Click
1292*/
1293ContextMenu_Daemons_Shutdown_Click:
1294 Msg.Text = NLVGetMessage(34, RecCap)
1295 Msg.Type = 'Q'
1296 if _MsgYesNo() = 1 then do
1297 address cmd samba.!smbcontrolexe' 'RecCap' shutdown 2>'samba.!error' 1>'samba.!msg
1298 call _SambaShowMsg "section table registered"
1299 end
1300 ok = VRSet("TM_refresh","Enabled", 1)
1301return
1302
1303/*:VRX ContextMenu_Daemons_Tree_Click
1304*/
1305ContextMenu_Daemons_Tree_Click:
1306 ok = VRset("CN_Daemons","View","IconTree")
1307 ok = VRset("ContextMenu_Daemons_Tree","Enabled",0)
1308 ok = VRset("ContextMenu_Daemons_Details","Enabled",1)
1309 ok = VRSet("TM_refresh","Enabled", 1)
1310return
1311
1312/*:VRX ContextMenu_Service_CloseShare_Click
1313*/
1314ContextMenu_Service_CloseShare_Click:
1315 Msg.Text = NLVGetMessage(75, Service)
1316 Msg.Type = 'Q'
1317 if _MsgYesNo() = 1 then do
1318 address cmd samba.!smbcontrolexe' smbd close-share 'Service' --debuglevel=0' /* ' 2>'samba.!error' 1>'samba.!msg */
1319 /* No usable output from Samba here ! */
1320 /* call _SambaShowMsg */
1321 Msg.Text = NLVGetMessage(76, Service)
1322 Msg.Type = 'I'
1323 call _ShowMsg
1324 end
1325 ok = VRSet("TM_refresh","Enabled", 1)
1326return
1327
1328/*:VRX ContextMenu_Tree_Details_Click
1329*/
1330ContextMenu_Tree_Details_Click:
1331 ok = VRset("CN_Tree","View","Detail")
1332 ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
1333 ok = VRset("ContextMenu_Tree_Details","Enabled",0)
1334 ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
1335return
1336
1337/*:VRX ContextMenu_Tree_Icons_Click
1338*/
1339ContextMenu_Tree_Icons_Click:
1340 ok = VRset("CN_Tree","View","Icon")
1341 ok = VRset("ContextMenu_Tree_Icons","Enabled",0)
1342 ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
1343 ok = VRset("ContextMenu_Tree_Details","Enabled",1)
1344return
1345
1346/*:VRX ContextMenu_Tree_SendMsg_Click
1347*/
1348ContextMenu_Tree_SendMsg_Click:
1349 call _SendMsg
1350return
1351
1352/*:VRX ContextMenu_Tree_Tree_Click
1353*/
1354ContextMenu_Tree_Tree_Click:
1355 ok = VRset("CN_Tree","View","IconTree")
1356 ok = VRset("ContextMenu_Tree_Tree","Enabled",0)
1357 ok = VRset("ContextMenu_Tree_Details","Enabled",1)
1358 ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
1359return
1360
1361/*:VRX ContextMenu_Users_SendMsg_Click
1362*/
1363ContextMenu_Users_SendMsg_Click:
1364 call _SendMsg
1365return
1366
1367/*:VRX Fini
1368*/
1369Fini:
1370 window = VRWindow()
1371 call VRSet window, "Visible", 0
1372 drop window
1373return 0
1374
1375/*:VRX GetBootDrive
1376*/
1377GetBootDrive:
1378/* Use SysBootDrive if possible */
1379If Rxfuncadd('SysBootDrive', 'RexxUtil', 'SysBootDrive') Then
1380 Return Left(Value('RUNWORKPLACE',,'OS2ENVIRONMENT'),2)
1381Else
1382 Return SysBootDrive()
1383
1384
1385/*:VRX Halt
1386*/
1387Halt:
1388 signal _VREHalt
1389return
1390
1391/*:VRX Init
1392*/
1393Init:
1394window = VRWindow()
1395call VRMethod window, "CenterWindow"
1396call VRSet window, "Visible", 0
1397call VRMethod window, "Activate"
1398drop window
1399return
1400
1401/*:VRX IPB_Paper_Click
1402*/
1403IPB_Paper_Click:
1404 if VRInfo("Left") > VRInfo("Top") then call Activate min(CurrentPageNr+1,Pages)
1405 if VRInfo("Left") <= VRInfo("Top") then call Activate max(CurrentPageNr-1,1)
1406return
1407
1408/*:VRX IPB_Reload_Click
1409*/
1410IPB_Reload_Click:
1411 call VRSet VRWindow(), 'Pointer', 'Wait'
1412 address CMD samba.!smbcmd' reload '
1413
1414/* 2>'samba.!error' 1>'samba.!msg
1415 if \NoMsgBox then call _SambaShowMsg "[32 Done" */
1416
1417 ok = VRSet("TM_Refresh","Delay", 1000)
1418 call VRSet VRWindow(), 'Pointer', '<default>'
1419return
1420
1421/*:VRX IPB_Restart_Click
1422*/
1423IPB_Restart_Click:
1424 call VRSet VRWindow(), 'Pointer', 'Wait'
1425 address CMD samba.!smbcmd' restart '
1426
1427/* 2>'samba.!error' 1>'samba.!msg
1428 if \NoMsgBox then call _SambaShowMsg "[32 Done" */
1429
1430 ok = VRSet("TM_Refresh","Delay", 1000)
1431 call VRSet VRWindow(), 'Pointer', '<default>'
1432return
1433
1434/*:VRX IPB_Start_Click
1435*/
1436IPB_Start_Click:
1437 say "IPB_Start_Click started"
1438 call VRSet VRWindow(), 'Pointer', 'Wait'
1439
1440 say " "samba.!smbcmd' start '
1441/* 2>'samba.!error' 1>'samba.!msg */
1442
1443 address CMD samba.!smbcmd' start '
1444
1445/* 2>'samba.!error' 1>'samba.!msg
1446 if \NoMsgBox then call _SambaShowMsg "[32 Done"
1447 else do
1448 say "Start no msg"
1449 ok = stream(Samba.!msg,"c","close")
1450 say " stream close "Samba.!msg" = "ok
1451 ok = SysFileDelete(Samba.!msg)
1452 say " Delete "Samba.!msg" = "ok
1453 end */
1454 ok = VRSet("TM_Refresh","Delay", 1000)
1455 call VRSet VRWindow(), 'Pointer', '<default>'
1456 say "IPB_Start_Click done"
1457return
1458
1459/*:VRX IPB_Stop_Click
1460*/
1461IPB_Stop_Click:
1462 say "IPB_Stop_Click started"
1463 call VRSet VRWindow(), 'Pointer', 'Wait'
1464 say " "samba.!smbcmd' stop '
1465/* 2>'samba.!error' 1>'samba.!msg */
1466
1467 address CMD samba.!smbcmd' stop'
1468
1469/* 2>'samba.!error' 1>'samba.!msg
1470 if \NoMsgBox then call _SambaShowMsg "[32 Done"
1471 else do
1472 say " Stop no msg"
1473 ok = stream(Samba.!msg,"c","close")
1474 say " stream close "Samba.!msg" = "ok
1475 ok = SysFileDelete(Samba.!msg)
1476 say " Delete "Samba.!msg" = "ok
1477 end */
1478 ok = VRSet("TM_Refresh","Delay", 1000)
1479
1480 call VRSet VRWindow(), 'Pointer', '<default>'
1481 say "IPB_Stop_Click done"
1482return
1483
1484/*:VRX Main_Activate
1485*/
1486Main_Activate:
1487 call TM_Refresh_Trigger
1488 ok = VRset("TM_Refresh", "Enabled", 1)
1489return
1490
1491/*:VRX Main_Close
1492*/
1493Main_Close:
1494 call Quit
1495return
1496
1497/*:VRX Main_Create
1498*/
1499Main_Create:
1500 call _LoadOtherFuncs
1501 call _InitTempDir
1502 call _IniRead
1503 call _NLVSetup
1504 call _SambaInit
1505 if _SambaRunning() then call _SambaFindPIDfile
1506 call _ContainerInit
1507 call _GUIInit
1508
1509 str = 'call TAB_'CurrentPageNr'_Click'; interpret str
1510 ok = VRMethod("PB_Refresh","SetFocus")
1511 call _Refresh
1512 if FirstRun = 1 & CurrentPageNr = 5 then call _RefreshTree
1513return
1514/*:VRX Main_Deactivate
1515*/
1516Main_Deactivate:
1517 ok = VRset("TM_Refresh", "Enabled", 0)
1518return
1519
1520/*:VRX Main_Resize
1521*/
1522Main_Resize:
1523 say 'Mainresize() started'
1524 MainWin = "Main"
1525 ok = VRSet(MainWin,"Painting", 0)
1526 if datatype(Pages) <> "NUM" then call PushbackAll
1527 ok = VRSet(MainWin,"Width",max(VRget(MainWin,"Width"),Pages*TabWidth+300))
1528 ok = VRset("GB_Main","width",VRget(MainWin,"Width")-150)
1529 ok = VRset("GB_Main","Height",VRget(MainWin,"Height")-1175-240)
1530 ok = VRset("GB_Main2","width",VRget("GB_Main","Width")-260)
1531 ok = VRset("GB_Main2","Height",VRget("GB_Main","Height")-275)
1532 ok = VRset("GB_VerticalLine","Left",VRget("GB_Main2","Width")-60)
1533 ok = VRset("GB_VerticalLine","Height",VRget("GB_Main2","Height")-410)
1534 ok = VRset("IPB_Paper","Left",VRget("GB_Main2","width")-420)
1535 ok = VRset("GB_HorLineTop","Width",VRget("GB_Main2","width")-440)
1536 ok = VRset("GB_HorLineTop","Width",VRget("GB_Main2","width")-440)
1537 ok = VRset("GB_LineSubtitle","Width",VRget("GB_Main2","width")-480)
1538 do I = 1 to Pages
1539 /*say 'Page_'I'='max(PageHeight,VRget("GB_Main2","Height")-600) */
1540 ok = VRSet("Page_"I,"Height", max(PageHeight,VRget("GB_Main2","Height")-600))
1541 ok = VRSet("Page_"I,"Width", max(PageWidth,VRget("GB_Main2","Width")-450))
1542 end
1543
1544 ok = VRSEt("PB_Refresh","top",VRGet("GB_Main","Height")+305)
1545 ok = VRSEt("PB_Help", "top",VRGet("GB_Main","Height")+305)
1546 ok = VRSEt("PB_Cancel", "top",VRGet("GB_Main","Height")+305)
1547 ok = VRSEt("PB_About", "top",VRGet("GB_Main","Height")+305)
1548
1549 ok = VRset("CN_Users","Top", 120)
1550 ok = VRset("CN_Users","Left", 20)
1551 ok = VRset("CN_Users","Width", VRGet("Page_1","Width")-600)
1552 ok = VRset("CN_Users","Height", VRGet("Page_1","Height")-120)
1553
1554 ok = VRset("CN_Files","Top", 120)
1555 ok = VRset("CN_Files","Left", 20)
1556 ok = VRset("CN_Files","Width", VRGet("Page_2","Width")-600)
1557 ok = VRset("CN_Files","Height", VRGet("Page_2","Height")-120)
1558
1559 ok = VRset("CN_Service","Top", 120)
1560 ok = VRset("CN_Service","Left", 20)
1561 ok = VRset("CN_Service","Width", VRGet("Page_2","Width")-600)
1562 ok = VRset("CN_Service","Height", VRGet("Page_2","Height")-120)
1563
1564 ok = VRset("CN_Daemons","Top", 120)
1565 ok = VRset("CN_Daemons","Left", 20)
1566 ok = VRset("CN_Daemons","Width", VRGet("Page_2","Width")-600)
1567 ok = VRset("CN_Daemons","Height", VRGet("Page_2","Height")-120)
1568
1569 ok = VRSet("IPB_Start","Left", VRGet("CN_Daemons","Width") + 120)
1570 ok = VRSet("IPB_Stop","Top", VRGet("IPB_Start","Top"))
1571 ok = VRSet("IPB_Stop","Left", VRGet("CN_Daemons","Width") + 120)
1572 ok = VRSet("IPB_Restart","Left", VRGet("CN_Daemons","Width") + 120)
1573 ok = VRSet("IPB_Reload","Left", VRGet("CN_Daemons","Width") + 120)
1574
1575 ok = VRset("CN_Tree","Top", 120)
1576 ok = VRset("CN_Tree","Left", 20)
1577 ok = VRset("CN_Tree","Width", VRGet("Page_5","Width")-120)
1578 ok = VRset("CN_Tree","Height", VRGet("Page_5","Height")-120)
1579
1580
1581
1582 ButtonDist= 980
1583 ButtonNr = 4
1584 ButtonPos = format(max((VRget(MainWin,"Width")-ButtonDist*ButtonNr)/2,0),,0)
1585 ok = VRSEt("PB_Refresh","left",ButtonPos+ButtonDist*(ButtonNr-4))
1586 ok = VRSEt("PB_Help", "left",ButtonPos+ButtonDist*(ButtonNr-3))
1587 ok = VRSEt("PB_About", "left",ButtonPos+ButtonDist*(ButtonNr-2))
1588 ok = VRSEt("PB_Cancel", "left",ButtonPos+ButtonDist*(ButtonNr-1))
1589
1590 /* check and empty event queue, trash spurious resize events */
1591 EventString = ''
1592 TrashedResize = 0
1593 do until EventString = 'nop'
1594 EventString = VREvent('N')
1595 if EventString <> 'nop' then do
1596 if EventString = 'CALL 'MainWin'_Resize' then TrashedResize = 1
1597 else interpret eventString
1598 end
1599 end
1600 if TrashedResize then CALL Main_Resize
1601 ok = VRSet(MainWin, "Painting", 1)
1602
1603 /* ok = VRset(MainWin,"Visible", 1) */
1604 say 'Mainresize() done'
1605return
1606
1607/*:VRX Page1_Create
1608*/
1609Page1_Create:
1610
1611Return
1612
1613/*:VRX Page1_Init
1614*/
1615Page1_Init:
1616 call _ContainerInit
1617return
1618
1619/*:VRX Page2_Create
1620*/
1621Page2_create:
1622
1623Return
1624/*:VRX Page2_init
1625*/
1626Page2_init:
1627
1628return
1629
1630/*:VRX Page3_Create
1631*/
1632Page3_create:
1633
1634Return
1635/*:VRX Page3_Init
1636*/
1637Page3_Init:
1638
1639return
1640
1641/*:VRX Page4_Create
1642*/
1643Page4_Create:
1644
1645Return
1646/*:VRX Page4_init
1647*/
1648Page4_init:
1649
1650return
1651
1652/*:VRX Page5_Create
1653*/
1654Page5_Create:
1655
1656return
1657
1658/*:VRX Page5_Init
1659*/
1660Page5_Init:
1661
1662return
1663
1664/*:VRX Paper_Init
1665*/
1666Paper_Init:
1667 ok = VRSet("IPB_Paper","Width" ,VRMethod( "Screen", "PixelsToTwips", 32 ))
1668 ok = VRSet("IPB_Paper","Height",VRMethod( "Screen", "PixelsToTwips", 32 ))
1669 ok = VRset("IPB_Paper","Left",VRget("GB_Main2","width")-420)
1670return
1671
1672/*:VRX PB_About_Click
1673*/
1674PB_About_Click:
1675 window = VRLoadSecondary( "About", "W" )
1676return
1677
1678/*:VRX PB_AboutOK_Click
1679*/
1680PB_AboutOK_Click:
1681 call About_Close
1682return
1683
1684/*:VRX PB_Cancel_Click
1685*/
1686PB_Cancel_Click:
1687 say 'start PB_Cancel_Click'
1688 Call Quit
1689 say 'done PB_Cancel_Click'
1690return
1691
1692/*:VRX PB_Help_Click
1693*/
1694PB_Help_Click:
1695 ok = VRMethod("Page_"CurrentPageNr, "InvokeHelp" )
1696return
1697
1698/*:VRX PB_Refresh_Click
1699*/
1700PB_Refresh_Click:
1701 ok = SysSleep(0.3)
1702 if CurrentPageNr = 5
1703 then call _RefreshTree
1704 else call _Refresh
1705return
1706
1707/*:VRX PushbackAll
1708*/
1709PushbackAll:
1710 Pages = 6
1711 /* Tab distance from top */
1712 TabTop = 20
1713 TabWidth = VRMethod( "Screen", "PixelsToTwips", 78 )
1714 TabHeight= VRMethod( "Screen", "PixelsToTwips", 24 )
1715
1716 /* Page Position */
1717 PageLeft = 120
1718 PageTop = PageLeft + TabTop + 330
1719
1720 /* Page size */
1721 PageHeight = 3000
1722 PageWidth = 3000
1723 ok = VRset("DT_PageName", "Caption", "")
1724 ok = VRSet("GB_Main","Left", 0)
1725 ok = VRSet("GB_Main","Top", TabTop+230)
1726 do I = 1 to Pages
1727 ok = VRSet("TAB_"I,"Top", TabTop)
1728 ok = VRSet("TAB_"I,"PicturePath","#2"||I||";#2"||I)
1729 ok = VRSet("TAB_"I,"Left",TabWidth*(I-1)+PageLeft)
1730 ok = VRSet("TAB_"I,"Width",TabWidth)
1731 ok = VRSet("TAB_"I,"Height",TabHeight)
1732 ok = VRSet("Page_"I,"Height", max(PageHeight,VRget("GB_Main2","Height")-600))
1733 ok = VRSet("Page_"I,"Width", max(PageWidth,VRget("GB_Main2","Width")-450))
1734 ok = VRSet("Page_"I,"Left", PageLeft)
1735 ok = VRSet("Page_"I,"Top", PageTop)
1736 ok = VRSet("Page_"I,"Visible", 0)
1737 ok = VRSet("Page_"I,"BackColor", "<default>")
1738 end
1739return
1740
1741/*:VRX Quit
1742*/
1743Quit:
1744 call _IniWrite
1745 ok = VRRedirectStdIO("OFF")
1746 call _SambaFinish
1747
1748 ok = SysFileDelete(smbdoutput)
1749
1750 window = VRWindow()
1751 call VRSet window, "Shutdown", 1
1752 drop window
1753return
1754
1755/*:VRX SPIN_Intervall_Change
1756*/
1757SPIN_Intervall_Change:
1758 Intervall = VRGet("SPIN_Intervall","Value")
1759 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
1760return
1761
1762/*:VRX SPIN_IntervallMin_Change
1763*/
1764SPIN_IntervallMin_Change:
1765 IntervallMin = VRGet("SPIN_IntervallMin","Value")
1766return
1767
1768/*:VRX TAB_1_Click
1769*/
1770TAB_1_Click:
1771 call Activate 1
1772return
1773
1774/*:VRX TAB_2_Click
1775*/
1776TAB_2_Click:
1777 call Activate 2
1778return
1779
1780/*:VRX TAB_3_Click
1781*/
1782TAB_3_Click:
1783 call Activate 3
1784return
1785
1786/*:VRX TAB_4_Click
1787*/
1788TAB_4_Click:
1789 call Activate 4
1790return
1791
1792/*:VRX TAB_5_Click
1793*/
1794TAB_5_Click:
1795 call Activate 5
1796 if FirstRun = 1 then call _RefreshTree
1797return
1798
1799/*:VRX TAB_6_Click
1800*/
1801TAB_6_Click:
1802 call Activate 6
1803return
1804
1805/*:VRX TM_Refresh_Trigger
1806*/
1807TM_Refresh_Trigger:
1808 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
1809 call _Refresh
1810return
1811
Note: See TracBrowser for help on using the repository browser.