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

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

SMBMon: ACLS browser, missing, recreated stuff

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