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

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

GUI-Tools: Updates in EVFSGUI, SMBMON and SSCC

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