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

Last change on this file since 294 was 294, checked in by Herwig Bauernfeind, 16 years ago

GUI tools: removecfg Version 1.0

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