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

Last change on this file since 917 was 910, checked in by Herwig Bauernfeind, 9 years ago

GUITools: EVFSGUI also fix progress throbber

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