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

Last change on this file since 897 was 894, checked in by Alex Taylor, 10 years ago

Various UI tweaks, see changes for details. Enabled detection of Blue Lion system. Added some missing icons.

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