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

Last change on this file since 863 was 837, checked in by Herwig Bauernfeind, 12 years ago

GUITools: EVFSGUI (Ticket #231), SMBMon, shared library updates

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