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

Last change on this file since 1024 was 1024, checked in by Herwig Bauernfeind, 8 years ago

GUITools: Add GPLv3 header to all .VRX, .WIS and some .CMD files

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