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

Last change on this file since 666 was 665, checked in by Herwig Bauernfeind, 14 years ago

GUI-Tools: EVFSGUI 2.5.x: Continue implementing server based logon script support

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