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

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

GUI-Tools: EVFSGUI Version 2.0 beta3 level code

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