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

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

GUI-Tools: SMBMON V.next (Adding sorting dialog)

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