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

Last change on this file since 1058 was 1058, checked in by Herwig Bauernfeind, 6 years ago

Fix Ticket #324 in cltinit.vrs

File size: 121.8 KB
Line 
1/*:VRX Main
2*/
3/* Samba Status Monitor for OS/2
4Copyright (C) 2007-2017 Herwig Bauernfeind for bww bitwise works GmbH.
5
6This program is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19/* Main
20*/
21Main:
22/* Process the arguments.
23 Get the parent window.
24*/
25 parse source . calledAs .
26 parent = ""
27 argCount = arg()
28 argOff = 0
29 if( calledAs \= "COMMAND" )then do
30 if argCount >= 1 then do
31 parent = arg(1)
32 argCount = argCount - 1
33 argOff = 1
34 end
35 end; else do
36 call VROptions 'ImplicitNames'
37 call VROptions 'NoEchoQuit'
38 end
39 InitArgs.0 = argCount
40 if( argCount > 0 )then do i = 1 to argCount
41 InitArgs.i = arg( i + argOff )
42 end
43 drop calledAs argCount argOff
44
45/* Load the windows
46*/
47 call VRInit
48 parse source . . spec
49 _VREPrimaryWindowPath = ,
50 VRParseFileName( spec, "dpn" ) || ".VRW"
51 _VREPrimaryWindow = ,
52 VRLoad( parent, _VREPrimaryWindowPath )
53 drop parent spec
54 if( _VREPrimaryWindow == "" )then do
55 call VRMessage "", "Cannot load window:" VRError(), ,
56 "Error!"
57 _VREReturnValue = 32000
58 signal _VRELeaveMain
59 end
60
61/* Process events
62*/
63 call Init
64 signal on halt
65 do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
66 _VREEvent = VREvent()
67 interpret _VREEvent
68 end
69_VREHalt:
70 _VREReturnValue = Fini()
71 call VRDestroy _VREPrimaryWindow
72_VRELeaveMain:
73 call VRFini
74exit _VREReturnValue
75
76VRLoadSecondary:
77 __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
78 if __vrlsWait then do
79 call VRFlush
80 end
81 __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
82 if __vrlsHWnd = '' then signal __vrlsDone
83 if __vrlsWait \= 1 then signal __vrlsDone
84 call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
85 __vrlsTmp = __vrlsWindows.0
86 if( DataType(__vrlsTmp) \= 'NUM' ) then do
87 __vrlsTmp = 1
88 end
89 else do
90 __vrlsTmp = __vrlsTmp + 1
91 end
92 __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
93 __vrlsWindows.0 = __vrlsTmp
94 do while( VRIsValidObject( VRWindow() ) = 1 )
95 __vrlsEvent = VREvent()
96 interpret __vrlsEvent
97 end
98 __vrlsTmp = __vrlsWindows.0
99 __vrlsWindows.0 = __vrlsTmp - 1
100 call VRWindow __vrlsWindows.__vrlsTmp
101 __vrlsHWnd = ''
102__vrlsDone:
103return __vrlsHWnd
104
105/*:VRX __VXREXX____APPENDS__
106*/
107__VXREXX____APPENDS__:
108/*
109#append ..\shared\inittempdir.vrs
110#append ..\shared\sambainit.vrs
111#append ..\shared\nlv.vrs
112#append ..\shared\smbtree.vrs
113#append ..\shared\browse.VRS
114#append ..\shared\usercredmem.vrs
115#append ..\shared\rxrpclib.vrs
116*/
117return
118
119/*:VRX _ChkTDB
120*/
121_ChkTDB:
122
123ok = SysFileTree(etc'\samba\lock\*.TDB',tdb.,'FO')
124say etc'\samba\lock\*.TDB 'tdb.0
125
126error = 0
127ok = VRMethod("CN_CHKTDB", "RemoveRecord", "ALL")
128
129RecHandleArray.0 = 0
130ok = VRSet("CN_CHKTDB", "Painting", 0)
131
132do I = 1 to tdb.0
133 RecHandleArray.I = VRMethod("CN_CHKTDB", "Addrecord")
134end
135ok = VRSet("CN_CHKTDB", "Painting", 1)
136
137/* ok = VRSet("CN_CHKTDB", "Painting", 0) */
138
139do I = 1 to tdb.0
140 RecHandle = RecHandleArray.I
141 TDBFile =left(filespec('N',tdb.I), 22)
142 TDBSize = stream(tdb.I,'c','query size')
143 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBFilesFH, TDBFile, ChkTDBIconFH, "$50", ChkTDBSizeFH, TDBSize||" Bytes" )
144 address cmd '@tdbtool 'tdb.I' check 2>'tdb.I'.err 1>'tdb.I'.out'
145 ok = file2stem(tdb.I'.out',"out.")
146 out = out.ok
147 say out
148 if pos('integrity is OK',out) > 0 then do /* integrity is ok */
149 ok = SysFileDelete(tdb.I'.err')
150 ok = SysFileDelete(tdb.I'.out')
151 out = left(out,length(out)-1)
152 TDBRecords = substr(out, pos("and has", out) + 7,)
153 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBStatusFH, TDBRecords )
154
155 address cmd '@tdbbackup -s.bak 'tdb.I' 2>NUL 1>NUL'
156 end
157 else do /* tdb error */
158 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBIconFH, "$51" )
159 error = 1
160 count = 0
161 out = ""
162 do while lines(tdb.I'.err') > 0 & count < 5
163 errline = linein(tdb.I'.err')
164 select
165 /* skip unnecessary lines of log */
166 when pos("bww ",errline) > 0 then iterate
167 when pos("fcntl",errline) > 0 then iterate
168 otherwise do
169 out = out||errline'. '
170 count = count + 1
171 end
172 end
173 end
174 ok = VRMethod("CN_CHKTDB", "SetFieldData", RecHandle, ChkTDBStatusFH, out )
175 ok = VRSet("CN_CHKTDB", "Painting", 1)
176 ok = VRSet("CN_CHKTDB", "Painting", 0)
177
178 ok = stream(tdb.I'.err','c','close')
179 end
180
181/*
182 call charout , left(filespec('N',tdb.I), 22)
183 address cmd '@tdbtool 'tdb.I' check 2>'tdb.I'.err 1>'tdb.I'.out'
184 out = linein(tdb.I'.out')
185 ok = stream(tdb.I'.out','c','close')
186 say out
187 if pos('integrity is OK',out) = 0 then do
188 call beep 880, 20
189 address cmd '@tdbbackup -s.bak -v 'tdb.I' 2>NUL 1>NUL'
190 error = 1
191 count = 0
192 do while lines(tdb.I'.err') > 0 & count < 5
193 errline = linein(tdb.I'.err')
194 select
195 /* skip unnecessary lines of log */
196 when pos("bww ",errline) > 0 then iterate
197 when pos("fcntl",errline) > 0 then iterate
198 otherwise do
199 say right(copies(' ',22)'Cause: 'errline'!',min(length(errline)+22,79))
200 count = count + 1
201 end
202 end
203 end
204 ok = stream(tdb.I'.err','c','close')
205 end
206 else do
207 ok = SysFileDelete(tdb.I'.err')
208 ok = SysFileDelete(tdb.I'.out')
209 address cmd '@tdbbackup -s.bak 'tdb.I' 2>NUL 1>NUL'
210 end */
211end
212
213ok = VRSet("CN_CHKTDB", "Painting", 1)
214
215return
216
217/*:VRX _ColumnShow
218*/
219_ColumnShow:
220 userdata = VRGet(VRInfo("Object"),"Userdata")
221 parse var userdata Container '|' fieldh '|' VisStatus
222say userdata
223 ok = VRMethod(Container,"SetFieldAttr", fieldh, "Visible", \VisStatus )
224return
225
226/*:VRX _ColumnsMenu
227*/
228_ColumnsMenu:
229 Container = arg(1)
230 ok = VRMethod(Container, "GetFieldList", "Fields." )
231
232 do I = 1 to 14
233 R2I = right("0"||I,2)
234 if I <= fields.0 then do
235/* say "Columns_"||R2I' 'VRMethod(Container, "GetFieldAttr", fields.I, "Title" ) */
236 ok = VRset("Columns_"||R2I, "Visible", 1)
237 ok = VRset("Columns_"||R2I, "Caption", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
238 ok = VRset("Columns_"||R2I, "Checked", VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
239 ok = VRset("Columns_"||R2I, "Userdata", Container'|'fields.I'|'VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
240 end
241 else ok = VRset("Columns_"||R2I, "Visible", 0)
242 end
243 ok = VRMethod( "Columns", "Popup", , , "", "" )
244return
245
246/*:VRX _ContainerInit
247*/
248_ContainerInit:
249 say '_ContainerInit() started.'
250
251 /* Users */
252 UIconH = VRMethod( "CN_Users", "AddField", "Icon", NLVGetMessage(148) )
253 UsernameFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(131) )
254 GroupFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(132) )
255 UMachineFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(133) )
256 UIPAdrFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(147) )
257 UPIDFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(130) )
258
259 /* Files */
260 FIconH = VRMethod( "CN_Files", "AddField", "Icon", NLVGetMessage(148) )
261 FileFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(134) )
262 FUserFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(131) )
263 FPIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(130) )
264 DenyModeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(135) )
265 TimeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(136) )
266 DateFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(149) )
267 AccessFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(137) )
268 RWFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(138) )
269 OplockFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(139) )
270 UIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(140) )
271 SharePathFH= VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(141) )
272 NameFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(142) )
273
274 /* Service */
275 SIconH = VRMethod( "CN_Service", "AddField", "Icon", NLVGetMessage(148) )
276 SPIDFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(130) )
277 ServiceFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(143) )
278 SMachineFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(133) )
279 ConnectedFH= VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(144) )
280
281 /* Daemons */
282 DaemonFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(145) )
283 DStatusFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(146) )
284 DPidsFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(130) )
285
286 smbdHandle = VRMethod("CN_Daemons", "Addrecord",, ,NLVGetMessage(77),"$41") /* smbd.exe */
287 nmbdHandle = VRMethod("CN_Daemons", "Addrecord", ,,NLVGetMessage(78),"$41") /* nmbd.exe */
288 winbHandle = VRMethod("CN_Daemons", "Addrecord",, ,NLVGetMessage(79),"$41") /* winbindd.exe */
289
290 ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DaemonFH, NLVGetMessage(77)) /* smbd.exe */
291 ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DaemonFH, NLVGetMessage(78)) /* nmbd.exe */
292 ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DaemonFH, NLVGetMessage(79)) /* winbindd.exe */
293 ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
294 ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
295 ok = VRMethod("CN_Daemons", "SetRecordAttr","All", "Collapsed", 0 )
296
297
298 /* SMBTree */
299 WorkgroupFH = VRMethod( "CN_SMBTREE", "AddField", "String", NLVGetMessage(150) )
300 NBFH = VRMethod( "CN_SMBTREE", "AddField", "String", "NetBIOS name" )
301 IpFH = VRMethod( "CN_SMBTREE", "AddField", "String", NLVGetMessage(147) )
302 MBFH = VRMethod( "CN_SMBTREE", "AddField", "String", "DMB/LMB" )
303 OSFH = VRMethod( "CN_SMBTREE", "AddField", "String", "OS" )
304 /* VersionFH = VRMethod( "CN_SmbTree", "AddField", "String", "Version" ) */
305 CommentFH = VRMethod( "CN_SMBTREE", "AddField", "String", NLVGetMessage(151) )
306 MacFH = VRMethod( "CN_SMBTREE", "AddField", "String", "MAC" )
307
308 ok = VRMethod("CN_SMBTREE","SetfieldAttr",IPFH, "ReadOnly", 1)
309 ok = VRMethod("CN_SMBTREE","SetfieldAttr",NBFH, "ReadOnly", 1)
310 ok = VRMethod("CN_SMBTREE","SetfieldAttr",MBFH, "ReadOnly", 1)
311 ok = VRMethod("CN_SMBTREE","SetfieldAttr",WorkGroupFH,"ReadOnly", 1)
312 ok = VRMethod("CN_SMBTREE","SetfieldAttr",OSFH, "ReadOnly", 1)
313 ok = VRMethod("CN_SMBTREE","SetfieldAttr",MacFH, "ReadOnly", 1)
314
315 /* ChkTdb */
316 ChkTDBFilesFH = VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(134) )
317 ChkTDBIconFH = VRMethod( "CN_CHKTDB", "AddField", "Icon", NLVGetMessage(146) )
318 ChkTDBSizeFH = VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(152) )
319 ChkTDBStatusFH= VRMethod( "CN_CHKTDB", "AddField", "String", NLVGetMessage(151) )
320
321 ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBIconFH, "Justification","Center", "ReadOnly", 1)
322 ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBSizeFH, "Justification","Right", "ReadOnly", 1)
323 ok = VRMethod( "CN_CHKTDB", "SetfieldAttr", ChkTDBStatusFH, "Justification","Right", "ReadOnly", 1)
324
325 say '_ContainerInit() done.'
326return
327/*:VRX _ContainerSort
328*/
329_ContainerSort:
330 ok = VRMethod( "LB_SortFields", "GetSelectedList", "SortFields." )
331 if Fields.0 = 0 then return
332 idx = SortFields.1
333 ok = VRset( Container, "DetailSort", Fields.idx )
334 ok = VRSet( Container, "Sort", SortOrder )
335 ok = VRMethod( Container, "SortRecords" )
336return
337
338/*:VRX _ContextMenuSelectedSet
339*/
340_ContextMenuSelectedSet:
341 ok = VRSet("ContextMenu_Tree_Login", "Visible", 0)
342 ok = VRSet("ContextMenu_Tree_ACLS", "Visible", 0)
343 ok = VRSet("ContextMenu_Tree_SendMsg", "Visible", 0)
344 ok = VRSet("ContextMenu_Tree_Logoff", "Visible", 0)
345 ok = VRSet("ContextMenu_Tree_Sep1", "Visible", 0)
346 ok = VRSet("ContextMenu_Tree_MiniIcons", "Visible", 0)
347 ok = VRSet("ContextMenu_Tree_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)' 'right("0000"||word(smbdpids,I),5)' ('right("0000"||d2x(word(smbdpids,I)),4)'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)' 'right("0000"||word(nmbdpids,I),5)' ('right("0000"||d2x(word(nmbdpids,I)),4)'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)' 'right("0000"||word(winbpids,I),5)' ('right("0000"||d2x(word(winbpids,I)),4)'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 ACLSObj = VRGet("SW_ACLS","Caption")
2174 parse var ACLSObj .'\\'aclssrv'\'aclsshare'\'aclspath
2175 if aclspath = "" then aclspath = "\"
2176
2177 say "smbcacls \\"ACLSsrv"\"aclsshare" "aclspath" "UserCred" --"VRget("DDCB_ACLS_ACTION","Value")"=ACL:"VRGet("DDCB_ACLS_USER","Value")":"VRGet("DDCB_ACLS_A_D","Value")":"VRGet("DDCB_ACLS_FLAGS","Value")":"VRGet("DDCB_ACLS_PERMISSIONS","Value")
2178 address cmd samba.!smbcaclsexe" \\"ACLSsrv"\"aclsshare" "aclspath" "UserCred" --"VRget("DDCB_ACLS_ACTION","Value")"=ACL:"VRGet("DDCB_ACLS_USER","Value")":"VRGet("DDCB_ACLS_A_D","Value")"/"VRGet("DDCB_ACLS_FLAGS","Value")"/"VRGet("DDCB_ACLS_PERMISSIONS","Value")' 2>'samba.!err' 1>'samba.!msg
2179 ok = file2stem(samba.!msg,"aclsmsg.")
2180 ok = file2stem(samba.!err,"aclserr.")
2181 if aclsmsg.0 = 0 & aclserr.0 = 0 then call _StatusBarWrapper "OK"
2182 if aclserr.0 > 0 then call _StatusBarWrapper "ERROR "aclserr.1
2183 ok = VRMethod( "CN_ACLS", "RemoveRecord", "ALL")
2184 call _ACLSBrowse
2185 if VRIsValidObject("SW_ACLS") then do
2186 ACLSObj = VRGet("SW_ACLS","Caption")
2187 parse var ACLSObj .'\\'ACLSObj
2188 ACLSObj = NLVGetMessage(154)' \\'ACLSOBj
2189 ok = VRSet("SW_ACLS","Caption",ACLSObj)
2190 end
2191 drop ACLSObj
2192
2193 call SW_ACLSEdit_Close
2194return
2195
2196/*:VRX ICB_APPLY_Click
2197*/
2198ICB_APPLY_Click:
2199 IF options.!debug == 1 then say time()' PB_Apply_Click() started'
2200 options.!Debug = VRGet("CB_Debug","set")
2201 if options.!Debug then ok = VRREdirectStdIO("ON")
2202 else ok = VRREdirectStdIO("OFF")
2203 Intervall = VRGet("SPIN_Intervall","Value")
2204 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
2205 IntervallMin = VRGet("SPIN_IntervallMin","Value")
2206
2207 NoMsgBox = VRGet("CB_NoMsgBox","set")
2208 say 'NoMsgBox = "'NoMsgBox'"'
2209
2210 WPSStartStop = VRGet("CB_WPSStartStop","set")
2211 say 'WPSStartStop = "'WPSStartStop'"'
2212
2213 DetectZombies = VRGet("CB_DetectZombies","set")
2214 say 'DetectZombies = "'DetectZombies'"'
2215
2216 VIOFontsize = VRGet("SPIN_FONTSIZE","Value")
2217 say "VIOFontsize = "VIOFontsize
2218
2219 options.!storecreds = VRGet("CB_STORECREDS","Set")
2220 say "options.!storecreds = "options.!storecreds
2221
2222 if advanced.!smbconfchanged = 1 then do
2223 log_level = VRGet("SPIN_log_level","Value")
2224 log_file = VRGet("EF_log_file","Value")
2225 max_protocol = VRGet("SPIN_max_protocol","Value")
2226 max_log_size = VRGet("SPIN_max_log_size","Value")
2227
2228 handle = IniOpen('global', samba.!smbconf)
2229
2230 ok = IniSet('log level', log_level, handle)
2231 ok = IniSet('log file', log_file, handle)
2232 ok = IniSet('max log size', max_log_size, handle)
2233 ok = IniSet('max protocol', max_protocol, handle)
2234
2235 ok = IniSave(handle)
2236 ok = IniClose(handle)
2237 advanced.!smbconfchanged = 0
2238 end
2239 IF options.!debug == 1 then say time()' PB_Apply_Click() done'
2240return
2241
2242/*:VRX ICB_CHOOSE_Click
2243*/
2244ICB_CHOOSE_Click:
2245 FileName = VRFileDialog( VRWindow(), "Choose location for log files", "Open", VRGet("EF_LOG_FILE","Value"))
2246 if Filename <> "" then ok = VRSet("EF_LOG_FILE","Value", FIleName)
2247 drop Filename
2248return
2249
2250/*:VRX ICB_DELLOGS_Click
2251*/
2252ICB_DELLOGS_Click:
2253 call VRSet VRWindow(), 'Pointer', 'Wait'
2254
2255 call _SambaCheckFreeSpace
2256
2257 ok = SysFileTree(samba.!logdir'\log.*', logs.,'FO')
2258 do I = 1 to logs.0
2259 ok = VRMethod( "CN_Daemons", "GetRecordList", "All", "handle." )
2260 KeepLog = 0
2261 do J = 1 to handle.0
2262 CurPID = VRMethod("CN_Daemons", "GetFieldData", handle.J, DPidsFH)
2263 if pos(CurPID,logs.I) > 0 then KeepLog = 1
2264 end
2265 if KeepLog = 0 then do
2266 say "Delete "logs.I
2267 ok = SysFileDelete(logs.I)
2268 end
2269 end
2270
2271 call _SambaCheckFreeSpace
2272
2273 call VRSet VRWindow(), 'Pointer', '<default>'
2274return
2275
2276/*:VRX ICB_EXIT_Click
2277*/
2278ICB_EXIT_Click:
2279 say 'start ICB_EXIT_Click'
2280 Call Quit
2281 say 'done ICB_EXIT_Click'
2282return
2283
2284/*:VRX ICB_LOGIN_CANCEL_Click
2285*/
2286ICB_LOGIN_CANCEL_Click:
2287/* ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
2288 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value")) */
2289 options.!storecreds = VRGet("CB_STORECREDS1","Set")
2290 credentials.!entered = 1
2291 p_server = SMBObj.resname
2292 if p_server <> "" then do
2293 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
2294
2295 if word(ok,1) = "1" then do
2296 call _StatusBarWrapper NLVGetMessage(107, rpc.queryuser.FULL_NAME)
2297 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
2298 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
2299 call _UserCredUpdate
2300 end
2301 else do
2302 call _StatusBarWrapper VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS
2303 end
2304 end
2305
2306 call SW_LOGIN_Close
2307return
2308
2309/*:VRX ICB_LOGIN_OK_Click
2310*/
2311ICB_LOGIN_OK_Click:
2312/* ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
2313 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value")) */
2314 options.!storecreds = VRGet("CB_STORECREDS1","Set")
2315 credentials.!entered = 1
2316 p_server = SMBObj.resname
2317 if p_server <> "" then do
2318 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
2319
2320 if word(ok,1) = "1" then do
2321 call _StatusBarReset
2322 call _StatusBarWrapper NLVGetMessage(15)' "'VRGet("EF_USER1","Value")'" 'rpc.queryuser.LOGONSTATUS
2323 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
2324 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
2325 call _UserCredUpdate
2326 Usercontext = VRGet("CN_SMBTREE","Caption")
2327 parse var Usercontext Usercontext':'.
2328 Usercontext = Usercontext': 'VRGet("EF_USER1","Value")
2329 ok = VRSet("CN_SMBTREE","Caption",Usercontext)
2330 end
2331 else do
2332 call _StatusBarWrapper VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS
2333 end
2334 end
2335
2336 call SW_LOGIN_Close
2337return
2338
2339/*:VRX ICB_REFRESH_Click
2340*/
2341ICB_REFRESH_Click:
2342 IF options.!debug == 1 then say time()' ICB_REFRESH_Click() started'
2343 ok = SysSleep(0.3)
2344
2345 say " CurrentPageNr = "CurrentPageNr
2346 select
2347 when CurrentPageNr = 2 then do
2348 ok = VRset("Pict_Throbber", "Visible", 1)
2349 ok = VRset("TM_Throbber", "Enabled", 1)
2350 call _RefreshTree
2351 end
2352 when CurrentPageNr = 6 then do
2353 call _ChkTDB
2354 end
2355 otherwise call _Refresh
2356 end
2357 IF options.!debug == 1 then say time()' ICB_REFRESH_Click() done'
2358return
2359
2360/*:VRX ICB_RELOAD_Click
2361*/
2362ICB_RELOAD_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_reload>', 'DEFAULT', 1)
2370 end
2371 else do
2372 call lineout samba.!bin"\smbstart", "reload"
2373 ok = stream(samba.!bin"\reload","c","close")
2374 end
2375 ok = VRSet("TM_Refresh","Delay", 2000)
2376 call VRSet VRWindow(), 'Pointer', '<default>'
2377return
2378
2379/*:VRX ICB_RESTART_Click
2380*/
2381ICB_RESTART_Click:
2382 call VRSet VRWindow(), 'Pointer', 'Wait'
2383 OldFontSize = _VIOFontSizeGetCurrent()
2384 say 'OldFontSize = 'OldFontSize
2385 if OldFontSize <> VIOFontSize then ok = _VIOFontSizeSetCurrent(VIOFontSize)
2386
2387 if WPSStartStop then do
2388 ok = SysOpenObject('<smb_restart>', 'DEFAULT', 1)
2389 end
2390 else do
2391 call lineout samba.!bin"\restart", "restart"
2392 ok = stream(samba.!bin"\restart","c","close")
2393 end
2394 ok = VRSet("TM_Refresh","Delay", 2000)
2395 call VRSet VRWindow(), 'Pointer', '<default>'
2396return
2397
2398/*:VRX ICB_START_Click
2399*/
2400ICB_START_Click:
2401 say "IPB_Start_Click started"
2402 call VRSet VRWindow(), 'Pointer', 'Wait'
2403 OldFontSize = _VIOFontSizeGetCurrent()
2404 say 'OldFontSize = 'OldFontSize
2405 if OldFontSize <> VIOFontSize then ok = _VIOFontSizeSetCurrent(VIOFontSize)
2406 if WPSStartStop then do
2407 ok = SysOpenObject('<smb_start>', 'DEFAULT', 1)
2408 end
2409 else do
2410 call lineout samba.!bin"\smbstart", "smbstart"
2411 ok = stream(samba.!bin"\smbstart","c","close")
2412 end
2413 ok = VRSet("TM_Refresh","Delay", 2000)
2414 call VRSet VRWindow(), 'Pointer', '<default>'
2415 say "IPB_Start_Click done"
2416return
2417
2418/*:VRX ICB_STOP_Click
2419*/
2420ICB_STOP_Click:
2421 say "IPB_Stop_Click started"
2422 call VRSet VRWindow(), 'Pointer', 'Wait'
2423 OldFontSize = _VIOFontSizeGetCurrent()
2424 say 'OldFontSize = 'OldFontSize
2425 if OldFontSize <> VIOFontSize then ok = _VIOFontSizeSetCurrent(VIOFontSize)
2426
2427 if WPSStartStop then do
2428 ok = SysOpenObject('<smb_stop>', 'DEFAULT', 1)
2429 end
2430 else do
2431 call lineout samba.!bin"\smbstop", "smbstop"
2432 ok = stream(samba.!bin"\smbstop","c","close")
2433 end
2434 ok = VRSet("TM_Refresh","Delay", 2000)
2435 call VRSet VRWindow(), 'Pointer', '<default>'
2436 say "IPB_Stop_Click done"
2437return
2438
2439/*:VRX Init
2440*/
2441Init:
2442window = VRWindow()
2443call VRMethod window, "CenterWindow"
2444call VRSet window, "Visible", 0
2445call VRMethod window, "Activate"
2446drop window
2447return
2448
2449/*:VRX LB_SortFields_Click
2450*/
2451LB_SortFields_Click:
2452 call _ContainerSort
2453return
2454
2455/*:VRX Main_Activate
2456*/
2457Main_Activate:
2458 call TM_Refresh_Trigger
2459 ok = VRset("TM_Refresh", "Enabled", 1)
2460return
2461
2462/*:VRX Main_Close
2463*/
2464Main_Close:
2465 call Quit
2466return
2467
2468/*:VRX Main_Create
2469*/
2470Main_Create:
2471 options.!debug = 0
2472 if options.!debug == 1 then do
2473 ok = VRRedirectStdIO("ON")
2474 say time()' Main_Create started'
2475 end
2476 else ok = VRRedirectStdIO("OFF")
2477
2478 call _LoadOtherFuncs
2479 call _InitTempDir
2480
2481 call _IniRead
2482 call _NLVSetup
2483
2484 call _SambaInit
2485 if \WPSStartStop then call _CreateSmbStarter
2486 if _SambaRunning() then call _SambaFindPIDfile
2487 call _ContainerInit
2488 call _GUIInit
2489
2490 ok = VRMethod("ICB_Refresh","SetFocus")
2491
2492 if options.!debug == 1 then say time()' Main_Create done'
2493return
2494/*:VRX Main_Deactivate
2495*/
2496Main_Deactivate:
2497 ok = VRset("TM_Refresh", "Enabled", 0)
2498return
2499
2500/*:VRX Main_Resize
2501*/
2502Main_Resize:
2503 IF options.!debug == 1 THEN SAY time()' Main_Resize started'
2504 if TrashedSize = 1 then do
2505 IF options.!debug == 1 THEN SAY time()' Main_Resize aborted, already in progress'
2506 end
2507 ok = VRSet("Main","Painting", 0)
2508
2509 /* Basic measurements */
2510 main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */
2511 main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */
2512
2513 /* if main_iheight < 5500 then ok = VRSet("Main","Height",6200) */
2514 sbar_height = margin * 8 /* Height of status-bar */
2515 marginx2 = margin * 2 /* Common margin around controls */
2516 marginx4 = margin * 4
2517
2518 pbtn_width = 1200
2519 pbtn_dist = 80 + pbtn_width
2520 pbtn_nr = 4
2521 pbtn_pos = max((main_iwidth - pbtn_Dist * pbtn_Nr)%2, 0)+ margin
2522 pbtn_height = 460 /* Height of the panels' internal button areas */
2523
2524
2525 pane_height = main_iheight- sbar_height - pbtn_height - margin * 7 /* Height of notebook */
2526 pane_width = main_iwidth - marginx2 /* Width of the notebook panel */
2527
2528 /* Tabbed Dialog */
2529 ok = VRset("TDL_1", "Top", marginx2 )
2530 ok = VRset("TDL_1", "Left", margin )
2531 ok = VRset("TDL_1", "Width", pane_width )
2532 ok = VRset("TDL_1", "Height", pane_height )
2533
2534 /* Statusbar */
2535 ok = VRSet("GB_STATUSBAR", "Left", margin )
2536 ok = VRSet("GB_STATUSBAR", "Top", main_iheight - sbar_height - margin )
2537 ok = VRSet("GB_STATUSBAR", "Height",sbar_height )
2538 ok = VRSet("GB_STATUSBAR", "Width", pane_width )
2539
2540 ok = VRSet("DT_STATUSBAR", "Top", 12 )
2541 ok = VRSet("DT_STATUSBAR", "Left", 12 )
2542 ok = VRSet("DT_STATUSBAR", "Height",sbar_height- 24)
2543 ok = VRSet("DT_STATUSBAR", "Width", pane_width - 24)
2544
2545 ok = VRSet("ICB_REFRESH","top", pane_height + marginx4 )
2546 ok = VRSet("ICB_EXIT", "top", pane_height + marginx4 )
2547 ok = VRSet("ICB_Apply", "top", pane_height + marginx4 )
2548 ok = VRSet("ICB_About", "top", pane_height + marginx4 )
2549
2550 ok = VRSet("ICB_REFRESH","Width", pbtn_width )
2551 ok = VRSet("ICB_EXIT", "Width", pbtn_width )
2552 ok = VRSet("ICB_Apply", "Width", pbtn_width )
2553 ok = VRSet("ICB_About", "Width", pbtn_width )
2554
2555 ok = VRSet("ICB_REFRESH","Height", pbtn_Height )
2556 ok = VRSet("ICB_EXIT", "Height", pbtn_Height )
2557 ok = VRSet("ICB_Apply", "Height", pbtn_Height )
2558 ok = VRSet("ICB_About", "Height", pbtn_Height )
2559
2560
2561 ok = VRSet("ICB_REFRESH","left",pbtn_pos + pbtn_dist * (pbtn_nr - 4))
2562 ok = VRSet("ICB_Apply", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 3))
2563 ok = VRSet("ICB_About", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 2))
2564 ok = VRSet("ICB_EXIT", "left",pbtn_pos + pbtn_dist * (pbtn_nr - 1))
2565
2566 ok = VRset("GB_CHKTDB","Top", margin )
2567 ok = VRset("GB_CHKTDB","Left", marginx2)
2568 ok = VRset("GB_CHKTDB","Width", pane_width - 760)
2569 ok = VRset("GB_CHKTDB","Height", pane_height- 1020)
2570 ok = VRset("CN_CHKTDB","Top", margin)
2571 ok = VRset("CN_CHKTDB","Left", margin)
2572 ok = VRset("CN_CHKTDB","Width", pane_width - 760 - marginx2 )
2573 ok = VRset("CN_CHKTDB","Height", pane_height- 1020- marginx2 )
2574
2575 ok = VRset("GB_USERS","Top", margin )
2576 ok = VRset("GB_USERS","Left", marginx2)
2577 ok = VRset("GB_USERS","Width", pane_width - 760)
2578 ok = VRset("GB_USERS","Height", pane_height- 1020)
2579 ok = VRset("CN_USERS","Top", margin)
2580 ok = VRset("CN_USERS","Left", margin)
2581 ok = VRset("CN_USERS","Width", pane_width - 760 - marginx2 )
2582 ok = VRset("CN_USERS","Height", pane_height- 1020- marginx2 )
2583
2584 ok = VRset("GB_FILES","Top", margin )
2585 ok = VRset("GB_FILES","Left", marginx2)
2586 ok = VRset("GB_FILES","Width", pane_width - 760)
2587 ok = VRset("GB_FILES","Height", pane_height- 1020)
2588 ok = VRset("CN_FILES","Top", margin)
2589 ok = VRset("CN_FILES","Left", margin)
2590 ok = VRset("CN_FILES","Width", pane_width - 760 - marginx2 )
2591 ok = VRset("CN_FILES","Height", pane_height- 1020- marginx2 )
2592
2593 ok = VRset("GB_SERVICE","Top", margin )
2594 ok = VRset("GB_SERVICE","Left", marginx2)
2595 ok = VRset("GB_SERVICE","Width", pane_width - 760)
2596 ok = VRset("GB_SERVICE","Height", pane_height- 1020)
2597 ok = VRset("CN_SERVICE","Top", margin)
2598 ok = VRset("CN_SERVICE","Left", margin)
2599 ok = VRset("CN_SERVICE","Width", pane_width - 760 - marginx2 )
2600 ok = VRset("CN_SERVICE","Height", pane_height- 1020- marginx2 )
2601
2602 ok = VRset("GB_DAEMONS","Top", margin )
2603 ok = VRset("GB_DAEMONS","Left", marginx2)
2604 ok = VRset("GB_DAEMONS","Width", pane_width - 760)
2605 ok = VRset("GB_DAEMONS","Height", pane_height- 1020)
2606 ok = VRset("CN_DAEMONS","Top", margin)
2607 ok = VRset("CN_DAEMONS","Left", margin)
2608 ok = VRset("CN_DAEMONS","Width", pane_width - 760 - margin*4 - pbtn_width)
2609 ok = VRset("CN_DAEMONS","Height", pane_height- 1020 - marginx2 )
2610
2611 ok = VRSet("ICB_START", "Top", pbtn_height*2 - marginx2)
2612 ok = VRSet("ICB_STOP", "Top", pbtn_height*3 - marginx2)
2613 ok = VRSet("ICB_Restart","Top", pbtn_height*4 - marginx2)
2614 ok = VRSet("ICB_REload", "Top", pbtn_height*5 - marginx2)
2615
2616 ok = VRSet("ICB_START", "Left", pane_width - 760 - marginx2 - pbtn_width)
2617 ok = VRSet("ICB_STOP", "Left", pane_width - 760 - marginx2 - pbtn_width)
2618 ok = VRSet("ICB_Restart","Left", pane_width - 760 - marginx2 - pbtn_width)
2619 ok = VRSet("ICB_REload", "Left", pane_width - 760 - marginx2 - pbtn_width)
2620
2621 ok = VRSet("ICB_START", "Width", pbtn_width)
2622 ok = VRSet("ICB_STOP", "Width", pbtn_width)
2623 ok = VRSet("ICB_Restart","Width", pbtn_width)
2624 ok = VRSet("ICB_Reload", "Width", pbtn_width)
2625
2626 ok = VRSet("ICB_START", "Height", pbtn_Height)
2627 ok = VRSet("ICB_STOP", "Height", pbtn_Height)
2628 ok = VRSet("ICB_Restart","Height", pbtn_Height)
2629 ok = VRSet("ICB_Reload", "Height", pbtn_Height)
2630
2631 ok = VRSet("ICB_CHOOSE", "Width", pbtn_width)
2632 ok = VRSet("ICB_CHOOSE", "Height", pbtn_Height)
2633
2634 ok = VRSet("ICB_DELLOGS", "Width", pbtn_width)
2635 ok = VRSet("ICB_DELLOGS", "Height", pbtn_Height)
2636
2637 ok = VRset("GB_SMBTREE","Top", margin )
2638 ok = VRset("GB_SMBTREE","Left", marginx2)
2639 ok = VRset("GB_SMBTREE","Width", pane_width - 760)
2640 ok = VRset("GB_SMBTREE","Height", pane_height- 1020)
2641 ok = VRset("CN_SMBTREE","Top", margin)
2642 ok = VRset("CN_SMBTREE","Left", margin)
2643 ok = VRset("CN_SMBTREE","Width", pane_width - 760 - marginx2 )
2644 ok = VRset("CN_SMBTREE","Height", pane_height- 1020- marginx2 )
2645
2646 ok = VRset("PICT_THROBBER", "Top", VRGet("CN_SMBTREE","Height") % 2 - 100 )
2647 ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width") % 2 - 200 )
2648
2649 ok = VRset("GB_SETTINGS","Top", margin )
2650 ok = VRset("GB_SETTINGS","Left", marginx2)
2651 ok = VRset("GB_SETTINGS","Width", pane_width - 760)
2652 ok = VRset("GB_SETTINGS","Height", pane_height- 1020- marginx2)
2653
2654
2655 /* check and empty event queue, trash spurious resize events */
2656 EventString = ''
2657 TrashedResize = 0
2658 do until EventString = 'nop'
2659 EventString = VREvent('N')
2660 if EventString <> 'nop' then do
2661 if EventString = 'CALL Main_Resize' then TrashedResize = 1
2662 else interpret eventString
2663 end
2664 end
2665 if TrashedResize then CALL Main_Resize
2666 ok = VRSet("Main", "Painting", 1)
2667
2668 IF options.!debug == 1 THEN SAY time()' Main_Resize done'
2669return
2670
2671/*:VRX Page1_Create
2672*/
2673Page1_Create:
2674
2675Return
2676
2677/*:VRX Page1_Init
2678*/
2679Page1_Init:
2680 call _ContainerInit
2681return
2682
2683/*:VRX Page2_Create
2684*/
2685Page2_create:
2686
2687Return
2688/*:VRX Page2_init
2689*/
2690Page2_init:
2691
2692return
2693
2694/*:VRX Page3_Create
2695*/
2696Page3_create:
2697
2698Return
2699/*:VRX Page3_Init
2700*/
2701Page3_Init:
2702
2703return
2704
2705/*:VRX Page4_Create
2706*/
2707Page4_Create:
2708
2709Return
2710/*:VRX Page4_init
2711*/
2712Page4_init:
2713
2714return
2715
2716/*:VRX Page5_Create
2717*/
2718Page5_Create:
2719
2720return
2721
2722/*:VRX Page5_Init
2723*/
2724Page5_Init:
2725
2726return
2727
2728/*:VRX Paper_Init
2729*/
2730Paper_Init:
2731 ok = VRSet("IPB_Paper","Width" ,VRMethod( "Screen", "PixelsToTwips", 32 ))
2732 ok = VRSet("IPB_Paper","Height",VRMethod( "Screen", "PixelsToTwips", 32 ))
2733 ok = VRset("IPB_Paper","Left",VRget("GB_Main2","width")-420)
2734return
2735
2736/*:VRX PB_AboutOK1_Click
2737*/
2738PB_AboutOK1_Click:
2739 call About_Close
2740return
2741
2742/*:VRX PB_AboutOK_Click
2743*/
2744PB_AboutOK_Click:
2745 call About_Close
2746return
2747
2748/*:VRX PB_Help_Click
2749*/
2750PB_Help_Click:
2751 ok = VRMethod("Main", "InvokeHelp" )
2752return
2753
2754/*:VRX PB_Sort_Cancel_Click
2755*/
2756PB_Sort_Cancel_Click:
2757 ok = VRset( Container, "DetailSort", Old.SortField )
2758 ok = VRSet( Container, "Sort", Old.SortOrder )
2759 ok = VRMethod( Container, "SortRecords" )
2760 drop Old.
2761 call SW_SORT_Close
2762return
2763
2764/*:VRX PB_Sort_OK_Click
2765*/
2766PB_Sort_OK_Click:
2767 drop Old.
2768 call SW_SORT_Close
2769return
2770
2771/*:VRX PushbackAll
2772*/
2773PushbackAll:
2774 Pages = 6
2775 /* Tab distance from top */
2776 TabTop = 20
2777 TabWidth = VRMethod( "Screen", "PixelsToTwips", 78 )
2778 TabHeight= VRMethod( "Screen", "PixelsToTwips", 24 )
2779
2780 /* Page Position */
2781 PageLeft = 120
2782 PageTop = PageLeft + TabTop + 330
2783
2784 /* Page size */
2785 PageHeight = 3000
2786 PageWidth = 3000
2787 call beep 880, 20
2788/* ok = VRset("DT_PageName", "Caption", "")
2789 ok = VRSet("GB_Main","Left", 0)
2790 ok = VRSet("GB_Main","Top", TabTop+230)
2791 do I = 1 to Pages
2792 ok = VRSet("TAB_"I,"Top", TabTop)
2793 ok = VRSet("TAB_"I,"PicturePath","#2"||I||";#2"||I)
2794 ok = VRSet("TAB_"I,"Left",TabWidth*(I-1)+PageLeft)
2795 ok = VRSet("TAB_"I,"Width",TabWidth)
2796 ok = VRSet("TAB_"I,"Height",TabHeight)
2797 ok = VRSet("Page_"I,"Height", max(PageHeight,VRget("GB_Main2","Height")-600))
2798 ok = VRSet("Page_"I,"Width", max(PageWidth,VRget("GB_Main2","Width")-450))
2799 ok = VRSet("Page_"I,"Left", PageLeft)
2800 ok = VRSet("Page_"I,"Top", PageTop)
2801 ok = VRSet("Page_"I,"Visible", 0)
2802 ok = VRSet("Page_"I,"BackColor", "<default>")
2803 end */
2804return
2805
2806/*:VRX Quit
2807*/
2808Quit:
2809 call VRSet VRWindow(), 'Pointer', 'Wait'
2810 call _IniWrite
2811 ok = VRRedirectStdIO("OFF")
2812 call _SambaFinish
2813
2814 ok = SysFileDelete(smbdoutput)
2815
2816 call lineout samba.!bin"\quit", "quit"
2817 ok = stream(samba.!bin"\quit","c","close")
2818 ok = SysSleep(1)
2819 ok = SysDestroyObject('<smbstarter>')
2820 ok = SysFileDelete(samba.!bin'\smbstarter.cmd')
2821 ok = SysFileDelete(samba.!bin'\quit')
2822 call VRSet VRWindow(), 'Pointer', '<default>'
2823
2824 window = VRWindow()
2825 call VRSet window, "Shutdown", 1
2826 drop window
2827return
2828
2829/*:VRX RB_ACLS_NUMERIC_Click
2830*/
2831RB_ACLS_NUMERIC_Click:
2832 aclsnumeric = '--numeric'
2833 ok = VRSet("DT_REV_CONT","Caption","")
2834 ok = VRMethod("CN_ACLS","RemoveRecord","ALL")
2835 ok = VRMethod("CN_ACLS","SetFieldAttr", ACL.userFH, "Visible", 0 )
2836 call _ACLSBrowse
2837return
2838
2839/*:VRX RB_ACLS_TEXT_Click
2840*/
2841RB_ACLS_TEXT_Click:
2842 aclsnumeric = ''
2843 ok = VRSet("DT_REV_CONT","Caption","")
2844 ok = VRMethod("CN_ACLS","RemoveRecord","ALL")
2845 ok = VRMethod("CN_ACLS","SetFieldAttr", ACL.userFH, "Visible", 1 )
2846 call _ACLSBrowse
2847return
2848
2849/*:VRX RB_Sort_Ascending_Click
2850*/
2851RB_Sort_Ascending_Click:
2852 SortOrder = "Ascending"
2853 call _ContainerSort
2854return
2855
2856/*:VRX RB_Sort_Descending_Click
2857*/
2858RB_Sort_Descending_Click:
2859 SortOrder = "Descending"
2860 call _ContainerSort
2861return
2862
2863/*:VRX RB_Sort_None_Click
2864*/
2865RB_Sort_None_Click:
2866 SortOrder = "None"
2867 call _ContainerSort
2868return
2869
2870/*:VRX SPIN_FONTSIZE_Change
2871*/
2872SPIN_FONTSIZE_Change:
2873return
2874
2875/*:VRX SPIN_Intervall_Change
2876*/
2877SPIN_Intervall_Change:
2878return
2879
2880/*:VRX SPIN_IntervallMin_Change
2881*/
2882SPIN_IntervallMin_Change:
2883return
2884
2885/*:VRX SPIN_log_level_Change
2886*/
2887SPIN_log_level_Change:
2888 advanced.!smbconfchanged = 1
2889return
2890
2891/*:VRX SPIN_MAX_LOG_SIZE_Change
2892*/
2893SPIN_MAX_LOG_SIZE_Change:
2894 advanced.!smbconfchanged = 1
2895return
2896
2897/*:VRX SPIN_max_protocol_Change
2898*/
2899SPIN_max_protocol_Change:
2900 advanced.!smbconfchanged = 1
2901return
2902
2903/*:VRX SW_ACLS_Activate
2904*/
2905SW_ACLS_Activate:
2906
2907return
2908
2909/*:VRX SW_ACLS_Close
2910*/
2911SW_ACLS_Close:
2912 call SW_ACLS_Fini
2913return
2914
2915/*:VRX SW_ACLS_Create
2916*/
2917SW_ACLS_Create:
2918 call SW_ACLS_Init
2919 CALL NLVSetText 'ICB_ACLS_OK', "Caption", 2
2920 CALL NLVSetText 'RB_ACLS_TEXT' "Caption", 155
2921 CALL NLVSetText 'RB_ACLS_NUMERIC' "Caption", 156
2922
2923 ACL.typeFH = VRMethod( "CN_ACLS", "AddField", "String", "Type" )
2924 ACL.groupFH = VRMethod( "CN_ACLS", "AddField", "String", "Group" )
2925 ACL.userFH = VRMethod( "CN_ACLS", "AddField", "String", "User" )
2926 ACL.ADFH = VRMethod( "CN_ACLS", "AddField", "String", "A/D" )
2927 ACL.flagsFH = VRMethod( "CN_ACLS", "AddField", "String", "Flags" )
2928 ACL.accessFH = VRMethod( "CN_ACLS", "AddField", "String", "Access" )
2929 ok = VRMethod( "CN_ACLS", "RemoveRecord", "ALL")
2930 aclsnumeric = ''
2931 call _ACLSBrowse
2932 if VRIsValidObject("SW_ACLS") then do
2933 ACLSObj = VRGet("SW_ACLS","Caption")
2934 parse var ACLSObj .'\\'ACLSObj
2935 ACLSObj = NLVGetMessage(154)' \\'ACLSOBj
2936 ok = VRSet("SW_ACLS","Caption",ACLSObj)
2937 end
2938 drop ACLSObj
2939return
2940/*:VRX SW_ACLS_Fini
2941*/
2942SW_ACLS_Fini:
2943 window = VRInfo( "Window" )
2944 call VRDestroy window
2945 drop window
2946return
2947/*:VRX SW_ACLS_Init
2948*/
2949SW_ACLS_Init:
2950 window = VRInfo( "Object" )
2951 if( \VRIsChildOf( window, "Notebook" ) ) then do
2952 call VRMethod window, "CenterWindow"
2953 call VRSet window, "Visible", 1
2954 call VRMethod window, "Activate"
2955 end
2956 drop window
2957return
2958
2959/*:VRX SW_ACLSEdit_Close
2960*/
2961SW_ACLSEdit_Close:
2962 call SW_ACLSEdit_Fini
2963return
2964
2965/*:VRX SW_ACLSEdit_Create
2966*/
2967SW_ACLSEdit_Create:
2968 call SW_ACLSEdit_Init
2969 CALL NLVSetText 'ICB_ACLSEDIT_OK', "Caption", 2
2970 CALL NLVSetText 'ICB_ACLSEDIT_CANCEL',"Caption", 3
2971
2972 ok = VRMethod("CN_ACLS","GetRecordList","Selected", "aclsrh.")
2973 if aclsrh.0 = 0 then return
2974 drop ACLS.
2975 do i = 1 to aclsrh.0
2976 ACLS.ACL = VRMethod("CN_ACLS","GetFieldData", aclsrh.i, ACL.typeFH )
2977 ACLS.Group = VRMethod("CN_ACLS","GetFieldData", aclsrh.i, ACL.groupFH)
2978 ACLS.User = VRMethod("CN_ACLS","GetFieldData", aclsrh.i, ACL.userFH)
2979 ACLS.A_D = VRMethod("CN_ACLS","GetFieldData", aclsrh.i, ACL.ADFH)
2980 ACLS.Flags = VRMethod("CN_ACLS","GetFieldData", aclsrh.i, ACL.flagsFH)
2981 ACLS.Permissions = VRMethod("CN_ACLS","GetFieldData", aclsrh.i, ACL.accessFH)
2982 ok = VRSet("DDCB_ACLS_USER", "Value", strip(ACLS.Group'\'ACLS.User,,'\'))
2983 ok = VRSet("DDCB_ACLS_A_D", "Value", ACLS.A_D)
2984 ok = VRSet("DDCB_ACLS_FLAGS", "Value", ACLS.Flags)
2985 ok = VRSet("DDCB_ACLS_PERMISSIONS","Value", ACLS.Permissions)
2986 end
2987 ok = VRSet("DDCB_ACLS_ACTION","value","modify")
2988return
2989
2990/*:VRX SW_ACLSEdit_Fini
2991*/
2992SW_ACLSEdit_Fini:
2993 window = VRInfo( "Window" )
2994 call VRDestroy window
2995 drop window
2996return
2997/*:VRX SW_ACLSEdit_Init
2998*/
2999SW_ACLSEdit_Init:
3000 window = VRInfo( "Object" )
3001 if( \VRIsChildOf( window, "Notebook" ) ) then do
3002 call VRMethod window, "CenterWindow"
3003 call VRSet window, "Visible", 1
3004 call VRMethod window, "Activate"
3005 end
3006 drop window
3007return
3008
3009/*:VRX SW_CHKTDB_Close
3010*/
3011SW_CHKTDB_Close:
3012 call SW_CHKTDB_Fini
3013return
3014
3015/*:VRX SW_CHKTDB_Create
3016*/
3017SW_CHKTDB_Create:
3018 call SW_CHKTDB_Init
3019return
3020
3021/*:VRX SW_CHKTDB_Fini
3022*/
3023SW_CHKTDB_Fini:
3024 window = VRInfo( "Window" )
3025 call VRDestroy window
3026 drop window
3027return
3028/*:VRX SW_CHKTDB_Init
3029*/
3030SW_CHKTDB_Init:
3031 window = VRInfo( "Object" )
3032 if( \VRIsChildOf( window, "Notebook" ) ) then do
3033 call VRMethod window, "CenterWindow"
3034 call VRSet window, "Visible", 1
3035 call VRMethod window, "Activate"
3036 end
3037 drop window
3038return
3039
3040/*:VRX SW_DAEMONS_Close
3041*/
3042SW_DAEMONS_Close:
3043 call SW_DAEMONS_Fini
3044return
3045
3046/*:VRX SW_DAEMONS_Create
3047*/
3048SW_DAEMONS_Create:
3049 call SW_DAEMONS_Init
3050
3051 CALL NLVSetText 'CN_DAEMONS', 'Caption', 65
3052
3053 CALL VRMethod 'TT_Main', 'Register', 'ICB_START', NLVGetMessage(61)
3054 CALL VRMethod 'TT_Main', 'Register', 'ICB_STOP', NLVGetMessage(62)
3055 CALL VRMethod 'TT_Main', 'Register', 'ICB_RESTART', NLVGetMessage(63)
3056 CALL VRMethod 'TT_Main', 'Register', 'ICB_RELOAD', NLVGetMessage(64)
3057 CALL VRMethod 'TT_DAEMONS', 'Register', 'CN_DAEMONS', NLVGetMessage(66)
3058return
3059
3060/*:VRX SW_DAEMONS_Fini
3061*/
3062SW_DAEMONS_Fini:
3063 window = VRInfo( "Window" )
3064 call VRDestroy window
3065 drop window
3066return
3067/*:VRX SW_DAEMONS_Init
3068*/
3069SW_DAEMONS_Init:
3070 window = VRInfo( "Object" )
3071 if( \VRIsChildOf( window, "Notebook" ) ) then do
3072 call VRMethod window, "CenterWindow"
3073 call VRSet window, "Visible", 1
3074 call VRMethod window, "Activate"
3075 end
3076 drop window
3077return
3078
3079/*:VRX SW_FILES_Close
3080*/
3081SW_FILES_Close:
3082 call SW_FILES_Fini
3083return
3084
3085/*:VRX SW_FILES_Create
3086*/
3087SW_FILES_Create:
3088 call SW_FILES_Init
3089 CALL VRMethod 'TT_FILES', 'Register', 'CN_FILES', NLVGetMessage(68)
3090return
3091
3092/*:VRX SW_FILES_Fini
3093*/
3094SW_FILES_Fini:
3095 window = VRInfo( "Window" )
3096 call VRDestroy window
3097 drop window
3098return
3099/*:VRX SW_FILES_Init
3100*/
3101SW_FILES_Init:
3102 window = VRInfo( "Object" )
3103 if( \VRIsChildOf( window, "TDL" ) ) then do
3104 call VRMethod window, "CenterWindow"
3105 call VRSet window, "Visible", 1
3106 call VRMethod window, "Activate"
3107 end
3108 drop window
3109return
3110
3111/*:VRX SW_LOGIN_Close
3112*/
3113SW_LOGIN_Close:
3114 call SW_LOGIN_Fini
3115return
3116
3117/*:VRX SW_LOGIN_Create
3118*/
3119SW_LOGIN_Create:
3120 call SW_LOGIN_Init
3121/* ok = VRSet("SW_LOGIN","Caption",NLVGetMessage(136)' 'strip(p_workgroup' \\'p_server'\'p_share,'T','\')) */
3122 CALL NLVSetText 'DT_USER1', "Caption", 131
3123 CALL NLVSetText 'DT_PASSWORD1', "Caption", 23
3124/* CALL NLVSetText 'CB_STORECREDS1', "Caption", 135 */
3125 CALL NLVSetText 'ICB_LOGIN_OK', "Caption", 2
3126 CALL NLVSetText 'ICB_LOGIN_CANCEL',"Caption", 3
3127
3128 if VRIsValidObject(SMBObj.rh) then do
3129 select
3130 when pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.rh, MBFH)) > 0 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
3131 when SMBObj.udatatype = "WORKGROUP" then LoginIcon = SMBObj.Icon
3132 when SMBObj.udatatype = "SERVER" then LoginIcon = SMBObj.Icon
3133 when SMBObj.udatatype = "DISK" then do
3134 if pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.parentrh, MBFH)) > 0
3135 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
3136 else LoginIcon = "#35:PMWP.DLL" /* icons.!pdc */
3137 end
3138 otherwise LoginIcon = "#35:PMWP.DLL" /* icons.!machine_awake */
3139 end
3140 say loginicon
3141 ok = VRSet("Pict_Login","PicturePath", LoginIcon)
3142 end
3143/* ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
3144 ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value")) */
3145say options.!storecreds
3146 ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
3147return
3148
3149/*:VRX SW_LOGIN_Fini
3150*/
3151SW_LOGIN_Fini:
3152 window = VRInfo( "Window" )
3153 call VRDestroy window
3154 drop window
3155return
3156/*:VRX SW_LOGIN_Init
3157*/
3158SW_LOGIN_Init:
3159 window = VRInfo( "Object" )
3160 if( \VRIsChildOf( window, "Notebook" ) ) then do
3161 call VRMethod window, "CenterWindow"
3162 call VRSet window, "Visible", 1
3163 call VRMethod window, "Activate"
3164 end
3165 drop window
3166return
3167
3168/*:VRX SW_SERVICE_Close
3169*/
3170SW_SERVICE_Close:
3171 call SW_SERVICE_Fini
3172return
3173
3174/*:VRX SW_SERVICE_Create
3175*/
3176SW_SERVICE_Create:
3177 call SW_SERVICE_Init
3178 CALL VRMethod 'TT_SERVICE', 'Register', 'CN_SERVICE', NLVGetMessage(69)
3179return
3180
3181/*:VRX SW_SERVICE_Fini
3182*/
3183SW_SERVICE_Fini:
3184 window = VRInfo( "Window" )
3185 call VRDestroy window
3186 drop window
3187return
3188/*:VRX SW_SERVICE_Init
3189*/
3190SW_SERVICE_Init:
3191 window = VRInfo( "Object" )
3192 if( \VRIsChildOf( window, "TDL" ) ) then do
3193 call VRMethod window, "CenterWindow"
3194 call VRSet window, "Visible", 1
3195 call VRMethod window, "Activate"
3196 end
3197 drop window
3198return
3199
3200/*:VRX SW_SETTINGS_Close
3201*/
3202SW_SETTINGS_Close:
3203 call SW_SETTINGS_Fini
3204return
3205
3206/*:VRX SW_SETTINGS_Create
3207*/
3208SW_SETTINGS_Create:
3209 call SW_SETTINGS_Init
3210
3211 CALL NLVSetText 'DT_Refresh', 'Caption', 25
3212 CALL NLVSetText 'DT_RefreshMin', 'Caption', 25
3213 ok = VRSet("DT_REFRESH","AutoSize", 1)
3214 ok = VRSet("DT_REFRESH","AutoSize", 0)
3215 ok = VRSet("DT_REFRESH","Height", 253)
3216 ok = VRSet("DT_REFRESHMIN","Width", VRGet("DT_REFRESH","width"))
3217
3218 ok = VRSet("SPIN_Intervall","Left",VRGet("DT_REFRESH","Left")+VRGet("DT_REFRESH","Width")+marginx2)
3219 ok = VRSet("SPIN_IntervallMin","Left",VRGet("DT_REFRESH","Left")+VRGet("DT_REFRESH","Width")+marginx2)
3220
3221 CALL NLVSetText 'DT_Intervall', 'Caption', 26
3222 ok = VRSet("DT_IntervallMin", "Caption", NLVGetMessage(26)', 'NLVGetMessage(28))
3223 ok = VRSet("DT_IntervallMin","AutoSize", 1)
3224 ok = VRSet("DT_IntervallMin","AutoSize", 0)
3225 ok = VRSet("DT_IntervallMin","Height", 253)
3226
3227 ok = VRSet("DT_Intervall", "Left",VRGet("SPIN_Intervall","Left")+VRGet("SPIN_Intervall","Width")+marginx2)
3228 ok = VRSet("DT_IntervallMin","Left",VRGet("SPIN_Intervall","Left")+VRGet("SPIN_Intervall","Width")+marginx2)
3229
3230 CALL NLVSetText 'CB_NoMsgBox', 'Caption', 27
3231 CALL NLVSetText 'CB_WPSSTARTSTOP', 'Caption', 29
3232 CALL NLVSetText 'CB_DetectZombies','Caption', 30
3233
3234 CALL NLVSetText 'DT_FONTSIZE', 'Caption', 97
3235 CALL NLVSetText 'ICB_CHOOSE', 'Caption', 98
3236 CALL NLVSetText 'ICB_DELLOGS', 'Caption', 99
3237
3238 log_level = IniGet('log level', 'global', samba.!smbconf)
3239 log_file = IniGet('log file', 'global', samba.!smbconf)
3240 log_file = translate(log_file,'\','/')
3241 max_protocol = IniGet('max protocol', 'global', samba.!smbconf)
3242 max_log_size = IniGet('max log size', 'global', samba.!smbconf)
3243
3244 if log_level = "" then log_level = 2
3245 if max_protocol = "" then max_protocol = "NT1"
3246
3247 ok = VRSet("SPIN_LOG_LEVEL","Value",log_level)
3248 ok = VRSet("SPIN_MAX_LOG_SIZE","Value",max_log_size)
3249 ok = VRSet("SPIN_MAX_PROTOCOL","Value",max_protocol)
3250 ok = VRSet("EF_LOG_FILE","Value",log_file)
3251 ok = VRSet("EF_LOG_FILE","Width",length(log_file) * 100 + 300)
3252 ok = VRSet("DT_FREESPACE","Left",VRGet("EF_LOG_FILE","Width")+VRGet("EF_LOG_FILE","Left") + marginx2)
3253 ok = VRSet("ICB_DELLOGS","Left",VRGet("DT_FREESPACE","Left"))
3254
3255 ok = VRSet("DT_FONTSIZE","AutoSize", 1)
3256 ok = VRSet("DT_FONTSIZE","AutoSize", 0)
3257 ok = VRSet("DT_FONTSIZE","Height", 253)
3258 ok = VRSet("SPIN_FONTSIZE", "Left", VRGet("DT_FONTSIZE","Left")+VRGet("DT_FONTSIZE","Width")+marginx2)
3259
3260 CALL VRMethod 'TT_SETTINGS', 'Register', 'ICB_CHOOSE', NLVGetMessage(95)
3261 CALL VRMethod 'TT_SETTINGS', 'Register', 'ICB_DELLOGS', NLVGetMessage(96)
3262 CALL VRMethod 'TT_SETTINGS', 'Register', 'DT_LOG_LEVEL', samba.!smbconf
3263 CALL VRMethod 'TT_SETTINGS', 'Register', 'SPIN_LOG_LEVEL', samba.!smbconf
3264 CALL VRMethod 'TT_SETTINGS', 'Register', 'DT_LOG_FILE', samba.!smbconf
3265 CALL VRMethod 'TT_SETTINGS', 'Register', 'EF_LOG_FILE', samba.!smbconf
3266 CALL VRMethod 'TT_SETTINGS', 'Register', 'DT_MAX_LOG_SIZE', samba.!smbconf
3267 CALL VRMethod 'TT_SETTINGS', 'Register', 'SPIN_MAX_LOG_SIZE', samba.!smbconf
3268 CALL VRMethod 'TT_SETTINGS', 'Register', 'DT_MAX_PROTOCOL', samba.!smbconf
3269 CALL VRMethod 'TT_SETTINGS', 'Register', 'SPIN_MAX_PROTOCOL', samba.!smbconf
3270
3271 call _SambaCheckFreeSpace
3272return
3273
3274/*:VRX SW_SETTINGS_Fini
3275*/
3276SW_SETTINGS_Fini:
3277 window = VRInfo( "Window" )
3278 call VRDestroy window
3279 drop window
3280return
3281/*:VRX SW_SETTINGS_Init
3282*/
3283SW_SETTINGS_Init:
3284 window = VRInfo( "Object" )
3285 if( \VRIsChildOf( window, "TDL" ) ) then do
3286 call VRMethod window, "CenterWindow"
3287 call VRSet window, "Visible", 1
3288 call VRMethod window, "Activate"
3289 end
3290 drop window
3291return
3292
3293/*:VRX SW_SMBTREE_Close
3294*/
3295SW_SMBTREE_Close:
3296 call SW_SMBTREE_Fini
3297return
3298
3299/*:VRX SW_SMBTREE_Create
3300*/
3301SW_SMBTREE_Create:
3302 call SW_SMBTREE_Init
3303return
3304
3305/*:VRX SW_SMBTREE_Fini
3306*/
3307SW_SMBTREE_Fini:
3308 window = VRInfo( "Window" )
3309 call VRDestroy window
3310 drop window
3311return
3312/*:VRX SW_SMBTREE_Init
3313*/
3314SW_SMBTREE_Init:
3315 window = VRInfo( "Object" )
3316 if( \VRIsChildOf( window, "TDL" ) ) then do
3317 call VRMethod window, "CenterWindow"
3318 call VRSet window, "Visible", 1
3319 call VRMethod window, "Activate"
3320 end
3321 drop window
3322return
3323
3324/*:VRX SW_SMBTREE_Init_Content
3325*/
3326SW_SMBTREE_Init_Content:
3327 ok = VRset("Pict_Throbber", "Visible", 1)
3328 ok = VRset("TM_Throbber", "Enabled", 1)
3329 call _RefreshTree
3330return
3331
3332/*:VRX SW_SORT_Close
3333*/
3334SW_SORT_Close:
3335 call SW_SORT_Fini
3336return
3337
3338/*:VRX SW_SORT_Create
3339*/
3340SW_SORT_Create:
3341 call SW_SORT_Init
3342
3343 CALL NLVSetText 'SW_SORT', 'Caption', 35
3344 CALL NLVSetText 'PB_Sort_OK', 'Caption', 2
3345 CALL NLVSetText 'PB_Sort_Cancel', 'Caption', 3
3346
3347 CALL NLVSetText 'RB_Sort_Ascending', 'Caption', 90
3348 CALL NLVSetText 'RB_Sort_Descending', 'Caption', 91
3349 CALL NLVSetText 'RB_Sort_None', 'Caption', 92
3350
3351 Container = OH
3352say OH
3353say Container
3354 ok = VRMethod(Container, "GetFieldList", "Fields." )
3355
3356 SortOrder = "None"
3357
3358 do I = 1 to Fields.0
3359 ok = VRMethod("LB_SortFields","AddString", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
3360 end
3361 Old.SortField = VRGet( Container, "DetailSort" )
3362 Old.SortOrder = VRGet( Container, "Sort" )
3363say Old.SortField
3364say Old.SortOrder
3365return
3366
3367/*:VRX SW_SORT_Fini
3368*/
3369SW_SORT_Fini:
3370 window = VRInfo( "Window" )
3371 call VRDestroy window
3372 drop window
3373return
3374/*:VRX SW_SORT_Init
3375*/
3376SW_SORT_Init:
3377 window = VRInfo( "Object" )
3378 if( \VRIsChildOf( window, "Notebook" ) ) then do
3379 call VRMethod window, "CenterWindow"
3380 call VRSet window, "Visible", 1
3381 call VRMethod window, "Activate"
3382 end
3383 drop window
3384return
3385
3386/*:VRX SW_USERS_Close
3387*/
3388SW_USERS_Close:
3389 call SW_USERS_Fini
3390return
3391
3392/*:VRX SW_USERS_Create
3393*/
3394SW_USERS_Create:
3395 call SW_USERS_Init
3396 CALL VRMethod 'TT_USERS', 'Register', 'CN_USERS', NLVGetMessage(67)
3397return
3398
3399/*:VRX SW_USERS_Fini
3400*/
3401SW_USERS_Fini:
3402 window = VRInfo( "Window" )
3403 call VRDestroy window
3404 drop window
3405return
3406/*:VRX SW_USERS_Init
3407*/
3408SW_USERS_Init:
3409 window = VRInfo( "Object" )
3410 if( \VRIsChildOf( window, "Notebook" ) ) then do
3411 call VRMethod window, "CenterWindow"
3412 call VRSet window, "Visible", 1
3413 call VRMethod window, "Activate"
3414 end
3415 drop window
3416return
3417
3418/*:VRX TDL_1_PageSelected
3419*/
3420TDL_1_PageSelected:
3421 page = VRInfo("Page")
3422 CurrentPageNr = page
3423 ok = VRSet("TM_RefreshDaemons","Enabled", 0)
3424 ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
3425
3426 ok = VRSet("CN_DAEMONS", "Visible", 0)
3427 ok = VRSet("ICB_START", "Visible", 0)
3428 ok = VRSet("ICB_STOP", "Visible", 0)
3429 ok = VRSet("ICB_RESTART","Visible", 0)
3430 ok = VRSet("ICB_RELOAD", "Visible", 0)
3431
3432 ok = VRSet("CN_SMBTREE","Visible", 0)
3433 ok = VRSet("CN_USERS", "Visible", 0)
3434 ok = VRSet("CN_FILES", "Visible", 0)
3435 ok = VRSet("CN_SERVICE","Visible", 0)
3436 ok = VRSet("CN_CHKTDB", "Visible", 0)
3437
3438 ok = VRSet("GB_SETTINGS", "Visible", 0)
3439 ok = VRSet("ICB_CHOOSE", "Visible", 0)
3440 ok = VRSet("ICB_DELLOGS", "Visible", 0)
3441 ok = VRSet('ICB_CHOOSE', "Visible", 0)
3442 ok = VRSet('ICB_DELLOGS', "Visible", 0)
3443 ok = VRSet('DT_LOG_LEVEL', "Visible", 0)
3444 ok = VRSet('SPIN_LOG_LEVEL', "Visible", 0)
3445 ok = VRSet('DT_LOG_FILE', "Visible", 0)
3446 ok = VRSet('EF_LOG_FILE', "Visible", 0)
3447 ok = VRSet('DT_MAX_LOG_SIZE', "Visible", 0)
3448 ok = VRSet('SPIN_MAX_LOG_SIZE', "Visible", 0)
3449 ok = VRSet('DT_MAX_PROTOCOL', "Visible", 0)
3450 ok = VRSet('SPIN_MAX_PROTOCOL', "Visible", 0)
3451
3452 select
3453 when page = 1 then do /* daemons */
3454 ok = VRSet("CN_DAEMONS","Visible", 1)
3455 ok = VRSet("ICB_START", "Visible", 1)
3456 ok = VRSet("ICB_STOP", "Visible", 1)
3457 ok = VRSet("ICB_RESTART","Visible", 1)
3458 ok = VRSet("ICB_RELOAD", "Visible", 1)
3459 ok = VRSet("Main","WindowIcon","$46")
3460 ok = VRSet("TM_RefreshDaemons","Enabled", 1)
3461 ok = VRSet("TM_RefreshDaemons","Delay", 3000)
3462 end
3463 when page = 2 then do /* smbtree */
3464 ok = VRSet("CN_SMBTREE","Visible", 1)
3465 ok = VRSet("Main","WindowIcon","$1")
3466 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "All", "handle." )
3467 /* if the page is empty, populate it */
3468 if handle.0 = 0 then call ICB_REFRESH_Click
3469 end
3470 when page = 3 then do /* Users */
3471 ok = VRSet("CN_USERS","Visible", 1)
3472 ok = VRSet("Main","WindowIcon","$44")
3473 end
3474 when page = 4 then do /* files */
3475 ok = VRSet("CN_FILES", "Visible", 1)
3476 ok = VRSet("Main","WindowIcon","$1")
3477 end
3478 when page = 5 then do /* service */
3479 ok = VRSet("CN_SERVICE","Visible", 1)
3480 ok = VRSet("Main","WindowIcon","$52")
3481 end
3482 when page = 6 then do /* chkTDB */
3483 ok = VRSet("CN_CHKTDB", "Visible", 1)
3484 ok = VRSet("Main","WindowIcon","$53")
3485 say "ChkTDB"
3486 call _ChkTDB
3487 end
3488 when page = 7 then do /* Settings */
3489 ok = VRSet("GB_SETTINGS", "Visible", 1)
3490 ok = VRSet("ICB_CHOOSE", "Visible", 1)
3491 ok = VRSet("ICB_DELLOGS", "Visible", 1)
3492 ok = VRSet('DT_LOG_LEVEL', "Visible", 1)
3493 ok = VRSet('SPIN_LOG_LEVEL', "Visible", 1)
3494 ok = VRSet('DT_LOG_FILE', "Visible", 1)
3495 ok = VRSet('EF_LOG_FILE', "Visible", 1)
3496 ok = VRSet('DT_MAX_LOG_SIZE', "Visible", 1)
3497 ok = VRSet('SPIN_MAX_LOG_SIZE', "Visible", 1)
3498 ok = VRSet('DT_MAX_PROTOCOL', "Visible", 1)
3499 ok = VRSet('SPIN_MAX_PROTOCOL', "Visible", 1)
3500 ok = VRSet("Main","WindowIcon", "$53")
3501 end
3502 otherwise nop
3503 end
3504return
3505
3506/*:VRX TM_Refresh_Trigger
3507*/
3508TM_Refresh_Trigger:
3509/* call beep 1200, 20 */
3510 ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
3511 if _VIOFontSizeGetCurrent() <> OldFontSize then ok = _VIOFontSizeSetCurrent(OldFontSize)
3512 call _Refresh
3513return
3514
3515/*:VRX TM_RefreshDaemons_Trigger
3516*/
3517TM_RefreshDaemons_Trigger:
3518 ok = VRSet("TM_RefreshDaemons","Delay", 3000)
3519 call _RefreshDaemons
3520 call _AddSharesDisplay
3521return
3522
3523/*:VRX TM_RefreshTreeDisplay_Trigger
3524*/
3525TM_RefreshTreeDisplay_Trigger:
3526 select
3527 when RefreshMode = "TREE" then do
3528 call _RefreshTreeDisplay
3529 end
3530 when RefreshMode = "SHARE" then do
3531 call _AddSharesDisplay
3532 end
3533 otherwise say "RefreshMode = "RefreshMode
3534 end
3535return
3536
3537/*:VRX TM_STATUSBAR_Trigger
3538*/
3539TM_STATUSBAR_Trigger:
3540 call _StatusBarReset
3541return
3542
3543/*:VRX TM_Throbber_Trigger
3544*/
3545TM_Throbber_Trigger:
3546 pIdx = VRGet("Pict_Throbber","PicturePath")
3547 parse var pIdx '#' pidx
3548 pidx = pidx + 1
3549 if pidx = 122 then pidx = 111
3550 ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
3551return
3552
Note: See TracBrowser for help on using the repository browser.