source: trunk/guitools/evfsgui/evfsgui.vrx@ 1010

Last change on this file since 1010 was 1009, checked in by Alex Taylor, 9 years ago

Enable use of different program name (for WPS objects, configuration files, etc.) if optional message is defined.

File size: 216.2 KB
Line 
1/*:VRX Main
2*/
3/* Main
4*/
5Main:
6/*
7 Samba Connections GUI for OS/2 based systems
8 Copyright (C) 2007-2016 by Alexander Taylor and Herwig Bauernfeind
9 Derived works must contain this copyright notice.
10
11 This program is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
23*/
24/* Process the arguments.
25 Get the parent window.
26*/
27 parse source . calledAs .
28 parent = ""
29 argCount = arg()
30 argOff = 0
31 if( calledAs \= "COMMAND" )then do
32 if argCount >= 1 then do
33 parent = arg(1)
34 argCount = argCount - 1
35 argOff = 1
36 end
37 end; else do
38 call VROptions 'ImplicitNames'
39 call VROptions 'NoEchoQuit'
40 end
41 InitArgs.0 = argCount
42 if( argCount > 0 )then do i = 1 to argCount
43 InitArgs.i = arg( i + argOff )
44 end
45 drop calledAs argCount argOff
46
47/* Load the windows
48*/
49 call VRInit
50 parse source . . spec
51 _VREPrimaryWindowPath = ,
52 VRParseFileName( spec, "dpn" ) || ".VRW"
53 _VREPrimaryWindow = ,
54 VRLoad( parent, _VREPrimaryWindowPath )
55 drop parent spec
56 if( _VREPrimaryWindow == "" )then do
57 call VRMessage "", "Cannot load window:" VRError(), ,
58 "Error!"
59 _VREReturnValue = 32000
60 signal _VRELeaveMain
61 end
62
63/* Process events
64*/
65 call Init
66 signal on halt
67 do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
68 _VREEvent = VREvent()
69 interpret _VREEvent
70 end
71_VREHalt:
72 _VREReturnValue = Fini()
73 call VRDestroy _VREPrimaryWindow
74_VRELeaveMain:
75 call VRFini
76exit _VREReturnValue
77
78VRLoadSecondary:
79 __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
80 if __vrlsWait then do
81 call VRFlush
82 end
83 __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
84 if __vrlsHWnd = '' then signal __vrlsDone
85 if __vrlsWait \= 1 then signal __vrlsDone
86 call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
87 __vrlsTmp = __vrlsWindows.0
88 if( DataType(__vrlsTmp) \= 'NUM' ) then do
89 __vrlsTmp = 1
90 end
91 else do
92 __vrlsTmp = __vrlsTmp + 1
93 end
94 __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
95 __vrlsWindows.0 = __vrlsTmp
96 do while( VRIsValidObject( VRWindow() ) = 1 )
97 __vrlsEvent = VREvent()
98 interpret __vrlsEvent
99 end
100 __vrlsTmp = __vrlsWindows.0
101 __vrlsWindows.0 = __vrlsTmp - 1
102 call VRWindow __vrlsWindows.__vrlsTmp
103 __vrlsHWnd = ''
104__vrlsDone:
105return __vrlsHWnd
106
107/*:VRX __VXREXX____APPENDS__
108*/
109__VXREXX____APPENDS__:
110/*
111#append ..\shared\cltinit.vrs
112#append ..\shared\inittempdir.vrs
113#append ..\shared\nlv.vrs
114#append ..\shared\rexx_md5.vrs
115#append ..\shared\smbtree.vrs
116#append ..\shared\textini.vrs
117#append ..\shared\usercredmem.vrs
118#append ..\shared\rxrpclib.vrs
119*/
120return
121/*:VRX _AboutSambaClientGetInfo
122*/
123_AboutSambaClientGetInfo:
124 call VRSet "SW_ABOUT", "Painting", 0
125 BR = ''
126
127 ok = VRMethod( "CN_About", "RemoveRecord", "All" )
128
129 /* OS Version */
130 if VRFileExists(SysBootDrive()||"\SYS\INSTALL\INSTALL.FLG" ) then do
131 OS = linein(SysBootDrive()||"\SYS\INSTALL\INSTALL.FLG")
132 OS = subword(OS,1,2) '('translate(word(OS,3))')'
133 ok = stream(SysBootDrive()||"\SYS\INSTALL\INSTALL.FLG",'c','close')
134 end
135 else if VRFileExists(SysBootDrive()||"\ECS\ECS_INST.FLG" ) then do
136 OS = linein(SysBootDrive()||"\ECS\ECS_INST.FLG")
137 OS = subword(OS,1,3)
138 ok = stream(SysBootDrive()||"\ECS\ECS_INST.FLG",'c','close')
139 end
140 else OS = "OS/2 Warp/eComStation 1.x"
141
142 DummyRH = VRMethod('CN_About', 'AddRecord')
143 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Operating system", About.ValFH, OS)
144
145 /* Filesystem version */
146 DummyRH = VRMethod('CN_About', 'AddRecord')
147 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "File system", About.ValFH, fs.!name' Version 'fs.!version)
148 ABoutStr = "Samba Client Versions:"||BR
149 AboutStr = AboutStr||'0D0A'x||"File system "||'09'x||fs.!name' Version 'fs.!version||BR
150 plugindll. =""
151
152 /* Plugin */
153 address cmd 'look4dll.exe ndpsmb.dll >'samba.!msg
154 if RC <> 0 then do
155 /* Look4DLL not installed or failed, try fallback search */
156 if rc == 1041 then do /* look4dll not found, use REXX-based search */
157 pluginpath = _DLLSearch('ndpsmb.dll')
158 if pluginpath <> '' then do
159 plugindll.0 = 1
160 plugindll.1 = pluginpath
161 end
162 end
163 else plugindll.0 = 0
164 /* DLL is not in libpath; as a last resort, check some well-known places */
165 if plugindll.0 < 1 then do
166 NDFSDir = value("NDFSDIR",,"OS2ENVIRONMENT")
167 if NDFSDir = "" then do
168 OSDir = value("OSDIR",,"OS2ENVIRONMENT")
169 if OSDir == '' then OSDir = SysBootDrive()'\os2'
170 NDFSDir = OSDir'\dll'
171 end
172 ok = SysFileTree(NDFSDir'\ndpsmb.dll', "plugindll.", 'FOS')
173 end
174 end
175 else do
176 pluginline = linein(samba.!msg)
177 ok = stream(samba.!msg,'c','close')
178 ok = SysFileDelete(samba.!msg)
179 parse var pluginline . 'loaded ' pluginline
180 NDFSDir = VRParseFileName(pluginline,"DP")
181 plugindll.0 = 1
182 plugindll.1 = pluginline
183 end
184
185 if plugindll.0 > 0 then do
186 do J = 1 to plugindll.0
187 DummyRH.1 = VRMethod('CN_About', 'AddRecord')
188 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH.1, About.DscFH, "Plugin file", About.ValFH, plugindll.J)
189 AboutStr = AboutStr||'0D0A'x||"Plugin file "||'09'x||plugindll.J||BR
190
191 address cmd 'bldlevel.exe 'plugindll.J' >'samba.!msg
192
193 I = 0
194 Dummy = linein(samba.!msg)
195 say Dummy
196 Dummy = linein(samba.!msg)
197 say Dummy
198 Dummy = linein(samba.!msg)
199 say Dummy
200 do until lines(samba.!msg) = 0
201 I = I + 1
202 line.I = linein(samba.!msg)
203 if pos('has no LAN component-style version string', line.I) > 0 then do
204 DummyRH = VRMethod('CN_About', 'AddRecord')
205 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Error", About.ValFH, "Plugin has no LAN component-style version string")
206 leave
207 end
208 else do
209 parse var line.I desc':'vers
210 DummyRH = VRMethod('CN_About', 'AddRecord')
211 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Plugin "Desc, About.ValFH, strip(Vers))
212 AboutStr = AboutStr||'0D0A'x||"Plugin "Desc '09'x||strip(Vers)||BR
213 end
214 end
215 line.0 = I
216 ok = stream(samba.!msg,'c','close')
217 ok = SysFileDelete(samba.!msg)
218 end
219 end
220 else do
221 DummyRH = VRMethod('CN_About', 'AddRecord')
222 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Plugin", About.ValFH, "Not found!")
223 AboutStr = AboutStr||'0D0A'x||"Plugin not found!"||BR
224 end
225
226 /* Commandline utilities */
227 address cmd samba.!smbclientexe' -V >'samba.!msg
228 ClutVer = linein(samba.!msg)
229 ok = stream(samba.!msg,'c','close')
230 ok = SysFileDelete(samba.!msg)
231
232 DummyRH = VRMethod('CN_About', 'AddRecord')
233 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Commandline utility path", About.ValFH, VRParseFileName(samba.!smbclientexe,"DP"))
234
235 DummyRH = VRMethod('CN_About', 'AddRecord')
236 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, "Commandline utilities", About.ValFH, ClutVer)
237 AboutStr = AboutStr||'0D0A'x||"Commandline utilities "||'09'x||ClutVer||BR
238
239 /* GUI Version */
240 DummyRH = VRMethod('CN_About', 'AddRecord')
241 ok = VRMethod("CN_ABOUT", "SetFieldData", DummyRH, About.DscFH, options.!appname_long, About.ValFH, VRGet("Main", "HintText"))
242 AboutStr = AboutStr||'0D0A'x||"options.!appname_long "||'09'x || VRGet("Main", "HintText")||BR
243 call VRSet "SW_ABOUT", "Painting", 1
244return
245
246/*:VRX _AddTemplates
247*/
248_AddTemplates:
249 VolTplRH = VRMethod("CN_CURRENT", 'AddRecord', , 'First', 'Volume template', icons.!template )
250 MpTplRH = VRMethod("CN_CURRENT", 'AddRecord', VolTplRH, 'First', 'Mountpoint template', icons.!template )
251return
252
253/*:VRX _BrowseBuildPath
254*/
255_BrowseBuildPath: procedure expose options. icons. samba. sharerh
256 if options.!debug == 1 then say time()' _BrowseBuildPath started'
257 rh = arg(1)
258
259 finished = 0
260 BrowsePathStr = ''
261
262 do while \finished
263 parentrh = VRMethod("CN_SMBTREE","GetRecordAttr",rh,"Parent")
264 resname = VRMethod("CN_SMBTREE","GetRecordAttr",rh,"caption")
265 userdata = VRMethod("CN_SMBTREE","GetRecordAttr",rh,"userdata")
266 parse var userdata udatatype '|' udatamsg
267 parse var resname resname '0D0A'x .
268 resname = strip(resname)
269 /* say " Not connected - cannot open!" */
270 select
271 when udatatype = "SERVER" then do
272 BrowsePathStr = '\\'resname'\'BrowsePathStr
273 finished = 1
274 end
275 when udatatype = "DISK" then do
276 BrowsePathStr = resname'\'BrowsePathStr
277 sharerh =rh
278 rh = parentrh
279 end
280 otherwise do
281 BrowsePathStr = resname'\'BrowsePathStr
282 rh = parentrh
283 end
284 end
285 /* say ' BrowsePathStr = "'BrowsePathStr'"' */
286 end
287 BrowsePathStr = strip(BrowsePathStr,'T','\')
288 if options.!debug == 1 then say time()' _BrowseBuildPath done, returning "'BrowsePathStr'"'
289return BrowsePathStr
290
291/*:VRX _BrowseDirectory
292*/
293_BrowseDirectory: /* This must not be a procedure */
294 if options.!debug == 1 then say time()' _BrowseDirectory started'
295
296 /* Turn off painting */
297 ok = VRSet("CN_SMBTREE","Painting", 0 )
298 call VRSet VRWindow(), 'Pointer', 'Wait'
299
300 /* Make sure credentials are usable */
301 if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
302
303 /* We have to remove the double % for smbclient.exe - not entirely clear why */
304 OldUserCred = ""
305 if pos('%%',UserCred) > 0 & pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 0 then do
306 OldUserCred = UserCred
307 parse var UserCred '--user='username'%%'password
308 UserCred = '--user='username'%'password
309 say " Strip double %%!!!"
310 end
311
312 say ' 'samba.!smbclientexe' \\'machine'\'sharename' 'UserCred' --command="dir 'browsepath'"'
313 address cmd samba.!smbclientexe' \\'machine'\'sharename' 'UserCred' --command="dir 'browsepath'" 'debuglevel' 2>NUL 1>'samba.!msg
314
315 if UserCred = '-N' then UserCred = ''
316
317 if OldUserCred <> "" then do
318 UserCred = OldUserCred
319 OldUserCred = ""
320 say " Restore double %%!!!"
321 end
322
323 I = 0
324 ok = VRSet("DT_STATUSBAR","Caption", "")
325 do until lines(samba.!msg) = 0
326 infoline = linein(samba.!msg)
327 select
328 when pos('blocks',infoline) > 0 then do /* Last line */
329 /* we should handle size information here */
330 iterate
331 end
332 when I = 0 & length(infoline) > 0 & left(infoline,2) <> " " then do /* Login message */
333 say ' Login message "'Infoline'"'
334 ok = VRMethod("CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Userdata", SMBObj.udatatype'|'infoline )
335 ok = VRSet("DT_STATUSBAR","Caption", infoline)
336 end
337 when left(infoline,2) = " " & length(infoline) > 0 then do /* file or DIR */
338 wn = words(infoline)
339 fyear = word(infoline,wn)
340 ftime = word(infoline,wn-1)
341 fday = word(infoline,wn-2)
342 fmonth = word(infoline,wn-3)
343 fwday = word(infoline,wn-4)
344 pos_attr = pos(fwday,infoline)-16
345 fsize = word(infoline,wn-5)
346 fattr = substr(infoline,pos_attr,6)
347 fname = strip( substr(infoline,3,pos_attr-3))
348 if fname = '.' | fname = '..' then iterate /* we do not display these */
349 if pos('H',fattr) > 0 then iterate /* we do not display hidden files */
350 if pos('S',fattr) > 0 then iterate /* we do not display system files */
351 I = I + 1
352 fh.I = VRMethod( "CN_SMBTREE", "AddRecord", SMBObj.rh, , fname)
353 if pos('D',fattr) = 0 then do
354 Ext = translate(VRParseFIleName(fname,'E'))
355 select
356 when Ext = 'EXE' then ficon = icons.!exe /* executable */
357 when Ext = 'CMD' then ficon = icons.!cmd /* OS/2 or NT batch */
358 when Ext = 'BAT' then ficon = icons.!bat /* DOS batch */
359 when Ext = 'PDF' then ficon = icons.!pdf /* PDF document */
360 when wordpos(Ext, 'XLS SXC ODS') > 0 then ficon = icons.!spreadsheet
361 when wordpos(Ext, 'DOC SXW ODT') > 0 then ficon = icons.!textdocument
362 when wordpos(Ext, 'FW2 FW3 FW4') > 0 then ficon = icons.!framework
363 when wordpos(Ext, 'JPG BMP PNG GIF TIF') > 0 then ficon = icons.!image
364 when wordpos(Ext, 'AVI MPG FLV WMV') > 0 then ficon = icons.!movie
365 when wordpos(Ext, 'WAV MP3 OGG MID') > 0 then ficon = icons.!sound
366 when wordpos(Ext, 'WPI') > 0 then ficon = icons.!warpin
367 when wordpos(Ext, 'ZIP') > 0 then ficon = icons.!zip
368 when wordpos(Ext, 'INF HLP') > 0 then ficon = icons.!view
369 when wordpos(Ext, 'TXT') > 0 then ficon = icons.!plaintext
370 otherwise ficon = icons.!defaultfile /* default file icon */
371 end
372 ftype = 'FILE'
373 end
374 else do
375 ficon = icons.!folder
376 ftype = 'DIRECTORY'
377 end
378
379 ok = VRmethod("CN_SMBTREE", "SetRecordAttr", fh.I, "userdata", ftype'|'fsize' Bytes 'fday'-'fmonth'-'fyear' 'ftime,'icon',Ficon)
380
381 end
382 otherwise nop /* no other line type */
383 end
384 end
385 if I > 0 then ok = VRMethod("CN_SMBTREE","SetRecordAttr",SMBObj.rh, "Icon", icons.!folder_open)
386 ok = stream(samba.!msg,'c','close')
387 ok = SysFileDelete(samba.!msg)
388
389 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh,"Collapsed", 0)
390 /* Turn on painting */
391 call VRSet VRWindow(), 'Pointer', '<default>'
392 ok = VRSet("CN_SMBTREE","Painting", 1 )
393 if options.!debug == 1 then say time()' _BrowseDirectory done'
394return
395
396/*:VRX _BrowseObjectOpen
397*/
398_BrowseObjectOpen: procedure expose samba. options. cd. icons.
399 machine = arg(1)
400 sharename = arg(2)
401 browsepath = arg(3)
402
403 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
404
405 OpenOk = 0
406
407 DO i = 1 TO records.0
408 if VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.StatusFH) = icons.!active then do
409 if options.!debug == 1 then say ' 'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.StatusFH)' 'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.MPointFH)' 'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ServerFH)' 'VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ShareFH)
410 if machine = VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ServerFH) &,
411 sharename = VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.ShareFH) then do
412 Object = strip(VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.MPointFH),'T','\')'\'browsepath
413 if options.!debug == 1 then say ' Non UNC object: "'Object'"'
414 ID = VRMethod( "Application", "StartThread", "wps_open", Object, "DEFAULT" )
415 OpenOK = 1
416 end
417 end
418 if OpenOK = 1 then leave
419 end
420return OpenOK
421
422/*:VRX _BrowseResetObject
423*/
424_BrowseResetObject: procedure
425 ok = VRSet("CN_SMBTREE","Painting", 0 )
426 rh = arg(1)
427
428 /* Remove all files and directories whose parent is our share */
429 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "All", "AllRH." )
430 do I = 1 to AllRH.0
431 AllParentRH = VRMethod("CN_SMBTREE","GetRecordAttr",AllRH.I,"Parent")
432 if AllParentRH = rh then ok = VRMethod( "CN_SMBTREE", "RemoveRecord", AllRH.I )
433 end
434 ok = VRSet("CN_SMBTREE","Painting", 1 )
435return
436
437/*:VRX _ContainersInit
438*/
439_ContainersInit:
440 if options.!debug == 1 then say time()' _ContainersInit started'
441 /* Connection details */
442 CD.StatusFH = VRMethod( "CN_CONDET", "AddField", "Icon", "Status" )
443 CD.mpointFH = VRMethod( "CN_CONDET", "AddField", "String", "mpoint" )
444 CD.mpidxFH = VRMethod( "CN_CONDET", "AddField", "String", "index" )
445 CD.workgrpFH = VRMethod( "CN_CONDET", "AddField", "String", "workgroup" )
446 CD.serverFH = VRMethod( "CN_CONDET", "AddField", "String", "server" )
447 CD.shareFH = VRMethod( "CN_CONDET", "AddField", "String", "share" )
448 CD.userFH = VRMethod( "CN_CONDET", "AddField", "String", "user" )
449 CD.passwordFH = VRMethod( "CN_CONDET", "AddField", "String", "password" )
450 CD.spasswordFH = VRMethod( "CN_CONDET", "AddField", "String", "spassword" )
451 CD.masterFH = VRMethod( "CN_CONDET", "AddField", "String", "master" )
452 CD.mtypeFH = VRMethod( "CN_CONDET", "AddField", "String", "mastertype" )
453 CD.memlenFH = VRMethod( "CN_CONDET", "AddField", "String", "memlen" )
454 CD.easupportFH = VRMethod( "CN_CONDET", "AddField", "String", "easupport" )
455 CD.logfileFH = VRMethod( "CN_CONDET", "AddField", "String", "logfile" )
456 CD.loglevelFH = VRMethod( "CN_CONDET", "AddField", "String", "loglevel" )
457 CD.rwFH = VRMethod( "CN_CONDET", "AddField", "String", "readonly" )
458 CD.ctoFH = VRMethod( "CN_CONDET", "AddField", "String", "cachetimeout" )
459 CD.cldFH = VRMethod( "CN_CONDET", "AddField", "String", "cachelistings" )
460 CD.hashFH = VRMethod( "CN_CONDET", "AddField", "String", "hash" )
461
462 /* Connection details */
463 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", options.!debug)
464 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", options.!debug)
465 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", options.!debug)
466 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", options.!debug)
467 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", options.!debug)
468 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", options.!debug)
469 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", options.!debug)
470 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", options.!debug)
471 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", options.!debug)
472
473 ok = VRSet("CN_CONDET", "DetailSort", cd.mpointfh )
474
475 /* NLV columns */
476 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.statusfh , "Title", strip(NLVGetMessage(67),"T",":"))
477 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpointfh , "Title", strip(NLVGetMessage(27),"T",":"))
478 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.workgrpFH , "Title", strip(NLVGetMessage(21),"T",":"))
479 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.serverFH , "Title", strip(NLVGetMessage(19),"T",":"))
480 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.shareFH , "Title", strip(NLVGetMessage(20),"T",":"))
481 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.userFH , "Title", strip(NLVGetMessage(25),"T",":"))
482 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.ctoFH , "Title", strip(NLVGetMessage(130),"T",":"))
483 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.cldFH , "Title", strip(NLVGetMessage(131),"T",":"))
484 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.easupportFH , "Title", strip(NLVGetMessage(68),"T",":"))
485 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.rwfh , "Title", strip(NLVGetMessage(69),"T",":"))
486
487 /* SMBTree columns */
488 WorkgroupFH= VRMethod( "CN_smbtree", "AddField", "String", "Workgroup" )
489 NBFH = VRMethod( "CN_smbtree", "AddField", "String", "NetBIOS name" )
490 IpFH = VRMethod( "CN_smbtree", "AddField", "String", "IP" )
491 MBFH = VRMethod( "CN_smbtree", "AddField", "String", "Role" )
492 OSFH = VRMethod( "CN_smbtree", "AddField", "String", "OS" )
493 VersionFH = VRMethod( "CN_SmbTree", "AddField", "String", "Version" )
494 CommentFH = VRMethod( "CN_smbtree", "AddField", "String", "Comment" )
495 MacFH = VRMethod( "CN_smbtree", "AddField", "String", "MAC" )
496
497 ok = VRMethod("CN_smbtree","SetfieldAttr",IPFH, "ReadOnly", 1)
498 ok = VRMethod("CN_smbtree","SetfieldAttr",NBFH, "ReadOnly", 1)
499 ok = VRMethod("CN_smbtree","SetfieldAttr",MBFH, "ReadOnly", 1)
500 ok = VRMethod("CN_smbtree","SetfieldAttr",WorkGroupFH,"ReadOnly", 1)
501 ok = VRMethod("CN_smbtree","SetfieldAttr",OSFH, "ReadOnly", 1)
502 ok = VRMethod("CN_smbtree","SetfieldAttr",MacFH, "ReadOnly", 1)
503
504 if options.!debug == 1 then say time()' _ContainersInit done'
505return
506/*:VRX _ContextMenuSelectedSet
507*/
508_ContextMenuSelectedSet:
509 /* Fixme: This routine only works for CN_SMBTREE right now */
510
511 /* Hide all context menu entries */
512 ok = VRSet("Menu_Selected_Remove", "Visible", 0) /* CN_CONDET */
513 ok = VRSet("Menu_Selected_Retry", "Visible", 0) /* CN_CONDET */
514 ok = VRSet("Menu_Selected_Connect", "Visible", 0) /* CN_SMBTREE */
515 ok = VRSet("Menu_Selected_Sep1", "Visible", 0) /* CN_SMBTREE */
516 ok = VRSet("Menu_Selected_Info", "Visible", 0) /* CN_SMBTREE */
517 ok = VRSet("Menu_Selected_TimeSync", "Visible", 0) /* CN_SMBTREE */
518 ok = VRSet("Menu_Selected_Refresh", "Visible", 0) /* CN_SMBTREE */
519 ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0) /* CN_SMBTREE */
520
521
522/* ok = VRSet("Menu_Selected_TreeView","Visible",1)
523 ok = VRSet("Menu_Selected_DetailsView","Visible",1)
524 */
525 select
526 when SMBObj.udatatype = "DISK" then do
527 ok = VRSet("Menu_Selected_Connect", "Visible", 1)
528 end
529 when SMBObj.udatatype = "SERVER" then do
530 ok = VRSet("Menu_Selected_Connect", "Visible", 1)
531 ok = VRSet("Menu_Selected_Sep1", "Visible", 1)
532 ok = VRSet("Menu_Selected_Info", "Visible", 1)
533 ok = VRSet("Menu_Selected_TimeSync", "Visible", 1)
534 ok = VRSet("Menu_Selected_Refresh", "Visible", 1)
535 end
536 when SMBObj.udatatype = "WORKGROUP" then do
537 ok = VRSet("Menu_Selected_Connect", "Visible", 1)
538 ok = VRSet("Menu_Selected_Sep1", "Visible", 1)
539 ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 1)
540 end
541 when SMBObj.udatatype = "PRINTER" then do
542 call _PrinterInfo
543 /* CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E' */
544 end
545 otherwise nop /* FILE DIRECTORY */
546 end
547return
548
549/*:VRX _CreateSmbConf
550*/
551_CreateSmbConf:
552 if options.!debug == 1 then say time()' '||"_CreateSmbConf started"
553 call lineout samba.!smbconf, '# Samba config file created using' options.!appname_long 'ver. 'word(VRGet("Main","Hinttext"),2)
554 call lineout samba.!smbconf, '# from 'value("USER",,'OS2ENVIRONMENT')'@'value("HOSTNAME",,'OS2ENVIRONMENT')
555 call lineout samba.!smbconf, '# Date: 'date()' 'time()
556 call lineout samba.!smbconf, '[global]'
557 if settings.!network <> '' then do
558 call lineout samba.!smbconf, '09'x||'workgroup = 'settings.!network
559 end
560 else do
561 call lineout samba.!smbconf, '09'x||'workgroup = WORKGROUP'
562 end
563 call lineout samba.!smbconf, '09'x||'log level = 0'
564 ok = stream(samba.!smbconf,'c','close')
565 if options.!debug == 1 then say time()' '||"_CreateSmbConf done"
566return
567
568/*:VRX _DaemonRunning
569*/
570_DaemonRunning: procedure expose fs.
571 ok = PRProcessList(proc)
572 PID = 0
573 do I = 1 to proc.0
574 CurProc = VRParseFileName(proc.i.name,'NE')
575 if CurProc = fs.!prefix"CTL.EXE" then do
576 PID = proc.i.pid
577 leave
578 end
579 end
580return PID
581
582/*:VRX _DelSMBObjectShares
583*/
584_DelSMBObjectShares: procedure expose samba. options. SMBObj. rh
585 /* Purpose: Delete shares for a given Object (as handle) */
586
587 rh = arg(1)
588
589 ok = VRMethod("CN_smbtree", "GetRecordList", "All", rh.)
590
591 do J = 1 to rh.0 /* populate shares with valid entries */
592 ParentRH = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Parent")
593
594 if ParentRH = rh then do /* we found a share belonging to our server */
595 ok = VRMethod("CN_SMBTree", "RemoveRecord", rh.J )
596 end
597 end
598 SmbObj.shares. = ''
599 SmbObj.shares.0 = 0
600return
601
602/*:VRX _DialogPopulate
603*/
604_DialogPopulate:
605
606 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "Visible", "rh." )
607
608 ok = VRMethod("EF_SHARE", "Reset")
609 ok = VRMethod("EF_SERVER", "Reset")
610 ok = VRMethod("EF_NETWORK", "Reset")
611
612 do I = 1 to rh.0
613
614 Userdata = VRMethod("CN_SMBTREE","GetRecordAttr",rh.I,"Userdata")
615 ResName = VRMethod("CN_SMBTREE","GetRecordAttr",rh.I,"Caption")
616
617 parse var ResName ResName '0D0A'x .
618 ResName = strip(ResName)
619 parse var userdata ResType '|' .
620
621 select
622 when ResType = "WORKGROUP" then ok = VRMethod("EF_NETWORK","AddString", ResName)
623 when ResType = "SERVER" then ok = VRMethod("EF_SERVER", "AddString", ResName)
624 when ResType = "DISK" then ok = VRMethod("EF_SHARE", "AddString", ResName)
625 otherwise nop
626 end
627 end
628
629return
630
631/*:VRX _DLLSearch
632*/
633_DLLSearch: PROCEDURE
634 PARSE ARG dname
635 _bd = SysBootDrive()
636
637 IF _bd == '' THEN
638 _bd = FILESPEC('DRIVE', VALUE('COMSPEC',,'OS2ENVIRONMENT'))
639 _csys = _bd'\CONFIG.SYS'
640
641 CALL SysFileSearch 'LIBPATH=', _csys, 'match.'
642 DO i = 1 TO match.0
643 PARSE UPPER VAR match.i _lead 'LIBPATH=' _lpath
644 IF (_lead == '') & (_lpath <> '') THEN LEAVE
645 END
646
647 _lpath = SysQueryExtLIBPATH('B') || ';'_lpath';' || SysQueryExtLIBPATH('E')
648
649 CALL SETLOCAL
650 _testenv = 'TEST_'dname'_LIBPATH'
651 CALL VALUE _testenv, _lpath, 'OS2ENVIRONMENT'
652 location = SysSearchPath( _testenv, dname )
653 CALL ENDLOCAL
654
655RETURN location
656
657/*:VRX _dropdeprecated
658*/
659_dropdeprecated:
660 /* The stem-less counterparts of these variables are considered deprecated and should be removed wherever possible
661 The _dropdeprecated routine will drop any value in order to make sure the stem actually works
662 If another variable is added to the stem, ensure to also drop it in dropdeprecated otherwise it will not be exported
663 */
664 drop rh
665 drop parentrh
666 drop gparentrh
667 drop icon
668 drop resname
669 drop comment
670 drop udatatype
671 drop udatamsg
672return
673
674/*:VRX _Dynamic
675*/
676_Dynamic:
677 dyn_code = arg(1)
678 if options.!debug == 1 then say ' Dynamic code: 'dyn_code
679 interpret dyn_code; drop dyn_code
680return
681
682/*:VRX _GetSMBObjectProperties
683*/
684_GetSMBObjectProperties: procedure expose samba. options. SMBObj. rh icon resname udatatype udatamsg parentrh icons.
685 if options.!debug == 1 then say time()' _GetSMBObjectProperties started'
686
687 /* Purpose of this subroutine:
688 The current SMB object's frequently used properties should be stored in a stem
689 SMBObj.rh = recordhandle of the object
690 SMBObj.resname = resourcename of the object
691 SMBObj.comment = commentstring of the object
692 SMBObj.icon = icon of the object
693 SMBObj.udatatype = type of object (WORKGROUP, SERVER, DISK, PRINTER, FILE, DIRECTORY)
694 SMBObj.udatamsg = arbitrary object related data (Login message, file properties)
695 SMBObj.parentrh = recordhandle of the object's parent
696 SMBObj.gparentrh = recordhandle of the object's grandparent
697
698 The stem-less counterparts of these variables are considered deprecated and should be removed wherever possible
699 The _dropdeprecated routine will drop any value in order to make sure the stem actually works
700 If another variable is added to the stem, ensure to also drop it in dropdeprecated otherwise it will not be exported
701 */
702 call _dropdeprecated
703
704 SMBObj. = ""
705 SMBObj.rh = arg(1)
706
707 if VRMethod( "CN_SMBTREE", "ValidateRecord", SMBObj.rh) <> 1 | SMBObj.rh = "" then do
708 if options.!debug == 1 then say time()' _GetSMBObjectProperties aborted'
709 return
710 end
711
712 SMBObj.Icon = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Icon")
713
714 SMBObj.parentrh = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Parent")
715 if SMBObj.parentrh = ""
716 then SMBObj.gparentrh = ""
717 else SMBObj.gparentrh = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Parent")
718
719 SMBObj.resname = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Caption")
720 parse var SMBObj.resname SMBObj.resname '0D0A'x SMBObj.comment
721 SMBObj.resname = strip(SMBObj.resname)
722 SMBObj.comment = strip(SMBObj.comment)
723
724 Userdata = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Userdata")
725 parse var userdata SMBObj.udatatype '|' SMBObj.udatamsg
726 SMBObj.udatatype = strip(SMBObj.udatatype)
727 SMBObj.udatamsg = strip(SMBObj.udatamsg)
728
729 if options.!debug == 1 then do
730 say ' Handle: "'SMBObj.rh'"'
731 say ' GParentrh "'SMBObj.gparentrh'"'
732 say ' Resource: "'SMBObj.resname'"'
733 say ' Comment: "'SMBObj.comment'"'
734 say ' Type: "'SMBObj.udatatype'"'
735 say ' Message: "'SMBObj.udatamsg'"'
736 say ' Icon: "'SMBObj.icon'"'
737 end
738
739 if options.!debug == 1 then say time()' _GetSMBObjectProperties done'
740return
741
742/*:VRX _GetSMBObjectShares
743*/
744_GetSMBObjectShares: procedure expose samba. options. SMBObj.
745 /* Purpose: Return stem with shares for a given Object (as handle) */
746
747 rh = arg(1)
748
749 SmbObj.shares. = ''
750 SmbObj.shares.0 = 0
751 I = 0
752 ok = VRMethod("CN_smbtree", "GetRecordList", "All", rh.)
753
754 do J = 1 to rh.0 /* populate shares with valid entries */
755 Userdata = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Userdata")
756 ResName = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Caption")
757 ParentRH = VRMethod("CN_SMBTREE","GetRecordAttr",rh.J,"Parent")
758
759 parse var ResName ResName '0D0A'x .
760 ResName = strip(ResName)
761 parse var userdata ResType '|' .
762
763 if ParentRH = rh then do /* we found a share belonging to our server */
764 if ResType = "DISK" then do
765 I = I + 1
766 SmbObj.shares.I = ResName
767 end
768 end
769 end
770 SmbObj.shares.0 = I
771return
772
773/*:VRX _GUIInit
774*/
775_GUIInit:
776 if options.!debug == 1 then say time()' _GUIInit started'
777 CALL VRSet 'Main', 'HelpFile', settings.!helpfile
778
779 /* Main Window */
780 CALL NLVSetText 'Main', "Caption", 1
781
782 CALL NLVSetText 'Menu_File', "Caption", 80
783 CALL NLVSetText 'Menu_Context', "Caption", 81
784 CALL NLVSetText 'Menu_Selected', "Caption", 83
785 CALL NLVSetText 'Menu_Help', "Caption", 84
786
787 CALL NLVSetText 'Menu_File_LOAD', "Caption", 31
788 CALL NLVSetText 'Menu_File_SAVE', "Caption", 30
789 CALL NLVSetText 'Menu_File_LMHosts_Reset', "Caption", 127
790 CALL NLVSetText 'Menu_File_ucCred_Reset', "Caption", 128
791 CALL NLVSetText 'Menu_File_Autostart', "Caption", 35
792 CALL NLVSetText 'Menu_File_Autostart_Activate', "Caption", 76
793 CALL NLVSetText 'Menu_File_Autostart_Deactivate', "Caption", 77
794 CALL NLVSetText 'Menu_File_Daemon', "Caption", 126
795 CALL NLVSetText 'Menu_File_Daemon_Start', "Caption", 76
796 CALL NLVSetText 'Menu_File_Daemon_Stop', "Caption", 77
797 CALL NLVSetText 'Menu_File_CLOSE', "Caption", 29
798
799 CALL NLVSetText 'Menu_Context_DETACH', "Caption", 11
800 CALL NLVSetText 'Menu_Context_DETACH_ALL', "Caption", 120
801 CALL NLVSetText 'Menu_Context_REFRESH', "Caption", 38
802 CALL NLVSetText 'Menu_Context_UNMOUNT', "Caption", 12
803 CALL NLVSetText 'Menu_Context_EDIT', "Caption", 32
804 CALL NLVSetText 'Menu_Context_OPEN', "Caption", 94
805 CALL NLVSetText 'Menu_Context_OPEN_ICON', "Caption", 95
806 CALL NLVSetText 'Menu_Context_OPEN_TREE', "Caption", 96
807 CALL NLVSetText 'Menu_Context_OPEN_DETAIL', "Caption", 97
808 CALL NLVSetText 'Menu_Context_OPEN_SETTINGS', "Caption", 98
809 CALL NLVSetText 'Menu_Context_OPEN_SPLITVIEW', "Caption", 99
810
811 CALL NLVSetText 'Menu_Selected_Connect', "Caption", 28
812 CALL NLVSetText 'Menu_Selected_Remove', "Caption", 12
813 CALL NLVSetText 'Menu_Selected_Retry', "Caption", 90
814 CALL NLVSetText 'Menu_Selected_Info', "Caption", 92
815 CALL NLVSetText 'Menu_Selected_TimeSync', "Caption", 129
816 CALL NLVSetText 'Menu_Selected_Refresh', "Caption", 38
817 CALL NLVSetText 'Menu_Selected_Default_Workgroup',"Caption", 75
818
819 CALL NLVSetText 'Menu_Help_Extended', "Caption", 4
820 CALL NLVSetText 'Menu_Help_About', "Caption", 91
821
822 /* Left pane */
823 CALL NLVSetText 'DT_CURRENT', "Caption", 10
824 CALL NLVSetText 'PB_DETACH', "Caption", 11
825 CALL NLVSetText 'PB_UNMOUNT', "Caption", 12
826
827 /* Dialog window */
828 CALL NLVSetText 'DT_MOUNT', "Caption", 14
829 CALL NLVSetText 'DT_SERVER', "Caption", 19
830 CALL NLVSetText 'DT_SHARE', "Caption", 20
831 CALL NLVSetText 'DT_NETWORK', "Caption", 21
832 CALL NLVSetText 'CHK_MTYPE', "Caption", 23
833 CALL NLVSetText 'DT_USER', "Caption", 25
834 CALL NLVSetText 'DT_PASSWORD', "Caption", 26
835 CALL NLVSetText 'DT_MPOINT', "Caption", 27
836 CALL NLVSetText 'PB_MOUNT', "Caption", 28
837 CALL NLVSetText 'PB_EDIT_CANCEL', "Caption", 3
838 CALL NLVSetText 'PB_DIALOG_HELP', "Caption", 4
839 CALL NLVSetText 'PB_CLEARCRED', "Caption", 89
840
841 IF (mtype.1 \= '' & mtype.2 \= '' & mtype.3 \= '' & mtype.4 \= '') THEN DO
842 CALL VRMethod CB_MOUNT, 'Clear'
843 CALL VRMethod CB_MOUNT, 'AddStringList', 'mtype.'
844 END
845
846 if (mtype.1 = '' & mtype.2 = '' & mtype.3 = '' & mtype.4 = '') THEN DO /* we do not seem to have an NLV file */
847 /* we fill the array with the list predefined directly in the GUI control */
848 ok = VRMethod( "CB_MOUNT", "GetStringList", "mtype." )
849 end
850
851 /* SMBTree */
852 CALL NLVSetText 'PB_SMBTREE_CONNECT', "Caption", 28
853 CALL NLVSetText 'PB_SMBTREE_REFRESH', "Caption", 38
854 CALL NLVSetText 'PB_SMBTREE_HELP', "Caption", 4
855 CALL NLVSetText 'CN_SMBTREE', "Caption",140
856
857/** Use AutoSize property instead
858 ok = VRSet("Pict_Throbber","Width", VRMethod( "Screen", "PixelsToTwips", 32 ))
859 ok = VRSet("Pict_Throbber","Height", VRMethod( "Screen", "PixelsToTwips", 32 ))
860**/
861 /* Condet */
862 CALL NLVSetText 'PB_CONDET_SAVE', "Caption", 30
863 CALL NLVSetText 'PB_CONDET_LOAD', "Caption", 31
864 CALL NLVSetText 'PB_CONDET_HELP',"Caption", 4
865
866 /* Statusbar */
867 ok = VRSet("DT_STATUSBAR", "Caption", VRGet("Main", "HintText"))
868
869 /* Common margin around controls */
870 margin = ((VRGet("Main", "InteriorLeft") / 3) * 2) + 2
871
872 smbwait = "#50"
873
874 if options.!debug == 1 then say time()' _GUIInit done'
875return
876
877/*:VRX _INILoad
878*/
879_INILoad:
880 if options.!debug == 1 then say time()' _INILoad started'
881
882 /* Locate the profile */
883 os2_ini = VALUE('USER_INI',,'OS2ENVIRONMENT')
884 inipath = VRParseFilePath( os2_ini, 'DP')
885 IF inipath == '' THEN inipath = SysBootDrive() || '\OS2'
886 settings.!ini = inipath'\'options.!appname_short'.INI'
887 drop os2_ini inipath
888 if options.!debug == 1 then say ' 'options.!appname_long' INIfile = "'settings.!ini'"'
889
890 settings.!network = ""
891 /* Create default smb.conf if none exists */
892 if \VRFileExists( samba.!smbconf ) then call _CreateSmbConf
893
894 say _ucInitObj()
895 say _ucChkObj()
896
897 IF STREAM( settings.!ini, 'C', 'QUERY EXISTS') == '' THEN DO
898 /* First start */
899 if options.!debug == 1 then say " First start!"
900
901 advanced.!browseauth = 0
902 advanced.!browseimme = 1
903 advanced.!broadcast = 0
904 advanced.!special = 0
905 advanced.!savepassive= 0
906 advanced.!lmhosts = 1
907
908 advanced.!miniicons = 0
909
910 advanced.!easupport = 1
911 advanced.!readonly = 0
912 advanced.!alwaysmp = 0
913 advanced.!cachetimeout = 10
914 advanced.!cachelistings = 32
915
916 CALL VRSet "Main", 'Height', 7576
917 CALL VRSet "Main", 'Width', 8200
918 CALL VRSet "SPLIT_MAIN", 'Left', 2915
919 CALL VRMethod "Main", 'CenterWindow'
920 call VRSet 'Main', 'Visible', 1
921 call Main_Resize
922 END
923 ELSE DO
924 /* Subsequent start */
925 /* Load window position settings */
926 settings.!x = VRGetIni('Settings', 'X', settings.!ini, 'NoClose')
927 settings.!y = VRGetIni('Settings', 'Y', settings.!ini, 'NoClose')
928 settings.!h = VRGetIni('Settings', 'H', settings.!ini, 'NoClose')
929 settings.!w = VRGetIni('Settings', 'W', settings.!ini, 'NoClose')
930 settings.!s = VRGetIni('Settings', 'S', settings.!ini, 'NoClose')
931
932 IF settings.!x == '' THEN settings.!x = -1
933 IF settings.!y == '' THEN settings.!y = -1
934 IF settings.!h == '' THEN settings.!h = -1
935 IF settings.!w == '' THEN settings.!w = -1
936 IF settings.!s == '' THEN settings.!s = -1
937
938 /* Titlebar settings */
939 settings.!curbcolor = VRGetIni('Settings', 'TitleBarBackground', settings.!ini, 'NoClose')
940 settings.!curfcolor = VRGetIni('Settings', 'TitleBarForeground', settings.!ini, 'NoClose')
941 IF (settings.!curbcolor = '' | settings.!curbcolor = '<default>') THEN settings.!curbcolor = 'SystemActiveTitle'
942 IF (settings.!curfcolor = '' | settings.!curfcolor = '<default>') THEN settings.!curfcolor = 'SystemActiveTitleText'
943
944 /* Load font settings */
945 IF VRFileExists( SysBootDrive() || '\OS2DBCS') == 1
946 THEN default_font = '9.WarpSans Combined'
947 ELSE default_font = '9.WarpSans'
948
949 settings.!cfont = VRGetIni('Settings', 'ContainerFont', settings.!ini, 'NoClose')
950 settings.!wfont = VRGetIni('Settings', 'WindowFont', settings.!ini, 'NoClose')
951 IF settings.!cfont == '' THEN settings.!cfont = default_font
952 IF settings.!wfont == '' THEN settings.!wfont = default_font
953
954 /* Current page */
955 settings.!curpage = VRGetIni('Settings', 'CurrentPage', settings.!ini, 'NoClose')
956 IF settings.!curpage == '' THEN settings.!curpage = 1
957
958 /* Global settings */
959 advanced.!browseauth = VRGetIni('Settings', 'BrowseAuth', settings.!ini, 'NoClose')
960 advanced.!browseimme = VRGetIni('Settings', 'BrowseImme', settings.!ini, 'NoClose')
961 advanced.!broadcast = VRGetIni('Settings', 'Broadcast', settings.!ini, 'NoClose')
962 advanced.!special = VRGetIni('Settings', 'SpecialShares', settings.!ini, 'NoClose')
963 advanced.!savepassive= VRGetIni('Settings', 'SavePassive', settings.!ini, 'NoClose')
964 advanced.!lmhosts = VRGetIni('Settings', 'LMHosts', settings.!ini, 'NoClose')
965 advanced.!miniicons = VRGetIni('Settings', 'MiniIcons', settings.!ini, 'NoClose')
966
967 advanced.!easupport = VRGetIni('Settings', 'EAS', settings.!ini, 'NoClose')
968 advanced.!readonly = VRGetIni('Settings', 'ReadOnly', settings.!ini, 'NoClose')
969 advanced.!alwaysmp = VRGetIni('Settings', 'AlwaysMP', settings.!ini, 'NoClose')
970 advanced.!cachetimeout = VRGetIni('Settings', 'CacheTimeOut', settings.!ini, 'NoClose')
971 advanced.!cachelistings = VRGetIni('Settings', 'CacheListings',settings.!ini, 'NoClose')
972
973 IF advanced.!browseauth == '' THEN advanced.!browseauth = 0
974 IF advanced.!browseimme == '' THEN advanced.!browseimme = 1
975 IF advanced.!broadcast == '' THEN advanced.!broadcast = 0
976 IF advanced.!special == '' THEN advanced.!special = 0
977 IF advanced.!savepassive== '' THEN advanced.!savepassive= 0
978 IF advanced.!lmhosts == '' THEN advanced.!lmhosts = 1
979
980 options.!storecreds = VRGetIni('Settings', 'StoreCreds', settings.!ini, 'NoClose')
981say "options.!storecreds = "options.!storecreds
982 IF options.!storecreds == '' then options.!storecreds = 1
983
984say "options.!storecreds = "options.!storecreds
985 IF _ucChkObj() = 0 then options.!storecreds = 0
986say "options.!storecreds = "options.!storecreds
987
988 options.!tracmark = VRGetIni('Settings', 'TracMarkup', settings.!ini, 'NoClose')
989 options.!debug = VRGetIni('Settings', 'Debug', settings.!ini)
990 IF options.!debug == '' THEN options.!debug = 0 /* Turn off debug by default for release builds */
991 if options.!debug == 1 then ok = VRRedirectStdIO("ON")
992 else ok = VRRedirectStdio("OFF")
993
994 IF advanced.!miniicons == '' THEN advanced.!miniicons = 0
995
996 /* Advanced */
997 IF advanced.!easupport == '' THEN advanced.!easupport = 1
998 IF advanced.!readonly == '' THEN advanced.!readonly = 0
999 IF advanced.!alwaysmp == '' THEN advanced.!alwaysmp = 0
1000 IF advanced.!cachetimeout == '' THEN advanced.!cachetimeout = 10
1001 IF advanced.!cachelistings == '' THEN advanced.!cachelistings = 32
1002
1003 /* Apply the settings */
1004 ok = VRSet("DT_CURRENT","BACKCOLOR", settings.!curbcolor )
1005 ok = VRSet("DT_CURRENT","FORECOLOR", settings.!curfcolor )
1006
1007 ok = VRset("CN_CURRENT", "MiniIcons", advanced.!miniicons)
1008 ok = VRset("CN_SMBTREE", "MiniIcons", advanced.!miniicons)
1009 ok = VRset("CN_CONDET", "MiniIcons", advanced.!miniicons)
1010
1011 IF ( settings.!x >= 0 ) & ( settings.!y >= 0 ) & ( settings.!l >= 0 ) & ( settings.!w >= 0 ) & ( settings.!s >= 0 ) THEN DO
1012 CALL VRSet VRWindow(), 'Left', settings.!x
1013 CALL VRSet VRWindow(), 'Top', settings.!y
1014 CALL VRSet VRWindow(), 'Height', settings.!h
1015 CALL VRSet VRWindow(), 'Width', settings.!w
1016 CALL VRSet "SPLIT_MAIN", 'Left', settings.!s
1017 END
1018 ELSE CALL VRMethod VRWindow(), 'CenterWindow'
1019
1020 CALL VRSet "CN_CURRENT", 'Font', settings.!cfont
1021 CALL VRSet "CN_CONDET", 'Font', settings.!cfont
1022 CALL VRSet "CN_SMBTREE", 'Font', settings.!cfont
1023
1024 CALL VRSet 'Main', 'Font', settings.!wfont
1025 CALL VRSet 'Main', 'StatusFont', settings.!wfont
1026
1027 ok = VRSet("TDL_1","Selected", settings.!curpage)
1028 END
1029
1030 if options.!nogui == 1 then CALL VRLoadSecondary "SW_PROGRESS","W"
1031 else do
1032 if options.!delay > 0 then do
1033 /* Set mouse pointer to wait - this operation might take a few seconds */
1034 call VRSet VRWindow(), 'Pointer', 'Wait'
1035 call Main_Resize
1036 ok = SysSleep(options.!delay)
1037 options.!delay = 0
1038 /* Set mouse pointer to default again */
1039 call VRSet VRWindow(), 'Pointer', '<default>'
1040 end
1041 end
1042
1043 /* Look for usable credentials */
1044 if options.!storecreds = 1 & _ucChkUc() then do
1045 UserCred = _ucGetUc()
1046 parse var UserCred '--user='Credentials.!username'%'Credentials.!password
1047 if left(Credentials.!password,1)='%' then Credentials.!password = substr(Credentials.!password,2)
1048 ok = VRSet("EF_USER", "Value",Credentials.!username)
1049 ok = VRSet("EF_PASSWORD","Value",Credentials.!password)
1050 ok = VRSet("CN_SMBTREE","Caption",VRGet("CN_SMBTREE","Caption")||": "Credentials.!username)
1051 end
1052 else ok = VRSet("CN_SMBTREE","Caption",VRGet("CN_SMBTREE","Caption")||": Guest")
1053
1054 /* SambaInit.VRS needs these 2 */
1055 ShowHidden = advanced.!special
1056 Broadcast = advanced.!broadcast
1057
1058 /* in non debug versions this is normally not visible */
1059 if options.!debug == 1 then say ' NLV MessageFile = "'settings.!messages'"'
1060 if options.!debug == 1 then say ' NLV HelpFile = "'settings.!helpfile'"'
1061
1062 if options.!debug == 1 then say time()' _INILoad done'
1063RETURN
1064
1065/*:VRX _INISave
1066*/
1067_INISave: PROCEDURE EXPOSE settings. options. icons. fs. advanced. cd. samba.
1068 if options.!debug == 1 then say time()' '||"SaveSettings started"
1069
1070 if advanced.!savepassive then call _PassiveSave
1071
1072/* This does not make sense anymore
1073 settings.!network = VRGet("EF_NETWORK","Value")
1074 CALL VRSetIni 'Settings', 'Network', settings.!network, settings.!ini, 'NoClose'
1075 */
1076
1077 font = VRGet("CN_CURRENT", 'Font')
1078 CALL VRSetIni 'Settings', 'ContainerFont', font, settings.!ini, 'NoClose'
1079
1080 font = VRGet('Main', 'Font')
1081 CALL VRSetIni 'Settings', 'WindowFont', font, settings.!ini, 'NoClose'
1082
1083 settings.!curbcolor = VRGet("DT_CURRENT","BackColor")
1084 CALL VRSetIni 'Settings', 'TitleBarBackground', settings.!curbcolor, settings.!ini, 'NoClose'
1085
1086 settings.!curfcolor = VRGet("DT_CURRENT","ForeColor")
1087 CALL VRSetIni 'Settings', 'TitleBarForeground', settings.!curfcolor, settings.!ini, 'NoClose'
1088
1089 /* Global options */
1090 CALL VRSetIni 'Settings', 'BrowseAuth', advanced.!browseauth , settings.!ini, 'NoClose'
1091 CALL VRSetIni 'Settings', 'BrowseImme', advanced.!browseimme , settings.!ini, 'NoClose'
1092 CALL VRSetIni 'Settings', 'Broadcast', advanced.!broadcast , settings.!ini, 'NoClose'
1093 CALL VRSetIni 'Settings', 'SpecialShares', advanced.!special , settings.!ini, 'NoClose'
1094 CALL VRSetIni 'Settings', 'SavePassive', advanced.!savepassive, settings.!ini, 'NoClose'
1095 CALL VRSetIni 'Settings', 'LMHosts', advanced.!lmhosts , settings.!ini, 'NoClose'
1096
1097 CALL VRSetIni 'Settings', 'StoreCreds', options.!storecreds , settings.!ini, 'NoClose'
1098 CALL VRSetIni 'Settings', 'Debug', options.!debug , settings.!ini, 'NoClose'
1099 CALL VRSetIni 'Settings', 'MiniIcons', advanced.!miniicons , settings.!ini, 'NoClose'
1100 CALL VRSetIni 'Settings', 'TracMarkup', options.!tracmark , settings.!ini, 'NoClose'
1101
1102 /* Advanced */
1103 CALL VRSetIni 'Settings', 'EAS', advanced.!easupport , settings.!ini, 'NoClose'
1104 CALL VRSetIni 'Settings', 'ReadOnly', advanced.!readonly , settings.!ini, 'NoClose'
1105 CALL VRSetIni 'Settings', 'AlwaysMP', advanced.!alwaysmp , settings.!ini, 'NoClose'
1106 CALL VRSetIni 'Settings', 'CacheTimeOut', advanced.!cachetimeout , settings.!ini, 'NoClose'
1107 CALL VRSetIni 'Settings', 'CacheListings', advanced.!cachelistings, settings.!ini, 'NoClose'
1108
1109 /* Current page */
1110 settings.!curpage = VRget("TDL_1","Selected")
1111 CALL VRSetIni 'Settings', 'CurrentPage', settings.!curpage , settings.!ini, 'NoClose'
1112
1113 /* Save position and size */
1114 settings.!l = VRGet("Main", 'Left' )
1115 settings.!t = VRGet("Main", 'Top' )
1116 settings.!h = VRGet("Main", 'Height')
1117 settings.!w = VRGet("Main", 'Width' )
1118 settings.!s = VRGet("SPLIT_Main", 'Left' )
1119
1120 CALL VRSetIni 'Settings', 'X', settings.!l, settings.!ini, 'NoClose'
1121 CALL VRSetIni 'Settings', 'Y', settings.!t, settings.!ini, 'NoClose'
1122 CALL VRSetIni 'Settings', 'H', settings.!h, settings.!ini, 'NoClose'
1123 CALL VRSetIni 'Settings', 'W', settings.!w, settings.!ini, 'NoClose'
1124 CALL VRSetIni 'Settings', 'S', settings.!s, settings.!ini
1125
1126 if options.!debug == 1 then say time()' '||"SaveSettings done"
1127RETURN
1128
1129/*:VRX _isValidIPAddress
1130*/
1131_isValidIPAddress: procedure
1132 ipaddr = arg(1)
1133 d. = ''
1134 d.0 = 4
1135 fail = 0
1136 parse var ipaddr d.1 '.' d.2 '.' d.3 '.' d.4
1137 do I = 1 to 4
1138 if datatype(d.I) = 'NUM' then do
1139 if d.I < 0 | d.I > 255 then fail = 1
1140 end
1141 else fail = 1
1142 if fail = 1 then leave
1143 end
1144return(\fail)
1145
1146/*:VRX _LMHostsRead
1147*/
1148_LMHostsRead:
1149 ok = file2stem(samba.!lmhosts,'lmhosts.', 'NoDel')
1150 lmname. = "#"
1151 lmapp. = ""
1152 lmname.0 = lmhosts.0
1153 lmip.0 = lmhosts.0
1154 lmapp.0 = lmhosts.0
1155 do I = 1 to lmhosts.0
1156 if left(lmhosts.I,1) = "#" then iterate
1157 parse var lmhosts.I lmip.I ' ' lmname.I '#' lmapp.I
1158 lmip.I = strip(lmip.I)
1159 lmname.I = strip(lmname.I)
1160 if lmapp.I <> "" & left(lmapp.I,1) <> '#' then lmapp.I = '#'lmapp.I
1161 end
1162 drop lmhosts.
1163return
1164
1165/*:VRX _LMHostsReset
1166*/
1167_LMHostsReset:
1168 ok = SysFileDelete(samba.!lmhosts)
1169
1170 Buttons.1 = NLVGetMessage(2)
1171 Buttons.0 = 1
1172 if ok = 0 then do
1173 id = VRMessage( VRWindow(), NLVGetMessage(118,samba.!lmhosts), NLVGetMessage(127), "Information", "Buttons.", 1, 1 )
1174 end
1175 else do
1176 id = VRMessage( VRWindow(), samba.!lmhosts', RC = 'ok, NLVGetMessage(127), "Error", "Buttons.", 1, 1 )
1177 end
1178return
1179
1180/*:VRX _LMHostsUpdate
1181*/
1182_LMHostsUpdate:
1183 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "Visible", "rh." )
1184 do I = 1 to rh.0
1185 call _GetSMBObjectProperties rh.I
1186 if SMBObj.udatatype = "SERVER" then do
1187 IP = VRMethod("CN_SMBTREE","GetFieldData",rh.I, IPFH )
1188 Role = VRMethod("CN_SMBTREE","GetFieldData",rh.I, MBFH )
1189 parse var IP T1 '.' T2 '.' T3 '.' T4
1190 if datatype(T1) = "NUM" & datatype(T2) = "NUM" & datatype(T3) = "NUM" & datatype(T4) = "NUM" then do
1191 FoundName = 0
1192 /* Don't add localhost and local link IP to LMHosts */
1193 if T1 = '127' & T2 = '0' & T3 = '0' & T4 = '1' then iterate
1194 if T1 = '169' & T2 = '254' then iterate
1195 do J = 1 to lmname.0 /* machine already in LMHosts? */
1196 if lmname.J = SmbObj.resname then do /* Yes? then update IP */
1197 lmip.J = IP
1198 if pos('PDC',Role) > 0 & SMBObj.parentrh <> "" then do
1199 Domain = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
1200 lmapp.J = "#DOM:"Domain
1201 end
1202 FoundName = 1
1203 leave
1204 end
1205 end
1206 if FoundName = 0 then do /* New machine for LMhosts - add it */
1207 new = lmname.0 + 1
1208 lmname.0 = new
1209 lmname.new = SmbObj.resname
1210 lmip.0 = new
1211 lmip.new = IP
1212 end
1213 end
1214 end
1215 end
1216 ok = SysFileDelete(samba.!lmhosts)
1217 call lineout samba.!lmhosts,'# Created by 'translate(VRParseFilename(settings.!ini,'N'))' Version 'word(VRGet("Main","Hinttext"),2)' on 'date()' at 'time()
1218 call lineout samba.!lmhosts,'# Syntax:'
1219 call lineout samba.!lmhosts,left('# IP-address',25)||left('NetBIOS-name',16)' [Role]'
1220 do I = 1 to lmname.0
1221 if left(lmname.I,1) = "#" then iterate
1222 call lineout samba.!lmhosts,left(lmip.I,25)||left(lmname.I,16)' 'lmapp.I
1223 end
1224 ok = stream(samba.!lmhosts,'c','close')
1225return
1226
1227/*:VRX _LMHostsWrite
1228*/
1229_LMHostsWrite:
1230
1231return
1232
1233/*:VRX _LoadOtherFuncs
1234*/
1235_LoadOtherFuncs:
1236 IF options.!debug == 1 then say time()' _LoadotherFuncs() started'
1237 SIGNAL ON SYNTAX
1238
1239 call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
1240 call SysLoadFuncs
1241
1242 call rxfuncadd 'IniLoadFuncs', 'REXXINI', 'IniLoadFuncs'
1243 call IniLoadFuncs
1244
1245 call RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
1246 call PRLoadFuncs
1247
1248 call RxFuncAdd 'RxuInit', 'RXU', 'RxuInit'
1249 call RxuInit
1250
1251 SIGNAL OFF SYNTAX
1252 IF options.!debug == 1 then say time()' _LoadotherFuncs() done'
1253return
1254
1255SYNTAX:
1256 IF options.!debug == 1 then say time()' _LoadotherFuncs() error handler entered.'
1257 Fatal = 1
1258 parse source . . InVXIDE
1259 if left(InVXIDE,length(Tempdir)+5) = TempDir||'__tmp'
1260 then xxx = "VX-REXX IDE: "strip(translate(word(sourceline(SIGL-1),4),' ',"',"))
1261 else xxx = 'A'
1262 call VRMessage 'Main', xxx' REXX function library DLL is missing or unloadable!', options.!appname_long "fatal error", "E"
1263 IF options.!debug == 1 then say time()' _LoadotherFuncs() error handler finished, program will be terminated.'
1264signal Quit
1265
1266/*:VRX _ParseCommandLine
1267*/
1268_ParseCommandLine:
1269 if options.!debug == 1 then say time()' _ParseCommandLine() started'
1270 CmdLine = VRGet("Application","Commandline")
1271 upCmdLine = translate(CmdLine)
1272 if options.!debug == 1 then say ' Commandline = "'CmdLine'"'
1273
1274 ForceNDFS = 0
1275 if wordpos('-NDFS',upCmdLine) > 0 then do
1276 if options.!debug == 1 then say " NDFS switch detected"
1277 CmdLine = delWord(CmdLine,wordpos('-NDFS',upCmdLine),1)
1278 upCmdLine = translate(CmdLine)
1279 ForceNDFS = 1
1280 CALL VRSet "Menu_File_Autostart","Visible", 0
1281 end
1282
1283 if wordpos('-AUTOCLOSE',upCmdLine) > 0 then do
1284 options.!autoclose = 1
1285 if options.!debug == 1 then say " AutoClose switch detected"
1286 CmdLine = delWord(CmdLine,wordpos('-AUTOCLOSE',upCmdLine),1)
1287 upCmdLine = translate(CmdLine)
1288 end
1289 if wordpos('-NOGUI',upCmdLine) > 0 then do
1290 options.!nogui = 1
1291 options.!autoclose = 1
1292 if options.!debug == 1 then say " -NOGUI switch detected"
1293 CmdLine = delWord(CmdLine,wordpos('-NOGUI',upCmdLine),1)
1294 upCmdLine = translate(CmdLine)
1295 end
1296
1297 if wordpos('-TIMESYNC',upCmdLine) > 0 then do
1298 options.!timesync = 1
1299 if options.!debug == 1 then say " -TIMESYNC switch detected"
1300 dwpos = wordpos('-TIMESYNC',upCmdLine)
1301 if dwpos = words(upCmdLine) then do /* TIMESYNC was last parm - assume automatic */
1302 options.!timesrv = ""
1303 CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),1)
1304 end
1305 else do
1306 options.!timesrv = word(upCmdLine,dwpos+1)
1307 if left(options.!timesrv,1) = "-" then do /* other parameter detected */
1308 options.!timesrv = ""
1309 CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),1)
1310 end
1311 else do /* seems we have a timeserver - IP or name - no further check */
1312 CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),2)
1313 end
1314 end
1315 upCmdLine = translate(CmdLine)
1316 end
1317
1318 if wordpos('-DELAY',upCmdLine) > 0 then do
1319 if options.!debug == 1 then say " DELAY switch detected"
1320 dwpos = wordpos('-DELAY',upCmdLine)
1321 if dwpos = words(upCmdLine) then do /* DELAY was last parm - assume 60 seconds */
1322 options.!delay = 60
1323 CmdLine = delWord(CmdLine,dwpos,1)
1324 end
1325 else do
1326 options.!delay = word(upCmdLine,dwpos+1)
1327 if datatype(options.!delay) <> "NUM" then do /* No number of seconds specified */
1328 options.!delay = 60
1329 CmdLine = delWord(CmdLine,dwpos,1)
1330 end
1331 else do
1332 CmdLine = delWord(CmdLine,dwpos,2)
1333 end
1334 end
1335 upCmdLine = translate(CmdLine)
1336 if options.!debug == 1 then say " DELAY set to "options.!delay" seconds."
1337 end
1338
1339 Profile = strip(CmdLine,,'"')
1340 if Profile <> "" then do
1341 Profile = strip(VRParseFilename(Profile,"DPNE"))
1342 options.!autoload = 1
1343 if options.!debug == 1 then say ' Profile = "'Profile'"'
1344 if \VRFileExists(Profile) then do
1345 CALL VRMessage 'Main', NLVGetMessage( 102, Profile ), NLVGetMessage( 1 ), 'E'
1346 /* Disable all switches in case of an error */
1347 options.!autoload = 0
1348 options.!autoclose = 0
1349 options.!nogui = 0
1350 options.!delay = 0
1351 end
1352 end
1353 if options.!debug == 1 then say time()' _ParseCommandLine done'
1354return
1355
1356/*:VRX _PassiveLoad
1357*/
1358_PassiveLoad:
1359 if options.!debug == 1 then say time()' '||"_PassiveLoad started"
1360
1361 do cnt = 1 to 255
1362 resdata = VRGetIni( "PassiveConnections", cnt, settings.!ini )
1363 if resdata = "" then leave
1364
1365 parse var resdata p_mpoint resource rwFlag
1366 if options.!debug == 1 then do
1367 say ' Connection 'cnt', resdata ="'resdata'"'
1368 end
1369
1370/* vfs.!drive = FILESPEC('DRIVE', node )
1371 vfs.!mountpoint = STRIP( node, 'T', '\') */
1372
1373 /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
1374 if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
1375
1376 p_mpidx = ""
1377
1378 call ParseResParmString
1379
1380 p_rw = rwFlag
1381
1382 /* Create the hash string */
1383 hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
1384
1385 /* A truncated, useless entry - skip it */
1386 if p_server = "" & p_share = ""& p_workgroup = "" then iterate
1387
1388 md5.cnt = rexx_md5(hashstr)
1389 md5.0 = cnt
1390
1391 /* Passive connection already restored - skip the dupe one */
1392 PassiveDupe = 0
1393 do X = 1 to md5.0-1
1394 if md5.cnt = md5.X then PassiveDupe = 1
1395 end
1396 if PassiveDupe = 1 then iterate /* do not add record for a duplicate passive connection */
1397
1398 /* Everything is ok, let's add a new entry */
1399 cd.lastrh = VRMethod("CN_CONDET","AddRecord")
1400
1401 /* Fill columns now */
1402 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpointFH, p_mpoint)
1403 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpidxfh, p_mpidx)
1404 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.workgrpFH , p_workgroup)
1405 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.serverfh, p_server)
1406 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.sharefh, p_share)
1407 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.userfh, p_user)
1408 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password)
1409 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.spasswordfh, p_spassword)
1410 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout)
1411 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.cldFH, p_cachelistings)
1412 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.masterfh, p_master)
1413 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mtypefh, p_mtype)
1414 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.easupportfh, p_easupport)
1415 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.rwfh, p_rw)
1416 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh, md5.cnt)
1417 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive)
1418 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive)
1419
1420/* Obsolete fields:
1421 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.memlenfh, p_memlen)
1422 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.logfilefh, p_logfile)
1423 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.loglevelfh, p_loglevel) */
1424 end
1425 if options.!debug == 1 then say time()' '||"_PassiveLoad done"
1426return
1427/*:VRX _PassiveSave
1428*/
1429_PassiveSave:
1430 if options.!debug == 1 then say time()' '||"_PassiveSave started"
1431 ok = VRDelIni( "PassiveConnections", "ALL", settings.!ini )
1432
1433 ok = SysIni(settings.!ini, 'PassiveConnections', 'DELETE:')
1434
1435 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
1436 cnt = 0
1437 DO i = 1 TO records.0
1438
1439 if VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.StatusFH) = icons.!passive then do
1440 cnt = cnt + 1
1441 resdata = ""
1442 resdata = resdata||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
1443 resdata = resdata||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
1444 resdata = resdata||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
1445 resdata = resdata||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
1446 resdata = resdata||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
1447 resdata = resdata||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
1448 resdata = resdata||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
1449 resdata = resdata||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
1450 resdata = resdata||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
1451 resdata = resdata||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
1452 resdata = resdata||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
1453 resdata = resdata||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
1454 resdata = resdata||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
1455/* resdata = resdata||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
1456 resdata = resdata||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
1457 resdata = resdata||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
1458 resdata = resdata||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
1459 resdata = resdata||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
1460 resdata = resdata||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
1461 resdata = resdata||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
1462 ok = VRSetIni( "PassiveConnections", cnt, resdata, settings.!ini )
1463 END
1464 else iterate
1465 end
1466 if options.!debug == 1 then say time()' '||"_PassiveSave done"
1467return
1468
1469/*:VRX _PrinterInfo
1470*/
1471_PrinterInfo:
1472 if \_SMBpdrInstalled() then do
1473 /* SMB.PDR is not installed */
1474 CALL VRMessage 'Main', NLVGetMessage( 104 ), NLVGetMessage( 5 ), 'E'
1475 end
1476 else do /* SMB.pdr is installed */
1477 /* shared queue name */
1478 p_printer = SMBObj.resname
1479
1480 /* printer server */
1481 capt = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
1482 parse var Capt p_prtsrv '0D0A'x .
1483 p_prtsrv = strip(p_prtsrv)
1484
1485 /* workgroup of the printer server */
1486 Gparrh = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Parent")
1487 capt = VRMethod("CN_SMBTREE", "GetRecordAttr", GParrh, "Caption")
1488 parse var Capt p_workgroup '0D0A'x .
1489
1490 /* This is the string we will find in case this resource is already connected */
1491 DescStr = translate(p_prtsrv'#'p_printer'#'p_workgroup'#')
1492 say '"'DescStr'"'
1493 LDescStr = length(DescStr)
1494
1495 /* Enumerate all SMB ports */
1496 ok = SysIni('SYSTEM','PM_SPOOLER_PORT',"All:",'ports')
1497 if ports.0 = 0 then do
1498 /* No SMB ports installed */
1499 CALL VRMessage 'Main', NLVGetMessage( 105 ), NLVGetMessage( 5 ), 'E'
1500 end
1501 else do
1502 /* At least 1 SMB port was found - lets check whether it is already connected to our resource */
1503 FoundPort = 0
1504 do I = 1 to ports.0
1505 if left(ports.i,3) = 'SMB' then do
1506 say ports.I
1507 say translate(left(SysIni('SYSTEM','PM_'ports.I,'INITIALIZATION'),LDescStr))
1508 say DescStr
1509 if translate(left(SysIni('SYSTEM','PM_'ports.I,'INITIALIZATION'),LDescStr)) = DescStr then do
1510 OurPort = ports.I
1511 FoundPort = 1
1512 leave
1513 end
1514 end
1515 end
1516 say 'OurPort = "'OurPort'"'
1517 if Foundport then do
1518 ok = SysIni('SYSTEM','PM_SPOOLER_PRINTER',"All:",'printer')
1519 FoundPrinter = 0
1520 do I = 1 to printer.0
1521 prtsummary = SysINi('SYSTEM','PM_SPOOLER_PRINTER',printer.i)
1522 parse var prtsummary port ';'PrinterDriver';'PrinterQueue';' .
1523 say printer.I' 'prtsummary
1524 if port = ourPort then do
1525 PrinterName = SysINi('SYSTEM','PM_SPOOLER_PRINTER_DESCR',printer.i)
1526 parse var Printername Printername ';' .
1527 CALL VRMessage 'Main', PrinterName' ('PrinterQueue') prints to port ' Port' connected to \\'p_workgroup'\'p_prtsrv'\'p_printer, NLVGetMessage( 1 ), 'I'
1528 FoundPrinter = 1
1529 leave
1530 end
1531 end
1532 if FoundPrinter = 0 then do
1533 /* Port installed and configured, but not used by any printer */
1534 CALL VRMessage 'Main', NLVGetMessage( 106 ), NLVGetMessage( 5 ), 'E'
1535 end
1536 end
1537 else do
1538 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
1539 end
1540 end
1541 end
1542return
1543
1544/*:VRX _ShowMsg
1545*/
1546_ShowMsg:
1547 /* preliminary implementation - we just do not ignore it anymore -
1548 - ShowMsg from smbmon/smbusers should become a shared library */
1549 ok = VRSet("DT_StatusBar", "Caption", Msg.Text)
1550return
1551
1552/*:VRX _SmbConfCreateShadowCopy
1553*/
1554_SmbConfCreateShadowCopy:
1555 if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy started'
1556 /* we create a complete version of smb.conf in temporary directory for reading purposes */
1557 /* as we can only determine a default value from this complete version of the file */
1558 /* however it is not desirable to always have a complete copy normally */
1559 ok = SysFileDelete(samba.!shadowsmbconf)
1560 if datatype(log_level) <> "NUM" then log_level = 2
1561 say ' 'samba.!testparmexe' -v -s -d='log_level' 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
1562 address cmd samba.!testparmexe' -v -s -d='log_level' 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
1563 if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy done'
1564return
1565
1566/*:VRX _SMBpdrInstalled
1567*/
1568_SMBpdrInstalled: procedure
1569 ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
1570return (ok <> "")
1571
1572/*:VRX _StemsInit
1573*/
1574_StemsInit:
1575 if options.!debug == 1 then say time()' _StemsInit started'
1576 if options.!debug == 1 then say ' initializing options.'
1577 options.!workgroup = ''
1578 options.!server = ''
1579 options.!share = ''
1580 options.!user = ''
1581 options.!password = ''
1582 options.!spassword = ''
1583 options.!master = ''
1584 options.!mastertype = ''
1585 options.!memlen = '2'
1586 options.!cachetimeout = '10'
1587 options.!cachelistings = '32'
1588 options.!easupport = '1'
1589 options.!readonly = ''
1590 options.!loglevel = 0
1591 options.!logfile = ''
1592
1593 options.!autoload = 0
1594 options.!autoclose = 0
1595 options.!nogui = 0
1596 options.!autostart = 0
1597 options.!editmode = 0
1598 options.!delay = 0
1599 options.!storecreds = 0
1600 options.!timesync = 0
1601 options.!timesrv = ''
1602
1603 options.!tracmark = 0
1604
1605 app_name_msg = NLVGetMessage( 0 )
1606 IF app_name_msg == '' | WORD( app_name_msg, 1 ) == '[Missing' THEN
1607 app_name_msg = 'EVFSGUI EVFSGUI'
1608
1609 /* These values are used in things like config files, WPS objects, etc.
1610 */
1611 options.!appname_short = TRANSLATE( SUBWORD( app_name_msg, 1, 1 ))
1612 options.!appname_long = SUBWORD( app_name_msg, 2 )
1613
1614 if options.!debug == 1 then say ' initializing vfs. '
1615 vfs.!drive = ''
1616 vfs.!mountpoint = ''
1617
1618 if options.!debug == 1 then say ' initializing advanced. '
1619 advanced.!browseauth = ''
1620 advanced.!browseimme = ''
1621 advanced.!broadcast = ''
1622 advanced.!special = ''
1623 advanced.!savepassive= ''
1624 advanced.!miniicons = ''
1625
1626 advanced.!easupport = 1
1627 advanced.!readonly = ''
1628 advanced.!alwaysmp = ''
1629 advanced.!cachetimeout = '10'
1630 advanced.!cachelistings = '32'
1631
1632 advanced.!smbconfchanged = 0
1633
1634 /* Obsolete */
1635 advanced.!memlen = ''
1636 advanced.!loglevel = '0'
1637 advanced.!logfile = ''
1638
1639 if options.!debug == 1 then say ' initializing credentials. '
1640 credentials.!username = ""
1641 credentials.!password = ""
1642 credentials.!entered = 0
1643
1644 UserCred = ""
1645 RefreshMode = ""
1646
1647 if options.!debug == 1 then say ' initializing mtype. '
1648 mtype.0 = 4
1649 mtype.1 = NLVGetMessage( 15 )
1650 mtype.2 = NLVGetMessage( 16 )
1651 mtype.3 = NLVGetMessage( 17 )
1652 mtype.4 = NLVGetMessage( 18 )
1653
1654 if options.!debug == 1 then say ' initializing icons. '
1655 icons.!bat = '#1:PMWP.DLL'
1656 icons.!cmd = '#2:PMWP.DLL'
1657 icons.!exe = '#3:PMWP.DLL'
1658 icons.!template = '#10:PMWP.DLL'
1659 icons.!drive = '#16:PMWP.DLL'
1660 icons.!defaultfile = '#24:PMWP.DLL'
1661 icons.!folder = '#26:PMWP.DLL'
1662 icons.!folder_open = '#34:PMWP.DLL'
1663 icons.!machine_awake = '#35:PMWP.DLL'
1664 icons.!machine_sleeping = '#61:PMWP.DLL'
1665 icons.!workgroup = '#62:PMWP.DLL'
1666 icons.!pdc = '#63:PMWP.DLL'
1667 icons.!active = '#64:PMWP.DLL'
1668 icons.!passive = '#68:PMWP.DLL'
1669 icons.!printer = '#65:PMWP.DLL'
1670 icons.!drive_inactive = '#70:PMWP.DLL'
1671 icons.!pdf = '#80'
1672 icons.!spreadsheet = '#82'
1673 icons.!textdocument = '#86'
1674 icons.!framework = '#87'
1675 icons.!image = '#88'
1676 icons.!movie = '#89'
1677 icons.!sound = '#90'
1678 icons.!warpin = '#91'
1679 icons.!zip = '#92'
1680 icons.!view = '#93'
1681 icons.!plaintext = '#94'
1682
1683 p_workgroup = "Unknown"
1684 p_server = "Unknown"
1685 p_share = "Unknown"
1686
1687 if options.!debug == 1 then say time()' _StemsInit done'
1688return
1689/*:VRX _TabbedDialogSetup
1690*/
1691_TabbedDialogSetup:
1692 if options.!debug == 1 then say time()' _TabbedDialogSetup started'
1693
1694 w = VRLoad( "TDL_1", VRWindowPath(), "SW_DIALOG" )
1695 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(13)" ")
1696 ok = VRMethod( "TDL_1", "SetStatusText", 1, NLVGetMessage(132,"1","2"))
1697 w = VRLoad( "TDL_1", VRWindowPath(), "SW_ADVANCED" )
1698 ok = VRMethod( "TDL_1", "InsertPage", w,"- "NLVGetMessage(40)" ")
1699 ok = VRMethod( "TDL_1", "SetStatusText", 2, NLVGetMessage(132,"2","2"))
1700
1701 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SMBTREE" )
1702 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(39)" ")
1703
1704 w = VRLoad( "TDL_1", VRWindowPath(), "SW_CONDET" )
1705 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(63)" ")
1706 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SETTINGS" )
1707 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(47)" ")
1708 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SMBCONF" )
1709 ok = VRMethod( "TDL_1", "InsertPage", w,"- "NLVGetMessage(47)" ")
1710 if options.!debug == 1 then say time()' _TabbedDialogSetup done'
1711return
1712
1713
1714/*:VRX _TabFix
1715*/
1716_TabFix:
1717 ok = VRMethod( "TDL_1", "SetTabText", arg(1), " "strip(VRMethod( "TDL_1", "GetTabText", arg(1)))" ")
1718return
1719
1720/*:VRX _TabsStrip
1721*/
1722_TabsStrip:
1723 ok = VRMethod( "TDL_1", "SetTabText", 1, strip(VRMethod( "TDL_1", "GetTabText", 1)))
1724 ok = VRMethod( "TDL_1", "SetTabText", 2, strip(VRMethod( "TDL_1", "GetTabText", 2)))
1725 ok = VRMethod( "TDL_1", "SetTabText", 3, strip(VRMethod( "TDL_1", "GetTabText", 3)))
1726 ok = VRMethod( "TDL_1", "SetTabText", 4, strip(VRMethod( "TDL_1", "GetTabText", 4)))
1727 ok = VRMethod( "TDL_1", "SetTabText", 5, strip(VRMethod( "TDL_1", "GetTabText", 5)))
1728return
1729
1730/*:VRX _TimeSync
1731*/
1732_TimeSync:
1733 if options.!debug == 1 then say time()' _TimeSync started, "'options.!timesrv'"'
1734 TimeMsg.1 = NLVGetMessage(141)' 'time()
1735 if options.!timesrv <> '' then do
1736 say ' 'samba.!netexe' time set -S 'options.!timesrv
1737 address cmd samba.!netexe' time set -S 'options.!timesrv
1738 end
1739 else do
1740 say ' 'samba.!netexe' time set'
1741 address cmd samba.!netexe' time set'
1742 end
1743 options.!timesync = ''
1744 TimeMsg.2 = NLVGetMessage(142)' 'time()
1745 TimeMsg.0 = 2
1746
1747 Buttons.1 = NLVGetMessage(2)
1748 Buttons.0 = 1
1749 id = VRMessageStem( VRWindow(), TimeMsg. , NLVGetMessage(129) , "Information", "Buttons.", 1, 1 )
1750 if options.!debug == 1 then say time()' _TimeSync done'
1751return
1752
1753/*:VRX _UpdateObject
1754*/
1755_UpdateObject: procedure
1756 Object = arg(1)
1757 ObjValue = arg(2)
1758 if VRGet(Object,"Value") <> ObjValue then ok = VRset(Object,"Value",ObjValue)
1759return
1760
1761/*:VRX _UserCredUpdate
1762*/
1763_UserCredUpdate:
1764 if options.!debug == 1 then say time()' _UserCredUpdate started'
1765 credentials.!username = VRGet("EF_USER","Value")
1766 credentials.!password = VRGet("EF_PASSWORD","Value")
1767
1768 if pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 1 | pos(left(credentials.!password,1),'01234567890') > 0
1769 then UserCred = '--user='Credentials.!username'%%'Credentials.!password
1770 else UserCred = '--user='Credentials.!username'%'Credentials.!password
1771
1772 if options.!storecreds = 1 & \(UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' | UserCred = '--user=%%' | UserCred = '-N') then do
1773 ok = _ucSetUc()
1774 ok = VRSet("Pict_PWINMEM","PicturePath","#36")
1775 if options.!debug == 1 then call beep 2400, 10
1776 end
1777 else do
1778 if options.!debug == 1 then call beep 200, 20
1779 ok = VRSet("Pict_PWINMEM","PicturePath","#37")
1780 end
1781 if options.!debug == 1 then say time()' _UserCredUpdate done'
1782return
1783
1784/*:VRX CB_client_lanman_auth_Click
1785*/
1786CB_client_lanman_auth_Click:
1787 advanced.!smbconfchanged = 1
1788return
1789
1790/*:VRX CB_client_NTLMv2_auth_Click
1791*/
1792CB_client_NTLMv2_auth_Click:
1793 advanced.!smbconfchanged = 1
1794
1795 if VRGet("CB_client_NTLMv2_auth","Set") = 0 then do
1796 ok = VRSet("CB_client_lanman_auth","Enabled", 1)
1797 ok = VRSet("CB_client_plaintext_auth","Enabled", 1)
1798 end
1799 else do
1800 ok = VRSet("CB_client_lanman_auth","Enabled", 0)
1801 ok = VRSet("CB_client_lanman_auth","Set", 0)
1802 ok = VRSet("CB_client_plaintext_auth","Enabled", 0)
1803 ok = VRSet("CB_client_plaintext_auth","Set", 0)
1804 end
1805return
1806
1807/*:VRX CB_client_plaintext_auth_Click
1808*/
1809CB_client_plaintext_auth_Click:
1810 advanced.!smbconfchanged = 1
1811return
1812
1813/*:VRX CB_client_use_spnego_Click
1814*/
1815CB_client_use_spnego_Click:
1816 advanced.!smbconfchanged = 1
1817return
1818
1819/*:VRX CB_client_use_spnego_principal_Click
1820*/
1821CB_client_use_spnego_principal_Click:
1822 advanced.!smbconfchanged = 1
1823return
1824
1825/*:VRX CB_DEBUG_Click
1826*/
1827CB_DEBUG_Click:
1828
1829return
1830
1831/*:VRX CB_LOGGING_Click
1832*/
1833CB_LOGGING_Click:
1834 if VRFileExists(SysBootDrive()'\ndpsmb.dbg') then
1835 ok = SysFileDelete(SysBootDrive()'\ndpsmb.dbg')
1836 else do
1837 call lineout SysBootDrive()'\ndpsmb.dbg','NDPSMB debug flag file'
1838 ok = stream(SysBootDrive()'\ndpsmb.dbg','c','close')
1839 end
1840
1841 CALL VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()'\ndpsmb.dbg')
1842return
1843
1844/*:VRX CB_MOUNT_Change
1845*/
1846CB_MOUNT_Change:
1847 if options.!debug == 1 then say time()' '||"CB_MOUNT_Change started"
1848
1849 mount = VRGet("CB_MOUNT", "Value")
1850
1851 /* Catch empty mount type error */
1852 if mount = "" then do
1853 if mtype.1 <> "" then ok = VRSet("CB_MOUNT", "Value", mtype.1)
1854 if options.!debug == 1 then say time()' '||"CB_MOUNT_Change aborted"
1855 return
1856 end
1857
1858 SELECT
1859 WHEN mount == mtype.1 THEN DO
1860 CALL VRSet "DT_SHARE", "Visible", 1
1861 CALL VRSet "EF_SHARE", "Visible", 1
1862 CALL VRSet "DT_SERVER", "Visible", 1
1863 CALL VRSet "EF_SERVER", "Visible", 1
1864 CALL VRSet "CHK_MTYPE", "Visible", 0
1865 CALL NLVSetText "DT_NETWORK", "Caption", 21
1866 END
1867 WHEN mount == mtype.2 THEN DO
1868 CALL VRSet "DT_SHARE", "Visible", 0
1869 CALL VRSet "EF_SHARE", "Visible", 0
1870 CALL VRSet "DT_SERVER", "Visible", 1
1871 CALL VRSet "EF_SERVER", "Visible", 1
1872 CALL VRSet "CHK_MTYPE", "Visible", 0
1873 CALL NLVSetText "DT_NETWORK", "Caption", 21
1874 END
1875 WHEN mount == mtype.3 THEN DO
1876 CALL VRSet "DT_SHARE", "Visible", 0
1877 CALL VRSet "EF_SHARE", "Visible", 0
1878 CALL VRSet "DT_SERVER", "Visible", 0
1879 CALL VRSet "EF_SERVER", "Visible", 0
1880 CALL VRSet "CHK_MTYPE", "Visible", 0
1881 CALL NLVSetText "DT_NETWORK", "Caption", 21
1882 END
1883 WHEN mount == mtype.4 THEN DO
1884 CALL VRSet "DT_SHARE", "Visible", 0
1885 CALL VRSet "EF_SHARE", "Visible", 0
1886 CALL VRSet "DT_SERVER", "Visible", 0
1887 CALL VRSet "EF_SERVER", "Visible", 0
1888 CALL VRSet "CHK_MTYPE", "Visible", 1
1889 CALL NLVSetText "DT_NETWORK", "Caption", 22
1890 END
1891 OTHERWISE DO
1892 id = VRMessage( "", 'unknown mount type here >>'mount'<< mtype1=>>'mtype.1'<<', "Mount change error", "E", )
1893 END
1894 END
1895 if options.!debug == 1 then say time()' '||"CB_MOUNT_Change done"
1896RETURN
1897
1898/*:VRX CN_CONDET_Click
1899*/
1900CN_CONDET_Click:
1901 /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
1902return
1903
1904/*:VRX CN_CONDET_ContextMenu
1905*/
1906CN_CONDET_ContextMenu:
1907 rh = VRInfo('Record')
1908 if VRMethod( "CN_CONDET", "ValidateRecord", rh) <> 1 then return
1909
1910 /* Hide all context menu entries */
1911 ok = VRSet("Menu_Selected_Remove", "Visible", 0) /* CN_CONDET */
1912 ok = VRSet("Menu_Selected_Retry", "Visible", 0) /* CN_CONDET */
1913 ok = VRSet("Menu_Selected_Connect", "Visible", 0) /* CN_SMBTREE */
1914 ok = VRSet("Menu_Selected_Sep1", "Visible", 0) /* CN_SMBTREE */
1915 ok = VRSet("Menu_Selected_Info", "Visible", 0) /* CN_SMBTREE */
1916 ok = VRSet("Menu_Selected_TimeSync", "Visible", 0) /* CN_SMBTREE */
1917 ok = VRSet("Menu_Selected_Refresh", "Visible", 0) /* CN_SMBTREE */
1918 ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0) /* CN_SMBTREE */
1919
1920 /* This is the place to enable specific context menu entries */
1921 ok = VRMethod( "CN_CONDET", "GetRecordList", "All", "records." )
1922 ok = VRSet("Menu_Selected_Remove", "Visible", (records.0 <> 0))
1923 ok = VRSet("Menu_Selected_Retry", "Visible", (records.0 <> 0))
1924
1925 if VRMethod( "CN_CONDET", "GetFieldData", rh, CD.StatusFH) = icons.!passive then do
1926 ok = VRSet("Menu_Selected_Retry", "Enabled",1)
1927 ok = VRSet("Menu_Selected_Remove", "Enabled",1)
1928 end
1929 ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
1930return
1931/*:VRX CN_CONDET_DragStart
1932*/
1933CN_CONDET_DragStart:
1934
1935 obj = VRInfo( "object" )
1936 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
1937 if selrec.0 = 0 then return
1938
1939 Icon = VRMethod("CN_CONDET", "GetRecordAttr", selrec.1, "Icon")
1940
1941 if Icon = icons.!printer then do /* Printers not supported at the moment */
1942 call beep 4800,100
1943 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
1944 end
1945 else call VRMethod obj, 'StartDrag'
1946return
1947
1948/*:VRX CN_CURRENT_Click
1949*/
1950CN_CURRENT_Click:
1951 if options.!debug == 1 then say time()' CN_CURRENT_Click started'
1952 /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
1953
1954 /* Herwig B. */
1955 CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
1956 ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0)
1957
1958 rh = VRInfo('Record')
1959 if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then return
1960
1961 data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
1962 options.currentdata = data
1963
1964 /* ok = VRset("DT_StatusBar","Caption", data' - 'VRGet("Main", "HintText")) */
1965
1966 PARSE VAR data p_node ';' p_mounts ';' p_string
1967
1968 if options.!debug == 1 then do
1969 say ' data = "'data'"'
1970 say ' p_node = "'p_node'"'
1971 say ' p_mounts = "'p_mounts'"'
1972 say ' p_string = "'p_string'"'
1973 end
1974
1975 if p_string = ""
1976 then infotext = fs.!name' 'fs.!version
1977 else infotext = p_string
1978
1979 if infotext = "" then infotext = " "
1980 CALL VRSet "CN_CURRENT", "Caption", infotext
1981 CALL VRSet "CN_CURRENT", 'HintText',infotext
1982
1983 IF p_mounts > 0 THEN DO
1984 CALL VRSet 'PB_UNMOUNT', 'Enabled', 1
1985 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 1
1986
1987 if pos("*",p_string) > 0 | pos(";",p_string) > 0
1988 then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
1989 else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
1990 END
1991 ELSE DO
1992 CALL VRSet 'PB_UNMOUNT', 'Enabled', 0
1993 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 0
1994 CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
1995 END
1996
1997 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'Parent')
1998
1999 IF parent == '' THEN DO
2000 CALL VRSet 'PB_DETACH', 'Enabled', 1
2001 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 1
2002 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
2003/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1 */
2004 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 1
2005/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1 */
2006
2007 END
2008 ELSE DO
2009 CALL VRSet 'PB_DETACH', 'Enabled', 0
2010 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 0
2011 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 0
2012/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 0 */
2013 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 0
2014/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 0 */
2015 END
2016
2017 parse var p_string p_workgroup'\\'p_server'\'p_share
2018
2019 p_workgroup = strip(p_workgroup,'T',':')
2020
2021 if options.!debug == 1 then do
2022 say ' p_workgroup = "'p_workgroup'"'
2023 say ' p_server = "'p_server'"'
2024 say ' p_share = "'p_share'"'
2025 end
2026
2027 p_server = translate(p_server)
2028
2029 ok = VRSet("EF_NETWORK","Value", p_workgroup)
2030 if p_workgroup <> "" then do
2031 wgh = _GetMachineHandle(p_workgroup)
2032 if wgh = "" then wgh = _AddWorkGroup(p_workgroup)
2033 call _UpdateObject "EF_SERVER", p_server
2034 mh = _GetMachineHandle(p_server)
2035 if mh = "" & p_server <> "*" then do
2036 mh = _AddSleepingMachine(p_server,'',wgh)
2037 machine = p_server
2038 call _RefreshShares
2039 end
2040 ok = VRSet("EF_Share","Value", p_share)
2041 select
2042 when p_workgroup = "*" then ok = VRSet("CB_MOUNT","Value", mtype.4)
2043 when p_server = "*" then ok = VRSet("CB_MOUNT","Value", mtype.3)
2044 when p_share = "*" then ok = VRSet("CB_MOUNT","Value", mtype.2)
2045 otherwise ok = VRSet("CB_MOUNT","Value", mtype.1)
2046 end
2047 end
2048 if options.!debug == 1 then say time()' CN_CURRENT_Click done'
2049RETURN
2050
2051/*:VRX CN_CURRENT_ContextMenu
2052*/
2053CN_CURRENT_ContextMenu: /* PROCEDURE EXPOSE existrec. options. icons. fs. */
2054 if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu started"
2055
2056 CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
2057
2058 rh = VRInfo('Record')
2059
2060 /* we have to check whether the record still exists because under certain
2061 circumstances the event routine is executed after the record was already
2062 removed */
2063 if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then do
2064 if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu aborted"
2065 return
2066 end
2067
2068 data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2069 PARSE VAR data p_node ';' p_mounts ';' p_string
2070
2071 if options.!debug == 1 then do
2072 say ' data = "'data'"'
2073 say ' p_node = "'p_node'"'
2074 say ' p_mounts = "'p_mounts'"'
2075 say ' p_string = "'p_string'"'
2076 end
2077/*
2078 infotext = p_node
2079 DO i = 1 TO p_mounts
2080 infotext = infotext ' ['p_string']'
2081 END
2082*/
2083 if p_string = ""
2084 then infotext = fs.!name' 'fs.!version
2085 else infotext = p_string
2086
2087 if infotext = "" then infotext = " "
2088 CALL VRSet "CN_CURRENT", "Caption", infotext
2089 CALL VRSet "CN_CURRENT", 'HintText',infotext
2090
2091 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
2092/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1
2093 CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1
2094 CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 1 */
2095 CALL VRSet 'Menu_Context_Open_Default', "Visible", 1
2096
2097 IF p_mounts > 0 THEN DO
2098 CALL VRSet 'PB_UNMOUNT', 'Enabled', 1
2099 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 1
2100
2101 if pos("*",p_string) > 0 | pos(";",p_string) > 0 then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
2102 else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
2103 END
2104 ELSE DO
2105 CALL VRSet 'PB_UNMOUNT', 'Enabled', 0
2106 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 0
2107 CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
2108 END
2109
2110 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'Parent')
2111
2112 IF parent == '' THEN DO
2113 CALL VRSet 'PB_DETACH', 'Enabled', 1
2114 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 1
2115 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
2116/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1 */
2117 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 1
2118/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1 */
2119/* CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 1 */
2120 END
2121 ELSE DO
2122 CALL VRSet 'PB_DETACH', 'Enabled', 0
2123 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 0
2124 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 0
2125/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 0 */
2126 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 0
2127/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 0 */
2128/* CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 0 */
2129 END
2130
2131 ok = VRMethod( "Menu_Context", "Popup", , , "", "" )
2132 if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu done"
2133return
2134
2135/*:VRX CN_CURRENT_DoubleClick
2136*/
2137CN_CURRENT_DoubleClick:
2138 if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick started"
2139
2140 CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
2141
2142 rh = VRInfo('Record')
2143
2144 /* we have to check whether the record still exists because under certain
2145 circumstances the event routine is executed after the record was already
2146 removed */
2147 if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then do
2148 if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick aborted"
2149 return
2150 end
2151
2152 data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2153 PARSE VAR data p_node ';' p_mounts ';' p_string
2154
2155 if options.!debug == 1 then do
2156 say ' data = "'data'"'
2157 say ' p_node = "'p_node'"'
2158 say ' p_mounts = "'p_mounts'"'
2159 say ' p_string = "'p_string'"'
2160 end
2161 call Menu_Context_Open_Default_Click
2162
2163 if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick done"
2164return
2165
2166/*:VRX CN_CURRENT_DragDrop
2167*/
2168CN_CURRENT_DragDrop:
2169 if options.!debug == 1 then say time()' CN_CURRENT_DragDrop started'
2170 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
2171 if options.!debug == 1 then say " settings.!network = "settings.!network
2172
2173 p_workgroup = ''
2174 p_server = ''
2175 p_share = ''
2176
2177 srcFile = VRInfo( "SourceFile" )
2178 srcCtn = VRInfo( "SourceObject" )
2179 srcRec = VRInfo( "SourceRecord" )
2180 trgCtn = VRInfo( "TargetObject" )
2181 trgRec = VRInfo( "TargetRecord" )
2182
2183 if options.!debug == 1 then do
2184 say ' srcFile = "'srcFile'"'
2185 say ' srcCtn = "'srcCtn'"'
2186 if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
2187 say ' srcRec = "'srcRec'"'
2188 say ' trgCtn = "'trgCtn'"'
2189 if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
2190 say ' trgRec = "'trgRec'"'
2191 end
2192
2193 if srcFile <> "" then do /* A file was dropped onto the container - attempt to load it */
2194 if options.!debug == 1 then say ' Possible profile dropped: "'srcFile'"'
2195
2196 /* was it really a profile ? */
2197 if translate(VRParseFileName(srcFile,'E')) = translate(fs.!profileext) then do /* Yes - load it! */
2198 options.!autoload = 1
2199 Profile = srcFile
2200 call Menu_File_Load_Click
2201 ok = VRSet("EF_NETWORK","Value",options.!workgroup)
2202 end
2203 else do /* No - barf! */
2204 buttons.0 = 1
2205 buttons.1 = NLVGetMessage(9)
2206 ok = VRMessage('Main', NLVGetMessage(103,srcFile ), NLVGetMessage(5), 'E','buttons.')
2207 end
2208 if options.!debug == 1 then say time()' CN_CURRENT_DragDrop done (load profile)'
2209 return
2210 end
2211
2212 ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
2213
2214 if VRGet(srcCtn,'Name') = "CN_CONDET" then do
2215 p_mpoint = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.MpointFH)
2216
2217 p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcRec, cd.workgrpFH )
2218 p_server = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.ServerFH)
2219 p_share = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.ShareFH)
2220 p_user = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.UserFH)
2221 p_password = x2c(VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.SpasswordFH))
2222
2223 ShareLevel = 1
2224 if p_share = "" then ShareLevel = 2
2225 if p_server = "" then ShareLevel = 3
2226 if p_workgroup = "" then ShareLevel = 4
2227
2228 ok = VRSet("CB_MOUNT", "Selected", Sharelevel )
2229 ok = VRset("CB_MOUNT", "Value", mtype.sharelevel)
2230
2231 call _UpdateObject "EF_SERVER", p_server
2232 ok = VRset("EF_SHARE", "Value", p_share)
2233 ok = VRset("EF_NETWORK", "Value", p_workgroup)
2234 ok = VRset("EF_USER", "Value", p_user)
2235 ok = VRset("EF_PASSWORD", "Value", p_password)
2236
2237 parse var p_mpoint p_drv '\' p_dir
2238
2239 p_dir = strip(p_dir,'T','\')
2240
2241 ok = VRset("CB_DRIVES", "Value", p_drv)
2242 ok = VRset("EF_DIRECTORY", "Value", p_dir)
2243 end /* Drag from CN_CONDET */
2244
2245 else do /* Drag from CN_SMBTREE */
2246 call _GetSMBObjectProperties srcRec
2247 select
2248 when SMBObj.udatatype = "WORKGROUP" then do
2249 say "Workgroup dragged!"
2250 p_workgroup = SMBObj.resname
2251 p_server = ""
2252 p_share = ""
2253
2254 ShareLevel = 3
2255 end
2256 when SMBObj.udatatype = "SERVER" then do
2257 say "Server dragged!"
2258 if SMBObj.parentrh <> "" then do /* detect server without workgroup */
2259 p_workgroup = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
2260 end
2261 p_server = SMBObj.resname
2262 p_share = ""
2263
2264 ShareLevel = 2
2265 end
2266 when SMBObj.udatatype = "DISK" then do
2267 say "Shared disk dragged!"
2268 if SMBObj.gparentrh <> "" then do /* detect share on a server without workgroup */
2269 p_workgroup = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.gparentrh, "Caption")
2270 end
2271 p_server = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
2272 parse var p_server p_server '0D0A'x .
2273 p_share = SMBObj.resname
2274
2275 ShareLevel = 1
2276 end
2277 otherwise nop /* Printer */
2278 end
2279 ok = VRSet("EF_NETWORK","Value",p_workgroup)
2280 call _UpdateObject "EF_SERVER", p_server
2281 ok = VRSet("EF_Share","Value", p_share)
2282 end /* Drag from CN_SMBTREE */
2283
2284 if options.!debug == 1 then do
2285 say 'p_workgroup = "'p_workgroup'"'
2286 say 'p_server = "'p_server'"'
2287 say 'p_share = "'p_share'"'
2288 end
2289
2290 ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
2291
2292 settings.!network = VRGet("EF_NETWORK","Value")
2293 call CB_MOUNT_Change
2294
2295 if trgRec = "" then do
2296 ok = VRMethod("CB_DRIVES", "GetStringList", "freedrives.")
2297 if freedrives.0 > 0
2298 then ok = VRSet("CB_DRIVES","Value", freedrives.1)
2299 else ok = VRSet("CB_DRIVES","Value", "")
2300
2301 ok = VRSet("EF_DIRECTORY","Value", "")
2302 end
2303 else do
2304 TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
2305
2306 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
2307
2308 do while parTrgRH <> ""
2309 partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
2310 TargetString = partrgCapt||'\'||TargetString
2311 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
2312 end
2313 say 'TargetString = "'TargetString'"'
2314 ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
2315 ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
2316 end
2317
2318 window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
2319 if VRGet("CB_DRIVES","Value") = "" then return
2320
2321 window = VRLoadSecondary( "SW_LOGIN", "W" )
2322 if credentials.!entered = 1 then call PB_MOUNT_CLICK
2323
2324 if VRGet(srcCtn,'Name') = "CN_CONDET" & VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
2325 if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
2326 end
2327 if options.!debug == 1 then say time()' CN_CURRENT_DragDrop done'
2328return
2329/*:VRX CN_SMBTREE_Click
2330*/
2331CN_SMBTREE_Click:
2332 if options.!debug == 1 then say time()' CN_SMBTREE_Click started'
2333 /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
2334
2335 call _dropdeprecated
2336 call _GetSmbObjectProperties VRInfo('Record')
2337 call _ContextMenuSelectedSet
2338
2339 ok = VRset("DT_Statusbar", "Caption", SMBObj.udatamsg)
2340
2341 if options.!debug == 1 then say time()' CN_SMBTREE_Click done'
2342return
2343/*:VRX CN_SMBTREE_ContextMenu
2344*/
2345CN_SMBTREE_ContextMenu:
2346 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu started'
2347
2348 call _dropdeprecated
2349 call _GetSmbObjectProperties VRInfo('Record')
2350
2351 call _ContextMenuSelectedSet
2352 ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
2353
2354 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu done'
2355return
2356/*:VRX CN_SMBTREE_DoubleClick
2357*/
2358CN_SMBTREE_DoubleClick:
2359 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick started'
2360
2361 call _dropdeprecated
2362 call _GetSmbObjectProperties VRInfo('Record')
2363
2364/* if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
2365return */
2366 /* Enable last 2 lines for 2.0.x (to disable on the fly browsing) */
2367
2368 if options.!debug == 1 then say ' Browsing "'SMBObj.udatatype'"'
2369
2370 If SMBObj.udatatype = "DIRECTORY" then do
2371 BrowsePath = _browsebuildpath(SMBObj.rh)
2372
2373 call _BrowseResetObject(SmbObj.rh)
2374
2375 parse var browsepath '\\'machine'\'sharename '\' browsepath
2376 browsepath = browsepath'\*'
2377
2378 call _BrowseDirectory
2379 end
2380
2381 If SMBObj.udatatype = "FILE" then do
2382 BrowsePath = _browsebuildpath(SMBObj.rh)
2383 call _BrowseResetObject(SmbObj.rh)
2384
2385 parse var browsepath '\\'machine'\'sharename '\' browsepath
2386
2387 OpenOk = _browseobjectopen(machine,sharename,browsepath)
2388
2389 if \OpenOK then do
2390 say " Not connected - trying to connect"
2391 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", sharerh, "Selected", 1)
2392 call PB_SMBTREE_CONNECT_Click
2393 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Selected", 1)
2394
2395 OpenOk = _browseobjectopen(machine,sharename,browsepath)
2396
2397 if \OpenOk then do
2398 say " Not connected - cannot open - aborting!"
2399 end
2400 end
2401 end
2402
2403 if SMBObj.udatatype = "DISK" then do
2404 machine = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
2405 parse var machine machine '0D0A'x .
2406 machine = strip(machine)
2407
2408 call _BrowseResetObject(SmbObj.rh)
2409
2410 sharename = SMBObj.resname
2411 BrowsePath = ""
2412
2413 call _BrowseDirectory
2414 end
2415 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
2416return
2417/*:VRX CN_SMBTREE_DragFile
2418*/
2419CN_SMBTREE_DragFile:
2420 if options.!debug == 1 then say time()' CN_SMBTREE_DragFile started'
2421
2422 obj = VRInfo( "object" )
2423
2424 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
2425 if SelRH.0 = 0 then do
2426 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart aborted'
2427 return
2428 end
2429
2430 call _dropdeprecated
2431 call _GetSMBObjectProperties SelRH.1
2432
2433 select
2434 when SMBObj.udatatype = "WORKGROUP" | SMBObj.udatatype = "SERVER" | SMBObj.udatatype = "DISK" then do
2435 call VRMethod obj, 'StartDrag'
2436 end
2437 when SMBObj.udatatype = "PRINTER" then do
2438 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
2439 end
2440 otherwise nop /* FILE DIRECTORY */
2441 end
2442
2443 if options.!debug == 1 then say time()' CN_SMBTREE_DragFile done'
2444return
2445
2446/*:VRX CN_SMBTREE_DragStart
2447*/
2448CN_SMBTREE_DragStart:
2449 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart started'
2450
2451 obj = VRInfo( "object" )
2452
2453 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
2454 if SelRH.0 = 0 then do
2455 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart aborted'
2456 return
2457 end
2458
2459 call _dropdeprecated
2460 call _GetSMBObjectProperties SelRH.1
2461
2462 select
2463 when SMBObj.udatatype = "WORKGROUP" | SMBObj.udatatype = "SERVER" | SMBObj.udatatype = "DISK" then do
2464 call VRMethod obj, 'StartDrag'
2465 end
2466 when SMBObj.udatatype = "PRINTER" then do
2467 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
2468 end
2469 otherwise nop /* FILE DIRECTORY */
2470 end
2471
2472 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart done'
2473return
2474/*:VRX CreateObject
2475*/
2476CreateObject: procedure
2477 Parse Arg Class, Title, Location, Setup, Collision
2478 /* say 'Creating ['Title']' */
2479say Setup
2480 rc = SysCreateObject( Class, Title, Location, Setup, Collision )
2481 If rc <> 1 Then do
2482 Msg.Text = ' > failed to create ['Title' | 'Class'] at location ['Location']'
2483 Msg.Type = 'Error'
2484 say Msg.Text
2485 end
2486return rc
2487/*:VRX DT_STATUSBAR_ContextMenu
2488*/
2489DT_STATUSBAR_ContextMenu:
2490 ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
2491return
2492
2493/*:VRX EF_PASSWORD1_KeyPress
2494*/
2495EF_PASSWORD1_KeyPress:
2496 if options.!debug == 1 then say time()' EF_PASSWORD1_KeyPress started'
2497 obj = VRInfo( "Object" )
2498 keystr = VRGet( obj, "KeyString" )
2499/* say keystr */
2500 select
2501 when keystr = "{Enter}" then call PB_LOGIN_OK_Click
2502 when keystr = "{Newline}" then call PB_LOGIN_OK_Click
2503 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
2504 otherwise nop
2505 end
2506 if options.!debug == 1 then say time()' EF_PASSWORD1_KeyPress done'
2507return
2508
2509/*:VRX EF_PASSWORD_Change
2510*/
2511EF_PASSWORD_Change:
2512 Now = VRGet("EF_PASSWORD","value")
2513 if Now = "" | Now = LastPassword then return
2514 ok = SysSleep(1)
2515 LastPassword = Now
2516 if Now <> VRGet("EF_PASSWORD","value") then return
2517 call _UserCredUpdate
2518return
2519
2520/*:VRX EF_SERVER_Change
2521*/
2522EF_SERVER_Change:
2523 if options.!debug == 1 then say time()' EF_SERVER_Change started'
2524 Now = VRGet("EF_SERVER","value")
2525
2526 if Now = "" | Now = LastServer then return
2527 ok = SysSleep(2)
2528 if Now <> VRGet("EF_SERVER","value") then return
2529
2530 IF options.!editmode = 1 then return
2531
2532 /* Do nothing for incomplete IP addresses */
2533 if strip(translate(VRGet("EF_SERVER","value"),copies(' ',11),'01234567890.')) = "" then do /* got an IP address */
2534 if \_IsValidIPAddress(VRGet("EF_SERVER","value")) then return /* it is invalid or incomplete */
2535 end
2536
2537 /* do nothing if a workgroup was mounted */
2538 if VRGet("EF_SERVER","value") = "*" then return
2539
2540 machine = VRGet("EF_SERVER","value")
2541 ok = VRSet("EF_SHARE","Value", "")
2542 ok = VRMethod("EF_SHARE","Reset")
2543
2544 rh = _GetMachineHandle(machine)
2545 if rh <> "" then do
2546 call _GetSMBObjectProperties rh
2547 if SMBObj.parentrh = ""
2548 then ok = VRSet("EF_NETWORK","Value", "") /* The workgroup might be unknown at this moment */
2549 else ok = VRSet("EF_NETWORK","Value", VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentRH,"Caption"))
2550
2551 call _GetSMBObjectShares SMBObj.rh
2552
2553 if SMBObj.shares.0 > 0 then do
2554 ok = VRMethod("EF_SHARE", "AddStringList", "SMBObj.shares.")
2555 end
2556 end
2557 else do
2558 call _RefreshWorkgroups
2559 smbtree.!machine = _AddSleepingMachine(machine,"","")
2560 call _UserCredUpdate
2561 call _RefreshShares
2562 ok = VRSet( "CN_smbtree", "Painting", 1 )
2563
2564 ok = VRSet("Main", 'Pointer', '<default>' )
2565 ok = VRSet("CN_smbtree","Enabled", 1)
2566 ok = VRSet("TM_Throbber","Enabled", 0)
2567 ok = VRSet("Pict_Throbber","Visible", 0)
2568 end
2569
2570 LastServer = VRGet("EF_SERVER","value")
2571 if options.!debug == 1 then say time()' EF_SERVER_Change done'
2572return
2573
2574/*:VRX EF_USER1_KeyPress
2575*/
2576EF_USER1_KeyPress:
2577 if options.!debug == 1 then say time()' EF_USER1_KeyPress started'
2578 obj = VRInfo( "Object" )
2579 keystr = VRGet( obj, "KeyString" )
2580 say keystr
2581 select
2582 when keystr = "{Enter}" then ok = VRMethod( "EF_Password1", "SetFocus" )
2583 when keystr = "{Newline}" then ok = VRMethod( "EF_Password1", "SetFocus" )
2584 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
2585 otherwise nop
2586 end
2587 if options.!debug == 1 then say time()' EF_USER1_KeyPress done'
2588return
2589
2590/*:VRX EF_USER_Change
2591*/
2592EF_USER_Change:
2593 Now = VRGet("EF_USER","value")
2594 if Now = "" | Now = LastUser then return
2595 ok = SysSleep(1)
2596 LastUser = Now
2597 if Now <> VRGet("EF_USER","value") then return
2598 call _UserCredUpdate
2599return
2600
2601/*:VRX EF_WINS_SERVER_Change
2602*/
2603EF_WINS_SERVER_Change:
2604 advanced.!smbconfchanged = 1
2605return
2606
2607/*:VRX Fini
2608*/
2609Fini:
2610 window = VRWindow()
2611 call VRSet window, "Visible", 0
2612 drop window
2613return 0
2614
2615/*:VRX GetChildren
2616*/
2617GetChildren: PROCEDURE EXPOSE existrec. exc options. icons. fs. cd. samba.
2618 if options.!debug == 1 then say time()' GetChildren started'
2619 PARSE ARG node, parec
2620
2621 CALL _Dynamic "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
2622
2623 IF info.2 > 0 THEN icon = icons.!active
2624 ELSE icon = icons.!passive
2625
2626 rh = VRMethod("CN_CURRENT", 'AddRecord', parec, 'Last', info.0, icon )
2627 IF rh == '' | datatype(res.0) <> "NUM" THEN RETURN
2628
2629 exc = exc + 1
2630 existrec.exc = rh
2631 userdata = node';'info.2
2632 DO i = 1 TO res.0
2633 userdata = ParseResourceData( userdata, res.i )
2634 END
2635 if userdata = "UNKNOWN" then ok = VRMethod("CN_CURRENT", 'RemoveRecord', rh)
2636 else do
2637 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'UserData', userdata
2638 if options.currentdata = userdata then ok = VRMethod("CN_CURRENT", 'SetRecordAttr', rh, 'Selected', 1)
2639 end
2640
2641 DO i = 1 TO points.0
2642 childnode = node || points.i || '\'
2643 CALL GetChildren childnode, rh
2644 END
2645 if options.!debug == 1 then say time()' GetChildren done'
2646RETURN
2647
2648/*:VRX GetMountPoints
2649*/
2650GetMountPoints: PROCEDURE EXPOSE existrec. options. icons. fs. cd. samba.
2651 if options.!debug == 1 then say time()' GetMountPoints started'
2652/* CALL VRSet "CN_CURRENT", 'Painting', 0 */
2653/* if options.!debug == 1 then say time()' '||"GetMountPoints: SysDriveMap(USED) started" */
2654 drvs = SysDriveMap('C:', 'USED') /* was "REMOTE" */
2655/* if options.!debug == 1 then say time()' '||"GetMountPoints: SysDriveMap(USED) done" */
2656 ac = 0
2657 DO i = 1 TO WORDS( drvs )
2658 fs = TRANSLATE( SysFileSystemType( WORD( drvs, i )))
2659 IF fs == fs.!fileSystemtype THEN DO
2660 ac = ac + 1
2661 attached.ac = WORD( drvs, i )
2662 END
2663 END
2664 attached.0 = ac
2665
2666 exc = 0
2667 DO i = 1 TO attached.0
2668 node = attached.i'\'
2669
2670 CALL VRMethod 'CB_DRIVES', 'AddString', attached.i
2671
2672 CALL _Dynamic "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
2673
2674 IF info.2 > 0 THEN icon = icons.!drive
2675 ELSE icon = icons.!drive_inactive
2676
2677 rh = VRMethod("CN_CURRENT", 'AddRecord',, 'Last', attached.i, icon )
2678 IF rh == '' THEN ITERATE
2679
2680 exc = exc + 1
2681 existrec.exc = rh
2682 userdata = node';'info.2
2683 DO j = 1 TO res.0
2684 userdata = ParseResourceData( userdata, res.j )
2685 END
2686/* if options.!debug == 1 then say ' "'attached.i'" "'userdata'"' */
2687 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'UserData', userdata /* , 'FileName', 'TESTER.EVP' */
2688 if options.currentdata = userdata then ok = VRMethod("CN_CURRENT", 'SetRecordAttr', rh, 'Selected', 1)
2689
2690 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'Expanded', 1
2691
2692 DO j = 1 TO points.0
2693 childnode = node || points.j || '\'
2694 CALL GetChildren childnode, rh
2695 END
2696
2697 END
2698 existrec.0 = exc
2699/* CALL VRSet "CN_CURRENT", 'Painting', 1 */
2700 if options.!debug == 1 then say time()' '||"GetMountPoints done"
2701RETURN
2702
2703/*:VRX Halt
2704*/
2705Halt:
2706 signal _VREHalt
2707return
2708
2709/*:VRX Init
2710*/
2711Init:
2712/* Herwig */
2713/* CALL VRSet 'Console', 'WindowListTitle', '' */
2714
2715 window = VRWindow()
2716 call VRSet window, "Visible", 0
2717 call VRMethod window, "Activate"
2718 drop window
2719
2720RETURN
2721
2722/*:VRX LoadFileSysFuncs
2723*/
2724LoadFileSysFuncs:
2725 if options.!debug == 1 then say time()' LoadFileSysFuncs() started'
2726
2727 Fatal = 1
2728 RestartCount = 0
2729 FoundEVFS = 1
2730 FoundND = 1
2731
2732 program = VRGet("Application", "Program")
2733 if program = "" then parse source . . program
2734 say "Program = '"program"'"
2735 program = translate(VRParseFileName(Program,'N'))
2736 say "Program = '"program"'"
2737
2738 if SysSearchPath("PATH", "EVFSCTL.EXE") = "" | program = "SMBGUI" then do
2739 FoundEVFS = 0
2740 ForceNDFS = 1
2741 end
2742
2743CtlRestart:
2744 if \ForceNDFS then signal NoNetDrive
2745
2746ForceNDFS:
2747 if options.!debug == 1 then say ' NDFS check entered'
2748 call RxFuncAdd 'NdRxLoadFuncs', 'NDCALLS', 'NdRxLoadFuncs'
2749 SIGNAL ON SYNTAX NAME NoNetdrive
2750 call NdRxLoadFuncs
2751 FoundND = 1
2752 SIGNAL OFF SYNTAX
2753 fs.!prefix = 'ND'
2754 fs.!fileSystemtype = "NDFS32"
2755 fs.!profileext = "ndc"
2756 signal CommonToBothFS
2757NoNetdrive:
2758 if options.!debug == 1 then say ' NDFS not found'
2759 CALL RxFuncAdd 'EvfsRxLoadFuncs', 'EVFSCALL.DLL', 'EvfsRxLoadFuncs'
2760 SIGNAL ON SYNTAX NAME NoEVFSCALL
2761 CALL EvfsRxLoadFuncs
2762 FoundEVFS = 1
2763 SIGNAL OFF SYNTAX
2764 fs.!prefix = 'EVFS'
2765 fs.!fileSystemtype = "EVFS"
2766 fs.!profileext = "evp"
2767CommonToBothFS:
2768 if options.!debug == 1 then say ' Common version check'
2769 CALL _Dynamic "fsstat = "fs.!prefix"RxQueryIFS()"
2770 if fsstat = 252 then CALL _Dynamic "Found"fs.!prefix" = 0"
2771
2772 if word(fsstat,1) = '0' then do
2773 PARSE VAR fsstat '0 'fsname fsver fsctl .
2774 fs.!name = fsname
2775 fs.!version = fsver
2776
2777 if options.!debug == 1 then DO
2778 say ' fs.!prefix = 'fs.!prefix
2779 say ' fs.!name = 'fs.!Name
2780 say ' Version = 'fsver
2781 say ' fsctl = 'fsctl
2782 end
2783 end
2784 else do
2785 if FoundND = 0 & FoundEVFS = 0 then do
2786 CALL VRMessage 'Main', 'FATAL: Neither EVFS nor Netdrive found: 'fs.!prefix'RxQueryIFS()='fsstat, NLVGetMessage( 5 ), 'E'
2787 signal Halt
2788 end
2789 signal ForceNDFS
2790 end
2791 IF fsctl \= 1 THEN DO
2792 if ReStartCount = 0 then do
2793 'detach 'fs.!prefix'ctl.exe'
2794 RestartCount = 1
2795 ok = SysSleep(1)
2796 signal CtlRestart
2797 end
2798 else do
2799 CALL VRMessage 'Main', NLVGetMessage( 101 ), NLVGetMessage( 5 ), 'E'
2800 signal Halt
2801 end
2802 END
2803
2804 Fatal = 0
2805
2806 if options.!debug == 1 then say time()' LoadFileSysFuncs() done'
2807return
2808
2809/*:VRX Main_Close
2810*/
2811Main_Close:
2812 CALL Quit
2813RETURN
2814
2815/*:VRX Main_Create
2816*/
2817Main_Create:
2818 options.!debug = 0
2819 if options.!debug == 1 then do
2820 ok = VRRedirectStdIO("ON")
2821 say time()' Main_Create started'
2822 end
2823 else ok = VRRedirectStdIO("OFF")
2824
2825 call _InitTempDir
2826 call _LoadOtherFuncs
2827
2828 call NLVSetup
2829 call _StemsInit
2830
2831 call _TabbedDialogSetup
2832 call _ContainersInit
2833 call _GUIInit
2834
2835 CALL _ParseCommandLine
2836
2837 CALL LoadFileSysFuncs
2838
2839 CALL _CltInit
2840
2841 CALL _INILoad
2842
2843 call _TabFix 1
2844 call SW_ADVANCED_Init_Content
2845 call SW_SMBTREE_Init_Content
2846 call SW_CONDET_Init_Content
2847 call SW_SETTINGS_Init_Content
2848
2849 CALL Refresh
2850
2851 if advanced.!savepassive == 1 then CALL _PassiveLoad
2852
2853 IF options.!timesync == 1 THEN CALL _TimeSync
2854
2855 IF options.!autoload == 1 THEN CALL Menu_File_Load_Click
2856
2857 CALL VRSet "CB_MOUNT", "Selected", 1
2858 CALL VRSet "CB_DRIVES", "Selected", 1
2859 IF options.!autoclose == 1
2860 THEN CALL TM_AutoClose_Trigger
2861 ELSE do
2862 if advanced.!browseauth == 1 then do
2863 /* FIXME: unclear why we have to do the following 4 lines here */
2864 call SW_SETTINGS_Init
2865 call SW_SETTINGS_Init_Content
2866 call SW_ADVANCED_Init
2867 call SW_ADVANCED_Init_Content
2868
2869 window = VRLoadSecondary( "SW_LOGIN", "W" )
2870 call Main_Resize
2871 end
2872 if advanced.!browseimme == 1 then call PB_SMBTREE_REFRESH_Click
2873 end
2874
2875 if options.!debug == 1 then say time()' Main_Create done'
2876return
2877
2878/*:VRX Main_KeyPress
2879*/
2880Main_KeyPress:
2881 key = VRGet('Main', 'KeyString')
2882 IF key == '{F5}' THEN CALL Refresh
2883RETURN
2884
2885/*:VRX Main_Resize
2886*/
2887Main_Resize:
2888 if options.!debug == 1 then say time()' Main_Resize started'
2889 ok = VRset("Main","Painting", 0)
2890
2891 /* Basic measurements */
2892 main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */
2893 main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */
2894
2895/** This caused weird resizing glitches, horrible jittering, etc. Instead,
2896 ** what we now do (further down) is set a minimum size in twips for the right
2897 ** pane, below which it simply stops resizing and switches to clipping. (The
2898 ** left pane resizes all its controls dynamically anyway.) This better matches
2899 ** standard application behaviour, and makes resizing behave more smoothly.
2900 *
2901 * if VRMethod( "Screen", "TwipsToPixels", main_iheight) < 600 then
2902 * ok = VRSet("Main","Height",VRMethod( "Screen", "PixelsToTwips", 580))
2903 * if VRMethod( "Screen", "TwipsToPixels", main_iwidth) < 730 then
2904 * ok = VRSet("Main","Width", VRMethod( "Screen", "PixelsToTwips", 730))
2905 */
2906
2907 sbar_height = VRGet("GB_STATUSBAR","Height") /* Height of status-bar */
2908 split_left = VRGet("SPLIT_Main","Left") /* Position of the left edge of the split-bar */
2909 marginx2 = margin * 2 /* Common margin around controls */
2910 pbtn_height = 400 /* Height of the panels' internal button areas */
2911
2912 pane_height = main_iheight - sbar_height - (margin * 4) /* Height of a split-bar panel */
2913 lpane_width = split_left - margin /* Width of the left split-bar panel */
2914 rpane_width = main_iwidth - split_left - 60 - margin /* Width of the right split-bar panel */
2915
2916 /* Tabbed Dialog = right pane */
2917 ok = VRset("TDL_1", "Top", marginx2)
2918 ok = VRset("TDL_1", "Left", split_left + 60)
2919 ok = VRset("TDL_1", "Width", rpane_width )
2920 ok = VRset("TDL_1", "Height", pane_height )
2921
2922 /* Current Panel */
2923 ok = VRSet("GB_CURRENT", "Visible", 1 )
2924 ok = VRSet("GB_CURRENT", "Top", marginx2 )
2925 ok = VRSet("GB_CURRENT", "Left", margin )
2926 ok = VRSet("GB_CURRENT", "Width", lpane_width )
2927 ok = VRSet("GB_CURRENT", "Height", pane_height )
2928
2929 ok = VRset("GB_CURRENT3", "Top", margin )
2930 ok = VRset("GB_CURRENT3", "Left", margin )
2931 ok = VRset("GB_CURRENT3", "Height", 245 )
2932 ok = VRset("GB_CURRENT3", "Width", lpane_width - marginx2)
2933
2934 ok = VRset("DT_CURRENT", "Top", 8 )
2935 ok = VRset("DT_CURRENT", "Left", 8 )
2936 ok = VRset("DT_CURRENT", "Height", 213 )
2937 ok = VRset("DT_CURRENT", "Width", (lpane_width - marginx2) - 24 )
2938
2939 ok = VRset("GB_CURRENT2", "Left", margin )
2940 ok = VRset("GB_CURRENT2", "Top", 245 + marginx2 )
2941 ok = VRset("GB_CURRENT2", "Width", lpane_width - marginx2)
2942 ok = VRset("GB_CURRENT2", "Height", pane_height - (margin * 5) - pbtn_height - 245 )
2943
2944 ok = VRset("CN_CURRENT", "Top", margin )
2945 ok = VRset("CN_CURRENT", "Left", margin )
2946 ok = VRset("CN_CURRENT", "Width", VRGet("GB_CURRENT2","Width") - marginx2)
2947 ok = VRset("CN_CURRENT", "Height", VRGet("GB_CURRENT2","Height") - marginx2)
2948
2949 ok = VRset("PB_DETACH", "Left", margin )
2950 ok = VRset("PB_DETACH", "Top", pane_height - pbtn_height - marginx2 )
2951 ok = VRset("PB_DETACH", "Width", min((lpane_width-margin*3) % 2, 1313) )
2952 ok = VRset("PB_UNMOUNT", "Left", VRGet("PB_DETACH","Width") + marginx2)
2953 ok = VRset("PB_UNMOUNT", "Top", pane_height - pbtn_height - marginx2 )
2954 ok = VRset("PB_UNMOUNT", "Width", min((lpane_width-margin*3) % 2, 1313) )
2955
2956 /* Splitbar - reduced in size to make it more noticable */
2957 ok = VRset("SPLIT_Main", "Visible", 1 )
2958 ok = VRset("SPLIT_Main", "Top", marginx2 + (pane_height-1200)%2 )
2959 ok = VRset("SPLIT_Main", "Height", 1200 /* pane_height */ )
2960
2961 /* Statusbar */
2962 ok = VRSet("GB_STATUSBAR", "Left", margin )
2963 ok = VRSet("GB_STATUSBAR", "Top", main_iheight - sbar_height - margin )
2964 ok = VRSet("GB_STATUSBAR", "Width", lpane_width + 50 + rpane_width )
2965
2966 ok = VRset("DT_STATUSBAR", "Top", 12 )
2967 ok = VRset("DT_STATUSBAR", "Left", 12 )
2968 ok = VRset("DT_STATUSBAR", "Height", VRGet("GB_STATUSBAR","Height") -24 )
2969 ok = VRset("DT_STATUSBAR", "Width", (lpane_width + 50 + rpane_width) - 24 )
2970
2971 /* Modified for notebook pages */
2972 pane_height = marginx2 + pane_height -1180
2973 rpane_width = marginx2 + rpane_width -760
2974 /* Use this as the width for the container pages, which don't have as strict a minimum width */
2975 rcnr_width = rpane_width
2976
2977 /* Minimum size of right panel (based on SW_DIALOG which is the largest) */
2978 if pane_height < 5360 then pane_height = 5360
2979 if rpane_width < 6010 then rpane_width = 6010
2980
2981 /* Dialog page */
2982 ok = VRSet("GB_DIALOG", "Top", margin /* marginx2 */ )
2983 ok = VRSet("GB_DIALOG", "Left", margin /* marginx2 */ /* split_left + 60 */ )
2984 ok = VRset("GB_DIALOG", "Height", pane_height )
2985 ok = VRset("GB_DIALOG", "Width", rpane_width )
2986
2987 ok = VRset("PB_MOUNT", "Left", margin )
2988 ok = VRset("PB_MOUNT", "Top", pane_height - pbtn_height - marginx2)
2989 ok = VRset("PB_EDIT_CANCEL", "Left", VRGet("PB_MOUNT","Width") + marginx2)
2990 ok = VRset("PB_EDIT_CANCEL", "Top", pane_height - pbtn_height - marginx2)
2991
2992 ok = VRset("PB_DIALOG_HELP", "Left", rpane_width - marginx2 - VRGet("PB_DIALOG_HELP","Width") + 24)
2993 ok = VRset("PB_DIALOG_HELP", "Top", pane_height - pbtn_height - marginx2)
2994
2995 ok = VRset("GB_SHARE", "Left", margin )
2996 ok = VRset("GB_SHARE", "Top", marginx2 /* 245 + marginx2 */ )
2997 ok = VRset("GB_SHARE", "Height", 2252 )
2998 ok = VRset("GB_SHARE", "Width", rpane_width - marginx2 )
2999
3000 ok = VRset("GB_AUTH", "Left", margin )
3001 ok = VRset("GB_AUTH", "Top", margin * 3 + VRGet("GB_SHARE","Height") /* 245 + (margin * 3) + VRGet("GB_SHARE","Height") */ )
3002 ok = VRset("GB_AUTH", "Width", rpane_width - marginx2 )
3003
3004 ok = VRset("GB_MPOINT","Left", margin )
3005 ok = VRset("GB_MPOINT","Top", /* 245 + */ (margin * 4) + VRGet("GB_SHARE","Height") + VRGet("GB_AUTH","Height"))
3006 ok = VRset("GB_MPOINT","Width", rpane_width - marginx2 )
3007
3008 /* Advanced page */
3009 ok = VRSet("GB_ADVANCED", "Top", margin /* marginx2 */ )
3010 ok = VRSet("GB_ADVANCED", "Left", margin /* marginx2 */ /* split_left + 60 */ )
3011 ok = VRset("GB_ADVANCED", "Height", pane_height )
3012 ok = VRset("GB_ADVANCED", "Width", rpane_width )
3013
3014 ok = VRset("GB_ADVANCED2", "Left", margin )
3015 ok = VRset("GB_ADVANCED2", "Top", /* 245 + */ marginx2)
3016 ok = VRset("GB_ADVANCED2", "Width", rpane_width - marginx2)
3017 ok = VRset("GB_ADVANCED2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
3018
3019 ok = VRset("PB_ADVANCED_APPLY", "Left", margin )
3020 ok = VRset("PB_ADVANCED_APPLY", "Top", pane_height - pbtn_height - marginx2)
3021 ok = VRset("PB_ADVANCED_UNDO", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
3022 ok = VRset("PB_ADVANCED_UNDO", "Top", pane_height - pbtn_height - marginx2)
3023 ok = VRset("PB_ADVANCED_HELP", "Left", rpane_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24)
3024 ok = VRset("PB_ADVANCED_HELP", "Top", pane_height - pbtn_height - marginx2)
3025
3026 /* SMBTree page */
3027 ok = VRSet("GB_SMBTREE", "Top", margin /* x2 */ )
3028 ok = VRSet("GB_SMBTREE", "Left", margin /* x2 */ /* split_left + 60 */ )
3029 ok = VRset("GB_SMBTREE", "Height", pane_height )
3030 ok = VRset("GB_SMBTREE", "Width", rcnr_width )
3031
3032 ok = VRset("GB_SMBTREE2","Left", margin )
3033 ok = VRset("GB_SMBTREE2","Top", /* 45 + */ marginx2 )
3034 ok = VRset("GB_SMBTREE2","Width", rcnr_width - marginx2)
3035 ok = VRset("GB_SMBTREE2","Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
3036
3037 ok = VRset("CN_SMBTREE", "Top", margin )
3038 ok = VRset("CN_SMBTREE", "Left", margin )
3039 ok = VRset("CN_SMBTREE", "Width", VRGet("GB_SMBTREE2","Width") - marginx2)
3040 ok = VRset("CN_SMBTREE", "Height", VRGet("GB_SMBTREE2","Height") - marginx2)
3041
3042 ok = VRset("PB_SMBTREE_CONNECT", "Left", margin )
3043 ok = VRset("PB_SMBTREE_CONNECT", "Top", pane_height - pbtn_height - marginx2)
3044 ok = VRset("PB_SMBTREE_REFRESH", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
3045 ok = VRset("PB_SMBTREE_REFRESH", "Top", pane_height - pbtn_height - marginx2)
3046
3047 hlpmin = VRGet("PB_SMBTREE_REFRESH", "Left") + VRGet("PB_SMBTREE_REFRESH","Width") + marginx2
3048 hlppos = rcnr_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24
3049 IF hlppos < hlpmin THEN hlppos = hlpmin
3050
3051 ok = VRset("PB_SMBTREE_HELP", "Left", hlppos )
3052 ok = VRset("PB_SMBTREE_HELP", "Top", pane_height - pbtn_height - marginx2)
3053
3054 ok = VRset("PICT_THROBBER", "Top", VRGet("CN_SMBTREE","Height") % 2 - 100 )
3055 ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width") % 2 - 200 )
3056
3057 /* Connection details page */
3058 ok = VRSet("GB_CONDET", "Top", margin /* x2 */ )
3059 ok = VRSet("GB_CONDET", "Left", margin /* x2 */ /* split_left + 60 */ )
3060 ok = VRset("GB_CONDET", "Height", pane_height )
3061 ok = VRset("GB_CONDET", "Width", rcnr_width )
3062
3063 ok = VRset("GB_CONDET2", "Left", margin )
3064 ok = VRset("GB_CONDET2", "Top", /* 245 + */ marginx2)
3065 ok = VRset("GB_CONDET2", "Width", rcnr_width - marginx2)
3066 ok = VRset("GB_CONDET2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
3067
3068 ok = VRset("CN_CONDET", "Top", margin )
3069 ok = VRset("CN_CONDET", "Left", margin )
3070 ok = VRset("CN_CONDET", "Width", VRGet("GB_CONDET2","Width") - marginx2)
3071 ok = VRset("CN_CONDET", "Height", VRGet("GB_CONDET2","Height") - marginx2)
3072
3073 ok = VRset("PB_CONDET_SAVE", "Left", margin )
3074 ok = VRset("PB_CONDET_SAVE", "Top", pane_height - pbtn_height - marginx2 )
3075 ok = VRset("PB_CONDET_LOAD", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
3076 ok = VRset("PB_CONDET_LOAD", "Top", pane_height - pbtn_height - marginx2 )
3077
3078 hlpmin = VRGet("PB_CONDET_LOAD", "Left") + VRGet("PB_CONDET_LOAD","Width") + marginx2
3079 hlppos = rcnr_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24
3080 IF hlppos < hlpmin THEN hlppos = hlpmin
3081
3082 ok = VRset("PB_CONDET_HELP", "Left", hlppos )
3083 ok = VRset("PB_CONDET_HELP", "Top", pane_height - pbtn_height - marginx2)
3084
3085 /* Global settings page */
3086 ok = VRSet("GB_GLOBAL", "Top", margin /* x2 */ )
3087 ok = VRSet("GB_GLOBAL", "Left", margin /* x2 */ /* split_left + 60 */ )
3088 ok = VRset("GB_GLOBAL", "Height", pane_height )
3089 ok = VRset("GB_GLOBAL", "Width", rpane_width )
3090
3091 ok = VRset("GB_GLOBAL2", "Left", margin )
3092 ok = VRset("GB_GLOBAL2", "Top", marginx2 /* 245 + marginx2 */ )
3093 ok = VRset("GB_GLOBAL2", "Width", rpane_width - marginx2 )
3094
3095 ok = VRset("GB_RESOLUTION", "Left", margin )
3096 ok = VRset("GB_RESOLUTION", "Top", margin * 3 + VRGet("GB_GLOBAL2","Height") /* 245 + (margin * 3) + VRGet("GB_GLOBAL2","Height") */ )
3097 ok = VRset("GB_RESOLUTION", "Width", rpane_width - marginx2 )
3098
3099 ok = VRset("GB_LOGGING","Left", margin )
3100 ok = VRset("GB_LOGGING","Top", /* 245 + */ (margin * 4) + VRGet("GB_GLOBAL2","Height") + VRGet("GB_RESOLUTION","Height"))
3101 ok = VRset("GB_LOGGING","Width", rpane_width - marginx2 )
3102
3103 ok = VRset("PB_SETTINGS_APPLY", "Left", margin )
3104 ok = VRset("PB_SETTINGS_APPLY", "Top", pane_height - pbtn_height - marginx2 )
3105 ok = VRset("PB_SETTINGS_APPLY", "Height", pbtn_height)
3106 ok = VRset("PB_SETTINGS_UNDO", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
3107 ok = VRset("PB_SETTINGS_UNDO", "Top", pane_height - pbtn_height - marginx2 )
3108 ok = VRset("PB_SETTINGS_UNDO", "Height", pbtn_height)
3109 ok = VRset("PB_SETTINGS_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
3110 ok = VRset("PB_SETTINGS_HELP", "Top", pane_height - pbtn_height - marginx2)
3111 ok = VRset("PB_SETTINGS_HELP", "Height", pbtn_height)
3112
3113 /* SMB.CONF Settings page */
3114 ok = VRSet("GB_SMBCONFX", "Top", margin /* x2 */ )
3115 ok = VRSet("GB_SMBCONFX", "Left", margin /* x2 */ /* split_left + 60 */ )
3116 ok = VRset("GB_SMBCONFX", "Height", pane_height )
3117 ok = VRset("GB_SMBCONFX", "Width", rpane_width )
3118
3119 ok = VRset("GB_SMBCONF2", "Left", margin )
3120 ok = VRset("GB_SMBCONF2", "Top", marginx2 )
3121 ok = VRset("GB_SMBCONF2", "Width", rpane_width - marginx2 )
3122 ok = VRset("GB_SMBCONF2", "Height", pane_height - (margin * 7) - pbtn_height /* - 245 */ )
3123
3124 ok = VRset("PB_SMBCONF_APPLY", "Left", margin )
3125 ok = VRset("PB_SMBCONF_APPLY", "Top", pane_height - pbtn_height - marginx2 )
3126 ok = VRset("PB_SMBCONF_APPLY", "Height", pbtn_height)
3127 ok = VRset("PB_SMBCONF_UNDO", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
3128 ok = VRset("PB_SMBCONF_UNDO", "Top", pane_height - pbtn_height - marginx2 )
3129 ok = VRset("PB_SMBCONF_UNDO", "Height", pbtn_height)
3130 ok = VRset("PB_SMBCONF_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
3131 ok = VRset("PB_SMBCONF_HELP", "Top", pane_height - pbtn_height - marginx2)
3132 ok = VRset("PB_SMBCONF_HELP", "Height", pbtn_height)
3133
3134 /* DOne with pages */
3135 ok = VRset("Main","Painting", 1)
3136
3137 /* check and empty event queue, trash spurious resize events */
3138 EventString = ''
3139 TrashedResize = 0
3140
3141 do until EventString = 'nop'
3142 EventString = VREvent('N')
3143 if EventString <> 'nop' then do
3144 if EventString = 'CALL Main_Resize' then TrashedResize = 1
3145 else interpret eventString
3146 end
3147 end
3148 if TrashedResize then CALL Main_Resize
3149
3150 if options.!debug == 1 then say time()' Main_Resize done'
3151return
3152/*:VRX Menu_Context_ChangeView_Click
3153*/
3154Menu_Context_ChangeView_Click:
3155 ok = VRSet("Cn_Current","View","NameTree")
3156return
3157
3158/*:VRX Menu_Context_Detach_All_Click
3159*/
3160Menu_Context_Detach_All_Click:
3161 ok = VRMethod( "CN_CURRENT", "GetRecordList", "All", "umrh." )
3162 do um = 1 to umrh.0
3163 ok = VRMethod( "CN_CURRENT", "SetRecordAttr", umrh.um, "Selected", 1)
3164 call PB_DETACH_Click
3165 end
3166 drop um umrh.
3167return
3168
3169/*:VRX Menu_Context_Detach_Click
3170*/
3171Menu_Context_Detach_Click:
3172 call PB_DETACH_Click
3173return
3174
3175/*:VRX Menu_Context_Edit_Click
3176*/
3177Menu_Context_Edit_Click:
3178 if options.!debug == 1 then say time()' Menu_Context_Edit_Click started'
3179 /* call VRMethod "TDL_1", 'PostEvent', 'PageSelected', 'Page', 1 */
3180 ok = VRset("TDL_1", 'Selected', 1)
3181 options.!editmode = 1
3182 CALL VRSet "PB_EDIT_CANCEL","Visible", 1
3183 CALL VRSet "PB_UNMOUNT","Enabled", 0
3184
3185 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(33)" " )
3186/* CALL NLVSetText "DT_DIALOG","Caption",33 */
3187 CALL VRSet "GB_CURRENT", "ENABLED", 0
3188
3189 ok = VRSet("CB_MOUNT","Value","")
3190 ok = VRSet("CB_MOUNT","Selected",1)
3191 ok = VRSet("CB_MOUNT","Value",mtype.1)
3192
3193 parse var p_string p_workgroup':\\'p_server'\'p_share
3194
3195 /* if options.!debug == 1 then say time()' '||p_workgroup */
3196
3197 if options.!debug == 1 then say time()' data '||data
3198 if options.!debug == 1 then say time()' domain '||p_workgroup
3199 if options.!debug == 1 then say time()' server '||p_server
3200 if options.!debug == 1 then say time()' share '||p_share
3201 if options.!debug == 1 then say time()' string '||p_string
3202
3203
3204 CALL VRSet "EF_SHARE", "VALUE", p_share
3205 CALL VRSet "EF_SERVER", "VALUE", p_server
3206 CALL VRSet "EF_NETWORK","VALUE", p_workgroup
3207
3208 /* if options.!debug == 1 then say time()' '||p_node */
3209 parse var p_node p_drive'\'p_directory'\'
3210 CALL VRSet "CB_DRIVES", "Value", p_drive
3211 CALL VRSet "EF_DIRECTORY", "Value", p_directory
3212 if options.!debug == 1 then say time()' Menu_Context_Edit_Click done'
3213return
3214
3215/*:VRX Menu_Context_Open_Click
3216*/
3217Menu_Context_Open_Click:
3218 ok = VRSet("Menu_Context_Open_Default","Visible",0)
3219return
3220
3221/*:VRX Menu_Context_Open_Default_Click
3222*/
3223Menu_Context_Open_Default_Click:
3224 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Click started"
3225 if \VRIsValidObject(rh) then return
3226
3227 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3228 PARSE VAR userdata mountpoint ';' mounts ';' .
3229
3230 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3231
3232 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DEFAULT" )
3233
3234 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Click done"
3235return
3236
3237/*:VRX Menu_Context_Open_Detail_Click
3238*/
3239Menu_Context_Open_Detail_Click:
3240 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click started"
3241 if \VRIsValidObject(rh) then return
3242
3243 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3244 PARSE VAR userdata mountpoint ';' mounts ';' .
3245
3246 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3247
3248 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DETAILS" )
3249
3250 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click done"
3251return
3252
3253/*:VRX Menu_Context_Open_Icon_Click
3254*/
3255Menu_Context_Open_Icon_Click:
3256 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click started"
3257 if \VRIsValidObject(rh) then return
3258
3259 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3260 PARSE VAR userdata mountpoint ';' mounts ';' .
3261
3262 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3263
3264 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "ICON" )
3265
3266 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click done"
3267return
3268
3269/*:VRX Menu_Context_Open_Settings_Click
3270*/
3271Menu_Context_Open_Settings_Click:
3272 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Settings_Click started"
3273 if \VRIsValidObject(rh) then return
3274
3275 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3276 PARSE VAR userdata mountpoint ';' mounts ';' .
3277
3278 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3279
3280 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SETTINGS" )
3281
3282 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Settings_Click done"
3283return
3284
3285/*:VRX Menu_Context_Open_Splitview_Click
3286*/
3287Menu_Context_Open_Splitview_Click:
3288 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click started"
3289 if \VRIsValidObject(rh) then return
3290
3291 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3292 PARSE VAR userdata mountpoint ';' mounts ';' .
3293
3294 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3295
3296 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SPLITVIEW" )
3297
3298 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click done"
3299return
3300
3301/*:VRX Menu_Context_Open_Tree_Click
3302*/
3303Menu_Context_Open_Tree_Click:
3304 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click started"
3305 if \VRIsValidObject(rh) then return
3306
3307 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3308 PARSE VAR userdata mountpoint ';' mounts ';' .
3309
3310 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3311
3312 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "TREE" )
3313
3314 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click done"
3315return
3316
3317/*:VRX Menu_Context_Refresh_Click
3318*/
3319Menu_Context_Refresh_Click:
3320 CALL Refresh
3321return
3322
3323/*:VRX Menu_Context_Unmount_Click
3324*/
3325Menu_Context_Unmount_Click:
3326 call PB_UNMOUNT_Click
3327return
3328
3329/*:VRX Menu_File_Autostart_Activate_Click
3330*/
3331Menu_File_Autostart_Activate_Click:
3332 options.!autostart = 1
3333
3334 Profile = VRParseFilename(settings.!ini,'DPN')'.'fs.!profileext
3335 ExeName = VRParseFileName(VRget("Application","Program"),'DPNE')
3336 if ExeName = "" then do
3337 parse source . . script
3338 ExeName = VRParseFilename(script,'DP')'\'options.!appname_short'.EXE'
3339 end
3340 StartupDir = VRParseFileName(VRget("Application","Program"),'DP')
3341 if StartupDir = "" then do
3342 parse source . . script
3343 StartUpDir = VRParseFilename(script,'DP')
3344 end
3345
3346 ObjTitle = NLVGetMessage( 59 )
3347 if ObjTitle = "" then ObjTitle = '[EVFS LAN-Connections]'
3348
3349 CALL PB_CONDET_SAVE_Click
3350
3351 rc = CreateObject( 'WPProgram', ObjTitle,'<WP_START>',,
3352 'EXENAME='||ExeName||';'||,
3353 'PROGTYPE=PM;'||,
3354 'TITLE='ObjTitle';'||,
3355 'PARAMETERS='Profile' -AUTOCLOSE -NOGUI;'||,
3356 'STARTUPDIR='StartupDir';'||,
3357 'NOPRINT=YES;'||,
3358 'HIDEBUTTON=DEFAULT;'||,
3359 'MINWIN=DEFAULT;'||,
3360 'CCVIEW=DEFAULT;'||,
3361 'DEFAULTVIEW=DEFAULT;'||,
3362 'OBJECTID=<'options.!appname_short'_AUTOSTART>',,
3363 'REPLACE' )
3364
3365 IF rc == 1 THEN do
3366 Text = NLVGetMessage( 60 )
3367 if Text = "" then Text = '[Created object in Autostart-Folder]'
3368 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3369 end
3370 ELSE do
3371 Text = NLVGetMessage( 61 )
3372 if Text = "" then Text = '[Could not create object in Autostart-Folder]'
3373 Title = NLVGetMessage( 5 )
3374 if Title = "" then Title = '[Error]'
3375 CALL VRMessage 'Main', Text, Title, 'E'
3376 end
3377
3378 options.!autostart = 0
3379return
3380/*:VRX Menu_File_Autostart_Click
3381*/
3382Menu_File_Autostart_Click:
3383
3384return
3385
3386/*:VRX Menu_File_Autostart_Deactivate_Click
3387*/
3388Menu_File_Autostart_Deactivate_Click:
3389 ok = SysDestroyObject("<'options.!appname_short'_AUTOSTART>")
3390 IF ok == 1 THEN do
3391 Text = NLVGetMessage( 79 )
3392 if Text = "" then Text = '[Autostart object created successfully]'
3393 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3394 end
3395 ELSE do
3396 Text = NLVGetMessage( 78 )
3397 if Text = "" then Text = '[Could find Autostart object]'
3398 Title = NLVGetMessage( 5 )
3399 if Title = "" then Title = '[Error]'
3400 CALL VRMessage 'Main', Text, Title, 'E'
3401 end
3402return
3403
3404/*:VRX Menu_File_Click
3405*/
3406Menu_File_Click:
3407 ok = VRSet("Menu_File_LMHosts_Reset", "Enabled", VRFileExists( samba.!lmhosts ))
3408 ok = VRSet("Menu_File_ucCred_Reset", "Enabled", (VRGet("Pict_PWINMEM","PicturePath") = "#36"))
3409return
3410
3411/*:VRX Menu_File_Close_Click
3412*/
3413Menu_File_Close_Click:
3414 call Quit
3415return
3416
3417/*:VRX Menu_File_Daemon_Start_Click
3418*/
3419Menu_File_Daemon_Start_Click:
3420 if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click started'
3421 if VRFileExists(SysBootDrive()"\ndpsmb.dbg") then do
3422 btns.0 = 2
3423 btns.1 = NLVGetMessage( 6 )
3424 btns.2 = NLVGetMessage( 7 )
3425 confirm = VRMessage('Main', NLVGetMessage( 119 ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3426 IF confirm == 1 THEN do
3427 logFiles = value("LOGFILES",,"OS2ENVIRONMENT")
3428 ok1 = SysFileDelete(Logfiles||'\log.smbc')
3429 ok2 = SysFileDelete(Logfiles||'\log.ndpsmb')
3430 if ok1 <> 0 | ok2 <> 0 then do
3431 ok = VRMessage('Main', NLVGetMessage(5)' 'Logfiles||'\log.smbc RC='ok1||'0D0A'x||NLVGetMessage(5)' 'Logfiles||'\log.ndpsmb RC='ok2, NLVGetMessage( 5 ), 'E')
3432 end
3433 drop ok1 ok2
3434 end
3435 end
3436 address cmd 'detach 'fs.!prefix'CTL.EXE'
3437 ok = VRset("GB_CURRENT","Enabled", 1)
3438 ok = VRset("TDL_1","Enabled", 1)
3439 CALL REFRESH
3440 ok = VRSet("Menu_File_Daemon_Start","Enabled",0)
3441 ok = VRSet("Menu_File_Daemon_Stop","Enabled",1)
3442 if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click done'
3443return
3444
3445/*:VRX Menu_File_Daemon_Stop_Click
3446*/
3447Menu_File_Daemon_Stop_Click:
3448 if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click started'
3449 ok = PRProcessList(proc)
3450 do I = 1 to proc.0
3451 CurProc = VRParseFileName(proc.i.name,'NE')
3452 if CurProc = fs.!prefix"CTL.EXE" then do
3453 call charout , ' 'CurProc' RC='
3454 ok = PRKillProcess(1,proc.i.pid)
3455 say ok
3456 end
3457 end
3458 ok = VRset("GB_CURRENT","Enabled", 0)
3459 ok = VRset("TDL_1","Enabled", 0)
3460 ok = VRSet("Menu_File_Daemon_Start","Enabled",1)
3461 ok = VRSet("Menu_File_Daemon_Stop","Enabled",0)
3462 if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click stopped'
3463return
3464/*:VRX Menu_File_LMHosts_Reset_Click
3465*/
3466Menu_File_LMHosts_Reset_Click:
3467 call _LMHostsReset
3468return
3469
3470/*:VRX Menu_File_Load_Click
3471*/
3472Menu_File_Load_Click: PROCEDURE EXPOSE settings. options. icons. advanced. vfs. Profile fs. cd. samba.
3473 IF options.!autoload == 1 then filename = Profile
3474 else filename = VRFileDialog('Main', NLVGetMessage( 55 ), 'L', '*.'fs.!profileext)
3475 IF filename == '' THEN RETURN
3476 IF STREAM( filename, 'C', 'QUERY EXISTS') == '' THEN DO
3477 CALL VRMessage 'Main', NLVGetMessage( 56, filename ), NLVGetMessage( 5 ), 'E'
3478 RETURN
3479 END
3480
3481 CALL LINEIN filename, 1, 0
3482 DO WHILE LINES( filename )
3483 /* Fix Ticket #202 in order to allow blanks in sharenames */
3484 resline = LINEIN( filename )
3485 nodelen = pos('\\',resline)-2
3486 node = left(resline,nodelen)
3487 rwFlag = word(resline,words(resline))
3488 resource = substr(resline,nodelen+2,length(resline)-(nodelen+2)-(length(rwFlag)+1)+1)
3489 drop resline
3490 drop nodelen
3491
3492 vfs.!drive = FILESPEC('DRIVE', node )
3493 vfs.!mountpoint = STRIP( node, 'T', '\')
3494
3495 /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
3496 if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
3497
3498 call ParseResParmString
3499
3500 options.!workgroup = p_workgroup
3501 options.!server = p_server
3502 options.!share = p_share
3503 options.!user = p_user
3504 options.!password = p_password
3505 options.!spassword = p_spassword
3506 options.!master = p_master
3507 options.!mastertype = p_mtype
3508/* options.!memlen = p_memlen
3509 options.!logfile = p_logfile
3510 options.!loglevel = p_loglevel */
3511 options.!cachetimeout = p_cachetimeout
3512 options.!cachelistings = p_cachelistings
3513 options.!easupport = p_easupport
3514
3515 IF rwFlag == 'R' THEN
3516 options.!readonly = 1
3517 ELSE
3518 options.!readonly = 0
3519
3520 CALL Mount
3521
3522 END
3523 CALL STREAM filename, 'C', 'CLOSE'
3524
3525 options.!autoload = 0
3526
3527 CALL Refresh
3528RETURN
3529/*:VRX Menu_File_Save_Click
3530*/
3531Menu_File_Save_Click:
3532 call PB_CONDET_SAVE_Click
3533return
3534
3535/*:VRX Menu_File_ucCred_Reset_Click
3536*/
3537Menu_File_ucCred_Reset_Click:
3538 if _ucChkUc() then ok = _ucDelUc()
3539 ok = VRSet("Pict_PWINMEM","PicturePath","#37")
3540 ok = VRSet("EF_USER", "Value","")
3541 ok = VRSet("EF_PASSWORD","Value","")
3542 call _UserCredUpdate
3543return
3544
3545/*:VRX Menu_Help_About_Click
3546*/
3547Menu_Help_About_Click:
3548 ok = VRLoadSecondary("SW_ABOUT", "W")
3549return
3550
3551/*:VRX Menu_Help_Extended_Click
3552*/
3553Menu_Help_Extended_Click:
3554 ok = VRMethod( "Main", "InvokeHelp" )
3555return
3556
3557/*:VRX Menu_Selected_Connect_Click
3558*/
3559Menu_Selected_Connect_Click:
3560 call PB_SMBTREE_CONNECT_Click
3561return
3562
3563/*:VRX Menu_Selected_Default_Workgroup_Click
3564*/
3565Menu_Selected_Default_Workgroup_Click:
3566 if options.!debug == 1 then say time()' '||"Menu_Selected_Default_Workgroup_Click started"
3567 if options.!debug == 1 then say ' SMBObj.rh = "'SMBObj.rh'"'
3568 Success = 0
3569 if SMBObj.rh <> "" then do
3570 if options.!debug == 1 then say ' SMBObj.udatatype = "'SMBObj.udatatype'"'
3571 Success = 1
3572 select
3573 when SMBObj.udatatype = "WORKGROUP" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.rh,"Caption")
3574 when SMBObj.udatatype = "DISK" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.gparentrh,"Caption")
3575 when SMBObj.udatatype = "PRINTER" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.gparentrh,"Caption")
3576 when SMBObj.udatatype = "SERVER" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
3577 otherwise Success = 0
3578 end
3579
3580 /* FIXME: switch over to REXXIni calls */
3581 if Success = 1 then ok = TRSetIni("[global]","workgroup", workgroupname, samba.!smbconf)
3582 end
3583 Buttons.1 = NLVGetMessage(2)
3584 Buttons.0 = 1
3585
3586 if Success = 0 then do
3587 id = VRMessage( VRWindow(), NLVGetMessage(5), NLVGetMessage(75), "Error", "Buttons.", 1, 1 )
3588 end
3589 else do
3590 id = VRMessage( VRWindow(), NLVGetMessage(117, workgroupname), NLVGetMessage(75), "Information", "Buttons.", 1, 1 )
3591 end
3592 if options.!debug == 1 then say time()' '||"Menu_Selected_Default_Workgroup_Click done"
3593return
3594
3595/*:VRX Menu_Selected_DetailsView_Click
3596*/
3597Menu_Selected_DetailsView_Click:
3598 ok = VRSet("CN_smbtree", "View", "Detail")
3599return
3600
3601/*:VRX Menu_Selected_Info_Click
3602*/
3603Menu_Selected_Info_Click:
3604 if options.!debug == 1 then say time()' Menu_Selected_Info_Click started'
3605
3606 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3607 if SelRH.0 = 0 then do
3608 if options.!debug == 1 then say time()' Menu_Selected_Info_Click aborted'
3609 return
3610 end
3611
3612 call _GetSMBObjectProperties SelRH.1
3613
3614 window = VRLoadSecondary( "SW_INFO", "W" )
3615 if options.!debug == 1 then say time()' Menu_Selected_Info_Click done'
3616return
3617
3618/*:VRX Menu_Selected_Refresh_Click
3619*/
3620Menu_Selected_Refresh_Click:
3621 ok = VRMethod( "CN_smbtree", "SetRecordAttr", SMBObj.rh, "Icon","#61:PMWP.DLL")
3622 call _DelSMBObjectShares SMBObj.rh
3623 machine = SMBObj.resname
3624 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
3625 call _RefreshShares
3626return
3627
3628/*:VRX Menu_Selected_Remove_Click
3629*/
3630Menu_Selected_Remove_Click:
3631 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
3632 if selrec.0 = 0 then return
3633
3634 do I = 1 to selrec.0
3635 if VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.statusfh) = icons.!passive then do
3636 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3637 end
3638 else do
3639 mountpoint = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpointfh)
3640 mpidx = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpidxfh)
3641 if mpidx = 1 then do
3642 btns.0 = 2
3643 btns.1 = NLVGetMessage( 6 )
3644 btns.2 = NLVGetMessage( 7 )
3645 confirm = VRMessage('Main', NLVGetMessage( 72, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3646 IF confirm \= 1 THEN RETURN
3647
3648 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "mpidx")"
3649 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3650 CALL Refresh
3651 end
3652 else do
3653 CALL VRMessage 'Main', NLVGetMessage( 71 ) , NLVGetMessage( 89 )||" "||mountpoint , 'E'
3654 end
3655 end
3656 end
3657return
3658
3659/*:VRX Menu_Selected_Retry_Click
3660*/
3661Menu_Selected_Retry_Click: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba. mtype.
3662
3663 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "srcrec." )
3664 if srcrec.0 = 0 then return
3665
3666 srcrec = srcrec.1
3667
3668 p_mpoint = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.MpointFH)
3669
3670 p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcrec, cd.workgrpFH )
3671 p_server = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ServerFH)
3672 p_share = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ShareFH)
3673 p_user = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.UserFH)
3674 p_password = x2c(VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.SpasswordFH))
3675
3676 ShareLevel = 1
3677 if p_share = "" then ShareLevel = 2
3678 if p_server = "" then ShareLevel = 3
3679 if p_workgroup = "" then ShareLevel = 4
3680
3681 ok = VRSet("CB_MOUNT", "Selected", Sharelevel )
3682 ok = VRset("CB_MOUNT", "Value", mtype.sharelevel)
3683
3684 call _UpdateObject "EF_SERVER", p_server
3685 ok = VRset("EF_SHARE" , "Value", p_share)
3686 ok = VRset("EF_NETWORK", "Value", p_workgroup)
3687 ok = VRset("EF_USER" , "Value", p_user)
3688 ok = VRset("EF_PASSWORD", "Value", p_password)
3689
3690 parse var p_mpoint p_drv '\' p_dir
3691
3692 p_dir = strip(p_dir,'T','\')
3693
3694 ok = VRset("CB_DRIVES" , "Value", p_drv)
3695 ok = VRset("EF_DIRECTORY" , "Value", p_dir)
3696
3697 CALL PB_MOUNT_Click
3698
3699/* if VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
3700 if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
3701 end */
3702return
3703
3704/*:VRX Menu_Selected_TimeSync_Click
3705*/
3706Menu_Selected_TimeSync_Click:
3707 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click started'
3708
3709 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3710 if SelRH.0 = 0 then do
3711 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click aborted'
3712 return
3713 end
3714
3715 call _GetSMBObjectProperties SelRH.1
3716
3717 options.!timesrv = SMBObj.resname
3718 call _TimeSync
3719
3720 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click done'
3721return
3722
3723/*:VRX Menu_Selected_TreeView_Click
3724*/
3725Menu_Selected_TreeView_Click:
3726 ok = VRSet("CN_smbtree", "View", "IconTree")
3727return
3728
3729/*:VRX Mount
3730*/
3731Mount: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba.
3732 if options.!debug == 1 then say time()' Mount procedure started'
3733 /* Set mouse pointer to wait - this operation might take a few seconds */
3734 call VRSet VRWindow(), 'Pointer', 'Wait'
3735
3736/* Disabled, because we merge profile now - in earlier revisions
3737 we replaced it but only for preexisting drives - this made only
3738 sense as long as we were unable to detect double connections -
3739 this could be made an option!
3740
3741 IF options.!autoload then do
3742 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"vfs.!drive"')"
3743 if options.!debug == 1 then say time()' '||'Autoload Detach "'vfs.!drive'" =' ok
3744 end */
3745
3746 /* Attach the virtual drive - only if drive is not already attached */
3747 if pos(vfs.!drive,MyFreeDriveMap("C:","FREE")) > 0 then do
3748 CALL _Dynamic "ok = "fs.!prefix"RxAttach('"vfs.!drive"')"
3749
3750 if options.!debug == 1 then say time()' '||'Attach "'vfs.!drive'" =' ok
3751 end
3752
3753 /* Create the mount point and store whether it was created or already existed */
3754 CALL _Dynamic "CreateMP = "fs.!prefix"RxCreateMountPoint('"vfs.!mountpoint"')"
3755
3756 if options.!debug == 1 then say time()' '||'Create "'vfs.!mountpoint'" = 'CreateMP
3757
3758
3759 /* Build the resource parameter string */
3760 src = ''
3761 IF options.!workgroup \= '' THEN src = src';WORKGROUP='options.!workgroup
3762 IF options.!server \= '' THEN src = src';SERVER='options.!server
3763 IF options.!share \= '' THEN src = src';SHARE='options.!share
3764 IF options.!user \= '' THEN src = src';USER='options.!user
3765 IF options.!password \= '' THEN src = src';PASSWORD='options.!password
3766 IF options.!spassword \= '' THEN src = src';SPASSWORD='options.!spassword
3767 IF options.!master \= '' THEN src = src';MASTER='options.!master
3768 IF options.!mastertype \= '' THEN src = src';MASTERTYPE='options.!mastertype
3769/* IF options.!memlen \= '' THEN src = src';MEMLEN='options.!memlen
3770 IF options.!logfile \= '' THEN src = src';LOGFILE='options.!logfile
3771 IF options.!loglevel \= '' THEN src = src';LOGLEVEL='options.!loglevel */
3772 IF options.!cachetimeout \= '' THEN src = src';CTO='options.!cachetimeout
3773 IF options.!cachelistings \= '' THEN src = src';CLD='options.!cachelistings
3774 IF options.!easupport \= '' THEN src = src';EASUPPORT='options.!easupport
3775
3776 IF options.!readonly = 1 then rwFlag = 'R'; else rwFlag = 'W'
3777
3778 parse var vfs.!mountpoint mpoint ';' .
3779 mpoint = strip(mpoint,'T','\')||'\'
3780
3781 if options.!master = "" then options.!master = "WORKGROUP"
3782 if options.!mtype = "" then options.!mtype = "1"
3783 if options.!loglevel = "" then options.!loglevel = "0"
3784 if options.!memlen = "" then options.!memlen = "2"
3785 if options.!cachetimeout = "" then options.!cachetimeout = "10"
3786 if options.!cachelistings = "" then options.!cachelistings = "32"
3787 if options.!easupport= "" | options.!easupport= " " then options.!easupport = strip(options.!easupport)
3788 if options.!password <> "" & options.!spassword = "" then do
3789 options.!spassword = c2x(options.!password)
3790 options.!password = ""
3791 end
3792
3793 hashstr = mpoint' 'translate(options.!workgroup)' 'translate(options.!server)' 'translate(options.!share)' 'options.!user' 'options.!spassword' 'options.!easupport' 'rwFlag
3794
3795 md5 = rexx_md5(hashstr)
3796
3797 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
3798 DO i = 1 TO records.0
3799 hash = VRMethod("CN_CONDET","GetFieldData", records.i, cd.hashfh)
3800
3801 if options.!debug == 1 then say VRMethod("CN_CONDET","GetFieldData", records.i, CD.mpointFH)'->'hash
3802 if options.!debug == 1 then say mpoint'->'md5
3803
3804 if hash = md5 then do
3805 If VRMethod("CN_CONDET","GetFieldData", records.i, cd.statusfh) = icons.!active then do /* Same hash, status active */
3806 say "Double connection detected!!"
3807 if options.!spassword <> "" then upw = ":********"
3808 else upw = ""
3809 buttons.0 = 2
3810 buttons.1 = NLVGetMessage(9)
3811 buttons.2 = NLVGetMessage(3)
3812 Answer = VRMessage('Main',NLVGetMessage(64) , NLVGetMessage( 36,options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3813 if Answer = 2 then do
3814 call VRSet VRWindow(), 'Pointer', '<default>'
3815 say "Double connection - do not mount!!"
3816 return
3817 end
3818 end
3819 else do /* Same hash, status passive - we have to remove it */
3820 ok = VRMethod("CN_CONDET", "RemoveRecord", records.i )
3821 end
3822 end
3823 end
3824
3825 cd.lastrh = ""
3826 ok = ParseResourceData(vfs.!mountpoint,'SMBFS SMBFS64 \\'options.!workgroup':'options.!server'\'options.!share'@'options.!user||src' 'rwFlag)
3827
3828 /* Now mount the resource */
3829 CALL _Dynamic "ok = "fs.!prefix"RxMount('SMBFS','"vfs.!mountpoint"', '"src"', '"rwFlag"')"
3830
3831 if options.!debug == 1 then say time()' '||'Mount "'vfs.!mountpoint'" =' ok
3832 if ok <> 0 then do
3833 if options.!password <> "" then upw = ":********"
3834 else upw = ""
3835 buttons.0 = 2
3836 buttons.1 = NLVGetMessage(2)
3837 buttons.2 = NLVGetMessage(37)
3838 Answer = VRMessage('Main', SysGetMessage(ok), NLVGetMessage( 36, options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3839 if Answer = 2 then do /* Show explanation */
3840 xx = VRMessage('Main', NLVGetMessage( 36, options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint )||'0D0A'x||'0D0A'x||SysGetMessage(ok)||'0D0A'x||'0D0A'x||SysGetMessage(ok, 'OSO001H.MSG'), NLVGetMessage(37), 'W')
3841 end
3842 if cd.lastrh <> '' then do
3843 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive) /* Passive Connection icon */
3844 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive) /* Passive Connection icon */
3845 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, '') /* remove pain text password */
3846 end
3847
3848 /* In case the mountpoint was created for this failed operation, it is (optionally) removed again */
3849 if CreateMP = 0 & advanced.!alwaysmp <> 1 then do
3850 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"vfs.!mountpoint"')"
3851 if options.!debug == 1 then say time()' '||'Remove "'vfs.!mountpoint'" = 'ok
3852 end
3853 end
3854 else do
3855 if options.!storecreds = 1 then do
3856 ok = VRSet("EF_User", "Value",options.!user)
3857 ok = VRSet("EF_Password","Value",x2c(options.!spassword))
3858 end
3859 end
3860 drop CreateMP /* not required anymore */
3861
3862/* Obsolete - the IOCtl will not be implemented this way in the plugin
3863 The REXX function is present, but is has no counterpart in the plugin
3864 ok = EvfsRxIoctl( 100 , vfs.!mountpoint, outstring)
3865 if options.!debug == 1 then say time()' '||'RxIoctl "'vfs.!mountpoint'" = 'ok', 'outstring
3866 */
3867 /* Set mouse pointer to default again */
3868 call VRSet VRWindow(), 'Pointer', '<default>'
3869 if options.!debug == 1 then say time()' Mount procedure done'
3870RETURN ok
3871
3872/*:VRX MyFreeDriveMap
3873*/
3874MyFreeDriveMap: procedure expose options. icons. fs. samba.
3875 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) started'
3876 alldrives = "C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:"
3877/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) started" */
3878 useddrives= SysDriveMap("C:","USED")
3879/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) done" */
3880
3881 Alldr = words(alldrives)
3882 FreeDriveMap = ""
3883 do I = 1 to AllDr
3884 if word(alldrives,1) = word(useddrives,1) then do
3885 Useddrives = subword(useddrives,2)
3886 Alldrives = subword(Alldrives,2)
3887 end
3888 else do
3889 FreeDriveMap = FreeDriveMap||word(alldrives,1)||' '
3890 Alldrives = subword(Alldrives,2)
3891 end
3892 end
3893 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) done, result "'FreeDriveMap'"'
3894return FreeDriveMap
3895/*:VRX NoEVFSCALL
3896*/
3897NoEVFSCALL:
3898 CALL VRMessage 'Main', NLVGetMessage( 100 ), NLVGetMessage( 5 ), 'E'
3899 signal Halt
3900RETURN
3901
3902/*:VRX ParseResourceData
3903*/
3904ParseResourceData: PROCEDURE EXPOSE userdata options. icons. advanced. fs. cd. samba.
3905 PARSE ARG userdata, resource
3906 if options.!debug == 1 then say time()' ParseResourceData started'
3907 if options.!debug == 1 then say ' receiving "'userdata'" "'resource'" length ('length(resource)')'
3908
3909/* WARNING! resource has a maximal length of 255 and is truncated otherwise */
3910
3911/* PARSE VAR resource . ';WORKGROUP='p_workgroup';SERVER='p_server';SHARE='p_share';' . */
3912
3913 if left(word(resource,1),5) <> "SMBFS" then do
3914 /* Support for other filesystems would come here! */
3915 userData = "UNKNOWN"
3916 end
3917 else do
3918 cd.lastrh = VRMethod("CN_CONDET","AddRecord")
3919 PARSE VAR userdata p_mpoint ';' p_mpidx ';' .
3920
3921 p_mpoint = strip(p_mpoint,'T','\')||'\'
3922 p_rw = word(resource, words(resource))
3923
3924 /* Workaround for truncated resource string */
3925 if length(p_rw) > 1 then do
3926 /* The resource string must have been truncated
3927 p_rw is already wrong and
3928 p_easupport will most likely be also wrong (look below for workaround!) */
3929 p_rw ="W" /* this is guessed only!!! */
3930 if options.!debug == 1 then say ' WARNING! Detected truncated resource string - shorten workgroup name, server name, share name until this message goes away!'
3931 end
3932 /* this should be done unconditionally if the resource string is never truncated */
3933 else resource = left(resource,length(resource)-length(p_rw))
3934
3935 call ParseResParmString
3936
3937 if p_master = "" then p_master = "WORKGROUP"
3938 if p_mtype = "" then p_mtype = "1"
3939 if p_loglevel = "" then p_loglevel = "0"
3940 if p_memlen = "" then p_memlen = "2"
3941
3942 /* Also works around for a truncated resource string! */
3943 if p_easupport= "" | p_easupport= " " then p_easupport = strip(options.!easupport)
3944
3945 if p_password <> "" & p_spassword = "" then do
3946 p_spassword = c2x(p_password)
3947 p_password = ""
3948 end
3949
3950 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpointFH, p_mpoint, cd.mpidxfh, p_mpidx, cd.workgrpFH , p_workgroup, cd.serverfh, p_server, cd.sharefh, p_share, cd.userfh, p_user)
3951 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password, cd.spasswordfh, p_spassword, cd.masterfh, p_master, cd.mtypefh, p_mtype)
3952 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout, cd.cldFH, p_cachelistings)
3953 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.memlenfh, p_memlen, cd.easupportfh, p_easupport, cd.logfilefh, p_logfile, cd.loglevelfh, p_loglevel, cd.rwfh, p_rw)
3954 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!active) /* Active */
3955 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!active) /* Active */
3956
3957 hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
3958
3959 md5 = rexx_md5(hashstr)
3960
3961 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh,md5)
3962
3963 SELECT
3964 WHEN p_share == '' & p_server \= '' THEN DO /* all shares on server */
3965 IF p_workgroup == '' THEN
3966 userdata = userdata';\\'p_server'\*'
3967 ELSE
3968 userdata = userdata';'p_workgroup':\\'p_server'\*'
3969 END
3970 WHEN p_server == '' & p_workgroup \= '' THEN /* all servers in workgroup */
3971 userdata = userdata';'p_workgroup':\\*'
3972 WHEN p_server == '' & p_workgroup == '' THEN /* all workgroups */
3973 userdata = userdata';*:\\*'
3974 OTHERWISE DO
3975 IF p_workgroup == '' THEN
3976 userdata = userdata';\\'p_server'\'p_share
3977 ELSE
3978 userdata = userdata';'p_workgroup':\\'p_server'\'p_share
3979 END
3980 END
3981 end
3982
3983 if options.!debug == 1 then say ' returning "'userdata'"'
3984 if options.!debug == 1 then say time()' ParseResourceData done'
3985RETURN userdata
3986
3987/*:VRX ParseResParmString
3988*/
3989ParseResParmString:
3990 PARSE VAR resource . ';WORKGROUP=' p_workgroup ';' .
3991 PARSE VAR resource . ';SERVER=' p_server ';' .
3992 PARSE VAR resource . ';SHARE=' p_share ';' .
3993 PARSE VAR resource . ';USER=' p_user ';' .
3994 PARSE VAR resource . ';PASSWORD=' p_password ';' .
3995 PARSE VAR resource . ';SPASSWORD=' p_spassword ';' .
3996 PARSE VAR resource . ';MASTER=' p_master ';' .
3997 PARSE VAR resource . ';MASTERTYPE=' p_mtype ';' .
3998 PARSE VAR resource . ';MEMLEN=' p_memlen ';' .
3999 PARSE VAR resource . ';LOGFILE=' p_logfile ';' .
4000 PARSE VAR resource . ';LOGLEVEL=' p_loglevel ';' .
4001 PARSE VAR resource . ';CTO=' p_cachetimeout ';' .
4002 PARSE VAR resource . ';CLD=' p_cachelistings ';' .
4003 PARSE VAR resource . ';EASUPPORT=' p_easupport ' '
4004return
4005/*:VRX PB_ABOUT_CLOSE_Click
4006*/
4007PB_ABOUT_CLOSE_Click:
4008 CALL SW_ABOUT_Close
4009return
4010
4011/*:VRX PB_ABOUT_COPY_Click
4012*/
4013PB_ABOUT_COPY_Click:
4014
4015 if VRGet("CB_TRAC","set") then DO
4016 remainstr = AboutStr
4017 AboutStr = ''
4018 DO WHILE remainstr <> ''
4019 PARSE VAR remainstr _part '0d0a'x remainstr
4020 AboutStr = AboutStr || _part ||'[[BR]]'||'0d0a'x
4021 END
4022 END
4023 ok = VRMethod( "Application", "PutClipboard", AboutStr )
4024 if options.!debug == 1 then call beep 880*2,10
4025 CALL SW_ABOUT_Close
4026return
4027
4028/*:VRX PB_ADVANCED_APPLY_Click
4029*/
4030PB_ADVANCED_APPLY_Click:
4031 advanced.!easupport = VRGet( "CB_EAS", "Set" )
4032 advanced.!readonly = VRGet( "CB_READONLY", "Set" )
4033 advanced.!alwaysmp = VRGet( "CB_ALWAYSMP", "Set" )
4034 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT", "Value" )
4035 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS", "Value" )
4036
4037 /* Obsolete */
4038 advanced.!memlen = VRGet( "SPB_MEMLEN", "Value" )
4039return
4040
4041/*:VRX PB_ADVANCED_HELP_Click
4042*/
4043PB_ADVANCED_HELP_Click:
4044 CALL VRMethod 'SW_ADVANCED', 'InvokeHelp'
4045return
4046
4047/*:VRX PB_ADVANCED_UNDO_Click
4048*/
4049PB_ADVANCED_UNDO_Click:
4050 CALL SW_ADVANCED_Init_Content
4051RETURN
4052
4053/*:VRX PB_ClearCred_Click
4054*/
4055PB_ClearCred_Click:
4056 call Menu_File_ucCred_Reset_Click
4057return
4058
4059/*:VRX PB_CONDET_HELP_Click
4060*/
4061PB_CONDET_HELP_Click:
4062 CALL VRMethod 'GB_CONDET', 'InvokeHelp'
4063return
4064
4065/*:VRX PB_CONDET_LOAD_Click
4066*/
4067PB_CONDET_LOAD_Click:
4068 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click started"
4069 call Menu_File_Load_Click
4070 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click done"
4071RETURN
4072
4073/*:VRX PB_CONDET_SAVE_Click
4074*/
4075PB_CONDET_SAVE_Click: PROCEDURE EXPOSE settings. options. icons. Profile fs. cd. advanced. samba.
4076 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click started"
4077
4078 if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
4079 ELSE filename = Profile
4080
4081 IF filename == '' THEN RETURN
4082
4083 IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
4084 btns.0 = 2
4085 btns.1 = NLVGetMessage( 6 )
4086 if btns.1 = "" then btns.1 = '[Yes]'
4087 btns.2 = NLVGetMessage( 7 )
4088 if btns.2 = "" then btns.2 = '[No]'
4089 Title = NLVGetMessage( 53 )
4090 if Title = "" then Title = "[File exists]"
4091 Text = NLVGetMessage( 54, filename )
4092 if Text = "" then Text = "[File "filename" exists? Overwrite?]"
4093
4094 confirm = VRMessage('Main', Text, Title, 'W', 'btns.', 1, 2 )
4095 IF confirm \= 1 THEN RETURN
4096 CALL VRChAttr filename,, 'HSR'
4097 CALL VRDeleteFile filename
4098 END
4099
4100 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
4101 DO i = 1 TO records.0
4102 resource = ""
4103 resource = resource||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
4104 resource = resource||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
4105 resource = resource||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
4106 resource = resource||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
4107 resource = resource||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
4108 resource = resource||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
4109 resource = resource||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
4110 resource = resource||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
4111 resource = resource||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
4112 resource = resource||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
4113 resource = resource||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
4114 resource = resource||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
4115 resource = resource||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
4116 resource = resource||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
4117 resource = resource||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
4118/* resource = resource||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
4119 resource = resource||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
4120 resource = resource||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
4121 resource = resource||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
4122 resource = resource||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
4123 call lineout filename, resource
4124 END
4125 CALL STREAM filename, 'C', 'CLOSE'
4126
4127 if options.!autostart == 0 THEN do
4128 Title = NLVGetMessage( 51 )
4129 if Title = "" then Title = "[Profile saved]"
4130 Text = NLVGetMessage( 52, filename )
4131 if Text = "" then Text = "[Profile saved to "filename"!]"
4132 CALL VRMessage 'Main', Text , Title, 'I'
4133 end
4134
4135 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click done"
4136RETURN
4137
4138/*:VRX PB_DETACH_Click
4139*/
4140PB_DETACH_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
4141 if options.!debug == 1 then say time()' '||"PB_DETACH_Click started"
4142 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
4143 IF select.0 < 1 THEN RETURN
4144
4145 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
4146 PARSE VAR userdata mountpoint ';' mounts ';' .
4147 drive = STRIP( mountpoint, 'T', '\')
4148
4149 btns.0 = 2
4150 btns.1 = NLVGetMessage( 6 )
4151 btns.2 = NLVGetMessage( 7 )
4152 confirm = VRMessage('Main', NLVGetMessage( 58, drive ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
4153 IF confirm \= 1 THEN RETURN
4154
4155 /* TODO: ?? Unmount & delete all child mountpoints? - Do we need this? */
4156 /* FIXME: This is potentially dangerous on Netdrive - what happens with unknown mount types? */
4157 /* FIXME: Unclear under which circumstances we have an alpha value here (which crahed EVFSGUI) */
4158 if datatype(mounts) = 'NUM' then do
4159 /* Unmount any resources */
4160 DO i = 1 TO mounts
4161 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
4162 END
4163 end
4164 else if options.!debug == 1 then say ' '||"mounts = "mounts
4165
4166 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"drive"')"
4167
4168 CALL Refresh
4169 if options.!debug == 1 then say time()' '||"PB_DETACH_Click done"
4170RETURN
4171
4172/*:VRX PB_DIALOG_HELP_Click
4173*/
4174PB_DIALOG_HELP_Click:
4175 CALL VRMethod 'GB_DIALOG', 'InvokeHelp'
4176return
4177
4178/*:VRX PB_EDIT_CANCEL_Click
4179*/
4180PB_EDIT_CANCEL_Click:
4181 options.!editmode = 0
4182 CALL VRSet "PB_UNMOUNT","Enabled", 1
4183 CALL VRSet "GB_CURRENT", "ENABLED", 1
4184 ok = VRSet("PB_EDIT_CANCEL","Visible", 0)
4185 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(13)" " )
4186/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
4187RETURN 0
4188
4189/*:VRX PB_INFO_OK_Click
4190*/
4191PB_INFO_OK_Click:
4192 call SW_INFO_Close
4193RETURN
4194
4195/*:VRX PB_LOGIN_CANCEL_Click
4196*/
4197PB_LOGIN_CANCEL_Click:
4198 credentials.!entered = 0
4199 call SW_LOGIN_Close
4200RETURN
4201
4202/*:VRX PB_LOGIN_OK_Click
4203*/
4204PB_LOGIN_OK_Click:
4205 ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
4206 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value"))
4207 options.!storecreds = VRGet("CB_STORECREDS1","Set")
4208 credentials.!entered = 1
4209
4210 if p_server <> "" then do
4211 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
4212
4213 if word(ok,1) = "1" then do
4214 ok = VRSet("DT_STATUSBAR","Caption", NLVGetMessage(107, rpc.queryuser.FULL_NAME))
4215 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
4216 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
4217 end
4218 else do
4219 CALL VRMessage 'Main', VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS, NLVGetMessage(5), "E"
4220 end
4221 end
4222
4223 call SW_LOGIN_Close
4224RETURN
4225
4226/*:VRX PB_MOUNT_Click
4227*/
4228PB_MOUNT_Click:
4229 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click started"
4230 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
4231 say " network = "network
4232 if options.!editmode = 1 then do
4233 CALL PB_UNMOUNT_Click
4234 options.!editmode = 0
4235 ok = VRMethod("TDL_1","SetTabText", " "strip(NLVGetMessage(13))" ")
4236/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
4237
4238 CALL VRSet "PB_UNMOUNT","Enabled", 1
4239 CALL VRSet "GB_CURRENT", "ENABLED", 1
4240 end
4241
4242 options.!workgroup = ''
4243 options.!server = ''
4244 options.!share = ''
4245 options.!user = ''
4246 options.!password = ''
4247 options.!master = ''
4248 options.!mastertype = ''
4249 options.!memlen = advanced.!memlen
4250 options.!easupport = advanced.!easupport
4251 options.!readonly = advanced.!readonly
4252 options.!loglevel = advanced.!loglevel
4253 options.!logfile = advanced.!logfile
4254 options.!cachetimeout = advanced.!cachetimeout
4255 options.!cachelistings = advanced.!cachelistings
4256
4257 vfs.!drive = ''
4258 vfs.!mountpoint = ''
4259
4260 stype = VRGet( "CB_MOUNT", "Selected" )
4261 share = STRIP( VRGet( "EF_SHARE", "Value" ))
4262 server = STRIP( VRGet( "EF_SERVER", "Value" ))
4263 network = STRIP( VRGet( "EF_NETWORK", "Value" ))
4264 mtype = VRGet( "CHK_MTYPE", "Set" )
4265 userid = STRIP( VRGet( "EF_USER", "Value" ))
4266 password = STRIP( VRGet( "EF_PASSWORD", "Value" ))
4267 mdrive = VRGet( "CB_DRIVES", "SelectedText" )
4268 if mdrive = "" then mdrive = VRGet( "CB_DRIVES", "Value" )
4269 mpath = STRIP( VRGet( "EF_DIRECTORY", "Value" ))
4270
4271 IF ( stype < 1 | stype > 4 ) THEN stype = 1
4272
4273 /* The required/optional/ignored parameters depend on the type of mount
4274 * requested. (Note, however, that the user, password, easupport and
4275 * memlen parameters are always optional.)
4276 */
4277 SELECT
4278 /* Scenario 1: Mount a single share.
4279 * Required: share, server
4280 * Optional: workgroup
4281 * Unused: master, mastertype
4282 */
4283 WHEN stype = 1 THEN DO
4284 IF server == '' | share == '' THEN DO
4285 /* error */
4286 RETURN 1
4287 END
4288 options.!server = server
4289 options.!share = share
4290 options.!workgroup = network
4291 END
4292
4293 /* Scenario 2: Mount all shares on a server.
4294 * Required: server
4295 * Optional: workgroup
4296 * Unused: share, master, mastertype
4297 */
4298 WHEN stype = 2 THEN DO
4299 IF server == '' THEN DO
4300 /* error */
4301 RETURN 1
4302 END
4303 options.!server = server
4304 options.!workgroup = network
4305 END
4306
4307 /* Scenario 3: Mount all servers in a workgroup.
4308 * Required: workgroup
4309 * Optional: -
4310 * Unused: share, server, master, mastertype
4311 */
4312 WHEN stype = 3 THEN DO
4313 IF workgroup == '' THEN DO
4314 /* error */
4315 RETURN 1
4316 END
4317 options.!workgroup = network
4318 END
4319
4320 /* Scenario 4: Mount all workgroups known to a master.
4321 * Required: master, mastertype
4322 * Optional: -
4323 * Unused: share, server, workgroup
4324 */
4325 WHEN stype = 4 THEN DO
4326 IF master == '' | mastertype == '' THEN DO
4327 /* error */
4328 RETURN 1
4329 END
4330 options.!master = network
4331 options.!mastertype = mtype
4332 END
4333 END
4334
4335 options.!user = userid
4336 options.!password = password
4337
4338 vfs.!drive = mdrive
4339 vfs.!mountpoint = mdrive'\'mpath
4340
4341 CALL Mount
4342 CALL Refresh
4343 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 1)
4344 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click done"
4345RETURN 0
4346
4347/*:VRX PB_NEWMOUNTPOINTCANCEL_Click
4348*/
4349PB_NEWMOUNTPOINTCANCEL_Click:
4350 ok = VRSet("CB_DRIVES","Value","")
4351 ok = VRSet("EF_DIRECTORY","Value","")
4352 call SW_MOUNTPOINT_Close
4353RETURN 0
4354
4355/*:VRX PB_NEWMOUNTPOINTOK_Click
4356*/
4357PB_NEWMOUNTPOINTOK_Click:
4358 ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4359 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4360
4361 advanced.!readonly = VRGet("CB_READONLY1","Set")
4362 advanced.!easupport = VRGet("CB_EAS1","Set")
4363 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4364 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4365 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4366
4367 call SW_MOUNTPOINT_Close
4368RETURN
4369
4370/*:VRX PB_NEWPORTCANCEL_Click
4371*/
4372PB_NEWPORTCANCEL_Click:
4373/* ok = VRSet("CB_DRIVES","Value","")
4374 ok = VRSet("EF_DIRECTORY","Value","")
4375 call SW_MOUNTPOINT_Close */
4376RETURN 0
4377
4378/*:VRX PB_NEWPORTCONNECT_Click
4379*/
4380PB_NEWPORTCONNECT_Click:
4381/* ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4382 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4383
4384 advanced.!readonly = VRGet("CB_READONLY1","Set")
4385 advanced.!easupport = VRGet("CB_EAS1","Set")
4386 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4387 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4388 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4389
4390 call SW_MOUNTPOINT_Close */
4391RETURN
4392
4393/*:VRX PB_PROGRESS_ABORT_Click
4394*/
4395PB_PROGRESS_ABORT_Click:
4396 options.!delay = 0
4397 options.!autoload = 0
4398 options.!autoclose = 0
4399 call SW_PROGRESS_Close
4400return
4401
4402/*:VRX PB_SETTINGS_APPLY_Click
4403*/
4404PB_SETTINGS_APPLY_Click:
4405 advanced.!loglevel = VRGet("SPIN_LOG_LEVEL", "Value" )
4406 advanced.!logfile = VRGet("EF_LOGFILE", "Value" )
4407 advanced.!browseauth = VRGet("CB_BROWSEAUTH", "Set" )
4408 advanced.!browseimme = VRGet("CB_BROWSEIMME", "Set" )
4409 advanced.!special = VRGet("CB_SPECIAL", "Set" )
4410 advanced.!savepassive = VRGet("CB_SAVEPASSIVE","Set" )
4411 advanced.!lmhosts = VRGet("CB_LMHOSTS", "Set" )
4412 advanced.!broadcast = VRGet("CB_BROADCAST", "Set" )
4413 advanced.!miniicons = VRGet("CB_MINIICONS", "Set" )
4414
4415 /* Note: CB_LOGGING has its own event tied to the click */
4416 options.!storecreds = VRGet("CB_STORECREDS", "Set" )
4417 options.!debug = VRGet("CB_DEBUG", "Set" )
4418
4419 if options.!debug == 1 then do /* Turn on additional columns in connection details view */
4420 ok = VRRedirectStdio("ON")
4421 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 1)
4422 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 1)
4423 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 1)
4424 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 1)
4425 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 1)
4426 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 1)
4427 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 1)
4428 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 1)
4429 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 1)
4430 end
4431 else do /* Turn on additional columns in connection details view */
4432 ok = VRRedirectStdio("OFF")
4433 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 0)
4434 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 0)
4435 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 0)
4436 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 0)
4437 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 0)
4438 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 0)
4439 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 0)
4440 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 0)
4441 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 0)
4442 end
4443
4444 ok = VRset("CN_CURRENT", "MiniIcons", advanced.!miniicons)
4445 ok = VRset("CN_SMBTREE", "MiniIcons", advanced.!miniicons)
4446 ok = VRset("CN_CONDET", "MiniIcons", advanced.!miniicons)
4447
4448 if advanced.!lmhosts = 1 then do
4449 call _LMHostsRead
4450 call _LMHostsUpdate
4451 end
4452 if advanced.!smbconfchanged = 1 then do
4453 name_resolve_order = VRGet("SPIN_NRO1","value")' 'VRGet("SPIN_NRO2","value")' 'VRGet("SPIN_NRO3","value")' 'VRGet("SPIN_NRO4","value")
4454 handle = IniOpen('global', samba.!smbconf)
4455 call IniSet 'name resolve order', name_resolve_order, handle
4456 /* FIXME: Throw an error in this case */
4457 if \_IsValidIPAddress(VRGet("EF_WINS_SERVER","Value")) then ok = VRSet("EF_WINS_SERVER","Value","")
4458 call IniSet 'wins server', VRGet("EF_WINS_SERVER","Value"), handle
4459 call IniSet 'log level', VRGet("SPIN_LOG_LEVEL","Value"), handle
4460 call IniSave handle
4461 call IniClose handle
4462 advanced.!smbconfchanged = 0
4463 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 0)
4464 end
4465 if options.!storecreds = 0 then call Menu_File_ucCred_Reset_Click
4466return
4467
4468/*:VRX PB_SETTINGS_HELP_Click
4469*/
4470PB_SETTINGS_HELP_Click:
4471 CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
4472return
4473
4474/*:VRX PB_SETTINGS_UNDO_Click
4475*/
4476PB_SETTINGS_UNDO_Click:
4477 call SW_SETTINGS_Init_Content
4478return
4479
4480/*:VRX PB_SMBCONF_APPLY_Click
4481*/
4482PB_SMBCONF_APPLY_Click:
4483 if advanced.!smbconfchanged = 1 then do
4484 client_NTLMv2_auth = VRGet("CB_client_NTLMv2_auth","Set")
4485 client_lanman_auth = VRGet("CB_client_lanman_auth","Set")
4486 client_plaintext_auth = VRGet("CB_client_plaintext_auth","Set")
4487 client_use_spnego = VRGet("CB_client_use_spnego","Set")
4488 client_use_spnego_principal = VRGet("CB_client_use_spnego_principal","Set")
4489 client_signing = VRGet("SPIN_client_signing","Value")
4490 client_ipc_signing = VRGet("SPIN_client_ipc_signing","Value")
4491
4492 if VRGet("SPIN_client_max_protocol","Enabled") = 1 then do
4493 client_max_protocol = VRGet("SPIN_client_max_protocol","Value")
4494 client_min_protocol = VRGet("SPIN_client_min_protocol","Value")
4495 end
4496
4497
4498 handle = IniOpen('global', samba.!smbconf)
4499 call IniSet 'client NTLMv2 auth', YesNo(client_NTLMv2_auth), handle
4500 call IniSet 'client lanman auth', YesNo(client_lanman_auth), handle
4501 call IniSet 'client plaintext auth', YesNo(client_plaintext_auth), handle
4502 call IniSet 'client use spnego', YesNo(client_use_spnego), handle
4503 call IniSet 'client use spnego principal', YesNo(client_use_spnego_principal), handle
4504 call IniSet 'client signing', client_signing, handle
4505 call IniSet 'client ipc signing', client_ipc_signing, handle
4506
4507 if VRGet("SPIN_client_max_protocol","Enabled") = 1 then do
4508 call IniSet 'client max protocol', client_max_protocol, handle
4509 call IniSet 'client min protocol', client_min_protocol, handle
4510 end
4511
4512 call IniSave handle
4513 call IniClose handle
4514 advanced.!smbconfchanged = 0
4515 ok = VRSet("PB_SMBCONF_UNDO","Enabled", 0)
4516 end
4517return
4518
4519/*:VRX PB_SMBCONF_HELP_Click
4520*/
4521PB_SMBCONF_HELP_Click:
4522 CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
4523return
4524
4525/*:VRX PB_SMBCONF_UNDO_Click
4526*/
4527PB_SMBCONF_UNDO_Click:
4528 call SW_SETTINGS_Init_Content
4529return
4530
4531/*:VRX PB_SMBTREE_CONNECT_Click
4532*/
4533PB_SMBTREE_CONNECT_Click: PROCEDURE EXPOSE settings. options. icons. fs. advanced. cd. samba. mtype.
4534 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click started"
4535
4536 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
4537
4538 if SelRH.0 = 0 then do
4539 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click aborted"
4540 return
4541 end
4542
4543 p_workgroup = ''
4544 p_server = ''
4545 p_share = ''
4546
4547 srcFile = ""
4548 srcCtn = VRGet("CN_SMBTREE","Self")
4549 srcRec = SelRH.1
4550 trgCtn = VRGet("CN_CURRENT","Self")
4551 trgRec = ""
4552
4553 if options.!debug == 1 then do
4554 say ' srcCtn = "'srcCtn'"'
4555 if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
4556 say ' srcRec = "'srcRec'"'
4557 say ' trgCtn = "'trgCtn'"'
4558 if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
4559 say ' trgRec = "'trgRec'"'
4560 end
4561
4562 ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
4563
4564 DragCapt = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Caption")
4565 ParentRH = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Parent")
4566
4567 if ParentRH = "" then do /* A workgroup was dragged */
4568 say "Workgroup dragged!"
4569 parse var DragCapt p_workgroup '0D0A'x .
4570 p_workgroup = strip(p_workgroup)
4571 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4572 call _UpdateObject "EF_SERVER", ""
4573 ok = VRSet("EF_SHARE","Value","")
4574
4575 ShareLevel = 3
4576 end
4577 else do
4578 ParDragCapt = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Caption")
4579 GParentRH = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Parent")
4580
4581 if GParentRH = "" then do /* A server was dragged */
4582 say "Server dragged!"
4583 parse var ParDragCapt p_workgroup '0D0A'x .
4584 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4585 p_workgroup = strip(p_workgroup)
4586
4587 parse var DragCapt p_server '0D0A'x .
4588 p_server = strip(p_server)
4589 call _UpdateObject "EF_SERVER", p_server
4590 ok = VRSet("EF_Share","Value","")
4591
4592 ShareLevel = 2
4593 end
4594 else do /* A share was dragged */
4595 say "Share dragged!"
4596 GParDragCapt = VRMethod(srcCtn, "GetRecordAttr", GParentRH, "Caption")
4597
4598 parse var GParDragCapt p_workgroup '0D0A'x .
4599 p_workgroup = strip(p_workgroup)
4600 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4601
4602 parse var ParDragCapt p_server '0D0A'x .
4603 p_server = strip(p_server)
4604 call _UpdateObject "EF_SERVER", p_server
4605
4606 parse var DragCapt p_share '0D0A'x .
4607 p_share = strip(p_share)
4608 ok = VRSet("EF_Share","Value",strip(p_share))
4609
4610 ShareLevel = 1
4611 end
4612 end
4613
4614 say 'p_workgroup = "'p_workgroup'"'
4615 say 'p_server = "'p_server'"'
4616 say 'p_share = "'p_share'"'
4617
4618 ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
4619 call CB_MOUNT_Change
4620
4621 if trgRec = "" then do
4622 window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
4623 if VRGet("CB_DRIVES","Value") = "" then return
4624 end
4625 else do
4626
4627 TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
4628
4629 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
4630
4631 do while parTrgRH <> ""
4632 partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
4633 TargetString = partrgCapt||'\'||TargetString
4634 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
4635 end
4636 say 'TargetString = "'TargetString'"'
4637 ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
4638 ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
4639 end
4640
4641 window = VRLoadSecondary( "SW_LOGIN", "W" )
4642 if credentials.!entered = 1 then call PB_MOUNT_CLICK
4643
4644 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click done"
4645RETURN
4646
4647/*:VRX PB_SMBTREE_HELP_Click
4648*/
4649PB_SMBTREE_HELP_Click:
4650 CALL VRMethod 'GB_SMBTREE', 'InvokeHelp'
4651return
4652
4653/*:VRX PB_SMBTREE_REFRESH_Click
4654*/
4655PB_SMBTREE_REFRESH_Click: /* PROCEDURE EXPOSE settings. options. icons. fs. samba. debuglevel advanced. UserCred Refreshmode Tempdir */
4656 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click started"
4657
4658 if advanced.!browseauth = 1 & (UserCred = "--user=%" | UserCred = "" ) then do
4659 window = VRLoadSecondary( "SW_LOGIN", "W" )
4660 end
4661
4662 call _UserCredUpdate
4663 ok = VRset("Pict_Throbber", "Visible", 1)
4664 ok = VRset("Menu_Selected_Connect", "Visible", 0)
4665 ok = VRset("TM_Throbber", "Enabled", 1)
4666 ShowHidden = advanced.!special
4667 BroadCast = advanced.!broadcast
4668 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
4669 ok = time('R')
4670 call _RefreshTree
4671 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click done"
4672RETURN
4673
4674/*:VRX PB_UNMOUNT_Click
4675*/
4676PB_UNMOUNT_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
4677 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click started"
4678 if options.!debug == 1 then say time()' '||'options.!editmode = 'options.!editmode
4679 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
4680 IF select.0 < 1 THEN RETURN
4681
4682 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
4683 PARSE VAR userdata mountpoint ';' mounts ';' .
4684say 'userdata="'userdata'"'
4685 IF mounts > 0 & options.!editmode = 0 THEN DO
4686 btns.0 = 2
4687 btns.1 = NLVGetMessage( 6 )
4688 btns.2 = NLVGetMessage( 7 )
4689 confirm = VRMessage('Main', NLVGetMessage( 57, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
4690 IF confirm \= 1 THEN RETURN
4691 END
4692
4693 /* Unmount any resources */
4694 DO i = 1 TO mounts
4695 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
4696 END
4697
4698 /* Delete mountpoint */
4699 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', select.1, 'Parent')
4700 IF parent \= '' THEN DO
4701 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"mountpoint"')"
4702 END
4703
4704 CALL Refresh
4705 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click done"
4706RETURN 0
4707
4708/*:VRX Pict_PWINMEM_Click
4709*/
4710Pict_PWINMEM_Click:
4711 if VRGet("Pict_PWINMEM","PicturePath") = "#36" then do
4712 call Menu_File_ucCred_Reset_Click
4713 end
4714return
4715
4716/*:VRX Quit
4717*/
4718Quit:
4719 if Fatal <> 1 then CALL _INISave
4720 /* ok = VRREdirectSTdio("OFF") */
4721 window = VRWindow()
4722 call VRSet window, "Shutdown", 1
4723 drop window
4724RETURN
4725
4726/*:VRX Refresh
4727*/
4728Refresh:
4729 if options.!debug == 1 then say time()' Refresh started'
4730 CALL VRSet "CN_CURRENT", 'Painting', 0
4731
4732 CALL VRMethod "CN_CURRENT", 'RemoveRecord', 'All'
4733
4734 /* Remove Active connections from details view */
4735 ok = VRMethod( "CN_CONDET", "GetRecordList", 'All', "rh." )
4736
4737 do I = 1 to rh.0
4738 /* This catches the bug we observed exactly once and were unable to reproduce! */
4739 if cd.statusfh = 'CD.STATUSFH' then do
4740 if options.!debug == 1 then call beep 880, 50
4741 if options.!debug == 1 then call beep 880, 50
4742 if options.!debug == 1 then say " cd.statusfh is undefined - check why!!!!!!"
4743 leave
4744 end
4745 if options.!debug == 1 then say ' Icon.'i' = "'||VRMethod( "CN_CONDET", "GetFieldData", rh.i, cd.statusfh)'"'
4746 if VRMethod("CN_CONDET","GetFieldData", rh.i, cd.statusfh) = icons.!active then CALL VRMethod "CN_CONDET", 'RemoveRecord', rh.i
4747 end
4748
4749/* call _AddTemplates */
4750 CALL VRSet "PB_DETACH", "Enabled", 0
4751 CALL VRSet "PB_UNMOUNT", "Enabled", 0
4752
4753 ok = VRSet("MENU_CONTEXT_OPEN", "Visible", 0)
4754/* ok = VRSet("MENU_CONTEXT_SEP1", "Visible", 0) */
4755 ok = VRSet("MENU_CONTEXT_DETACH", "Visible", 0)
4756 ok = VRSet("MENU_CONTEXT_UNMOUNT", "Visible", 0)
4757 ok = VRSet("MENU_CONTEXT_EDIT", "Visible", 0)
4758
4759 ok = VRSet("MENU_SELECTED_REMOVE", "Visible", 0)
4760 ok = VRSet("MENU_SELECTED_RETRY", "Visible", 0)
4761
4762 if options.!debug == 1 then say ' Remove records, disable buttons done.'
4763
4764 CALL VRMethod 'CB_DRIVES', 'Clear'
4765
4766 CALL VRSet "CN_CURRENT", "Caption", fs.!Name' 'fs.!version
4767
4768 /* Herwig B.: Attention! The SysDrivemap function with the "free" parameter causes hangs in case it is called repeatedly! */
4769 drvs = MyFreeDriveMap('C:', 'FREE')
4770
4771 DO i = 1 TO WORDS( drvs )
4772 drvstem.i = WORD( drvs, i )
4773 END
4774
4775 drvstem.0 = WORDS( drvs )
4776
4777 /* Add any existing EVFS drives */
4778 CALL GetMountPoints
4779
4780 CALL VRMethod "CB_DRIVES", "AddStringList", "drvstem."
4781 CALL VRSet "CN_CURRENT", 'Painting', 1
4782 if options.!debug == 1 then say time()' '||"Refresh done"
4783RETURN 0
4784
4785/*:VRX SPIN_client_ipc_signing_Change
4786*/
4787SPIN_client_ipc_signing_Change:
4788 advanced.!smbconfchanged = 1
4789return
4790
4791/*:VRX SPIN_client_max_protocol_Change
4792*/
4793SPIN_client_max_protocol_Change:
4794 advanced.!smbconfchanged = 1
4795return
4796
4797/*:VRX SPIN_client_min_protocol_Change
4798*/
4799SPIN_client_min_protocol_Change:
4800 advanced.!smbconfchanged = 1
4801return
4802
4803/*:VRX SPIN_client_signing_Change
4804*/
4805SPIN_client_signing_Change:
4806 advanced.!smbconfchanged = 1
4807return
4808
4809/*:VRX SPIN_LOG_LEVEL_Change
4810*/
4811SPIN_LOG_LEVEL_Change:
4812 advanced.!smbconfchanged = 1
4813return
4814
4815/*:VRX SPIN_NRO1_Change
4816*/
4817SPIN_NRO1_Change:
4818 advanced.!smbconfchanged = 1
4819return
4820
4821/*:VRX SPIN_NRO2_Change
4822*/
4823SPIN_NRO2_Change:
4824 advanced.!smbconfchanged = 1
4825return
4826
4827/*:VRX SPIN_NRO3_Change
4828*/
4829SPIN_NRO3_Change:
4830 advanced.!smbconfchanged = 1
4831return
4832
4833/*:VRX SPIN_NRO4_Change
4834*/
4835SPIN_NRO4_Change:
4836 advanced.!smbconfchanged = 1
4837return
4838
4839/*:VRX SPLIT_Main_Move
4840*/
4841SPLIT_Main_Move:
4842 ok = VRset("Main", "Painting", 0)
4843 NewPos = VRInfo("Left")
4844 OldPos = VRGet("SPLIT_Main","Left")
4845 ok = VRSet("SPLIT_Main","Left", NewPos)
4846 ok = VRset("GB_SMBTREE","Left", NewPos+60)
4847 call Main_Resize
4848 ok = VRset("Main", "Painting", 1)
4849return
4850
4851/*:VRX SW_ABOUT_Close
4852*/
4853SW_ABOUT_Close:
4854 options.!tracmark = VRGet('CB_TRAC', 'Set')
4855 call SW_ABOUT_Fini
4856return
4857
4858/*:VRX SW_ABOUT_Create
4859*/
4860SW_ABOUT_Create:
4861 call SW_ABOUT_Init
4862
4863 CALL NLVSetText 'SW_ABOUT', "Caption", 1
4864 CALL NLVSetText 'PB_ABOUT_CLOSE', "Caption", 29
4865 CALL NLVSetText 'PB_ABOUT_COPY', "Caption", 121
4866 CALL NLVSetText 'CB_TRAC', "Caption", 134
4867
4868 CALL VRSet 'CB_TRAC', 'Set', options.!tracmark
4869
4870 ok = VRSet("DT_About","Caption", Program' (c) 2007-2017 Alexander Taylor'||'0D0A'x||'and Herwig Bauernfeind for bww bitwise works GmbH.')
4871
4872 About.DscFH = VRMethod( "CN_ABOUT", "AddField", "String", "Component" )
4873 About.ValFH = VRMethod( "CN_ABOUT", "AddField", "String", "Version" )
4874
4875 call _AboutSambaClientGetInfo
4876
4877return
4878/*:VRX SW_ABOUT_Fini
4879*/
4880SW_ABOUT_Fini:
4881 window = VRInfo( "Window" )
4882 call VRDestroy window
4883 drop window
4884return
4885/*:VRX SW_ABOUT_Init
4886*/
4887SW_ABOUT_Init:
4888 window = VRInfo( "Object" )
4889 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
4890 call VRMethod window, "CenterWindow"
4891 call VRSet window, "Visible", 1
4892 call VRMethod window, "Activate"
4893 end
4894 drop window
4895return
4896
4897/*:VRX SW_ADVANCED_Close
4898*/
4899SW_ADVANCED_Close:
4900 call SW_ADVANCED_Fini
4901return
4902
4903/*:VRX SW_ADVANCED_Create
4904*/
4905SW_ADVANCED_Create:
4906 call SW_ADVANCED_Init
4907return
4908
4909/*:VRX SW_ADVANCED_Fini
4910*/
4911SW_ADVANCED_Fini:
4912 window = VRInfo( "Window" )
4913 call VRDestroy window
4914 drop window
4915return
4916/*:VRX SW_ADVANCED_Init
4917*/
4918SW_ADVANCED_Init:
4919 /* Title bar */
4920 CALL NLVSetText "SW_ADVANCED", "Caption", 40
4921
4922 /* Options */
4923 CALL NLVSetText "GB_ADVANCED", "Caption", 43
4924 CALL NLVSetText "CB_EAS", "Caption", 44
4925 CALL NLVSetText "CB_READONLY", "Caption", 45
4926 CALL NLVSetText "CB_ALWAYSMP", "Caption", 65
4927 CALL NLVSetText "DT_CACHETIMEOUT", "Caption", 130
4928 CALL NLVSetText "DT_CACHELISTINGS", "Caption", 131
4929
4930 /* Buttons */
4931 CALL NLVSetText "PB_ADVANCED_APPLY", "Caption", 122
4932 CALL NLVSetText "PB_ADVANCED_UNDO", "Caption", 123
4933 CALL NLVSetText "PB_ADVANCED_HELP", "Caption", 4
4934
4935 CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40)
4936
4937/* call VRMethod "SW_ADVANCED", "CenterWindow" */
4938 ok = VRSet("SW_ADVANCED", "Visible", 1)
4939/* call VRMethod "SW_ADVANCED", "Activate" */
4940return
4941
4942/*:VRX SW_ADVANCED_Init_Content
4943*/
4944SW_ADVANCED_Init_Content:
4945 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS", "Set", advanced.!easupport)
4946 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY","Set", advanced.!readonly)
4947 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP","Set", advanced.!alwaysmp)
4948 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT", "Value", advanced.!cachetimeout)
4949 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS", "Value", advanced.!cachelistings)
4950
4951 /* Obsolete */
4952 IF advanced.!memlen \= "" THEN ok = VRSet("SPB_MEMLEN", "Value", advanced.!memlen)
4953return
4954
4955/*:VRX SW_CONDET_Close
4956*/
4957SW_CONDET_Close:
4958 call SW_CONDET_Fini
4959return
4960
4961/*:VRX SW_CONDET_Create
4962*/
4963SW_CONDET_Create:
4964 call SW_CONDET_Init
4965return
4966
4967/*:VRX SW_CONDET_Fini
4968*/
4969SW_CONDET_Fini:
4970 window = VRInfo( "Window" )
4971 call VRDestroy window
4972 drop window
4973return
4974/*:VRX SW_CONDET_Init
4975*/
4976SW_CONDET_Init:
4977
4978return
4979
4980/*:VRX SW_CONDET_Init_Content
4981*/
4982SW_CONDET_Init_Content:
4983 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
4984
4985 /* Hide any "foreign" menu entries */
4986 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
4987return
4988
4989/*:VRX SW_DIALOG_Close
4990*/
4991SW_DIALOG_Close:
4992 call SW_DIALOG_Fini
4993return
4994
4995/*:VRX SW_DIALOG_Create
4996*/
4997SW_DIALOG_Create:
4998 call SW_DIALOG_Init
4999return
5000
5001/*:VRX SW_DIALOG_Fini
5002*/
5003SW_DIALOG_Fini:
5004 window = VRInfo( "Window" )
5005 call VRDestroy window
5006 drop window
5007return
5008/*:VRX SW_DIALOG_Init
5009*/
5010SW_DIALOG_Init:
5011 LEDSize = VRMethod( "Screen", "PixelsToTwips", 16 )
5012
5013 ok = VRSet("Pict_PWINMEM","Top", VRGet("EF_USER","Top")+(VRGet("EF_USER","Height")-LEDSize)%2)
5014 ok = VRSet("Pict_PWINMEM","Width", LEDSize)
5015 ok = VRSet("Pict_PWINMEM","Height", LEDSize)
5016return
5017
5018/*:VRX SW_DIALOG_Init_Content
5019*/
5020SW_DIALOG_Init_Content:
5021 /* obsolete */
5022 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
5023
5024 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
5025 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
5026 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
5027
5028 call _DialogPopulate
5029return
5030
5031/*:VRX SW_INFO_Close
5032*/
5033SW_INFO_Close:
5034 call SW_INFO_Fini
5035return
5036
5037/*:VRX SW_INFO_Create
5038*/
5039SW_INFO_Create:
5040 if options.!debug == 1 then say time()' SW_INFO_Create started'
5041 call SW_INFO_Init
5042 CALL NLVSetText 'SW_INFO', "Caption", 92
5043 CALL NLVSetText 'PB_INFO_OK', "Caption", 2
5044 Info.TypeFH = VRMethod( "CN_INFO", "AddField", "String", "Type" )
5045 Info.ValueFH = VRMethod( "CN_INFO", "AddField", "String", "Value" )
5046
5047 if options.!debug == 1 then do
5048 say ' Handle: "'SMBObj.rh'"'
5049 say ' Resource: "'SMBObj.resname'"'
5050 say ' Comment: "'SMBObj.comment'"'
5051 say ' Type: "'SMBObj.udatatype'"'
5052 say ' Message: "'SMBObj.udatamsg'"'
5053 say ' Icon: "'SMBObj.icon'"'
5054 end
5055say "Vorher:"rpc.srvinfo.OS_VERSION
5056 drop rpc.
5057say "Vorher:"rpc.srvinfo.OS_VERSION
5058 rpc_success = _rpcsrvinfo(SMBObj.resname,credentials.!username,credentials.!password)
5059
5060 Info.!nbname = VRMethod( "CN_INFO", "AddRecord")
5061 Info.!comment = VRMethod( "CN_INFO", "AddRecord")
5062 Info.!domain = VRMethod( "CN_INFO", "AddRecord")
5063 Info.!DMBLMB = VRMethod( "CN_INFO", "AddRecord")
5064 if rpc_success = 1 then Info.!capabilities = VRMethod( "CN_INFO", "AddRecord")
5065 Info.!os = VRMethod( "CN_INFO", "AddRecord")
5066 Info.!server = VRMethod( "CN_INFO", "AddRecord")
5067 if rpc_success = 1 then Info.!version = VRMethod( "CN_INFO", "AddRecord")
5068 Info.!status = VRMethod( "CN_INFO", "AddRecord")
5069 Info.!IP = VRMethod( "CN_INFO", "AddRecord")
5070 Info.!MAC = VRMethod( "CN_INFO", "AddRecord")
5071
5072 if rpc_success = 1 then do
5073 if rpc.srvinfo.OS_VERSION = 'RPC.SRVINFO.OS_VERSION' then rpc.srvinfo.OS_VERSION = ''
5074 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, rpc.srvinfo.NETBIOSNAME)
5075 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, rpc.srvinfo.SERVERSTRING)
5076 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!capabilities, Info.TypeFH, strip(NLVGetMessage(138),'T',':'),Info.ValueFH, rpc.srvinfo.CAPABILITIES)
5077 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!version,Info.TypeFH, strip(NLVGetMessage(139),'T',':'),Info.ValueFH, rpc.srvinfo.OS_VERSION)
5078 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'),Info.ValueFH, rpc.srvinfo.LOGONSTATUS )
5079 /* we did not get these, but we know them anyway */
5080 if rpc.srvinfo.NETBIOSNAME = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
5081 if rpc.srvinfo.SERVERSTRING = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
5082 end
5083 else do
5084 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
5085 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
5086 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'), Info.ValueFH, SMBObj.udatamsg)
5087 end
5088
5089 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, WorkGroupFH ))
5090 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os, Info.TypeFH, strip(NLVGetMessage(93), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, OSFH ))
5091 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, VersionFH ))
5092 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!DMBLMB, Info.TypeFH, strip(NLVGetMessage(124),'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MBFH ))
5093 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!IP, Info.TypeFH, "IP" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, IPFH ))
5094 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!MAC, Info.TypeFH, "MAC" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MacFH ))
5095
5096 if options.!debug == 1 then say time()' SW_INFO_Create done'
5097return
5098
5099/*:VRX SW_INFO_Fini
5100*/
5101SW_INFO_Fini:
5102 window = VRInfo( "Window" )
5103 call VRDestroy window
5104 drop window
5105return
5106/*:VRX SW_INFO_Init
5107*/
5108SW_INFO_Init:
5109 window = VRInfo( "Object" )
5110 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5111 call VRMethod window, "CenterWindow"
5112 call VRSet window, "Visible", 1
5113 call VRMethod window, "Activate"
5114 end
5115 drop window
5116return
5117
5118/*:VRX SW_LOGIN_Close
5119*/
5120SW_LOGIN_Close:
5121 call SW_LOGIN_Fini
5122return
5123
5124/*:VRX SW_LOGIN_Create
5125*/
5126SW_LOGIN_Create:
5127 call SW_LOGIN_Init
5128 ok = VRSet("SW_LOGIN","Caption",NLVGetMessage(136)' 'strip(p_workgroup' \\'p_server'\'p_share,'T','\'))
5129 CALL NLVSetText 'DT_USER1', "Caption", 25
5130 CALL NLVSetText 'DT_PASSWORD1', "Caption", 26
5131 CALL NLVSetText 'CB_STORECREDS1', "Caption", 135
5132 CALL NLVSetText 'PB_LOGIN_OK', "Caption", 2
5133 CALL NLVSetText 'PB_LOGIN_CANCEL',"Caption", 3
5134
5135 if VRIsValidObject(SMBObj.rh) then do
5136 select
5137 when pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.rh, MBFH)) > 0 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
5138 when SMBObj.udatatype = "WORKGROUP" then LoginIcon = SMBObj.Icon
5139 when SMBObj.udatatype = "SERVER" then LoginIcon = SMBObj.Icon
5140 when SMBObj.udatatype = "DISK" then do
5141 if pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.parentrh, MBFH)) > 0
5142 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
5143 else LoginIcon = "#35:PMWP.DLL" /* icons.!pdc */
5144 end
5145 otherwise LoginIcon = "#35:PMWP.DLL" /* icons.!machine_awake */
5146 end
5147 say loginicon
5148 ok = VRSet("Pict_Login","PicturePath", LoginIcon)
5149 end
5150 ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
5151 ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value"))
5152 ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
5153return
5154
5155/*:VRX SW_LOGIN_Fini
5156*/
5157SW_LOGIN_Fini:
5158 window = VRInfo( "Window" )
5159 call VRDestroy window
5160 drop window
5161return
5162/*:VRX SW_LOGIN_Init
5163*/
5164SW_LOGIN_Init:
5165 window = VRInfo( "Object" )
5166 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5167 call VRMethod window, "CenterWindow"
5168 call VRSet window, "Visible", 1
5169 call VRMethod window, "Activate"
5170 end
5171 drop window
5172return
5173
5174/*:VRX SW_LOGIN_KeyPress
5175*/
5176SW_LOGIN_KeyPress:
5177 obj = VRInfo( "Object" )
5178 keystr = VRGet( obj, "KeyString" )
5179/* say keystr */
5180 select
5181 when keystr = "{Enter}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
5182 when keystr = "{Newline}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
5183 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
5184 otherwise nop
5185 end
5186return
5187
5188/*:VRX SW_MOUNTPOINT_Close
5189*/
5190SW_MOUNTPOINT_Close:
5191 call SW_MOUNTPOINT_Fini
5192return
5193
5194/*:VRX SW_MOUNTPOINT_Create
5195*/
5196SW_MOUNTPOINT_Create:
5197 call SW_MOUNTPOINT_Init
5198
5199 ok = VRSet("SW_MOUNTPOINT","Caption",strip(p_workgroup' \\'p_server'\'p_share,'T','\')) /* NLVGetMessage(14)' ' */
5200 CALL NLVSetText 'DT_MPOINT1', "Caption", 27
5201 CALL NLVSetText 'PB_NEWMOUNTPOINTOK', "Caption", 2
5202 CALL NLVSetText 'PB_NEWMOUNTPOINTCANCEL',"Caption", 3
5203 CALL NLVSetText 'CB_EAS1', "Caption", 44
5204 CALL NLVSetText 'CB_READONLY1', "Caption", 45
5205 CALL NLVSetText 'CB_ALWAYSMP1', "Caption", 65
5206 CALL NLVSetText "DT_CACHETIMEOUT1", "Caption", 130
5207 CALL NLVSetText "DT_CACHELISTINGS1", "Caption", 131
5208
5209 ok = VRMethod( "CB_DRIVES", "GetStringList", "freedrives." )
5210 ok = VRMethod( "CB_DRIVES1", "AddStringList", "freedrives." )
5211 ok = VRSet("CB_DRIVES1", "Value", VRGet("CB_Drives","Value"))
5212
5213 if VRGet("EF_Directory","Value") = "" then ok = VRSet("EF_DIRECTORY1", "Value", VRGet("EF_Directory","Value"))
5214
5215 ok = VRMethod("EF_DIRECTORY1","AddString",p_share)
5216
5217 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS1", "Set", advanced.!easupport)
5218 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY1", "Set", advanced.!readonly)
5219 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP1", "Set", advanced.!alwaysmp)
5220 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT1", "Value", advanced.!cachetimeout)
5221 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS1","Value", advanced.!cachelistings)
5222return
5223
5224/*:VRX SW_MOUNTPOINT_Fini
5225*/
5226SW_MOUNTPOINT_Fini:
5227 window = VRInfo( "Window" )
5228 call VRDestroy window
5229 drop window
5230return
5231/*:VRX SW_MOUNTPOINT_Init
5232*/
5233SW_MOUNTPOINT_Init:
5234 window = VRInfo( "Object" )
5235 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5236 call VRMethod window, "CenterWindow"
5237 call VRSet window, "Visible", 1
5238 call VRMethod window, "Activate"
5239 end
5240 drop window
5241return
5242
5243/*:VRX SW_PORTCONNECT_Close
5244*/
5245SW_PORTCONNECT_Close:
5246 call SW_PORTCONNECT_Fini
5247return
5248
5249/*:VRX SW_PORTCONNECT_Create
5250*/
5251SW_PORTCONNECT_Create:
5252 call SW_PORTCONNECT_Init
5253
5254 ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
5255
5256 if ok = "" then do
5257
5258 end
5259 else do
5260 say "Samba Spooler Port driver installed!"
5261 ok = SysINI("SYSTEM","PM_SPOOLER_PORT","ALL:","ports")
5262 smbport.0 = 0
5263 do I = 1 to ports.0
5264 if left(ports.I,3) = "SMB" then do
5265 X = smbport.0
5266 X = X + 1
5267 smbport.0 = X
5268 smbport.X = ports.I
5269 end
5270 end
5271 do I = 1 to smbport.0
5272 say smbport.I
5273 end
5274 end
5275
5276return
5277
5278/*:VRX SW_PORTCONNECT_Fini
5279*/
5280SW_PORTCONNECT_Fini:
5281 window = VRInfo( "Window" )
5282 call VRDestroy window
5283 drop window
5284return
5285/*:VRX SW_PORTCONNECT_Init
5286*/
5287SW_PORTCONNECT_Init:
5288 window = VRInfo( "Object" )
5289 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5290 call VRMethod window, "CenterWindow"
5291 call VRSet window, "Visible", 1
5292 call VRMethod window, "Activate"
5293 end
5294 drop window
5295return
5296
5297/*:VRX SW_PROGRESS_Close
5298*/
5299SW_PROGRESS_Close:
5300 options.!delay = 0
5301 call Main_Resize
5302 call VRSet 'Main', 'Visible', 1
5303 call SW_PROGRESS_Fini
5304return
5305
5306/*:VRX SW_PROGRESS_Create
5307*/
5308SW_PROGRESS_Create:
5309 call SW_PROGRESS_Init
5310 CALL NLVSetText 'SW_PROGRESS', "Caption", 1
5311 CALL NLVSetText 'DT_PROGRESS', "Caption", 34
5312 CALL NLVSetText 'PB_PROGRESS_ABORT', "Caption", 3
5313
5314 if options.!delay > 0 then ok = VRSet("TM_TheCloser","Delay", options.!delay*1000)
5315
5316 CALL VRSet "TM_Progress_Throbber","Enabled", 1
5317 CALL VRSet "TM_TheCloser","Enabled", 1
5318return
5319
5320/*:VRX SW_PROGRESS_Fini
5321*/
5322SW_PROGRESS_Fini:
5323 call VRDestroy "SW_PROGRESS"
5324return
5325/*:VRX SW_PROGRESS_Init
5326*/
5327SW_PROGRESS_Init:
5328 call VRMethod "SW_PROGRESS", "CenterWindow", "Parent"
5329 call VRSet "SW_PROGRESS", "Visible", 1
5330 call VRMethod "SW_PROGRESS", "Activate"
5331return
5332
5333/*:VRX SW_SETTINGS_Close
5334*/
5335SW_SETTINGS_Close:
5336 call SW_SETTINGS_Fini
5337return
5338
5339/*:VRX SW_SETTINGS_Create
5340*/
5341SW_SETTINGS_Create:
5342 call SW_SETTINGS_Init
5343return
5344
5345/*:VRX SW_SETTINGS_Fini
5346*/
5347SW_SETTINGS_Fini:
5348 window = VRInfo( "Window" )
5349 call VRDestroy window
5350 drop window
5351return
5352/*:VRX SW_SETTINGS_Init
5353*/
5354SW_SETTINGS_Init:
5355 /* Title bar */
5356 call NLVSetText "SW_SETTINGS", "Caption", 47
5357
5358 /* Options */
5359 call NLVSetText "GB_GLOBAL", "Caption", 47
5360 call NLVSetText "CB_DEBUG", "Caption", 42
5361 call NLVSetText "CB_LOGGING", "Caption", 46
5362 call NLVSetText "CB_BROWSEIMME", "Caption", 48
5363 call NLVSetText "CB_BROWSEAUTH", "Caption", 49
5364 call NLVSetText "CB_SPECIAL", "Caption", 66
5365 call NLVSetText "CB_SAVEPASSIVE", "Caption", 73
5366 call NLVSetText "CB_LMHOSTS", "Caption", 133
5367 call NLVSetText "CB_BROADCAST", "Caption", 74
5368 call NLVSetText "CB_MINIICONS", "Caption", 70
5369 call NLVSetText "CB_STORECREDS", "Caption", 135
5370
5371 /* Buttons */
5372 call NLVSetText "PB_SETTINGS_APPLY", "Caption", 122
5373 call NLVSetText "PB_SETTINGS_UNDO", "Caption", 123
5374 call NLVSetText "PB_SETTINGS_HELP", "Caption", 4
5375
5376/* call VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40) */
5377
5378/* call VRMethod "SW_SETTINGS", "CenterWindow" */
5379 ok = VRSet("SW_SETTINGS", "Visible", 1)
5380/* call VRMethod "SW_SETTINGS", "Activate" */
5381return
5382
5383/*:VRX SW_SETTINGS_Init_Content
5384*/
5385SW_SETTINGS_Init_Content:
5386 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 1)
5387
5388 if advanced.!browseauth \= "" then ok = VRSet("CB_BROWSEAUTH", "Set", advanced.!browseauth)
5389 if advanced.!browseimme \= "" then ok = VRSet("CB_BROWSEIMME", "Set", advanced.!browseimme)
5390 if advanced.!broadcast \= "" then ok = VRSet("CB_BROADCAST", "Set", advanced.!broadcast)
5391 if advanced.!special \= "" then ok = VRSet("CB_SPECIAL", "Set", advanced.!special)
5392 if advanced.!savepassive \= "" then ok = VRSet("CB_SAVEPASSIVE","Set", advanced.!savepassive)
5393 if advanced.!lmhosts \= "" then ok = VRSet("CB_LMHOSTS", "Set", advanced.!lmhosts)
5394
5395 call VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()"\ndpsmb.dbg")
5396 if options.!debug \= "" then ok = VRSet("CB_debug", "Set", options.!debug)
5397 if options.!storecreds \= "" then ok = VRSet("CB_STORECREDS", "Set", options.!storecreds)
5398
5399 if advanced.!miniicons \= "" then ok = VRSet("CB_MINIICONS", "Set", advanced.!miniicons)
5400
5401/* if advanced.!logfile \= "" then ok = VRSet("EF_LOGFILE", "Value", advanced.!logfile) /* Obsolete */
5402 if advanced.!loglevel \= "0" then ok = VRSet("SPIN_LOG_LEVEL", "Value", advanced.!loglevel) */
5403
5404 log_level = IniGet('log level', 'global', samba.!smbconf)
5405 call _SmbConfCreateShadowCopy
5406
5407
5408say "log level ="log_level
5409 if log_level = "" then log_level = 2
5410say "log level ="log_level
5411 ok = VRSet("SPIN_LOG_LEVEL","Value",log_level)
5412
5413 wins_support = translate(IniGet('wins support', 'global', samba.!shadowsmbconf))
5414
5415 if wins_support = "YES" then do /* we are a WINS server ourself */
5416 ok = VRSet("DT_WINS_SERVER","Enabled", 0)
5417 ok = VRSet("EF_WINS_SERVER","BackColor", "PaleGray")
5418 ok = VRSet("EF_WINS_SERVER","Value", "")
5419 ok = VRSet("EF_WINS_SERVER","Enabled", 0)
5420 end
5421 else do
5422 ok = VRSet("EF_WINS_SERVER","Value", IniGet('wins server', 'global', samba.!shadowsmbconf))
5423 end
5424
5425 name_resolve_order = IniGet('name resolve order', 'global', samba.!shadowsmbconf)
5426
5427 do I = 1 to words(name_resolve_order)
5428 ok = VRSet("SPIN_NRO"||I, "value", word(name_resolve_order,I))
5429 end
5430
5431 advanced.!smbconfchanged = 0
5432return
5433
5434/*:VRX SW_SMBCONF_Close
5435*/
5436SW_SMBCONF_Close:
5437 call SW_SMBCONF_Fini
5438return
5439
5440/*:VRX SW_SMBCONF_Create
5441*/
5442SW_SMBCONF_Create:
5443 call SW_SMBCONF_Init
5444return
5445
5446/*:VRX SW_SMBCONF_Fini
5447*/
5448SW_SMBCONF_Fini:
5449 window = VRInfo( "Window" )
5450 call VRDestroy window
5451 drop window
5452return
5453/*:VRX SW_SMBCONF_Init
5454*/
5455SW_SMBCONF_Init:
5456
5457 /* Buttons */
5458 call NLVSetText "PB_SMBCONF_APPLY", "Caption", 122
5459 call NLVSetText "PB_SMBCONF_UNDO", "Caption", 123
5460 call NLVSetText "PB_SMBCONF_HELP", "Caption", 4
5461
5462return
5463
5464/*:VRX SW_SMBCONF_Init_Content
5465*/
5466SW_SMBCONF_Init_Content:
5467 call _SmbConfCreateShadowCopy
5468
5469 client_NTLMv2_auth = ZeroOne(IniGet('client NTLMv2 auth', 'global', samba.!shadowsmbconf))
5470 if client_NTLMv2_auth = 1 then do
5471 ok = VRSet("CB_client_NTLMv2_auth","Set",client_NTLMv2_auth)
5472 ok = VRSet("CB_client_lanman_auth","Enabled", 0)
5473 ok = VRSet("CB_client_plaintext_auth","Enabled", 0)
5474 end
5475 else do
5476 client_lanman_auth = ZeroOne(IniGet('client lanman auth', 'global', samba.!shadowsmbconf))
5477 client_plaintext_auth = ZeroOne(IniGet('client plaintext auth', 'global', samba.!shadowsmbconf))
5478 ok = VRSet("CB_client_lanman_auth","Set",client_lanman_auth)
5479 ok = VRSet("CB_client_plaintext_auth","Set",client_plaintext_auth)
5480 end
5481
5482 client_use_spnego = ZeroOne(IniGet('client use spnego', 'global', samba.!shadowsmbconf))
5483 ok = VRSet("CB_client_use_spnego","Set",client_use_spnego)
5484
5485 client_use_spnego_principal = ZeroOne(IniGet('client use spnego principal', 'global', samba.!shadowsmbconf))
5486 ok = VRSet("CB_client_use_spnego_principal","Set",client_use_spnego_principal)
5487
5488 client_max_protocol = IniGet('client max protocol', 'global', samba.!shadowsmbconf)
5489 if client_max_protocol = "" then do
5490 /* ok = VRSet("SPIN_client_max_protocol","Enabled", 0)
5491 ok = VRSet("DT_client_max_protocol","Enabled", 0) */
5492 end
5493 else ok = VRSet("SPIN_client_max_protocol","Value",client_max_protocol)
5494
5495 client_min_protocol = IniGet('client min protocol', 'global', samba.!shadowsmbconf)
5496 if client_min_protocol = "" then do
5497 /* ok = VRSet("SPIN_client_min_protocol","Enabled", 0)
5498 ok = VRSet("DT_client_min_protocol","Enabled", 0) */
5499 end
5500 else ok = VRSet("SPIN_client_min_protocol","Value",client_min_protocol)
5501
5502 client_signing = IniGet('client signing', 'global', samba.!shadowsmbconf)
5503 client_ipc_signing = IniGet('client ipc signing', 'global', samba.!shadowsmbconf)
5504say "client_signing ="client_signing
5505 ok = VRSet("SPIN_client_signing","Value",client_signing)
5506 ok = VRSet("SPIN_client_ipc_signing","Value",client_signing)
5507
5508 advanced.!smbconfchanged = 0
5509return
5510
5511/*:VRX SW_SMBTREE_Close
5512*/
5513SW_SMBTREE_Close:
5514 call SW_SMBTREE_Fini
5515return
5516
5517/*:VRX SW_SMBTREE_Create
5518*/
5519SW_SMBTREE_Create:
5520 call SW_SMBTREE_Init
5521return
5522
5523/*:VRX SW_SMBTREE_Fini
5524*/
5525SW_SMBTREE_Fini:
5526 window = VRInfo( "Window" )
5527 call VRDestroy window
5528 drop window
5529return
5530/*:VRX SW_SMBTREE_Init
5531*/
5532SW_SMBTREE_Init:
5533
5534return
5535
5536/*:VRX SW_SMBTREE_Init_Content
5537*/
5538SW_SMBTREE_Init_Content:
5539 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 1)
5540
5541 /* Hide any "foreign" menu entries */
5542 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
5543 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
5544return
5545
5546/*:VRX TDL_1_PageSelected
5547*/
5548TDL_1_PageSelected:
5549 page = VRInfo("Page")
5550
5551 /* call _TabsStrip */
5552 select
5553 when page = 1 then do /* dialog */
5554 call _TabFix 1
5555 end
5556 when page = 2 then do /* advanced */
5557 call SW_ADVANCED_Init_Content
5558 end
5559 when page = 3 then do /* smbtree */
5560 call SW_SMBTREE_Init_Content
5561 end
5562 when page = 4 then do /* condet */
5563 call SW_CONDET_Init_Content
5564 end
5565 when page = 5 then do /* Settings */
5566 call SW_SETTINGS_Init_Content
5567 end
5568 when page = 6 then do /* SMB.CONF */
5569 call SW_SMBCONF_Init_Content
5570 end
5571 otherwise nop
5572 end
5573return
5574/*:VRX TM_AutoClose_Trigger
5575*/
5576TM_AutoClose_Trigger:
5577 call Quit
5578return
5579
5580/*:VRX TM_Progress_Throbber_Trigger
5581*/
5582TM_Progress_Throbber_Trigger:
5583 pIdx = VRGet("Pict_Progress_Throbber","PicturePath")
5584 parse var pIdx '#' pidx
5585 pidx = pidx + 1
5586 if pidx = 23 then pidx = 11
5587 ok = VRSet("Pict_Progress_Throbber","PicturePath","#"pidx)
5588return
5589
5590/*:VRX TM_RefreshCurrentDisplay_Trigger
5591*/
5592TM_RefreshCurrentDisplay_Trigger:
5593 if RefreshMode <> "" then return
5594 if _DaemonRunning() = 0 then do
5595 say " Daemon not running - disable GUI"
5596 ok = VRset("GB_CURRENT", "Enabled", 0)
5597 ok = VRset("TDL_1", "Enabled", 0)
5598 ok = VRSet("Menu_File_Daemon_Start","Enabled", 1)
5599 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 0)
5600 end
5601 else do
5602 say " Daemon running - enable GUI"
5603 ok = VRset("GB_CURRENT", "Enabled", 1)
5604 ok = VRset("TDL_1", "Enabled", 1)
5605 ok = VRSet("Menu_File_Daemon_Start","Enabled", 0)
5606 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 1)
5607 end
5608 CALL REFRESH
5609return
5610
5611/*:VRX TM_RefreshTreeDisplay_Trigger
5612*/
5613TM_RefreshTreeDisplay_Trigger:
5614 ShowHidden = advanced.!special
5615 BroadCast = advanced.!broadcast
5616 DoLMHosts = advanced.!lmhosts
5617
5618 select
5619 when RefreshMode = "TREE" then do
5620 call _RefreshTreeDisplay
5621
5622 if smbtree.!workgroup <> 'SMBTREE.!WORKGROUP' then do
5623 ok = VRset("Menu_Selected_Connect", "Visible", VRMethod("CN_SMBTREE", "ValidateRecord", smbtree.!workgroup ) )
5624 end
5625 end
5626 when RefreshMode = "SHARE" then do
5627 call _AddSharesDisplay
5628 end
5629 otherwise say "RefreshMode = "RefreshMode
5630 end
5631 call _DialogPopulate
5632return
5633
5634/*:VRX TM_TheCloser_Trigger
5635*/
5636TM_TheCloser_Trigger:
5637 call SW_PROGRESS_Close
5638return
5639
5640/*:VRX TM_Throbber_Trigger
5641*/
5642TM_Throbber_Trigger:
5643 pIdx = VRGet("Pict_Throbber","PicturePath")
5644 parse var pIdx '#' pidx
5645 pidx = pidx + 1
5646 if pidx = 23 then pidx = 11
5647 ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
5648return
5649
5650/*:VRX YesNo
5651*/
5652YesNo: procedure
5653 if arg(1) = 1 then answer = "Yes"
5654 else answer = "No"
5655return answer
5656
5657/*:VRX ZeroOne
5658*/
5659ZeroOne: procedure
5660 if translate(arg(1)) = "YES" then answer = 1
5661 else answer = 0
5662return answer
Note: See TracBrowser for help on using the repository browser.