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

Last change on this file since 873 was 869, checked in by Herwig Bauernfeind, 11 years ago

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

File size: 202.9 KB
Line 
1/*:VRX Main
2*/
3/* Main
4*/
5Main:
6/* Process the arguments.
7 Get the parent window.
8*/
9 parse source . calledAs .
10 parent = ""
11 argCount = arg()
12 argOff = 0
13 if( calledAs \= "COMMAND" )then do
14 if argCount >= 1 then do
15 parent = arg(1)
16 argCount = argCount - 1
17 argOff = 1
18 end
19 end; else do
20 call VROptions 'ImplicitNames'
21 call VROptions 'NoEchoQuit'
22 end
23 InitArgs.0 = argCount
24 if( argCount > 0 )then do i = 1 to argCount
25 InitArgs.i = arg( i + argOff )
26 end
27 drop calledAs argCount argOff
28
29/* Load the windows
30*/
31 call VRInit
32 parse source . . spec
33 _VREPrimaryWindowPath = ,
34 VRParseFileName( spec, "dpn" ) || ".VRW"
35 _VREPrimaryWindow = ,
36 VRLoad( parent, _VREPrimaryWindowPath )
37 drop parent spec
38 if( _VREPrimaryWindow == "" )then do
39 call VRMessage "", "Cannot load window:" VRError(), ,
40 "Error!"
41 _VREReturnValue = 32000
42 signal _VRELeaveMain
43 end
44
45/* Process events
46*/
47 call Init
48 signal on halt
49 do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
50 _VREEvent = VREvent()
51 interpret _VREEvent
52 end
53_VREHalt:
54 _VREReturnValue = Fini()
55 call VRDestroy _VREPrimaryWindow
56_VRELeaveMain:
57 call VRFini
58exit _VREReturnValue
59
60VRLoadSecondary:
61 __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
62 if __vrlsWait then do
63 call VRFlush
64 end
65 __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
66 if __vrlsHWnd = '' then signal __vrlsDone
67 if __vrlsWait \= 1 then signal __vrlsDone
68 call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
69 __vrlsTmp = __vrlsWindows.0
70 if( DataType(__vrlsTmp) \= 'NUM' ) then do
71 __vrlsTmp = 1
72 end
73 else do
74 __vrlsTmp = __vrlsTmp + 1
75 end
76 __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
77 __vrlsWindows.0 = __vrlsTmp
78 do while( VRIsValidObject( VRWindow() ) = 1 )
79 __vrlsEvent = VREvent()
80 interpret __vrlsEvent
81 end
82 __vrlsTmp = __vrlsWindows.0
83 __vrlsWindows.0 = __vrlsTmp - 1
84 call VRWindow __vrlsWindows.__vrlsTmp
85 __vrlsHWnd = ''
86__vrlsDone:
87return __vrlsHWnd
88
89/*:VRX __VXREXX____APPENDS__
90*/
91__VXREXX____APPENDS__:
92/*
93#append 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 if \VRIsValidObject(rh) then return
3047
3048 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3049 PARSE VAR userdata mountpoint ';' mounts ';' .
3050
3051 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3052
3053 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DEFAULT" )
3054
3055 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Click done"
3056return
3057
3058/*:VRX Menu_Context_Open_Detail_Click
3059*/
3060Menu_Context_Open_Detail_Click:
3061 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click started"
3062 if \VRIsValidObject(rh) then return
3063
3064 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3065 PARSE VAR userdata mountpoint ';' mounts ';' .
3066
3067 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3068
3069 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DETAILS" )
3070
3071 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click done"
3072return
3073
3074/*:VRX Menu_Context_Open_Icon_Click
3075*/
3076Menu_Context_Open_Icon_Click:
3077 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click started"
3078 if \VRIsValidObject(rh) then return
3079
3080 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3081 PARSE VAR userdata mountpoint ';' mounts ';' .
3082
3083 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3084
3085 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "ICON" )
3086
3087 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click done"
3088return
3089
3090/*:VRX Menu_Context_Open_Settings_Click
3091*/
3092Menu_Context_Open_Settings_Click:
3093 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Settings_Click started"
3094 if \VRIsValidObject(rh) then return
3095
3096 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3097 PARSE VAR userdata mountpoint ';' mounts ';' .
3098
3099 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3100
3101 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SETTINGS" )
3102
3103 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Settings_Click done"
3104return
3105
3106/*:VRX Menu_Context_Open_Splitview_Click
3107*/
3108Menu_Context_Open_Splitview_Click:
3109 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click started"
3110 if \VRIsValidObject(rh) then return
3111
3112 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3113 PARSE VAR userdata mountpoint ';' mounts ';' .
3114
3115 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3116
3117 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SPLITVIEW" )
3118
3119 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click done"
3120return
3121
3122/*:VRX Menu_Context_Open_Tree_Click
3123*/
3124Menu_Context_Open_Tree_Click:
3125 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click started"
3126 if \VRIsValidObject(rh) then return
3127
3128 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3129 PARSE VAR userdata mountpoint ';' mounts ';' .
3130
3131 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3132
3133 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "TREE" )
3134
3135 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click done"
3136return
3137
3138/*:VRX Menu_Context_Refresh_Click
3139*/
3140Menu_Context_Refresh_Click:
3141 CALL Refresh
3142return
3143
3144/*:VRX Menu_Context_Unmount_Click
3145*/
3146Menu_Context_Unmount_Click:
3147 call PB_UNMOUNT_Click
3148return
3149
3150/*:VRX Menu_File_Autostart_Activate_Click
3151*/
3152Menu_File_Autostart_Activate_Click:
3153 options.!autostart = 1
3154
3155 Profile = VRParseFilename(settings.!ini,'DPN')'.'fs.!profileext
3156 ExeName = VRParseFileName(VRget("Application","Program"),'DPNE')
3157 if ExeName = "" then do
3158 parse source . . script
3159 ExeName = VRParseFilename(script,'DP')'\EVFSGUI.EXE'
3160 end
3161 StartupDir = VRParseFileName(VRget("Application","Program"),'DP')
3162 if StartupDir = "" then do
3163 parse source . . script
3164 StartUpDir = VRParseFilename(script,'DP')
3165 end
3166
3167 ObjTitle = NLVGetMessage( 59 )
3168 if ObjTitle = "" then ObjTitle = '[EVFS LAN-Connections]'
3169
3170 CALL PB_CONDET_SAVE_Click
3171
3172 rc = CreateObject( 'WPProgram', ObjTitle,'<WP_START>',,
3173 'EXENAME='||ExeName||';'||,
3174 'PROGTYPE=PM;'||,
3175 'TITLE='ObjTitle';'||,
3176 'PARAMETERS='Profile' -AUTOCLOSE -NOGUI;'||,
3177 'STARTUPDIR='StartupDir';'||,
3178 'NOPRINT=YES;'||,
3179 'HIDEBUTTON=DEFAULT;'||,
3180 'MINWIN=DEFAULT;'||,
3181 'CCVIEW=DEFAULT;'||,
3182 'DEFAULTVIEW=DEFAULT;'||,
3183 'OBJECTID=<EVFSGUI_AUTOSTART>',,
3184 'REPLACE' )
3185
3186 IF rc == 1 THEN do
3187 Text = NLVGetMessage( 60 )
3188 if Text = "" then Text = '[Created object in Autostart-Folder]'
3189 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3190 end
3191 ELSE do
3192 Text = NLVGetMessage( 61 )
3193 if Text = "" then Text = '[Could not create object in Autostart-Folder]'
3194 Title = NLVGetMessage( 5 )
3195 if Title = "" then Title = '[Error]'
3196 CALL VRMessage 'Main', Text, Title, 'E'
3197 end
3198
3199 options.!autostart = 0
3200return
3201/*:VRX Menu_File_Autostart_Click
3202*/
3203Menu_File_Autostart_Click:
3204
3205return
3206
3207/*:VRX Menu_File_Autostart_Deactivate_Click
3208*/
3209Menu_File_Autostart_Deactivate_Click:
3210 ok = SysDestroyObject("<EVFSGUI_AUTOSTART>")
3211 IF ok == 1 THEN do
3212 Text = NLVGetMessage( 79 )
3213 if Text = "" then Text = '[Autostart object created successfully]'
3214 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3215 end
3216 ELSE do
3217 Text = NLVGetMessage( 78 )
3218 if Text = "" then Text = '[Could find Autostart object]'
3219 Title = NLVGetMessage( 5 )
3220 if Title = "" then Title = '[Error]'
3221 CALL VRMessage 'Main', Text, Title, 'E'
3222 end
3223return
3224
3225/*:VRX Menu_File_Click
3226*/
3227Menu_File_Click:
3228 ok = VRSet("Menu_File_LMHosts_Reset", "Enabled", VRFileExists( samba.!lmhosts ))
3229 ok = VRSet("Menu_File_ucCred_Reset", "Enabled", (VRGet("Pict_PWINMEM","PicturePath") = "#36"))
3230return
3231
3232/*:VRX Menu_File_Close_Click
3233*/
3234Menu_File_Close_Click:
3235 call Quit
3236return
3237
3238/*:VRX Menu_File_Daemon_Start_Click
3239*/
3240Menu_File_Daemon_Start_Click:
3241 if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click started'
3242 if VRFileExists(SysBootDrive()"\ndpsmb.dbg") then do
3243 btns.0 = 2
3244 btns.1 = NLVGetMessage( 6 )
3245 btns.2 = NLVGetMessage( 7 )
3246 confirm = VRMessage('Main', NLVGetMessage( 119 ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3247 IF confirm == 1 THEN do
3248 logFiles = value("LOGFILES",,"OS2ENVIRONMENT")
3249 ok1 = SysFileDelete(Logfiles||'\log.smbc')
3250 ok2 = SysFileDelete(Logfiles||'\log.ndpsmb')
3251 if ok1 <> 0 | ok2 <> 0 then do
3252 ok = VRMessage('Main', NLVGetMessage(5)' 'Logfiles||'\log.smbc RC='ok1||'0D0A'x||NLVGetMessage(5)' 'Logfiles||'\log.ndpsmb RC='ok2, NLVGetMessage( 5 ), 'E')
3253 end
3254 drop ok1 ok2
3255 end
3256 end
3257 address cmd 'detach 'fs.!prefix'CTL.EXE'
3258 ok = VRset("GB_CURRENT","Enabled", 1)
3259 ok = VRset("TDL_1","Enabled", 1)
3260 CALL REFRESH
3261 ok = VRSet("Menu_File_Daemon_Start","Enabled",0)
3262 ok = VRSet("Menu_File_Daemon_Stop","Enabled",1)
3263 if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click done'
3264return
3265
3266/*:VRX Menu_File_Daemon_Stop_Click
3267*/
3268Menu_File_Daemon_Stop_Click:
3269 if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click started'
3270 ok = PRProcessList(proc)
3271 do I = 1 to proc.0
3272 CurProc = VRParseFileName(proc.i.name,'NE')
3273 if CurProc = fs.!prefix"CTL.EXE" then do
3274 call charout , ' 'CurProc' RC='
3275 ok = PRKillProcess(1,proc.i.pid)
3276 say ok
3277 end
3278 end
3279 ok = VRset("GB_CURRENT","Enabled", 0)
3280 ok = VRset("TDL_1","Enabled", 0)
3281 ok = VRSet("Menu_File_Daemon_Start","Enabled",1)
3282 ok = VRSet("Menu_File_Daemon_Stop","Enabled",0)
3283 if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click stopped'
3284return
3285/*:VRX Menu_File_LMHosts_Reset_Click
3286*/
3287Menu_File_LMHosts_Reset_Click:
3288 call _LMHostsReset
3289return
3290
3291/*:VRX Menu_File_Load_Click
3292*/
3293Menu_File_Load_Click: PROCEDURE EXPOSE settings. options. icons. advanced. vfs. Profile fs. cd. samba.
3294 IF options.!autoload == 1 then filename = Profile
3295 else filename = VRFileDialog('Main', NLVGetMessage( 55 ), 'L', '*.'fs.!profileext)
3296 IF filename == '' THEN RETURN
3297 IF STREAM( filename, 'C', 'QUERY EXISTS') == '' THEN DO
3298 CALL VRMessage 'Main', NLVGetMessage( 56, filename ), NLVGetMessage( 5 ), 'E'
3299 RETURN
3300 END
3301
3302 CALL LINEIN filename, 1, 0
3303 DO WHILE LINES( filename )
3304 /* Fix Ticket #202 in order to allow blanks in sharenames */
3305 resline = LINEIN( filename )
3306 nodelen = pos('\\',resline)-2
3307 node = left(resline,nodelen)
3308 rwFlag = word(resline,words(resline))
3309 resource = substr(resline,nodelen+2,length(resline)-(nodelen+2)-(length(rwFlag)+1)+1)
3310 drop resline
3311 drop nodelen
3312
3313 vfs.!drive = FILESPEC('DRIVE', node )
3314 vfs.!mountpoint = STRIP( node, 'T', '\')
3315
3316 /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
3317 if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
3318
3319 call ParseResParmString
3320
3321 options.!workgroup = p_workgroup
3322 options.!server = p_server
3323 options.!share = p_share
3324 options.!user = p_user
3325 options.!password = p_password
3326 options.!spassword = p_spassword
3327 options.!master = p_master
3328 options.!mastertype = p_mtype
3329/* options.!memlen = p_memlen
3330 options.!logfile = p_logfile
3331 options.!loglevel = p_loglevel */
3332 options.!cachetimeout = p_cachetimeout
3333 options.!cachelistings = p_cachelistings
3334 options.!easupport = p_easupport
3335
3336 IF rwFlag == 'R' THEN
3337 options.!readonly = 1
3338 ELSE
3339 options.!readonly = 0
3340
3341 CALL Mount
3342
3343 END
3344 CALL STREAM filename, 'C', 'CLOSE'
3345
3346 options.!autoload = 0
3347
3348 CALL Refresh
3349RETURN
3350/*:VRX Menu_File_Save_Click
3351*/
3352Menu_File_Save_Click:
3353 call PB_CONDET_SAVE_Click
3354return
3355
3356/*:VRX Menu_File_ucCred_Reset_Click
3357*/
3358Menu_File_ucCred_Reset_Click:
3359 if _ucChkUc() then ok = _ucDelUc()
3360 ok = VRSet("Pict_PWINMEM","PicturePath","#37")
3361 ok = VRSet("EF_USER", "Value","")
3362 ok = VRSet("EF_PASSWORD","Value","")
3363 call _UserCredUpdate
3364return
3365
3366/*:VRX Menu_Help_About_Click
3367*/
3368Menu_Help_About_Click:
3369 ok = VRLoadSecondary("SW_ABOUT", "W")
3370return
3371
3372/*:VRX Menu_Help_Extended_Click
3373*/
3374Menu_Help_Extended_Click:
3375 ok = VRMethod( "Main", "InvokeHelp" )
3376return
3377
3378/*:VRX Menu_Selected_Connect_Click
3379*/
3380Menu_Selected_Connect_Click:
3381 call PB_SMBTREE_CONNECT_Click
3382return
3383
3384/*:VRX Menu_Selected_Default_Workgroup_Click
3385*/
3386Menu_Selected_Default_Workgroup_Click:
3387 if options.!debug == 1 then say time()' '||"Menu_Selected_Default_Workgroup_Click started"
3388 if options.!debug == 1 then say ' SMBObj.rh = "'SMBObj.rh'"'
3389 Success = 0
3390 if SMBObj.rh <> "" then do
3391 if options.!debug == 1 then say ' SMBObj.udatatype = "'SMBObj.udatatype'"'
3392 Success = 1
3393 select
3394 when SMBObj.udatatype = "WORKGROUP" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.rh,"Caption")
3395 when SMBObj.udatatype = "DISK" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.gparentrh,"Caption")
3396 when SMBObj.udatatype = "PRINTER" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.gparentrh,"Caption")
3397 when SMBObj.udatatype = "SERVER" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
3398 otherwise Success = 0
3399 end
3400
3401 /* FIXME: switch over to REXXIni calls */
3402 if Success = 1 then ok = TRSetIni("[global]","workgroup", workgroupname, samba.!smbconf)
3403 end
3404 Buttons.1 = NLVGetMessage(2)
3405 Buttons.0 = 1
3406
3407 if Success = 0 then do
3408 id = VRMessage( VRWindow(), NLVGetMessage(5), NLVGetMessage(75), "Error", "Buttons.", 1, 1 )
3409 end
3410 else do
3411 id = VRMessage( VRWindow(), NLVGetMessage(117, workgroupname), NLVGetMessage(75), "Information", "Buttons.", 1, 1 )
3412 end
3413 if options.!debug == 1 then say time()' '||"Menu_Selected_Default_Workgroup_Click done"
3414return
3415
3416/*:VRX Menu_Selected_DetailsView_Click
3417*/
3418Menu_Selected_DetailsView_Click:
3419 ok = VRSet("CN_smbtree", "View", "Detail")
3420return
3421
3422/*:VRX Menu_Selected_Info_Click
3423*/
3424Menu_Selected_Info_Click:
3425 if options.!debug == 1 then say time()' Menu_Selected_Info_Click started'
3426
3427 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3428 if SelRH.0 = 0 then do
3429 if options.!debug == 1 then say time()' Menu_Selected_Info_Click aborted'
3430 return
3431 end
3432
3433 call _GetSMBObjectProperties SelRH.1
3434
3435 window = VRLoadSecondary( "SW_INFO", "W" )
3436 if options.!debug == 1 then say time()' Menu_Selected_Info_Click done'
3437return
3438
3439/*:VRX Menu_Selected_Refresh_Click
3440*/
3441Menu_Selected_Refresh_Click:
3442 ok = VRMethod( "CN_smbtree", "SetRecordAttr", SMBObj.rh, "Icon","#61:PMWP.DLL")
3443 call _DelSMBObjectShares SMBObj.rh
3444 machine = SMBObj.resname
3445 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
3446 call _RefreshShares
3447return
3448
3449/*:VRX Menu_Selected_Remove_Click
3450*/
3451Menu_Selected_Remove_Click:
3452 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
3453 if selrec.0 = 0 then return
3454
3455 do I = 1 to selrec.0
3456 if VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.statusfh) = icons.!passive then do
3457 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3458 end
3459 else do
3460 mountpoint = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpointfh)
3461 mpidx = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpidxfh)
3462 if mpidx = 1 then do
3463 btns.0 = 2
3464 btns.1 = NLVGetMessage( 6 )
3465 btns.2 = NLVGetMessage( 7 )
3466 confirm = VRMessage('Main', NLVGetMessage( 72, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3467 IF confirm \= 1 THEN RETURN
3468
3469 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "mpidx")"
3470 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3471 CALL Refresh
3472 end
3473 else do
3474 CALL VRMessage 'Main', NLVGetMessage( 71 ) , NLVGetMessage( 89 )||" "||mountpoint , 'E'
3475 end
3476 end
3477 end
3478return
3479
3480/*:VRX Menu_Selected_Retry_Click
3481*/
3482Menu_Selected_Retry_Click: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba. mtype.
3483
3484 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "srcrec." )
3485 if srcrec.0 = 0 then return
3486
3487 srcrec = srcrec.1
3488
3489 p_mpoint = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.MpointFH)
3490
3491 p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcrec, cd.workgrpFH )
3492 p_server = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ServerFH)
3493 p_share = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ShareFH)
3494 p_user = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.UserFH)
3495 p_password = x2c(VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.SpasswordFH))
3496
3497 ShareLevel = 1
3498 if p_share = "" then ShareLevel = 2
3499 if p_server = "" then ShareLevel = 3
3500 if p_workgroup = "" then ShareLevel = 4
3501
3502 ok = VRSet("CB_MOUNT", "Selected", Sharelevel )
3503 ok = VRset("CB_MOUNT", "Value", mtype.sharelevel)
3504
3505 call _UpdateObject "EF_SERVER", p_server
3506 ok = VRset("EF_SHARE" , "Value", p_share)
3507 ok = VRset("EF_NETWORK", "Value", p_workgroup)
3508 ok = VRset("EF_USER" , "Value", p_user)
3509 ok = VRset("EF_PASSWORD", "Value", p_password)
3510
3511 parse var p_mpoint p_drv '\' p_dir
3512
3513 p_dir = strip(p_dir,'T','\')
3514
3515 ok = VRset("CB_DRIVES" , "Value", p_drv)
3516 ok = VRset("EF_DIRECTORY" , "Value", p_dir)
3517
3518 CALL PB_MOUNT_Click
3519
3520/* if VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
3521 if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
3522 end */
3523return
3524
3525/*:VRX Menu_Selected_TimeSync_Click
3526*/
3527Menu_Selected_TimeSync_Click:
3528 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click started'
3529
3530 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3531 if SelRH.0 = 0 then do
3532 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click aborted'
3533 return
3534 end
3535
3536 call _GetSMBObjectProperties SelRH.1
3537
3538 options.!timesrv = SMBObj.resname
3539 call _TimeSync
3540
3541 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click done'
3542return
3543
3544/*:VRX Menu_Selected_TreeView_Click
3545*/
3546Menu_Selected_TreeView_Click:
3547 ok = VRSet("CN_smbtree", "View", "IconTree")
3548return
3549
3550/*:VRX Mount
3551*/
3552Mount: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba.
3553 if options.!debug == 1 then say time()' Mount procedure started'
3554 /* Set mouse pointer to wait - this operation might take a few seconds */
3555 call VRSet VRWindow(), 'Pointer', 'Wait'
3556
3557/* Disabled, because we merge profile now - in earlier revisions
3558 we replaced it but only for preexisting drives - this made only
3559 sense as long as we were unable to detect double connections -
3560 this could be made an option!
3561
3562 IF options.!autoload then do
3563 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"vfs.!drive"')"
3564 if options.!debug == 1 then say time()' '||'Autoload Detach "'vfs.!drive'" =' ok
3565 end */
3566
3567 /* Attach the virtual drive - only if drive is not already attached */
3568 if pos(vfs.!drive,MyFreeDriveMap("C:","FREE")) > 0 then do
3569 CALL _Dynamic "ok = "fs.!prefix"RxAttach('"vfs.!drive"')"
3570
3571 if options.!debug == 1 then say time()' '||'Attach "'vfs.!drive'" =' ok
3572 end
3573
3574 /* Create the mount point and store whether it was created or already existed */
3575 CALL _Dynamic "CreateMP = "fs.!prefix"RxCreateMountPoint('"vfs.!mountpoint"')"
3576
3577 if options.!debug == 1 then say time()' '||'Create "'vfs.!mountpoint'" = 'CreateMP
3578
3579
3580 /* Build the resource parameter string */
3581 src = ''
3582 IF options.!workgroup \= '' THEN src = src';WORKGROUP='options.!workgroup
3583 IF options.!server \= '' THEN src = src';SERVER='options.!server
3584 IF options.!share \= '' THEN src = src';SHARE='options.!share
3585 IF options.!user \= '' THEN src = src';USER='options.!user
3586 IF options.!password \= '' THEN src = src';PASSWORD='options.!password
3587 IF options.!spassword \= '' THEN src = src';SPASSWORD='options.!spassword
3588 IF options.!master \= '' THEN src = src';MASTER='options.!master
3589 IF options.!mastertype \= '' THEN src = src';MASTERTYPE='options.!mastertype
3590/* IF options.!memlen \= '' THEN src = src';MEMLEN='options.!memlen
3591 IF options.!logfile \= '' THEN src = src';LOGFILE='options.!logfile
3592 IF options.!loglevel \= '' THEN src = src';LOGLEVEL='options.!loglevel */
3593 IF options.!cachetimeout \= '' THEN src = src';CTO='options.!cachetimeout
3594 IF options.!cachelistings \= '' THEN src = src';CLD='options.!cachelistings
3595 IF options.!easupport \= '' THEN src = src';EASUPPORT='options.!easupport
3596
3597 IF options.!readonly = 1 then rwFlag = 'R'; else rwFlag = 'W'
3598
3599 parse var vfs.!mountpoint mpoint ';' .
3600 mpoint = strip(mpoint,'T','\')||'\'
3601
3602 if options.!master = "" then options.!master = "WORKGROUP"
3603 if options.!mtype = "" then options.!mtype = "1"
3604 if options.!loglevel = "" then options.!loglevel = "0"
3605 if options.!memlen = "" then options.!memlen = "2"
3606 if options.!cachetimeout = "" then options.!cachetimeout = "10"
3607 if options.!cachelistings = "" then options.!cachelistings = "32"
3608 if options.!easupport= "" | options.!easupport= " " then options.!easupport = strip(options.!easupport)
3609 if options.!password <> "" & options.!spassword = "" then do
3610 options.!spassword = c2x(options.!password)
3611 options.!password = ""
3612 end
3613
3614 hashstr = mpoint' 'translate(options.!workgroup)' 'translate(options.!server)' 'translate(options.!share)' 'options.!user' 'options.!spassword' 'options.!easupport' 'rwFlag
3615
3616 md5 = rexx_md5(hashstr)
3617
3618 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
3619 DO i = 1 TO records.0
3620 hash = VRMethod("CN_CONDET","GetFieldData", records.i, cd.hashfh)
3621
3622 if options.!debug == 1 then say VRMethod("CN_CONDET","GetFieldData", records.i, CD.mpointFH)'->'hash
3623 if options.!debug == 1 then say mpoint'->'md5
3624
3625 if hash = md5 then do
3626 If VRMethod("CN_CONDET","GetFieldData", records.i, cd.statusfh) = icons.!active then do /* Same hash, status active */
3627 say "Double connection detected!!"
3628 if options.!spassword <> "" then upw = ":********"
3629 else upw = ""
3630 buttons.0 = 2
3631 buttons.1 = NLVGetMessage(9)
3632 buttons.2 = NLVGetMessage(3)
3633 Answer = VRMessage('Main',NLVGetMessage(64) , NLVGetMessage( 36,options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3634 if Answer = 2 then do
3635 call VRSet VRWindow(), 'Pointer', '<default>'
3636 say "Double connection - do not mount!!"
3637 return
3638 end
3639 end
3640 else do /* Same hash, status passive - we have to remove it */
3641 ok = VRMethod("CN_CONDET", "RemoveRecord", records.i )
3642 end
3643 end
3644 end
3645
3646 cd.lastrh = ""
3647 ok = ParseResourceData(vfs.!mountpoint,'SMBFS SMBFS64 \\'options.!workgroup':'options.!server'\'options.!share'@'options.!user||src' 'rwFlag)
3648
3649 /* Now mount the resource */
3650 CALL _Dynamic "ok = "fs.!prefix"RxMount('SMBFS','"vfs.!mountpoint"', '"src"', '"rwFlag"')"
3651
3652 if options.!debug == 1 then say time()' '||'Mount "'vfs.!mountpoint'" =' ok
3653 if ok <> 0 then do
3654 if options.!password <> "" then upw = ":********"
3655 else upw = ""
3656 buttons.0 = 2
3657 buttons.1 = NLVGetMessage(2)
3658 buttons.2 = NLVGetMessage(37)
3659 Answer = VRMessage('Main', SysGetMessage(ok), NLVGetMessage( 36, options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3660 if Answer = 2 then do /* Show explanation */
3661 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')
3662 end
3663 if cd.lastrh <> '' then do
3664 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive) /* Passive Connection icon */
3665 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive) /* Passive Connection icon */
3666 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, '') /* remove pain text password */
3667 end
3668
3669 /* In case the mountpoint was created for this failed operation, it is (optionally) removed again */
3670 if CreateMP = 0 & advanced.!alwaysmp <> 1 then do
3671 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"vfs.!mountpoint"')"
3672 if options.!debug == 1 then say time()' '||'Remove "'vfs.!mountpoint'" = 'ok
3673 end
3674 end
3675 else do
3676 if options.!storecreds = 1 then do
3677 ok = VRSet("EF_User", "Value",options.!user)
3678 ok = VRSet("EF_Password","Value",x2c(options.!spassword))
3679 end
3680 end
3681 drop CreateMP /* not required anymore */
3682
3683/* Obsolete - the IOCtl will not be implemented this way in the plugin
3684 The REXX function is present, but is has no counterpart in the plugin
3685 ok = EvfsRxIoctl( 100 , vfs.!mountpoint, outstring)
3686 if options.!debug == 1 then say time()' '||'RxIoctl "'vfs.!mountpoint'" = 'ok', 'outstring
3687 */
3688 /* Set mouse pointer to default again */
3689 call VRSet VRWindow(), 'Pointer', '<default>'
3690 if options.!debug == 1 then say time()' Mount procedure done'
3691RETURN ok
3692
3693/*:VRX MyFreeDriveMap
3694*/
3695MyFreeDriveMap: procedure expose options. icons. fs. samba.
3696 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) started'
3697 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:"
3698/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) started" */
3699 useddrives= SysDriveMap("C:","USED")
3700/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) done" */
3701
3702 Alldr = words(alldrives)
3703 FreeDriveMap = ""
3704 do I = 1 to AllDr
3705 if word(alldrives,1) = word(useddrives,1) then do
3706 Useddrives = subword(useddrives,2)
3707 Alldrives = subword(Alldrives,2)
3708 end
3709 else do
3710 FreeDriveMap = FreeDriveMap||word(alldrives,1)||' '
3711 Alldrives = subword(Alldrives,2)
3712 end
3713 end
3714 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) done, result "'FreeDriveMap'"'
3715return FreeDriveMap
3716/*:VRX NoEVFSCALL
3717*/
3718NoEVFSCALL:
3719 CALL VRMessage 'Main', NLVGetMessage( 100 ), NLVGetMessage( 5 ), 'E'
3720 signal Halt
3721RETURN
3722
3723/*:VRX ParseResourceData
3724*/
3725ParseResourceData: PROCEDURE EXPOSE userdata options. icons. advanced. fs. cd. samba.
3726 PARSE ARG userdata, resource
3727 if options.!debug == 1 then say time()' ParseResourceData started'
3728 if options.!debug == 1 then say ' receiving "'userdata'" "'resource'" length ('length(resource)')'
3729
3730/* WARNING! resource has a maximal length of 255 and is truncated otherwise */
3731
3732/* PARSE VAR resource . ';WORKGROUP='p_workgroup';SERVER='p_server';SHARE='p_share';' . */
3733
3734 if left(word(resource,1),5) <> "SMBFS" then do
3735 /* Support for other filesystems would come here! */
3736 userData = "UNKNOWN"
3737 end
3738 else do
3739 cd.lastrh = VRMethod("CN_CONDET","AddRecord")
3740 PARSE VAR userdata p_mpoint ';' p_mpidx ';' .
3741
3742 p_mpoint = strip(p_mpoint,'T','\')||'\'
3743 p_rw = word(resource, words(resource))
3744
3745 /* Workaround for truncated resource string */
3746 if length(p_rw) > 1 then do
3747 /* The resource string must have been truncated
3748 p_rw is already wrong and
3749 p_easupport will most likely be also wrong (look below for workaround!) */
3750 p_rw ="W" /* this is guessed only!!! */
3751 if options.!debug == 1 then say ' WARNING! Detected truncated resource string - shorten workgroup name, server name, share name until this message goes away!'
3752 end
3753 /* this should be done unconditionally if the resource string is never truncated */
3754 else resource = left(resource,length(resource)-length(p_rw))
3755
3756 call ParseResParmString
3757
3758 if p_master = "" then p_master = "WORKGROUP"
3759 if p_mtype = "" then p_mtype = "1"
3760 if p_loglevel = "" then p_loglevel = "0"
3761 if p_memlen = "" then p_memlen = "2"
3762
3763 /* Also works around for a truncated resource string! */
3764 if p_easupport= "" | p_easupport= " " then p_easupport = strip(options.!easupport)
3765
3766 if p_password <> "" & p_spassword = "" then do
3767 p_spassword = c2x(p_password)
3768 p_password = ""
3769 end
3770
3771 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)
3772 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password, cd.spasswordfh, p_spassword, cd.masterfh, p_master, cd.mtypefh, p_mtype)
3773 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout, cd.cldFH, p_cachelistings)
3774 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)
3775 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!active) /* Active */
3776 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!active) /* Active */
3777
3778 hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
3779
3780 md5 = rexx_md5(hashstr)
3781
3782 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh,md5)
3783
3784 SELECT
3785 WHEN p_share == '' & p_server \= '' THEN DO /* all shares on server */
3786 IF p_workgroup == '' THEN
3787 userdata = userdata';\\'p_server'\*'
3788 ELSE
3789 userdata = userdata';'p_workgroup':\\'p_server'\*'
3790 END
3791 WHEN p_server == '' & p_workgroup \= '' THEN /* all servers in workgroup */
3792 userdata = userdata';'p_workgroup':\\*'
3793 WHEN p_server == '' & p_workgroup == '' THEN /* all workgroups */
3794 userdata = userdata';*:\\*'
3795 OTHERWISE DO
3796 IF p_workgroup == '' THEN
3797 userdata = userdata';\\'p_server'\'p_share
3798 ELSE
3799 userdata = userdata';'p_workgroup':\\'p_server'\'p_share
3800 END
3801 END
3802 end
3803
3804 if options.!debug == 1 then say ' returning "'userdata'"'
3805 if options.!debug == 1 then say time()' ParseResourceData done'
3806RETURN userdata
3807
3808/*:VRX ParseResParmString
3809*/
3810ParseResParmString:
3811 PARSE VAR resource . ';WORKGROUP=' p_workgroup ';' .
3812 PARSE VAR resource . ';SERVER=' p_server ';' .
3813 PARSE VAR resource . ';SHARE=' p_share ';' .
3814 PARSE VAR resource . ';USER=' p_user ';' .
3815 PARSE VAR resource . ';PASSWORD=' p_password ';' .
3816 PARSE VAR resource . ';SPASSWORD=' p_spassword ';' .
3817 PARSE VAR resource . ';MASTER=' p_master ';' .
3818 PARSE VAR resource . ';MASTERTYPE=' p_mtype ';' .
3819 PARSE VAR resource . ';MEMLEN=' p_memlen ';' .
3820 PARSE VAR resource . ';LOGFILE=' p_logfile ';' .
3821 PARSE VAR resource . ';LOGLEVEL=' p_loglevel ';' .
3822 PARSE VAR resource . ';CTO=' p_cachetimeout ';' .
3823 PARSE VAR resource . ';CLD=' p_cachelistings ';' .
3824 PARSE VAR resource . ';EASUPPORT=' p_easupport ' '
3825return
3826/*:VRX PB_ABOUT_CLOSE_Click
3827*/
3828PB_ABOUT_CLOSE_Click:
3829 CALL SW_ABOUT_Close
3830return
3831
3832/*:VRX PB_ABOUT_COPY_Click
3833*/
3834PB_ABOUT_COPY_Click:
3835 ok = VRMethod( "Application", "PutClipboard", AboutStr )
3836 if options.!debug == 1 then call beep 880*2,10
3837 CALL SW_ABOUT_Close
3838return
3839
3840/*:VRX PB_ADVANCED_APPLY_Click
3841*/
3842PB_ADVANCED_APPLY_Click:
3843 advanced.!easupport = VRGet( "CB_EAS", "Set" )
3844 advanced.!readonly = VRGet( "CB_READONLY", "Set" )
3845 advanced.!alwaysmp = VRGet( "CB_ALWAYSMP", "Set" )
3846 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT", "Value" )
3847 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS", "Value" )
3848
3849 /* Obsolete */
3850 advanced.!memlen = VRGet( "SPB_MEMLEN", "Value" )
3851return
3852
3853/*:VRX PB_ADVANCED_HELP_Click
3854*/
3855PB_ADVANCED_HELP_Click:
3856 CALL VRMethod 'SW_ADVANCED', 'InvokeHelp'
3857return
3858
3859/*:VRX PB_ADVANCED_UNDO_Click
3860*/
3861PB_ADVANCED_UNDO_Click:
3862 CALL SW_ADVANCED_Init_Content
3863RETURN
3864
3865/*:VRX PB_ClearCred_Click
3866*/
3867PB_ClearCred_Click:
3868 call Menu_File_ucCred_Reset_Click
3869return
3870
3871/*:VRX PB_CONDET_HELP_Click
3872*/
3873PB_CONDET_HELP_Click:
3874 CALL VRMethod 'GB_CONDET', 'InvokeHelp'
3875return
3876
3877/*:VRX PB_CONDET_LOAD_Click
3878*/
3879PB_CONDET_LOAD_Click:
3880 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click started"
3881 call Menu_File_Load_Click
3882 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click done"
3883RETURN
3884
3885/*:VRX PB_CONDET_SAVE_Click
3886*/
3887PB_CONDET_SAVE_Click: PROCEDURE EXPOSE settings. options. icons. Profile fs. cd. advanced. samba.
3888 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click started"
3889
3890 if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
3891 ELSE filename = Profile
3892
3893 IF filename == '' THEN RETURN
3894
3895 IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
3896 btns.0 = 2
3897 btns.1 = NLVGetMessage( 6 )
3898 if btns.1 = "" then btns.1 = '[Yes]'
3899 btns.2 = NLVGetMessage( 7 )
3900 if btns.2 = "" then btns.2 = '[No]'
3901 Title = NLVGetMessage( 53 )
3902 if Title = "" then Title = "[File exists]"
3903 Text = NLVGetMessage( 54, filename )
3904 if Text = "" then Text = "[File "filename" exists? Overwrite?]"
3905
3906 confirm = VRMessage('Main', Text, Title, 'W', 'btns.', 1, 2 )
3907 IF confirm \= 1 THEN RETURN
3908 CALL VRChAttr filename,, 'HSR'
3909 CALL VRDeleteFile filename
3910 END
3911
3912 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
3913 DO i = 1 TO records.0
3914 resource = ""
3915 resource = resource||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
3916 resource = resource||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
3917 resource = resource||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3918 resource = resource||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3919 resource = resource||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3920 resource = resource||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
3921 resource = resource||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3922 resource = resource||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3923 resource = resource||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3924 resource = resource||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
3925 resource = resource||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
3926 resource = resource||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
3927 resource = resource||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
3928 resource = resource||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
3929 resource = resource||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
3930/* resource = resource||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
3931 resource = resource||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
3932 resource = resource||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
3933 resource = resource||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
3934 resource = resource||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
3935 call lineout filename, resource
3936 END
3937 CALL STREAM filename, 'C', 'CLOSE'
3938
3939 if options.!autostart == 0 THEN do
3940 Title = NLVGetMessage( 51 )
3941 if Title = "" then Title = "[Profile saved]"
3942 Text = NLVGetMessage( 52, filename )
3943 if Text = "" then Text = "[Profile saved to "filename"!]"
3944 CALL VRMessage 'Main', Text , Title, 'I'
3945 end
3946
3947 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click done"
3948RETURN
3949
3950/*:VRX PB_DETACH_Click
3951*/
3952PB_DETACH_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
3953 if options.!debug == 1 then say time()' '||"PB_DETACH_Click started"
3954 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
3955 IF select.0 < 1 THEN RETURN
3956
3957 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
3958 PARSE VAR userdata mountpoint ';' mounts ';' .
3959 drive = STRIP( mountpoint, 'T', '\')
3960
3961 btns.0 = 2
3962 btns.1 = NLVGetMessage( 6 )
3963 btns.2 = NLVGetMessage( 7 )
3964 confirm = VRMessage('Main', NLVGetMessage( 58, drive ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3965 IF confirm \= 1 THEN RETURN
3966
3967 /* TODO: ?? Unmount & delete all child mountpoints? - Do we need this? */
3968 /* FIXME: This is potentially dangerous on Netdrive - what happens with unknown mount types? */
3969 /* FIXME: Unclear under which circumstances we have an alpha value here (which crahed EVFSGUI) */
3970 if datatype(mounts) = 'NUM' then do
3971 /* Unmount any resources */
3972 DO i = 1 TO mounts
3973 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
3974 END
3975 end
3976 else if options.!debug == 1 then say ' '||"mounts = "mounts
3977
3978 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"drive"')"
3979
3980 CALL Refresh
3981 if options.!debug == 1 then say time()' '||"PB_DETACH_Click done"
3982RETURN
3983
3984/*:VRX PB_DIALOG_HELP_Click
3985*/
3986PB_DIALOG_HELP_Click:
3987 CALL VRMethod 'GB_DIALOG', 'InvokeHelp'
3988return
3989
3990/*:VRX PB_EDIT_CANCEL_Click
3991*/
3992PB_EDIT_CANCEL_Click:
3993 options.!editmode = 0
3994 CALL VRSet "PB_UNMOUNT","Enabled", 1
3995 CALL VRSet "GB_CURRENT", "ENABLED", 1
3996 ok = VRSet("PB_EDIT_CANCEL","Visible", 0)
3997 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(13)" " )
3998/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
3999RETURN 0
4000
4001/*:VRX PB_INFO_OK_Click
4002*/
4003PB_INFO_OK_Click:
4004 call SW_INFO_Close
4005RETURN
4006
4007/*:VRX PB_LOGIN_CANCEL_Click
4008*/
4009PB_LOGIN_CANCEL_Click:
4010 credentials.!entered = 0
4011 call SW_LOGIN_Close
4012RETURN
4013
4014/*:VRX PB_LOGIN_OK_Click
4015*/
4016PB_LOGIN_OK_Click:
4017 ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
4018 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value"))
4019 options.!storecreds = VRGet("CB_STORECREDS1","Set")
4020 credentials.!entered = 1
4021
4022 if p_server <> "" then do
4023 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
4024
4025 if word(ok,1) = "1" then do
4026 ok = VRSet("DT_STATUSBAR","Caption", NLVGetMessage(107, rpc.queryuser.FULL_NAME))
4027 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
4028 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
4029 end
4030 else do
4031 CALL VRMessage 'Main', VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS, NLVGetMessage(5), "E"
4032 end
4033 end
4034
4035 call SW_LOGIN_Close
4036RETURN
4037
4038/*:VRX PB_MOUNT_Click
4039*/
4040PB_MOUNT_Click:
4041 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click started"
4042 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
4043 say " network = "network
4044 if options.!editmode = 1 then do
4045 CALL PB_UNMOUNT_Click
4046 options.!editmode = 0
4047 ok = VRMethod("TDL_1","SetTabText", " "strip(NLVGetMessage(13))" ")
4048/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
4049
4050 CALL VRSet "PB_UNMOUNT","Enabled", 1
4051 CALL VRSet "GB_CURRENT", "ENABLED", 1
4052 end
4053
4054 options.!workgroup = ''
4055 options.!server = ''
4056 options.!share = ''
4057 options.!user = ''
4058 options.!password = ''
4059 options.!master = ''
4060 options.!mastertype = ''
4061 options.!memlen = advanced.!memlen
4062 options.!easupport = advanced.!easupport
4063 options.!readonly = advanced.!readonly
4064 options.!loglevel = advanced.!loglevel
4065 options.!logfile = advanced.!logfile
4066 options.!cachetimeout = advanced.!cachetimeout
4067 options.!cachelistings = advanced.!cachelistings
4068
4069 vfs.!drive = ''
4070 vfs.!mountpoint = ''
4071
4072 stype = VRGet( "CB_MOUNT", "Selected" )
4073 share = STRIP( VRGet( "EF_SHARE", "Value" ))
4074 server = STRIP( VRGet( "EF_SERVER", "Value" ))
4075 network = STRIP( VRGet( "EF_NETWORK", "Value" ))
4076 mtype = VRGet( "CHK_MTYPE", "Set" )
4077 userid = STRIP( VRGet( "EF_USER", "Value" ))
4078 password = STRIP( VRGet( "EF_PASSWORD", "Value" ))
4079 mdrive = VRGet( "CB_DRIVES", "SelectedText" )
4080 if mdrive = "" then mdrive = VRGet( "CB_DRIVES", "Value" )
4081 mpath = STRIP( VRGet( "EF_DIRECTORY", "Value" ))
4082
4083 IF ( stype < 1 | stype > 4 ) THEN stype = 1
4084
4085 /* The required/optional/ignored parameters depend on the type of mount
4086 * requested. (Note, however, that the user, password, easupport and
4087 * memlen parameters are always optional.)
4088 */
4089 SELECT
4090 /* Scenario 1: Mount a single share.
4091 * Required: share, server
4092 * Optional: workgroup
4093 * Unused: master, mastertype
4094 */
4095 WHEN stype = 1 THEN DO
4096 IF server == '' | share == '' THEN DO
4097 /* error */
4098 RETURN 1
4099 END
4100 options.!server = server
4101 options.!share = share
4102 options.!workgroup = network
4103 END
4104
4105 /* Scenario 2: Mount all shares on a server.
4106 * Required: server
4107 * Optional: workgroup
4108 * Unused: share, master, mastertype
4109 */
4110 WHEN stype = 2 THEN DO
4111 IF server == '' THEN DO
4112 /* error */
4113 RETURN 1
4114 END
4115 options.!server = server
4116 options.!workgroup = network
4117 END
4118
4119 /* Scenario 3: Mount all servers in a workgroup.
4120 * Required: workgroup
4121 * Optional: -
4122 * Unused: share, server, master, mastertype
4123 */
4124 WHEN stype = 3 THEN DO
4125 IF workgroup == '' THEN DO
4126 /* error */
4127 RETURN 1
4128 END
4129 options.!workgroup = network
4130 END
4131
4132 /* Scenario 4: Mount all workgroups known to a master.
4133 * Required: master, mastertype
4134 * Optional: -
4135 * Unused: share, server, workgroup
4136 */
4137 WHEN stype = 4 THEN DO
4138 IF master == '' | mastertype == '' THEN DO
4139 /* error */
4140 RETURN 1
4141 END
4142 options.!master = network
4143 options.!mastertype = mtype
4144 END
4145 END
4146
4147 options.!user = userid
4148 options.!password = password
4149
4150 vfs.!drive = mdrive
4151 vfs.!mountpoint = mdrive'\'mpath
4152
4153 CALL Mount
4154 CALL Refresh
4155 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 1)
4156 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click done"
4157RETURN 0
4158
4159/*:VRX PB_NEWMOUNTPOINTCANCEL_Click
4160*/
4161PB_NEWMOUNTPOINTCANCEL_Click:
4162 ok = VRSet("CB_DRIVES","Value","")
4163 ok = VRSet("EF_DIRECTORY","Value","")
4164 call SW_MOUNTPOINT_Close
4165RETURN 0
4166
4167/*:VRX PB_NEWMOUNTPOINTOK_Click
4168*/
4169PB_NEWMOUNTPOINTOK_Click:
4170 ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4171 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4172
4173 advanced.!readonly = VRGet("CB_READONLY1","Set")
4174 advanced.!easupport = VRGet("CB_EAS1","Set")
4175 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4176 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4177 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4178
4179 call SW_MOUNTPOINT_Close
4180RETURN
4181
4182/*:VRX PB_NEWPORTCANCEL_Click
4183*/
4184PB_NEWPORTCANCEL_Click:
4185/* ok = VRSet("CB_DRIVES","Value","")
4186 ok = VRSet("EF_DIRECTORY","Value","")
4187 call SW_MOUNTPOINT_Close */
4188RETURN 0
4189
4190/*:VRX PB_NEWPORTCONNECT_Click
4191*/
4192PB_NEWPORTCONNECT_Click:
4193/* ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4194 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4195
4196 advanced.!readonly = VRGet("CB_READONLY1","Set")
4197 advanced.!easupport = VRGet("CB_EAS1","Set")
4198 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4199 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4200 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4201
4202 call SW_MOUNTPOINT_Close */
4203RETURN
4204
4205/*:VRX PB_PROGRESS_ABORT_Click
4206*/
4207PB_PROGRESS_ABORT_Click:
4208 options.!delay = 0
4209 options.!autoload = 0
4210 options.!autoclose = 0
4211 call SW_PROGRESS_Close
4212return
4213
4214/*:VRX PB_SETTINGS_APPLY_Click
4215*/
4216PB_SETTINGS_APPLY_Click:
4217 advanced.!loglevel = VRGet("SPIN_LOGLEVEL", "Value" )
4218 advanced.!logfile = VRGet("EF_LOGFILE", "Value" )
4219 advanced.!browseauth = VRGet("CB_BROWSEAUTH", "Set" )
4220 advanced.!browseimme = VRGet("CB_BROWSEIMME", "Set" )
4221 advanced.!special = VRGet("CB_SPECIAL", "Set" )
4222 advanced.!savepassive = VRGet("CB_SAVEPASSIVE","Set" )
4223 advanced.!lmhosts = VRGet("CB_LMHOSTS", "Set" )
4224 advanced.!broadcast = VRGet("CB_BROADCAST", "Set" )
4225 advanced.!miniicons = VRGet("CB_MINIICONS", "Set" )
4226
4227 /* Note: CB_LOGGING has its own event tied to the click */
4228 options.!storecreds = VRGet("CB_STORECREDS", "Set" )
4229 options.!debug = VRGet("CB_DEBUG", "Set" )
4230
4231 if options.!debug == 1 then do /* Turn on additional columns in connection details view */
4232 ok = VRRedirectStdio("ON")
4233 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 1)
4234 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 1)
4235 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 1)
4236 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 1)
4237 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 1)
4238 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 1)
4239 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 1)
4240 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 1)
4241 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 1)
4242 end
4243 else do /* Turn on additional columns in connection details view */
4244 ok = VRRedirectStdio("OFF")
4245 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 0)
4246 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 0)
4247 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 0)
4248 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 0)
4249 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 0)
4250 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 0)
4251 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 0)
4252 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 0)
4253 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 0)
4254 end
4255
4256 ok = VRset("CN_CURRENT", "MiniIcons", advanced.!miniicons)
4257 ok = VRset("CN_SMBTREE", "MiniIcons", advanced.!miniicons)
4258 ok = VRset("CN_CONDET", "MiniIcons", advanced.!miniicons)
4259
4260 if advanced.!lmhosts = 1 then do
4261 call _LMHostsRead
4262 call _LMHostsUpdate
4263 end
4264 if advanced.!smbconfchanged = 1 then do
4265 name_resolve_order = VRGet("SPIN_NRO1","value")' 'VRGet("SPIN_NRO2","value")' 'VRGet("SPIN_NRO3","value")' 'VRGet("SPIN_NRO4","value")
4266 handle = IniOpen('global', samba.!smbconf)
4267 call IniSet 'name resolve order', name_resolve_order, handle
4268 /* FIXME: Throw an error in this case */
4269 if \_IsValidIPAddress(VRGet("EF_WINS_SERVER","Value")) then ok = VRSet("EF_WINS_SERVER","Value","")
4270 call IniSet 'wins server', VRGet("EF_WINS_SERVER","Value"), handle
4271 call IniSave handle
4272 call IniClose handle
4273 advanced.!smbconfchanged = 0
4274 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 0)
4275 end
4276 if options.!storecreds = 0 then call Menu_File_ucCred_Reset_Click
4277return
4278
4279/*:VRX PB_SETTINGS_HELP_Click
4280*/
4281PB_SETTINGS_HELP_Click:
4282 CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
4283return
4284
4285/*:VRX PB_SETTINGS_UNDO_Click
4286*/
4287PB_SETTINGS_UNDO_Click:
4288 call SW_SETTINGS_Init_Content
4289return
4290
4291/*:VRX PB_SMBTREE_CONNECT_Click
4292*/
4293PB_SMBTREE_CONNECT_Click: PROCEDURE EXPOSE settings. options. icons. fs. advanced. cd. samba. mtype.
4294 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click started"
4295
4296 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
4297
4298 if SelRH.0 = 0 then do
4299 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click aborted"
4300 return
4301 end
4302
4303 p_workgroup = ''
4304 p_server = ''
4305 p_share = ''
4306
4307 srcFile = ""
4308 srcCtn = VRGet("CN_SMBTREE","Self")
4309 srcRec = SelRH.1
4310 trgCtn = VRGet("CN_CURRENT","Self")
4311 trgRec = ""
4312
4313 if options.!debug == 1 then do
4314 say ' srcCtn = "'srcCtn'"'
4315 if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
4316 say ' srcRec = "'srcRec'"'
4317 say ' trgCtn = "'trgCtn'"'
4318 if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
4319 say ' trgRec = "'trgRec'"'
4320 end
4321
4322 ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
4323
4324 DragCapt = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Caption")
4325 ParentRH = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Parent")
4326
4327 if ParentRH = "" then do /* A workgroup was dragged */
4328 say "Workgroup dragged!"
4329 parse var DragCapt p_workgroup '0D0A'x .
4330 p_workgroup = strip(p_workgroup)
4331 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4332 call _UpdateObject "EF_SERVER", ""
4333 ok = VRSet("EF_SHARE","Value","")
4334
4335 ShareLevel = 3
4336 end
4337 else do
4338 ParDragCapt = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Caption")
4339 GParentRH = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Parent")
4340
4341 if GParentRH = "" then do /* A server was dragged */
4342 say "Server dragged!"
4343 parse var ParDragCapt p_workgroup '0D0A'x .
4344 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4345 p_workgroup = strip(p_workgroup)
4346
4347 parse var DragCapt p_server '0D0A'x .
4348 p_server = strip(p_server)
4349 call _UpdateObject "EF_SERVER", p_server
4350 ok = VRSet("EF_Share","Value","")
4351
4352 ShareLevel = 2
4353 end
4354 else do /* A share was dragged */
4355 say "Share dragged!"
4356 GParDragCapt = VRMethod(srcCtn, "GetRecordAttr", GParentRH, "Caption")
4357
4358 parse var GParDragCapt p_workgroup '0D0A'x .
4359 p_workgroup = strip(p_workgroup)
4360 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4361
4362 parse var ParDragCapt p_server '0D0A'x .
4363 p_server = strip(p_server)
4364 call _UpdateObject "EF_SERVER", p_server
4365
4366 parse var DragCapt p_share '0D0A'x .
4367 p_share = strip(p_share)
4368 ok = VRSet("EF_Share","Value",strip(p_share))
4369
4370 ShareLevel = 1
4371 end
4372 end
4373
4374 say 'p_workgroup = "'p_workgroup'"'
4375 say 'p_server = "'p_server'"'
4376 say 'p_share = "'p_share'"'
4377
4378 ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
4379 call CB_MOUNT_Change
4380
4381 if trgRec = "" then do
4382 window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
4383 if VRGet("CB_DRIVES","Value") = "" then return
4384 end
4385 else do
4386
4387 TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
4388
4389 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
4390
4391 do while parTrgRH <> ""
4392 partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
4393 TargetString = partrgCapt||'\'||TargetString
4394 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
4395 end
4396 say 'TargetString = "'TargetString'"'
4397 ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
4398 ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
4399 end
4400
4401 window = VRLoadSecondary( "SW_LOGIN", "W" )
4402 if credentials.!entered = 1 then call PB_MOUNT_CLICK
4403
4404 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click done"
4405RETURN
4406
4407/*:VRX PB_SMBTREE_HELP_Click
4408*/
4409PB_SMBTREE_HELP_Click:
4410 CALL VRMethod 'GB_SMBTREE', 'InvokeHelp'
4411return
4412
4413/*:VRX PB_SMBTREE_REFRESH_Click
4414*/
4415PB_SMBTREE_REFRESH_Click: /* PROCEDURE EXPOSE settings. options. icons. fs. samba. debuglevel advanced. UserCred Refreshmode Tempdir */
4416 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click started"
4417
4418 if advanced.!browseauth = 1 & (UserCred = "--user=%" | UserCred = "" ) then do
4419 window = VRLoadSecondary( "SW_LOGIN", "W" )
4420 end
4421
4422 call _UserCredUpdate
4423 ok = VRset("Pict_Throbber", "Visible", 1)
4424 ok = VRset("Menu_Selected_Connect", "Visible", 0)
4425 ok = VRset("TM_Throbber", "Enabled", 1)
4426 ShowHidden = advanced.!special
4427 BroadCast = advanced.!broadcast
4428 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
4429 ok = time('R')
4430 call _RefreshTree
4431 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click done"
4432RETURN
4433
4434/*:VRX PB_UNMOUNT_Click
4435*/
4436PB_UNMOUNT_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
4437 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click started"
4438 if options.!debug == 1 then say time()' '||'options.!editmode = 'options.!editmode
4439 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
4440 IF select.0 < 1 THEN RETURN
4441
4442 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
4443 PARSE VAR userdata mountpoint ';' mounts ';' .
4444say 'userdata="'userdata'"'
4445 IF mounts > 0 & options.!editmode = 0 THEN DO
4446 btns.0 = 2
4447 btns.1 = NLVGetMessage( 6 )
4448 btns.2 = NLVGetMessage( 7 )
4449 confirm = VRMessage('Main', NLVGetMessage( 57, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
4450 IF confirm \= 1 THEN RETURN
4451 END
4452
4453 /* Unmount any resources */
4454 DO i = 1 TO mounts
4455 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
4456 END
4457
4458 /* Delete mountpoint */
4459 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', select.1, 'Parent')
4460 IF parent \= '' THEN DO
4461 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"mountpoint"')"
4462 END
4463
4464 CALL Refresh
4465 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click done"
4466RETURN 0
4467
4468/*:VRX Pict_PWINMEM_Click
4469*/
4470Pict_PWINMEM_Click:
4471 if VRGet("Pict_PWINMEM","PicturePath") = "#36" then do
4472 call Menu_File_ucCred_Reset_Click
4473 end
4474return
4475
4476/*:VRX Quit
4477*/
4478Quit:
4479 if Fatal <> 1 then CALL _INISave
4480 /* ok = VRREdirectSTdio("OFF") */
4481 window = VRWindow()
4482 call VRSet window, "Shutdown", 1
4483 drop window
4484RETURN
4485
4486/*:VRX Refresh
4487*/
4488Refresh:
4489 if options.!debug == 1 then say time()' Refresh started'
4490 CALL VRSet "CN_CURRENT", 'Painting', 0
4491
4492 CALL VRMethod "CN_CURRENT", 'RemoveRecord', 'All'
4493
4494 /* Remove Active connections from details view */
4495 ok = VRMethod( "CN_CONDET", "GetRecordList", 'All', "rh." )
4496
4497 do I = 1 to rh.0
4498 /* This catches the bug we observed exactly once and were unable to reproduce! */
4499 if cd.statusfh = 'CD.STATUSFH' then do
4500 if options.!debug == 1 then call beep 880, 50
4501 if options.!debug == 1 then call beep 880, 50
4502 if options.!debug == 1 then say " cd.statusfh is undefined - check why!!!!!!"
4503 leave
4504 end
4505 if options.!debug == 1 then say ' Icon.'i' = "'||VRMethod( "CN_CONDET", "GetFieldData", rh.i, cd.statusfh)'"'
4506 if VRMethod("CN_CONDET","GetFieldData", rh.i, cd.statusfh) = icons.!active then CALL VRMethod "CN_CONDET", 'RemoveRecord', rh.i
4507 end
4508
4509/* call _AddTemplates */
4510 CALL VRSet "PB_DETACH", "Enabled", 0
4511 CALL VRSet "PB_UNMOUNT", "Enabled", 0
4512
4513 ok = VRSet("MENU_CONTEXT_OPEN", "Visible", 0)
4514/* ok = VRSet("MENU_CONTEXT_SEP1", "Visible", 0) */
4515 ok = VRSet("MENU_CONTEXT_DETACH", "Visible", 0)
4516 ok = VRSet("MENU_CONTEXT_UNMOUNT", "Visible", 0)
4517 ok = VRSet("MENU_CONTEXT_EDIT", "Visible", 0)
4518
4519 ok = VRSet("MENU_SELECTED_REMOVE", "Visible", 0)
4520 ok = VRSet("MENU_SELECTED_RETRY", "Visible", 0)
4521
4522 if options.!debug == 1 then say ' Remove records, disable buttons done.'
4523
4524 CALL VRMethod 'CB_DRIVES', 'Clear'
4525
4526 CALL VRSet "CN_CURRENT", "Caption", fs.!Name' 'fs.!version
4527
4528 /* Herwig B.: Attention! The SysDrivemap function with the "free" parameter causes hangs in case it is called repeatedly! */
4529 drvs = MyFreeDriveMap('C:', 'FREE')
4530
4531 DO i = 1 TO WORDS( drvs )
4532 drvstem.i = WORD( drvs, i )
4533 END
4534
4535 drvstem.0 = WORDS( drvs )
4536
4537 /* Add any existing EVFS drives */
4538 CALL GetMountPoints
4539
4540 CALL VRMethod "CB_DRIVES", "AddStringList", "drvstem."
4541 CALL VRSet "CN_CURRENT", 'Painting', 1
4542 if options.!debug == 1 then say time()' '||"Refresh done"
4543RETURN 0
4544
4545/*:VRX SPIN_NRO1_Change
4546*/
4547SPIN_NRO1_Change:
4548 advanced.!smbconfchanged = 1
4549return
4550
4551/*:VRX SPIN_NRO2_Change
4552*/
4553SPIN_NRO2_Change:
4554 advanced.!smbconfchanged = 1
4555return
4556
4557/*:VRX SPIN_NRO3_Change
4558*/
4559SPIN_NRO3_Change:
4560 advanced.!smbconfchanged = 1
4561return
4562
4563/*:VRX SPIN_NRO4_Change
4564*/
4565SPIN_NRO4_Change:
4566 advanced.!smbconfchanged = 1
4567return
4568
4569/*:VRX SPLIT_Main_Move
4570*/
4571SPLIT_Main_Move:
4572 ok = VRset("Main", "Painting", 0)
4573 NewPos = VRInfo("Left")
4574 OldPos = VRGet("SPLIT_Main","Left")
4575 ok = VRSet("SPLIT_Main","Left", NewPos)
4576 ok = VRset("GB_SMBTREE","Left", NewPos+60)
4577 call Main_Resize
4578 ok = VRset("Main", "Painting", 1)
4579return
4580
4581/*:VRX SW_ABOUT_Close
4582*/
4583SW_ABOUT_Close:
4584 call SW_ABOUT_Fini
4585return
4586
4587/*:VRX SW_ABOUT_Create
4588*/
4589SW_ABOUT_Create:
4590 call SW_ABOUT_Init
4591
4592 CALL NLVSetText 'SW_ABOUT', "Caption", 1
4593 CALL NLVSetText 'PB_ABOUT_CLOSE', "Caption", 29
4594 CALL NLVSetText 'PB_ABOUT_COPY', "Caption", 121
4595 CALL NLVSetText 'CB_TRAC', "Caption", 134
4596
4597 ok = VRSet("DT_About","Caption", Program' (c) 2007-2013 Alexander Taylor'||'0D0A'x||'and Herwig Bauernfeind for bww bitwise works GmbH.')
4598
4599 About.DscFH = VRMethod( "CN_ABOUT", "AddField", "String", "Component" )
4600 About.ValFH = VRMethod( "CN_ABOUT", "AddField", "String", "Version" )
4601
4602 call _AboutSambaClientGetInfo
4603
4604return
4605/*:VRX SW_ABOUT_Fini
4606*/
4607SW_ABOUT_Fini:
4608 window = VRInfo( "Window" )
4609 call VRDestroy window
4610 drop window
4611return
4612/*:VRX SW_ABOUT_Init
4613*/
4614SW_ABOUT_Init:
4615 window = VRInfo( "Object" )
4616 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
4617 call VRMethod window, "CenterWindow"
4618 call VRSet window, "Visible", 1
4619 call VRMethod window, "Activate"
4620 end
4621 drop window
4622return
4623
4624/*:VRX SW_ADVANCED_Close
4625*/
4626SW_ADVANCED_Close:
4627 call SW_ADVANCED_Fini
4628return
4629
4630/*:VRX SW_ADVANCED_Create
4631*/
4632SW_ADVANCED_Create:
4633 call SW_ADVANCED_Init
4634return
4635
4636/*:VRX SW_ADVANCED_Fini
4637*/
4638SW_ADVANCED_Fini:
4639 window = VRInfo( "Window" )
4640 call VRDestroy window
4641 drop window
4642return
4643/*:VRX SW_ADVANCED_Init
4644*/
4645SW_ADVANCED_Init:
4646 /* Title bar */
4647 CALL NLVSetText "SW_ADVANCED", "Caption", 40
4648
4649 /* Options */
4650 CALL NLVSetText "GB_ADVANCED", "Caption", 43
4651 CALL NLVSetText "CB_EAS", "Caption", 44
4652 CALL NLVSetText "CB_READONLY", "Caption", 45
4653 CALL NLVSetText "CB_ALWAYSMP", "Caption", 65
4654 CALL NLVSetText "DT_CACHETIMEOUT", "Caption", 130
4655 CALL NLVSetText "DT_CACHELISTINGS", "Caption", 131
4656
4657 /* Buttons */
4658 CALL NLVSetText "PB_ADVANCED_APPLY", "Caption", 122
4659 CALL NLVSetText "PB_ADVANCED_UNDO", "Caption", 123
4660 CALL NLVSetText "PB_ADVANCED_HELP", "Caption", 4
4661
4662 CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40)
4663
4664/* call VRMethod "SW_ADVANCED", "CenterWindow" */
4665 ok = VRSet("SW_ADVANCED", "Visible", 1)
4666/* call VRMethod "SW_ADVANCED", "Activate" */
4667return
4668
4669/*:VRX SW_ADVANCED_Init_Content
4670*/
4671SW_ADVANCED_Init_Content:
4672 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS", "Set", advanced.!easupport)
4673 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY","Set", advanced.!readonly)
4674 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP","Set", advanced.!alwaysmp)
4675 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT", "Value", advanced.!cachetimeout)
4676 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS", "Value", advanced.!cachelistings)
4677
4678 /* Obsolete */
4679 IF advanced.!memlen \= "" THEN ok = VRSet("SPB_MEMLEN", "Value", advanced.!memlen)
4680return
4681
4682/*:VRX SW_CONDET_Close
4683*/
4684SW_CONDET_Close:
4685 call SW_CONDET_Fini
4686return
4687
4688/*:VRX SW_CONDET_Create
4689*/
4690SW_CONDET_Create:
4691 call SW_CONDET_Init
4692return
4693
4694/*:VRX SW_CONDET_Fini
4695*/
4696SW_CONDET_Fini:
4697 window = VRInfo( "Window" )
4698 call VRDestroy window
4699 drop window
4700return
4701/*:VRX SW_CONDET_Init
4702*/
4703SW_CONDET_Init:
4704
4705return
4706
4707/*:VRX SW_CONDET_Init_Content
4708*/
4709SW_CONDET_Init_Content:
4710 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
4711
4712 /* Hide any "foreign" menu entries */
4713 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
4714return
4715
4716/*:VRX SW_DIALOG_Close
4717*/
4718SW_DIALOG_Close:
4719 call SW_DIALOG_Fini
4720return
4721
4722/*:VRX SW_DIALOG_Create
4723*/
4724SW_DIALOG_Create:
4725 call SW_DIALOG_Init
4726return
4727
4728/*:VRX SW_DIALOG_Fini
4729*/
4730SW_DIALOG_Fini:
4731 window = VRInfo( "Window" )
4732 call VRDestroy window
4733 drop window
4734return
4735/*:VRX SW_DIALOG_Init
4736*/
4737SW_DIALOG_Init:
4738 LEDSize = VRMethod( "Screen", "PixelsToTwips", 16 )
4739
4740 ok = VRSet("Pict_PWINMEM","Top", VRGet("EF_USER","Top")+(VRGet("EF_USER","Height")-LEDSize)%2)
4741 ok = VRSet("Pict_PWINMEM","Width", LEDSize)
4742 ok = VRSet("Pict_PWINMEM","Height", LEDSize)
4743return
4744
4745/*:VRX SW_DIALOG_Init_Content
4746*/
4747SW_DIALOG_Init_Content:
4748 /* obsolete */
4749 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
4750
4751 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
4752 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
4753 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
4754
4755 call _DialogPopulate
4756return
4757
4758/*:VRX SW_INFO_Close
4759*/
4760SW_INFO_Close:
4761 call SW_INFO_Fini
4762return
4763
4764/*:VRX SW_INFO_Create
4765*/
4766SW_INFO_Create:
4767 if options.!debug == 1 then say time()' SW_INFO_Create started'
4768 call SW_INFO_Init
4769 CALL NLVSetText 'SW_INFO', "Caption", 92
4770 CALL NLVSetText 'PB_INFO_OK', "Caption", 2
4771 Info.TypeFH = VRMethod( "CN_INFO", "AddField", "String", "Type" )
4772 Info.ValueFH = VRMethod( "CN_INFO", "AddField", "String", "Value" )
4773
4774 if options.!debug == 1 then do
4775 say ' Handle: "'SMBObj.rh'"'
4776 say ' Resource: "'SMBObj.resname'"'
4777 say ' Comment: "'SMBObj.comment'"'
4778 say ' Type: "'SMBObj.udatatype'"'
4779 say ' Message: "'SMBObj.udatamsg'"'
4780 say ' Icon: "'SMBObj.icon'"'
4781 end
4782say "Vorher:"rpc.srvinfo.OS_VERSION
4783 drop rpc.
4784say "Vorher:"rpc.srvinfo.OS_VERSION
4785 rpc_success = _rpcsrvinfo(SMBObj.resname,credentials.!username,credentials.!password)
4786
4787 Info.!nbname = VRMethod( "CN_INFO", "AddRecord")
4788 Info.!comment = VRMethod( "CN_INFO", "AddRecord")
4789 Info.!domain = VRMethod( "CN_INFO", "AddRecord")
4790 Info.!DMBLMB = VRMethod( "CN_INFO", "AddRecord")
4791 if rpc_success = 1 then Info.!capabilities = VRMethod( "CN_INFO", "AddRecord")
4792 Info.!os = VRMethod( "CN_INFO", "AddRecord")
4793 Info.!server = VRMethod( "CN_INFO", "AddRecord")
4794 if rpc_success = 1 then Info.!version = VRMethod( "CN_INFO", "AddRecord")
4795 Info.!status = VRMethod( "CN_INFO", "AddRecord")
4796 Info.!IP = VRMethod( "CN_INFO", "AddRecord")
4797 Info.!MAC = VRMethod( "CN_INFO", "AddRecord")
4798
4799 if rpc_success = 1 then do
4800 if rpc.srvinfo.OS_VERSION = 'RPC.SRVINFO.OS_VERSION' then rpc.srvinfo.OS_VERSION = ''
4801 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, rpc.srvinfo.NETBIOSNAME)
4802 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, rpc.srvinfo.SERVERSTRING)
4803 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!capabilities, Info.TypeFH, strip(NLVGetMessage(138),'T',':'),Info.ValueFH, rpc.srvinfo.CAPABILITIES)
4804 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!version,Info.TypeFH, strip(NLVGetMessage(139),'T',':'),Info.ValueFH, rpc.srvinfo.OS_VERSION)
4805 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'),Info.ValueFH, rpc.srvinfo.LOGONSTATUS )
4806 /* we did not get these, but we know them anyway */
4807 if rpc.srvinfo.NETBIOSNAME = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
4808 if rpc.srvinfo.SERVERSTRING = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
4809 end
4810 else do
4811 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
4812 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
4813 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'), Info.ValueFH, SMBObj.udatamsg)
4814 end
4815
4816 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, WorkGroupFH ))
4817 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os, Info.TypeFH, strip(NLVGetMessage(93), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, OSFH ))
4818 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, VersionFH ))
4819 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!DMBLMB, Info.TypeFH, strip(NLVGetMessage(124),'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MBFH ))
4820 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!IP, Info.TypeFH, "IP" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, IPFH ))
4821 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!MAC, Info.TypeFH, "MAC" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MacFH ))
4822
4823 if options.!debug == 1 then say time()' SW_INFO_Create done'
4824return
4825
4826/*:VRX SW_INFO_Fini
4827*/
4828SW_INFO_Fini:
4829 window = VRInfo( "Window" )
4830 call VRDestroy window
4831 drop window
4832return
4833/*:VRX SW_INFO_Init
4834*/
4835SW_INFO_Init:
4836 window = VRInfo( "Object" )
4837 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
4838 call VRMethod window, "CenterWindow"
4839 call VRSet window, "Visible", 1
4840 call VRMethod window, "Activate"
4841 end
4842 drop window
4843return
4844
4845/*:VRX SW_LOGIN_Close
4846*/
4847SW_LOGIN_Close:
4848 call SW_LOGIN_Fini
4849return
4850
4851/*:VRX SW_LOGIN_Create
4852*/
4853SW_LOGIN_Create:
4854 call SW_LOGIN_Init
4855 ok = VRSet("SW_LOGIN","Caption",NLVGetMessage(136)' 'strip(p_workgroup' \\'p_server'\'p_share,'T','\'))
4856 CALL NLVSetText 'DT_USER1', "Caption", 25
4857 CALL NLVSetText 'DT_PASSWORD1', "Caption", 26
4858 CALL NLVSetText 'CB_STORECREDS1', "Caption", 135
4859 CALL NLVSetText 'PB_LOGIN_OK', "Caption", 2
4860 CALL NLVSetText 'PB_LOGIN_CANCEL',"Caption", 3
4861
4862 if VRIsValidObject(SMBObj.rh) then do
4863 select
4864 when pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.rh, MBFH)) > 0 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
4865 when SMBObj.udatatype = "WORKGROUP" then LoginIcon = SMBObj.Icon
4866 when SMBObj.udatatype = "SERVER" then LoginIcon = SMBObj.Icon
4867 when SMBObj.udatatype = "DISK" then do
4868 if pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.parentrh, MBFH)) > 0
4869 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
4870 else LoginIcon = "#35:PMWP.DLL" /* icons.!pdc */
4871 end
4872 otherwise LoginIcon = "#35:PMWP.DLL" /* icons.!machine_awake */
4873 end
4874 say loginicon
4875 ok = VRSet("Pict_Login","PicturePath", LoginIcon)
4876 end
4877 ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
4878 ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value"))
4879 ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
4880return
4881
4882/*:VRX SW_LOGIN_Fini
4883*/
4884SW_LOGIN_Fini:
4885 window = VRInfo( "Window" )
4886 call VRDestroy window
4887 drop window
4888return
4889/*:VRX SW_LOGIN_Init
4890*/
4891SW_LOGIN_Init:
4892 window = VRInfo( "Object" )
4893 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
4894 call VRMethod window, "CenterWindow"
4895 call VRSet window, "Visible", 1
4896 call VRMethod window, "Activate"
4897 end
4898 drop window
4899return
4900
4901/*:VRX SW_LOGIN_KeyPress
4902*/
4903SW_LOGIN_KeyPress:
4904 obj = VRInfo( "Object" )
4905 keystr = VRGet( obj, "KeyString" )
4906/* say keystr */
4907 select
4908 when keystr = "{Enter}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
4909 when keystr = "{Newline}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
4910 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
4911 otherwise nop
4912 end
4913return
4914
4915/*:VRX SW_MOUNTPOINT_Close
4916*/
4917SW_MOUNTPOINT_Close:
4918 call SW_MOUNTPOINT_Fini
4919return
4920
4921/*:VRX SW_MOUNTPOINT_Create
4922*/
4923SW_MOUNTPOINT_Create:
4924 call SW_MOUNTPOINT_Init
4925
4926 ok = VRSet("SW_MOUNTPOINT","Caption",strip(p_workgroup' \\'p_server'\'p_share,'T','\')) /* NLVGetMessage(14)' ' */
4927 CALL NLVSetText 'DT_MPOINT1', "Caption", 27
4928 CALL NLVSetText 'PB_NEWMOUNTPOINTOK', "Caption", 2
4929 CALL NLVSetText 'PB_NEWMOUNTPOINTCANCEL',"Caption", 3
4930 CALL NLVSetText 'CB_EAS1', "Caption", 44
4931 CALL NLVSetText 'CB_READONLY1', "Caption", 45
4932 CALL NLVSetText 'CB_ALWAYSMP1', "Caption", 65
4933 CALL NLVSetText "DT_CACHETIMEOUT1", "Caption", 130
4934 CALL NLVSetText "DT_CACHELISTINGS1", "Caption", 131
4935
4936 ok = VRMethod( "CB_DRIVES", "GetStringList", "freedrives." )
4937 ok = VRMethod( "CB_DRIVES1", "AddStringList", "freedrives." )
4938 ok = VRSet("CB_DRIVES1", "Value", VRGet("CB_Drives","Value"))
4939
4940 if VRGet("EF_Directory","Value") = "" then ok = VRSet("EF_DIRECTORY1", "Value", VRGet("EF_Directory","Value"))
4941
4942 ok = VRMethod("EF_DIRECTORY1","AddString",p_share)
4943
4944 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS1", "Set", advanced.!easupport)
4945 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY1", "Set", advanced.!readonly)
4946 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP1", "Set", advanced.!alwaysmp)
4947 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT1", "Value", advanced.!cachetimeout)
4948 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS1","Value", advanced.!cachelistings)
4949return
4950
4951/*:VRX SW_MOUNTPOINT_Fini
4952*/
4953SW_MOUNTPOINT_Fini:
4954 window = VRInfo( "Window" )
4955 call VRDestroy window
4956 drop window
4957return
4958/*:VRX SW_MOUNTPOINT_Init
4959*/
4960SW_MOUNTPOINT_Init:
4961 window = VRInfo( "Object" )
4962 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
4963 call VRMethod window, "CenterWindow"
4964 call VRSet window, "Visible", 1
4965 call VRMethod window, "Activate"
4966 end
4967 drop window
4968return
4969
4970/*:VRX SW_PORTCONNECT_Close
4971*/
4972SW_PORTCONNECT_Close:
4973 call SW_PORTCONNECT_Fini
4974return
4975
4976/*:VRX SW_PORTCONNECT_Create
4977*/
4978SW_PORTCONNECT_Create:
4979 call SW_PORTCONNECT_Init
4980
4981 ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
4982
4983 if ok = "" then do
4984
4985 end
4986 else do
4987 say "Samba Spooler Port driver installed!"
4988 ok = SysINI("SYSTEM","PM_SPOOLER_PORT","ALL:","ports")
4989 smbport.0 = 0
4990 do I = 1 to ports.0
4991 if left(ports.I,3) = "SMB" then do
4992 X = smbport.0
4993 X = X + 1
4994 smbport.0 = X
4995 smbport.X = ports.I
4996 end
4997 end
4998 do I = 1 to smbport.0
4999 say smbport.I
5000 end
5001 end
5002
5003return
5004
5005/*:VRX SW_PORTCONNECT_Fini
5006*/
5007SW_PORTCONNECT_Fini:
5008 window = VRInfo( "Window" )
5009 call VRDestroy window
5010 drop window
5011return
5012/*:VRX SW_PORTCONNECT_Init
5013*/
5014SW_PORTCONNECT_Init:
5015 window = VRInfo( "Object" )
5016 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5017 call VRMethod window, "CenterWindow"
5018 call VRSet window, "Visible", 1
5019 call VRMethod window, "Activate"
5020 end
5021 drop window
5022return
5023
5024/*:VRX SW_PROGRESS_Close
5025*/
5026SW_PROGRESS_Close:
5027 options.!delay = 0
5028 call Main_Resize
5029 call VRSet 'Main', 'Visible', 1
5030 call SW_PROGRESS_Fini
5031return
5032
5033/*:VRX SW_PROGRESS_Create
5034*/
5035SW_PROGRESS_Create:
5036 call SW_PROGRESS_Init
5037 CALL NLVSetText 'SW_PROGRESS', "Caption", 1
5038 CALL NLVSetText 'DT_PROGRESS', "Caption", 34
5039 CALL NLVSetText 'PB_PROGRESS_ABORT', "Caption", 3
5040
5041 if options.!delay > 0 then ok = VRSet("TM_TheCloser","Delay", options.!delay*1000)
5042
5043 CALL VRSet "TM_Progress_Throbber","Enabled", 1
5044 CALL VRSet "TM_TheCloser","Enabled", 1
5045return
5046
5047/*:VRX SW_PROGRESS_Fini
5048*/
5049SW_PROGRESS_Fini:
5050 call VRDestroy "SW_PROGRESS"
5051return
5052/*:VRX SW_PROGRESS_Init
5053*/
5054SW_PROGRESS_Init:
5055 call VRMethod "SW_PROGRESS", "CenterWindow", "Parent"
5056 call VRSet "SW_PROGRESS", "Visible", 1
5057 call VRMethod "SW_PROGRESS", "Activate"
5058return
5059
5060/*:VRX SW_SETTINGS_Close
5061*/
5062SW_SETTINGS_Close:
5063 call SW_SETTINGS_Fini
5064return
5065
5066/*:VRX SW_SETTINGS_Create
5067*/
5068SW_SETTINGS_Create:
5069 call SW_SETTINGS_Init
5070return
5071
5072/*:VRX SW_SETTINGS_Fini
5073*/
5074SW_SETTINGS_Fini:
5075 window = VRInfo( "Window" )
5076 call VRDestroy window
5077 drop window
5078return
5079/*:VRX SW_SETTINGS_Init
5080*/
5081SW_SETTINGS_Init:
5082 /* Title bar */
5083 call NLVSetText "SW_SETTINGS", "Caption", 47
5084
5085 /* Options */
5086 call NLVSetText "GB_GLOBAL", "Caption", 47
5087 call NLVSetText "CB_DEBUG", "Caption", 42
5088 call NLVSetText "CB_LOGGING", "Caption", 46
5089 call NLVSetText "CB_BROWSEIMME", "Caption", 48
5090 call NLVSetText "CB_BROWSEAUTH", "Caption", 49
5091 call NLVSetText "CB_SPECIAL", "Caption", 66
5092 call NLVSetText "CB_SAVEPASSIVE", "Caption", 73
5093 call NLVSetText "CB_LMHOSTS", "Caption", 133
5094 call NLVSetText "CB_BROADCAST", "Caption", 74
5095 call NLVSetText "CB_MINIICONS", "Caption", 70
5096 call NLVSetText "CB_STORECREDS", "Caption", 135
5097
5098 /* Buttons */
5099 call NLVSetText "PB_SETTINGS_APPLY", "Caption", 122
5100 call NLVSetText "PB_SETTINGS_UNDO", "Caption", 123
5101 call NLVSetText "PB_SETTINGS_HELP", "Caption", 4
5102
5103/* call VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40) */
5104
5105/* call VRMethod "SW_SETTINGS", "CenterWindow" */
5106 ok = VRSet("SW_SETTINGS", "Visible", 1)
5107/* call VRMethod "SW_SETTINGS", "Activate" */
5108return
5109
5110/*:VRX SW_SETTINGS_Init_Content
5111*/
5112SW_SETTINGS_Init_Content:
5113 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 1)
5114
5115 if advanced.!browseauth \= "" then ok = VRSet("CB_BROWSEAUTH", "Set", advanced.!browseauth)
5116 if advanced.!browseimme \= "" then ok = VRSet("CB_BROWSEIMME", "Set", advanced.!browseimme)
5117 if advanced.!broadcast \= "" then ok = VRSet("CB_BROADCAST", "Set", advanced.!broadcast)
5118 if advanced.!special \= "" then ok = VRSet("CB_SPECIAL", "Set", advanced.!special)
5119 if advanced.!savepassive \= "" then ok = VRSet("CB_SAVEPASSIVE","Set", advanced.!savepassive)
5120 if advanced.!lmhosts \= "" then ok = VRSet("CB_LMHOSTS", "Set", advanced.!lmhosts)
5121
5122 call VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()"\ndpsmb.dbg")
5123 if options.!debug \= "" then ok = VRSet("CB_debug", "Set", options.!debug)
5124 if options.!storecreds \= "" then ok = VRSet("CB_STORECREDS", "Set", options.!storecreds)
5125
5126 if advanced.!miniicons \= "" then ok = VRSet("CB_MINIICONS", "Set", advanced.!miniicons)
5127
5128 /* Obsolete */
5129 if advanced.!logfile \= "" then ok = VRSet("EF_LOGFILE", "Value", advanced.!logfile)
5130 if advanced.!loglevel \= "0" then ok = VRSet("SPIN_LOGLEVEL", "Value", advanced.!loglevel)
5131
5132 call _SmbConfCreateShadowCopy
5133
5134 wins_support = translate(IniGet('wins support', 'global', samba.!shadowsmbconf))
5135
5136 if wins_support = "YES" then do /* we are a WINS server ourself */
5137 ok = VRSet("DT_WINS_SERVER","Enabled", 0)
5138 ok = VRSet("EF_WINS_SERVER","BackColor", "PaleGray")
5139 ok = VRSet("EF_WINS_SERVER","Value", "")
5140 ok = VRSet("EF_WINS_SERVER","Enabled", 0)
5141 end
5142 else do
5143 ok = VRSet("EF_WINS_SERVER","Value", IniGet('wins server', 'global', samba.!shadowsmbconf))
5144 end
5145
5146 name_resolve_order = IniGet('name resolve order', 'global', samba.!shadowsmbconf)
5147
5148 do I = 1 to words(name_resolve_order)
5149 ok = VRSet("SPIN_NRO"||I, "value", word(name_resolve_order,I))
5150 end
5151
5152 advanced.!smbconfchanged = 0
5153return
5154
5155/*:VRX SW_SMBTREE_Close
5156*/
5157SW_SMBTREE_Close:
5158 call SW_SMBTREE_Fini
5159return
5160
5161/*:VRX SW_SMBTREE_Create
5162*/
5163SW_SMBTREE_Create:
5164 call SW_SMBTREE_Init
5165return
5166
5167/*:VRX SW_SMBTREE_Fini
5168*/
5169SW_SMBTREE_Fini:
5170 window = VRInfo( "Window" )
5171 call VRDestroy window
5172 drop window
5173return
5174/*:VRX SW_SMBTREE_Init
5175*/
5176SW_SMBTREE_Init:
5177
5178return
5179
5180/*:VRX SW_SMBTREE_Init_Content
5181*/
5182SW_SMBTREE_Init_Content:
5183 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 1)
5184
5185 /* Hide any "foreign" menu entries */
5186 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
5187 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
5188return
5189
5190/*:VRX TDL_1_PageSelected
5191*/
5192TDL_1_PageSelected:
5193 page = VRInfo("Page")
5194
5195 /* call _TabsStrip */
5196 select
5197 when page = 1 then do /* dialog */
5198 call _TabFix 1
5199 end
5200 when page = 2 then do /* advanced */
5201 call SW_ADVANCED_Init_Content
5202 end
5203 when page = 3 then do /* smbtree */
5204 call SW_SMBTREE_Init_Content
5205 end
5206 when page = 4 then do /* condet */
5207 call SW_CONDET_Init_Content
5208 end
5209 when page = 5 then do /* Settings */
5210 call SW_SETTINGS_Init_Content
5211 end
5212 otherwise nop
5213 end
5214return
5215/*:VRX TM_AutoClose_Trigger
5216*/
5217TM_AutoClose_Trigger:
5218 call Quit
5219return
5220
5221/*:VRX TM_Progress_Throbber_Trigger
5222*/
5223TM_Progress_Throbber_Trigger:
5224 pIdx = VRGet("Pict_Progress_Throbber","PicturePath")
5225 parse var pIdx '#' pidx
5226 pidx = pidx + 1
5227 if pidx = 36 then pidx = 11
5228 ok = VRSet("Pict_Progress_Throbber","PicturePath","#"pidx)
5229return
5230
5231/*:VRX TM_RefreshCurrentDisplay_Trigger
5232*/
5233TM_RefreshCurrentDisplay_Trigger:
5234 if RefreshMode <> "" then return
5235 if _DaemonRunning() = 0 then do
5236 say " Daemon not running - disable GUI"
5237 ok = VRset("GB_CURRENT", "Enabled", 0)
5238 ok = VRset("TDL_1", "Enabled", 0)
5239 ok = VRSet("Menu_File_Daemon_Start","Enabled", 1)
5240 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 0)
5241 end
5242 else do
5243 say " Daemon running - enable GUI"
5244 ok = VRset("GB_CURRENT", "Enabled", 1)
5245 ok = VRset("TDL_1", "Enabled", 1)
5246 ok = VRSet("Menu_File_Daemon_Start","Enabled", 0)
5247 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 1)
5248 end
5249 CALL REFRESH
5250return
5251
5252/*:VRX TM_RefreshTreeDisplay_Trigger
5253*/
5254TM_RefreshTreeDisplay_Trigger:
5255 ShowHidden = advanced.!special
5256 BroadCast = advanced.!broadcast
5257 DoLMHosts = advanced.!lmhosts
5258
5259 select
5260 when RefreshMode = "TREE" then do
5261 call _RefreshTreeDisplay
5262
5263 if smbtree.!workgroup <> 'SMBTREE.!WORKGROUP' then do
5264 ok = VRset("Menu_Selected_Connect", "Visible", VRMethod("CN_SMBTREE", "ValidateRecord", smbtree.!workgroup ) )
5265 end
5266 end
5267 when RefreshMode = "SHARE" then do
5268 call _AddSharesDisplay
5269 end
5270 otherwise say "RefreshMode = "RefreshMode
5271 end
5272 call _DialogPopulate
5273return
5274
5275/*:VRX TM_TheCloser_Trigger
5276*/
5277TM_TheCloser_Trigger:
5278 call SW_PROGRESS_Close
5279return
5280
5281/*:VRX TM_Throbber_Trigger
5282*/
5283TM_Throbber_Trigger:
5284 pIdx = VRGet("Pict_Throbber","PicturePath")
5285 parse var pIdx '#' pidx
5286 pidx = pidx + 1
5287 if pidx = 36 then pidx = 11
5288 ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
5289return
5290
Note: See TracBrowser for help on using the repository browser.