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

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

GUITools: SSCC (Ticket #248), SMBMon (TDB Check page), EVFSGUI, shared library updates

File size: 203.3 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 IF options.!debug == 1 then say time()' _LoadotherFuncs() error handler entered.'
1187 Fatal = 1
1188 parse source . . InVXIDE
1189 if left(InVXIDE,length(Tempdir)+5) = TempDir||'__tmp'
1190 then xxx = "VX-REXX IDE: "strip(translate(word(sourceline(SIGL-1),4),' ',"',"))
1191 else xxx = 'A'
1192 call VRMessage 'Main', xxx' REXX function library DLL is missing or unloadable!', "EVFSGUI fatal error", "E"
1193 IF options.!debug == 1 then say time()' _LoadotherFuncs() error handler finished, program will be terminated.'
1194signal Quit
1195
1196/*:VRX _ParseCommandLine
1197*/
1198_ParseCommandLine:
1199 if options.!debug == 1 then say time()' _ParseCommandLine() started'
1200 CmdLine = VRGet("Application","Commandline")
1201 upCmdLine = translate(CmdLine)
1202 if options.!debug == 1 then say ' Commandline = "'CmdLine'"'
1203
1204 ForceNDFS = 0
1205 if wordpos('-NDFS',upCmdLine) > 0 then do
1206 if options.!debug == 1 then say " NDFS switch detected"
1207 CmdLine = delWord(CmdLine,wordpos('-NDFS',upCmdLine),1)
1208 upCmdLine = translate(CmdLine)
1209 ForceNDFS = 1
1210 CALL VRSet "Menu_File_Autostart","Visible", 0
1211 end
1212
1213 if wordpos('-AUTOCLOSE',upCmdLine) > 0 then do
1214 options.!autoclose = 1
1215 if options.!debug == 1 then say " AutoClose switch detected"
1216 CmdLine = delWord(CmdLine,wordpos('-AUTOCLOSE',upCmdLine),1)
1217 upCmdLine = translate(CmdLine)
1218 end
1219 if wordpos('-NOGUI',upCmdLine) > 0 then do
1220 options.!nogui = 1
1221 options.!autoclose = 1
1222 if options.!debug == 1 then say " -NOGUI switch detected"
1223 CmdLine = delWord(CmdLine,wordpos('-NOGUI',upCmdLine),1)
1224 upCmdLine = translate(CmdLine)
1225 end
1226
1227 if wordpos('-TIMESYNC',upCmdLine) > 0 then do
1228 options.!timesync = 1
1229 if options.!debug == 1 then say " -TIMESYNC switch detected"
1230 dwpos = wordpos('-TIMESYNC',upCmdLine)
1231 if dwpos = words(upCmdLine) then do /* TIMESYNC was last parm - assume automatic */
1232 options.!timesrv = ""
1233 CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),1)
1234 end
1235 else do
1236 options.!timesrv = word(upCmdLine,dwpos+1)
1237 if left(options.!timesrv,1) = "-" then do /* other parameter detected */
1238 options.!timesrv = ""
1239 CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),1)
1240 end
1241 else do /* seems we have a timeserver - IP or name - no further check */
1242 CmdLine = delWord(CmdLine,wordpos('-TIMESYNC',upCmdLine),2)
1243 end
1244 end
1245 upCmdLine = translate(CmdLine)
1246 end
1247
1248 if wordpos('-DELAY',upCmdLine) > 0 then do
1249 if options.!debug == 1 then say " DELAY switch detected"
1250 dwpos = wordpos('-DELAY',upCmdLine)
1251 if dwpos = words(upCmdLine) then do /* DELAY was last parm - assume 60 seconds */
1252 options.!delay = 60
1253 CmdLine = delWord(CmdLine,dwpos,1)
1254 end
1255 else do
1256 options.!delay = word(upCmdLine,dwpos+1)
1257 if datatype(options.!delay) <> "NUM" then do /* No number of seconds specified */
1258 options.!delay = 60
1259 CmdLine = delWord(CmdLine,dwpos,1)
1260 end
1261 else do
1262 CmdLine = delWord(CmdLine,dwpos,2)
1263 end
1264 end
1265 upCmdLine = translate(CmdLine)
1266 if options.!debug == 1 then say " DELAY set to "options.!delay" seconds."
1267 end
1268
1269 Profile = strip(CmdLine,,'"')
1270 if Profile <> "" then do
1271 Profile = strip(VRParseFilename(Profile,"DPNE"))
1272 options.!autoload = 1
1273 if options.!debug == 1 then say ' Profile = "'Profile'"'
1274 if \VRFileExists(Profile) then do
1275 CALL VRMessage 'Main', NLVGetMessage( 102, Profile ), NLVGetMessage( 1 ), 'E'
1276 /* Disable all switches in case of an error */
1277 options.!autoload = 0
1278 options.!autoclose = 0
1279 options.!nogui = 0
1280 options.!delay = 0
1281 end
1282 end
1283 if options.!debug == 1 then say time()' _ParseCommandLine done'
1284return
1285
1286/*:VRX _PassiveLoad
1287*/
1288_PassiveLoad:
1289 if options.!debug == 1 then say time()' '||"_PassiveLoad started"
1290
1291 do cnt = 1 to 255
1292 resdata = VRGetIni( "PassiveConnections", cnt, settings.!ini )
1293 if resdata = "" then leave
1294
1295 parse var resdata p_mpoint resource rwFlag
1296 if options.!debug == 1 then do
1297 say ' Connection 'cnt', resdata ="'resdata'"'
1298 end
1299
1300/* vfs.!drive = FILESPEC('DRIVE', node )
1301 vfs.!mountpoint = STRIP( node, 'T', '\') */
1302
1303 /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
1304 if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
1305
1306 p_mpidx = ""
1307
1308 call ParseResParmString
1309
1310 p_rw = rwFlag
1311
1312 /* Create the hash string */
1313 hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
1314
1315 /* A truncated, useless entry - skip it */
1316 if p_server = "" & p_share = ""& p_workgroup = "" then iterate
1317
1318 md5.cnt = rexx_md5(hashstr)
1319 md5.0 = cnt
1320
1321 /* Passive connection already restored - skip the dupe one */
1322 PassiveDupe = 0
1323 do X = 1 to md5.0-1
1324 if md5.cnt = md5.X then PassiveDupe = 1
1325 end
1326 if PassiveDupe = 1 then iterate /* do not add record for a duplicate passive connection */
1327
1328 /* Everything is ok, let's add a new entry */
1329 cd.lastrh = VRMethod("CN_CONDET","AddRecord")
1330
1331 /* Fill columns now */
1332 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpointFH, p_mpoint)
1333 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpidxfh, p_mpidx)
1334 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.workgrpFH , p_workgroup)
1335 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.serverfh, p_server)
1336 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.sharefh, p_share)
1337 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.userfh, p_user)
1338 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password)
1339 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.spasswordfh, p_spassword)
1340 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout)
1341 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.cldFH, p_cachelistings)
1342 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.masterfh, p_master)
1343 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mtypefh, p_mtype)
1344 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.easupportfh, p_easupport)
1345 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.rwfh, p_rw)
1346 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh, md5.cnt)
1347 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive)
1348 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive)
1349
1350/* Obsolete fields:
1351 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.memlenfh, p_memlen)
1352 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.logfilefh, p_logfile)
1353 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.loglevelfh, p_loglevel) */
1354 end
1355 if options.!debug == 1 then say time()' '||"_PassiveLoad done"
1356return
1357/*:VRX _PassiveSave
1358*/
1359_PassiveSave:
1360 if options.!debug == 1 then say time()' '||"_PassiveSave started"
1361 ok = VRDelIni( "PassiveConnections", "ALL", settings.!ini )
1362
1363 ok = SysIni(settings.!ini, 'PassiveConnections', 'DELETE:')
1364
1365 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
1366 cnt = 0
1367 DO i = 1 TO records.0
1368
1369 if VRMethod( "CN_CONDET", "GetFieldData", records.i, CD.StatusFH) = icons.!passive then do
1370 cnt = cnt + 1
1371 resdata = ""
1372 resdata = resdata||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
1373 resdata = resdata||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
1374 resdata = resdata||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
1375 resdata = resdata||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
1376 resdata = resdata||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
1377 resdata = resdata||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
1378 resdata = resdata||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
1379 resdata = resdata||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
1380 resdata = resdata||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
1381 resdata = resdata||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
1382 resdata = resdata||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
1383 resdata = resdata||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
1384 resdata = resdata||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
1385/* resdata = resdata||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
1386 resdata = resdata||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
1387 resdata = resdata||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
1388 resdata = resdata||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
1389 resdata = resdata||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
1390 resdata = resdata||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
1391 resdata = resdata||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
1392 ok = VRSetIni( "PassiveConnections", cnt, resdata, settings.!ini )
1393 END
1394 else iterate
1395 end
1396 if options.!debug == 1 then say time()' '||"_PassiveSave done"
1397return
1398
1399/*:VRX _PrinterInfo
1400*/
1401_PrinterInfo:
1402 if \_SMBpdrInstalled() then do
1403 /* SMB.PDR is not installed */
1404 CALL VRMessage 'Main', NLVGetMessage( 104 ), NLVGetMessage( 5 ), 'E'
1405 end
1406 else do /* SMB.pdr is installed */
1407 /* shared queue name */
1408 p_printer = SMBObj.resname
1409
1410 /* printer server */
1411 capt = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
1412 parse var Capt p_prtsrv '0D0A'x .
1413 p_prtsrv = strip(p_prtsrv)
1414
1415 /* workgroup of the printer server */
1416 Gparrh = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Parent")
1417 capt = VRMethod("CN_SMBTREE", "GetRecordAttr", GParrh, "Caption")
1418 parse var Capt p_workgroup '0D0A'x .
1419
1420 /* This is the string we will find in case this resource is already connected */
1421 DescStr = translate(p_prtsrv'#'p_printer'#'p_workgroup'#')
1422 say '"'DescStr'"'
1423 LDescStr = length(DescStr)
1424
1425 /* Enumerate all SMB ports */
1426 ok = SysIni('SYSTEM','PM_SPOOLER_PORT',"All:",'ports')
1427 if ports.0 = 0 then do
1428 /* No SMB ports installed */
1429 CALL VRMessage 'Main', NLVGetMessage( 105 ), NLVGetMessage( 5 ), 'E'
1430 end
1431 else do
1432 /* At least 1 SMB port was found - lets check whether it is already connected to our resource */
1433 FoundPort = 0
1434 do I = 1 to ports.0
1435 if left(ports.i,3) = 'SMB' then do
1436 say ports.I
1437 say translate(left(SysIni('SYSTEM','PM_'ports.I,'INITIALIZATION'),LDescStr))
1438 say DescStr
1439 if translate(left(SysIni('SYSTEM','PM_'ports.I,'INITIALIZATION'),LDescStr)) = DescStr then do
1440 OurPort = ports.I
1441 FoundPort = 1
1442 leave
1443 end
1444 end
1445 end
1446 say 'OurPort = "'OurPort'"'
1447 if Foundport then do
1448 ok = SysIni('SYSTEM','PM_SPOOLER_PRINTER',"All:",'printer')
1449 FoundPrinter = 0
1450 do I = 1 to printer.0
1451 prtsummary = SysINi('SYSTEM','PM_SPOOLER_PRINTER',printer.i)
1452 parse var prtsummary port ';'PrinterDriver';'PrinterQueue';' .
1453 say printer.I' 'prtsummary
1454 if port = ourPort then do
1455 PrinterName = SysINi('SYSTEM','PM_SPOOLER_PRINTER_DESCR',printer.i)
1456 parse var Printername Printername ';' .
1457 CALL VRMessage 'Main', PrinterName' ('PrinterQueue') prints to port ' Port' connected to \\'p_workgroup'\'p_prtsrv'\'p_printer, NLVGetMessage( 1 ), 'I'
1458 FoundPrinter = 1
1459 leave
1460 end
1461 end
1462 if FoundPrinter = 0 then do
1463 /* Port installed and configured, but not used by any printer */
1464 CALL VRMessage 'Main', NLVGetMessage( 106 ), NLVGetMessage( 5 ), 'E'
1465 end
1466 end
1467 else do
1468 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
1469 end
1470 end
1471 end
1472return
1473
1474/*:VRX _ShowMsg
1475*/
1476_ShowMsg:
1477 /* preliminary implementation - we just do not ignore it anymore -
1478 - ShowMsg from smbmon/smbusers should become a shared library */
1479 ok = VRSet("DT_StatusBar", "Caption", Msg.Text)
1480return
1481
1482/*:VRX _SmbConfCreateShadowCopy
1483*/
1484_SmbConfCreateShadowCopy:
1485 if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy started'
1486 /* we create a complete version of smb.conf in temporary directory for reading purposes */
1487 /* as we can only determine a default value from this complete version of the file */
1488 /* however it is not desirable to always have a complete copy normally */
1489 ok = SysFileDelete(samba.!shadowsmbconf)
1490 say ' 'samba.!testparmexe' -v -s 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
1491 address cmd samba.!testparmexe' -v -s 1>'samba.!shadowsmbconf' 2>'TempDir'testparm.stderr'
1492 if options.!debug == 1 then say time()' _SmbConfCreateShadowCopy done'
1493return
1494
1495/*:VRX _SMBpdrInstalled
1496*/
1497_SMBpdrInstalled: procedure
1498 ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
1499return (ok <> "")
1500
1501/*:VRX _StemsInit
1502*/
1503_StemsInit:
1504 if options.!debug == 1 then say time()' _StemsInit started'
1505 if options.!debug == 1 then say ' initializing options.'
1506 options.!workgroup = ''
1507 options.!server = ''
1508 options.!share = ''
1509 options.!user = ''
1510 options.!password = ''
1511 options.!spassword = ''
1512 options.!master = ''
1513 options.!mastertype = ''
1514 options.!memlen = '2'
1515 options.!cachetimeout = '10'
1516 options.!cachelistings = '32'
1517 options.!easupport = '1'
1518 options.!readonly = ''
1519 options.!loglevel = 0
1520 options.!logfile = ''
1521
1522 options.!autoload = 0
1523 options.!autoclose = 0
1524 options.!nogui = 0
1525 options.!autostart = 0
1526 options.!editmode = 0
1527 options.!delay = 0
1528 options.!storecreds = 0
1529 options.!timesync = 0
1530 options.!timesrv = ''
1531
1532 if options.!debug == 1 then say ' initializing vfs. '
1533 vfs.!drive = ''
1534 vfs.!mountpoint = ''
1535
1536 if options.!debug == 1 then say ' initializing advanced. '
1537 advanced.!browseauth = ''
1538 advanced.!browseimme = ''
1539 advanced.!broadcast = ''
1540 advanced.!special = ''
1541 advanced.!savepassive= ''
1542 advanced.!miniicons = ''
1543
1544 advanced.!easupport = 1
1545 advanced.!readonly = ''
1546 advanced.!alwaysmp = ''
1547 advanced.!cachetimeout = '10'
1548 advanced.!cachelistings = '32'
1549
1550 advanced.!smbconfchanged = 0
1551
1552 /* Obsolete */
1553 advanced.!memlen = ''
1554 advanced.!loglevel = '0'
1555 advanced.!logfile = ''
1556
1557 if options.!debug == 1 then say ' initializing credentials. '
1558 credentials.!username = ""
1559 credentials.!password = ""
1560 credentials.!entered = 0
1561
1562 UserCred = ""
1563 RefreshMode = ""
1564
1565 if options.!debug == 1 then say ' initializing mtype. '
1566 mtype.0 = 4
1567 mtype.1 = NLVGetMessage( 15 )
1568 mtype.2 = NLVGetMessage( 16 )
1569 mtype.3 = NLVGetMessage( 17 )
1570 mtype.4 = NLVGetMessage( 18 )
1571
1572 if options.!debug == 1 then say ' initializing icons. '
1573 icons.!bat = '#1:PMWP.DLL'
1574 icons.!cmd = '#2:PMWP.DLL'
1575 icons.!exe = '#3:PMWP.DLL'
1576 icons.!template = '#10:PMWP.DLL'
1577 icons.!drive = '#16:PMWP.DLL'
1578 icons.!defaultfile = '#24:PMWP.DLL'
1579 icons.!folder = '#26:PMWP.DLL'
1580 icons.!folder_open = '#34:PMWP.DLL'
1581 icons.!machine_awake = '#35:PMWP.DLL'
1582 icons.!machine_sleeping = '#61:PMWP.DLL'
1583 icons.!workgroup = '#62:PMWP.DLL'
1584 icons.!pdc = '#63:PMWP.DLL'
1585 icons.!active = '#64:PMWP.DLL'
1586 icons.!passive = '#68:PMWP.DLL'
1587 icons.!printer = '#65:PMWP.DLL'
1588 icons.!drive_inactive = '#70:PMWP.DLL'
1589 icons.!pdf = '#80'
1590 icons.!spreadsheet = '#82'
1591 icons.!textdocument = '#86'
1592 icons.!framework = '#87'
1593 icons.!image = '#88'
1594 icons.!movie = '#89'
1595 icons.!sound = '#90'
1596 icons.!warpin = '#91'
1597 icons.!zip = '#92'
1598 icons.!view = '#93'
1599 icons.!plaintext = '#94'
1600
1601 p_workgroup = "Unknown"
1602 p_server = "Unknown"
1603 p_share = "Unknown"
1604
1605 if options.!debug == 1 then say time()' _StemsInit done'
1606return
1607/*:VRX _TabbedDialogSetup
1608*/
1609_TabbedDialogSetup:
1610 if options.!debug == 1 then say time()' _TabbedDialogSetup started'
1611
1612 w = VRLoad( "TDL_1", VRWindowPath(), "SW_DIALOG" )
1613 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(13)" ")
1614 ok = VRMethod( "TDL_1", "SetStatusText", 1, NLVGetMessage(132,"1","2"))
1615 w = VRLoad( "TDL_1", VRWindowPath(), "SW_ADVANCED" )
1616 ok = VRMethod( "TDL_1", "InsertPage", w,"- "NLVGetMessage(40)" ")
1617 ok = VRMethod( "TDL_1", "SetStatusText", 2, NLVGetMessage(132,"2","2"))
1618
1619 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SMBTREE" )
1620 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(39)" ")
1621
1622 w = VRLoad( "TDL_1", VRWindowPath(), "SW_CONDET" )
1623 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(63)" ")
1624 w = VRLoad( "TDL_1", VRWindowPath(), "SW_SETTINGS" )
1625 ok = VRMethod( "TDL_1", "InsertPage", w,"+ "NLVGetMessage(47)" ")
1626 if options.!debug == 1 then say time()' _TabbedDialogSetup done'
1627return
1628
1629
1630/*:VRX _TabFix
1631*/
1632_TabFix:
1633 ok = VRMethod( "TDL_1", "SetTabText", arg(1), " "strip(VRMethod( "TDL_1", "GetTabText", arg(1)))" ")
1634return
1635
1636/*:VRX _TabsStrip
1637*/
1638_TabsStrip:
1639 ok = VRMethod( "TDL_1", "SetTabText", 1, strip(VRMethod( "TDL_1", "GetTabText", 1)))
1640 ok = VRMethod( "TDL_1", "SetTabText", 2, strip(VRMethod( "TDL_1", "GetTabText", 2)))
1641 ok = VRMethod( "TDL_1", "SetTabText", 3, strip(VRMethod( "TDL_1", "GetTabText", 3)))
1642 ok = VRMethod( "TDL_1", "SetTabText", 4, strip(VRMethod( "TDL_1", "GetTabText", 4)))
1643 ok = VRMethod( "TDL_1", "SetTabText", 5, strip(VRMethod( "TDL_1", "GetTabText", 5)))
1644return
1645
1646/*:VRX _TimeSync
1647*/
1648_TimeSync:
1649 if options.!debug == 1 then say time()' _TimeSync started, "'options.!timesrv'"'
1650 TimeMsg.1 = NLVGetMessage(141)' 'time()
1651 if options.!timesrv <> '' then do
1652 say ' 'samba.!netexe' time set -S 'options.!timesrv
1653 address cmd samba.!netexe' time set -S 'options.!timesrv
1654 end
1655 else do
1656 say ' 'samba.!netexe' time set'
1657 address cmd samba.!netexe' time set'
1658 end
1659 options.!timesync = ''
1660 TimeMsg.2 = NLVGetMessage(142)' 'time()
1661 TimeMsg.0 = 2
1662
1663 Buttons.1 = NLVGetMessage(2)
1664 Buttons.0 = 1
1665 id = VRMessageStem( VRWindow(), TimeMsg. , NLVGetMessage(129) , "Information", "Buttons.", 1, 1 )
1666 if options.!debug == 1 then say time()' _TimeSync done'
1667return
1668
1669/*:VRX _UpdateObject
1670*/
1671_UpdateObject: procedure
1672 Object = arg(1)
1673 ObjValue = arg(2)
1674 if VRGet(Object,"Value") <> ObjValue then ok = VRset(Object,"Value",ObjValue)
1675return
1676
1677/*:VRX _UserCredUpdate
1678*/
1679_UserCredUpdate:
1680 if options.!debug == 1 then say time()' _UserCredUpdate started'
1681 credentials.!username = VRGet("EF_USER","Value")
1682 credentials.!password = VRGet("EF_PASSWORD","Value")
1683
1684 if pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 1 | pos(left(credentials.!password,1),'01234567890') > 0
1685 then UserCred = '--user='Credentials.!username'%%'Credentials.!password
1686 else UserCred = '--user='Credentials.!username'%'Credentials.!password
1687
1688 if options.!storecreds = 1 & \(UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' | UserCred = '--user=%%' | UserCred = '-N') then do
1689 ok = _ucSetUc()
1690 ok = VRSet("Pict_PWINMEM","PicturePath","#36")
1691 if options.!debug == 1 then call beep 2400, 10
1692 end
1693 else do
1694 if options.!debug == 1 then call beep 200, 20
1695 ok = VRSet("Pict_PWINMEM","PicturePath","#37")
1696 end
1697 if options.!debug == 1 then say time()' _UserCredUpdate done'
1698return
1699
1700/*:VRX CB_DEBUG_Click
1701*/
1702CB_DEBUG_Click:
1703
1704return
1705
1706/*:VRX CB_LOGGING_Click
1707*/
1708CB_LOGGING_Click:
1709 if VRFileExists(SysBootDrive()'\ndpsmb.dbg') then
1710 ok = SysFileDelete(SysBootDrive()'\ndpsmb.dbg')
1711 else do
1712 call lineout SysBootDrive()'\ndpsmb.dbg','EVFS debug flag file'
1713 ok = stream(SysBootDrive()'\ndpsmb.dbg','c','close')
1714 end
1715
1716 CALL VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()'\ndpsmb.dbg')
1717return
1718
1719/*:VRX CB_MOUNT_Change
1720*/
1721CB_MOUNT_Change:
1722 if options.!debug == 1 then say time()' '||"CB_MOUNT_Change started"
1723
1724 mount = VRGet("CB_MOUNT", "Value")
1725
1726 /* Catch empty mount type error */
1727 if mount = "" then do
1728 if mtype.1 <> "" then ok = VRSet("CB_MOUNT", "Value", mtype.1)
1729 if options.!debug == 1 then say time()' '||"CB_MOUNT_Change aborted"
1730 return
1731 end
1732
1733 SELECT
1734 WHEN mount == mtype.1 THEN DO
1735 CALL VRSet "DT_SHARE", "Visible", 1
1736 CALL VRSet "EF_SHARE", "Visible", 1
1737 CALL VRSet "DT_SERVER", "Visible", 1
1738 CALL VRSet "EF_SERVER", "Visible", 1
1739 CALL VRSet "CHK_MTYPE", "Visible", 0
1740 CALL NLVSetText "DT_NETWORK", "Caption", 21
1741 END
1742 WHEN mount == mtype.2 THEN DO
1743 CALL VRSet "DT_SHARE", "Visible", 0
1744 CALL VRSet "EF_SHARE", "Visible", 0
1745 CALL VRSet "DT_SERVER", "Visible", 1
1746 CALL VRSet "EF_SERVER", "Visible", 1
1747 CALL VRSet "CHK_MTYPE", "Visible", 0
1748 CALL NLVSetText "DT_NETWORK", "Caption", 21
1749 END
1750 WHEN mount == mtype.3 THEN DO
1751 CALL VRSet "DT_SHARE", "Visible", 0
1752 CALL VRSet "EF_SHARE", "Visible", 0
1753 CALL VRSet "DT_SERVER", "Visible", 0
1754 CALL VRSet "EF_SERVER", "Visible", 0
1755 CALL VRSet "CHK_MTYPE", "Visible", 0
1756 CALL NLVSetText "DT_NETWORK", "Caption", 21
1757 END
1758 WHEN mount == mtype.4 THEN DO
1759 CALL VRSet "DT_SHARE", "Visible", 0
1760 CALL VRSet "EF_SHARE", "Visible", 0
1761 CALL VRSet "DT_SERVER", "Visible", 0
1762 CALL VRSet "EF_SERVER", "Visible", 0
1763 CALL VRSet "CHK_MTYPE", "Visible", 1
1764 CALL NLVSetText "DT_NETWORK", "Caption", 22
1765 END
1766 OTHERWISE DO
1767 id = VRMessage( "", 'unknown mount type here >>'mount'<< mtype1=>>'mtype.1'<<', "Mount change error", "E", )
1768 END
1769 END
1770 if options.!debug == 1 then say time()' '||"CB_MOUNT_Change done"
1771RETURN
1772
1773/*:VRX CN_CONDET_Click
1774*/
1775CN_CONDET_Click:
1776 /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
1777return
1778
1779/*:VRX CN_CONDET_ContextMenu
1780*/
1781CN_CONDET_ContextMenu:
1782 rh = VRInfo('Record')
1783 if VRMethod( "CN_CONDET", "ValidateRecord", rh) <> 1 then return
1784
1785 /* Hide all context menu entries */
1786 ok = VRSet("Menu_Selected_Remove", "Visible", 0) /* CN_CONDET */
1787 ok = VRSet("Menu_Selected_Retry", "Visible", 0) /* CN_CONDET */
1788 ok = VRSet("Menu_Selected_Connect", "Visible", 0) /* CN_SMBTREE */
1789 ok = VRSet("Menu_Selected_Sep1", "Visible", 0) /* CN_SMBTREE */
1790 ok = VRSet("Menu_Selected_Info", "Visible", 0) /* CN_SMBTREE */
1791 ok = VRSet("Menu_Selected_TimeSync", "Visible", 0) /* CN_SMBTREE */
1792 ok = VRSet("Menu_Selected_Refresh", "Visible", 0) /* CN_SMBTREE */
1793 ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0) /* CN_SMBTREE */
1794
1795 /* This is the place to enable specific context menu entries */
1796 ok = VRMethod( "CN_CONDET", "GetRecordList", "All", "records." )
1797 ok = VRSet("Menu_Selected_Remove", "Visible", (records.0 <> 0))
1798 ok = VRSet("Menu_Selected_Retry", "Visible", (records.0 <> 0))
1799
1800 if VRMethod( "CN_CONDET", "GetFieldData", rh, CD.StatusFH) = icons.!passive then do
1801 ok = VRSet("Menu_Selected_Retry", "Enabled",1)
1802 ok = VRSet("Menu_Selected_Remove", "Enabled",1)
1803 end
1804 ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
1805return
1806/*:VRX CN_CONDET_DragStart
1807*/
1808CN_CONDET_DragStart:
1809
1810 obj = VRInfo( "object" )
1811 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
1812 if selrec.0 = 0 then return
1813
1814 Icon = VRMethod("CN_CONDET", "GetRecordAttr", selrec.1, "Icon")
1815
1816 if Icon = icons.!printer then do /* Printers not supported at the moment */
1817 call beep 4800,100
1818 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
1819 end
1820 else call VRMethod obj, 'StartDrag'
1821return
1822
1823/*:VRX CN_CURRENT_Click
1824*/
1825CN_CURRENT_Click:
1826 if options.!debug == 1 then say time()' CN_CURRENT_Click started'
1827 /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
1828
1829 /* Herwig B. */
1830 CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
1831 ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0)
1832
1833 rh = VRInfo('Record')
1834 if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then return
1835
1836 data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
1837 options.currentdata = data
1838
1839 /* ok = VRset("DT_StatusBar","Caption", data' - 'VRGet("Main", "HintText")) */
1840
1841 PARSE VAR data p_node ';' p_mounts ';' p_string
1842
1843 if options.!debug == 1 then do
1844 say ' data = "'data'"'
1845 say ' p_node = "'p_node'"'
1846 say ' p_mounts = "'p_mounts'"'
1847 say ' p_string = "'p_string'"'
1848 end
1849
1850 if p_string = ""
1851 then infotext = fs.!name' 'fs.!version
1852 else infotext = p_string
1853
1854 if infotext = "" then infotext = " "
1855 CALL VRSet "CN_CURRENT", "Caption", infotext
1856 CALL VRSet "CN_CURRENT", 'HintText',infotext
1857
1858 IF p_mounts > 0 THEN DO
1859 CALL VRSet 'PB_UNMOUNT', 'Enabled', 1
1860 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 1
1861
1862 if pos("*",p_string) > 0 | pos(";",p_string) > 0
1863 then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
1864 else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
1865 END
1866 ELSE DO
1867 CALL VRSet 'PB_UNMOUNT', 'Enabled', 0
1868 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 0
1869 CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
1870 END
1871
1872 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'Parent')
1873
1874 IF parent == '' THEN DO
1875 CALL VRSet 'PB_DETACH', 'Enabled', 1
1876 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 1
1877 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
1878/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1 */
1879 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 1
1880/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1 */
1881
1882 END
1883 ELSE DO
1884 CALL VRSet 'PB_DETACH', 'Enabled', 0
1885 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 0
1886 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 0
1887/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 0 */
1888 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 0
1889/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 0 */
1890 END
1891
1892 parse var p_string p_workgroup'\\'p_server'\'p_share
1893
1894 p_workgroup = strip(p_workgroup,'T',':')
1895
1896 if options.!debug == 1 then do
1897 say ' p_workgroup = "'p_workgroup'"'
1898 say ' p_server = "'p_server'"'
1899 say ' p_share = "'p_share'"'
1900 end
1901
1902 p_server = translate(p_server)
1903
1904 ok = VRSet("EF_NETWORK","Value", p_workgroup)
1905 if p_workgroup <> "" then do
1906 wgh = _GetMachineHandle(p_workgroup)
1907 if wgh = "" then wgh = _AddWorkGroup(p_workgroup)
1908 call _UpdateObject "EF_SERVER", p_server
1909 mh = _GetMachineHandle(p_server)
1910 if mh = "" & p_server <> "*" then do
1911 mh = _AddSleepingMachine(p_server,'',wgh)
1912 machine = p_server
1913 call _RefreshShares
1914 end
1915 ok = VRSet("EF_Share","Value", p_share)
1916 select
1917 when p_workgroup = "*" then ok = VRSet("CB_MOUNT","Value", mtype.4)
1918 when p_server = "*" then ok = VRSet("CB_MOUNT","Value", mtype.3)
1919 when p_share = "*" then ok = VRSet("CB_MOUNT","Value", mtype.2)
1920 otherwise ok = VRSet("CB_MOUNT","Value", mtype.1)
1921 end
1922 end
1923 if options.!debug == 1 then say time()' CN_CURRENT_Click done'
1924RETURN
1925
1926/*:VRX CN_CURRENT_ContextMenu
1927*/
1928CN_CURRENT_ContextMenu: /* PROCEDURE EXPOSE existrec. options. icons. fs. */
1929 if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu started"
1930
1931 CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
1932
1933 rh = VRInfo('Record')
1934
1935 /* we have to check whether the record still exists because under certain
1936 circumstances the event routine is executed after the record was already
1937 removed */
1938 if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then do
1939 if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu aborted"
1940 return
1941 end
1942
1943 data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
1944 PARSE VAR data p_node ';' p_mounts ';' p_string
1945
1946 if options.!debug == 1 then do
1947 say ' data = "'data'"'
1948 say ' p_node = "'p_node'"'
1949 say ' p_mounts = "'p_mounts'"'
1950 say ' p_string = "'p_string'"'
1951 end
1952/*
1953 infotext = p_node
1954 DO i = 1 TO p_mounts
1955 infotext = infotext ' ['p_string']'
1956 END
1957*/
1958 if p_string = ""
1959 then infotext = fs.!name' 'fs.!version
1960 else infotext = p_string
1961
1962 if infotext = "" then infotext = " "
1963 CALL VRSet "CN_CURRENT", "Caption", infotext
1964 CALL VRSet "CN_CURRENT", 'HintText',infotext
1965
1966 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
1967/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1
1968 CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1
1969 CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 1 */
1970 CALL VRSet 'Menu_Context_Open_Default', "Visible", 1
1971
1972 IF p_mounts > 0 THEN DO
1973 CALL VRSet 'PB_UNMOUNT', 'Enabled', 1
1974 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 1
1975
1976 if pos("*",p_string) > 0 | pos(";",p_string) > 0 then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
1977 else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
1978 END
1979 ELSE DO
1980 CALL VRSet 'PB_UNMOUNT', 'Enabled', 0
1981 CALL VRSet 'MENU_CONTEXT_UNMOUNT', 'Visible', 0
1982 CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
1983 END
1984
1985 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'Parent')
1986
1987 IF parent == '' THEN DO
1988 CALL VRSet 'PB_DETACH', 'Enabled', 1
1989 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 1
1990 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
1991/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1 */
1992 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 1
1993/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1 */
1994/* CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 1 */
1995 END
1996 ELSE DO
1997 CALL VRSet 'PB_DETACH', 'Enabled', 0
1998 CALL VRSet 'MENU_CONTEXT_DETACH', 'Visible', 0
1999 CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 0
2000/* CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 0 */
2001 CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 0
2002/* CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 0 */
2003/* CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 0 */
2004 END
2005
2006 ok = VRMethod( "Menu_Context", "Popup", , , "", "" )
2007 if options.!debug == 1 then say time()' '||"CN_CURRENT_ContextMenu done"
2008return
2009
2010/*:VRX CN_CURRENT_DoubleClick
2011*/
2012CN_CURRENT_DoubleClick:
2013 if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick started"
2014
2015 CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
2016
2017 rh = VRInfo('Record')
2018
2019 /* we have to check whether the record still exists because under certain
2020 circumstances the event routine is executed after the record was already
2021 removed */
2022 if VRMethod( "CN_CURRENT", "ValidateRecord", rh) <> 1 then do
2023 if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick aborted"
2024 return
2025 end
2026
2027 data = VRMethod("CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2028 PARSE VAR data p_node ';' p_mounts ';' p_string
2029
2030 if options.!debug == 1 then do
2031 say ' data = "'data'"'
2032 say ' p_node = "'p_node'"'
2033 say ' p_mounts = "'p_mounts'"'
2034 say ' p_string = "'p_string'"'
2035 end
2036 call Menu_Context_Open_Default_Click
2037
2038 if options.!debug == 1 then say time()' '||"CN_CURRENT_DoubleClick done"
2039return
2040
2041/*:VRX CN_CURRENT_DragDrop
2042*/
2043CN_CURRENT_DragDrop:
2044 if options.!debug == 1 then say time()' CN_CURRENT_DragDrop started'
2045 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
2046 if options.!debug == 1 then say " settings.!network = "settings.!network
2047
2048 p_workgroup = ''
2049 p_server = ''
2050 p_share = ''
2051
2052 srcFile = VRInfo( "SourceFile" )
2053 srcCtn = VRInfo( "SourceObject" )
2054 srcRec = VRInfo( "SourceRecord" )
2055 trgCtn = VRInfo( "TargetObject" )
2056 trgRec = VRInfo( "TargetRecord" )
2057
2058 if options.!debug == 1 then do
2059 say ' srcFile = "'srcFile'"'
2060 say ' srcCtn = "'srcCtn'"'
2061 if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
2062 say ' srcRec = "'srcRec'"'
2063 say ' trgCtn = "'trgCtn'"'
2064 if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
2065 say ' trgRec = "'trgRec'"'
2066 end
2067
2068 if srcFile <> "" then do /* A file was dropped onto the container - attempt to load it */
2069 if options.!debug == 1 then say ' Possible profile dropped: "'srcFile'"'
2070
2071 /* was it really a profile ? */
2072 if translate(VRParseFileName(srcFile,'E')) = translate(fs.!profileext) then do /* Yes - load it! */
2073 options.!autoload = 1
2074 Profile = srcFile
2075 call Menu_File_Load_Click
2076 ok = VRSet("EF_NETWORK","Value",options.!workgroup)
2077 end
2078 else do /* No - barf! */
2079 buttons.0 = 1
2080 buttons.1 = NLVGetMessage(9)
2081 ok = VRMessage('Main', NLVGetMessage(103,srcFile ), NLVGetMessage(5), 'E','buttons.')
2082 end
2083 if options.!debug == 1 then say time()' CN_CURRENT_DragDrop done (load profile)'
2084 return
2085 end
2086
2087 ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
2088
2089 if VRGet(srcCtn,'Name') = "CN_CONDET" then do
2090 p_mpoint = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.MpointFH)
2091
2092 p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcRec, cd.workgrpFH )
2093 p_server = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.ServerFH)
2094 p_share = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.ShareFH)
2095 p_user = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.UserFH)
2096 p_password = x2c(VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.SpasswordFH))
2097
2098 ShareLevel = 1
2099 if p_share = "" then ShareLevel = 2
2100 if p_server = "" then ShareLevel = 3
2101 if p_workgroup = "" then ShareLevel = 4
2102
2103 ok = VRSet("CB_MOUNT", "Selected", Sharelevel )
2104 ok = VRset("CB_MOUNT", "Value", mtype.sharelevel)
2105
2106 call _UpdateObject "EF_SERVER", p_server
2107 ok = VRset("EF_SHARE", "Value", p_share)
2108 ok = VRset("EF_NETWORK", "Value", p_workgroup)
2109 ok = VRset("EF_USER", "Value", p_user)
2110 ok = VRset("EF_PASSWORD", "Value", p_password)
2111
2112 parse var p_mpoint p_drv '\' p_dir
2113
2114 p_dir = strip(p_dir,'T','\')
2115
2116 ok = VRset("CB_DRIVES", "Value", p_drv)
2117 ok = VRset("EF_DIRECTORY", "Value", p_dir)
2118 end /* Drag from CN_CONDET */
2119
2120 else do /* Drag from CN_SMBTREE */
2121 call _GetSMBObjectProperties srcRec
2122 select
2123 when SMBObj.udatatype = "WORKGROUP" then do
2124 say "Workgroup dragged!"
2125 p_workgroup = SMBObj.resname
2126 p_server = ""
2127 p_share = ""
2128
2129 ShareLevel = 3
2130 end
2131 when SMBObj.udatatype = "SERVER" then do
2132 say "Server dragged!"
2133 if SMBObj.parentrh <> "" then do /* detect server without workgroup */
2134 p_workgroup = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
2135 end
2136 p_server = SMBObj.resname
2137 p_share = ""
2138
2139 ShareLevel = 2
2140 end
2141 when SMBObj.udatatype = "DISK" then do
2142 say "Shared disk dragged!"
2143 if SMBObj.gparentrh <> "" then do /* detect share on a server without workgroup */
2144 p_workgroup = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.gparentrh, "Caption")
2145 end
2146 p_server = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
2147 parse var p_server p_server '0D0A'x .
2148 p_share = SMBObj.resname
2149
2150 ShareLevel = 1
2151 end
2152 otherwise nop /* Printer */
2153 end
2154 ok = VRSet("EF_NETWORK","Value",p_workgroup)
2155 call _UpdateObject "EF_SERVER", p_server
2156 ok = VRSet("EF_Share","Value", p_share)
2157 end /* Drag from CN_SMBTREE */
2158
2159 if options.!debug == 1 then do
2160 say 'p_workgroup = "'p_workgroup'"'
2161 say 'p_server = "'p_server'"'
2162 say 'p_share = "'p_share'"'
2163 end
2164
2165 ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
2166
2167 settings.!network = VRGet("EF_NETWORK","Value")
2168 call CB_MOUNT_Change
2169
2170 if trgRec = "" then do
2171 ok = VRMethod("CB_DRIVES", "GetStringList", "freedrives.")
2172 if freedrives.0 > 0
2173 then ok = VRSet("CB_DRIVES","Value", freedrives.1)
2174 else ok = VRSet("CB_DRIVES","Value", "")
2175
2176 ok = VRSet("EF_DIRECTORY","Value", "")
2177 end
2178 else do
2179 TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
2180
2181 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
2182
2183 do while parTrgRH <> ""
2184 partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
2185 TargetString = partrgCapt||'\'||TargetString
2186 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
2187 end
2188 say 'TargetString = "'TargetString'"'
2189 ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
2190 ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
2191 end
2192
2193 window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
2194 if VRGet("CB_DRIVES","Value") = "" then return
2195
2196 window = VRLoadSecondary( "SW_LOGIN", "W" )
2197 if credentials.!entered = 1 then call PB_MOUNT_CLICK
2198
2199 if VRGet(srcCtn,'Name') = "CN_CONDET" & VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
2200 if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
2201 end
2202 if options.!debug == 1 then say time()' CN_CURRENT_DragDrop done'
2203return
2204/*:VRX CN_SMBTREE_Click
2205*/
2206CN_SMBTREE_Click:
2207 if options.!debug == 1 then say time()' CN_SMBTREE_Click started'
2208 /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
2209
2210 call _dropdeprecated
2211 call _GetSmbObjectProperties VRInfo('Record')
2212 call _ContextMenuSelectedSet
2213
2214 ok = VRset("DT_Statusbar", "Caption", SMBObj.udatamsg)
2215
2216 if options.!debug == 1 then say time()' CN_SMBTREE_Click done'
2217return
2218/*:VRX CN_SMBTREE_ContextMenu
2219*/
2220CN_SMBTREE_ContextMenu:
2221 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu started'
2222
2223 call _dropdeprecated
2224 call _GetSmbObjectProperties VRInfo('Record')
2225
2226 call _ContextMenuSelectedSet
2227 ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
2228
2229 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu done'
2230return
2231/*:VRX CN_SMBTREE_DoubleClick
2232*/
2233CN_SMBTREE_DoubleClick:
2234 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick started'
2235
2236 call _dropdeprecated
2237 call _GetSmbObjectProperties VRInfo('Record')
2238
2239/* if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
2240return */
2241 /* Enable last 2 lines for 2.0.x (to disable on the fly browsing) */
2242
2243 if options.!debug == 1 then say ' Browsing "'SMBObj.udatatype'"'
2244
2245 If SMBObj.udatatype = "DIRECTORY" then do
2246 BrowsePath = _browsebuildpath(SMBObj.rh)
2247
2248 call _BrowseResetObject(SmbObj.rh)
2249
2250 parse var browsepath '\\'machine'\'sharename '\' browsepath
2251 browsepath = browsepath'\*'
2252
2253 call _BrowseDirectory
2254 end
2255
2256 If SMBObj.udatatype = "FILE" then do
2257 BrowsePath = _browsebuildpath(SMBObj.rh)
2258 call _BrowseResetObject(SmbObj.rh)
2259
2260 parse var browsepath '\\'machine'\'sharename '\' browsepath
2261
2262 OpenOk = _browseobjectopen(machine,sharename,browsepath)
2263
2264 if \OpenOK then do
2265 say " Not connected - trying to connect"
2266 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", sharerh, "Selected", 1)
2267 call PB_SMBTREE_CONNECT_Click
2268 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Selected", 1)
2269
2270 OpenOk = _browseobjectopen(machine,sharename,browsepath)
2271
2272 if \OpenOk then do
2273 say " Not connected - cannot open - aborting!"
2274 end
2275 end
2276 end
2277
2278 if SMBObj.udatatype = "DISK" then do
2279 machine = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
2280 parse var machine machine '0D0A'x .
2281 machine = strip(machine)
2282
2283 call _BrowseResetObject(SmbObj.rh)
2284
2285 sharename = SMBObj.resname
2286 BrowsePath = ""
2287
2288 call _BrowseDirectory
2289 end
2290 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
2291return
2292/*:VRX CN_SMBTREE_DragFile
2293*/
2294CN_SMBTREE_DragFile:
2295 if options.!debug == 1 then say time()' CN_SMBTREE_DragFile started'
2296
2297 obj = VRInfo( "object" )
2298
2299 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
2300 if SelRH.0 = 0 then do
2301 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart aborted'
2302 return
2303 end
2304
2305 call _dropdeprecated
2306 call _GetSMBObjectProperties SelRH.1
2307
2308 select
2309 when SMBObj.udatatype = "WORKGROUP" | SMBObj.udatatype = "SERVER" | SMBObj.udatatype = "DISK" then do
2310 call VRMethod obj, 'StartDrag'
2311 end
2312 when SMBObj.udatatype = "PRINTER" then do
2313 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
2314 end
2315 otherwise nop /* FILE DIRECTORY */
2316 end
2317
2318 if options.!debug == 1 then say time()' CN_SMBTREE_DragFile done'
2319return
2320
2321/*:VRX CN_SMBTREE_DragStart
2322*/
2323CN_SMBTREE_DragStart:
2324 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart started'
2325
2326 obj = VRInfo( "object" )
2327
2328 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
2329 if SelRH.0 = 0 then do
2330 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart aborted'
2331 return
2332 end
2333
2334 call _dropdeprecated
2335 call _GetSMBObjectProperties SelRH.1
2336
2337 select
2338 when SMBObj.udatatype = "WORKGROUP" | SMBObj.udatatype = "SERVER" | SMBObj.udatatype = "DISK" then do
2339 call VRMethod obj, 'StartDrag'
2340 end
2341 when SMBObj.udatatype = "PRINTER" then do
2342 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
2343 end
2344 otherwise nop /* FILE DIRECTORY */
2345 end
2346
2347 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart done'
2348return
2349/*:VRX CreateObject
2350*/
2351CreateObject: procedure
2352 Parse Arg Class, Title, Location, Setup, Collision
2353 /* say 'Creating ['Title']' */
2354say Setup
2355 rc = SysCreateObject( Class, Title, Location, Setup, Collision )
2356 If rc <> 1 Then do
2357 Msg.Text = ' > failed to create ['Title' | 'Class'] at location ['Location']'
2358 Msg.Type = 'Error'
2359 say Msg.Text
2360 end
2361return rc
2362/*:VRX DT_STATUSBAR_ContextMenu
2363*/
2364DT_STATUSBAR_ContextMenu:
2365 ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
2366return
2367
2368/*:VRX EF_PASSWORD1_KeyPress
2369*/
2370EF_PASSWORD1_KeyPress:
2371 if options.!debug == 1 then say time()' EF_PASSWORD1_KeyPress started'
2372 obj = VRInfo( "Object" )
2373 keystr = VRGet( obj, "KeyString" )
2374/* say keystr */
2375 select
2376 when keystr = "{Enter}" then call PB_LOGIN_OK_Click
2377 when keystr = "{Newline}" then call PB_LOGIN_OK_Click
2378 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
2379 otherwise nop
2380 end
2381 if options.!debug == 1 then say time()' EF_PASSWORD1_KeyPress done'
2382return
2383
2384/*:VRX EF_PASSWORD_Change
2385*/
2386EF_PASSWORD_Change:
2387 Now = VRGet("EF_PASSWORD","value")
2388 if Now = "" | Now = LastPassword then return
2389 ok = SysSleep(1)
2390 LastPassword = Now
2391 if Now <> VRGet("EF_PASSWORD","value") then return
2392 call _UserCredUpdate
2393return
2394
2395/*:VRX EF_SERVER_Change
2396*/
2397EF_SERVER_Change:
2398 if options.!debug == 1 then say time()' EF_SERVER_Change started'
2399 Now = VRGet("EF_SERVER","value")
2400
2401 if Now = "" | Now = LastServer then return
2402 ok = SysSleep(2)
2403 if Now <> VRGet("EF_SERVER","value") then return
2404
2405 IF options.!editmode = 1 then return
2406
2407 /* Do nothing for incomplete IP addresses */
2408 if strip(translate(VRGet("EF_SERVER","value"),copies(' ',11),'01234567890.')) = "" then do /* got an IP address */
2409 if \_IsValidIPAddress(VRGet("EF_SERVER","value")) then return /* it is invalid or incomplete */
2410 end
2411
2412 /* do nothing if a workgroup was mounted */
2413 if VRGet("EF_SERVER","value") = "*" then return
2414
2415 machine = VRGet("EF_SERVER","value")
2416 rh = _GetMachineHandle(machine)
2417
2418 if rh <> "" then do
2419 call _GetSMBObjectProperties rh
2420
2421 if SMBObj.parentrh = ""
2422 then ok = VRSet("EF_NETWORK","Value", "") /* The workgroup might be unknown at this moment */
2423 else ok = VRSet("EF_NETWORK","Value", VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentRH,"Caption"))
2424
2425 call _GetSMBObjectShares rh
2426
2427 ok = VRMethod("EF_SHARE", "Reset")
2428 if SMBObj.shares.0 > 0 then ok = VRMethod("EF_SHARE", "AddRecordList", "SMBObj.shares.")
2429 end
2430 else do
2431 call _RefreshWorkgroups
2432 smbtree.!machine = _AddSleepingMachine(machine,"","")
2433 call _UserCredUpdate
2434 call _RefreshShares
2435 ok = VRSet( "CN_smbtree", "Painting", 1 )
2436
2437 ok = VRSet("Main", 'Pointer', '<default>' )
2438 ok = VRSet("CN_smbtree","Enabled", 1)
2439 ok = VRSet("TM_Throbber","Enabled", 0)
2440 ok = VRSet("Pict_Throbber","Visible", 0)
2441 end
2442
2443 LastServer = VRGet("EF_SERVER","value")
2444 if options.!debug == 1 then say time()' EF_SERVER_Change done'
2445return
2446
2447/*:VRX EF_USER1_KeyPress
2448*/
2449EF_USER1_KeyPress:
2450 if options.!debug == 1 then say time()' EF_USER1_KeyPress started'
2451 obj = VRInfo( "Object" )
2452 keystr = VRGet( obj, "KeyString" )
2453 say keystr
2454 select
2455 when keystr = "{Enter}" then ok = VRMethod( "EF_Password1", "SetFocus" )
2456 when keystr = "{Newline}" then ok = VRMethod( "EF_Password1", "SetFocus" )
2457 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
2458 otherwise nop
2459 end
2460 if options.!debug == 1 then say time()' EF_USER1_KeyPress done'
2461return
2462
2463/*:VRX EF_USER_Change
2464*/
2465EF_USER_Change:
2466 Now = VRGet("EF_USER","value")
2467 if Now = "" | Now = LastUser then return
2468 ok = SysSleep(1)
2469 LastUser = Now
2470 if Now <> VRGet("EF_USER","value") then return
2471 call _UserCredUpdate
2472return
2473
2474/*:VRX EF_WINS_SERVER_Change
2475*/
2476EF_WINS_SERVER_Change:
2477 advanced.!smbconfchanged = 1
2478return
2479
2480/*:VRX Fini
2481*/
2482Fini:
2483 window = VRWindow()
2484 call VRSet window, "Visible", 0
2485 drop window
2486return 0
2487
2488/*:VRX GetChildren
2489*/
2490GetChildren: PROCEDURE EXPOSE existrec. exc options. icons. fs. cd. samba.
2491 if options.!debug == 1 then say time()' GetChildren started'
2492 PARSE ARG node, parec
2493
2494 CALL _Dynamic "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
2495
2496 IF info.2 > 0 THEN icon = icons.!active
2497 ELSE icon = icons.!passive
2498
2499 rh = VRMethod("CN_CURRENT", 'AddRecord', parec, 'Last', info.0, icon )
2500 IF rh == '' | datatype(res.0) <> "NUM" THEN RETURN
2501
2502 exc = exc + 1
2503 existrec.exc = rh
2504 userdata = node';'info.2
2505 DO i = 1 TO res.0
2506 userdata = ParseResourceData( userdata, res.i )
2507 END
2508 if userdata = "UNKNOWN" then ok = VRMethod("CN_CURRENT", 'RemoveRecord', rh)
2509 else do
2510 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'UserData', userdata
2511 if options.currentdata = userdata then ok = VRMethod("CN_CURRENT", 'SetRecordAttr', rh, 'Selected', 1)
2512 end
2513
2514 DO i = 1 TO points.0
2515 childnode = node || points.i || '\'
2516 CALL GetChildren childnode, rh
2517 END
2518 if options.!debug == 1 then say time()' GetChildren done'
2519RETURN
2520
2521/*:VRX GetMountPoints
2522*/
2523GetMountPoints: PROCEDURE EXPOSE existrec. options. icons. fs. cd. samba.
2524 if options.!debug == 1 then say time()' GetMountPoints started'
2525/* CALL VRSet "CN_CURRENT", 'Painting', 0 */
2526/* if options.!debug == 1 then say time()' '||"GetMountPoints: SysDriveMap(USED) started" */
2527 drvs = SysDriveMap('C:', 'USED') /* was "REMOTE" */
2528/* if options.!debug == 1 then say time()' '||"GetMountPoints: SysDriveMap(USED) done" */
2529 ac = 0
2530 DO i = 1 TO WORDS( drvs )
2531 fs = TRANSLATE( SysFileSystemType( WORD( drvs, i )))
2532 IF fs == fs.!fileSystemtype THEN DO
2533 ac = ac + 1
2534 attached.ac = WORD( drvs, i )
2535 END
2536 END
2537 attached.0 = ac
2538
2539 exc = 0
2540 DO i = 1 TO attached.0
2541 node = attached.i'\'
2542
2543 CALL VRMethod 'CB_DRIVES', 'AddString', attached.i
2544
2545 CALL _Dynamic "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
2546
2547 IF info.2 > 0 THEN icon = icons.!drive
2548 ELSE icon = icons.!drive_inactive
2549
2550 rh = VRMethod("CN_CURRENT", 'AddRecord',, 'Last', attached.i, icon )
2551 IF rh == '' THEN ITERATE
2552
2553 exc = exc + 1
2554 existrec.exc = rh
2555 userdata = node';'info.2
2556 DO j = 1 TO res.0
2557 userdata = ParseResourceData( userdata, res.j )
2558 END
2559/* if options.!debug == 1 then say ' "'attached.i'" "'userdata'"' */
2560 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'UserData', userdata /* , 'FileName', 'TESTER.EVP' */
2561 if options.currentdata = userdata then ok = VRMethod("CN_CURRENT", 'SetRecordAttr', rh, 'Selected', 1)
2562
2563 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'Expanded', 1
2564
2565 DO j = 1 TO points.0
2566 childnode = node || points.j || '\'
2567 CALL GetChildren childnode, rh
2568 END
2569
2570 END
2571 existrec.0 = exc
2572/* CALL VRSet "CN_CURRENT", 'Painting', 1 */
2573 if options.!debug == 1 then say time()' '||"GetMountPoints done"
2574RETURN
2575
2576/*:VRX Halt
2577*/
2578Halt:
2579 signal _VREHalt
2580return
2581
2582/*:VRX Init
2583*/
2584Init:
2585/* Herwig */
2586/* CALL VRSet 'Console', 'WindowListTitle', '' */
2587
2588 window = VRWindow()
2589 call VRSet window, "Visible", 0
2590 call VRMethod window, "Activate"
2591 drop window
2592
2593RETURN
2594
2595/*:VRX LoadFileSysFuncs
2596*/
2597LoadFileSysFuncs:
2598 if options.!debug == 1 then say time()' LoadFileSysFuncs() started'
2599
2600 Fatal = 1
2601 RestartCount = 0
2602 FoundEVFS = 1
2603 FoundND = 1
2604
2605 program = VRGet("Application", "Program")
2606 if program = "" then parse source . . program
2607 say "Program = '"program"'"
2608 program = translate(VRParseFileName(Program,'N'))
2609 say "Program = '"program"'"
2610
2611 if SysSearchPath("PATH", "EVFSCTL.EXE") = "" | program = "SMBGUI" then do
2612 FoundEVFS = 0
2613 ForceNDFS = 1
2614 end
2615
2616CtlRestart:
2617 if \ForceNDFS then signal NoNetDrive
2618
2619ForceNDFS:
2620 if options.!debug == 1 then say ' NDFS check entered'
2621 call RxFuncAdd 'NdRxLoadFuncs', 'NDCALLS', 'NdRxLoadFuncs'
2622 SIGNAL ON SYNTAX NAME NoNetdrive
2623 call NdRxLoadFuncs
2624 FoundND = 1
2625 SIGNAL OFF SYNTAX
2626 fs.!prefix = 'ND'
2627 fs.!fileSystemtype = "NDFS32"
2628 fs.!profileext = "ndc"
2629 signal CommonToBothFS
2630NoNetdrive:
2631 if options.!debug == 1 then say ' NDFS not found'
2632 CALL RxFuncAdd 'EvfsRxLoadFuncs', 'EVFSCALL.DLL', 'EvfsRxLoadFuncs'
2633 SIGNAL ON SYNTAX NAME NoEVFSCALL
2634 CALL EvfsRxLoadFuncs
2635 FoundEVFS = 1
2636 SIGNAL OFF SYNTAX
2637 fs.!prefix = 'EVFS'
2638 fs.!fileSystemtype = "EVFS"
2639 fs.!profileext = "evp"
2640CommonToBothFS:
2641 if options.!debug == 1 then say ' Common version check'
2642 CALL _Dynamic "fsstat = "fs.!prefix"RxQueryIFS()"
2643 if fsstat = 252 then CALL _Dynamic "Found"fs.!prefix" = 0"
2644
2645 if word(fsstat,1) = '0' then do
2646 PARSE VAR fsstat '0 'fsname fsver fsctl .
2647 fs.!name = fsname
2648 fs.!version = fsver
2649
2650 if options.!debug == 1 then DO
2651 say ' fs.!prefix = 'fs.!prefix
2652 say ' fs.!name = 'fs.!Name
2653 say ' Version = 'fsver
2654 say ' fsctl = 'fsctl
2655 end
2656 end
2657 else do
2658 if FoundND = 0 & FoundEVFS = 0 then do
2659 CALL VRMessage 'Main', 'FATAL: Neither EVFS nor Netdrive found: 'fs.!prefix'RxQueryIFS()='fsstat, NLVGetMessage( 5 ), 'E'
2660 signal Halt
2661 end
2662 signal ForceNDFS
2663 end
2664 IF fsctl \= 1 THEN DO
2665 if ReStartCount = 0 then do
2666 'detach 'fs.!prefix'ctl.exe'
2667 RestartCount = 1
2668 ok = SysSleep(1)
2669 signal CtlRestart
2670 end
2671 else do
2672 CALL VRMessage 'Main', NLVGetMessage( 101 ), NLVGetMessage( 5 ), 'E'
2673 signal Halt
2674 end
2675 END
2676
2677 Fatal = 0
2678
2679 if options.!debug == 1 then say time()' LoadFileSysFuncs() done'
2680return
2681
2682/*:VRX Main_Close
2683*/
2684Main_Close:
2685 CALL Quit
2686RETURN
2687
2688/*:VRX Main_Create
2689*/
2690Main_Create:
2691 options.!debug = 1
2692 if options.!debug == 1 then do
2693 ok = VRRedirectStdIO("ON")
2694 say time()' Main_Create started'
2695 end
2696 else ok = VRRedirectStdIO("OFF")
2697
2698 call _InitTempDir
2699 call _LoadOtherFuncs
2700
2701 call NLVSetup
2702 call _StemsInit
2703
2704 call _TabbedDialogSetup
2705 call _ContainersInit
2706 call _GUIInit
2707
2708 CALL _ParseCommandLine
2709
2710 CALL LoadFileSysFuncs
2711
2712 CALL _CltInit
2713
2714 CALL _INILoad
2715
2716 call _TabFix 1
2717 call SW_ADVANCED_Init_Content
2718 call SW_SMBTREE_Init_Content
2719 call SW_CONDET_Init_Content
2720 call SW_SETTINGS_Init_Content
2721
2722 CALL Refresh
2723
2724 if advanced.!savepassive == 1 then CALL _PassiveLoad
2725
2726 IF options.!timesync == 1 THEN CALL _TimeSync
2727
2728 IF options.!autoload == 1 THEN CALL Menu_File_Load_Click
2729
2730 CALL VRSet "CB_MOUNT", "Selected", 1
2731 CALL VRSet "CB_DRIVES", "Selected", 1
2732 IF options.!autoclose == 1
2733 THEN CALL TM_AutoClose_Trigger
2734 ELSE do
2735 if advanced.!browseauth == 1 then do
2736 /* FIXME: unclear why we have to do the following 4 lines here */
2737 call SW_SETTINGS_Init
2738 call SW_SETTINGS_Init_Content
2739 call SW_ADVANCED_Init
2740 call SW_ADVANCED_Init_Content
2741
2742 window = VRLoadSecondary( "SW_LOGIN", "W" )
2743 call Main_Resize
2744 end
2745 if advanced.!browseimme == 1 then call PB_SMBTREE_REFRESH_Click
2746 end
2747
2748 if options.!debug == 1 then say time()' Main_Create done'
2749return
2750
2751/*:VRX Main_KeyPress
2752*/
2753Main_KeyPress:
2754 key = VRGet('Main', 'KeyString')
2755 IF key == '{F5}' THEN CALL Refresh
2756RETURN
2757
2758/*:VRX Main_Resize
2759*/
2760Main_Resize:
2761 if options.!debug == 1 then say time()' Main_Resize started'
2762 ok = VRset("Main","Painting", 0)
2763
2764 /* Basic measurements */
2765 main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */
2766 main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */
2767
2768 if VRMethod( "Screen", "TwipsToPixels", main_iheight) < 580 then ok = VRSet("Main","Height",VRMethod( "Screen", "PixelsToTwips", 600))
2769 if VRMethod( "Screen", "TwipsToPixels", main_iwidth) < 800 then ok = VRSet("Main","Width", VRMethod( "Screen", "PixelsToTwips", 800))
2770
2771 sbar_height = VRGet("GB_STATUSBAR","Height") /* Height of status-bar */
2772 split_left = VRGet("SPLIT_Main","Left") /* Position of the left edge of the split-bar */
2773 marginx2 = margin * 2 /* Common margin around controls */
2774 pbtn_height = 400 /* Height of the panels' internal button areas */
2775
2776 pane_height = main_iheight - sbar_height - (margin * 4) /* Height of a split-bar panel */
2777 lpane_width = split_left - margin /* Width of the left split-bar panel */
2778 rpane_width = main_iwidth - split_left - 60 - margin /* Width of the right split-bar panel */
2779
2780 /* Tabbed Dialog = right pane */
2781 ok = VRset("TDL_1", "Top", marginx2)
2782 ok = VRset("TDL_1", "Left", split_left + 60)
2783 ok = VRset("TDL_1", "Width", rpane_width )
2784 ok = VRset("TDL_1", "Height", pane_height )
2785
2786 /* Current Panel */
2787 ok = VRSet("GB_CURRENT", "Visible", 1 )
2788 ok = VRSet("GB_CURRENT", "Top", marginx2 )
2789 ok = VRSet("GB_CURRENT", "Left", margin )
2790 ok = VRSet("GB_CURRENT", "Width", lpane_width )
2791 ok = VRSet("GB_CURRENT", "Height", pane_height )
2792
2793 ok = VRset("GB_CURRENT3", "Top", margin )
2794 ok = VRset("GB_CURRENT3", "Left", margin )
2795 ok = VRset("GB_CURRENT3", "Height", 245 )
2796 ok = VRset("GB_CURRENT3", "Width", lpane_width - marginx2)
2797
2798 ok = VRset("DT_CURRENT", "Top", 8 )
2799 ok = VRset("DT_CURRENT", "Left", 8 )
2800 ok = VRset("DT_CURRENT", "Height", 213 )
2801 ok = VRset("DT_CURRENT", "Width", (lpane_width - marginx2) - 24 )
2802
2803 ok = VRset("GB_CURRENT2", "Left", margin )
2804 ok = VRset("GB_CURRENT2", "Top", 245 + marginx2 )
2805 ok = VRset("GB_CURRENT2", "Width", lpane_width - marginx2)
2806 ok = VRset("GB_CURRENT2", "Height", pane_height - (margin * 5) - pbtn_height - 245 )
2807
2808 ok = VRset("CN_CURRENT", "Top", margin )
2809 ok = VRset("CN_CURRENT", "Left", margin )
2810 ok = VRset("CN_CURRENT", "Width", VRGet("GB_CURRENT2","Width") - marginx2)
2811 ok = VRset("CN_CURRENT", "Height", VRGet("GB_CURRENT2","Height") - marginx2)
2812
2813 ok = VRset("PB_DETACH", "Left", margin )
2814 ok = VRset("PB_DETACH", "Top", pane_height - pbtn_height - marginx2 )
2815 ok = VRset("PB_DETACH", "Width", min((lpane_width-margin*3) % 2, 1313) )
2816 ok = VRset("PB_UNMOUNT", "Left", VRGet("PB_DETACH","Width") + marginx2)
2817 ok = VRset("PB_UNMOUNT", "Top", pane_height - pbtn_height - marginx2 )
2818 ok = VRset("PB_UNMOUNT", "Width", min((lpane_width-margin*3) % 2, 1313) )
2819
2820 /* Splitbar - reduced in size to make it more noticable */
2821 ok = VRset("SPLIT_Main", "Visible", 1 )
2822 ok = VRset("SPLIT_Main", "Top", marginx2 + (pane_height-1200)%2 )
2823 ok = VRset("SPLIT_Main", "Height", 1200 /* pane_height */ )
2824
2825 /* Statusbar */
2826 ok = VRSet("GB_STATUSBAR", "Left", margin )
2827 ok = VRSet("GB_STATUSBAR", "Top", main_iheight - sbar_height - margin )
2828 ok = VRSet("GB_STATUSBAR", "Width", lpane_width + 50 + rpane_width )
2829
2830 ok = VRset("DT_STATUSBAR", "Top", 12 )
2831 ok = VRset("DT_STATUSBAR", "Left", 12 )
2832 ok = VRset("DT_STATUSBAR", "Height", VRGet("GB_STATUSBAR","Height") -24 )
2833 ok = VRset("DT_STATUSBAR", "Width", (lpane_width + 50 + rpane_width) - 24 )
2834
2835 /* Modified for notebook pages */
2836 pane_height = marginx2 + pane_height -1020
2837 rpane_width = marginx2 + rpane_width -760
2838
2839 /* Dialog page */
2840 ok = VRSet("GB_DIALOG", "Top", margin /* marginx2 */ )
2841 ok = VRSet("GB_DIALOG", "Left", margin /* marginx2 */ /* split_left + 60 */ )
2842 ok = VRset("GB_DIALOG", "Height", pane_height )
2843 ok = VRset("GB_DIALOG", "Width", rpane_width )
2844
2845 ok = VRset("PB_MOUNT", "Left", margin )
2846 ok = VRset("PB_MOUNT", "Top", pane_height - pbtn_height - marginx2)
2847 ok = VRset("PB_EDIT_CANCEL", "Left", VRGet("PB_MOUNT","Width") + marginx2)
2848 ok = VRset("PB_EDIT_CANCEL", "Top", pane_height - pbtn_height - marginx2)
2849
2850 ok = VRset("PB_DIALOG_HELP", "Left", rpane_width - marginx2 - VRGet("PB_DIALOG_HELP","Width") + 24)
2851 ok = VRset("PB_DIALOG_HELP", "Top", pane_height - pbtn_height - marginx2)
2852
2853 ok = VRset("GB_SHARE", "Left", margin )
2854 ok = VRset("GB_SHARE", "Top", marginx2 /* 245 + marginx2 */ )
2855 ok = VRset("GB_SHARE", "Height", 2252 )
2856 ok = VRset("GB_SHARE", "Width", rpane_width - marginx2 )
2857
2858 ok = VRset("GB_AUTH", "Left", margin )
2859 ok = VRset("GB_AUTH", "Top", margin * 3 + VRGet("GB_SHARE","Height") /* 245 + (margin * 3) + VRGet("GB_SHARE","Height") */ )
2860 ok = VRset("GB_AUTH", "Width", rpane_width - marginx2 )
2861
2862 ok = VRset("GB_MPOINT","Left", margin )
2863 ok = VRset("GB_MPOINT","Top", /* 245 + */ (margin * 4) + VRGet("GB_SHARE","Height") + VRGet("GB_AUTH","Height"))
2864 ok = VRset("GB_MPOINT","Width", rpane_width - marginx2 )
2865
2866 /* Advanced page */
2867 ok = VRSet("GB_ADVANCED", "Top", margin /* marginx2 */ )
2868 ok = VRSet("GB_ADVANCED", "Left", margin /* marginx2 */ /* split_left + 60 */ )
2869 ok = VRset("GB_ADVANCED", "Height", pane_height )
2870 ok = VRset("GB_ADVANCED", "Width", rpane_width )
2871
2872 ok = VRset("GB_ADVANCED2", "Left", margin )
2873 ok = VRset("GB_ADVANCED2", "Top", /* 245 + */ marginx2)
2874 ok = VRset("GB_ADVANCED2", "Width", rpane_width - marginx2)
2875 ok = VRset("GB_ADVANCED2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
2876
2877 ok = VRset("PB_ADVANCED_APPLY", "Left", margin )
2878 ok = VRset("PB_ADVANCED_APPLY", "Top", pane_height - pbtn_height - marginx2)
2879 ok = VRset("PB_ADVANCED_UNDO", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
2880 ok = VRset("PB_ADVANCED_UNDO", "Top", pane_height - pbtn_height - marginx2)
2881 ok = VRset("PB_ADVANCED_HELP", "Left", rpane_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24)
2882 ok = VRset("PB_ADVANCED_HELP", "Top", pane_height - pbtn_height - marginx2)
2883
2884 /* SMBTree page */
2885 ok = VRSet("GB_SMBTREE", "Top", margin /* x2 */ )
2886 ok = VRSet("GB_SMBTREE", "Left", margin /* x2 */ /* split_left + 60 */ )
2887 ok = VRset("GB_SMBTREE", "Height", pane_height )
2888 ok = VRset("GB_SMBTREE", "Width", rpane_width )
2889
2890 ok = VRset("GB_SMBTREE2","Left", margin )
2891 ok = VRset("GB_SMBTREE2","Top", /* 45 + */ marginx2 )
2892 ok = VRset("GB_SMBTREE2","Width", rpane_width - marginx2)
2893 ok = VRset("GB_SMBTREE2","Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
2894
2895 ok = VRset("CN_SMBTREE", "Top", margin )
2896 ok = VRset("CN_SMBTREE", "Left", margin )
2897 ok = VRset("CN_SMBTREE", "Width", VRGet("GB_SMBTREE2","Width") - marginx2)
2898 ok = VRset("CN_SMBTREE", "Height", VRGet("GB_SMBTREE2","Height") - marginx2)
2899
2900 ok = VRset("PB_SMBTREE_CONNECT", "Left", margin )
2901 ok = VRset("PB_SMBTREE_CONNECT", "Top", pane_height - pbtn_height - marginx2)
2902 ok = VRset("PB_SMBTREE_REFRESH", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
2903 ok = VRset("PB_SMBTREE_REFRESH", "Top", pane_height - pbtn_height - marginx2)
2904 ok = VRset("PB_SMBTREE_HELP", "Left", rpane_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24)
2905 ok = VRset("PB_SMBTREE_HELP", "Top", pane_height - pbtn_height - marginx2)
2906
2907 ok = VRset("PICT_THROBBER", "Top", VRGet("CN_SMBTREE","Height") % 2 - 100 )
2908 ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width") % 2 - 200 )
2909
2910 /* Connection details page */
2911 ok = VRSet("GB_CONDET", "Top", margin /* x2 */ )
2912 ok = VRSet("GB_CONDET", "Left", margin /* x2 */ /* split_left + 60 */ )
2913 ok = VRset("GB_CONDET", "Height", pane_height )
2914 ok = VRset("GB_CONDET", "Width", rpane_width )
2915
2916 ok = VRset("GB_CONDET2", "Left", margin )
2917 ok = VRset("GB_CONDET2", "Top", /* 245 + */ marginx2)
2918 ok = VRset("GB_CONDET2", "Width", rpane_width - marginx2)
2919 ok = VRset("GB_CONDET2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
2920
2921 ok = VRset("CN_CONDET", "Top", margin )
2922 ok = VRset("CN_CONDET", "Left", margin )
2923 ok = VRset("CN_CONDET", "Width", VRGet("GB_CONDET2","Width") - marginx2)
2924 ok = VRset("CN_CONDET", "Height", VRGet("GB_CONDET2","Height") - marginx2)
2925
2926 ok = VRset("PB_CONDET_SAVE", "Left", margin )
2927 ok = VRset("PB_CONDET_SAVE", "Top", pane_height - pbtn_height - marginx2 )
2928 ok = VRset("PB_CONDET_LOAD", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
2929 ok = VRset("PB_CONDET_LOAD", "Top", pane_height - pbtn_height - marginx2 )
2930 ok = VRset("PB_CONDET_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
2931 ok = VRset("PB_CONDET_HELP", "Top", pane_height - pbtn_height - marginx2)
2932
2933 /* Global settings page */
2934 ok = VRSet("GB_GLOBAL", "Top", margin /* x2 */ )
2935 ok = VRSet("GB_GLOBAL", "Left", margin /* x2 */ /* split_left + 60 */ )
2936 ok = VRset("GB_GLOBAL", "Height", pane_height )
2937 ok = VRset("GB_GLOBAL", "Width", rpane_width )
2938
2939 ok = VRset("GB_GLOBAL2", "Left", margin )
2940 ok = VRset("GB_GLOBAL2", "Top", marginx2 /* 245 + marginx2 */ )
2941 ok = VRset("GB_GLOBAL2", "Width", rpane_width - marginx2 )
2942
2943 ok = VRset("GB_LOGGING", "Left", margin )
2944 ok = VRset("GB_LOGGING", "Top", margin * 3 + VRGet("GB_GLOBAL2","Height") /* 245 + (margin * 3) + VRGet("GB_GLOBAL2","Height") */ )
2945 ok = VRset("GB_LOGGING", "Width", rpane_width - marginx2 )
2946
2947 ok = VRset("GB_GUI","Left", margin )
2948 ok = VRset("GB_GUI","Top", /* 245 + */ (margin * 4) + VRGet("GB_GLOBAL2","Height") + VRGet("GB_LOGGING","Height"))
2949 ok = VRset("GB_GUI","Width", rpane_width - marginx2 )
2950
2951 ok = VRset("PB_SETTINGS_APPLY", "Left", margin )
2952 ok = VRset("PB_SETTINGS_APPLY", "Top", pane_height - pbtn_height - marginx2 )
2953 ok = VRset("PB_SETTINGS_APPLY", "Height", pbtn_height)
2954 ok = VRset("PB_SETTINGS_UNDO", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
2955 ok = VRset("PB_SETTINGS_UNDO", "Top", pane_height - pbtn_height - marginx2 )
2956 ok = VRset("PB_SETTINGS_UNDO", "Height", pbtn_height)
2957 ok = VRset("PB_SETTINGS_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
2958 ok = VRset("PB_SETTINGS_HELP", "Top", pane_height - pbtn_height - marginx2)
2959 ok = VRset("PB_SETTINGS_HELP", "Height", pbtn_height)
2960
2961 /* DOne with pages */
2962 ok = VRset("Main","Painting", 1)
2963
2964 /* check and empty event queue, trash spurious resize events */
2965 EventString = ''
2966 TrashedResize = 0
2967
2968 do until EventString = 'nop'
2969 EventString = VREvent('N')
2970 if EventString <> 'nop' then do
2971 if EventString = 'CALL Main_Resize' then TrashedResize = 1
2972 else interpret eventString
2973 end
2974 end
2975 if TrashedResize then CALL Main_Resize
2976
2977 if options.!debug == 1 then say time()' Main_Resize done'
2978return
2979/*:VRX Menu_Context_ChangeView_Click
2980*/
2981Menu_Context_ChangeView_Click:
2982 ok = VRSet("Cn_Current","View","NameTree")
2983return
2984
2985/*:VRX Menu_Context_Detach_All_Click
2986*/
2987Menu_Context_Detach_All_Click:
2988 ok = VRMethod( "CN_CURRENT", "GetRecordList", "All", "umrh." )
2989 do um = 1 to umrh.0
2990 ok = VRMethod( "CN_CURRENT", "SetRecordAttr", umrh.um, "Selected", 1)
2991 call PB_DETACH_Click
2992 end
2993 drop um umrh.
2994return
2995
2996/*:VRX Menu_Context_Detach_Click
2997*/
2998Menu_Context_Detach_Click:
2999 call PB_DETACH_Click
3000return
3001
3002/*:VRX Menu_Context_Edit_Click
3003*/
3004Menu_Context_Edit_Click:
3005 if options.!debug == 1 then say time()' Menu_Context_Edit_Click started'
3006 /* call VRMethod "TDL_1", 'PostEvent', 'PageSelected', 'Page', 1 */
3007 ok = VRset("TDL_1", 'Selected', 1)
3008 options.!editmode = 1
3009 CALL VRSet "PB_EDIT_CANCEL","Visible", 1
3010 CALL VRSet "PB_UNMOUNT","Enabled", 0
3011
3012 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(33)" " )
3013/* CALL NLVSetText "DT_DIALOG","Caption",33 */
3014 CALL VRSet "GB_CURRENT", "ENABLED", 0
3015
3016 ok = VRSet("CB_MOUNT","Value","")
3017 ok = VRSet("CB_MOUNT","Selected",1)
3018 ok = VRSet("CB_MOUNT","Value",mtype.1)
3019
3020 parse var p_string p_workgroup':\\'p_server'\'p_share
3021
3022 /* if options.!debug == 1 then say time()' '||p_workgroup */
3023
3024 if options.!debug == 1 then say time()' data '||data
3025 if options.!debug == 1 then say time()' domain '||p_workgroup
3026 if options.!debug == 1 then say time()' server '||p_server
3027 if options.!debug == 1 then say time()' share '||p_share
3028 if options.!debug == 1 then say time()' string '||p_string
3029
3030
3031 CALL VRSet "EF_SHARE", "VALUE", p_share
3032 CALL VRSet "EF_SERVER", "VALUE", p_server
3033 CALL VRSet "EF_NETWORK","VALUE", p_workgroup
3034
3035 /* if options.!debug == 1 then say time()' '||p_node */
3036 parse var p_node p_drive'\'p_directory'\'
3037 CALL VRSet "CB_DRIVES", "Value", p_drive
3038 CALL VRSet "EF_DIRECTORY", "Value", p_directory
3039 if options.!debug == 1 then say time()' Menu_Context_Edit_Click done'
3040return
3041
3042/*:VRX Menu_Context_Open_Click
3043*/
3044Menu_Context_Open_Click:
3045 ok = VRSet("Menu_Context_Open_Default","Visible",0)
3046return
3047
3048/*:VRX Menu_Context_Open_Default_Click
3049*/
3050Menu_Context_Open_Default_Click:
3051 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Click started"
3052 if \VRIsValidObject(rh) then return
3053
3054 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3055 PARSE VAR userdata mountpoint ';' mounts ';' .
3056
3057 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3058
3059 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DEFAULT" )
3060
3061 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Click done"
3062return
3063
3064/*:VRX Menu_Context_Open_Detail_Click
3065*/
3066Menu_Context_Open_Detail_Click:
3067 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click started"
3068 if \VRIsValidObject(rh) then return
3069
3070 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3071 PARSE VAR userdata mountpoint ';' mounts ';' .
3072
3073 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3074
3075 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DETAILS" )
3076
3077 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click done"
3078return
3079
3080/*:VRX Menu_Context_Open_Icon_Click
3081*/
3082Menu_Context_Open_Icon_Click:
3083 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click started"
3084 if \VRIsValidObject(rh) then return
3085
3086 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3087 PARSE VAR userdata mountpoint ';' mounts ';' .
3088
3089 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3090
3091 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "ICON" )
3092
3093 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click done"
3094return
3095
3096/*:VRX Menu_Context_Open_Settings_Click
3097*/
3098Menu_Context_Open_Settings_Click:
3099 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Settings_Click started"
3100 if \VRIsValidObject(rh) then return
3101
3102 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3103 PARSE VAR userdata mountpoint ';' mounts ';' .
3104
3105 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3106
3107 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SETTINGS" )
3108
3109 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Settings_Click done"
3110return
3111
3112/*:VRX Menu_Context_Open_Splitview_Click
3113*/
3114Menu_Context_Open_Splitview_Click:
3115 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click started"
3116 if \VRIsValidObject(rh) then return
3117
3118 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3119 PARSE VAR userdata mountpoint ';' mounts ';' .
3120
3121 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3122
3123 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SPLITVIEW" )
3124
3125 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click done"
3126return
3127
3128/*:VRX Menu_Context_Open_Tree_Click
3129*/
3130Menu_Context_Open_Tree_Click:
3131 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click started"
3132 if \VRIsValidObject(rh) then return
3133
3134 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3135 PARSE VAR userdata mountpoint ';' mounts ';' .
3136
3137 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3138
3139 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "TREE" )
3140
3141 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click done"
3142return
3143
3144/*:VRX Menu_Context_Refresh_Click
3145*/
3146Menu_Context_Refresh_Click:
3147 CALL Refresh
3148return
3149
3150/*:VRX Menu_Context_Unmount_Click
3151*/
3152Menu_Context_Unmount_Click:
3153 call PB_UNMOUNT_Click
3154return
3155
3156/*:VRX Menu_File_Autostart_Activate_Click
3157*/
3158Menu_File_Autostart_Activate_Click:
3159 options.!autostart = 1
3160
3161 Profile = VRParseFilename(settings.!ini,'DPN')'.'fs.!profileext
3162 ExeName = VRParseFileName(VRget("Application","Program"),'DPNE')
3163 if ExeName = "" then do
3164 parse source . . script
3165 ExeName = VRParseFilename(script,'DP')'\EVFSGUI.EXE'
3166 end
3167 StartupDir = VRParseFileName(VRget("Application","Program"),'DP')
3168 if StartupDir = "" then do
3169 parse source . . script
3170 StartUpDir = VRParseFilename(script,'DP')
3171 end
3172
3173 ObjTitle = NLVGetMessage( 59 )
3174 if ObjTitle = "" then ObjTitle = '[EVFS LAN-Connections]'
3175
3176 CALL PB_CONDET_SAVE_Click
3177
3178 rc = CreateObject( 'WPProgram', ObjTitle,'<WP_START>',,
3179 'EXENAME='||ExeName||';'||,
3180 'PROGTYPE=PM;'||,
3181 'TITLE='ObjTitle';'||,
3182 'PARAMETERS='Profile' -AUTOCLOSE -NOGUI;'||,
3183 'STARTUPDIR='StartupDir';'||,
3184 'NOPRINT=YES;'||,
3185 'HIDEBUTTON=DEFAULT;'||,
3186 'MINWIN=DEFAULT;'||,
3187 'CCVIEW=DEFAULT;'||,
3188 'DEFAULTVIEW=DEFAULT;'||,
3189 'OBJECTID=<EVFSGUI_AUTOSTART>',,
3190 'REPLACE' )
3191
3192 IF rc == 1 THEN do
3193 Text = NLVGetMessage( 60 )
3194 if Text = "" then Text = '[Created object in Autostart-Folder]'
3195 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3196 end
3197 ELSE do
3198 Text = NLVGetMessage( 61 )
3199 if Text = "" then Text = '[Could not create object in Autostart-Folder]'
3200 Title = NLVGetMessage( 5 )
3201 if Title = "" then Title = '[Error]'
3202 CALL VRMessage 'Main', Text, Title, 'E'
3203 end
3204
3205 options.!autostart = 0
3206return
3207/*:VRX Menu_File_Autostart_Click
3208*/
3209Menu_File_Autostart_Click:
3210
3211return
3212
3213/*:VRX Menu_File_Autostart_Deactivate_Click
3214*/
3215Menu_File_Autostart_Deactivate_Click:
3216 ok = SysDestroyObject("<EVFSGUI_AUTOSTART>")
3217 IF ok == 1 THEN do
3218 Text = NLVGetMessage( 79 )
3219 if Text = "" then Text = '[Autostart object created successfully]'
3220 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3221 end
3222 ELSE do
3223 Text = NLVGetMessage( 78 )
3224 if Text = "" then Text = '[Could find Autostart object]'
3225 Title = NLVGetMessage( 5 )
3226 if Title = "" then Title = '[Error]'
3227 CALL VRMessage 'Main', Text, Title, 'E'
3228 end
3229return
3230
3231/*:VRX Menu_File_Click
3232*/
3233Menu_File_Click:
3234 ok = VRSet("Menu_File_LMHosts_Reset", "Enabled", VRFileExists( samba.!lmhosts ))
3235 ok = VRSet("Menu_File_ucCred_Reset", "Enabled", (VRGet("Pict_PWINMEM","PicturePath") = "#36"))
3236return
3237
3238/*:VRX Menu_File_Close_Click
3239*/
3240Menu_File_Close_Click:
3241 call Quit
3242return
3243
3244/*:VRX Menu_File_Daemon_Start_Click
3245*/
3246Menu_File_Daemon_Start_Click:
3247 if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click started'
3248 if VRFileExists(SysBootDrive()"\ndpsmb.dbg") then do
3249 btns.0 = 2
3250 btns.1 = NLVGetMessage( 6 )
3251 btns.2 = NLVGetMessage( 7 )
3252 confirm = VRMessage('Main', NLVGetMessage( 119 ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3253 IF confirm == 1 THEN do
3254 logFiles = value("LOGFILES",,"OS2ENVIRONMENT")
3255 ok1 = SysFileDelete(Logfiles||'\log.smbc')
3256 ok2 = SysFileDelete(Logfiles||'\log.ndpsmb')
3257 if ok1 <> 0 | ok2 <> 0 then do
3258 ok = VRMessage('Main', NLVGetMessage(5)' 'Logfiles||'\log.smbc RC='ok1||'0D0A'x||NLVGetMessage(5)' 'Logfiles||'\log.ndpsmb RC='ok2, NLVGetMessage( 5 ), 'E')
3259 end
3260 drop ok1 ok2
3261 end
3262 end
3263 address cmd 'detach 'fs.!prefix'CTL.EXE'
3264 ok = VRset("GB_CURRENT","Enabled", 1)
3265 ok = VRset("TDL_1","Enabled", 1)
3266 CALL REFRESH
3267 ok = VRSet("Menu_File_Daemon_Start","Enabled",0)
3268 ok = VRSet("Menu_File_Daemon_Stop","Enabled",1)
3269 if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click done'
3270return
3271
3272/*:VRX Menu_File_Daemon_Stop_Click
3273*/
3274Menu_File_Daemon_Stop_Click:
3275 if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click started'
3276 ok = PRProcessList(proc)
3277 do I = 1 to proc.0
3278 CurProc = VRParseFileName(proc.i.name,'NE')
3279 if CurProc = fs.!prefix"CTL.EXE" then do
3280 call charout , ' 'CurProc' RC='
3281 ok = PRKillProcess(1,proc.i.pid)
3282 say ok
3283 end
3284 end
3285 ok = VRset("GB_CURRENT","Enabled", 0)
3286 ok = VRset("TDL_1","Enabled", 0)
3287 ok = VRSet("Menu_File_Daemon_Start","Enabled",1)
3288 ok = VRSet("Menu_File_Daemon_Stop","Enabled",0)
3289 if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click stopped'
3290return
3291/*:VRX Menu_File_LMHosts_Reset_Click
3292*/
3293Menu_File_LMHosts_Reset_Click:
3294 call _LMHostsReset
3295return
3296
3297/*:VRX Menu_File_Load_Click
3298*/
3299Menu_File_Load_Click: PROCEDURE EXPOSE settings. options. icons. advanced. vfs. Profile fs. cd. samba.
3300 IF options.!autoload == 1 then filename = Profile
3301 else filename = VRFileDialog('Main', NLVGetMessage( 55 ), 'L', '*.'fs.!profileext)
3302 IF filename == '' THEN RETURN
3303 IF STREAM( filename, 'C', 'QUERY EXISTS') == '' THEN DO
3304 CALL VRMessage 'Main', NLVGetMessage( 56, filename ), NLVGetMessage( 5 ), 'E'
3305 RETURN
3306 END
3307
3308 CALL LINEIN filename, 1, 0
3309 DO WHILE LINES( filename )
3310 /* Fix Ticket #202 in order to allow blanks in sharenames */
3311 resline = LINEIN( filename )
3312 nodelen = pos('\\',resline)-2
3313 node = left(resline,nodelen)
3314 rwFlag = word(resline,words(resline))
3315 resource = substr(resline,nodelen+2,length(resline)-(nodelen+2)-(length(rwFlag)+1)+1)
3316 drop resline
3317 drop nodelen
3318
3319 vfs.!drive = FILESPEC('DRIVE', node )
3320 vfs.!mountpoint = STRIP( node, 'T', '\')
3321
3322 /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
3323 if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
3324
3325 call ParseResParmString
3326
3327 options.!workgroup = p_workgroup
3328 options.!server = p_server
3329 options.!share = p_share
3330 options.!user = p_user
3331 options.!password = p_password
3332 options.!spassword = p_spassword
3333 options.!master = p_master
3334 options.!mastertype = p_mtype
3335/* options.!memlen = p_memlen
3336 options.!logfile = p_logfile
3337 options.!loglevel = p_loglevel */
3338 options.!cachetimeout = p_cachetimeout
3339 options.!cachelistings = p_cachelistings
3340 options.!easupport = p_easupport
3341
3342 IF rwFlag == 'R' THEN
3343 options.!readonly = 1
3344 ELSE
3345 options.!readonly = 0
3346
3347 CALL Mount
3348
3349 END
3350 CALL STREAM filename, 'C', 'CLOSE'
3351
3352 options.!autoload = 0
3353
3354 CALL Refresh
3355RETURN
3356/*:VRX Menu_File_Save_Click
3357*/
3358Menu_File_Save_Click:
3359 call PB_CONDET_SAVE_Click
3360return
3361
3362/*:VRX Menu_File_ucCred_Reset_Click
3363*/
3364Menu_File_ucCred_Reset_Click:
3365 if _ucChkUc() then ok = _ucDelUc()
3366 ok = VRSet("Pict_PWINMEM","PicturePath","#37")
3367 ok = VRSet("EF_USER", "Value","")
3368 ok = VRSet("EF_PASSWORD","Value","")
3369 call _UserCredUpdate
3370return
3371
3372/*:VRX Menu_Help_About_Click
3373*/
3374Menu_Help_About_Click:
3375 ok = VRLoadSecondary("SW_ABOUT", "W")
3376return
3377
3378/*:VRX Menu_Help_Extended_Click
3379*/
3380Menu_Help_Extended_Click:
3381 ok = VRMethod( "Main", "InvokeHelp" )
3382return
3383
3384/*:VRX Menu_Selected_Connect_Click
3385*/
3386Menu_Selected_Connect_Click:
3387 call PB_SMBTREE_CONNECT_Click
3388return
3389
3390/*:VRX Menu_Selected_Default_Workgroup_Click
3391*/
3392Menu_Selected_Default_Workgroup_Click:
3393 if options.!debug == 1 then say time()' '||"Menu_Selected_Default_Workgroup_Click started"
3394 if options.!debug == 1 then say ' SMBObj.rh = "'SMBObj.rh'"'
3395 Success = 0
3396 if SMBObj.rh <> "" then do
3397 if options.!debug == 1 then say ' SMBObj.udatatype = "'SMBObj.udatatype'"'
3398 Success = 1
3399 select
3400 when SMBObj.udatatype = "WORKGROUP" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.rh,"Caption")
3401 when SMBObj.udatatype = "DISK" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.gparentrh,"Caption")
3402 when SMBObj.udatatype = "PRINTER" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.gparentrh,"Caption")
3403 when SMBObj.udatatype = "SERVER" then workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
3404 otherwise Success = 0
3405 end
3406
3407 /* FIXME: switch over to REXXIni calls */
3408 if Success = 1 then ok = TRSetIni("[global]","workgroup", workgroupname, samba.!smbconf)
3409 end
3410 Buttons.1 = NLVGetMessage(2)
3411 Buttons.0 = 1
3412
3413 if Success = 0 then do
3414 id = VRMessage( VRWindow(), NLVGetMessage(5), NLVGetMessage(75), "Error", "Buttons.", 1, 1 )
3415 end
3416 else do
3417 id = VRMessage( VRWindow(), NLVGetMessage(117, workgroupname), NLVGetMessage(75), "Information", "Buttons.", 1, 1 )
3418 end
3419 if options.!debug == 1 then say time()' '||"Menu_Selected_Default_Workgroup_Click done"
3420return
3421
3422/*:VRX Menu_Selected_DetailsView_Click
3423*/
3424Menu_Selected_DetailsView_Click:
3425 ok = VRSet("CN_smbtree", "View", "Detail")
3426return
3427
3428/*:VRX Menu_Selected_Info_Click
3429*/
3430Menu_Selected_Info_Click:
3431 if options.!debug == 1 then say time()' Menu_Selected_Info_Click started'
3432
3433 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3434 if SelRH.0 = 0 then do
3435 if options.!debug == 1 then say time()' Menu_Selected_Info_Click aborted'
3436 return
3437 end
3438
3439 call _GetSMBObjectProperties SelRH.1
3440
3441 window = VRLoadSecondary( "SW_INFO", "W" )
3442 if options.!debug == 1 then say time()' Menu_Selected_Info_Click done'
3443return
3444
3445/*:VRX Menu_Selected_Refresh_Click
3446*/
3447Menu_Selected_Refresh_Click:
3448 ok = VRMethod( "CN_smbtree", "SetRecordAttr", SMBObj.rh, "Icon","#61:PMWP.DLL")
3449 call _DelSMBObjectShares SMBObj.rh
3450 machine = SMBObj.resname
3451 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
3452 call _RefreshShares
3453return
3454
3455/*:VRX Menu_Selected_Remove_Click
3456*/
3457Menu_Selected_Remove_Click:
3458 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
3459 if selrec.0 = 0 then return
3460
3461 do I = 1 to selrec.0
3462 if VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.statusfh) = icons.!passive then do
3463 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3464 end
3465 else do
3466 mountpoint = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpointfh)
3467 mpidx = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpidxfh)
3468 if mpidx = 1 then do
3469 btns.0 = 2
3470 btns.1 = NLVGetMessage( 6 )
3471 btns.2 = NLVGetMessage( 7 )
3472 confirm = VRMessage('Main', NLVGetMessage( 72, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3473 IF confirm \= 1 THEN RETURN
3474
3475 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "mpidx")"
3476 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3477 CALL Refresh
3478 end
3479 else do
3480 CALL VRMessage 'Main', NLVGetMessage( 71 ) , NLVGetMessage( 89 )||" "||mountpoint , 'E'
3481 end
3482 end
3483 end
3484return
3485
3486/*:VRX Menu_Selected_Retry_Click
3487*/
3488Menu_Selected_Retry_Click: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba. mtype.
3489
3490 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "srcrec." )
3491 if srcrec.0 = 0 then return
3492
3493 srcrec = srcrec.1
3494
3495 p_mpoint = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.MpointFH)
3496
3497 p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcrec, cd.workgrpFH )
3498 p_server = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ServerFH)
3499 p_share = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ShareFH)
3500 p_user = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.UserFH)
3501 p_password = x2c(VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.SpasswordFH))
3502
3503 ShareLevel = 1
3504 if p_share = "" then ShareLevel = 2
3505 if p_server = "" then ShareLevel = 3
3506 if p_workgroup = "" then ShareLevel = 4
3507
3508 ok = VRSet("CB_MOUNT", "Selected", Sharelevel )
3509 ok = VRset("CB_MOUNT", "Value", mtype.sharelevel)
3510
3511 call _UpdateObject "EF_SERVER", p_server
3512 ok = VRset("EF_SHARE" , "Value", p_share)
3513 ok = VRset("EF_NETWORK", "Value", p_workgroup)
3514 ok = VRset("EF_USER" , "Value", p_user)
3515 ok = VRset("EF_PASSWORD", "Value", p_password)
3516
3517 parse var p_mpoint p_drv '\' p_dir
3518
3519 p_dir = strip(p_dir,'T','\')
3520
3521 ok = VRset("CB_DRIVES" , "Value", p_drv)
3522 ok = VRset("EF_DIRECTORY" , "Value", p_dir)
3523
3524 CALL PB_MOUNT_Click
3525
3526/* if VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
3527 if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
3528 end */
3529return
3530
3531/*:VRX Menu_Selected_TimeSync_Click
3532*/
3533Menu_Selected_TimeSync_Click:
3534 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click started'
3535
3536 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3537 if SelRH.0 = 0 then do
3538 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click aborted'
3539 return
3540 end
3541
3542 call _GetSMBObjectProperties SelRH.1
3543
3544 options.!timesrv = SMBObj.resname
3545 call _TimeSync
3546
3547 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click done'
3548return
3549
3550/*:VRX Menu_Selected_TreeView_Click
3551*/
3552Menu_Selected_TreeView_Click:
3553 ok = VRSet("CN_smbtree", "View", "IconTree")
3554return
3555
3556/*:VRX Mount
3557*/
3558Mount: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba.
3559 if options.!debug == 1 then say time()' Mount procedure started'
3560 /* Set mouse pointer to wait - this operation might take a few seconds */
3561 call VRSet VRWindow(), 'Pointer', 'Wait'
3562
3563/* Disabled, because we merge profile now - in earlier revisions
3564 we replaced it but only for preexisting drives - this made only
3565 sense as long as we were unable to detect double connections -
3566 this could be made an option!
3567
3568 IF options.!autoload then do
3569 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"vfs.!drive"')"
3570 if options.!debug == 1 then say time()' '||'Autoload Detach "'vfs.!drive'" =' ok
3571 end */
3572
3573 /* Attach the virtual drive - only if drive is not already attached */
3574 if pos(vfs.!drive,MyFreeDriveMap("C:","FREE")) > 0 then do
3575 CALL _Dynamic "ok = "fs.!prefix"RxAttach('"vfs.!drive"')"
3576
3577 if options.!debug == 1 then say time()' '||'Attach "'vfs.!drive'" =' ok
3578 end
3579
3580 /* Create the mount point and store whether it was created or already existed */
3581 CALL _Dynamic "CreateMP = "fs.!prefix"RxCreateMountPoint('"vfs.!mountpoint"')"
3582
3583 if options.!debug == 1 then say time()' '||'Create "'vfs.!mountpoint'" = 'CreateMP
3584
3585
3586 /* Build the resource parameter string */
3587 src = ''
3588 IF options.!workgroup \= '' THEN src = src';WORKGROUP='options.!workgroup
3589 IF options.!server \= '' THEN src = src';SERVER='options.!server
3590 IF options.!share \= '' THEN src = src';SHARE='options.!share
3591 IF options.!user \= '' THEN src = src';USER='options.!user
3592 IF options.!password \= '' THEN src = src';PASSWORD='options.!password
3593 IF options.!spassword \= '' THEN src = src';SPASSWORD='options.!spassword
3594 IF options.!master \= '' THEN src = src';MASTER='options.!master
3595 IF options.!mastertype \= '' THEN src = src';MASTERTYPE='options.!mastertype
3596/* IF options.!memlen \= '' THEN src = src';MEMLEN='options.!memlen
3597 IF options.!logfile \= '' THEN src = src';LOGFILE='options.!logfile
3598 IF options.!loglevel \= '' THEN src = src';LOGLEVEL='options.!loglevel */
3599 IF options.!cachetimeout \= '' THEN src = src';CTO='options.!cachetimeout
3600 IF options.!cachelistings \= '' THEN src = src';CLD='options.!cachelistings
3601 IF options.!easupport \= '' THEN src = src';EASUPPORT='options.!easupport
3602
3603 IF options.!readonly = 1 then rwFlag = 'R'; else rwFlag = 'W'
3604
3605 parse var vfs.!mountpoint mpoint ';' .
3606 mpoint = strip(mpoint,'T','\')||'\'
3607
3608 if options.!master = "" then options.!master = "WORKGROUP"
3609 if options.!mtype = "" then options.!mtype = "1"
3610 if options.!loglevel = "" then options.!loglevel = "0"
3611 if options.!memlen = "" then options.!memlen = "2"
3612 if options.!cachetimeout = "" then options.!cachetimeout = "10"
3613 if options.!cachelistings = "" then options.!cachelistings = "32"
3614 if options.!easupport= "" | options.!easupport= " " then options.!easupport = strip(options.!easupport)
3615 if options.!password <> "" & options.!spassword = "" then do
3616 options.!spassword = c2x(options.!password)
3617 options.!password = ""
3618 end
3619
3620 hashstr = mpoint' 'translate(options.!workgroup)' 'translate(options.!server)' 'translate(options.!share)' 'options.!user' 'options.!spassword' 'options.!easupport' 'rwFlag
3621
3622 md5 = rexx_md5(hashstr)
3623
3624 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
3625 DO i = 1 TO records.0
3626 hash = VRMethod("CN_CONDET","GetFieldData", records.i, cd.hashfh)
3627
3628 if options.!debug == 1 then say VRMethod("CN_CONDET","GetFieldData", records.i, CD.mpointFH)'->'hash
3629 if options.!debug == 1 then say mpoint'->'md5
3630
3631 if hash = md5 then do
3632 If VRMethod("CN_CONDET","GetFieldData", records.i, cd.statusfh) = icons.!active then do /* Same hash, status active */
3633 say "Double connection detected!!"
3634 if options.!spassword <> "" then upw = ":********"
3635 else upw = ""
3636 buttons.0 = 2
3637 buttons.1 = NLVGetMessage(9)
3638 buttons.2 = NLVGetMessage(3)
3639 Answer = VRMessage('Main',NLVGetMessage(64) , NLVGetMessage( 36,options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3640 if Answer = 2 then do
3641 call VRSet VRWindow(), 'Pointer', '<default>'
3642 say "Double connection - do not mount!!"
3643 return
3644 end
3645 end
3646 else do /* Same hash, status passive - we have to remove it */
3647 ok = VRMethod("CN_CONDET", "RemoveRecord", records.i )
3648 end
3649 end
3650 end
3651
3652 cd.lastrh = ""
3653 ok = ParseResourceData(vfs.!mountpoint,'SMBFS SMBFS64 \\'options.!workgroup':'options.!server'\'options.!share'@'options.!user||src' 'rwFlag)
3654
3655 /* Now mount the resource */
3656 CALL _Dynamic "ok = "fs.!prefix"RxMount('SMBFS','"vfs.!mountpoint"', '"src"', '"rwFlag"')"
3657
3658 if options.!debug == 1 then say time()' '||'Mount "'vfs.!mountpoint'" =' ok
3659 if ok <> 0 then do
3660 if options.!password <> "" then upw = ":********"
3661 else upw = ""
3662 buttons.0 = 2
3663 buttons.1 = NLVGetMessage(2)
3664 buttons.2 = NLVGetMessage(37)
3665 Answer = VRMessage('Main', SysGetMessage(ok), NLVGetMessage( 36, options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3666 if Answer = 2 then do /* Show explanation */
3667 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')
3668 end
3669 if cd.lastrh <> '' then do
3670 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive) /* Passive Connection icon */
3671 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive) /* Passive Connection icon */
3672 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, '') /* remove pain text password */
3673 end
3674
3675 /* In case the mountpoint was created for this failed operation, it is (optionally) removed again */
3676 if CreateMP = 0 & advanced.!alwaysmp <> 1 then do
3677 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"vfs.!mountpoint"')"
3678 if options.!debug == 1 then say time()' '||'Remove "'vfs.!mountpoint'" = 'ok
3679 end
3680 end
3681 else do
3682 if options.!storecreds = 1 then do
3683 ok = VRSet("EF_User", "Value",options.!user)
3684 ok = VRSet("EF_Password","Value",x2c(options.!spassword))
3685 end
3686 end
3687 drop CreateMP /* not required anymore */
3688
3689/* Obsolete - the IOCtl will not be implemented this way in the plugin
3690 The REXX function is present, but is has no counterpart in the plugin
3691 ok = EvfsRxIoctl( 100 , vfs.!mountpoint, outstring)
3692 if options.!debug == 1 then say time()' '||'RxIoctl "'vfs.!mountpoint'" = 'ok', 'outstring
3693 */
3694 /* Set mouse pointer to default again */
3695 call VRSet VRWindow(), 'Pointer', '<default>'
3696 if options.!debug == 1 then say time()' Mount procedure done'
3697RETURN ok
3698
3699/*:VRX MyFreeDriveMap
3700*/
3701MyFreeDriveMap: procedure expose options. icons. fs. samba.
3702 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) started'
3703 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:"
3704/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) started" */
3705 useddrives= SysDriveMap("C:","USED")
3706/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) done" */
3707
3708 Alldr = words(alldrives)
3709 FreeDriveMap = ""
3710 do I = 1 to AllDr
3711 if word(alldrives,1) = word(useddrives,1) then do
3712 Useddrives = subword(useddrives,2)
3713 Alldrives = subword(Alldrives,2)
3714 end
3715 else do
3716 FreeDriveMap = FreeDriveMap||word(alldrives,1)||' '
3717 Alldrives = subword(Alldrives,2)
3718 end
3719 end
3720 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) done, result "'FreeDriveMap'"'
3721return FreeDriveMap
3722/*:VRX NoEVFSCALL
3723*/
3724NoEVFSCALL:
3725 CALL VRMessage 'Main', NLVGetMessage( 100 ), NLVGetMessage( 5 ), 'E'
3726 signal Halt
3727RETURN
3728
3729/*:VRX ParseResourceData
3730*/
3731ParseResourceData: PROCEDURE EXPOSE userdata options. icons. advanced. fs. cd. samba.
3732 PARSE ARG userdata, resource
3733 if options.!debug == 1 then say time()' ParseResourceData started'
3734 if options.!debug == 1 then say ' receiving "'userdata'" "'resource'" length ('length(resource)')'
3735
3736/* WARNING! resource has a maximal length of 255 and is truncated otherwise */
3737
3738/* PARSE VAR resource . ';WORKGROUP='p_workgroup';SERVER='p_server';SHARE='p_share';' . */
3739
3740 if left(word(resource,1),5) <> "SMBFS" then do
3741 /* Support for other filesystems would come here! */
3742 userData = "UNKNOWN"
3743 end
3744 else do
3745 cd.lastrh = VRMethod("CN_CONDET","AddRecord")
3746 PARSE VAR userdata p_mpoint ';' p_mpidx ';' .
3747
3748 p_mpoint = strip(p_mpoint,'T','\')||'\'
3749 p_rw = word(resource, words(resource))
3750
3751 /* Workaround for truncated resource string */
3752 if length(p_rw) > 1 then do
3753 /* The resource string must have been truncated
3754 p_rw is already wrong and
3755 p_easupport will most likely be also wrong (look below for workaround!) */
3756 p_rw ="W" /* this is guessed only!!! */
3757 if options.!debug == 1 then say ' WARNING! Detected truncated resource string - shorten workgroup name, server name, share name until this message goes away!'
3758 end
3759 /* this should be done unconditionally if the resource string is never truncated */
3760 else resource = left(resource,length(resource)-length(p_rw))
3761
3762 call ParseResParmString
3763
3764 if p_master = "" then p_master = "WORKGROUP"
3765 if p_mtype = "" then p_mtype = "1"
3766 if p_loglevel = "" then p_loglevel = "0"
3767 if p_memlen = "" then p_memlen = "2"
3768
3769 /* Also works around for a truncated resource string! */
3770 if p_easupport= "" | p_easupport= " " then p_easupport = strip(options.!easupport)
3771
3772 if p_password <> "" & p_spassword = "" then do
3773 p_spassword = c2x(p_password)
3774 p_password = ""
3775 end
3776
3777 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)
3778 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password, cd.spasswordfh, p_spassword, cd.masterfh, p_master, cd.mtypefh, p_mtype)
3779 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout, cd.cldFH, p_cachelistings)
3780 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)
3781 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!active) /* Active */
3782 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!active) /* Active */
3783
3784 hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
3785
3786 md5 = rexx_md5(hashstr)
3787
3788 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh,md5)
3789
3790 SELECT
3791 WHEN p_share == '' & p_server \= '' THEN DO /* all shares on server */
3792 IF p_workgroup == '' THEN
3793 userdata = userdata';\\'p_server'\*'
3794 ELSE
3795 userdata = userdata';'p_workgroup':\\'p_server'\*'
3796 END
3797 WHEN p_server == '' & p_workgroup \= '' THEN /* all servers in workgroup */
3798 userdata = userdata';'p_workgroup':\\*'
3799 WHEN p_server == '' & p_workgroup == '' THEN /* all workgroups */
3800 userdata = userdata';*:\\*'
3801 OTHERWISE DO
3802 IF p_workgroup == '' THEN
3803 userdata = userdata';\\'p_server'\'p_share
3804 ELSE
3805 userdata = userdata';'p_workgroup':\\'p_server'\'p_share
3806 END
3807 END
3808 end
3809
3810 if options.!debug == 1 then say ' returning "'userdata'"'
3811 if options.!debug == 1 then say time()' ParseResourceData done'
3812RETURN userdata
3813
3814/*:VRX ParseResParmString
3815*/
3816ParseResParmString:
3817 PARSE VAR resource . ';WORKGROUP=' p_workgroup ';' .
3818 PARSE VAR resource . ';SERVER=' p_server ';' .
3819 PARSE VAR resource . ';SHARE=' p_share ';' .
3820 PARSE VAR resource . ';USER=' p_user ';' .
3821 PARSE VAR resource . ';PASSWORD=' p_password ';' .
3822 PARSE VAR resource . ';SPASSWORD=' p_spassword ';' .
3823 PARSE VAR resource . ';MASTER=' p_master ';' .
3824 PARSE VAR resource . ';MASTERTYPE=' p_mtype ';' .
3825 PARSE VAR resource . ';MEMLEN=' p_memlen ';' .
3826 PARSE VAR resource . ';LOGFILE=' p_logfile ';' .
3827 PARSE VAR resource . ';LOGLEVEL=' p_loglevel ';' .
3828 PARSE VAR resource . ';CTO=' p_cachetimeout ';' .
3829 PARSE VAR resource . ';CLD=' p_cachelistings ';' .
3830 PARSE VAR resource . ';EASUPPORT=' p_easupport ' '
3831return
3832/*:VRX PB_ABOUT_CLOSE_Click
3833*/
3834PB_ABOUT_CLOSE_Click:
3835 CALL SW_ABOUT_Close
3836return
3837
3838/*:VRX PB_ABOUT_COPY_Click
3839*/
3840PB_ABOUT_COPY_Click:
3841 ok = VRMethod( "Application", "PutClipboard", AboutStr )
3842 if options.!debug == 1 then call beep 880*2,10
3843 CALL SW_ABOUT_Close
3844return
3845
3846/*:VRX PB_ADVANCED_APPLY_Click
3847*/
3848PB_ADVANCED_APPLY_Click:
3849 advanced.!easupport = VRGet( "CB_EAS", "Set" )
3850 advanced.!readonly = VRGet( "CB_READONLY", "Set" )
3851 advanced.!alwaysmp = VRGet( "CB_ALWAYSMP", "Set" )
3852 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT", "Value" )
3853 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS", "Value" )
3854
3855 /* Obsolete */
3856 advanced.!memlen = VRGet( "SPB_MEMLEN", "Value" )
3857return
3858
3859/*:VRX PB_ADVANCED_HELP_Click
3860*/
3861PB_ADVANCED_HELP_Click:
3862 CALL VRMethod 'SW_ADVANCED', 'InvokeHelp'
3863return
3864
3865/*:VRX PB_ADVANCED_UNDO_Click
3866*/
3867PB_ADVANCED_UNDO_Click:
3868 CALL SW_ADVANCED_Init_Content
3869RETURN
3870
3871/*:VRX PB_ClearCred_Click
3872*/
3873PB_ClearCred_Click:
3874 call Menu_File_ucCred_Reset_Click
3875return
3876
3877/*:VRX PB_CONDET_HELP_Click
3878*/
3879PB_CONDET_HELP_Click:
3880 CALL VRMethod 'GB_CONDET', 'InvokeHelp'
3881return
3882
3883/*:VRX PB_CONDET_LOAD_Click
3884*/
3885PB_CONDET_LOAD_Click:
3886 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click started"
3887 call Menu_File_Load_Click
3888 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click done"
3889RETURN
3890
3891/*:VRX PB_CONDET_SAVE_Click
3892*/
3893PB_CONDET_SAVE_Click: PROCEDURE EXPOSE settings. options. icons. Profile fs. cd. advanced. samba.
3894 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click started"
3895
3896 if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
3897 ELSE filename = Profile
3898
3899 IF filename == '' THEN RETURN
3900
3901 IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
3902 btns.0 = 2
3903 btns.1 = NLVGetMessage( 6 )
3904 if btns.1 = "" then btns.1 = '[Yes]'
3905 btns.2 = NLVGetMessage( 7 )
3906 if btns.2 = "" then btns.2 = '[No]'
3907 Title = NLVGetMessage( 53 )
3908 if Title = "" then Title = "[File exists]"
3909 Text = NLVGetMessage( 54, filename )
3910 if Text = "" then Text = "[File "filename" exists? Overwrite?]"
3911
3912 confirm = VRMessage('Main', Text, Title, 'W', 'btns.', 1, 2 )
3913 IF confirm \= 1 THEN RETURN
3914 CALL VRChAttr filename,, 'HSR'
3915 CALL VRDeleteFile filename
3916 END
3917
3918 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
3919 DO i = 1 TO records.0
3920 resource = ""
3921 resource = resource||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
3922 resource = resource||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
3923 resource = resource||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3924 resource = resource||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3925 resource = resource||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3926 resource = resource||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
3927 resource = resource||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3928 resource = resource||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3929 resource = resource||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3930 resource = resource||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
3931 resource = resource||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
3932 resource = resource||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
3933 resource = resource||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
3934 resource = resource||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
3935 resource = resource||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
3936/* resource = resource||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
3937 resource = resource||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
3938 resource = resource||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
3939 resource = resource||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
3940 resource = resource||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
3941 call lineout filename, resource
3942 END
3943 CALL STREAM filename, 'C', 'CLOSE'
3944
3945 if options.!autostart == 0 THEN do
3946 Title = NLVGetMessage( 51 )
3947 if Title = "" then Title = "[Profile saved]"
3948 Text = NLVGetMessage( 52, filename )
3949 if Text = "" then Text = "[Profile saved to "filename"!]"
3950 CALL VRMessage 'Main', Text , Title, 'I'
3951 end
3952
3953 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click done"
3954RETURN
3955
3956/*:VRX PB_DETACH_Click
3957*/
3958PB_DETACH_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
3959 if options.!debug == 1 then say time()' '||"PB_DETACH_Click started"
3960 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
3961 IF select.0 < 1 THEN RETURN
3962
3963 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
3964 PARSE VAR userdata mountpoint ';' mounts ';' .
3965 drive = STRIP( mountpoint, 'T', '\')
3966
3967 btns.0 = 2
3968 btns.1 = NLVGetMessage( 6 )
3969 btns.2 = NLVGetMessage( 7 )
3970 confirm = VRMessage('Main', NLVGetMessage( 58, drive ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3971 IF confirm \= 1 THEN RETURN
3972
3973 /* TODO: ?? Unmount & delete all child mountpoints? - Do we need this? */
3974 /* FIXME: This is potentially dangerous on Netdrive - what happens with unknown mount types? */
3975 /* FIXME: Unclear under which circumstances we have an alpha value here (which crahed EVFSGUI) */
3976 if datatype(mounts) = 'NUM' then do
3977 /* Unmount any resources */
3978 DO i = 1 TO mounts
3979 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
3980 END
3981 end
3982 else if options.!debug == 1 then say ' '||"mounts = "mounts
3983
3984 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"drive"')"
3985
3986 CALL Refresh
3987 if options.!debug == 1 then say time()' '||"PB_DETACH_Click done"
3988RETURN
3989
3990/*:VRX PB_DIALOG_HELP_Click
3991*/
3992PB_DIALOG_HELP_Click:
3993 CALL VRMethod 'GB_DIALOG', 'InvokeHelp'
3994return
3995
3996/*:VRX PB_EDIT_CANCEL_Click
3997*/
3998PB_EDIT_CANCEL_Click:
3999 options.!editmode = 0
4000 CALL VRSet "PB_UNMOUNT","Enabled", 1
4001 CALL VRSet "GB_CURRENT", "ENABLED", 1
4002 ok = VRSet("PB_EDIT_CANCEL","Visible", 0)
4003 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(13)" " )
4004/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
4005RETURN 0
4006
4007/*:VRX PB_INFO_OK_Click
4008*/
4009PB_INFO_OK_Click:
4010 call SW_INFO_Close
4011RETURN
4012
4013/*:VRX PB_LOGIN_CANCEL_Click
4014*/
4015PB_LOGIN_CANCEL_Click:
4016 credentials.!entered = 0
4017 call SW_LOGIN_Close
4018RETURN
4019
4020/*:VRX PB_LOGIN_OK_Click
4021*/
4022PB_LOGIN_OK_Click:
4023 ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
4024 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value"))
4025 options.!storecreds = VRGet("CB_STORECREDS1","Set")
4026 credentials.!entered = 1
4027
4028 if p_server <> "" then do
4029 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
4030
4031 if word(ok,1) = "1" then do
4032 ok = VRSet("DT_STATUSBAR","Caption", NLVGetMessage(107, rpc.queryuser.FULL_NAME))
4033 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
4034 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
4035 end
4036 else do
4037 CALL VRMessage 'Main', VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS, NLVGetMessage(5), "E"
4038 end
4039 end
4040
4041 call SW_LOGIN_Close
4042RETURN
4043
4044/*:VRX PB_MOUNT_Click
4045*/
4046PB_MOUNT_Click:
4047 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click started"
4048 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
4049 say " network = "network
4050 if options.!editmode = 1 then do
4051 CALL PB_UNMOUNT_Click
4052 options.!editmode = 0
4053 ok = VRMethod("TDL_1","SetTabText", " "strip(NLVGetMessage(13))" ")
4054/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
4055
4056 CALL VRSet "PB_UNMOUNT","Enabled", 1
4057 CALL VRSet "GB_CURRENT", "ENABLED", 1
4058 end
4059
4060 options.!workgroup = ''
4061 options.!server = ''
4062 options.!share = ''
4063 options.!user = ''
4064 options.!password = ''
4065 options.!master = ''
4066 options.!mastertype = ''
4067 options.!memlen = advanced.!memlen
4068 options.!easupport = advanced.!easupport
4069 options.!readonly = advanced.!readonly
4070 options.!loglevel = advanced.!loglevel
4071 options.!logfile = advanced.!logfile
4072 options.!cachetimeout = advanced.!cachetimeout
4073 options.!cachelistings = advanced.!cachelistings
4074
4075 vfs.!drive = ''
4076 vfs.!mountpoint = ''
4077
4078 stype = VRGet( "CB_MOUNT", "Selected" )
4079 share = STRIP( VRGet( "EF_SHARE", "Value" ))
4080 server = STRIP( VRGet( "EF_SERVER", "Value" ))
4081 network = STRIP( VRGet( "EF_NETWORK", "Value" ))
4082 mtype = VRGet( "CHK_MTYPE", "Set" )
4083 userid = STRIP( VRGet( "EF_USER", "Value" ))
4084 password = STRIP( VRGet( "EF_PASSWORD", "Value" ))
4085 mdrive = VRGet( "CB_DRIVES", "SelectedText" )
4086 if mdrive = "" then mdrive = VRGet( "CB_DRIVES", "Value" )
4087 mpath = STRIP( VRGet( "EF_DIRECTORY", "Value" ))
4088
4089 IF ( stype < 1 | stype > 4 ) THEN stype = 1
4090
4091 /* The required/optional/ignored parameters depend on the type of mount
4092 * requested. (Note, however, that the user, password, easupport and
4093 * memlen parameters are always optional.)
4094 */
4095 SELECT
4096 /* Scenario 1: Mount a single share.
4097 * Required: share, server
4098 * Optional: workgroup
4099 * Unused: master, mastertype
4100 */
4101 WHEN stype = 1 THEN DO
4102 IF server == '' | share == '' THEN DO
4103 /* error */
4104 RETURN 1
4105 END
4106 options.!server = server
4107 options.!share = share
4108 options.!workgroup = network
4109 END
4110
4111 /* Scenario 2: Mount all shares on a server.
4112 * Required: server
4113 * Optional: workgroup
4114 * Unused: share, master, mastertype
4115 */
4116 WHEN stype = 2 THEN DO
4117 IF server == '' THEN DO
4118 /* error */
4119 RETURN 1
4120 END
4121 options.!server = server
4122 options.!workgroup = network
4123 END
4124
4125 /* Scenario 3: Mount all servers in a workgroup.
4126 * Required: workgroup
4127 * Optional: -
4128 * Unused: share, server, master, mastertype
4129 */
4130 WHEN stype = 3 THEN DO
4131 IF workgroup == '' THEN DO
4132 /* error */
4133 RETURN 1
4134 END
4135 options.!workgroup = network
4136 END
4137
4138 /* Scenario 4: Mount all workgroups known to a master.
4139 * Required: master, mastertype
4140 * Optional: -
4141 * Unused: share, server, workgroup
4142 */
4143 WHEN stype = 4 THEN DO
4144 IF master == '' | mastertype == '' THEN DO
4145 /* error */
4146 RETURN 1
4147 END
4148 options.!master = network
4149 options.!mastertype = mtype
4150 END
4151 END
4152
4153 options.!user = userid
4154 options.!password = password
4155
4156 vfs.!drive = mdrive
4157 vfs.!mountpoint = mdrive'\'mpath
4158
4159 CALL Mount
4160 CALL Refresh
4161 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 1)
4162 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click done"
4163RETURN 0
4164
4165/*:VRX PB_NEWMOUNTPOINTCANCEL_Click
4166*/
4167PB_NEWMOUNTPOINTCANCEL_Click:
4168 ok = VRSet("CB_DRIVES","Value","")
4169 ok = VRSet("EF_DIRECTORY","Value","")
4170 call SW_MOUNTPOINT_Close
4171RETURN 0
4172
4173/*:VRX PB_NEWMOUNTPOINTOK_Click
4174*/
4175PB_NEWMOUNTPOINTOK_Click:
4176 ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4177 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4178
4179 advanced.!readonly = VRGet("CB_READONLY1","Set")
4180 advanced.!easupport = VRGet("CB_EAS1","Set")
4181 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4182 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4183 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4184
4185 call SW_MOUNTPOINT_Close
4186RETURN
4187
4188/*:VRX PB_NEWPORTCANCEL_Click
4189*/
4190PB_NEWPORTCANCEL_Click:
4191/* ok = VRSet("CB_DRIVES","Value","")
4192 ok = VRSet("EF_DIRECTORY","Value","")
4193 call SW_MOUNTPOINT_Close */
4194RETURN 0
4195
4196/*:VRX PB_NEWPORTCONNECT_Click
4197*/
4198PB_NEWPORTCONNECT_Click:
4199/* ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4200 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4201
4202 advanced.!readonly = VRGet("CB_READONLY1","Set")
4203 advanced.!easupport = VRGet("CB_EAS1","Set")
4204 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4205 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4206 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4207
4208 call SW_MOUNTPOINT_Close */
4209RETURN
4210
4211/*:VRX PB_PROGRESS_ABORT_Click
4212*/
4213PB_PROGRESS_ABORT_Click:
4214 options.!delay = 0
4215 options.!autoload = 0
4216 options.!autoclose = 0
4217 call SW_PROGRESS_Close
4218return
4219
4220/*:VRX PB_SETTINGS_APPLY_Click
4221*/
4222PB_SETTINGS_APPLY_Click:
4223 advanced.!loglevel = VRGet("SPIN_LOGLEVEL", "Value" )
4224 advanced.!logfile = VRGet("EF_LOGFILE", "Value" )
4225 advanced.!browseauth = VRGet("CB_BROWSEAUTH", "Set" )
4226 advanced.!browseimme = VRGet("CB_BROWSEIMME", "Set" )
4227 advanced.!special = VRGet("CB_SPECIAL", "Set" )
4228 advanced.!savepassive = VRGet("CB_SAVEPASSIVE","Set" )
4229 advanced.!lmhosts = VRGet("CB_LMHOSTS", "Set" )
4230 advanced.!broadcast = VRGet("CB_BROADCAST", "Set" )
4231 advanced.!miniicons = VRGet("CB_MINIICONS", "Set" )
4232
4233 /* Note: CB_LOGGING has its own event tied to the click */
4234 options.!storecreds = VRGet("CB_STORECREDS", "Set" )
4235 options.!debug = VRGet("CB_DEBUG", "Set" )
4236
4237 if options.!debug == 1 then do /* Turn on additional columns in connection details view */
4238 ok = VRRedirectStdio("ON")
4239 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 1)
4240 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 1)
4241 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 1)
4242 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 1)
4243 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 1)
4244 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 1)
4245 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 1)
4246 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 1)
4247 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 1)
4248 end
4249 else do /* Turn on additional columns in connection details view */
4250 ok = VRRedirectStdio("OFF")
4251 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 0)
4252 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 0)
4253 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 0)
4254 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 0)
4255 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 0)
4256 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 0)
4257 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 0)
4258 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 0)
4259 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 0)
4260 end
4261
4262 ok = VRset("CN_CURRENT", "MiniIcons", advanced.!miniicons)
4263 ok = VRset("CN_SMBTREE", "MiniIcons", advanced.!miniicons)
4264 ok = VRset("CN_CONDET", "MiniIcons", advanced.!miniicons)
4265
4266 if advanced.!lmhosts = 1 then do
4267 call _LMHostsRead
4268 call _LMHostsUpdate
4269 end
4270 if advanced.!smbconfchanged = 1 then do
4271 name_resolve_order = VRGet("SPIN_NRO1","value")' 'VRGet("SPIN_NRO2","value")' 'VRGet("SPIN_NRO3","value")' 'VRGet("SPIN_NRO4","value")
4272 handle = IniOpen('global', samba.!smbconf)
4273 call IniSet 'name resolve order', name_resolve_order, handle
4274 /* FIXME: Throw an error in this case */
4275 if \_IsValidIPAddress(VRGet("EF_WINS_SERVER","Value")) then ok = VRSet("EF_WINS_SERVER","Value","")
4276 call IniSet 'wins server', VRGet("EF_WINS_SERVER","Value"), handle
4277 call IniSave handle
4278 call IniClose handle
4279 advanced.!smbconfchanged = 0
4280 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 0)
4281 end
4282 if options.!storecreds = 0 then call Menu_File_ucCred_Reset_Click
4283return
4284
4285/*:VRX PB_SETTINGS_HELP_Click
4286*/
4287PB_SETTINGS_HELP_Click:
4288 CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
4289return
4290
4291/*:VRX PB_SETTINGS_UNDO_Click
4292*/
4293PB_SETTINGS_UNDO_Click:
4294 call SW_SETTINGS_Init_Content
4295return
4296
4297/*:VRX PB_SMBTREE_CONNECT_Click
4298*/
4299PB_SMBTREE_CONNECT_Click: PROCEDURE EXPOSE settings. options. icons. fs. advanced. cd. samba. mtype.
4300 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click started"
4301
4302 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
4303
4304 if SelRH.0 = 0 then do
4305 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click aborted"
4306 return
4307 end
4308
4309 p_workgroup = ''
4310 p_server = ''
4311 p_share = ''
4312
4313 srcFile = ""
4314 srcCtn = VRGet("CN_SMBTREE","Self")
4315 srcRec = SelRH.1
4316 trgCtn = VRGet("CN_CURRENT","Self")
4317 trgRec = ""
4318
4319 if options.!debug == 1 then do
4320 say ' srcCtn = "'srcCtn'"'
4321 if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
4322 say ' srcRec = "'srcRec'"'
4323 say ' trgCtn = "'trgCtn'"'
4324 if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
4325 say ' trgRec = "'trgRec'"'
4326 end
4327
4328 ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
4329
4330 DragCapt = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Caption")
4331 ParentRH = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Parent")
4332
4333 if ParentRH = "" then do /* A workgroup was dragged */
4334 say "Workgroup dragged!"
4335 parse var DragCapt p_workgroup '0D0A'x .
4336 p_workgroup = strip(p_workgroup)
4337 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4338 call _UpdateObject "EF_SERVER", ""
4339 ok = VRSet("EF_SHARE","Value","")
4340
4341 ShareLevel = 3
4342 end
4343 else do
4344 ParDragCapt = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Caption")
4345 GParentRH = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Parent")
4346
4347 if GParentRH = "" then do /* A server was dragged */
4348 say "Server dragged!"
4349 parse var ParDragCapt p_workgroup '0D0A'x .
4350 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4351 p_workgroup = strip(p_workgroup)
4352
4353 parse var DragCapt p_server '0D0A'x .
4354 p_server = strip(p_server)
4355 call _UpdateObject "EF_SERVER", p_server
4356 ok = VRSet("EF_Share","Value","")
4357
4358 ShareLevel = 2
4359 end
4360 else do /* A share was dragged */
4361 say "Share dragged!"
4362 GParDragCapt = VRMethod(srcCtn, "GetRecordAttr", GParentRH, "Caption")
4363
4364 parse var GParDragCapt p_workgroup '0D0A'x .
4365 p_workgroup = strip(p_workgroup)
4366 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4367
4368 parse var ParDragCapt p_server '0D0A'x .
4369 p_server = strip(p_server)
4370 call _UpdateObject "EF_SERVER", p_server
4371
4372 parse var DragCapt p_share '0D0A'x .
4373 p_share = strip(p_share)
4374 ok = VRSet("EF_Share","Value",strip(p_share))
4375
4376 ShareLevel = 1
4377 end
4378 end
4379
4380 say 'p_workgroup = "'p_workgroup'"'
4381 say 'p_server = "'p_server'"'
4382 say 'p_share = "'p_share'"'
4383
4384 ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
4385 call CB_MOUNT_Change
4386
4387 if trgRec = "" then do
4388 window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
4389 if VRGet("CB_DRIVES","Value") = "" then return
4390 end
4391 else do
4392
4393 TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
4394
4395 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
4396
4397 do while parTrgRH <> ""
4398 partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
4399 TargetString = partrgCapt||'\'||TargetString
4400 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
4401 end
4402 say 'TargetString = "'TargetString'"'
4403 ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
4404 ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
4405 end
4406
4407 window = VRLoadSecondary( "SW_LOGIN", "W" )
4408 if credentials.!entered = 1 then call PB_MOUNT_CLICK
4409
4410 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click done"
4411RETURN
4412
4413/*:VRX PB_SMBTREE_HELP_Click
4414*/
4415PB_SMBTREE_HELP_Click:
4416 CALL VRMethod 'GB_SMBTREE', 'InvokeHelp'
4417return
4418
4419/*:VRX PB_SMBTREE_REFRESH_Click
4420*/
4421PB_SMBTREE_REFRESH_Click: /* PROCEDURE EXPOSE settings. options. icons. fs. samba. debuglevel advanced. UserCred Refreshmode Tempdir */
4422 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click started"
4423
4424 if advanced.!browseauth = 1 & (UserCred = "--user=%" | UserCred = "" ) then do
4425 window = VRLoadSecondary( "SW_LOGIN", "W" )
4426 end
4427
4428 call _UserCredUpdate
4429 ok = VRset("Pict_Throbber", "Visible", 1)
4430 ok = VRset("Menu_Selected_Connect", "Visible", 0)
4431 ok = VRset("TM_Throbber", "Enabled", 1)
4432 ShowHidden = advanced.!special
4433 BroadCast = advanced.!broadcast
4434 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
4435 ok = time('R')
4436 call _RefreshTree
4437 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click done"
4438RETURN
4439
4440/*:VRX PB_UNMOUNT_Click
4441*/
4442PB_UNMOUNT_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
4443 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click started"
4444 if options.!debug == 1 then say time()' '||'options.!editmode = 'options.!editmode
4445 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
4446 IF select.0 < 1 THEN RETURN
4447
4448 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
4449 PARSE VAR userdata mountpoint ';' mounts ';' .
4450say 'userdata="'userdata'"'
4451 IF mounts > 0 & options.!editmode = 0 THEN DO
4452 btns.0 = 2
4453 btns.1 = NLVGetMessage( 6 )
4454 btns.2 = NLVGetMessage( 7 )
4455 confirm = VRMessage('Main', NLVGetMessage( 57, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
4456 IF confirm \= 1 THEN RETURN
4457 END
4458
4459 /* Unmount any resources */
4460 DO i = 1 TO mounts
4461 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
4462 END
4463
4464 /* Delete mountpoint */
4465 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', select.1, 'Parent')
4466 IF parent \= '' THEN DO
4467 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"mountpoint"')"
4468 END
4469
4470 CALL Refresh
4471 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click done"
4472RETURN 0
4473
4474/*:VRX Pict_PWINMEM_Click
4475*/
4476Pict_PWINMEM_Click:
4477 if VRGet("Pict_PWINMEM","PicturePath") = "#36" then do
4478 call Menu_File_ucCred_Reset_Click
4479 end
4480return
4481
4482/*:VRX Quit
4483*/
4484Quit:
4485 if Fatal <> 1 then CALL _INISave
4486 /* ok = VRREdirectSTdio("OFF") */
4487 window = VRWindow()
4488 call VRSet window, "Shutdown", 1
4489 drop window
4490RETURN
4491
4492/*:VRX Refresh
4493*/
4494Refresh:
4495 if options.!debug == 1 then say time()' Refresh started'
4496 CALL VRSet "CN_CURRENT", 'Painting', 0
4497
4498 CALL VRMethod "CN_CURRENT", 'RemoveRecord', 'All'
4499
4500 /* Remove Active connections from details view */
4501 ok = VRMethod( "CN_CONDET", "GetRecordList", 'All', "rh." )
4502
4503 do I = 1 to rh.0
4504 /* This catches the bug we observed exactly once and were unable to reproduce! */
4505 if cd.statusfh = 'CD.STATUSFH' then do
4506 if options.!debug == 1 then call beep 880, 50
4507 if options.!debug == 1 then call beep 880, 50
4508 if options.!debug == 1 then say " cd.statusfh is undefined - check why!!!!!!"
4509 leave
4510 end
4511 if options.!debug == 1 then say ' Icon.'i' = "'||VRMethod( "CN_CONDET", "GetFieldData", rh.i, cd.statusfh)'"'
4512 if VRMethod("CN_CONDET","GetFieldData", rh.i, cd.statusfh) = icons.!active then CALL VRMethod "CN_CONDET", 'RemoveRecord', rh.i
4513 end
4514
4515/* call _AddTemplates */
4516 CALL VRSet "PB_DETACH", "Enabled", 0
4517 CALL VRSet "PB_UNMOUNT", "Enabled", 0
4518
4519 ok = VRSet("MENU_CONTEXT_OPEN", "Visible", 0)
4520/* ok = VRSet("MENU_CONTEXT_SEP1", "Visible", 0) */
4521 ok = VRSet("MENU_CONTEXT_DETACH", "Visible", 0)
4522 ok = VRSet("MENU_CONTEXT_UNMOUNT", "Visible", 0)
4523 ok = VRSet("MENU_CONTEXT_EDIT", "Visible", 0)
4524
4525 ok = VRSet("MENU_SELECTED_REMOVE", "Visible", 0)
4526 ok = VRSet("MENU_SELECTED_RETRY", "Visible", 0)
4527
4528 if options.!debug == 1 then say ' Remove records, disable buttons done.'
4529
4530 CALL VRMethod 'CB_DRIVES', 'Clear'
4531
4532 CALL VRSet "CN_CURRENT", "Caption", fs.!Name' 'fs.!version
4533
4534 /* Herwig B.: Attention! The SysDrivemap function with the "free" parameter causes hangs in case it is called repeatedly! */
4535 drvs = MyFreeDriveMap('C:', 'FREE')
4536
4537 DO i = 1 TO WORDS( drvs )
4538 drvstem.i = WORD( drvs, i )
4539 END
4540
4541 drvstem.0 = WORDS( drvs )
4542
4543 /* Add any existing EVFS drives */
4544 CALL GetMountPoints
4545
4546 CALL VRMethod "CB_DRIVES", "AddStringList", "drvstem."
4547 CALL VRSet "CN_CURRENT", 'Painting', 1
4548 if options.!debug == 1 then say time()' '||"Refresh done"
4549RETURN 0
4550
4551/*:VRX SPIN_NRO1_Change
4552*/
4553SPIN_NRO1_Change:
4554 advanced.!smbconfchanged = 1
4555return
4556
4557/*:VRX SPIN_NRO2_Change
4558*/
4559SPIN_NRO2_Change:
4560 advanced.!smbconfchanged = 1
4561return
4562
4563/*:VRX SPIN_NRO3_Change
4564*/
4565SPIN_NRO3_Change:
4566 advanced.!smbconfchanged = 1
4567return
4568
4569/*:VRX SPIN_NRO4_Change
4570*/
4571SPIN_NRO4_Change:
4572 advanced.!smbconfchanged = 1
4573return
4574
4575/*:VRX SPLIT_Main_Move
4576*/
4577SPLIT_Main_Move:
4578 ok = VRset("Main", "Painting", 0)
4579 NewPos = VRInfo("Left")
4580 OldPos = VRGet("SPLIT_Main","Left")
4581 ok = VRSet("SPLIT_Main","Left", NewPos)
4582 ok = VRset("GB_SMBTREE","Left", NewPos+60)
4583 call Main_Resize
4584 ok = VRset("Main", "Painting", 1)
4585return
4586
4587/*:VRX SW_ABOUT_Close
4588*/
4589SW_ABOUT_Close:
4590 call SW_ABOUT_Fini
4591return
4592
4593/*:VRX SW_ABOUT_Create
4594*/
4595SW_ABOUT_Create:
4596 call SW_ABOUT_Init
4597
4598 CALL NLVSetText 'SW_ABOUT', "Caption", 1
4599 CALL NLVSetText 'PB_ABOUT_CLOSE', "Caption", 29
4600 CALL NLVSetText 'PB_ABOUT_COPY', "Caption", 121
4601 CALL NLVSetText 'CB_TRAC', "Caption", 134
4602
4603 ok = VRSet("DT_About","Caption", Program' (c) 2007-2013 Alexander Taylor'||'0D0A'x||'and Herwig Bauernfeind for bww bitwise works GmbH.')
4604
4605 About.DscFH = VRMethod( "CN_ABOUT", "AddField", "String", "Component" )
4606 About.ValFH = VRMethod( "CN_ABOUT", "AddField", "String", "Version" )
4607
4608 call _AboutSambaClientGetInfo
4609
4610return
4611/*:VRX SW_ABOUT_Fini
4612*/
4613SW_ABOUT_Fini:
4614 window = VRInfo( "Window" )
4615 call VRDestroy window
4616 drop window
4617return
4618/*:VRX SW_ABOUT_Init
4619*/
4620SW_ABOUT_Init:
4621 window = VRInfo( "Object" )
4622 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
4623 call VRMethod window, "CenterWindow"
4624 call VRSet window, "Visible", 1
4625 call VRMethod window, "Activate"
4626 end
4627 drop window
4628return
4629
4630/*:VRX SW_ADVANCED_Close
4631*/
4632SW_ADVANCED_Close:
4633 call SW_ADVANCED_Fini
4634return
4635
4636/*:VRX SW_ADVANCED_Create
4637*/
4638SW_ADVANCED_Create:
4639 call SW_ADVANCED_Init
4640return
4641
4642/*:VRX SW_ADVANCED_Fini
4643*/
4644SW_ADVANCED_Fini:
4645 window = VRInfo( "Window" )
4646 call VRDestroy window
4647 drop window
4648return
4649/*:VRX SW_ADVANCED_Init
4650*/
4651SW_ADVANCED_Init:
4652 /* Title bar */
4653 CALL NLVSetText "SW_ADVANCED", "Caption", 40
4654
4655 /* Options */
4656 CALL NLVSetText "GB_ADVANCED", "Caption", 43
4657 CALL NLVSetText "CB_EAS", "Caption", 44
4658 CALL NLVSetText "CB_READONLY", "Caption", 45
4659 CALL NLVSetText "CB_ALWAYSMP", "Caption", 65
4660 CALL NLVSetText "DT_CACHETIMEOUT", "Caption", 130
4661 CALL NLVSetText "DT_CACHELISTINGS", "Caption", 131
4662
4663 /* Buttons */
4664 CALL NLVSetText "PB_ADVANCED_APPLY", "Caption", 122
4665 CALL NLVSetText "PB_ADVANCED_UNDO", "Caption", 123
4666 CALL NLVSetText "PB_ADVANCED_HELP", "Caption", 4
4667
4668 CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40)
4669
4670/* call VRMethod "SW_ADVANCED", "CenterWindow" */
4671 ok = VRSet("SW_ADVANCED", "Visible", 1)
4672/* call VRMethod "SW_ADVANCED", "Activate" */
4673return
4674
4675/*:VRX SW_ADVANCED_Init_Content
4676*/
4677SW_ADVANCED_Init_Content:
4678 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS", "Set", advanced.!easupport)
4679 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY","Set", advanced.!readonly)
4680 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP","Set", advanced.!alwaysmp)
4681 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT", "Value", advanced.!cachetimeout)
4682 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS", "Value", advanced.!cachelistings)
4683
4684 /* Obsolete */
4685 IF advanced.!memlen \= "" THEN ok = VRSet("SPB_MEMLEN", "Value", advanced.!memlen)
4686return
4687
4688/*:VRX SW_CONDET_Close
4689*/
4690SW_CONDET_Close:
4691 call SW_CONDET_Fini
4692return
4693
4694/*:VRX SW_CONDET_Create
4695*/
4696SW_CONDET_Create:
4697 call SW_CONDET_Init
4698return
4699
4700/*:VRX SW_CONDET_Fini
4701*/
4702SW_CONDET_Fini:
4703 window = VRInfo( "Window" )
4704 call VRDestroy window
4705 drop window
4706return
4707/*:VRX SW_CONDET_Init
4708*/
4709SW_CONDET_Init:
4710
4711return
4712
4713/*:VRX SW_CONDET_Init_Content
4714*/
4715SW_CONDET_Init_Content:
4716 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
4717
4718 /* Hide any "foreign" menu entries */
4719 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
4720return
4721
4722/*:VRX SW_DIALOG_Close
4723*/
4724SW_DIALOG_Close:
4725 call SW_DIALOG_Fini
4726return
4727
4728/*:VRX SW_DIALOG_Create
4729*/
4730SW_DIALOG_Create:
4731 call SW_DIALOG_Init
4732return
4733
4734/*:VRX SW_DIALOG_Fini
4735*/
4736SW_DIALOG_Fini:
4737 window = VRInfo( "Window" )
4738 call VRDestroy window
4739 drop window
4740return
4741/*:VRX SW_DIALOG_Init
4742*/
4743SW_DIALOG_Init:
4744 LEDSize = VRMethod( "Screen", "PixelsToTwips", 16 )
4745
4746 ok = VRSet("Pict_PWINMEM","Top", VRGet("EF_USER","Top")+(VRGet("EF_USER","Height")-LEDSize)%2)
4747 ok = VRSet("Pict_PWINMEM","Width", LEDSize)
4748 ok = VRSet("Pict_PWINMEM","Height", LEDSize)
4749return
4750
4751/*:VRX SW_DIALOG_Init_Content
4752*/
4753SW_DIALOG_Init_Content:
4754 /* obsolete */
4755 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
4756
4757 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
4758 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
4759 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
4760
4761 call _DialogPopulate
4762return
4763
4764/*:VRX SW_INFO_Close
4765*/
4766SW_INFO_Close:
4767 call SW_INFO_Fini
4768return
4769
4770/*:VRX SW_INFO_Create
4771*/
4772SW_INFO_Create:
4773 if options.!debug == 1 then say time()' SW_INFO_Create started'
4774 call SW_INFO_Init
4775 CALL NLVSetText 'SW_INFO', "Caption", 92
4776 CALL NLVSetText 'PB_INFO_OK', "Caption", 2
4777 Info.TypeFH = VRMethod( "CN_INFO", "AddField", "String", "Type" )
4778 Info.ValueFH = VRMethod( "CN_INFO", "AddField", "String", "Value" )
4779
4780 if options.!debug == 1 then do
4781 say ' Handle: "'SMBObj.rh'"'
4782 say ' Resource: "'SMBObj.resname'"'
4783 say ' Comment: "'SMBObj.comment'"'
4784 say ' Type: "'SMBObj.udatatype'"'
4785 say ' Message: "'SMBObj.udatamsg'"'
4786 say ' Icon: "'SMBObj.icon'"'
4787 end
4788say "Vorher:"rpc.srvinfo.OS_VERSION
4789 drop rpc.
4790say "Vorher:"rpc.srvinfo.OS_VERSION
4791 rpc_success = _rpcsrvinfo(SMBObj.resname,credentials.!username,credentials.!password)
4792
4793 Info.!nbname = VRMethod( "CN_INFO", "AddRecord")
4794 Info.!comment = VRMethod( "CN_INFO", "AddRecord")
4795 Info.!domain = VRMethod( "CN_INFO", "AddRecord")
4796 Info.!DMBLMB = VRMethod( "CN_INFO", "AddRecord")
4797 if rpc_success = 1 then Info.!capabilities = VRMethod( "CN_INFO", "AddRecord")
4798 Info.!os = VRMethod( "CN_INFO", "AddRecord")
4799 Info.!server = VRMethod( "CN_INFO", "AddRecord")
4800 if rpc_success = 1 then Info.!version = VRMethod( "CN_INFO", "AddRecord")
4801 Info.!status = VRMethod( "CN_INFO", "AddRecord")
4802 Info.!IP = VRMethod( "CN_INFO", "AddRecord")
4803 Info.!MAC = VRMethod( "CN_INFO", "AddRecord")
4804
4805 if rpc_success = 1 then do
4806 if rpc.srvinfo.OS_VERSION = 'RPC.SRVINFO.OS_VERSION' then rpc.srvinfo.OS_VERSION = ''
4807 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, rpc.srvinfo.NETBIOSNAME)
4808 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, rpc.srvinfo.SERVERSTRING)
4809 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!capabilities, Info.TypeFH, strip(NLVGetMessage(138),'T',':'),Info.ValueFH, rpc.srvinfo.CAPABILITIES)
4810 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!version,Info.TypeFH, strip(NLVGetMessage(139),'T',':'),Info.ValueFH, rpc.srvinfo.OS_VERSION)
4811 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'),Info.ValueFH, rpc.srvinfo.LOGONSTATUS )
4812 /* we did not get these, but we know them anyway */
4813 if rpc.srvinfo.NETBIOSNAME = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
4814 if rpc.srvinfo.SERVERSTRING = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
4815 end
4816 else do
4817 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
4818 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
4819 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'), Info.ValueFH, SMBObj.udatamsg)
4820 end
4821
4822 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, WorkGroupFH ))
4823 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os, Info.TypeFH, strip(NLVGetMessage(93), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, OSFH ))
4824 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, VersionFH ))
4825 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!DMBLMB, Info.TypeFH, strip(NLVGetMessage(124),'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MBFH ))
4826 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!IP, Info.TypeFH, "IP" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, IPFH ))
4827 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!MAC, Info.TypeFH, "MAC" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MacFH ))
4828
4829 if options.!debug == 1 then say time()' SW_INFO_Create done'
4830return
4831
4832/*:VRX SW_INFO_Fini
4833*/
4834SW_INFO_Fini:
4835 window = VRInfo( "Window" )
4836 call VRDestroy window
4837 drop window
4838return
4839/*:VRX SW_INFO_Init
4840*/
4841SW_INFO_Init:
4842 window = VRInfo( "Object" )
4843 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
4844 call VRMethod window, "CenterWindow"
4845 call VRSet window, "Visible", 1
4846 call VRMethod window, "Activate"
4847 end
4848 drop window
4849return
4850
4851/*:VRX SW_LOGIN_Close
4852*/
4853SW_LOGIN_Close:
4854 call SW_LOGIN_Fini
4855return
4856
4857/*:VRX SW_LOGIN_Create
4858*/
4859SW_LOGIN_Create:
4860 call SW_LOGIN_Init
4861 ok = VRSet("SW_LOGIN","Caption",NLVGetMessage(136)' 'strip(p_workgroup' \\'p_server'\'p_share,'T','\'))
4862 CALL NLVSetText 'DT_USER1', "Caption", 25
4863 CALL NLVSetText 'DT_PASSWORD1', "Caption", 26
4864 CALL NLVSetText 'CB_STORECREDS1', "Caption", 135
4865 CALL NLVSetText 'PB_LOGIN_OK', "Caption", 2
4866 CALL NLVSetText 'PB_LOGIN_CANCEL',"Caption", 3
4867
4868 if VRIsValidObject(SMBObj.rh) then do
4869 select
4870 when pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.rh, MBFH)) > 0 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
4871 when SMBObj.udatatype = "WORKGROUP" then LoginIcon = SMBObj.Icon
4872 when SMBObj.udatatype = "SERVER" then LoginIcon = SMBObj.Icon
4873 when SMBObj.udatatype = "DISK" then do
4874 if pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.parentrh, MBFH)) > 0
4875 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
4876 else LoginIcon = "#35:PMWP.DLL" /* icons.!pdc */
4877 end
4878 otherwise LoginIcon = "#35:PMWP.DLL" /* icons.!machine_awake */
4879 end
4880 say loginicon
4881 ok = VRSet("Pict_Login","PicturePath", LoginIcon)
4882 end
4883 ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
4884 ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value"))
4885 ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
4886return
4887
4888/*:VRX SW_LOGIN_Fini
4889*/
4890SW_LOGIN_Fini:
4891 window = VRInfo( "Window" )
4892 call VRDestroy window
4893 drop window
4894return
4895/*:VRX SW_LOGIN_Init
4896*/
4897SW_LOGIN_Init:
4898 window = VRInfo( "Object" )
4899 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
4900 call VRMethod window, "CenterWindow"
4901 call VRSet window, "Visible", 1
4902 call VRMethod window, "Activate"
4903 end
4904 drop window
4905return
4906
4907/*:VRX SW_LOGIN_KeyPress
4908*/
4909SW_LOGIN_KeyPress:
4910 obj = VRInfo( "Object" )
4911 keystr = VRGet( obj, "KeyString" )
4912/* say keystr */
4913 select
4914 when keystr = "{Enter}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
4915 when keystr = "{Newline}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
4916 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
4917 otherwise nop
4918 end
4919return
4920
4921/*:VRX SW_MOUNTPOINT_Close
4922*/
4923SW_MOUNTPOINT_Close:
4924 call SW_MOUNTPOINT_Fini
4925return
4926
4927/*:VRX SW_MOUNTPOINT_Create
4928*/
4929SW_MOUNTPOINT_Create:
4930 call SW_MOUNTPOINT_Init
4931
4932 ok = VRSet("SW_MOUNTPOINT","Caption",strip(p_workgroup' \\'p_server'\'p_share,'T','\')) /* NLVGetMessage(14)' ' */
4933 CALL NLVSetText 'DT_MPOINT1', "Caption", 27
4934 CALL NLVSetText 'PB_NEWMOUNTPOINTOK', "Caption", 2
4935 CALL NLVSetText 'PB_NEWMOUNTPOINTCANCEL',"Caption", 3
4936 CALL NLVSetText 'CB_EAS1', "Caption", 44
4937 CALL NLVSetText 'CB_READONLY1', "Caption", 45
4938 CALL NLVSetText 'CB_ALWAYSMP1', "Caption", 65
4939 CALL NLVSetText "DT_CACHETIMEOUT1", "Caption", 130
4940 CALL NLVSetText "DT_CACHELISTINGS1", "Caption", 131
4941
4942 ok = VRMethod( "CB_DRIVES", "GetStringList", "freedrives." )
4943 ok = VRMethod( "CB_DRIVES1", "AddStringList", "freedrives." )
4944 ok = VRSet("CB_DRIVES1", "Value", VRGet("CB_Drives","Value"))
4945
4946 if VRGet("EF_Directory","Value") = "" then ok = VRSet("EF_DIRECTORY1", "Value", VRGet("EF_Directory","Value"))
4947
4948 ok = VRMethod("EF_DIRECTORY1","AddString",p_share)
4949
4950 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS1", "Set", advanced.!easupport)
4951 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY1", "Set", advanced.!readonly)
4952 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP1", "Set", advanced.!alwaysmp)
4953 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT1", "Value", advanced.!cachetimeout)
4954 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS1","Value", advanced.!cachelistings)
4955return
4956
4957/*:VRX SW_MOUNTPOINT_Fini
4958*/
4959SW_MOUNTPOINT_Fini:
4960 window = VRInfo( "Window" )
4961 call VRDestroy window
4962 drop window
4963return
4964/*:VRX SW_MOUNTPOINT_Init
4965*/
4966SW_MOUNTPOINT_Init:
4967 window = VRInfo( "Object" )
4968 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
4969 call VRMethod window, "CenterWindow"
4970 call VRSet window, "Visible", 1
4971 call VRMethod window, "Activate"
4972 end
4973 drop window
4974return
4975
4976/*:VRX SW_PORTCONNECT_Close
4977*/
4978SW_PORTCONNECT_Close:
4979 call SW_PORTCONNECT_Fini
4980return
4981
4982/*:VRX SW_PORTCONNECT_Create
4983*/
4984SW_PORTCONNECT_Create:
4985 call SW_PORTCONNECT_Init
4986
4987 ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
4988
4989 if ok = "" then do
4990
4991 end
4992 else do
4993 say "Samba Spooler Port driver installed!"
4994 ok = SysINI("SYSTEM","PM_SPOOLER_PORT","ALL:","ports")
4995 smbport.0 = 0
4996 do I = 1 to ports.0
4997 if left(ports.I,3) = "SMB" then do
4998 X = smbport.0
4999 X = X + 1
5000 smbport.0 = X
5001 smbport.X = ports.I
5002 end
5003 end
5004 do I = 1 to smbport.0
5005 say smbport.I
5006 end
5007 end
5008
5009return
5010
5011/*:VRX SW_PORTCONNECT_Fini
5012*/
5013SW_PORTCONNECT_Fini:
5014 window = VRInfo( "Window" )
5015 call VRDestroy window
5016 drop window
5017return
5018/*:VRX SW_PORTCONNECT_Init
5019*/
5020SW_PORTCONNECT_Init:
5021 window = VRInfo( "Object" )
5022 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
5023 call VRMethod window, "CenterWindow"
5024 call VRSet window, "Visible", 1
5025 call VRMethod window, "Activate"
5026 end
5027 drop window
5028return
5029
5030/*:VRX SW_PROGRESS_Close
5031*/
5032SW_PROGRESS_Close:
5033 options.!delay = 0
5034 call Main_Resize
5035 call VRSet 'Main', 'Visible', 1
5036 call SW_PROGRESS_Fini
5037return
5038
5039/*:VRX SW_PROGRESS_Create
5040*/
5041SW_PROGRESS_Create:
5042 call SW_PROGRESS_Init
5043 CALL NLVSetText 'SW_PROGRESS', "Caption", 1
5044 CALL NLVSetText 'DT_PROGRESS', "Caption", 34
5045 CALL NLVSetText 'PB_PROGRESS_ABORT', "Caption", 3
5046
5047 if options.!delay > 0 then ok = VRSet("TM_TheCloser","Delay", options.!delay*1000)
5048
5049 CALL VRSet "TM_Progress_Throbber","Enabled", 1
5050 CALL VRSet "TM_TheCloser","Enabled", 1
5051return
5052
5053/*:VRX SW_PROGRESS_Fini
5054*/
5055SW_PROGRESS_Fini:
5056 call VRDestroy "SW_PROGRESS"
5057return
5058/*:VRX SW_PROGRESS_Init
5059*/
5060SW_PROGRESS_Init:
5061 call VRMethod "SW_PROGRESS", "CenterWindow", "Parent"
5062 call VRSet "SW_PROGRESS", "Visible", 1
5063 call VRMethod "SW_PROGRESS", "Activate"
5064return
5065
5066/*:VRX SW_SETTINGS_Close
5067*/
5068SW_SETTINGS_Close:
5069 call SW_SETTINGS_Fini
5070return
5071
5072/*:VRX SW_SETTINGS_Create
5073*/
5074SW_SETTINGS_Create:
5075 call SW_SETTINGS_Init
5076return
5077
5078/*:VRX SW_SETTINGS_Fini
5079*/
5080SW_SETTINGS_Fini:
5081 window = VRInfo( "Window" )
5082 call VRDestroy window
5083 drop window
5084return
5085/*:VRX SW_SETTINGS_Init
5086*/
5087SW_SETTINGS_Init:
5088 /* Title bar */
5089 call NLVSetText "SW_SETTINGS", "Caption", 47
5090
5091 /* Options */
5092 call NLVSetText "GB_GLOBAL", "Caption", 47
5093 call NLVSetText "CB_DEBUG", "Caption", 42
5094 call NLVSetText "CB_LOGGING", "Caption", 46
5095 call NLVSetText "CB_BROWSEIMME", "Caption", 48
5096 call NLVSetText "CB_BROWSEAUTH", "Caption", 49
5097 call NLVSetText "CB_SPECIAL", "Caption", 66
5098 call NLVSetText "CB_SAVEPASSIVE", "Caption", 73
5099 call NLVSetText "CB_LMHOSTS", "Caption", 133
5100 call NLVSetText "CB_BROADCAST", "Caption", 74
5101 call NLVSetText "CB_MINIICONS", "Caption", 70
5102 call NLVSetText "CB_STORECREDS", "Caption", 135
5103
5104 /* Buttons */
5105 call NLVSetText "PB_SETTINGS_APPLY", "Caption", 122
5106 call NLVSetText "PB_SETTINGS_UNDO", "Caption", 123
5107 call NLVSetText "PB_SETTINGS_HELP", "Caption", 4
5108
5109/* call VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40) */
5110
5111/* call VRMethod "SW_SETTINGS", "CenterWindow" */
5112 ok = VRSet("SW_SETTINGS", "Visible", 1)
5113/* call VRMethod "SW_SETTINGS", "Activate" */
5114return
5115
5116/*:VRX SW_SETTINGS_Init_Content
5117*/
5118SW_SETTINGS_Init_Content:
5119 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 1)
5120
5121 if advanced.!browseauth \= "" then ok = VRSet("CB_BROWSEAUTH", "Set", advanced.!browseauth)
5122 if advanced.!browseimme \= "" then ok = VRSet("CB_BROWSEIMME", "Set", advanced.!browseimme)
5123 if advanced.!broadcast \= "" then ok = VRSet("CB_BROADCAST", "Set", advanced.!broadcast)
5124 if advanced.!special \= "" then ok = VRSet("CB_SPECIAL", "Set", advanced.!special)
5125 if advanced.!savepassive \= "" then ok = VRSet("CB_SAVEPASSIVE","Set", advanced.!savepassive)
5126 if advanced.!lmhosts \= "" then ok = VRSet("CB_LMHOSTS", "Set", advanced.!lmhosts)
5127
5128 call VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()"\ndpsmb.dbg")
5129 if options.!debug \= "" then ok = VRSet("CB_debug", "Set", options.!debug)
5130 if options.!storecreds \= "" then ok = VRSet("CB_STORECREDS", "Set", options.!storecreds)
5131
5132 if advanced.!miniicons \= "" then ok = VRSet("CB_MINIICONS", "Set", advanced.!miniicons)
5133
5134 /* Obsolete */
5135 if advanced.!logfile \= "" then ok = VRSet("EF_LOGFILE", "Value", advanced.!logfile)
5136 if advanced.!loglevel \= "0" then ok = VRSet("SPIN_LOGLEVEL", "Value", advanced.!loglevel)
5137
5138 call _SmbConfCreateShadowCopy
5139
5140 wins_support = translate(IniGet('wins support', 'global', samba.!shadowsmbconf))
5141
5142 if wins_support = "YES" then do /* we are a WINS server ourself */
5143 ok = VRSet("DT_WINS_SERVER","Enabled", 0)
5144 ok = VRSet("EF_WINS_SERVER","BackColor", "PaleGray")
5145 ok = VRSet("EF_WINS_SERVER","Value", "")
5146 ok = VRSet("EF_WINS_SERVER","Enabled", 0)
5147 end
5148 else do
5149 ok = VRSet("EF_WINS_SERVER","Value", IniGet('wins server', 'global', samba.!shadowsmbconf))
5150 end
5151
5152 name_resolve_order = IniGet('name resolve order', 'global', samba.!shadowsmbconf)
5153
5154 do I = 1 to words(name_resolve_order)
5155 ok = VRSet("SPIN_NRO"||I, "value", word(name_resolve_order,I))
5156 end
5157
5158 advanced.!smbconfchanged = 0
5159return
5160
5161/*:VRX SW_SMBTREE_Close
5162*/
5163SW_SMBTREE_Close:
5164 call SW_SMBTREE_Fini
5165return
5166
5167/*:VRX SW_SMBTREE_Create
5168*/
5169SW_SMBTREE_Create:
5170 call SW_SMBTREE_Init
5171return
5172
5173/*:VRX SW_SMBTREE_Fini
5174*/
5175SW_SMBTREE_Fini:
5176 window = VRInfo( "Window" )
5177 call VRDestroy window
5178 drop window
5179return
5180/*:VRX SW_SMBTREE_Init
5181*/
5182SW_SMBTREE_Init:
5183
5184return
5185
5186/*:VRX SW_SMBTREE_Init_Content
5187*/
5188SW_SMBTREE_Init_Content:
5189 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 1)
5190
5191 /* Hide any "foreign" menu entries */
5192 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
5193 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
5194return
5195
5196/*:VRX TDL_1_PageSelected
5197*/
5198TDL_1_PageSelected:
5199 page = VRInfo("Page")
5200
5201 /* call _TabsStrip */
5202 select
5203 when page = 1 then do /* dialog */
5204 call _TabFix 1
5205 end
5206 when page = 2 then do /* advanced */
5207 call SW_ADVANCED_Init_Content
5208 end
5209 when page = 3 then do /* smbtree */
5210 call SW_SMBTREE_Init_Content
5211 end
5212 when page = 4 then do /* condet */
5213 call SW_CONDET_Init_Content
5214 end
5215 when page = 5 then do /* Settings */
5216 call SW_SETTINGS_Init_Content
5217 end
5218 otherwise nop
5219 end
5220return
5221/*:VRX TM_AutoClose_Trigger
5222*/
5223TM_AutoClose_Trigger:
5224 call Quit
5225return
5226
5227/*:VRX TM_Progress_Throbber_Trigger
5228*/
5229TM_Progress_Throbber_Trigger:
5230 pIdx = VRGet("Pict_Progress_Throbber","PicturePath")
5231 parse var pIdx '#' pidx
5232 pidx = pidx + 1
5233 if pidx = 36 then pidx = 11
5234 ok = VRSet("Pict_Progress_Throbber","PicturePath","#"pidx)
5235return
5236
5237/*:VRX TM_RefreshCurrentDisplay_Trigger
5238*/
5239TM_RefreshCurrentDisplay_Trigger:
5240 if RefreshMode <> "" then return
5241 if _DaemonRunning() = 0 then do
5242 say " Daemon not running - disable GUI"
5243 ok = VRset("GB_CURRENT", "Enabled", 0)
5244 ok = VRset("TDL_1", "Enabled", 0)
5245 ok = VRSet("Menu_File_Daemon_Start","Enabled", 1)
5246 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 0)
5247 end
5248 else do
5249 say " Daemon running - enable GUI"
5250 ok = VRset("GB_CURRENT", "Enabled", 1)
5251 ok = VRset("TDL_1", "Enabled", 1)
5252 ok = VRSet("Menu_File_Daemon_Start","Enabled", 0)
5253 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 1)
5254 end
5255 CALL REFRESH
5256return
5257
5258/*:VRX TM_RefreshTreeDisplay_Trigger
5259*/
5260TM_RefreshTreeDisplay_Trigger:
5261 ShowHidden = advanced.!special
5262 BroadCast = advanced.!broadcast
5263 DoLMHosts = advanced.!lmhosts
5264
5265 select
5266 when RefreshMode = "TREE" then do
5267 call _RefreshTreeDisplay
5268
5269 if smbtree.!workgroup <> 'SMBTREE.!WORKGROUP' then do
5270 ok = VRset("Menu_Selected_Connect", "Visible", VRMethod("CN_SMBTREE", "ValidateRecord", smbtree.!workgroup ) )
5271 end
5272 end
5273 when RefreshMode = "SHARE" then do
5274 call _AddSharesDisplay
5275 end
5276 otherwise say "RefreshMode = "RefreshMode
5277 end
5278 call _DialogPopulate
5279return
5280
5281/*:VRX TM_TheCloser_Trigger
5282*/
5283TM_TheCloser_Trigger:
5284 call SW_PROGRESS_Close
5285return
5286
5287/*:VRX TM_Throbber_Trigger
5288*/
5289TM_Throbber_Trigger:
5290 pIdx = VRGet("Pict_Throbber","PicturePath")
5291 parse var pIdx '#' pidx
5292 pidx = pidx + 1
5293 if pidx = 36 then pidx = 11
5294 ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
5295return
5296
Note: See TracBrowser for help on using the repository browser.