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

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

SMBMON 2.6: Fix several small bugs, add missing hints

File size: 117.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 ..\shared\inittempdir.vrs
110#append ..\shared\sambainit.vrs
111#append ..\shared\nlv.vrs
112#append ..\shared\smbtree.vrs
113#append ..\shared\browse.VRS
114#append ..\shared\usercredmem.vrs
115#append ..\shared\rxrpclib.vrs
116*/
117return
118
119/*:VRX _ChkTDB
120*/
121_ChkTDB:
122
123ok = SysFileTree(etc'\samba\lock\*.TDB',tdb.,'FO')
124say etc'\samba\lock\*.TDB 'tdb.0
125
126error = 0
127ok = VRMethod("CN_CHKTDB", "RemoveRecord", "ALL")
128
129RecHandleArray.0 = 0
130ok = VRSet("CN_CHKTDB", "Painting", 0)
131
132do I = 1 to tdb.0
133 RecHandleArray.I = VRMethod("CN_CHKTDB", "Addrecord")
134end
135ok = VRSet("CN_CHKTDB", "Painting", 1)
136
137/* ok = VRSet("CN_CHKTDB", "Painting", 0) */
138
139do I = 1 to tdb.0
140 RecHandle = RecHandleArray.I
141 TDBFile =left(filespec('N',tdb.I), 22)
142 TDBSize = stream(tdb.I,'c','query size')
143 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBFilesFH, TDBFile, ChkTDBIconFH, "$50", ChkTDBSizeFH, TDBSize||" Bytes" )
144 address cmd '@tdbtool 'tdb.I' check 2>'tdb.I'.err 1>'tdb.I'.out'
145 ok = file2stem(tdb.I'.out',"out.")
146 out = out.ok
147 say out
148 if pos('integrity is OK',out) > 0 then do /* integrity is ok */
149 ok = SysFileDelete(tdb.I'.err')
150 ok = SysFileDelete(tdb.I'.out')
151 out = left(out,length(out)-1)
152 TDBRecords = substr(out, pos("and has", out) + 7,)
153 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBStatusFH, TDBRecords )
154
155 address cmd '@tdbbackup -s.bak 'tdb.I' 2>NUL 1>NUL'
156 end
157 else do /* tdb error */
158 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBIconFH, "$51" )
159 error = 1
160 count = 0
161 out = ""
162 do while lines(tdb.I'.err') > 0 & count < 5
163 errline = linein(tdb.I'.err')
164 select
165 /* skip unnecessary lines of log */
166 when pos("bww ",errline) > 0 then iterate
167 when pos("fcntl",errline) > 0 then iterate
168 otherwise do
169 out = out||errline'. '
170 count = count + 1
171 end
172 end
173 end
174 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBStatusFH, out )
175 ok = VRSet("CN_CHKTDB", "Painting", 1)
176 ok = VRSet("CN_CHKTDB", "Painting", 0)
177
178 ok = stream(tdb.I'.err','c','close')
179 end
180
181/*
182 call charout , left(filespec('N',tdb.I), 22)
183 address cmd '@tdbtool 'tdb.I' check 2>'tdb.I'.err 1>'tdb.I'.out'
184 out = linein(tdb.I'.out')
185 ok = stream(tdb.I'.out','c','close')
186 say out
187 if pos('integrity is OK',out) = 0 then do
188 call beep 880, 20
189 address cmd '@tdbbackup -s.bak -v 'tdb.I' 2>NUL 1>NUL'
190 error = 1
191 count = 0
192 do while lines(tdb.I'.err') > 0 & count < 5
193 errline = linein(tdb.I'.err')
194 select
195 /* skip unnecessary lines of log */
196 when pos("bww ",errline) > 0 then iterate
197 when pos("fcntl",errline) > 0 then iterate
198 otherwise do
199 say right(copies(' ',22)'Cause: 'errline'!',min(length(errline)+22,79))
200 count = count + 1
201 end
202 end
203 end
204 ok = stream(tdb.I'.err','c','close')
205 end
206 else do
207 ok = SysFileDelete(tdb.I'.err')
208 ok = SysFileDelete(tdb.I'.out')
209 address cmd '@tdbbackup -s.bak 'tdb.I' 2>NUL 1>NUL'
210 end */
211end
212
213ok = VRSet("CN_CHKTDB", "Painting", 1)
214
215return
216
217/*:VRX _ColumnShow
218*/
219_ColumnShow:
220 userdata = VRGet(VRInfo("Object"),"Userdata")
221 parse var userdata Container '|' fieldh '|' VisStatus
222say userdata
223 ok = VRMethod(Container,"SetFieldAttr", fieldh, "Visible", \VisStatus )
224return
225
226/*:VRX _ColumnsMenu
227*/
228_ColumnsMenu:
229 Container = arg(1)
230 ok = VRMethod(Container, "GetFieldList", "Fields." )
231
232 do I = 1 to 14
233 R2I = right("0"||I,2)
234 if I <= fields.0 then do
235/* say "Columns_"||R2I' 'VRMethod(Container, "GetFieldAttr", fields.I, "Title" ) */
236 ok = VRset("Columns_"||R2I, "Visible", 1)
237 ok = VRset("Columns_"||R2I, "Caption", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
238 ok = VRset("Columns_"||R2I, "Checked", VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
239 ok = VRset("Columns_"||R2I, "Userdata", Container'|'fields.I'|'VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
240 end
241 else ok = VRset("Columns_"||R2I, "Visible", 0)
242 end
243 ok = VRMethod( "Columns", "Popup", , , "", "" )
244return
245
246/*:VRX _ContainerInit
247*/
248_ContainerInit:
249 say '_ContainerInit() started.'
250
251 /* Users */
252 UIconH = VRMethod( "CN_Users", "AddField", "Icon", NLVGetMessage(148) )
253 UsernameFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(131) )
254 GroupFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(132) )
255 UMachineFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(133) )
256 UIPAdrFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(147) )
257 UPIDFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(130) )
258
259 /* Files */
260 FIconH = VRMethod( "CN_Files", "AddField", "Icon", NLVGetMessage(148) )
261 FileFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(134) )
262 FUserFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(131) )
263 FPIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(130) )
264 DenyModeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(135) )
265 TimeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(136) )
266 DateFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(149) )
267 AccessFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(137) )
268 RWFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(138) )
269 OplockFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(139) )
270 UIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(140) )
271 SharePathFH= VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(141) )
272 NameFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(142) )
273
274 /* Service */
275 SIconH = VRMethod( "CN_Service", "AddField", "Icon", NLVGetMessage(148) )
276 SPIDFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(130) )
277 ServiceFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(143) )
278 SMachineFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(133) )
279 ConnectedFH= VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(144) )
280
281 /* Daemons */
282 DaemonFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(145) )
283 DStatusFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(146) )
284 DPidsFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(130) )
285
286 smbdHandle = VRMethod("CN_Daemons", "Addrecord",, ,NLVGetMessage(77),"$41") /* smbd.exe */
287 nmbdHandle = VRMethod("CN_Daemons", "Addrecord", ,,NLVGetMessage(78),"$41") /* nmbd.exe */
288 winbHandle = VRMethod("CN_Daemons", "Addrecord",, ,NLVGetMessage(79),"$41") /* winbindd.exe */
289
290 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DaemonFH, NLVGetMessage(77)) /* smbd.exe */
291 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DaemonFH, NLVGetMessage(78)) /* nmbd.exe */
292 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DaemonFH, NLVGetMessage(79)) /* winbindd.exe */
293 ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
294 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
295 ok = VRMethod("CN_Daemons", "SetRecordAttr","All", "Collapsed", 0 )
296
297
298 /* SMBTree */
299 WorkgroupFH = VRMethod( "CN_SMBTREE", "AddField", "String", NLVGetMessage(150) )
300 NBFH = VRMethod( "CN_SMBTREE", "AddField", "String", "NetBIOS name" )
301 IpFH = VRMethod( "CN_SMBTREE", "AddField", "String", NLVGetMessage(147) )
302 MBFH = VRMethod( "CN_SMBTREE", "AddField", "String", "DMB/LMB" )
303 OSFH = VRMethod( "CN_SMBTREE", "AddField", "String", "OS" )
304 /* VersionFH = VRMethod( "CN_SmbTree", "AddField", "String", "Version" ) */
305 CommentFH = VRMethod( "CN_SMBTREE", "AddField", "String", NLVGetMessage(151) )
306 MacFH = VRMethod( "CN_SMBTREE", "AddField", "String", "MAC" )
307
308 ok = VRMethod("CN_SMBTREE","SetfieldAttr",IPFH, "ReadOnly", 1)
309 ok = VRMethod("CN_SMBTREE","SetfieldAttr",NBFH, "ReadOnly", 1)
310 ok = VRMethod("CN_SMBTREE","SetfieldAttr",MBFH, "ReadOnly", 1)
311 ok = VRMethod("CN_SMBTREE","SetfieldAttr",WorkGroupFH,"ReadOnly", 1)
312 ok = VRMethod("CN_SMBTREE","SetfieldAttr",OSFH, "ReadOnly", 1)
313 ok = VRMethod("CN_SMBTREE","SetfieldAttr",MacFH, "ReadOnly", 1)
314
315 /* ChkTdb */
316 ChkTDBFilesFH = VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(134) )
317 ChkTDBIconFH = VRMethod( "CN_CHKTDB", "AddField", "Icon", NLVGetMessage(146) )
318 ChkTDBSizeFH = VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(152) )
319 ChkTDBStatusFH= VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(151) )
320
321 ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBIconFH, "Justification","Center", "ReadOnly", 1)
322 ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBSizeFH, "Justification","Right", "ReadOnly", 1)
323 ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBStatusFH, "Justification","Right", "ReadOnly", 1)
324
325 say '_ContainerInit() done.'
326return
327/*:VRX _ContainerSort
328*/
329_ContainerSort:
330 ok = VRMethod( "LB_SortFields", "GetSelectedList", "SortFields." )
331 if Fields.0 = 0 then return
332 idx = SortFields.1
333 ok = VRset( Container, "DetailSort", Fields.idx )
334 ok = VRSet( Container, "Sort", SortOrder )
335 ok = VRMethod( Container, "SortRecords" )
336return
337
338/*:VRX _ContextMenuSelectedSet
339*/
340_ContextMenuSelectedSet:
341 ok = VRSet("ContextMenu_Tree_Login", "Visible", 0)
342 ok = VRSet("ContextMenu_Tree_ACLS", "Visible", 0)
343 ok = VRSet("ContextMenu_Tree_SendMsg", "Visible", 0)
344 ok = VRSet("ContextMenu_Tree_Logoff", "Visible", 0)
345 ok = VRSet("ContextMenu_Tree_Sep1", "Visible", 0)
346 ok = VRSet("ContextMenu_Tree_MiniIcons", "Visible", 0)
347 ok = VRSet("ContextMenu_Tree_Tree", "Visible", 1)
348 ok = VRSet("ContextMenu_Tree_Details", "Visible", 1)
349 ok = VRSet("ContextMenu_Tree_Icons", "Visible", 1)
350 ok = VRSet("ContextMenu_Tree_Sort", "Visible", 0) /* FIXME: Crashes */
351 say ' SMBObj.udatatype = "'SMBObj.udatatype'"'
352 select
353 when SMBObj.udatatype = "WORKGROUP" then do
354 ok = VRSet("ContextMenu_Tree_MiniIcons", "Visible", 1)
355 end
356 when SMBObj.udatatype = "SERVER" then do
357 ok = VRSet("ContextMenu_Tree_Login", "Visible", 1)
358 ok = VRSet("ContextMenu_Tree_SendMsg", "Visible", 1)
359 ok = VRSet("ContextMenu_Tree_Logoff", "Visible", 1)
360 ok = VRSet("ContextMenu_Tree_Sep1", "Visible", 1)
361 ok = VRSet("ContextMenu_Tree_MiniIcons", "Visible", 1)
362 end
363 when SMBObj.udatatype = "DISK" then do
364 ok = VRSet("ContextMenu_Tree_ACLS", "Visible", 1)
365 ok = VRSet("ContextMenu_Tree_Sep1", "Visible", 1)
366 ok = VRSet("ContextMenu_Tree_MiniIcons", "Visible", 1)
367 end
368 when SMBObj.udatatype = "PRINTER" then do
369 ok = VRSet("ContextMenu_Tree_MiniIcons", "Visible", 1)
370 end
371 when SMBObj.udatatype = "DIRECTORY" then do
372 ok = VRSet("ContextMenu_Tree_ACLS", "Visible", 1)
373 ok = VRSet("ContextMenu_Tree_Sep1", "Visible", 1)
374 end
375 when SMBObj.udatatype = "FILE" then do
376 ok = VRSet("ContextMenu_Tree_ACLS", "Visible", 1)
377 ok = VRSet("ContextMenu_Tree_Sep1", "Visible", 1)
378 end
379 otherwise do /* No other value known - default */
380 ok = VRSet("ContextMenu_Tree_Tree", "Visible", 1)
381 ok = VRSet("ContextMenu_Tree_Details", "Visible", 1)
382 ok = VRSet("ContextMenu_Tree_Icons", "Visible", 1)
383 ok = VRSet("ContextMenu_Tree_Sort", "Visible", 1)
384 end
385 end
386return
387
388/*:VRX _CreateSmbStarter
389*/
390_CreateSmbStarter:
391ok = SysFileDelete(samba.!bin'\smbstarter.cmd')
392call lineout samba.!bin'\smbstarter.cmd', '/* REXX */'
393call lineout samba.!bin'\smbstarter.cmd', 'signal on failure name CLEANUP'
394call lineout samba.!bin'\smbstarter.cmd', 'signal on halt name CLEANUP'
395call lineout samba.!bin'\smbstarter.cmd', 'signal on syntax name CLEANUP'
396call lineout samba.!bin'\smbstarter.cmd', 'say "Samba Server Starter"'
397call lineout samba.!bin'\smbstarter.cmd', 'address cmd "@echo off"'
398call lineout samba.!bin'\smbstarter.cmd', 'home:'
399call lineout samba.!bin'\smbstarter.cmd', 'select'
400call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("smbstart") then do'
401call lineout samba.!bin'\smbstarter.cmd', 'say "Start"'
402call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd start"'
403call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("smbstart")'
404call lineout samba.!bin'\smbstarter.cmd', 'end'
405call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("smbstop") then do'
406call lineout samba.!bin'\smbstarter.cmd', 'say "Stop"'
407call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd stop"'
408call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("smbstop")'
409call lineout samba.!bin'\smbstarter.cmd', 'end'
410call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("restart") then do'
411call lineout samba.!bin'\smbstarter.cmd', 'say "Restart"'
412call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd restart"'
413call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("restart")'
414call lineout samba.!bin'\smbstarter.cmd', 'end'
415call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("reload") then do'
416call lineout samba.!bin'\smbstarter.cmd', 'say "Reload"'
417call lineout samba.!bin'\smbstarter.cmd', 'address cmd "call 'samba.!bin'\smb.cmd reload"'
418call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("reload")'
419call lineout samba.!bin'\smbstarter.cmd', 'end'
420call lineout samba.!bin'\smbstarter.cmd', 'when VRFileExists("quit") then do'
421call lineout samba.!bin'\smbstarter.cmd', 'say "Quit"'
422call lineout samba.!bin'\smbstarter.cmd', 'ok = SysFileDelete("quit")'
423call lineout samba.!bin'\smbstarter.cmd', 'signal cleanup'
424call lineout samba.!bin'\smbstarter.cmd', 'end'
425call lineout samba.!bin'\smbstarter.cmd', 'otherwise nop'
426call lineout samba.!bin'\smbstarter.cmd', 'end'
427call lineout samba.!bin'\smbstarter.cmd', 'ok = SysSleep(1)'
428call lineout samba.!bin'\smbstarter.cmd', 'signal home'
429call lineout samba.!bin'\smbstarter.cmd', 'cleanup:'
430call lineout samba.!bin'\smbstarter.cmd', 'say "Aborting..."'
431call lineout samba.!bin'\smbstarter.cmd', 'exit'
432ok = stream(samba.!bin'\smbstarter.cmd','c','close')
433
434Setup = 'NOPRINT=YES;DEFAULTVIEW=RUNNING;'||,
435 'EXENAME='samba.!bin'\smbstarter.cmd;'||,
436 'STARTUPDIR='samba.!bin';'||,
437 'TITLE=;'||,
438 'PROGTYPE=WINDOWABLEVIO;'||,
439 'MINIMIZED=YES;'||,
440 'VISIBLE=NO;'||,
441 'NOAUTOCLOSE=NO;'||,
442 'OBJECTID=<smbstarter>'
443
444rc = SysCreateObject('WPProgram', 'SMBSTARTER', '<WP_NOWHERE>', Setup, 'UPDATE' )
445If rc <> 1 Then Say ' > failed to create SMBSTARTER Object'
446else ok = SysOpenObject('<smbstarter>', 'DEFAULT', 1)
447
448
449return
450
451/*:VRX _GuessIcon
452*/
453_GuessIcon: procedure
454 text = arg(1)
455 select /* Printer guessing */
456 when pos('LJ',text) > 0 then res = '#65:PMWP.DLL'
457 when pos('LASER',text) > 0 then res = '#65:PMWP.DLL'
458 when pos('EPSON',text) > 0 then res = '#65:PMWP.DLL'
459 when pos('PRINT',text) > 0 then res = '#65:PMWP.DLL'
460 when pos('PRT',text) > 0 then res = '#65:PMWP.DLL'
461 when pos('CANON',text) > 0 then res = '#65:PMWP.DLL'
462 when pos('MINOLTA',text) > 0 then res = '#65:PMWP.DLL'
463 when pos('FAX',text) > 0 then res = '#65:PMWP.DLL'
464 when pos('LEXMARK',text) > 0 then res = '#65:PMWP.DLL'
465 when pos('IPC$',text) > 0 then res = '#59:PMWP.DLL'
466 otherwise res = "#34:PMWP.DLL"
467 end
468return res
469
470/*:VRX _GUIInit
471*/
472_GUIInit:
473 IF options.!debug == 1 then say time()' _GUIInit() started'
474
475 if datatype(Top) = 'NUM' then do
476 ok = VRset("Main","Top",Top)
477 ok = VRset("Main","Left",Left)
478 ok = VRset("Main","Width",Width)
479 ok = VRset("Main","Height",Height)
480 end
481
482 ok = VRSet("Main", "Font", Font.!Main)
483 ok = VRSet("DT_StatusBar","Font", Font.!Status)
484 ok = VRSet("SW_Users", "Font", Font.!Users)
485 ok = VRSet("SW_Files", "Font", Font.!Files)
486 ok = VRSet("SW_Service", "Font", Font.!Service)
487 ok = VRSet("SW_Daemons", "Font", Font.!Daemons)
488 ok = VRSet("SW_SMBTree", "Font", Font.!SMBTree)
489 ok = VRSet("SW_Settings", "Font", Font.!Settings)
490
491 ok = VRSet("CN_Users", "Font", Font.!Users)
492 ok = VRSet("CN_Files", "Font", Font.!Files)
493 ok = VRSet("CN_Service", "Font", Font.!Service)
494 ok = VRSet("CN_Daemons", "Font", Font.!Daemons)
495 ok = VRSet("CN_SMBTREE", "Font", Font.!SMBTree)
496
497 ok = VRset("CN_SMBTREE","Caption",NLVGetMessage(153)||': Guest')
498
499 CALL NLVSetText 'ContextMenu_Daemons_Sort', 'Caption', 35
500 CALL NLVSetText 'ContextMenu_Daemons_Ping', 'Caption', 32
501 CALL NLVSetText 'ContextMenu_Daemons_Details', 'Caption', 118
502/* CALL NLVSetText 'ContextMenu_Daemons_Icons', 'Caption', 119 */
503 CALL NLVSetText 'ContextMenu_Daemons_Tree', 'Caption', 120
504 CALL NLVSetText 'ContextMenu_Daemons_Miniicons', 'Caption', 81
505
506 CALL NLVSetText 'ContextMenu_Files_Sort', 'Caption', 35
507
508 CALL NLVSetText 'ContextMenu_Service_Sort', 'Caption', 35
509 CALL NLVSetText 'ContextMenu_Service_CloseSHare','Caption', 70
510
511 CALL NLVSetText 'ContextMenu_Users_SendMsg', 'Caption', 80
512 CALL NLVSetText 'ContextMenu_Users_Sort', 'Caption', 35
513
514 CALL NLVSetText 'ContextMenu_Tree_SendMsg', 'Caption', 80
515 CALL NLVSetText 'ContextMenu_Tree_Miniicons', 'Caption', 81
516 CALL NLVSetText 'ContextMenu_Tree_Login', 'Caption', 82
517 CALL NLVSetText 'ContextMenu_Tree_Logoff', 'Caption', 83
518
519 CALL NLVSetText 'ContextMenu_Tree_Sort', 'Caption', 35
520 CALL NLVSetText 'ContextMenu_Tree_Details', 'Caption', 118
521 CALL NLVSetText 'ContextMenu_Tree_Icons', 'Caption', 119
522 CALL NLVSetText 'ContextMenu_Tree_Tree', 'Caption', 120
523
524 Buttonwidth = VRMethod( "Screen", "PixelsToTwips", 32 )
525
526 ok = VRSet("SPIN_Intervall", "Value", Intervall)
527 ok = VRSet("SPIN_IntervallMin","Value", IntervallMin)
528 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
529
530 ok = VRSet("ICB_START", "Enabled", VRFileExists(samba.!smbcmd))
531 ok = VRSet("ICB_REstart","Enabled", VRFileExists(samba.!smbcmd))
532 ok = VRSet("ICB_REload", "Enabled", VRFileExists(samba.!smbcmd))
533
534 ok = VRSet("CN_Daemons", "View", DaemonView)
535 ok = VRSet("CN_SMBTREE", "View", TreeView)
536 ok = VRSet("CB_NoMsgBox", "Set", NoMsgBox)
537 ok = VRSet("CB_WPSStartStop", "Set", WPSStartStop)
538 ok = VRSet("CB_DetectZombies","Set", DetectZombies)
539
540 if VIOFontSize = "" then do
541 ok = VRSet("DT_FONTSIZE","Enabled", 0)
542 ok = VRSet("SPIN_FONTSIZE","Enabled", 0)
543 end
544 else ok = VRSet("SPIN_FONTSIZE","Value", VIOFontSize)
545
546 call _INILayoutRead "CN_Users"
547 call _INILayoutRead "CN_Files"
548 call _INILayoutRead "CN_Service"
549 call _INILayoutRead "CN_Daemons"
550 call _INILayoutRead "CN_SMBTREE"
551
552 ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons)
553 ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
554 ok = VRset("ContextMenu_Tree_MiniIcons", "Checked", \advanced.!bigicons)
555 ok = VRset("ContextMenu_Daemons_MiniIcons", "Checked", \advanced.!bigicons)
556 ok = VRSet("CB_Debug","set",options.!Debug)
557
558 if _ChkTempFreeSpace() < 262144 then do
559 Msg.Type = "W"
560 Msg.Text = NLVGetMessage(116, TempDir)
561 call _ShowMsg
562 end
563
564 /* Common margin around controls */
565 margin = ((VRGet("Main", "InteriorLeft") / 3) * 2) + 2
566
567 /* Statusbar */
568 ok = VRSet("DT_STATUSBAR","Caption", " "||VRGet("Main", "HintText"))
569
570 call Main_Resize
571
572
573 ok = VRSet("Main", "Visible", 1)
574 IF options.!debug == 1 then say time()' _GUIInit() done'
575return
576
577/*:VRX _INILayoutRead
578*/
579_INILayoutRead:
580 Container = arg(1)
581 ok = VRMethod(Container, "GetFieldList", "Fields." )
582 Layout = VRGetIni( "Layout", Container, OurINI )
583 if Layout = "" then return
584 do I = 1 to Fields.0
585 ok = VRMethod(Container, "SetFieldAttr", fields.I,"Visible", substr(Layout,I,1))
586 end
587return
588
589/*:VRX _INILayoutWrite
590*/
591_INILayoutWrite:
592 Container = arg(1)
593 ok = VRMethod(Container, "GetFieldList", "Fields." )
594 Layout = ""
595 do I = 1 to fields.0
596 Layout = Layout||VRMethod(Container, "GetFieldAttr", fields.I, "Visible" )
597 end
598 ok = VRSetIni( "Layout", Container , Layout, OurINI, 'NoClose' )
599return
600
601/*:VRX _INIRead
602*/
603_INIRead:
604 IF options.!debug == 1 then say time()' _INIRead() started'
605
606 OurINI = strip(VRParseFileName(VRget("Application","Program"),'DP')'\SMBSTATUS.INI',,'\')
607 ok = SysFileTree(OurINI, INIFound.,'FO')
608 if INIFound.0 = 1 then OurINI = VRParseFileName(INIFound.1,'DPNE')
609 IF options.!debug == 1 then say ' OurINI='OurINI
610
611 Top = VRGetIni( "Pos", "Top", OurINI , 'NoClose')
612 Left = VRGetIni( "Pos", "Left", OurINI , 'NoClose')
613 Width = VRGetIni( "Pos", "Width", OurINI , 'NoClose')
614 Height= VRGetIni( "Pos", "Height", OurINI , 'NoClose')
615
616 Font.!Users = VRGetIni( "Fonts", "SW_USERS", OurINI , 'NoClose' )
617 Font.!Files = VRGetIni( "Fonts", "SW_FILES", OurINI , 'NoClose' )
618 Font.!Service = VRGetIni( "Fonts", "SW_SERVICE", OurINI , 'NoClose' )
619 Font.!Daemons = VRGetIni( "Fonts", "SW_DAEMONS", OurINI , 'NoClose' )
620 Font.!SMBTree = VRGetIni( "Fonts", "SW_SMBTREE", OurINI , 'NoClose' )
621 Font.!Settings= VRGetIni( "Fonts", "SW_SETTINGS", OurINI , 'NoClose' )
622 Font.!Main = VRGetIni( "Fonts", "Main", OurINI , 'NoClose' )
623 Font.!Status = VRGetIni( "Fonts", "Statusfont", OurINI , 'NoClose' )
624
625 if Font.!Users = "" then Font.!Users = "9.WarpSans"
626 if Font.!Files = "" then Font.!Files = "9.WarpSans"
627 if Font.!Service = "" then Font.!Service = "9.WarpSans"
628 if Font.!Daemons = "" then Font.!Daemons = "9.WarpSans"
629 if Font.!SMBTree = "" then Font.!SMBTree = "9.WarpSans"
630 if Font.!Settings = "" then Font.!Settings = "9.WarpSans"
631 if Font.!Main = "" then Font.!Main = "9.WarpSans"
632 if Font.!Status = "" then Font.!Status = "9.WarpSans"
633
634 Intervall = VRGetIni( "Settings", "Intervall", OurINI,'NoClose')
635 if Intervall = "" then Intervall = 60
636
637 IntervallMin = VRGetIni( "Settings", "IntervallMin", OurINI,'NoClose')
638 if IntervallMin = "" then IntervallMin = 180
639
640 CurrentPageNr = VRGetIni( "Settings", "CurrentPageNr", OurINI,'NoClose')
641 if CurrentPageNr = "" then CurrentPageNr = 4
642
643 DaemonView = VRGetIni( "Settings", "DaemonView", OurINI,'NoClose')
644 if DaemonView = "" then DaemonView = "IconTree"
645
646 TreeView = VRGetIni( "Settings", "TreeView", OurINI,'NoClose')
647 if TreeView = "" then TreeView = "IconTree"
648
649 NoMsgBox = VRGetIni( "Settings", "NoMsgBox", OurINI,'NoClose')
650 if NoMsgBox = "" then NoMsgBox = 1
651
652 WPSStartStop = VRGetIni( "Settings", "WPSStartStop", OurINI,'NoClose')
653 if WPSStartStop = "" then WPSStartStop = 1
654
655 DetectZombies = VRGetIni( "Settings", "DetectZombies", OurINI,'NoClose')
656 if DetectZombies = "" then DetectZombies = 0
657
658 VIOFontSizeKey = ""
659
660 VIOFontSize = VRGetIni( "Settings", "VIOFontsize", OurINI,'NoClose')
661 if VIOFontSize = "" then do
662 say "Undefined VIOFontsize and OldFontSize"
663 VIOFontSize = _VIOFontSizeGetCurrent()
664 OldFontSize = VIOFontSize
665 say "VIOFontSize ="VIOFontSize
666 say "OldFontSize ="OldFontSize
667 end
668 else do
669 OldFontSize = _VIOFontSizeGetCurrent()
670 say "Detected OldFontSize = "OldFontSize
671 say "VIOFontSize from INI = "VIOFontSize
672 end
673
674
675 options.!debug = VRGetIni( "Options", "Debug", OurINI)
676 if options.!debug = "" then options.!debug = 0
677
678 if options.!Debug then ok = VRRedirectStdIO("ON")
679 else ok = VRRedirectStdIO("OFF")
680 options.!storecreds = VRGetIni('Settings', 'StoreCreds', OurINI, 'NoClose')
681say "options.!storecreds = "options.!storecreds
682 IF options.!storecreds == '' then options.!storecreds = 1
683say "options.!storecreds = "options.!storecreds
684 IF _ucChkObj() = 0 then options.!storecreds = 0
685say "options.!storecreds = "options.!storecreds
686
687
688 advanced.!bigicons = VRGetIni( "Settings", "BigIcons", OurINI)
689 if advanced.!bigicons = "" then advanced.!bigicons = 1
690
691 advanced.!smbconfchanged = 0
692
693 /* For Browse page */
694 FirstRun = 1
695 /* For Users page in case connections.tdb is not initialised */
696 IgnoreSmbNoInit = 1
697
698 /* For Refresh tree display code */
699 RefreshMode =""
700
701 call _BrowseIconsInit
702
703 smbdpidhandle.0 = 0
704 nmbdpidhandle.0 = 0
705 winbpidhandle.0 = 0
706
707 prevsmbdct = 0
708 prevnmbdct = 0
709 prevwinbct = 0
710
711 smbdoutput = TempDir'smbd.out'
712 IF options.!debug == 1 then say time()' _INIRead() done'
713return
714
715/*:VRX _INIWrite
716*/
717_INIWrite:
718 IF options.!debug == 1 then say time()' _INIWrite() started'
719 ok = VRSetIni( "Pos", "Top", VRGet("Main","Top"), OurINI, 'NoClose' )
720 ok = VRSetIni( "Pos", "Left", VRGet("Main","Left"), OurINI, 'NoClose' )
721 ok = VRSetIni( "Pos", "Width", VRGet("Main","Width"), OurINI, 'NoClose' )
722 ok = VRSetIni( "Pos", "Height", VRGet("Main","Height"), OurINI, 'NoClose' )
723
724 ok = VRSetIni( "Settings", "Intervall", VRGet("SPIN_Intervall","Value"),OurINI,'NoClose')
725 ok = VRSetIni( "Settings", "IntervallMin", VRGet("SPIN_IntervallMin","Value"),OurINI,'NoClose')
726 ok = VRSetIni( "Settings", "CurrentPageNr",CurrentPageNr, OurINI,'NoClose')
727 ok = VRSetIni( "Settings", "DaemonView", VRGet("CN_Daemons","View"), OurINI,'NoClose')
728 ok = VRSetIni( "Settings", "TreeView", VRGet("CN_SMBTREE","View"), OurINI,'NoClose')
729 ok = VRSetIni( "Settings", "NoMsgBox", NoMsgBox, OurINI,'NoClose')
730 ok = VRSetIni( "Settings", "WPSStartStop", WPSStartStop, OurINI,'NoClose')
731 ok = VRSetIni( "Settings", "BigIcons", \VRGet("CN_SMBTREE", "MiniIcons"),OurINI,'NoClose')
732 ok = VRSetIni( "Settings", "DetectZombies",DetectZombies, OurINI,'NoClose')
733 ok = VRSetIni( "Settings", "StoreCreds", options.!storecreds , OurINI,'NoClose')
734 ok = VRSetIni( "Settings", "VIOFontsize", VIOFontsize, OurINI,'NoClose')
735
736 ok = VRSetIni( "Options", "Debug", options.!debug, OurINI, 'NoClose' )
737
738 call _INILayoutWrite "CN_Users"
739 call _INILayoutWrite "CN_Files"
740 call _INILayoutWrite "CN_Service"
741 call _INILayoutWrite "CN_Daemons"
742 call _INILayoutWrite "CN_SMBTREE"
743
744 if VRGet("CN_USERS", "Font") <> "<default>" then ok = VRSet("SW_USERS", "Font", VRGet("CN_USERS", "Font"))
745 if VRGet("CN_FILES", "Font") <> "<default>" then ok = VRSet("SW_FILES", "Font", VRGet("CN_FILES", "Font"))
746 if VRGet("CN_SERVICE", "Font") <> "<default>" then ok = VRSet("SW_SERVICE","Font", VRGet("CN_SERVICE","Font"))
747 if VRGet("CN_DAEMONS", "Font") <> "<default>" then ok = VRSet("SW_DAEMONS","Font", VRGet("CN_DAEMONS","Font"))
748 if VRGet("CN_SMBTREE", "Font") <> "<default>" then ok = VRSet("SW_SMBTREE","Font", VRGet("CN_SMBTREE","Font"))
749
750 ok = VRSetIni( "Fonts", "SW_USERS", VRGet("SW_USERS", "Font"), OurINI, 'NoClose' )
751 ok = VRSetIni( "Fonts", "SW_FILES", VRGet("SW_FILES", "Font"), OurINI, 'NoClose' )
752 ok = VRSetIni( "Fonts", "SW_SERVICE", VRGet("SW_SERVICE", "Font"), OurINI, 'NoClose' )
753 ok = VRSetIni( "Fonts", "SW_DAEMONS", VRGet("SW_DAEMONS", "Font"), OurINI, 'NoClose' )
754 ok = VRSetIni( "Fonts", "SW_SMBTREE", VRGet("SW_SMBTREE", "Font"), OurINI, 'NoClose' )
755 ok = VRSetIni( "Fonts", "SW_SETTINGS",VRGet("SW_SETTINGS","Font"), OurINI, 'NoClose' )
756 ok = VRSetIni( "Fonts", "Statusfont", VRGet("DT_StatusBar","Font"),OurINI, 'NoClose' )
757 ok = VRSetIni( "Fonts", "Main", VRGet("Main","Font"), OurINI )
758 IF options.!debug == 1 then say time()' _INIWrite() done'
759return
760
761/*:VRX _LoadotherFuncs
762*/
763_LoadotherFuncs:
764 IF options.!debug == 1 then say time()' _LoadotherFuncs() started'
765 SIGNAL ON SYNTAX NAME DLLMissing
766
767 call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
768 call SysLoadFuncs
769
770 call RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
771 call PRLoadFuncs
772
773 call rxfuncadd 'IniLoadFuncs', 'REXXINI', 'IniLoadFuncs'
774 call IniLoadFuncs
775
776 call RxFuncAdd 'RxDate', 'RexxDate', 'RxDate'
777
778 SIGNAL OFF SYNTAX
779 IF options.!debug == 1 then say time()' _LoadotherFuncs() done'
780return
781
782DLLMissing:
783 Fatal = 1
784 call VRMessage 'Main', 'REXX function library 'strip(translate(word(sourceline(SIGL-1),4),' ',"',"))'.DLL is missing!', "EVFSGUI fatal error", "E"
785signal Quit
786/*:VRX _MsgYesNo
787*/
788_MsgYesNo:
789 say "_MsgYesNo() started"
790 buttons.0 = 2
791 buttons.1 = NLVGetMessage(6)
792 buttons.2 = NLVGetMessage(7)
793 default = 2
794 buttons.default = NLVGetMessage(7)
795 esc = 2
796 buttons.esc = NLVGetMessage(7)
797 RC = VRMessage( VRWindow(), Msg.Text, Msg.Title,"Q","buttons.",default, esc )
798 say "_MsgYesNo() done, answer "RC
799return RC
800
801/*:VRX _NLVSetup
802*/
803_NLVSetup:
804 settings.!messages = 1 /* language files exist(s) */
805 settings.!helpfile = 0 /* helpfiles do not exist */
806 settings.!nlv8dot3 = 0 /* NLV may have long filenames */
807 call NLVSetup
808
809 Msg.Title = NLVGetMessage(1)
810 ok = VRSet("Main","helpFile", settings.!helpfile)
811
812 /* Setup the tabbed dialogue */
813 w = VRLoad( "TDL_1", VRWindowPath(), "SW_DAEMONS" )
814 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(18)" ")
815 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SMBTREE" )
816 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(19)" ")
817 w = VRLoad( "TDL_1", VRWindowPath(), "SW_USERS" )
818 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(15)" ")
819 w = VRLoad( "TDL_1", VRWindowPath(), "SW_FILES" )
820 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(16)" ")
821 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SERVICE" )
822 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(17)" ")
823 w = VRLoad( "TDL_1", VRWindowPath(), "SW_CHKTDB" )
824 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(22)" ")
825 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SETTINGS" )
826 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(24)" ")
827
828 CALL NLVSetText 'ICB_Refresh', 'Caption', 11
829 CALL NLVSetText 'ICB_Apply', 'Caption', 10
830 CALL NLVSetText 'ICB_About', 'Caption', 14
831 CALL NLVSetText 'ICB_EXIT', 'Caption', 12
832
833 CALL NLVSetText 'ICB_Refresh', 'Hinttext', 51
834/* CALL NLVSetText 'ICB_APPLY', 'Hinttext', FIXME */
835 CALL NLVSetText 'ICB_ABOUT', 'Hinttext', 53
836 CALL NLVSetText 'ICB_EXIT', 'Hinttext', 54
837
838 CALL VRMethod 'TT_Main', 'Register', 'ICB_REFRESH', NLVGetMessage(51)
839 CALL VRMethod 'TT_Main', 'Register', 'ICB_APPLY', NLVGetMessage(52) /* FIXME */
840 CALL VRMethod 'TT_Main', 'Register', 'ICB_ABOUT', NLVGetMessage(53)
841 CALL VRMethod 'TT_Main', 'Register', 'ICB_EXIT', NLVGetMessage(54)
842return
843
844/*:VRX _Refresh
845*/
846_Refresh:
847 IF options.!debug == 1 then say time()' _Refresh() started'
848 ok = VRSet("TM_refresh","Enabled", 0)
849 SmbNoInit = 0
850
851 refreshoutput = TempDir'refresh.out'
852 refresherr = TempDir'refresh.err'
853
854 say ' 'samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput
855 address cmd samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput
856
857 do while lines(refreshoutput) > 0
858 Hdr = linein(refreshoutput)
859 if pos("Version ",Hdr) > 0 then leave
860 end
861
862 SambaVer = "Samba "||strip(Hdr)
863 say ' smbd.exe: "'SambaVer'"'
864 ok = stream(refreshoutput,'c','close')
865
866 say ' 'samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput
867 address cmd samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput
868
869 do while lines(refreshoutput) > 0
870 Hdr = linein(refreshoutput)
871 if pos("Samba version",Hdr) > 0 then leave
872 end
873
874 SambaStVer = strip(Hdr) /* we can detect version mismatches here */
875 say ' smbstatus: "'SambaStVer'"'
876
877 select
878 when pos('not initialised',SambaStVer) > 0 then do
879 SambaVer = SambaVer||" (Init)"
880 SmbNoInit = 1
881 end
882 when translate(SambaStVer) <> translate(SambaVer) then SambaVer = SambaVer||" (Hybrid)"
883 otherwise nop
884 end
885
886 Ok = VRSet("Main", "Caption", SambaVer' - 'NLVGetMessage(146))
887
888 /* Active User */
889 Hdr1 = linein(refreshoutput)
890/* say ' 1:'hdr1 */
891 Hdr2 = linein(refreshoutput)
892/* say ' 2:'hdr2 */
893 Zeile = linein(refreshoutput)
894 say ' 'Zeile
895 if SmbNoInit then do
896 call lineout samba.!msg, SambaStVer
897 call lineout samba.!msg, Hdr1
898 call lineout samba.!msg, Hdr2
899 call lineout samba.!msg, Zeile
900 ok = stream(samba.!msg,'c','close')
901 if IgnoreSmbNoInit then do
902 call _SambaShowMsg
903 IgnoreSmbNoInit = 0
904 end
905 end
906
907 say ' SmbNoInit = 'SmbNoInit
908
909 /* Active users */
910 ok = VRSet("CN_Users","Painting", 0)
911 ok = VRMethod("CN_Users", "RemoveRecord", "ALL")
912 Username.0 = 0
913 IP.0 = 0
914 Group.0 = 0
915 I = 0
916 if \SmbNoInit then do
917 do while Zeile <> ''
918 parse var Zeile UPID Username Group Machine IP
919 I = I + 1
920 UPID.I = UPID
921 Username.I = Username
922 Group.I = Group
923 IP = strip(IP)
924 parse var IP '('IP.I')'
925 RecHandle = VRMethod("CN_Users", "Addrecord")
926 ok = VRMethod("CN_Users", "SetFieldData", RecHandle, UIconH, "$44", UPIDFH, UPID, UsernameFH, Username, GroupFH, Group, UMachineFH, Machine, UIPAdrFH, IP.I)
927 Zeile = linein(refreshoutput)
928 end
929 end
930 Username.0 = I
931 Group.0 = I
932 UPID.0 = I
933 ok = VRSet("CN_Users","Painting", 1)
934
935 /* Active Services */
936 Hdr = linein(refreshoutput)
937 Hdr = linein(refreshoutput)
938 I = 0
939 Zeile = linein(refreshoutput)
940 ok = VRSet("CN_Service","Painting", 0)
941 ok = VRMethod("CN_Service", "RemoveRecord", "ALL")
942 do while Zeile <> ''
943 parse var Zeile Service SPId Machine Connected
944 I = I + 1
945 SPid.I = SPid
946 Machine.I = Machine
947 Service.I = Service
948 Icon = _GuessIcon(Service.I)
949
950 Connected = strip(Connected)
951 T. = ""
952 parse var Connected T.WDay T.Month T.DoM T.TimeoD T.Year
953 Connected = T.TimeoD', 'T.WDay' 'T.DoM' 'T.Month' 'T.Year
954
955 RecHandle = VRMethod("CN_Service", "Addrecord")
956 ok = VRMethod("CN_Service", "SetFieldData", RecHandle, SIconH, Icon, ServiceFH, Service, SPIDFH, SPID, SMachineFH, Machine, ConnectedFH, Connected)
957 Zeile = linein(refreshoutput)
958 end
959 SPid.0 = I
960 Machine.0 = I
961 Service.0 = I
962
963 ok = VRSet("CN_Service","Painting", 1)
964
965 /* Open files */
966 Hdr = linein(refreshoutput)
967 Hdr = linein(refreshoutput)
968 Hdr = linein(refreshoutput)
969
970 Zeile = linein(refreshoutput)
971 ok = VRSet("CN_Files","Painting", 0)
972 ok = VRMethod("CN_Files", "RemoveRecord", "ALL")
973 File.0 = 0
974 FPID.0 = 0
975 do while Zeile <> ''
976 parse var Zeile FPid Uid DenyMode Access RW Oplock Sharepath Rest
977 TimeDate = right(rest,25)
978
979say 'Refreshcrash "'Rest'"'
980say 'Refreshcrash "'max(length(Rest)-25)'"'
981
982 Name = strip(left(Rest,max(length(Rest)-25,1)))
983 I = I + 1
984 sharepath = strip(translate(left(sharepath,1))||translate(substr(SharePath,2),'\','/'),'T','\')
985 Username = UID
986 do J = 1 to UPID.0
987 if FPID = UPID.J then do
988 Username = Username.J
989 leave
990 end
991 end
992 File = SharePath||'\'||translate(Name,'\','/')
993 File.I = File
994 FPID.I = FPID
995 TimeDate = strip(TimeDate)
996 say Timedate
997 T. = ""
998 parse var TimeDate T.WDay T.Month T.DoM T.TimeoD T.Year
999 FileTime = T.TimeoD
1000 FileDate = T.WDay' 'T.DoM' 'T.Month' 'T.Year
1001 RecHandle = VRMethod("CN_Files", "Addrecord")
1002 ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FPidFH, FPid, FileFH, File, FUserFH, Username, UidFH, Uid, DenyModeFH, DenyMode, AccessFH, Access, RWFH, RW)
1003 ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FIconH, "$45", TimeFH, FileTime, DateFH, FileDate, OplockFH, Oplock, SharePathFH, Sharepath, NameFH, Name)
1004 Zeile = linein(refreshoutput)
1005 end
1006 File.0 = I
1007 FPID.0 = I
1008
1009 ok = stream(refreshoutput, 'c','close')
1010 ok = SysFileDelete(refreshoutput)
1011 ok = stream(refresherr, 'c','close')
1012 ok = SysFileDelete(refreshouterr)
1013 if VRFileExists( samba.!bin"\smbsched.cmd" ) then do
1014 address cmd samba.!bin"\smbsched.cmd"
1015 end
1016
1017 call _RefreshDaemons
1018 ok = VRSet("CN_Files","Painting", 1)
1019 if VRGet("Main", "WindowState") = "Minimized" then do
1020 ok = VRSet("TM_Refresh","Delay", IntervallMin * 1000)
1021 end
1022 else do
1023 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
1024 end
1025 ok = VRSet("TM_refresh","Enabled", 1)
1026
1027 IF options.!debug == 1 then say time()' _Refresh() done'
1028return
1029/*:VRX _RefreshDaemons
1030*/
1031_RefreshDaemons:
1032 IF options.!debug == 1 then say time()' _RefreshDaemons() started'
1033 ok = VRSet("TM_RefreshDaemons","Delay",3000)
1034
1035 ok = VRSet("CN_Daemons","Painting", 0 )
1036 call VRSet VRWindow(), 'Pointer', 'Wait'
1037
1038 do I = 1 to smbdpidhandle.0
1039 ok = VRMethod("CN_Daemons", "RemoveRecord", smbdpidhandle.I )
1040 end
1041
1042 do I = 1 to nmbdpidhandle.0
1043 ok = VRMethod("CN_Daemons", "RemoveRecord", nmbdpidhandle.I )
1044 end
1045
1046 do I = 1 to winbpidhandle.0
1047 ok = VRMethod("CN_Daemons", "RemoveRecord", winbpidhandle.I )
1048 end
1049
1050 Running = _SambaRunning()
1051
1052 call VRSet VRWindow(), 'Pointer', '<default>'
1053
1054 smbdpids = pids.!smbd
1055 nmbdpids = pids.!nmbd
1056 winbpids = pids.!nmbd
1057
1058 smbdRunning = running.!smbd
1059 nmbdRunning = running.!nmbd
1060 winbRunning = running.!winb
1061
1062 if smbdRunning then do
1063 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, smbdpids)
1064 ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$46")
1065 smbdpidhandle.0 = words(smbdpids)
1066 if options.!debug = 1 then do
1067 if smbdpidhandle.0 > prevsmbdct then do
1068 prevsmbdct = smbdpidhandle.0
1069 call beep 880*1, 10
1070 call beep 880*2, 10
1071 call beep 880*4, 10
1072 end
1073 if smbdpidhandle.0 < prevsmbdct then do
1074 prevsmbdct = smbdpidhandle.0
1075 call beep 880*4, 10
1076 call beep 880*2, 10
1077 call beep 880*1, 10
1078 end
1079 end
1080
1081 do I = 1 to words(smbdpids)
1082 Username = ""
1083 do J = 1 to UPID.0
1084 if UPID.J = word(smbdpids,I) then do
1085 Username = ' 'Username.J
1086 leave
1087 end
1088 end
1089 smbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", smbdhandle, , NLVGetMessage(130)' 'word(smbdpids,I)' ('d2x(word(smbdpids,I))'x)', "$48")
1090 /* we ping all smbd.exe except the first one */
1091 if DetectZombies = 1 & I > 1 then do
1092 ok = VRSet("Main", 'Pointer', 'Wait' )
1093 address cmd samba.!smbcontrolexe' 'word(smbdpids,I)' ping --timeout=2 --debuglevel=0 2>'samba.!error' 1>'samba.!msg
1094 ok = VRSet("Main", 'Pointer', '<default>' )
1095 response = linein(samba.!msg)
1096 ok = stream(samba.!msg,'c','close')
1097 if pos('PONG', response) = 0 then do /* we have a zombie */
1098 ok = VRMethod( "CN_Daemons", "SetRecordAttr", smbdpidhandle.I,"Icon", "$49")
1099 say " Found Zombie "word(smbdpids,I)
1100 end
1101 end
1102 if Username <> "" then do
1103 smbdpidhandle.I.user = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I, , Username, "$44")
1104 do J = 1 to FPID.0
1105 if FPID.J = word(smbdpids,I) then do
1106 dummyHandle = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I.user, , File.J, "$45")
1107 end
1108 end
1109 end
1110 end
1111 end
1112 else do
1113 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
1114 ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$47")
1115 if options.!debug = 1 then do
1116 if prevsmbdct > 0 then do
1117 prevsmbdct = 0
1118 call beep 880*4, 10
1119 call beep 880*2, 10
1120 call beep 880*1, 10
1121 end
1122 end
1123 end
1124
1125 if nmbdRunning then do
1126 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, nmbdpids)
1127 ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$46")
1128 nmbdpidhandle.0 = words(nmbdpids)
1129 do I = 1 to words(nmbdpids)
1130 nmbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", nmbdhandle, , NLVGetMessage(130)' 'word(nmbdpids,I)' ('d2x(word(nmbdpids,I))'x)', "$48")
1131 end
1132 end
1133 else do
1134 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
1135 ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$47")
1136 end
1137
1138 if winbRunning then do
1139 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(40), DPidsFH, winbpids)
1140 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$46")
1141 winbpidhandle.0 = words(winbpids)
1142 do I = 1 to words(winbpids)
1143 winbpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", winbhandle, , NLVGetMessage(130)' 'word(winbpids,I)' ('d2x(word(winbpids,I))'x)', "$48")
1144 end
1145 end
1146 else do
1147 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
1148 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$47")
1149 end
1150
1151 if \(smbdrunning|nmbdrunning|winbrunning) then do
1152 ok = VRSet("ICB_START", "Enabled", 1)
1153 ok = VRSet("ICB_STOP", "Enabled", 0)
1154 ok = VRSet("ICB_REStart","Enabled", 0)
1155 ok = VRSet("ICB_RELoad", "Enabled", 0)
1156 end
1157 else do
1158 ok = VRSet("ICB_START", "Enabled", 0)
1159 ok = VRSet("ICB_STOP", "Enabled", 1)
1160 ok = VRSet("ICB_REStart","Enabled", 1)
1161 ok = VRSet("ICB_RELoad", "Enabled", 1)
1162 end
1163
1164 ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
1165 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
1166 ok = VRSet("CN_Daemons","Painting", 1 )
1167 if Running then call _SambaUptime
1168
1169 IF options.!debug == 1 then say time()' _RefreshDaemons() done'
1170return
1171
1172/*
1173_pids: procedure
1174 pongfile = arg(1)
1175 pids = ''
1176 do until lines(pongfile) = 0
1177 pongline = linein(pongfile)
1178 if word(Pongline,1) = 'PONG' then do
1179 parse var pongline pong from tpid pid
1180 pids = pids||pid', '
1181 end
1182 else pids = pids||pongline
1183 end
1184 pids = strip(strip(pids),,',')
1185 ok = stream(pongfile,'c','close')
1186 ok = SysFileDelete(pongfile)
1187return pids
1188 */
1189
1190/* pingout = 'ping.out'
1191 '@smbcontrol -t 2 smbd ping -d 0 1>'pingout
1192 if rc = 0 then smbdRunning = 1
1193 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DPidsFH, _pids(pingout))
1194
1195 '@smbcontrol -t 2 nmbd ping -d 0 1>'pingout
1196 if rc = 0 then nmbdRunning = 1
1197 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DPidsFH, _pids(pingout))
1198
1199 '@smbcontrol -t 1 winbindd ping -d 0 1>'pingout
1200 if rc = 0 then winbRunning = 1
1201 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DPidsFH, _pids(pingout))
1202
1203 ok = SysFileDelete(PingOut)
1204*/
1205/*:VRX _RefreshDaemonsDelay
1206*/
1207_RefreshDaemonsDelay:
1208 IF options.!debug == 1 then say time()' _RefreshDaemonsDelay() started'
1209 IF options.!debug == 1 then say " Old intervall = "VRGet("TM_RefreshDaemons","Delay")
1210 ok = VRSet("TM_RefreshDaemons","Delay", 60000)
1211 IF options.!debug == 1 then say " New Intervall = "VRGet("TM_RefreshDaemons","Delay")
1212 IF options.!debug == 1 then say time()' _RefreshDaemonsDelay() done'
1213return
1214
1215/*:VRX _SambaCheckFreeSpace
1216*/
1217_SambaCheckFreeSpace:
1218 say time()" _SambaCheckFreeSpace() started"
1219
1220 if samba.!logdir = 'SAMBA.!LOGDIR' | samba.!Logdir = "" then do
1221 log_file = IniGet('log file', 'global', samba.!smbconf)
1222 say log_file
1223 say translate(log_file,'\','/')
1224 samba.!logdir = VRParseFileName(translate(log_file,'\','/'),"DP")
1225 say samba.!logdir
1226 end
1227 loggingfreespace = word(SysDriveInfo(left(samba.!logdir,2)),2)%1024%1024
1228 ok = VRSet("DT_FREESPACE", "Caption", " "loggingfreespace' MB')
1229
1230 select
1231 when loggingfreespace < 50 then ok = VRDeleteFile(samba.!logdir'\log.*')
1232 when loggingfreespace < 100 then ok = VRset("CN_Daemons","BackColor","Red")
1233 when loggingfreespace < 200 then ok = VRset("CN_Daemons","BackColor","Yellow")
1234 otherwise ok = VRset("CN_Daemons","BackColor","SystemWindow")
1235 end
1236 CALL VRMethod 'TT_SETTINGS', 'Register', 'DT_FREESPACE', samba.!logdir
1237 say time()" _SambaCheckFreeSpace() done"
1238return
1239
1240/*:VRX _SambaFindPIDfile
1241*/
1242_SambaFindPIDfile:
1243 IF options.!debug == 1 then say time()' _SambaFindPIDfile() started'
1244
1245 ok = SysFileTree(ETC'\samba\pid\nmbd*pid',nmbdpid.,'FO')
1246 if nmbdpid.0 = 1
1247 then nmbdpidfile = nmbdpid.1;
1248 else nmbdpidfile = ""
1249
1250 IF options.!debug == 1 then say " nmbdpidfile = "nmbdpidfile
1251
1252 IF options.!debug == 1 then say time()' _SambaFindPIDfile() done'
1253return
1254
1255/*:VRX _SambaShowError
1256*/
1257_SambaShowError: procedure expose samba. settings. options.
1258 I = 0
1259 do while lines(samba.!error) <> 0
1260 I = I + 1
1261 smberr.I = linein(samba.!error)
1262 end
1263 ok = stream(Samba.!error,"c","close")
1264 smberr.0 = I
1265 Buttons.1 = "OK" /* NLVGetMessage(2) */
1266 Buttons.0 = 1
1267 id = VRMessageStem( VRWindow(), "smberr.", VRGet("Main", "Caption") , "Error", "Buttons.", buttons.1, buttons.1 )
1268 ok = SysFileDelete(Samba.!error)
1269return
1270
1271/*:VRX _SambaShowMsg
1272*/
1273_SambaShowMsg: procedure expose samba. settings. options.
1274 say "SambaShowMsg started"
1275 skipWords = arg(1)
1276 skip.0 = words(skipWords)
1277 do J = 1 to skip.0
1278 skip.J = translate(word(skipWords,J))
1279 end
1280 I = 0
1281 do while lines(samba.!msg) <> 0
1282 msgline = linein(samba.!msg)
1283 SkipIt = 0
1284 do J = 1 to skip.0
1285 if pos(skip.J,translate(msgline)) > 0 then do
1286 skipit = 1
1287 leave
1288 end
1289 end
1290 if \SkipIt then do
1291 I = I + 1
1292 smbmsg.I = strip(MsgLine)
1293 end
1294 end
1295 ok = stream(Samba.!msg,"c","close")
1296 say " stream close "Samba.!msg" = "ok
1297 smbmsg.0 = I
1298 if smbmsg.0 > 0 then do
1299 Buttons.1 = "OK" /* NLVGetMessage(2) */
1300 Buttons.0 = 1
1301 id = VRMessageStem( VRWindow(), "smbmsg.", VRGet("Main", "Caption") , "I", "Buttons.", buttons.1, buttons.1 )
1302 end
1303 ok = SysFileDelete(Samba.!msg)
1304 say " Delete "Samba.!msg" = "ok
1305 say "SambaShowMsg done"
1306return
1307/*:VRX _SambaUptime
1308*/
1309_SambaUptime:
1310 IF options.!debug == 1 then say time()' _SambaUptime() started'
1311 call _SambaFindPIDfile
1312 if nmbdpidfile = "" then do
1313 ok = VRset("CN_Daemons", "Caption", NLVGetMessage(42)||" "||NLVGetMessage(41))
1314 return
1315 end
1316
1317 StartTime = SysGetFileDateTime(nmbdpidfile)
1318 if StartTime = -1 then return
1319
1320 NowTime = substr(date('S'),1,4)'-'substr(date('S'),5,2)'-'substr(date('S'),7,2)' 'time()
1321
1322 /* StartTime = "2007-12-31 00:00:00"
1323 NowTime = "2008-03-05 08:59:50" */
1324
1325 IF options.!debug == 1 then do
1326 say " Start Time ='"StartTime"'"
1327 say " Now Time ='"NowTime"'"
1328 end
1329
1330 doM.0 = 12
1331 doM.1 = 31; doM.2 = 28; doM.3 = 31; doM.4 = 30; doM.5 = 31; doM.6 = 30;
1332 doM.7 = 31; doM.8 = 31; doM.9 = 30; doM.10= 31; doM.11= 30; doM.12= 31
1333
1334 parse var StartTime sY'-'sM'-'sD' 'sH':'sMi':'sS
1335 parse var NowTime nY'-'nM'-'nD' 'nH':'nMi':'nS
1336
1337 if nY//4 = 0 & nY//400 <> 0 then doM.2 = 29
1338
1339 /* say doM.2 */
1340
1341 uY =nY-sY
1342 uM =nM-sM
1343 uD =nD-sD
1344 uH =nH-sH
1345 uMi=nMi-sMi
1346 uS =nS-sS
1347
1348
1349
1350 if uS < 0 then do; uMi= uMi- 1; uS = uS + 60; end
1351 if uMi< 0 then do; uH = uH - 1; uMi= uMi+ 60; end
1352 if uH < 0 then do; uD = uD - 1; uH = uH + 24; end
1353 if uD < 0 then do;
1354 /* uM = uM - 1; */
1355 if uM < 0 then uMx = uM + 12; else uMx = uM
1356 uD = uD + doM.uMx - 1;
1357 end
1358 if uM < 0 then do; uY = uY - 1; uM = uM + 12; end
1359
1360 /* say uY uM uD uH uMi uS */
1361
1362 UpTimeStr = ' 'NlvGetMessage(43)':'
1363 if uY <> 0 then UpTimeStr = UpTimeStr' 'uY' 'NlvGetMessage(44)
1364 if uM <> 0 then UpTimeStr = UpTimeStr' 'uM' 'NlvGetMessage(45)
1365 if uD <> 0 then UpTimeStr = UpTimeStr' 'uD' 'NlvGetMessage(46)
1366 if uH <> 0 then UpTimeStr = UpTimeStr' 'uH' 'NlvGetMessage(47)
1367 if uMi<> 0 then UpTimeStr = UpTimeStr' 'uMi' 'NlvGetMessage(48)
1368 if uS <> 0 | UpTimeStr = ' 'NlvGetMessage(43)':' then UpTimeStr = UpTimeStr' 'uS' 'NlvGetMessage(49)
1369
1370 ok = VRset("CN_Daemons", "Caption", UpTimeStr)
1371
1372 call _SambaCheckFreeSpace
1373
1374 IF options.!debug == 1 then say time()' _SambaUptime() done'
1375return
1376
1377/*:VRX _SendMsg
1378*/
1379_SendMsg:
1380 Buttons.1 = NLVGetMessage( 2 )
1381 Buttons.2 = NLVGetMessage( 3 )
1382 Buttons.0 = 2
1383 Message = "Blurp!"
1384 id = VRPrompt( VRWindow(), NLVGetMessage( 85 , CurMachine), "Message", NLVGetMessage( 80 ), "Buttons.", buttons.1, buttons.2 )
1385
1386 MsgFile = SysTempFileName(TempDir'\smbmsg.'??? )
1387 call lineout MsgFile, Message
1388 ok = stream(MsgFile,'c','close')
1389say Message
1390 address cmd samba.!smbclientexe' --message='CurMachine' 'DebugLevel' <'MsgFile' 2>&1>'samba.!msg
1391 /* if rc <> 0 then call _SambaShowError; else */
1392 call _SambaShowMsg
1393 ok = SysFileDelete(MsgFile)
1394return
1395
1396/*:VRX _ShowMsg
1397*/
1398_ShowMsg:
1399 Buttons.1 = NLVGetMessage(2)
1400 Buttons.0 = 1
1401 id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 )
1402return
1403
1404/*:VRX _SmbConfCreateShadowCopy
1405*/
1406_SmbConfCreateShadowCopy:
1407 if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy started'
1408 /* we create a complete version of smb.conf in temporary directory for reading purposes */
1409 /* as we can only determine a default value from this complete version of the file */
1410 /* however it is not desirable to always have a complete copy normally */
1411 ok = SysFileDelete(samba.!shadowsmbconf)
1412 if dataype(log_Level) <> "NUM" then log_level = 2
1413 say ' 'samba.!testparmexe' -v -s -d='log_level' 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
1414 address cmd samba.!testparmexe' -v -s -d='log_level' 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
1415 if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy done'
1416return
1417
1418/*:VRX _UserCredUpdate
1419*/
1420_UserCredUpdate:
1421 if options.!debug == 1 then say time()' _UserCredUpdate started'
1422 credentials.!username = VRGet("EF_USER1","Value")
1423 credentials.!password = VRGet("EF_PASSWORD1","Value")
1424
1425 if pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 1 | pos(left(credentials.!password,1),'01234567890') > 0
1426 then UserCred = '--user='Credentials.!username'%%'Credentials.!password
1427 else UserCred = '--user='Credentials.!username'%'Credentials.!password
1428
1429 if options.!storecreds = 1 & \(UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' | UserCred = '--user=%%' | UserCred = '-N') then do
1430 ok = _ucSetUc()
1431/* ok = VRSet("Pict_PWINMEM","PicturePath","#36") */
1432 if options.!debug == 1 then call beep 2400, 10
1433 end
1434 else do
1435 if options.!debug == 1 then call beep 200, 20
1436/* ok = VRSet("Pict_PWINMEM","PicturePath","#37") */
1437 end
1438 if options.!debug == 1 then say time()' _UserCredUpdate done'
1439return
1440/*:VRX _VIOFontSizeGetCurrent
1441*/
1442_VIOFontSizeGetCurrent: procedure expose VIOFontSizeKey
1443 say '_VIOFontSizeGetCurrent() started'
1444 if VIOFontSizeKey = "" then do
1445 ok = SysIni("USER", "Shield", 'ALL:', 'stem.')
1446 say "SysIni ="ok
1447 say "Shield keys: "stem.0
1448 do I = 1 to stem.0
1449 say I': 'stem.I
1450 Wert = c2x(strip(SysIni("USER", "Shield", stem.I),,'00'x))
1451 say I': 'Wert' ('length(Wert)')'
1452 if length(Wert) = 4 & pos('~',stem.I) > 0 then do
1453 VIOFontSizeKey = stem.I
1454 say "VIOFontSizeKey = "VIOFontSizeKey
1455 leave
1456 end
1457 end
1458 end
1459 else do
1460 Wert = c2x(strip(SysIni("USER", "Shield", VIOFontSizeKey),,'00'x))
1461 end
1462 if VIOFontSizeKey <> "" then FontSize = x2d(right(Wert,2))||'x'||x2d(left(Wert,2))
1463 else FontSize = ""
1464 say '_VIOFontSizeGetCurrent() started, done 'FontSize', 'Wert
1465return FontSize
1466
1467/*:VRX _VIOFontSizeSetCurrent
1468*/
1469_VIOFontSizeSetCurrent: procedure expose VIOFontSizeKey OldFontSize
1470 say '_VIOFontSizeSetCurrent() started'
1471 FontSize = arg(1)
1472 say 'FontSize als arg = 'FontSize
1473 if FontSize = 'OLDFONTSIZE' then FontSize = ''
1474 if VIOFontSizeKey = '' then FontSize = ''
1475
1476 if pos('x',FontSize) > 0 then do
1477 parse var FontSize HH'x'BB
1478say 'HH = 'HH
1479say 'BB = 'BB
1480 Wert = d2c(BB)||d2c(HH)
1481say 'Wert = 'Wert
1482 ok = SysIni("USER","Shield",VIOFontSizeKey, Wert||d2c(0))
1483 end
1484 say '_VIOFontSizeSetCurrent() done, 'FontSize', 'Wert
1485return FontSize
1486
1487/*:VRX About_Close
1488*/
1489About_Close:
1490 call About_Fini
1491return
1492
1493/*:VRX About_Create
1494*/
1495About_Create:
1496 call About_Init
1497 ok = VRSet("About","Caption", NLVGetMessage(20))
1498 ok = VRSet("PB_AboutOK1","Caption", NLVGetMessage(2))
1499 SambaTeam.0 = 11
1500 SambaTeam.1 = 'Silvan Scherrer'
1501 SambaTeam.2 = 'Herwig Bauernfeind'
1502 SambaTeam.3 = 'Dmitrij Kuminov'
1503 SambaTeam.4 = 'Vitali Pelenyov'
1504 SambaTeam.5 = 'Paul Smedley'
1505 SambaTeam.6 = 'Yuri Dario'
1506 SambaTeam.7 = 'Alex Taylor'
1507 SambaTeam.8 = 'Nikolay Kolosov'
1508 SambaTeam.9 = 'All the Samba people'
1509 SambaTeam.10= 'All the ArcaNoae people'
1510 SambaTeam.11= 'All the netlabs people'
1511 ok = VRSet("About","Font", VRGet("SW_SETTINGS","Font"))
1512 ok = VRMethod("LB_SambaTeam","AddStringList", "SambaTeam." )
1513 ok = VRSet("DT_SambaTeam","Caption", NLVGetMessage(21))
1514 ok = VRSet("MLE_Version","Value", NLVGetMessage(1)||'0D0A'x||VRGet("Main", "Hinttext")||'0D0A'x||'0D0A'x||SambaVer)
1515return
1516
1517/*:VRX About_Fini
1518*/
1519About_Fini:
1520 window = VRInfo( "Window" )
1521 call VRDestroy window
1522 drop window
1523return
1524/*:VRX About_Init
1525*/
1526About_Init:
1527 window = VRInfo( "Object" )
1528 if( \VRIsChildOf( window, "Notebook" ) ) then do
1529 call VRMethod window, "CenterWindow"
1530 call VRSet window, "Visible", 1
1531 call VRMethod window, "Activate"
1532 end
1533 drop window
1534return
1535
1536/*:VRX Activate
1537*/
1538Activate:
1539 parse arg Nr
1540 /* call PushbackAll */
1541 CurrentPageNr = Nr
1542 /* ok = VRSet("PB_"Nr,"Font","9.WarpSans Bold") */
1543/* ok = VRSet("TAB_"Nr,"Top", TabTop-8)
1544 ok = VRSet("TAB_"Nr,"Left",TabWidth*(Nr-1)+PageLeft)
1545 ok = VRSet("TAB_"Nr,"PicturePath", "#1"||Nr||";#1"||Nr)
1546 ok = VRset("DT_PageName", "Caption", VRGet("TAB_"Nr, "UserData"))
1547 ok = VRSet("Page_"Nr,"Visible", 1)
1548 select
1549 when Nr = 1 then ok = VRSet("IPB_paper","PicturePath","#4;#4")
1550 when Nr = Pages then ok = VRSet("IPB_paper","PicturePath","#6;#6")
1551 otherwise ok = VRSet("IPB_paper","PicturePath","#5;#5")
1552 end */
1553return
1554
1555/*:VRX CN_CHKTDB_ContextMenu
1556*/
1557CN_CHKTDB_ContextMenu:
1558 if VRInfo("Top") < 400 & VRGet("CN_Files", "View") = "Detail" then call _ColumnsMenu "CN_Files"
1559 else do
1560 RH = VRInfo("Record")
1561 OH = VRInfo("Object")
1562 if RH <> "" then do
1563 ok = VRMethod( "Contextmenu_Files", "Popup", , , "", "PositionOnItem" )
1564 end
1565 end
1566return
1567
1568/*:VRX CN_Daemons_Click
1569*/
1570CN_Daemons_Click:
1571 IF options.!debug == 1 then say time()' CN_Daemons_Click() started'
1572 NowClickedRecord = VRInfo("Record")
1573 say " NowRecord = '"NowClickedRecord"'"
1574 say " LastRecord = '"LastClickedRecord"'"
1575 if NowClickedRecord <> LastClickedRecord then call _RefreshDaemonsDelay
1576 LastClickedRecord = NowClickedRecord
1577 IF options.!debug == 1 then say time()' CN_Daemons_Click() done'
1578return
1579
1580/*:VRX CN_Daemons_ContextMenu
1581*/
1582CN_Daemons_ContextMenu:
1583 IF options.!debug == 1 THEN SAY time()' CN_Daemons_ContextMenu() started'
1584 if VRInfo("Top") < 400 & VRGet("CN_Daemons", "View") = "Detail" then do
1585 say " Going for column modification..."
1586 call _ColumnsMenu "CN_Daemons"
1587 end
1588 else do
1589 say " Going for context menu, record = '"VRInfo("Record")"'"
1590
1591 call _RefreshDaemonsDelay
1592 DRH = VRInfo("Record")
1593 DaemonName = ""
1594
1595 OH = VRInfo("Object")
1596 ok = VRset("ContextMenu_Daemons_Details", "Visible", 1 )
1597 ok = VRset("ContextMenu_Daemons_Tree", "Visible", 1 )
1598 ok = VRset("MItem_9", "Visible", 1 )
1599 ok = VRset("ContextMenu_Daemons_Sort", "Visible", 1 )
1600 ok = VRset("ContextMenu_Daemons_MiniIcons", "Visible", 1 )
1601 ok = VRset("MItem_13", "Visible", 1 )
1602 ok = VRset("ContextMenu_Daemons_Ping", "Visible", 1 )
1603 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 1 )
1604 ok = VRset("ContextMenu_Daemons_Start", "Visible", 1 )
1605 ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 1 )
1606
1607 if DRH <> "" then do
1608 DaemonName = VRMethod("CN_Daemons", "GetRecordAttr", DRH, "Caption")
1609 ok = VRset("ContextMenu_Daemons_Ping","Visible", 1 )
1610 end
1611
1612 select
1613 when Words(DaemonName) = 3 & pos("PID ",DaemonName) > 0 then do /* a child process with PID in name */
1614 DaemonName = word(DaemonName,2)
1615 ok = VRSet("ContextMenu_Daemons_KillPID", "Caption", NLVGetMessage( 38, DaemonName))
1616 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1617 end
1618 when Words(DaemonName) = 1 & (pos("mbd.exe",Daemonname) > 0 | pos("winbindd.exe",Daemonname) > 0) then do /* on root process */
1619 parse var DaemonName DaemonName'.exe'
1620 if strip(VRMethod("CN_Daemons", "GetFieldData", DRH, DPidsFH)) <> "" then do
1621 ok = VRSet("ContextMenu_Daemons_Shutdown", "Caption", NLVGetMessage( 33, DaemonName))
1622 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 )
1623 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1624 end
1625 end
1626 when pos("\", DaemonName) > 0 then do /* we are on a file */
1627 ok = VRset("MItem_13", "Visible", 0 )
1628 ok = VRset("ContextMenu_Daemons_Ping", "Visible", 0 )
1629 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 )
1630 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1631 ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 0 )
1632 end
1633 otherwise do /* we are on a user */
1634 ok = VRset("MItem_13", "Visible", 0 )
1635 ok = VRset("ContextMenu_Daemons_Ping", "Visible", 0 )
1636 ok = VRset("ContextMenu_Daemons_KillPID", "Visible", 0 )
1637 ok = VRset("ContextMenu_Daemons_Start", "Visible", 0 )
1638 ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 0 )
1639 end
1640 end
1641 say ' Daemon is "'DaemonName'"'
1642 say ' DaemonView = "'DaemonView'"'
1643 if VRGet("CN_Daemons","View") = "Detail" then do
1644 ok = VRSet("ContextMenu_Daemons_Details", "Enabled", 0)
1645 ok = VRSet("ContextMenu_Daemons_Tree", "Enabled", 1)
1646 end
1647 else do
1648 ok = VRSet("ContextMenu_Daemons_Details", "Enabled", 1)
1649 ok = VRSet("ContextMenu_Daemons_Tree", "Enabled", 0)
1650 end
1651 DaemonView = VRGet("CN_Daemons","View")
1652
1653 ok = VRMethod( "ContextMenu_Daemons", "Popup", , , "", "" )
1654 end
1655 IF options.!debug == 1 THEN SAY time()' CN_Daemons_ContextMenu() done'
1656return
1657
1658/*:VRX CN_Files_ContextMenu
1659*/
1660CN_Files_ContextMenu:
1661 if VRInfo("Top") < 400 & VRGet("CN_Files", "View") = "Detail" then call _ColumnsMenu "CN_Files"
1662 else do
1663 RH = VRInfo("Record")
1664 OH = VRInfo("Object")
1665 if RH <> "" then do
1666 ok = VRMethod( "Contextmenu_Files", "Popup", , , "", "PositionOnItem" )
1667 end
1668 end
1669return
1670
1671/*:VRX CN_Service_ContextMenu
1672*/
1673CN_Service_ContextMenu:
1674 if VRInfo("Top") < 400 & VRGet("CN_Service", "View") = "Detail" then call _ColumnsMenu "CN_Service"
1675 else do
1676 ok = VRSet("TM_refresh","Enabled", 0)
1677 SRH = VRInfo("Record")
1678 OH = VRInfo("Object")
1679 if SRH <> "" then do
1680 Service = VRMethod("CN_Service", "GetFieldData", SRH, ServiceFH)
1681 say ' Service is "'Service'"'
1682 ok = VRMethod( "ContextMenu_Service", "Popup", , , "", "" )
1683 end
1684 end
1685return
1686
1687/*:VRX CN_SMBTREE_Click
1688*/
1689CN_SMBTREE_Click:
1690 rh = VRInfo('Record')
1691 if VRMethod( 'CN_SMBTREE', "ValidateRecord", rh) <> 1 then return
1692 userdata = VRMethod('CN_SMBTREE', 'GetRecordAttr', rh, 'UserData')
1693 parse var userdata . '|' userdata
1694 ok = VRset("Main","StatusText", userdata)
1695
1696
1697return
1698
1699/*:VRX CN_SMBTREE_ContextMenu
1700*/
1701CN_SMBTREE_ContextMenu:
1702 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu started'
1703 if VRInfo("Top") < 400 & VRGet("CN_SMBTREE", "View") = "Detail" then call _ColumnsMenu "CN_SMBTREE"
1704 else do
1705 call _dropdeprecated
1706 RH = VRInfo("Record")
1707 if RH <> "" then do
1708 call _GetSmbObjectProperties RH
1709 call _ContextMenuSelectedSet
1710 if SMBobj.udatatype <> "WORKGROUP" then do
1711 BrowsePath = _browsebuildpath(SMBObj.rh)
1712 parse var browsepath '\\'machine'\'sharename '\' browsepath
1713 end
1714
1715 /* call _BrowseResetObject(SmbObj.rh) */
1716
1717 CurMachine = SMBObj.Resname
1718 ok = VRMethod( "Contextmenu_Tree", "Popup", , , "", "PositionOnItem" )
1719 end
1720 else do
1721 say "nix '"RH"'"
1722 drop SMBObj. /* it is invalid */
1723 call _ContextMenuSelectedSet
1724 end
1725 end
1726 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu done'
1727return
1728
1729/*:VRX CN_SMBTREE_DoubleClick
1730*/
1731CN_SMBTREE_DoubleClick:
1732 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick started'
1733
1734 call _dropdeprecated
1735 call _GetSmbObjectProperties VRInfo('Record')
1736
1737/* if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
1738return */
1739 /* Enable last 2 lines for 2.0.x (to disable on the fly browsing) */
1740
1741 if options.!debug == 1 then say ' Browsing "'SMBObj.udatatype'"'
1742
1743 If SMBObj.udatatype = "DIRECTORY" then do
1744 BrowsePath = _browsebuildpath(SMBObj.rh)
1745
1746 call _BrowseResetObject(SmbObj.rh)
1747
1748 parse var browsepath '\\'machine'\'sharename '\' browsepath
1749 browsepath = browsepath'\*'
1750
1751 call _BrowseDirectory
1752 end
1753
1754 If SMBObj.udatatype = "FILE" then do
1755 BrowsePath = _browsebuildpath(SMBObj.rh)
1756 call _BrowseResetObject(SmbObj.rh)
1757
1758 parse var browsepath '\\'machine'\'sharename '\' browsepath
1759
1760 OpenOk = _browseobjectopen(machine,sharename,browsepath)
1761
1762 if \OpenOK then do
1763 say " Not connected - trying to connect"
1764 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", sharerh, "Selected", 1)
1765 OpenOk = 0
1766 if VRIsValidObject("PB_SMBTREE_CONNECT") then do
1767 call PB_SMBTREE_CONNECT_Click
1768 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Selected", 1)
1769 OpenOk = _browseobjectopen(machine,sharename,browsepath)
1770 end
1771 if \OpenOk then do /* We cannot browse file content in smbmon (we are not a client) */
1772 /* Instead we open the ACLS Browser */
1773 call ContextMenu_Tree_ACLS_Click
1774 end
1775 end
1776 end
1777
1778 if SMBObj.udatatype = "DISK" then do
1779 machine = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
1780 parse var machine machine '0D0A'x .
1781 machine = strip(machine)
1782
1783 call _BrowseResetObject(SmbObj.rh)
1784
1785 sharename = SMBObj.resname
1786 BrowsePath = ""
1787
1788 call _BrowseDirectory
1789 end
1790 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
1791return
1792/*:VRX CN_Users_ContextMenu
1793*/
1794CN_Users_ContextMenu:
1795 if VRInfo("Top") < 400 & VRGet("CN_users", "View") = "Detail" then call _ColumnsMenu "CN_users"
1796 else do
1797 RH = VRInfo("Record")
1798 OH = VRInfo("Object")
1799 if RH <> "" then do
1800 CurMachine = VRMethod( "CN_users", "GetFieldData", RH, UMachineFH )
1801 ok = VRMethod( "Contextmenu_Users", "Popup", , , "", "PositionOnItem" )
1802 end
1803 end
1804return
1805
1806/*:VRX Columns_01_Click
1807*/
1808Columns_01_Click:
1809 call _ColumnShow
1810return
1811
1812/*:VRX Columns_02_Click
1813*/
1814Columns_02_Click:
1815 call _ColumnShow
1816return
1817
1818/*:VRX Columns_03_Click
1819*/
1820Columns_03_Click:
1821 call _ColumnShow
1822return
1823
1824/*:VRX Columns_04_Click
1825*/
1826Columns_04_Click:
1827 call _ColumnShow
1828return
1829
1830/*:VRX Columns_05_Click
1831*/
1832Columns_05_Click:
1833 call _ColumnShow
1834return
1835
1836/*:VRX Columns_06_Click
1837*/
1838Columns_06_Click:
1839 call _ColumnShow
1840return
1841
1842/*:VRX Columns_07_Click
1843*/
1844Columns_07_Click:
1845 call _ColumnShow
1846return
1847
1848/*:VRX Columns_08_Click
1849*/
1850Columns_08_Click:
1851 call _ColumnShow
1852return
1853
1854/*:VRX Columns_09_Click
1855*/
1856Columns_09_Click:
1857 call _ColumnShow
1858return
1859
1860/*:VRX Columns_10_Click
1861*/
1862Columns_10_Click:
1863 call _ColumnShow
1864return
1865
1866/*:VRX Columns_11_Click
1867*/
1868Columns_11_Click:
1869 call _ColumnShow
1870return
1871
1872/*:VRX Columns_12_Click
1873*/
1874Columns_12_Click:
1875 call _ColumnShow
1876return
1877
1878/*:VRX Columns_13_Click
1879*/
1880Columns_13_Click:
1881 call _ColumnShow
1882return
1883
1884/*:VRX Columns_14_Click
1885*/
1886Columns_14_Click:
1887 call _ColumnShow
1888return
1889
1890/*:VRX ContextMenu_Daemons_Details_Click
1891*/
1892ContextMenu_Daemons_Details_Click:
1893 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() started'
1894 ok = VRset("CN_Daemons","View","Detail")
1895 ok = VRset("ContextMenu_Daemons_Tree","Enabled",1)
1896 ok = VRset("ContextMenu_Daemons_Details","Enabled",0)
1897 ok = VRSet("TM_refresh","Enabled", 1)
1898 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() done'
1899return
1900
1901/*:VRX ContextMenu_Daemons_KillPID_Click
1902*/
1903ContextMenu_Daemons_KillPID_Click:
1904 Msg.Text = NLVGetMessage(39, DaemonName)
1905 Msg.Type = 'Q'
1906 if _MsgYesNo() = 1 then do
1907 ok = PRKillProcess("1",DaemonName )
1908 if ok = 0 then say ", success!"; else say ", error "ok
1909
1910/* say 'kill -9 'DaemonName
1911 address cmd 'kill -9 'DaemonName */
1912 end
1913 ok = VRSet("TM_Refresh","Enabled", 1)
1914return
1915
1916/*:VRX ContextMenu_Daemons_MiniIcons_Click
1917*/
1918ContextMenu_Daemons_MiniIcons_Click:
1919 advanced.!bigicons = \advanced.!bigicons
1920 ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons)
1921 ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
1922 ok = VRset("ContextMenu_Tree_MiniIcons", "Checked", \advanced.!bigicons)
1923 ok = VRset("ContextMenu_Daemons_MiniIcons","Checked", \advanced.!bigicons)
1924return
1925
1926/*:VRX ContextMenu_Daemons_Ping_Click
1927*/
1928ContextMenu_Daemons_Ping_Click:
1929 ok = VRSet("Main", 'Pointer', 'Wait' )
1930 address cmd samba.!smbcontrolexe' 'DaemonName' ping --timeout=3 --debuglevel=0 2>'samba.!error' 1>'samba.!msg
1931 call _SambaShowMsg "section table registered"
1932
1933 ok = VRSet("Main", 'Pointer', '<default>' )
1934 ok = VRSet("TM_refresh","Enabled", 1)
1935return
1936
1937/*:VRX ContextMenu_Daemons_Shutdown_Click
1938*/
1939ContextMenu_Daemons_Shutdown_Click:
1940 Msg.Text = NLVGetMessage(34, DaemonName)
1941 Msg.Type = 'Q'
1942 if _MsgYesNo() = 1 then do
1943 address cmd samba.!smbcontrolexe' 'DaemonName' shutdown 2>'samba.!error' 1>'samba.!msg
1944 call _SambaShowMsg "section table registered tdb"
1945 end
1946 ok = VRSet("TM_Refresh","Enabled", 1)
1947return
1948
1949/*:VRX ContextMenu_Daemons_Sort_Click
1950*/
1951ContextMenu_Daemons_Sort_Click:
1952 window = VRLoadSecondary( "SW_SORT", "W" )
1953return
1954
1955/*:VRX ContextMenu_Daemons_Start_Click
1956*/
1957ContextMenu_Daemons_Start_Click:
1958 Msg.Text = NLVGetMessage(37, DaemonName)
1959 Msg.Type = 'Q'
1960 if _MsgYesNo() = 1 then do
1961 say samba.!smbcmd' start 'DaemonName
1962 address cmd samba.!smbcmd' start 'DaemonName
1963 end
1964 ok = VRSet("TM_Refresh","Enabled", 1)
1965return
1966
1967/*:VRX ContextMenu_Daemons_Tree_Click
1968*/
1969ContextMenu_Daemons_Tree_Click:
1970 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() started'
1971 ok = VRset("CN_Daemons","View","IconTree")
1972 ok = VRset("ContextMenu_Daemons_Tree","Enabled",0)
1973 ok = VRset("ContextMenu_Daemons_Details","Enabled",1)
1974 ok = VRSet("TM_refresh","Enabled", 1)
1975 IF options.!debug == 1 THEN SAY time()' ContextMenu_Daemons_Tree_Click() done'
1976return
1977
1978/*:VRX ContextMenu_Files_Sort_Click
1979*/
1980ContextMenu_Files_Sort_Click:
1981 window = VRLoadSecondary( "SW_SORT", "W" )
1982return
1983
1984/*:VRX ContextMenu_Service_CloseShare_Click
1985*/
1986ContextMenu_Service_CloseShare_Click:
1987 Msg.Text = NLVGetMessage(75, Service)
1988 Msg.Type = 'Q'
1989 if _MsgYesNo() = 1 then do
1990 address cmd samba.!smbcontrolexe' smbd close-share 'Service' --debuglevel=0' /* ' 2>'samba.!error' 1>'samba.!msg */
1991 /* No usable output from Samba here ! */
1992 /* call _SambaShowMsg */
1993 Msg.Text = NLVGetMessage(76, Service)
1994 Msg.Type = 'I'
1995 call _ShowMsg
1996 end
1997 ok = VRSet("TM_refresh","Enabled", 1)
1998return
1999
2000/*:VRX ContextMenu_Service_Sort_Click
2001*/
2002ContextMenu_Service_Sort_Click:
2003 window = VRLoadSecondary( "SW_SORT", "W" )
2004return
2005
2006/*:VRX ContextMenu_Tree_ACLS_Click
2007*/
2008ContextMenu_Tree_ACLS_Click:
2009 if options.!debug == 1 then say ' List ACLS for "'SMBObj.udatatype'"'
2010 window = VRLoadSecondary( "SW_ACLS", "W" )
2011return
2012
2013/*:VRX ContextMenu_Tree_Details_Click
2014*/
2015ContextMenu_Tree_Details_Click:
2016 ok = VRset("CN_SMBTREE","View","Detail")
2017 ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
2018 ok = VRset("ContextMenu_Tree_Details","Enabled",0)
2019 ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
2020 ok = VRset("TM_Throbber", "Enabled", 1)
2021 ok = VRset("Pict_Throbber", "Visible", 0)
2022 call _RefreshTree
2023return
2024
2025/*:VRX ContextMenu_Tree_Icons_Click
2026*/
2027ContextMenu_Tree_Icons_Click:
2028 ok = VRset("CN_SMBTREE","View","Icon")
2029 ok = VRset("ContextMenu_Tree_Icons","Enabled",0)
2030 ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
2031 ok = VRset("ContextMenu_Tree_Details","Enabled",1)
2032 ok = VRset("TM_Throbber", "Enabled", 1)
2033 ok = VRset("Pict_Throbber", "Visible", 1)
2034 call _RefreshTree
2035return
2036
2037/*:VRX ContextMenu_Tree_LOGIN_Click
2038*/
2039ContextMenu_Tree_LOGIN_Click:
2040 window = VRLoadSecondary( "SW_LOGIN", "W" )
2041
2042 /* call _UserCredUpdate */
2043
2044return
2045
2046/*:VRX ContextMenu_Tree_LOGOFF_Click
2047*/
2048ContextMenu_Tree_LOGOFF_Click:
2049 UserCred = '-N'
2050return
2051
2052/*:VRX ContextMenu_Tree_MiniIcons_Click
2053*/
2054ContextMenu_Tree_MiniIcons_Click:
2055 advanced.!bigicons = \advanced.!bigicons
2056 ok = VRset("CN_DAEMONS", "MiniIcons", \advanced.!bigicons)
2057 ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
2058 ok = VRset("ContextMenu_Tree_MiniIcons", "Checked", \advanced.!bigicons)
2059 ok = VRset("ContextMenu_Daemons_MiniIcons","Checked", \advanced.!bigicons)
2060return
2061
2062/*:VRX ContextMenu_Tree_SendMsg_Click
2063*/
2064ContextMenu_Tree_SendMsg_Click:
2065 call _SendMsg
2066return
2067
2068/*:VRX ContextMenu_Tree_Sort_Click
2069*/
2070ContextMenu_Tree_Sort_Click:
2071 window = VRLoadSecondary( "SW_SORT", "W" )
2072return
2073
2074/*:VRX ContextMenu_Tree_Tree_Click
2075*/
2076ContextMenu_Tree_Tree_Click:
2077 ok = VRset("CN_SMBTREE","View","IconTree")
2078 ok = VRset("ContextMenu_Tree_Tree","Enabled",0)
2079 ok = VRset("ContextMenu_Tree_Details","Enabled",1)
2080 ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
2081 ok = VRset("TM_Throbber", "Enabled", 1)
2082 ok = VRset("Pict_Throbber", "Visible", 1)
2083 call _RefreshTree
2084return
2085
2086/*:VRX ContextMenu_Users_SendMsg_Click
2087*/
2088ContextMenu_Users_SendMsg_Click:
2089 call _SendMsg
2090return
2091
2092/*:VRX ContextMenu_Users_Sort_Click
2093*/
2094ContextMenu_Users_Sort_Click:
2095 window = VRLoadSecondary( "SW_SORT", "W" )
2096return
2097
2098/*:VRX DT_STATUSBAR_ContextMenu
2099*/
2100DT_STATUSBAR_ContextMenu:
2101 ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
2102return
2103
2104/*:VRX EF_log_file_Change
2105*/
2106EF_log_file_Change:
2107 advanced.!smbconfchanged = 1
2108return
2109
2110/*:VRX Fini
2111*/
2112Fini:
2113 window = VRWindow()
2114 call VRSet window, "Visible", 0
2115 drop window
2116return 0
2117
2118/*:VRX GetBootDrive
2119*/
2120GetBootDrive:
2121/* Use SysBootDrive if possible */
2122If Rxfuncadd('SysBootDrive', 'RexxUtil', 'SysBootDrive') Then
2123 Return Left(Value('RUNWORKPLACE',,'OS2ENVIRONMENT'),2)
2124Else
2125 Return SysBootDrive()
2126
2127
2128/*:VRX Halt
2129*/
2130Halt:
2131 signal _VREHalt
2132return
2133
2134/*:VRX ICB_ABOUT_Click
2135*/
2136ICB_ABOUT_Click:
2137 window = VRLoadSecondary( "About", "W" )
2138return
2139
2140/*:VRX ICB_ACLS_OK_Click
2141*/
2142ICB_ACLS_OK_Click:
2143 call SW_ACLS_close
2144return
2145
2146/*:VRX ICB_APPLY_Click
2147*/
2148ICB_APPLY_Click:
2149 IF options.!debug == 1 then say time()' PB_Apply_Click() started'
2150 options.!Debug = VRGet("CB_Debug","set")
2151 if options.!Debug then ok = VRREdirectStdIO("ON")
2152 else ok = VRREdirectStdIO("OFF")
2153 Intervall = VRGet("SPIN_Intervall","Value")
2154 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
2155 IntervallMin = VRGet("SPIN_IntervallMin","Value")
2156
2157 NoMsgBox = VRGet("CB_NoMsgBox","set")
2158 say 'NoMsgBox = "'NoMsgBox'"'
2159
2160 WPSStartStop = VRGet("CB_WPSStartStop","set")
2161 say 'WPSStartStop = "'WPSStartStop'"'
2162
2163 DetectZombies = VRGet("CB_DetectZombies","set")
2164 say 'DetectZombies = "'DetectZombies'"'
2165
2166 VIOFontsize = VRGet("SPIN_FONTSIZE","Value")
2167 say "VIOFontsize = "VIOFontsize
2168
2169 options.!storecreds = VRGet("CB_STORECREDS","Set")
2170 say "options.!storecreds = "options.!storecreds
2171
2172 if advanced.!smbconfchanged = 1 then do
2173 log_level = VRGet("SPIN_log_level","Value")
2174 log_file = VRGet("EF_log_file","Value")
2175 max_protocol = VRGet("SPIN_max_protocol","Value")
2176 max_log_size = VRGet("SPIN_max_log_size","Value")
2177
2178 handle = IniOpen('global', samba.!smbconf)
2179
2180 ok = IniSet('log level', log_level, handle)
2181 ok = IniSet('log file', log_file, handle)
2182 ok = IniSet('max log size', max_log_size, handle)
2183 ok = IniSet('max protocol', max_protocol, handle)
2184
2185 ok = IniSave(handle)
2186 ok = IniClose(handle)
2187 advanced.!smbconfchanged = 0
2188 end
2189 IF options.!debug == 1 then say time()' PB_Apply_Click() done'
2190return
2191
2192/*:VRX ICB_CHOOSE_Click
2193*/
2194ICB_CHOOSE_Click:
2195 FileName = VRFileDialog( VRWindow(), "Choose location for log files", "Open", VRGet("EF_LOG_FILE","Value"))
2196 if Filename <> "" then ok = VRSet("EF_LOG_FILE","Value", FIleName)
2197 drop Filename
2198return
2199
2200/*:VRX ICB_DELLOGS_Click
2201*/
2202ICB_DELLOGS_Click:
2203 call VRSet VRWindow(), 'Pointer', 'Wait'
2204
2205 call _SambaCheckFreeSpace
2206
2207 ok = SysFileTree(samba.!logdir'\log.*', logs.,'FO')
2208 do I = 1 to logs.0
2209 ok = VRMethod( "CN_Daemons", "GetRecordList", "All", "handle." )
2210 KeepLog = 0
2211 do J = 1 to handle.0
2212 CurPID = VRMethod("CN_Daemons", "GetFieldData", handle.J, DPidsFH)
2213 if pos(CurPID,logs.I) > 0 then KeepLog = 1
2214 end
2215 if KeepLog = 0 then do
2216 say "Delete "logs.I
2217 ok = SysFileDelete(logs.I)
2218 end
2219 end
2220
2221 call _SambaCheckFreeSpace
2222
2223 call VRSet VRWindow(), 'Pointer', '<default>'
2224return
2225
2226/*:VRX ICB_EXIT_Click
2227*/
2228ICB_EXIT_Click:
2229 say 'start ICB_EXIT_Click'
2230 Call Quit
2231 say 'done ICB_EXIT_Click'
2232return
2233
2234/*:VRX ICB_LOGIN_CANCEL_Click
2235*/
2236ICB_LOGIN_CANCEL_Click:
2237/* ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
2238 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value")) */
2239 options.!storecreds = VRGet("CB_STORECREDS1","Set")
2240 credentials.!entered = 1
2241 p_server = SMBObj.resname
2242 if p_server <> "" then do
2243 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
2244
2245 if word(ok,1) = "1" then do
2246 call _StatusBarWrapper NLVGetMessage(107, rpc.queryuser.FULL_NAME)
2247 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
2248 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
2249 call _UserCredUpdate
2250 end
2251 else do
2252 call _StatusBarWrapper VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS
2253 end
2254 end
2255
2256 call SW_LOGIN_Close
2257return
2258
2259/*:VRX ICB_LOGIN_OK_Click
2260*/
2261ICB_LOGIN_OK_Click:
2262/* ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
2263 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value")) */
2264 options.!storecreds = VRGet("CB_STORECREDS1","Set")
2265 credentials.!entered = 1
2266 p_server = SMBObj.resname
2267 if p_server <> "" then do
2268 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
2269
2270 if word(ok,1) = "1" then do
2271 call _StatusBarReset
2272 call _StatusBarWrapper NLVGetMessage(15)' "'VRGet("EF_USER1","Value")'" 'rpc.queryuser.LOGONSTATUS
2273 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
2274 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
2275 call _UserCredUpdate
2276 Usercontext = VRGet("CN_SMBTREE","Caption")
2277 parse var Usercontext Usercontext':'.
2278 Usercontext = Usercontext': 'VRGet("EF_USER1","Value")
2279 ok = VRSet("CN_SMBTREE","Caption",Usercontext)
2280 end
2281 else do
2282 call _StatusBarWrapper VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS
2283 end
2284 end
2285
2286 call SW_LOGIN_Close
2287return
2288
2289/*:VRX ICB_REFRESH_Click
2290*/
2291ICB_REFRESH_Click:
2292 IF options.!debug == 1 then say time()' ICB_REFRESH_Click() started'
2293 ok = SysSleep(0.3)
2294
2295 say " CurrentPageNr = "CurrentPageNr
2296 select
2297 when CurrentPageNr = 2 then do
2298 ok = VRset("Pict_Throbber", "Visible", 1)
2299 ok = VRset("TM_Throbber", "Enabled", 1)
2300 call _RefreshTree
2301 end
2302 when CurrentPageNr = 6 then do
2303 call _ChkTDB
2304 end
2305 otherwise call _Refresh
2306 end
2307 IF options.!debug == 1 then say time()' ICB_REFRESH_Click() done'
2308return
2309
2310/*:VRX ICB_RELOAD_Click
2311*/
2312ICB_RELOAD_Click:
2313 call VRSet VRWindow(), 'Pointer', 'Wait'
2314 OldFontSize = _VIOFontSizeGetCurrent()
2315 say 'OldFontSize = 'OldFontSize
2316 if OldFontSize <> VIOFontSize then ok = _VIOFontSizeSetCurrent(VIOFontSize)
2317
2318 if WPSStartStop then do
2319 ok = SysOpenObject('<smb_reload>', 'DEFAULT', 1)
2320 end
2321 else do
2322 call lineout samba.!bin"\smbstart", "reload"
2323 ok = stream(samba.!bin"\reload","c","close")
2324 end
2325 ok = VRSet("TM_Refresh","Delay", 2000)
2326 call VRSet VRWindow(), 'Pointer', '<default>'
2327return
2328
2329/*:VRX ICB_RESTART_Click
2330*/
2331ICB_RESTART_Click:
2332 call VRSet VRWindow(), 'Pointer', 'Wait'
2333 OldFontSize = _VIOFontSizeGetCurrent()
2334 say 'OldFontSize = 'OldFontSize
2335 if OldFontSize <> VIOFontSize then ok = _VIOFontSizeSetCurrent(VIOFontSize)
2336
2337 if WPSStartStop then do
2338 ok = SysOpenObject('<smb_restart>', 'DEFAULT', 1)
2339 end
2340 else do
2341 call lineout samba.!bin"\restart", "restart"
2342 ok = stream(samba.!bin"\restart","c","close")
2343 end
2344 ok = VRSet("TM_Refresh","Delay", 2000)
2345 call VRSet VRWindow(), 'Pointer', '<default>'
2346return
2347
2348/*:VRX ICB_START_Click
2349*/
2350ICB_START_Click:
2351 say "IPB_Start_Click started"
2352 call VRSet VRWindow(), 'Pointer', 'Wait'
2353 OldFontSize = _VIOFontSizeGetCurrent()
2354 say 'OldFontSize = 'OldFontSize
2355 if OldFontSize <> VIOFontSize then ok = _VIOFontSizeSetCurrent(VIOFontSize)
2356 if WPSStartStop then do
2357 ok = SysOpenObject('<smb_start>', 'DEFAULT', 1)
2358 end
2359 else do
2360 call lineout samba.!bin"\smbstart", "smbstart"
2361 ok = stream(samba.!bin"\smbstart","c","close")
2362 end
2363 ok = VRSet("TM_Refresh","Delay", 2000)
2364 call VRSet VRWindow(), 'Pointer', '<default>'
2365 say "IPB_Start_Click done"
2366return
2367
2368/*:VRX ICB_STOP_Click
2369*/
2370ICB_STOP_Click:
2371 say "IPB_Stop_Click started"
2372 call VRSet VRWindow(), 'Pointer', 'Wait'
2373 OldFontSize = _VIOFontSizeGetCurrent()
2374 say 'OldFontSize = 'OldFontSize
2375 if OldFontSize <> VIOFontSize then ok = _VIOFontSizeSetCurrent(VIOFontSize)
2376
2377 if WPSStartStop then do
2378 ok = SysOpenObject('<smb_stop>', 'DEFAULT', 1)
2379 end
2380 else do
2381 call lineout samba.!bin"\smbstop", "smbstop"
2382 ok = stream(samba.!bin"\smbstop","c","close")
2383 end
2384 ok = VRSet("TM_Refresh","Delay", 2000)
2385 call VRSet VRWindow(), 'Pointer', '<default>'
2386 say "IPB_Stop_Click done"
2387return
2388
2389/*:VRX Init
2390*/
2391Init:
2392window = VRWindow()
2393call VRMethod window, "CenterWindow"
2394call VRSet window, "Visible", 0
2395call VRMethod window, "Activate"
2396drop window
2397return
2398
2399/*:VRX LB_SortFields_Click
2400*/
2401LB_SortFields_Click:
2402 call _ContainerSort
2403return
2404
2405/*:VRX Main_Activate
2406*/
2407Main_Activate:
2408 call TM_Refresh_Trigger
2409 ok = VRset("TM_Refresh", "Enabled", 1)
2410return
2411
2412/*:VRX Main_Close
2413*/
2414Main_Close:
2415 call Quit
2416return
2417
2418/*:VRX Main_Create
2419*/
2420Main_Create:
2421 options.!debug = 0
2422 if options.!debug == 1 then do
2423 ok = VRRedirectStdIO("ON")
2424 say time()' Main_Create started'
2425 end
2426 else ok = VRRedirectStdIO("OFF")
2427
2428 call _LoadOtherFuncs
2429 call _InitTempDir
2430
2431 call _IniRead
2432 call _NLVSetup
2433
2434 call _SambaInit
2435 if \WPSStartStop then call _CreateSmbStarter
2436 if _SambaRunning() then call _SambaFindPIDfile
2437 call _ContainerInit
2438 call _GUIInit
2439
2440 ok = VRMethod("ICB_Refresh","SetFocus")
2441
2442 if options.!debug == 1 then say time()' Main_Create done'
2443return
2444/*:VRX Main_Deactivate
2445*/
2446Main_Deactivate:
2447 ok = VRset("TM_Refresh", "Enabled", 0)
2448return
2449
2450/*:VRX Main_Resize
2451*/
2452Main_Resize:
2453 IF options.!debug == 1 THEN SAY time()' Main_Resize started'
2454 if TrashedSize = 1 then do
2455 IF options.!debug == 1 THEN SAY time()' Main_Resize aborted, already in progress'
2456 end
2457 ok = VRSet("Main","Painting", 0)
2458
2459 /* Basic measurements */
2460 main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */
2461 main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */
2462
2463 /* if main_iheight < 5500 then ok = VRSet("Main","Height",6200) */
2464 sbar_height = margin * 8 /* Height of status-bar */
2465 marginx2 = margin * 2 /* Common margin around controls */
2466 marginx4 = margin * 4
2467
2468 pbtn_width = 1200
2469 pbtn_dist = 80 + pbtn_width
2470 pbtn_nr = 4
2471 pbtn_pos = max((main_iwidth - pbtn_Dist * pbtn_Nr)%2, 0)+ margin
2472 pbtn_height = 460 /* Height of the panels' internal button areas */
2473
2474
2475 pane_height = main_iheight- sbar_height - pbtn_height - margin * 7 /* Height of notebook */
2476 pane_width = main_iwidth - marginx2 /* Width of the notebook panel */
2477
2478 /* Tabbed Dialog */
2479 ok = VRset("TDL_1", "Top", marginx2 )
2480 ok = VRset("TDL_1", "Left", margin )
2481 ok = VRset("TDL_1", "Width", pane_width )
2482 ok = VRset("TDL_1", "Height", pane_height )
2483
2484 /* Statusbar */
2485 ok = VRSet("GB_STATUSBAR", "Left", margin )
2486 ok = VRSet("GB_STATUSBAR", "Top", main_iheight - sbar_height - margin )
2487 ok = VRSet("GB_STATUSBAR", "Height",sbar_height )
2488 ok = VRSet("GB_STATUSBAR", "Width", pane_width )
2489
2490 ok = VRSet("DT_STATUSBAR", "Top", 12 )
2491 ok = VRSet("DT_STATUSBAR", "Left", 12 )
2492 ok = VRSet("DT_STATUSBAR", "Height",sbar_height- 24)
2493 ok = VRSet("DT_STATUSBAR", "Width", pane_width - 24)
2494
2495 ok = VRSet("ICB_REFRESH","top", pane_height + marginx4 )
2496 ok = VRSet("ICB_EXIT", "top", pane_height + marginx4 )
2497 ok = VRSet("ICB_Apply", "top", pane_height + marginx4 )
2498 ok = VRSet("ICB_About", "top", pane_height + marginx4 )
2499
2500 ok = VRSet("ICB_REFRESH","Width", pbtn_width )
2501 ok = VRSet("ICB_EXIT", "Width", pbtn_width )
2502 ok = VRSet("ICB_Apply", "Width", pbtn_width )
2503 ok = VRSet("ICB_About", "Width", pbtn_width )
2504
2505 ok = VRSet("ICB_REFRESH","Height", pbtn_Height )
2506 ok = VRSet("ICB_EXIT", "Height", pbtn_Height )
2507 ok = VRSet("ICB_Apply", "Height", pbtn_Height )
2508 ok = VRSet("ICB_About", "Height", pbtn_Height )
2509
2510
2511 ok = VRSet("ICB_REFRESH","left",pbtn_pos + pbtn_dist * (pbtn_nr - 4))
2512 ok = VRSet("ICB_Apply", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 3))
2513 ok = VRSet("ICB_About", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 2))
2514 ok = VRSet("ICB_EXIT", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 1))
2515
2516 ok = VRset("GB_CHKTDB","Top", margin )
2517 ok = VRset("GB_CHKTDB","Left", marginx2)
2518 ok = VRset("GB_CHKTDB","Width", pane_width - 760)
2519 ok = VRset("GB_CHKTDB","Height", pane_height- 1020)
2520 ok = VRset("CN_CHKTDB","Top", margin)
2521 ok = VRset("CN_CHKTDB","Left", margin)
2522 ok = VRset("CN_CHKTDB","Width", pane_width - 760 - marginx2 )
2523 ok = VRset("CN_CHKTDB","Height", pane_height- 1020- marginx2 )
2524
2525 ok = VRset("GB_USERS","Top", margin )
2526 ok = VRset("GB_USERS","Left", marginx2)
2527 ok = VRset("GB_USERS","Width", pane_width - 760)
2528 ok = VRset("GB_USERS","Height", pane_height- 1020)
2529 ok = VRset("CN_USERS","Top", margin)
2530 ok = VRset("CN_USERS","Left", margin)
2531 ok = VRset("CN_USERS","Width", pane_width - 760 - marginx2 )
2532 ok = VRset("CN_USERS","Height", pane_height- 1020- marginx2 )
2533
2534 ok = VRset("GB_FILES","Top", margin )
2535 ok = VRset("GB_FILES","Left", marginx2)
2536 ok = VRset("GB_FILES","Width", pane_width - 760)
2537 ok = VRset("GB_FILES","Height", pane_height- 1020)
2538 ok = VRset("CN_FILES","Top", margin)
2539 ok = VRset("CN_FILES","Left", margin)
2540 ok = VRset("CN_FILES","Width", pane_width - 760 - marginx2 )
2541 ok = VRset("CN_FILES","Height", pane_height- 1020- marginx2 )
2542
2543 ok = VRset("GB_SERVICE","Top", margin )
2544 ok = VRset("GB_SERVICE","Left", marginx2)
2545 ok = VRset("GB_SERVICE","Width", pane_width - 760)
2546 ok = VRset("GB_SERVICE","Height", pane_height- 1020)
2547 ok = VRset("CN_SERVICE","Top", margin)
2548 ok = VRset("CN_SERVICE","Left", margin)
2549 ok = VRset("CN_SERVICE","Width", pane_width - 760 - marginx2 )
2550 ok = VRset("CN_SERVICE","Height", pane_height- 1020- marginx2 )
2551
2552 ok = VRset("GB_DAEMONS","Top", margin )
2553 ok = VRset("GB_DAEMONS","Left", marginx2)
2554 ok = VRset("GB_DAEMONS","Width", pane_width - 760)
2555 ok = VRset("GB_DAEMONS","Height", pane_height- 1020)
2556 ok = VRset("CN_DAEMONS","Top", margin)
2557 ok = VRset("CN_DAEMONS","Left", margin)
2558 ok = VRset("CN_DAEMONS","Width", pane_width - 760 - margin*4 - pbtn_width)
2559 ok = VRset("CN_DAEMONS","Height", pane_height- 1020 - marginx2 )
2560
2561 ok = VRSet("ICB_START", "Top", pbtn_height*2 - marginx2)
2562 ok = VRSet("ICB_STOP", "Top", pbtn_height*3 - marginx2)
2563 ok = VRSet("ICB_Restart","Top", pbtn_height*4 - marginx2)
2564 ok = VRSet("ICB_REload", "Top", pbtn_height*5 - marginx2)
2565
2566 ok = VRSet("ICB_START", "Left", pane_width - 760 - marginx2 - pbtn_width)
2567 ok = VRSet("ICB_STOP", "Left", pane_width - 760 - marginx2 - pbtn_width)
2568 ok = VRSet("ICB_Restart","Left", pane_width - 760 - marginx2 - pbtn_width)
2569 ok = VRSet("ICB_REload", "Left", pane_width - 760 - marginx2 - pbtn_width)
2570
2571 ok = VRSet("ICB_START", "Width", pbtn_width)
2572 ok = VRSet("ICB_STOP", "Width", pbtn_width)
2573 ok = VRSet("ICB_Restart","Width", pbtn_width)
2574 ok = VRSet("ICB_Reload", "Width", pbtn_width)
2575
2576 ok = VRSet("ICB_START", "Height", pbtn_Height)
2577 ok = VRSet("ICB_STOP", "Height", pbtn_Height)
2578 ok = VRSet("ICB_Restart","Height", pbtn_Height)
2579 ok = VRSet("ICB_Reload", "Height", pbtn_Height)
2580
2581 ok = VRSet("ICB_CHOOSE", "Width", pbtn_width)
2582 ok = VRSet("ICB_CHOOSE", "Height", pbtn_Height)
2583
2584 ok = VRSet("ICB_DELLOGS", "Width", pbtn_width)
2585 ok = VRSet("ICB_DELLOGS", "Height", pbtn_Height)
2586
2587 ok = VRset("GB_SMBTREE","Top", margin )
2588 ok = VRset("GB_SMBTREE","Left", marginx2)
2589 ok = VRset("GB_SMBTREE","Width", pane_width - 760)
2590 ok = VRset("GB_SMBTREE","Height", pane_height- 1020)
2591 ok = VRset("CN_SMBTREE","Top", margin)
2592 ok = VRset("CN_SMBTREE","Left", margin)
2593 ok = VRset("CN_SMBTREE","Width", pane_width - 760 - marginx2 )
2594 ok = VRset("CN_SMBTREE","Height", pane_height- 1020- marginx2 )
2595
2596 ok = VRset("PICT_THROBBER", "Top", VRGet("CN_SMBTREE","Height") % 2 - 100 )
2597 ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width") % 2 - 200 )
2598
2599 ok = VRset("GB_SETTINGS","Top", margin )
2600 ok = VRset("GB_SETTINGS","Left", marginx2)
2601 ok = VRset("GB_SETTINGS","Width", pane_width - 760)
2602 ok = VRset("GB_SETTINGS","Height", pane_height- 1020- marginx2)
2603
2604
2605 /* check and empty event queue, trash spurious resize events */
2606 EventString = ''
2607 TrashedResize = 0
2608 do until EventString = 'nop'
2609 EventString = VREvent('N')
2610 if EventString <> 'nop' then do
2611 if EventString = 'CALL Main_Resize' then TrashedResize = 1
2612 else interpret eventString
2613 end
2614 end
2615 if TrashedResize then CALL Main_Resize
2616 ok = VRSet("Main", "Painting", 1)
2617
2618 IF options.!debug == 1 THEN SAY time()' Main_Resize done'
2619return
2620
2621/*:VRX Page1_Create
2622*/
2623Page1_Create:
2624
2625Return
2626
2627/*:VRX Page1_Init
2628*/
2629Page1_Init:
2630 call _ContainerInit
2631return
2632
2633/*:VRX Page2_Create
2634*/
2635Page2_create:
2636
2637Return
2638/*:VRX Page2_init
2639*/
2640Page2_init:
2641
2642return
2643
2644/*:VRX Page3_Create
2645*/
2646Page3_create:
2647
2648Return
2649/*:VRX Page3_Init
2650*/
2651Page3_Init:
2652
2653return
2654
2655/*:VRX Page4_Create
2656*/
2657Page4_Create:
2658
2659Return
2660/*:VRX Page4_init
2661*/
2662Page4_init:
2663
2664return
2665
2666/*:VRX Page5_Create
2667*/
2668Page5_Create:
2669
2670return
2671
2672/*:VRX Page5_Init
2673*/
2674Page5_Init:
2675
2676return
2677
2678/*:VRX Paper_Init
2679*/
2680Paper_Init:
2681 ok = VRSet("IPB_Paper","Width" ,VRMethod( "Screen", "PixelsToTwips", 32 ))
2682 ok = VRSet("IPB_Paper","Height",VRMethod( "Screen", "PixelsToTwips", 32 ))
2683 ok = VRset("IPB_Paper","Left",VRget("GB_Main2","width")-420)
2684return
2685
2686/*:VRX PB_AboutOK1_Click
2687*/
2688PB_AboutOK1_Click:
2689 call About_Close
2690return
2691
2692/*:VRX PB_AboutOK_Click
2693*/
2694PB_AboutOK_Click:
2695 call About_Close
2696return
2697
2698/*:VRX PB_Help_Click
2699*/
2700PB_Help_Click:
2701 ok = VRMethod("Main", "InvokeHelp" )
2702return
2703
2704/*:VRX PB_Sort_Cancel_Click
2705*/
2706PB_Sort_Cancel_Click:
2707 ok = VRset( Container, "DetailSort", Old.SortField )
2708 ok = VRSet( Container, "Sort", Old.SortOrder )
2709 ok = VRMethod( Container, "SortRecords" )
2710 drop Old.
2711 call SW_SORT_Close
2712return
2713
2714/*:VRX PB_Sort_OK_Click
2715*/
2716PB_Sort_OK_Click:
2717 drop Old.
2718 call SW_SORT_Close
2719return
2720
2721/*:VRX PushbackAll
2722*/
2723PushbackAll:
2724 Pages = 6
2725 /* Tab distance from top */
2726 TabTop = 20
2727 TabWidth = VRMethod( "Screen", "PixelsToTwips", 78 )
2728 TabHeight= VRMethod( "Screen", "PixelsToTwips", 24 )
2729
2730 /* Page Position */
2731 PageLeft = 120
2732 PageTop = PageLeft + TabTop + 330
2733
2734 /* Page size */
2735 PageHeight = 3000
2736 PageWidth = 3000
2737 call beep 880, 20
2738/* ok = VRset("DT_PageName", "Caption", "")
2739 ok = VRSet("GB_Main","Left", 0)
2740 ok = VRSet("GB_Main","Top", TabTop+230)
2741 do I = 1 to Pages
2742 ok = VRSet("TAB_"I,"Top", TabTop)
2743 ok = VRSet("TAB_"I,"PicturePath","#2"||I||";#2"||I)
2744 ok = VRSet("TAB_"I,"Left",TabWidth*(I-1)+PageLeft)
2745 ok = VRSet("TAB_"I,"Width",TabWidth)
2746 ok = VRSet("TAB_"I,"Height",TabHeight)
2747 ok = VRSet("Page_"I,"Height", max(PageHeight,VRget("GB_Main2","Height")-600))
2748 ok = VRSet("Page_"I,"Width", max(PageWidth,VRget("GB_Main2","Width")-450))
2749 ok = VRSet("Page_"I,"Left", PageLeft)
2750 ok = VRSet("Page_"I,"Top", PageTop)
2751 ok = VRSet("Page_"I,"Visible", 0)
2752 ok = VRSet("Page_"I,"BackColor", "<default>")
2753 end */
2754return
2755
2756/*:VRX Quit
2757*/
2758Quit:
2759 call VRSet VRWindow(), 'Pointer', 'Wait'
2760 call _IniWrite
2761 ok = VRRedirectStdIO("OFF")
2762 call _SambaFinish
2763
2764 ok = SysFileDelete(smbdoutput)
2765
2766 call lineout samba.!bin"\quit", "quit"
2767 ok = stream(samba.!bin"\quit","c","close")
2768 ok = SysSleep(1)
2769 ok = SysDestroyObject('<smbstarter>')
2770 ok = SysFileDelete(samba.!bin'\smbstarter.cmd')
2771 ok = SysFileDelete(samba.!bin'\quit')
2772 call VRSet VRWindow(), 'Pointer', '<default>'
2773
2774 window = VRWindow()
2775 call VRSet window, "Shutdown", 1
2776 drop window
2777return
2778
2779/*:VRX RB_ACLS_NUMERIC_Click
2780*/
2781RB_ACLS_NUMERIC_Click:
2782 aclsnumeric = '--numeric'
2783 ok = VRSet("DT_REV_CONT","Caption","")
2784 ok = VRMethod("CN_ACLS","RemoveRecord","ALL")
2785 ok = VRMethod("CN_ACLS","SetFieldAttr", ACL.userFH, "Visible", 0 )
2786 call _ACLSBrowse
2787return
2788
2789/*:VRX RB_ACLS_TEXT_Click
2790*/
2791RB_ACLS_TEXT_Click:
2792 aclsnumeric = ''
2793 ok = VRSet("DT_REV_CONT","Caption","")
2794 ok = VRMethod("CN_ACLS","RemoveRecord","ALL")
2795 ok = VRMethod("CN_ACLS","SetFieldAttr", ACL.userFH, "Visible", 1 )
2796 call _ACLSBrowse
2797return
2798
2799/*:VRX RB_Sort_Ascending_Click
2800*/
2801RB_Sort_Ascending_Click:
2802 SortOrder = "Ascending"
2803 call _ContainerSort
2804return
2805
2806/*:VRX RB_Sort_Descending_Click
2807*/
2808RB_Sort_Descending_Click:
2809 SortOrder = "Descending"
2810 call _ContainerSort
2811return
2812
2813/*:VRX RB_Sort_None_Click
2814*/
2815RB_Sort_None_Click:
2816 SortOrder = "None"
2817 call _ContainerSort
2818return
2819
2820/*:VRX SPIN_FONTSIZE_Change
2821*/
2822SPIN_FONTSIZE_Change:
2823return
2824
2825/*:VRX SPIN_Intervall_Change
2826*/
2827SPIN_Intervall_Change:
2828return
2829
2830/*:VRX SPIN_IntervallMin_Change
2831*/
2832SPIN_IntervallMin_Change:
2833return
2834
2835/*:VRX SPIN_log_level_Change
2836*/
2837SPIN_log_level_Change:
2838 advanced.!smbconfchanged = 1
2839return
2840
2841/*:VRX SPIN_MAX_LOG_SIZE_Change
2842*/
2843SPIN_MAX_LOG_SIZE_Change:
2844 advanced.!smbconfchanged = 1
2845return
2846
2847/*:VRX SPIN_max_protocol_Change
2848*/
2849SPIN_max_protocol_Change:
2850 advanced.!smbconfchanged = 1
2851return
2852
2853/*:VRX SW_ACLS_Close
2854*/
2855SW_ACLS_Close:
2856 call SW_ACLS_Fini
2857return
2858
2859/*:VRX SW_ACLS_Create
2860*/
2861SW_ACLS_Create:
2862 call SW_ACLS_Init
2863 CALL NLVSetText 'ICB_ACLS_OK', "Caption", 2
2864 CALL NLVSetText 'RB_ACLS_TEXT' "Caption", 155
2865 CALL NLVSetText 'RB_ACLS_NUMERIC' "Caption", 156
2866
2867 ACL.typeFH = VRMethod( "CN_ACLS", "AddField", "String", "Type" )
2868 ACL.groupFH = VRMethod( "CN_ACLS", "AddField", "String", "Group" )
2869 ACL.userFH = VRMethod( "CN_ACLS", "AddField", "String", "User" )
2870 ACL.ADFH = VRMethod( "CN_ACLS", "AddField", "String", "A/D" )
2871 ACL.flagsFH = VRMethod( "CN_ACLS", "AddField", "String", "Flags" )
2872 ACL.accessFH = VRMethod( "CN_ACLS", "AddField", "String", "Access" )
2873 ok = VRMethod( "CN_ACLS", "RemoveRecord", "ALL")
2874 aclsnumeric = ''
2875 call _ACLSBrowse
2876 ACLSObj = VRGet("SW_ACLS","Caption")
2877 parse var ACLSObj .'\\'ACLSObj
2878 ACLSObj = NLVGetMessage(154)' \\'ACLSOBj
2879 ok = VRSet("SW_ACLS","Caption",ACLSObj)
2880 drop ACLSObj
2881return
2882/*:VRX SW_ACLS_Fini
2883*/
2884SW_ACLS_Fini:
2885 window = VRInfo( "Window" )
2886 call VRDestroy window
2887 drop window
2888return
2889/*:VRX SW_ACLS_Init
2890*/
2891SW_ACLS_Init:
2892 window = VRInfo( "Object" )
2893 if( \VRIsChildOf( window, "Notebook" ) ) then do
2894 call VRMethod window, "CenterWindow"
2895 call VRSet window, "Visible", 1
2896 call VRMethod window, "Activate"
2897 end
2898 drop window
2899return
2900
2901/*:VRX SW_CHKTDB_Close
2902*/
2903SW_CHKTDB_Close:
2904 call SW_CHKTDB_Fini
2905return
2906
2907/*:VRX SW_CHKTDB_Create
2908*/
2909SW_CHKTDB_Create:
2910 call SW_CHKTDB_Init
2911return
2912
2913/*:VRX SW_CHKTDB_Fini
2914*/
2915SW_CHKTDB_Fini:
2916 window = VRInfo( "Window" )
2917 call VRDestroy window
2918 drop window
2919return
2920/*:VRX SW_CHKTDB_Init
2921*/
2922SW_CHKTDB_Init:
2923 window = VRInfo( "Object" )
2924 if( \VRIsChildOf( window, "Notebook" ) ) then do
2925 call VRMethod window, "CenterWindow"
2926 call VRSet window, "Visible", 1
2927 call VRMethod window, "Activate"
2928 end
2929 drop window
2930return
2931
2932/*:VRX SW_DAEMONS_Close
2933*/
2934SW_DAEMONS_Close:
2935 call SW_DAEMONS_Fini
2936return
2937
2938/*:VRX SW_DAEMONS_Create
2939*/
2940SW_DAEMONS_Create:
2941 call SW_DAEMONS_Init
2942
2943 CALL NLVSetText 'CN_DAEMONS', 'Caption', 65
2944
2945 CALL VRMethod 'TT_Main', 'Register', 'ICB_START', NLVGetMessage(61)
2946 CALL VRMethod 'TT_Main', 'Register', 'ICB_STOP', NLVGetMessage(62)
2947 CALL VRMethod 'TT_Main', 'Register', 'ICB_RESTART', NLVGetMessage(63)
2948 CALL VRMethod 'TT_Main', 'Register', 'ICB_RELOAD', NLVGetMessage(64)
2949 CALL VRMethod 'TT_DAEMONS', 'Register', 'CN_DAEMONS', NLVGetMessage(66)
2950return
2951
2952/*:VRX SW_DAEMONS_Fini
2953*/
2954SW_DAEMONS_Fini:
2955 window = VRInfo( "Window" )
2956 call VRDestroy window
2957 drop window
2958return
2959/*:VRX SW_DAEMONS_Init
2960*/
2961SW_DAEMONS_Init:
2962 window = VRInfo( "Object" )
2963 if( \VRIsChildOf( window, "Notebook" ) ) then do
2964 call VRMethod window, "CenterWindow"
2965 call VRSet window, "Visible", 1
2966 call VRMethod window, "Activate"
2967 end
2968 drop window
2969return
2970
2971/*:VRX SW_FILES_Close
2972*/
2973SW_FILES_Close:
2974 call SW_FILES_Fini
2975return
2976
2977/*:VRX SW_FILES_Create
2978*/
2979SW_FILES_Create:
2980 call SW_FILES_Init
2981 CALL VRMethod 'TT_FILES', 'Register', 'CN_FILES', NLVGetMessage(68)
2982return
2983
2984/*:VRX SW_FILES_Fini
2985*/
2986SW_FILES_Fini:
2987 window = VRInfo( "Window" )
2988 call VRDestroy window
2989 drop window
2990return
2991/*:VRX SW_FILES_Init
2992*/
2993SW_FILES_Init:
2994 window = VRInfo( "Object" )
2995 if( \VRIsChildOf( window, "TDL" ) ) then do
2996 call VRMethod window, "CenterWindow"
2997 call VRSet window, "Visible", 1
2998 call VRMethod window, "Activate"
2999 end
3000 drop window
3001return
3002
3003/*:VRX SW_LOGIN_Close
3004*/
3005SW_LOGIN_Close:
3006 call SW_LOGIN_Fini
3007return
3008
3009/*:VRX SW_LOGIN_Create
3010*/
3011SW_LOGIN_Create:
3012 call SW_LOGIN_Init
3013/* ok = VRSet("SW_LOGIN","Caption",NLVGetMessage(136)' 'strip(p_workgroup' \\'p_server'\'p_share,'T','\')) */
3014 CALL NLVSetText 'DT_USER1', "Caption", 131
3015 CALL NLVSetText 'DT_PASSWORD1', "Caption", 23
3016/* CALL NLVSetText 'CB_STORECREDS1', "Caption", 135 */
3017 CALL NLVSetText 'ICB_LOGIN_OK', "Caption", 2
3018 CALL NLVSetText 'ICB_LOGIN_CANCEL',"Caption", 3
3019
3020 if VRIsValidObject(SMBObj.rh) then do
3021 select
3022 when pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.rh, MBFH)) > 0 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
3023 when SMBObj.udatatype = "WORKGROUP" then LoginIcon = SMBObj.Icon
3024 when SMBObj.udatatype = "SERVER" then LoginIcon = SMBObj.Icon
3025 when SMBObj.udatatype = "DISK" then do
3026 if pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.parentrh, MBFH)) > 0
3027 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
3028 else LoginIcon = "#35:PMWP.DLL" /* icons.!pdc */
3029 end
3030 otherwise LoginIcon = "#35:PMWP.DLL" /* icons.!machine_awake */
3031 end
3032 say loginicon
3033 ok = VRSet("Pict_Login","PicturePath", LoginIcon)
3034 end
3035/* ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
3036 ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value")) */
3037say options.!storecreds
3038 ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
3039return
3040
3041/*:VRX SW_LOGIN_Fini
3042*/
3043SW_LOGIN_Fini:
3044 window = VRInfo( "Window" )
3045 call VRDestroy window
3046 drop window
3047return
3048/*:VRX SW_LOGIN_Init
3049*/
3050SW_LOGIN_Init:
3051 window = VRInfo( "Object" )
3052 if( \VRIsChildOf( window, "Notebook" ) ) then do
3053 call VRMethod window, "CenterWindow"
3054 call VRSet window, "Visible", 1
3055 call VRMethod window, "Activate"
3056 end
3057 drop window
3058return
3059
3060/*:VRX SW_SERVICE_Close
3061*/
3062SW_SERVICE_Close:
3063 call SW_SERVICE_Fini
3064return
3065
3066/*:VRX SW_SERVICE_Create
3067*/
3068SW_SERVICE_Create:
3069 call SW_SERVICE_Init
3070 CALL VRMethod 'TT_SERVICE', 'Register', 'CN_SERVICE', NLVGetMessage(69)
3071return
3072
3073/*:VRX SW_SERVICE_Fini
3074*/
3075SW_SERVICE_Fini:
3076 window = VRInfo( "Window" )
3077 call VRDestroy window
3078 drop window
3079return
3080/*:VRX SW_SERVICE_Init
3081*/
3082SW_SERVICE_Init:
3083 window = VRInfo( "Object" )
3084 if( \VRIsChildOf( window, "TDL" ) ) then do
3085 call VRMethod window, "CenterWindow"
3086 call VRSet window, "Visible", 1
3087 call VRMethod window, "Activate"
3088 end
3089 drop window
3090return
3091
3092/*:VRX SW_SETTINGS_Close
3093*/
3094SW_SETTINGS_Close:
3095 call SW_SETTINGS_Fini
3096return
3097
3098/*:VRX SW_SETTINGS_Create
3099*/
3100SW_SETTINGS_Create:
3101 call SW_SETTINGS_Init
3102
3103 CALL NLVSetText 'DT_Refresh', 'Caption', 25
3104 CALL NLVSetText 'DT_RefreshMin', 'Caption', 25
3105 ok = VRSet("DT_REFRESH","AutoSize", 1)
3106 ok = VRSet("DT_REFRESH","AutoSize", 0)
3107 ok = VRSet("DT_REFRESH","Height", 253)
3108 ok = VRSet("DT_REFRESHMIN","Width", VRGet("DT_REFRESH","width"))
3109
3110 ok = VRSet("SPIN_Intervall","Left",VRGet("DT_REFRESH","Left")+VRGet("DT_REFRESH","Width")+marginx2)
3111 ok = VRSet("SPIN_IntervallMin","Left",VRGet("DT_REFRESH","Left")+VRGet("DT_REFRESH","Width")+marginx2)
3112
3113 CALL NLVSetText 'DT_Intervall', 'Caption', 26
3114 ok = VRSet("DT_IntervallMin", "Caption", NLVGetMessage(26)', 'NLVGetMessage(28))
3115 ok = VRSet("DT_IntervallMin","AutoSize", 1)
3116 ok = VRSet("DT_IntervallMin","AutoSize", 0)
3117 ok = VRSet("DT_IntervallMin","Height", 253)
3118
3119 ok = VRSet("DT_Intervall", "Left",VRGet("SPIN_Intervall","Left")+VRGet("SPIN_Intervall","Width")+marginx2)
3120 ok = VRSet("DT_IntervallMin","Left",VRGet("SPIN_Intervall","Left")+VRGet("SPIN_Intervall","Width")+marginx2)
3121
3122 CALL NLVSetText 'CB_NoMsgBox', 'Caption', 27
3123 CALL NLVSetText 'CB_WPSSTARTSTOP', 'Caption', 29
3124 CALL NLVSetText 'CB_DetectZombies','Caption', 30
3125
3126 CALL NLVSetText 'DT_FONTSIZE', 'Caption', 97
3127 CALL NLVSetText 'ICB_CHOOSE', 'Caption', 98
3128 CALL NLVSetText 'ICB_DELLOGS', 'Caption', 99
3129
3130 log_level = IniGet('log level', 'global', samba.!smbconf)
3131 log_file = IniGet('log file', 'global', samba.!smbconf)
3132 log_file = translate(log_file,'\','/')
3133 max_protocol = IniGet('max protocol', 'global', samba.!smbconf)
3134 max_log_size = IniGet('max log size', 'global', samba.!smbconf)
3135
3136 if log_level = "" then log_level = 2
3137 if max_protocol = "" then max_protocol = "NT1"
3138
3139 ok = VRSet("SPIN_LOG_LEVEL","Value",log_level)
3140 ok = VRSet("SPIN_MAX_LOG_SIZE","Value",max_log_size)
3141 ok = VRSet("SPIN_MAX_PROTOCOL","Value",max_protocol)
3142 ok = VRSet("EF_LOG_FILE","Value",log_file)
3143 ok = VRSet("EF_LOG_FILE","Width",length(log_file) * 100 + 300)
3144 ok = VRSet("DT_FREESPACE","Left",VRGet("EF_LOG_FILE","Width")+VRGet("EF_LOG_FILE","Left") + marginx2)
3145 ok = VRSet("ICB_DELLOGS","Left",VRGet("DT_FREESPACE","Left"))
3146
3147 ok = VRSet("DT_FONTSIZE","AutoSize", 1)
3148 ok = VRSet("DT_FONTSIZE","AutoSize", 0)
3149 ok = VRSet("DT_FONTSIZE","Height", 253)
3150 ok = VRSet("SPIN_FONTSIZE", "Left", VRGet("DT_FONTSIZE","Left")+VRGet("DT_FONTSIZE","Width")+marginx2)
3151
3152 CALL VRMethod 'TT_SETTINGS', 'Register', 'ICB_CHOOSE', NLVGetMessage(95)
3153 CALL VRMethod 'TT_SETTINGS', 'Register', 'ICB_DELLOGS', NLVGetMessage(96)
3154 CALL VRMethod 'TT_SETTINGS', 'Register', 'DT_LOG_LEVEL', samba.!smbconf
3155 CALL VRMethod 'TT_SETTINGS', 'Register', 'SPIN_LOG_LEVEL', samba.!smbconf
3156 CALL VRMethod 'TT_SETTINGS', 'Register', 'DT_LOG_FILE', samba.!smbconf
3157 CALL VRMethod 'TT_SETTINGS', 'Register', 'EF_LOG_FILE', samba.!smbconf
3158 CALL VRMethod 'TT_SETTINGS', 'Register', 'DT_MAX_LOG_SIZE', samba.!smbconf
3159 CALL VRMethod 'TT_SETTINGS', 'Register', 'SPIN_MAX_LOG_SIZE', samba.!smbconf
3160 CALL VRMethod 'TT_SETTINGS', 'Register', 'DT_MAX_PROTOCOL', samba.!smbconf
3161 CALL VRMethod 'TT_SETTINGS', 'Register', 'SPIN_MAX_PROTOCOL', samba.!smbconf
3162
3163 call _SambaCheckFreeSpace
3164return
3165
3166/*:VRX SW_SETTINGS_Fini
3167*/
3168SW_SETTINGS_Fini:
3169 window = VRInfo( "Window" )
3170 call VRDestroy window
3171 drop window
3172return
3173/*:VRX SW_SETTINGS_Init
3174*/
3175SW_SETTINGS_Init:
3176 window = VRInfo( "Object" )
3177 if( \VRIsChildOf( window, "TDL" ) ) then do
3178 call VRMethod window, "CenterWindow"
3179 call VRSet window, "Visible", 1
3180 call VRMethod window, "Activate"
3181 end
3182 drop window
3183return
3184
3185/*:VRX SW_SMBTREE_Close
3186*/
3187SW_SMBTREE_Close:
3188 call SW_SMBTREE_Fini
3189return
3190
3191/*:VRX SW_SMBTREE_Create
3192*/
3193SW_SMBTREE_Create:
3194 call SW_SMBTREE_Init
3195return
3196
3197/*:VRX SW_SMBTREE_Fini
3198*/
3199SW_SMBTREE_Fini:
3200 window = VRInfo( "Window" )
3201 call VRDestroy window
3202 drop window
3203return
3204/*:VRX SW_SMBTREE_Init
3205*/
3206SW_SMBTREE_Init:
3207 window = VRInfo( "Object" )
3208 if( \VRIsChildOf( window, "TDL" ) ) then do
3209 call VRMethod window, "CenterWindow"
3210 call VRSet window, "Visible", 1
3211 call VRMethod window, "Activate"
3212 end
3213 drop window
3214return
3215
3216/*:VRX SW_SMBTREE_Init_Content
3217*/
3218SW_SMBTREE_Init_Content:
3219 ok = VRset("Pict_Throbber", "Visible", 1)
3220 ok = VRset("TM_Throbber", "Enabled", 1)
3221 call _RefreshTree
3222return
3223
3224/*:VRX SW_SORT_Close
3225*/
3226SW_SORT_Close:
3227 call SW_SORT_Fini
3228return
3229
3230/*:VRX SW_SORT_Create
3231*/
3232SW_SORT_Create:
3233 call SW_SORT_Init
3234
3235 CALL NLVSetText 'SW_SORT', 'Caption', 35
3236 CALL NLVSetText 'PB_Sort_OK', 'Caption', 2
3237 CALL NLVSetText 'PB_Sort_Cancel', 'Caption', 3
3238
3239 CALL NLVSetText 'RB_Sort_Ascending', 'Caption', 90
3240 CALL NLVSetText 'RB_Sort_Descending', 'Caption', 91
3241 CALL NLVSetText 'RB_Sort_None', 'Caption', 92
3242
3243 Container = OH
3244say OH
3245say Container
3246 ok = VRMethod(Container, "GetFieldList", "Fields." )
3247
3248 SortOrder = "None"
3249
3250 do I = 1 to Fields.0
3251 ok = VRMethod("LB_SortFields","AddString", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
3252 end
3253 Old.SortField = VRGet( Container, "DetailSort" )
3254 Old.SortOrder = VRGet( Container, "Sort" )
3255say Old.SortField
3256say Old.SortOrder
3257return
3258
3259/*:VRX SW_SORT_Fini
3260*/
3261SW_SORT_Fini:
3262 window = VRInfo( "Window" )
3263 call VRDestroy window
3264 drop window
3265return
3266/*:VRX SW_SORT_Init
3267*/
3268SW_SORT_Init:
3269 window = VRInfo( "Object" )
3270 if( \VRIsChildOf( window, "Notebook" ) ) then do
3271 call VRMethod window, "CenterWindow"
3272 call VRSet window, "Visible", 1
3273 call VRMethod window, "Activate"
3274 end
3275 drop window
3276return
3277
3278/*:VRX SW_USERS_Close
3279*/
3280SW_USERS_Close:
3281 call SW_USERS_Fini
3282return
3283
3284/*:VRX SW_USERS_Create
3285*/
3286SW_USERS_Create:
3287 call SW_USERS_Init
3288 CALL VRMethod 'TT_USERS', 'Register', 'CN_USERS', NLVGetMessage(67)
3289return
3290
3291/*:VRX SW_USERS_Fini
3292*/
3293SW_USERS_Fini:
3294 window = VRInfo( "Window" )
3295 call VRDestroy window
3296 drop window
3297return
3298/*:VRX SW_USERS_Init
3299*/
3300SW_USERS_Init:
3301 window = VRInfo( "Object" )
3302 if( \VRIsChildOf( window, "Notebook" ) ) then do
3303 call VRMethod window, "CenterWindow"
3304 call VRSet window, "Visible", 1
3305 call VRMethod window, "Activate"
3306 end
3307 drop window
3308return
3309
3310/*:VRX TDL_1_PageSelected
3311*/
3312TDL_1_PageSelected:
3313 page = VRInfo("Page")
3314 CurrentPageNr = page
3315 ok = VRSet("TM_RefreshDaemons","Enabled", 0)
3316 ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
3317
3318 ok = VRSet("CN_DAEMONS", "Visible", 0)
3319 ok = VRSet("ICB_START", "Visible", 0)
3320 ok = VRSet("ICB_STOP", "Visible", 0)
3321 ok = VRSet("ICB_RESTART","Visible", 0)
3322 ok = VRSet("ICB_RELOAD", "Visible", 0)
3323
3324 ok = VRSet("CN_SMBTREE","Visible", 0)
3325 ok = VRSet("CN_USERS", "Visible", 0)
3326 ok = VRSet("CN_FILES", "Visible", 0)
3327 ok = VRSet("CN_SERVICE","Visible", 0)
3328 ok = VRSet("CN_CHKTDB", "Visible", 0)
3329
3330 ok = VRSet("GB_SETTINGS", "Visible", 0)
3331 ok = VRSet("ICB_CHOOSE", "Visible", 0)
3332 ok = VRSet("ICB_DELLOGS", "Visible", 0)
3333 ok = VRSet('ICB_CHOOSE', "Visible", 0)
3334 ok = VRSet('ICB_DELLOGS', "Visible", 0)
3335 ok = VRSet('DT_LOG_LEVEL', "Visible", 0)
3336 ok = VRSet('SPIN_LOG_LEVEL', "Visible", 0)
3337 ok = VRSet('DT_LOG_FILE', "Visible", 0)
3338 ok = VRSet('EF_LOG_FILE', "Visible", 0)
3339 ok = VRSet('DT_MAX_LOG_SIZE', "Visible", 0)
3340 ok = VRSet('SPIN_MAX_LOG_SIZE', "Visible", 0)
3341 ok = VRSet('DT_MAX_PROTOCOL', "Visible", 0)
3342 ok = VRSet('SPIN_MAX_PROTOCOL', "Visible", 0)
3343
3344 select
3345 when page = 1 then do /* daemons */
3346 ok = VRSet("CN_DAEMONS","Visible", 1)
3347 ok = VRSet("ICB_START", "Visible", 1)
3348 ok = VRSet("ICB_STOP", "Visible", 1)
3349 ok = VRSet("ICB_RESTART","Visible", 1)
3350 ok = VRSet("ICB_RELOAD", "Visible", 1)
3351 ok = VRSet("Main","WindowIcon","$46")
3352 ok = VRSet("TM_RefreshDaemons","Enabled", 1)
3353 ok = VRSet("TM_RefreshDaemons","Delay", 3000)
3354 end
3355 when page = 2 then do /* smbtree */
3356 ok = VRSet("CN_SMBTREE","Visible", 1)
3357 ok = VRSet("Main","WindowIcon","$1")
3358 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "All", "handle." )
3359 /* if the page is empty, populate it */
3360 if handle.0 = 0 then call ICB_REFRESH_Click
3361 end
3362 when page = 3 then do /* Users */
3363 ok = VRSet("CN_USERS","Visible", 1)
3364 ok = VRSet("Main","WindowIcon","$44")
3365 end
3366 when page = 4 then do /* files */
3367 ok = VRSet("CN_FILES", "Visible", 1)
3368 ok = VRSet("Main","WindowIcon","$1")
3369 end
3370 when page = 5 then do /* service */
3371 ok = VRSet("CN_SERVICE","Visible", 1)
3372 ok = VRSet("Main","WindowIcon","$52")
3373 end
3374 when page = 6 then do /* chkTDB */
3375 ok = VRSet("CN_CHKTDB", "Visible", 1)
3376 ok = VRSet("Main","WindowIcon","$53")
3377 say "ChkTDB"
3378 call _ChkTDB
3379 end
3380 when page = 7 then do /* Settings */
3381 ok = VRSet("GB_SETTINGS", "Visible", 1)
3382 ok = VRSet("ICB_CHOOSE", "Visible", 1)
3383 ok = VRSet("ICB_DELLOGS", "Visible", 1)
3384 ok = VRSet('DT_LOG_LEVEL', "Visible", 1)
3385 ok = VRSet('SPIN_LOG_LEVEL', "Visible", 1)
3386 ok = VRSet('DT_LOG_FILE', "Visible", 1)
3387 ok = VRSet('EF_LOG_FILE', "Visible", 1)
3388 ok = VRSet('DT_MAX_LOG_SIZE', "Visible", 1)
3389 ok = VRSet('SPIN_MAX_LOG_SIZE', "Visible", 1)
3390 ok = VRSet('DT_MAX_PROTOCOL', "Visible", 1)
3391 ok = VRSet('SPIN_MAX_PROTOCOL', "Visible", 1)
3392 ok = VRSet("Main","WindowIcon", "$53")
3393 end
3394 otherwise nop
3395 end
3396return
3397
3398/*:VRX TM_Refresh_Trigger
3399*/
3400TM_Refresh_Trigger:
3401/* call beep 1200, 20 */
3402 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
3403 if _VIOFontSizeGetCurrent() <> OldFontSize then ok = _VIOFontSizeSetCurrent(OldFontSize)
3404 call _Refresh
3405return
3406
3407/*:VRX TM_RefreshDaemons_Trigger
3408*/
3409TM_RefreshDaemons_Trigger:
3410 ok = VRSet("TM_RefreshDaemons","Delay", 3000)
3411 call _RefreshDaemons
3412 call _AddSharesDisplay
3413return
3414
3415/*:VRX TM_RefreshTreeDisplay_Trigger
3416*/
3417TM_RefreshTreeDisplay_Trigger:
3418 select
3419 when RefreshMode = "TREE" then do
3420 call _RefreshTreeDisplay
3421 end
3422 when RefreshMode = "SHARE" then do
3423 call _AddSharesDisplay
3424 end
3425 otherwise say "RefreshMode = "RefreshMode
3426 end
3427return
3428
3429/*:VRX TM_STATUSBAR_Trigger
3430*/
3431TM_STATUSBAR_Trigger:
3432 call _StatusBarReset
3433return
3434
3435/*:VRX TM_Throbber_Trigger
3436*/
3437TM_Throbber_Trigger:
3438 pIdx = VRGet("Pict_Throbber","PicturePath")
3439 parse var pIdx '#' pidx
3440 pidx = pidx + 1
3441 if pidx = 122 then pidx = 111
3442 ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
3443return
3444
Note: See TracBrowser for help on using the repository browser.