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

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

GUI-Tools: EVFSGUI 2.5.x: Several fixes and additions (including fix for Ticket #185)

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