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

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

GUI-Tools: Updates in EVFSGUI, SMBMON and SSCC

File size: 193.2 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
2472 Fatal = 1
2473 RestartCount = 0
2474 FoundEVFS = 1
2475 FoundND = 1
2476
2477 program = VRGet("Application", "Program")
2478 if program = "" then parse source . . program
2479 say "Program = '"program"'"
2480 program = translate(VRParseFileName(Program,'N'))
2481 say "Program = '"program"'"
2482
2483 if SysSearchPath("PATH", "EVFSCTL.EXE") = "" | program = "SMBGUI" then do
2484 FoundEVFS = 0
2485 ForceNDFS = 1
2486 end
2487
2488CtlRestart:
2489 if \ForceNDFS then signal NoNetDrive
2490
2491ForceNDFS:
2492 IF options.!debug == 1 THEN SAY ' NDFS check entered'
2493 call RxFuncAdd 'NdRxLoadFuncs', 'NDCALLS', 'NdRxLoadFuncs'
2494 SIGNAL ON SYNTAX NAME NoNetdrive
2495 call NdRxLoadFuncs
2496 FoundND = 1
2497 SIGNAL OFF SYNTAX
2498 fs.!prefix = 'ND'
2499 fs.!fileSystemtype = "NDFS32"
2500 fs.!profileext = "ndc"
2501 signal CommonToBothFS
2502NoNetdrive:
2503 IF options.!debug == 1 THEN SAY ' NDFS not found'
2504 CALL RxFuncAdd 'EvfsRxLoadFuncs', 'EVFSCALL.DLL', 'EvfsRxLoadFuncs'
2505 SIGNAL ON SYNTAX NAME NoEVFSCALL
2506 CALL EvfsRxLoadFuncs
2507 FoundEVFS = 1
2508 SIGNAL OFF SYNTAX
2509 fs.!prefix = 'EVFS'
2510 fs.!fileSystemtype = "EVFS"
2511 fs.!profileext = "evp"
2512CommonToBothFS:
2513 IF options.!debug == 1 THEN SAY ' Common version check'
2514 CALL _Dynamic "fsstat = "fs.!prefix"RxQueryIFS()"
2515 if fsstat = 252 then CALL _Dynamic "Found"fs.!prefix" = 0"
2516
2517 if word(fsstat,1) = '0' then do
2518 PARSE VAR fsstat '0 'fsname fsver fsctl .
2519 fs.!name = fsname
2520 fs.!version = fsver
2521
2522 IF options.!debug == 1 THEN DO
2523 say ' fs.!prefix = 'fs.!prefix
2524 say ' fs.!name = 'fs.!Name
2525 say ' Version = 'fsver
2526 say ' fsctl = 'fsctl
2527 end
2528 end
2529 else do
2530 if FoundND = 0 & FoundEVFS = 0 then do
2531 CALL VRMessage 'Main', 'FATAL: Neither EVFS nor Netdrive found: 'fs.!prefix'RxQueryIFS()='fsstat, NLVGetMessage( 5 ), 'E'
2532 signal Halt
2533 end
2534 signal ForceNDFS
2535 end
2536 IF fsctl \= 1 THEN DO
2537 if ReStartCount = 0 then do
2538 'detach 'fs.!prefix'ctl.exe'
2539 RestartCount = 1
2540 ok = SysSleep(1)
2541 signal CtlRestart
2542 end
2543 else do
2544 CALL VRMessage 'Main', NLVGetMessage( 101 ), NLVGetMessage( 5 ), 'E'
2545 signal Halt
2546 end
2547 END
2548
2549 Fatal = 0
2550
2551 IF options.!debug == 1 THEN SAY time()' LoadFileSysFuncs() done'
2552return
2553
2554/*:VRX Main_Close
2555*/
2556Main_Close:
2557 CALL Quit
2558RETURN
2559
2560/*:VRX Main_Create
2561*/
2562Main_Create:
2563 options.!debug = 0
2564 IF options.!debug == 1 THEN do
2565 ok = VRRedirectStdIO("ON")
2566 say time()' Main_Create started'
2567 end
2568 else ok = VRRedirectStdIO("OFF")
2569
2570 call _LoadOtherFuncs
2571 call _InitTempDir
2572 call NLVSetup
2573 call _StemsInit
2574
2575 call _TabbedDialogSetup
2576 call _ContainersInit
2577 call _GUIInit
2578
2579 CALL _ParseCommandLine
2580
2581 CALL LoadFileSysFuncs
2582
2583 CALL _CltInit
2584
2585 CALL _INILoad
2586
2587 CALL Refresh
2588
2589 if advanced.!savepassive == 1 then CALL _PassiveLoad
2590
2591 IF options.!timesync == 1 THEN CALL _TimeSync
2592
2593 IF options.!autoload == 1 THEN CALL Menu_File_Load_Click
2594
2595 CALL VRSet "CB_MOUNT", "Selected", 1
2596 CALL VRSet "CB_DRIVES", "Selected", 1
2597 IF options.!autoclose == 1
2598 THEN CALL TM_AutoClose_Trigger
2599 ELSE do
2600 if advanced.!browseauth == 1 then do
2601 /* FIXME: unclear why we have to do the following 4 lines here */
2602 call SW_SETTINGS_Init
2603 call SW_SETTINGS_Init_Content
2604 call SW_ADVANCED_Init
2605 call SW_ADVANCED_Init_Content
2606
2607 window = VRLoadSecondary( "SW_LOGIN", "W" )
2608 call Main_Resize
2609 end
2610 if advanced.!browseimme == 1 then call PB_SMBTREE_REFRESH_Click
2611 end
2612
2613 IF options.!debug == 1 THEN SAY time()' Main_Create done'
2614return
2615
2616/*:VRX Main_KeyPress
2617*/
2618Main_KeyPress:
2619 key = VRGet('Main', 'KeyString')
2620 IF key == '{F5}' THEN CALL Refresh
2621RETURN
2622
2623/*:VRX Main_Resize
2624*/
2625Main_Resize:
2626 IF options.!debug == 1 THEN SAY time()' Main_Resize started'
2627 ok = VRset("Main","Painting", 0)
2628
2629 /* Basic measurements */
2630 main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */
2631 main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */
2632
2633 if main_iheight < 5500 then ok = VRSet("Main","Height",6200)
2634 sbar_height = VRGet("GB_STATUSBAR","Height") /* Height of status-bar */
2635 split_left = VRGet("SPLIT_Main","Left") /* Position of the left edge of the split-bar */
2636 marginx2 = margin * 2 /* Common margin around controls */
2637 pbtn_height = 400 /* Height of the panels' internal button areas */
2638
2639 pane_height = main_iheight - sbar_height - (margin * 4) /* Height of a split-bar panel */
2640 lpane_width = split_left - margin /* Width of the left split-bar panel */
2641 rpane_width = main_iwidth - split_left - 60 - margin /* Width of the right split-bar panel */
2642
2643 /* Tabbed Dialog = right pane */
2644 ok = VRset("TDL_1", "Top", marginx2)
2645 ok = VRset("TDL_1", "Left", split_left + 60)
2646 ok = VRset("TDL_1", "Width", rpane_width )
2647 ok = VRset("TDL_1", "Height", pane_height )
2648
2649 /* Current Panel */
2650 ok = VRSet("GB_CURRENT", "Visible", 1 )
2651 ok = VRSet("GB_CURRENT", "Top", marginx2 )
2652 ok = VRSet("GB_CURRENT", "Left", margin )
2653 ok = VRSet("GB_CURRENT", "Width", lpane_width )
2654 ok = VRSet("GB_CURRENT", "Height", pane_height )
2655
2656 ok = VRset("GB_CURRENT3", "Top", margin )
2657 ok = VRset("GB_CURRENT3", "Left", margin )
2658 ok = VRset("GB_CURRENT3", "Height", 245 )
2659 ok = VRset("GB_CURRENT3", "Width", lpane_width - marginx2)
2660
2661 ok = VRset("DT_CURRENT", "Top", 8 )
2662 ok = VRset("DT_CURRENT", "Left", 8 )
2663 ok = VRset("DT_CURRENT", "Height", 213 )
2664 ok = VRset("DT_CURRENT", "Width", (lpane_width - marginx2) - 24 )
2665
2666 ok = VRset("GB_CURRENT2", "Left", margin )
2667 ok = VRset("GB_CURRENT2", "Top", 245 + marginx2 )
2668 ok = VRset("GB_CURRENT2", "Width", lpane_width - marginx2)
2669 ok = VRset("GB_CURRENT2", "Height", pane_height - (margin * 5) - pbtn_height - 245 )
2670
2671 ok = VRset("CN_CURRENT", "Top", margin )
2672 ok = VRset("CN_CURRENT", "Left", margin )
2673 ok = VRset("CN_CURRENT", "Width", VRGet("GB_CURRENT2","Width") - marginx2)
2674 ok = VRset("CN_CURRENT", "Height", VRGet("GB_CURRENT2","Height") - marginx2)
2675
2676 ok = VRset("PB_DETACH", "Left", margin )
2677 ok = VRset("PB_DETACH", "Top", pane_height - pbtn_height - marginx2 )
2678 ok = VRset("PB_DETACH", "Width", min((lpane_width-margin*3) % 2, 1313) )
2679 ok = VRset("PB_UNMOUNT", "Left", VRGet("PB_DETACH","Width") + marginx2)
2680 ok = VRset("PB_UNMOUNT", "Top", pane_height - pbtn_height - marginx2 )
2681 ok = VRset("PB_UNMOUNT", "Width", min((lpane_width-margin*3) % 2, 1313) )
2682
2683 /* Splitbar - reduced in size to make it more noticable */
2684 ok = VRset("SPLIT_Main", "Visible", 1 )
2685 ok = VRset("SPLIT_Main", "Top", marginx2 + (pane_height-1200)%2 )
2686 ok = VRset("SPLIT_Main", "Height", 1200 /* pane_height */ )
2687
2688 /* Statusbar */
2689 ok = VRSet("GB_STATUSBAR", "Left", margin )
2690 ok = VRSet("GB_STATUSBAR", "Top", main_iheight - sbar_height - margin )
2691 ok = VRSet("GB_STATUSBAR", "Width", lpane_width + 50 + rpane_width )
2692
2693 ok = VRset("DT_STATUSBAR", "Top", 12 )
2694 ok = VRset("DT_STATUSBAR", "Left", 12 )
2695 ok = VRset("DT_STATUSBAR", "Height", VRGet("GB_STATUSBAR","Height") -24 )
2696 ok = VRset("DT_STATUSBAR", "Width", (lpane_width + 50 + rpane_width) - 24 )
2697
2698 /* Modified for notebook pages */
2699 pane_height = marginx2 + pane_height -1020
2700 rpane_width = marginx2 + rpane_width -760
2701
2702 /* Dialog page */
2703 ok = VRSet("GB_DIALOG", "Top", margin /* marginx2 */ )
2704 ok = VRSet("GB_DIALOG", "Left", margin /* marginx2 */ /* split_left + 60 */ )
2705 ok = VRset("GB_DIALOG", "Height", pane_height )
2706 ok = VRset("GB_DIALOG", "Width", rpane_width )
2707
2708 ok = VRset("PB_MOUNT", "Left", margin )
2709 ok = VRset("PB_MOUNT", "Top", pane_height - pbtn_height - marginx2)
2710 ok = VRset("PB_EDIT_CANCEL", "Left", VRGet("PB_MOUNT","Width") + marginx2)
2711 ok = VRset("PB_EDIT_CANCEL", "Top", pane_height - pbtn_height - marginx2)
2712
2713 ok = VRset("PB_DIALOG_HELP", "Left", rpane_width - marginx2 - VRGet("PB_DIALOG_HELP","Width") + 24)
2714 ok = VRset("PB_DIALOG_HELP", "Top", pane_height - pbtn_height - marginx2)
2715
2716 ok = VRset("GB_SHARE", "Left", margin )
2717 ok = VRset("GB_SHARE", "Top", marginx2 /* 245 + marginx2 */ )
2718 ok = VRset("GB_SHARE", "Height", 2252 )
2719 ok = VRset("GB_SHARE", "Width", rpane_width - marginx2 )
2720
2721 ok = VRset("GB_AUTH", "Left", margin )
2722 ok = VRset("GB_AUTH", "Top", margin * 3 + VRGet("GB_SHARE","Height") /* 245 + (margin * 3) + VRGet("GB_SHARE","Height") */ )
2723 ok = VRset("GB_AUTH", "Width", rpane_width - marginx2 )
2724
2725 ok = VRset("GB_MPOINT","Left", margin )
2726 ok = VRset("GB_MPOINT","Top", /* 245 + */ (margin * 4) + VRGet("GB_SHARE","Height") + VRGet("GB_AUTH","Height"))
2727 ok = VRset("GB_MPOINT","Width", rpane_width - marginx2 )
2728
2729 /* Advanced page */
2730 ok = VRSet("GB_ADVANCED", "Top", margin /* marginx2 */ )
2731 ok = VRSet("GB_ADVANCED", "Left", margin /* marginx2 */ /* split_left + 60 */ )
2732 ok = VRset("GB_ADVANCED", "Height", pane_height )
2733 ok = VRset("GB_ADVANCED", "Width", rpane_width )
2734
2735 ok = VRset("GB_ADVANCED2", "Left", margin )
2736 ok = VRset("GB_ADVANCED2", "Top", /* 245 + */ marginx2)
2737 ok = VRset("GB_ADVANCED2", "Width", rpane_width - marginx2)
2738 ok = VRset("GB_ADVANCED2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
2739
2740 ok = VRset("PB_ADVANCED_APPLY", "Left", margin )
2741 ok = VRset("PB_ADVANCED_APPLY", "Top", pane_height - pbtn_height - marginx2)
2742 ok = VRset("PB_ADVANCED_UNDO", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
2743 ok = VRset("PB_ADVANCED_UNDO", "Top", pane_height - pbtn_height - marginx2)
2744 ok = VRset("PB_ADVANCED_HELP", "Left", rpane_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24)
2745 ok = VRset("PB_ADVANCED_HELP", "Top", pane_height - pbtn_height - marginx2)
2746
2747 /* SMBTree page */
2748 ok = VRSet("GB_SMBTREE", "Top", margin /* x2 */ )
2749 ok = VRSet("GB_SMBTREE", "Left", margin /* x2 */ /* split_left + 60 */ )
2750 ok = VRset("GB_SMBTREE", "Height", pane_height )
2751 ok = VRset("GB_SMBTREE", "Width", rpane_width )
2752
2753 ok = VRset("GB_SMBTREE2","Left", margin )
2754 ok = VRset("GB_SMBTREE2","Top", /* 45 + */ marginx2 )
2755 ok = VRset("GB_SMBTREE2","Width", rpane_width - marginx2)
2756 ok = VRset("GB_SMBTREE2","Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
2757
2758 ok = VRset("CN_SMBTREE", "Top", margin )
2759 ok = VRset("CN_SMBTREE", "Left", margin )
2760 ok = VRset("CN_SMBTREE", "Width", VRGet("GB_SMBTREE2","Width") - marginx2)
2761 ok = VRset("CN_SMBTREE", "Height", VRGet("GB_SMBTREE2","Height") - marginx2)
2762
2763 ok = VRset("PB_SMBTREE_CONNECT", "Left", margin )
2764 ok = VRset("PB_SMBTREE_CONNECT", "Top", pane_height - pbtn_height - marginx2)
2765 ok = VRset("PB_SMBTREE_REFRESH", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
2766 ok = VRset("PB_SMBTREE_REFRESH", "Top", pane_height - pbtn_height - marginx2)
2767 ok = VRset("PB_SMBTREE_HELP", "Left", rpane_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24)
2768 ok = VRset("PB_SMBTREE_HELP", "Top", pane_height - pbtn_height - marginx2)
2769
2770 ok = VRset("PICT_THROBBER", "Top", VRGet("CN_SMBTREE","Height") % 2 - 100 )
2771 ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width") % 2 - 200 )
2772
2773 /* Connection details page */
2774 ok = VRSet("GB_CONDET", "Top", margin /* x2 */ )
2775 ok = VRSet("GB_CONDET", "Left", margin /* x2 */ /* split_left + 60 */ )
2776 ok = VRset("GB_CONDET", "Height", pane_height )
2777 ok = VRset("GB_CONDET", "Width", rpane_width )
2778
2779 ok = VRset("GB_CONDET2", "Left", margin )
2780 ok = VRset("GB_CONDET2", "Top", /* 245 + */ marginx2)
2781 ok = VRset("GB_CONDET2", "Width", rpane_width - marginx2)
2782 ok = VRset("GB_CONDET2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
2783
2784 ok = VRset("CN_CONDET", "Top", margin )
2785 ok = VRset("CN_CONDET", "Left", margin )
2786 ok = VRset("CN_CONDET", "Width", VRGet("GB_CONDET2","Width") - marginx2)
2787 ok = VRset("CN_CONDET", "Height", VRGet("GB_CONDET2","Height") - marginx2)
2788
2789 ok = VRset("PB_CONDET_SAVE", "Left", margin )
2790 ok = VRset("PB_CONDET_SAVE", "Top", pane_height - pbtn_height - marginx2 )
2791 ok = VRset("PB_CONDET_LOAD", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
2792 ok = VRset("PB_CONDET_LOAD", "Top", pane_height - pbtn_height - marginx2 )
2793 ok = VRset("PB_CONDET_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
2794 ok = VRset("PB_CONDET_HELP", "Top", pane_height - pbtn_height - marginx2)
2795
2796 /* Global settings page */
2797 ok = VRSet("GB_GLOBAL", "Top", margin /* x2 */ )
2798 ok = VRSet("GB_GLOBAL", "Left", margin /* x2 */ /* split_left + 60 */ )
2799 ok = VRset("GB_GLOBAL", "Height", pane_height )
2800 ok = VRset("GB_GLOBAL", "Width", rpane_width )
2801
2802 ok = VRset("GB_GLOBAL2", "Left", margin )
2803 ok = VRset("GB_GLOBAL2", "Top", marginx2 /* 245 + marginx2 */ )
2804 ok = VRset("GB_GLOBAL2", "Width", rpane_width - marginx2 )
2805
2806 ok = VRset("GB_LOGGING", "Left", margin )
2807 ok = VRset("GB_LOGGING", "Top", margin * 3 + VRGet("GB_GLOBAL2","Height") /* 245 + (margin * 3) + VRGet("GB_GLOBAL2","Height") */ )
2808 ok = VRset("GB_LOGGING", "Width", rpane_width - marginx2 )
2809
2810 ok = VRset("GB_GUI","Left", margin )
2811 ok = VRset("GB_GUI","Top", /* 245 + */ (margin * 4) + VRGet("GB_GLOBAL2","Height") + VRGet("GB_LOGGING","Height"))
2812 ok = VRset("GB_GUI","Width", rpane_width - marginx2 )
2813
2814 ok = VRset("PB_SETTINGS_APPLY", "Left", margin )
2815 ok = VRset("PB_SETTINGS_APPLY", "Top", pane_height - pbtn_height - marginx2 )
2816 ok = VRset("PB_SETTINGS_APPLY", "Height", pbtn_height)
2817 ok = VRset("PB_SETTINGS_UNDO", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
2818 ok = VRset("PB_SETTINGS_UNDO", "Top", pane_height - pbtn_height - marginx2 )
2819 ok = VRset("PB_SETTINGS_UNDO", "Height", pbtn_height)
2820 ok = VRset("PB_SETTINGS_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
2821 ok = VRset("PB_SETTINGS_HELP", "Top", pane_height - pbtn_height - marginx2)
2822 ok = VRset("PB_SETTINGS_HELP", "Height", pbtn_height)
2823
2824 /* DOne with pages */
2825 ok = VRset("Main","Painting", 1)
2826
2827 /* check and empty event queue, trash spurious resize events */
2828 EventString = ''
2829 TrashedResize = 0
2830
2831 do until EventString = 'nop'
2832 EventString = VREvent('N')
2833 if EventString <> 'nop' then do
2834 if EventString = 'CALL Main_Resize' then TrashedResize = 1
2835 else interpret eventString
2836 end
2837 end
2838 if TrashedResize then CALL Main_Resize
2839
2840 IF options.!debug == 1 THEN SAY time()' Main_Resize done'
2841return
2842/*:VRX Menu_Context_ChangeView_Click
2843*/
2844Menu_Context_ChangeView_Click:
2845 ok = VRSet("Cn_Current","View","NameTree")
2846return
2847
2848/*:VRX Menu_Context_Detach_All_Click
2849*/
2850Menu_Context_Detach_All_Click:
2851 ok = VRMethod( "CN_CURRENT", "GetRecordList", "All", "umrh." )
2852 do um = 1 to umrh.0
2853 ok = VRMethod( "CN_CURRENT", "SetRecordAttr", umrh.um, "Selected", 1)
2854 call PB_DETACH_Click
2855 end
2856 drop um umrh.
2857return
2858
2859/*:VRX Menu_Context_Detach_Click
2860*/
2861Menu_Context_Detach_Click:
2862 call PB_DETACH_Click
2863return
2864
2865/*:VRX Menu_Context_Edit_Click
2866*/
2867Menu_Context_Edit_Click:
2868 IF options.!debug == 1 THEN SAY time()' Menu_Context_Edit_Click started'
2869 /* call VRMethod "TDL_1", 'PostEvent', 'PageSelected', 'Page', 1 */
2870 ok = VRset("TDL_1", 'Selected', 1)
2871 options.!editmode = 1
2872 CALL VRSet "PB_EDIT_CANCEL","Visible", 1
2873 CALL VRSet "PB_UNMOUNT","Enabled", 0
2874
2875 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(33)" " )
2876/* CALL NLVSetText "DT_DIALOG","Caption",33 */
2877 CALL VRSet "GB_CURRENT", "ENABLED", 0
2878
2879 ok = VRSet("CB_MOUNT","Value","")
2880 ok = VRSet("CB_MOUNT","Selected",1)
2881 ok = VRSet("CB_MOUNT","Value",mtype.1)
2882
2883 parse var p_string p_workgroup':\\'p_server'\'p_share
2884
2885 /* IF options.!debug == 1 THEN SAY time()' '||p_workgroup */
2886
2887 IF options.!debug == 1 THEN SAY time()' data '||data
2888 IF options.!debug == 1 THEN SAY time()' domain '||p_workgroup
2889 IF options.!debug == 1 THEN SAY time()' server '||p_server
2890 IF options.!debug == 1 THEN SAY time()' share '||p_share
2891 IF options.!debug == 1 THEN SAY time()' string '||p_string
2892
2893
2894 CALL VRSet "EF_SHARE", "VALUE", p_share
2895 CALL VRSet "EF_SERVER", "VALUE", p_server
2896 CALL VRSet "EF_NETWORK","VALUE", p_workgroup
2897
2898 /* IF options.!debug == 1 THEN SAY time()' '||p_node */
2899 parse var p_node p_drive'\'p_directory'\'
2900 CALL VRSet "CB_DRIVES", "Value", p_drive
2901 CALL VRSet "EF_DIRECTORY", "Value", p_directory
2902 IF options.!debug == 1 THEN SAY time()' Menu_Context_Edit_Click done'
2903return
2904
2905/*:VRX Menu_Context_Open_Click
2906*/
2907Menu_Context_Open_Click:
2908 ok = VRSet("Menu_Context_Open_Default","Visible",0)
2909return
2910
2911/*:VRX Menu_Context_Open_Default_Click
2912*/
2913Menu_Context_Open_Default_Click:
2914 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Click started"
2915 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2916 PARSE VAR userdata mountpoint ';' mounts ';' .
2917
2918 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2919
2920 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DEFAULT" )
2921
2922 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Click done"
2923return
2924
2925/*:VRX Menu_Context_Open_Detail_Click
2926*/
2927Menu_Context_Open_Detail_Click:
2928 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Details_Click started"
2929 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2930 PARSE VAR userdata mountpoint ';' mounts ';' .
2931
2932 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2933
2934 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DETAILS" )
2935
2936 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Details_Click done"
2937return
2938
2939/*:VRX Menu_Context_Open_Icon_Click
2940*/
2941Menu_Context_Open_Icon_Click:
2942 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Icon_Click started"
2943 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2944 PARSE VAR userdata mountpoint ';' mounts ';' .
2945
2946 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2947
2948 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "ICON" )
2949
2950 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Icon_Click done"
2951return
2952
2953/*:VRX Menu_Context_Open_Settings_Click
2954*/
2955Menu_Context_Open_Settings_Click:
2956 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_DetailsClick started"
2957 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2958 PARSE VAR userdata mountpoint ';' mounts ';' .
2959
2960 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2961
2962 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SETTINGS" )
2963
2964 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Details_Click done"
2965return
2966
2967/*:VRX Menu_Context_Open_Splitview_Click
2968*/
2969Menu_Context_Open_Splitview_Click:
2970 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Splitview_Click started"
2971 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2972 PARSE VAR userdata mountpoint ';' mounts ';' .
2973
2974 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2975
2976 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SPLITVIEW" )
2977
2978 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Splitview_Click done"
2979return
2980
2981/*:VRX Menu_Context_Open_Tree_Click
2982*/
2983Menu_Context_Open_Tree_Click:
2984 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Tree_Click started"
2985 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2986 PARSE VAR userdata mountpoint ';' mounts ';' .
2987
2988 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2989
2990 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "TREE" )
2991
2992 IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Tree_Click done"
2993return
2994
2995/*:VRX Menu_Context_Refresh_Click
2996*/
2997Menu_Context_Refresh_Click:
2998 CALL Refresh
2999return
3000
3001/*:VRX Menu_Context_Unmount_Click
3002*/
3003Menu_Context_Unmount_Click:
3004 call PB_UNMOUNT_Click
3005return
3006
3007/*:VRX Menu_File_Autostart_Activate_Click
3008*/
3009Menu_File_Autostart_Activate_Click:
3010 options.!autostart = 1
3011
3012 Profile = VRParseFilename(settings.!ini,'DPN')'.'fs.!profileext
3013 ExeName = VRParseFileName(VRget("Application","Program"),'DPNE')
3014 if ExeName = "" then do
3015 parse source . . script
3016 ExeName = VRParseFilename(script,'DP')'\EVFSGUI.EXE'
3017 end
3018 StartupDir = VRParseFileName(VRget("Application","Program"),'DP')
3019 if StartupDir = "" then do
3020 parse source . . script
3021 StartUpDir = VRParseFilename(script,'DP')
3022 end
3023
3024 ObjTitle = NLVGetMessage( 59 )
3025 if ObjTitle = "" then ObjTitle = '[EVFS LAN-Connections]'
3026
3027 CALL PB_SAVE_Click
3028
3029 rc = CreateObject( 'WPProgram', ObjTitle,'<WP_START>',,
3030 'EXENAME='||ExeName||';'||,
3031 'PROGTYPE=PM;'||,
3032 'TITLE='ObjTitle';'||,
3033 'PARAMETERS='Profile' -AUTOCLOSE -NOGUI;'||,
3034 'STARTUPDIR='StartupDir';'||,
3035 'NOPRINT=YES;'||,
3036 'HIDEBUTTON=DEFAULT;'||,
3037 'MINWIN=DEFAULT;'||,
3038 'CCVIEW=DEFAULT;'||,
3039 'DEFAULTVIEW=DEFAULT;'||,
3040 'OBJECTID=<EVFSGUI_AUTOSTART>',,
3041 'REPLACE' )
3042
3043 IF rc == 1 THEN do
3044 Text = NLVGetMessage( 60 )
3045 if Text = "" then Text = '[Created object in Autostart-Folder]'
3046 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3047 end
3048 ELSE do
3049 Text = NLVGetMessage( 61 )
3050 if Text = "" then Text = '[Could not create object in Autostart-Folder]'
3051 Title = NLVGetMessage( 5 )
3052 if Title = "" then Title = '[Error]'
3053 CALL VRMessage 'Main', Text, Title, 'E'
3054 end
3055
3056 options.!autostart = 0
3057return
3058/*:VRX Menu_File_Autostart_Click
3059*/
3060Menu_File_Autostart_Click:
3061
3062return
3063
3064/*:VRX Menu_File_Autostart_Deactivate_Click
3065*/
3066Menu_File_Autostart_Deactivate_Click:
3067 ok = SysDestroyObject("<EVFSGUI_AUTOSTART>")
3068 IF ok == 1 THEN do
3069 Text = NLVGetMessage( 79 )
3070 if Text = "" then Text = '[Autostart object created successfully]'
3071 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3072 end
3073 ELSE do
3074 Text = NLVGetMessage( 78 )
3075 if Text = "" then Text = '[Could find Autostart object]'
3076 Title = NLVGetMessage( 5 )
3077 if Title = "" then Title = '[Error]'
3078 CALL VRMessage 'Main', Text, Title, 'E'
3079 end
3080return
3081
3082/*:VRX Menu_File_Close_Click
3083*/
3084Menu_File_Close_Click:
3085 call Quit
3086return
3087
3088/*:VRX Menu_File_Daemon_Start_Click
3089*/
3090Menu_File_Daemon_Start_Click:
3091 IF options.!debug == 1 THEN SAY time()' Menu_File_Daemon_Start_Click started'
3092 if VRFileExists(SysBootDrive()"\ndpsmb.dbg") then do
3093 btns.0 = 2
3094 btns.1 = NLVGetMessage( 6 )
3095 btns.2 = NLVGetMessage( 7 )
3096 confirm = VRMessage('Main', NLVGetMessage( 119 ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3097 IF confirm == 1 THEN do
3098 logFiles = value("LOGFILES",,"OS2ENVIRONMENT")
3099 ok1 = SysFileDelete(Logfiles||'\log.smbc')
3100 ok2 = SysFileDelete(Logfiles||'\log.ndpsmb')
3101 if ok1 <> 0 | ok2 <> 0 then do
3102 ok = VRMessage('Main', NLVGetMessage(5)' 'Logfiles||'\log.smbc RC='ok1||'0D0A'x||NLVGetMessage(5)' 'Logfiles||'\log.ndpsmb RC='ok2, NLVGetMessage( 5 ), 'E')
3103 end
3104 drop ok1 ok2
3105 end
3106 end
3107 address cmd 'detach 'fs.!prefix'CTL.EXE'
3108 ok = VRset("GB_CURRENT","Enabled", 1)
3109 ok = VRset("TDL_1","Enabled", 1)
3110 CALL REFRESH
3111 ok = VRSet("Menu_File_Daemon_Start","Enabled",0)
3112 ok = VRSet("Menu_File_Daemon_Stop","Enabled",1)
3113 IF options.!debug == 1 THEN SAY time()' Menu_File_Daemon_Start_Click done'
3114return
3115
3116/*:VRX Menu_File_Daemon_Stop_Click
3117*/
3118Menu_File_Daemon_Stop_Click:
3119 IF options.!debug == 1 THEN SAY time()' Menu_File_Daemon_Stop_Click started'
3120 ok = PRProcessList(proc)
3121 do I = 1 to proc.0
3122 CurProc = VRParseFileName(proc.i.name,'NE')
3123 if CurProc = fs.!prefix"CTL.EXE" then do
3124 call charout , ' 'CurProc' RC='
3125 ok = PRKillProcess(1,proc.i.pid)
3126 say ok
3127 end
3128 end
3129 ok = VRset("GB_CURRENT","Enabled", 0)
3130 ok = VRset("TDL_1","Enabled", 0)
3131 ok = VRSet("Menu_File_Daemon_Start","Enabled",1)
3132 ok = VRSet("Menu_File_Daemon_Stop","Enabled",0)
3133 IF options.!debug == 1 THEN SAY time()' Menu_File_Daemon_Stop_Click stopped'
3134return
3135/*:VRX Menu_File_LMHosts_Reset_Click
3136*/
3137Menu_File_LMHosts_Reset_Click:
3138 ok = SysFileDelete(samba.!lmhosts)
3139 /* FIXME: Add a message box here */
3140return
3141
3142/*:VRX Menu_File_Load_Click
3143*/
3144Menu_File_Load_Click: PROCEDURE EXPOSE settings. options. icons. advanced. vfs. Profile fs. cd. samba.
3145 IF options.!autoload == 1 then filename = Profile
3146 else filename = VRFileDialog('Main', NLVGetMessage( 55 ), 'L', '*.'fs.!profileext)
3147 IF filename == '' THEN RETURN
3148 IF STREAM( filename, 'C', 'QUERY EXISTS') == '' THEN DO
3149 CALL VRMessage 'Main', NLVGetMessage( 56, filename ), NLVGetMessage( 5 ), 'E'
3150 RETURN
3151 END
3152
3153 CALL LINEIN filename, 1, 0
3154 DO WHILE LINES( filename )
3155 PARSE VALUE LINEIN( filename ) WITH node resource rwFlag
3156
3157 vfs.!drive = FILESPEC('DRIVE', node )
3158 vfs.!mountpoint = STRIP( node, 'T', '\')
3159
3160 /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
3161 if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
3162
3163 call ParseResParmString
3164
3165 options.!workgroup = p_workgroup
3166 options.!server = p_server
3167 options.!share = p_share
3168 options.!user = p_user
3169 options.!password = p_password
3170 options.!spassword = p_spassword
3171 options.!master = p_master
3172 options.!mastertype = p_mtype
3173/* options.!memlen = p_memlen
3174 options.!logfile = p_logfile
3175 options.!loglevel = p_loglevel */
3176 options.!cachetimeout = p_cachetimeout
3177 options.!cachelistings = p_cachelistings
3178 options.!easupport = p_easupport
3179
3180 IF rwFlag == 'R' THEN
3181 options.!readonly = 1
3182 ELSE
3183 options.!readonly = 0
3184
3185 CALL Mount
3186
3187 END
3188 CALL STREAM filename, 'C', 'CLOSE'
3189
3190 options.!autoload = 0
3191
3192 CALL Refresh
3193RETURN
3194/*:VRX Menu_File_Save_Click
3195*/
3196Menu_File_Save_Click:
3197 call PB_CONDET_SAVE_Click
3198return
3199
3200/*:VRX Menu_File_ucCred_Reset_Click
3201*/
3202Menu_File_ucCred_Reset_Click:
3203 ok = _ucDelUc()
3204 /* FIXME: Add a message box here */
3205return
3206
3207/*:VRX Menu_Help_About_Click
3208*/
3209Menu_Help_About_Click:
3210 ok = VRLoadSecondary("SW_ABOUT", "W")
3211return
3212
3213/*:VRX Menu_Help_Extended_Click
3214*/
3215Menu_Help_Extended_Click:
3216 ok = VRMethod( "Main", "InvokeHelp" )
3217return
3218
3219/*:VRX Menu_Selected_Connect_Click
3220*/
3221Menu_Selected_Connect_Click:
3222 call PB_SMBTREE_CONNECT_Click
3223return
3224
3225/*:VRX Menu_Selected_Default_Workgroup_Click
3226*/
3227Menu_Selected_Default_Workgroup_Click:
3228 workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.rh,"Caption")
3229 /* FIXME: switch over to REXXIni calls */
3230 ok = TRSetIni("[global]","workgroup", workgroupname, samba.!smbconf)
3231return
3232
3233/*:VRX Menu_Selected_DetailsView_Click
3234*/
3235Menu_Selected_DetailsView_Click:
3236 ok = VRSet("CN_smbtree", "View", "Detail")
3237return
3238
3239/*:VRX Menu_Selected_Info_Click
3240*/
3241Menu_Selected_Info_Click:
3242 IF options.!debug == 1 THEN SAY time()' Menu_Selected_Info_Click started'
3243
3244 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3245 if SelRH.0 = 0 then do
3246 IF options.!debug == 1 THEN SAY time()' Menu_Selected_Info_Click aborted'
3247 return
3248 end
3249
3250 call _GetSMBObjectProperties SelRH.1
3251
3252 window = VRLoadSecondary( "SW_INFO", "W" )
3253 IF options.!debug == 1 THEN SAY time()' Menu_Selected_Info_Click done'
3254return
3255
3256/*:VRX Menu_Selected_Refresh_Click
3257*/
3258Menu_Selected_Refresh_Click:
3259 ok = VRMethod( "CN_smbtree", "SetRecordAttr", SMBObj.rh, "Icon","#61:PMWP.DLL")
3260 call _DelSMBObjectShares SMBObj.rh
3261 machine = SMBObj.resname
3262 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
3263 call _RefreshShares
3264return
3265
3266/*:VRX Menu_Selected_Remove_Click
3267*/
3268Menu_Selected_Remove_Click:
3269 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
3270 if selrec.0 = 0 then return
3271
3272 do I = 1 to selrec.0
3273 if VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.statusfh) = icons.!passive then do
3274 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3275 end
3276 else do
3277 mountpoint = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpointfh)
3278 mpidx = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpidxfh)
3279 if mpidx = 1 then do
3280 btns.0 = 2
3281 btns.1 = NLVGetMessage( 6 )
3282 btns.2 = NLVGetMessage( 7 )
3283 confirm = VRMessage('Main', NLVGetMessage( 72, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3284 IF confirm \= 1 THEN RETURN
3285
3286 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "mpidx")"
3287 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3288 CALL Refresh
3289 end
3290 else do
3291 CALL VRMessage 'Main', NLVGetMessage( 71 ) , NLVGetMessage( 89 )||" "||mountpoint , 'E'
3292 end
3293 end
3294 end
3295return
3296
3297/*:VRX Menu_Selected_Retry_Click
3298*/
3299Menu_Selected_Retry_Click: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba.
3300
3301 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "srcrec." )
3302 if srcrec.0 = 0 then return
3303
3304 srcrec = srcrec.1
3305
3306 p_mpoint = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.MpointFH)
3307
3308 p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.WorkgroupFH)
3309 p_server = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ServerFH)
3310 p_share = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ShareFH)
3311 p_user = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.UserFH)
3312 p_password = x2c(VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.SpasswordFH))
3313
3314 ShareLevel = 1
3315 if p_share = "" then ShareLevel = 2
3316 if p_server = "" then ShareLevel = 3
3317 if p_workgroup = "" then ShareLevel = 4
3318
3319 ok = VRSet("CB_MOUNT", "Selected", Sharelevel )
3320 ok = VRset("CB_MOUNT", "Value", mtype.sharelevel)
3321
3322 call _UpdateObject "EF_SERVER", p_server
3323 ok = VRset("EF_SHARE" , "Value", p_share)
3324 ok = VRset("EF_NETWORK", "Value", p_workgroup)
3325 ok = VRset("EF_USER" , "Value", p_user)
3326 ok = VRset("EF_PASSWORD", "Value", p_password)
3327
3328 parse var p_mpoint p_drv '\' p_dir
3329
3330 p_dir = strip(p_dir,'T','\')
3331
3332 ok = VRset("CB_DRIVES" , "Value", p_drv)
3333 ok = VRset("EF_DIRECTORY" , "Value", p_dir)
3334
3335 CALL PB_MOUNT_Click
3336
3337 if VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
3338 if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
3339 end
3340return
3341
3342/*:VRX Menu_Selected_TimeSync_Click
3343*/
3344Menu_Selected_TimeSync_Click:
3345 IF options.!debug == 1 THEN SAY time()' Menu_Selected_TimeSync_Click started'
3346
3347 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3348 if SelRH.0 = 0 then do
3349 IF options.!debug == 1 THEN SAY time()' Menu_Selected_TimeSync_Click aborted'
3350 return
3351 end
3352
3353 call _GetSMBObjectProperties SelRH.1
3354
3355 options.!timesrv = SMBObj.resname
3356 call _TimeSync
3357
3358 IF options.!debug == 1 THEN SAY time()' Menu_Selected_TimeSync_Click done'
3359return
3360
3361/*:VRX Menu_Selected_TreeView_Click
3362*/
3363Menu_Selected_TreeView_Click:
3364 ok = VRSet("CN_smbtree", "View", "IconTree")
3365return
3366
3367/*:VRX Mount
3368*/
3369Mount: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba.
3370 IF options.!debug == 1 THEN SAY time()' Mount procedure started'
3371 /* Set mouse pointer to wait - this operation might take a few seconds */
3372 call VRSet VRWindow(), 'Pointer', 'Wait'
3373
3374/* Disabled, because we merge profile now - in earlier revisions
3375 we replaced it but only for preexisting drives - this made only
3376 sense as long as we were unable to detect double connections -
3377 this could be made an option!
3378
3379 IF options.!autoload then do
3380 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"vfs.!drive"')"
3381 IF options.!debug == 1 THEN SAY time()' '||'Autoload Detach "'vfs.!drive'" =' ok
3382 end */
3383
3384 /* Attach the virtual drive - only if drive is not already attached */
3385 if pos(vfs.!drive,MyFreeDriveMap("C:","FREE")) > 0 then do
3386 CALL _Dynamic "ok = "fs.!prefix"RxAttach('"vfs.!drive"')"
3387
3388 IF options.!debug == 1 THEN SAY time()' '||'Attach "'vfs.!drive'" =' ok
3389 end
3390
3391 /* Create the mount point and store whether it was created or already existed */
3392 CALL _Dynamic "CreateMP = "fs.!prefix"RxCreateMountPoint('"vfs.!mountpoint"')"
3393
3394 IF options.!debug == 1 THEN SAY time()' '||'Create "'vfs.!mountpoint'" = 'CreateMP
3395
3396
3397 /* Build the resource parameter string */
3398 src = ''
3399 IF options.!workgroup \= '' THEN src = src';WORKGROUP='options.!workgroup
3400 IF options.!server \= '' THEN src = src';SERVER='options.!server
3401 IF options.!share \= '' THEN src = src';SHARE='options.!share
3402 IF options.!user \= '' THEN src = src';USER='options.!user
3403 IF options.!password \= '' THEN src = src';PASSWORD='options.!password
3404 IF options.!spassword \= '' THEN src = src';SPASSWORD='options.!spassword
3405 IF options.!master \= '' THEN src = src';MASTER='options.!master
3406 IF options.!mastertype \= '' THEN src = src';MASTERTYPE='options.!mastertype
3407/* IF options.!memlen \= '' THEN src = src';MEMLEN='options.!memlen
3408 IF options.!logfile \= '' THEN src = src';LOGFILE='options.!logfile
3409 IF options.!loglevel \= '' THEN src = src';LOGLEVEL='options.!loglevel */
3410 IF options.!cachetimeout \= '' THEN src = src';CTO='options.!cachetimeout
3411 IF options.!cachelistings \= '' THEN src = src';CLD='options.!cachelistings
3412 IF options.!easupport \= '' THEN src = src';EASUPPORT='options.!easupport
3413
3414 IF options.!readonly = 1 then rwFlag = 'R'; else rwFlag = 'W'
3415
3416 parse var vfs.!mountpoint mpoint ';' .
3417 mpoint = strip(mpoint,'T','\')||'\'
3418
3419 if options.!master = "" then options.!master = "WORKGROUP"
3420 if options.!mtype = "" then options.!mtype = "1"
3421 if options.!loglevel = "" then options.!loglevel = "0"
3422 if options.!memlen = "" then options.!memlen = "2"
3423 if options.!cachetimeout = "" then options.!cachetimeout = "10"
3424 if options.!cachelistings = "" then options.!cachelistings = "32"
3425 if options.!easupport= "" | options.!easupport= " " then options.!easupport = strip(options.!easupport)
3426 if options.!password <> "" & options.!spassword = "" then do
3427 options.!spassword = c2x(options.!password)
3428 options.!password = ""
3429 end
3430
3431 hashstr = mpoint' 'translate(options.!workgroup)' 'translate(options.!server)' 'translate(options.!share)' 'options.!user' 'options.!spassword' 'options.!easupport' 'rwFlag
3432
3433 md5 = rexx_md5(hashstr)
3434
3435 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
3436 DO i = 1 TO records.0
3437 hash = VRMethod("CN_CONDET","GetFieldData", records.i, cd.hashfh)
3438
3439 IF options.!debug == 1 THEN say VRMethod("CN_CONDET","GetFieldData", records.i, CD.mpointFH)'->'hash
3440 IF options.!debug == 1 THEN say mpoint'->'md5
3441
3442 if hash = md5 then do
3443 If VRMethod("CN_CONDET","GetFieldData", records.i, cd.statusfh) = icons.!active then do /* Same hash, status active */
3444 say "Double connection detected!!"
3445 if options.!spassword <> "" then upw = ":********"
3446 else upw = ""
3447 buttons.0 = 2
3448 buttons.1 = NLVGetMessage(9)
3449 buttons.2 = NLVGetMessage(3)
3450 Answer = VRMessage('Main',NLVGetMessage(64) , NLVGetMessage( 36,options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3451 if Answer = 2 then do
3452 call VRSet VRWindow(), 'Pointer', '<default>'
3453 say "Double connection - do not mount!!"
3454 return
3455 end
3456 end
3457 else do /* Same hash, status passive - we have to remove it */
3458 ok = VRMethod("CN_CONDET", "RemoveRecord", records.i )
3459 end
3460 end
3461 end
3462
3463 cd.lastrh = ""
3464 ok = ParseResourceData(vfs.!mountpoint,'SMBFS SMBFS64 \\'options.!workgroup':'options.!server'\'options.!share'@'options.!user||src' 'rwFlag)
3465
3466 /* Now mount the resource */
3467 CALL _Dynamic "ok = "fs.!prefix"RxMount('SMBFS','"vfs.!mountpoint"', '"src"', '"rwFlag"')"
3468
3469 IF options.!debug == 1 THEN SAY time()' '||'Mount "'vfs.!mountpoint'" =' ok
3470 if ok <> 0 then do
3471 if options.!password <> "" then upw = ":********"
3472 else upw = ""
3473 buttons.0 = 2
3474 buttons.1 = NLVGetMessage(2)
3475 buttons.2 = NLVGetMessage(37)
3476 Answer = VRMessage('Main', SysGetMessage(ok), NLVGetMessage( 36, options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3477 if Answer = 2 then do /* Show explanation */
3478 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')
3479 end
3480 if cd.lastrh <> '' then do
3481 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive) /* Passive Connection icon */
3482 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive) /* Passive Connection icon */
3483 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, '') /* remove pain text password */
3484 end
3485
3486 /* In case the mountpoint was created for this failed operation, it is (optionally) removed again */
3487 if CreateMP = 0 & advanced.!alwaysmp <> 1 then do
3488 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"vfs.!mountpoint"')"
3489 IF options.!debug == 1 THEN SAY time()' '||'Remove "'vfs.!mountpoint'" = 'ok
3490 end
3491 end
3492 else do
3493 if options.!storecreds = 1 then do
3494 ok = VRSet("EF_User", "Value",options.!user)
3495 ok = VRSet("EF_Password","Value",x2c(options.!spassword))
3496 end
3497 end
3498 drop CreateMP /* not required anymore */
3499
3500/* Obsolete - the IOCtl will not be implemented this way in the plugin
3501 The REXX function is present, but is has no counterpart in the plugin
3502 ok = EvfsRxIoctl( 100 , vfs.!mountpoint, outstring)
3503 IF options.!debug == 1 THEN SAY time()' '||'RxIoctl "'vfs.!mountpoint'" = 'ok', 'outstring
3504 */
3505 /* Set mouse pointer to default again */
3506 call VRSet VRWindow(), 'Pointer', '<default>'
3507 IF options.!debug == 1 THEN SAY time()' Mount procedure done'
3508RETURN ok
3509
3510/*:VRX MyFreeDriveMap
3511*/
3512MyFreeDriveMap: procedure expose options. icons. fs. samba.
3513 IF options.!debug == 1 THEN SAY time()' MyFreeDriveMap(proc) started'
3514 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:"
3515/* IF options.!debug == 1 THEN SAY time()' '||"SysDriveMap(USED) started" */
3516 useddrives= SysDriveMap("C:","USED")
3517/* IF options.!debug == 1 THEN SAY time()' '||"SysDriveMap(USED) done" */
3518
3519 Alldr = words(alldrives)
3520 FreeDriveMap = ""
3521 do I = 1 to AllDr
3522 if word(alldrives,1) = word(useddrives,1) then do
3523 Useddrives = subword(useddrives,2)
3524 Alldrives = subword(Alldrives,2)
3525 end
3526 else do
3527 FreeDriveMap = FreeDriveMap||word(alldrives,1)||' '
3528 Alldrives = subword(Alldrives,2)
3529 end
3530 end
3531 IF options.!debug == 1 THEN SAY time()' MyFreeDriveMap(proc) done, result "'FreeDriveMap'"'
3532return FreeDriveMap
3533/*:VRX NoEVFSCALL
3534*/
3535NoEVFSCALL:
3536 CALL VRMessage 'Main', NLVGetMessage( 100 ), NLVGetMessage( 5 ), 'E'
3537 signal Halt
3538RETURN
3539
3540/*:VRX ParseResourceData
3541*/
3542ParseResourceData: PROCEDURE EXPOSE userdata options. icons. advanced. fs. cd. samba.
3543 PARSE ARG userdata, resource
3544 IF options.!debug == 1 THEN SAY time()' ParseResourceData started'
3545 IF options.!debug == 1 THEN SAY ' receiving "'userdata'" "'resource'" length ('length(resource)')'
3546
3547/* WARNING! resource has a maximal length of 255 and is truncated otherwise */
3548
3549/* PARSE VAR resource . ';WORKGROUP='p_workgroup';SERVER='p_server';SHARE='p_share';' . */
3550
3551 if left(word(resource,1),5) <> "SMBFS" then do
3552 /* Support for other filesystems would come here! */
3553 userData = "UNKNOWN"
3554 end
3555 else do
3556 cd.lastrh = VRMethod("CN_CONDET","AddRecord")
3557 PARSE VAR userdata p_mpoint ';' p_mpidx ';' .
3558
3559 p_mpoint = strip(p_mpoint,'T','\')||'\'
3560 p_rw = word(resource, words(resource))
3561
3562 /* Workaround for truncated resource string */
3563 if length(p_rw) > 1 then do
3564 /* The resource string must have been truncated
3565 p_rw is already wrong and
3566 p_easupport will most likely be also wrong (look below for workaround!) */
3567 p_rw ="W" /* this is guessed only!!! */
3568 IF options.!debug == 1 THEN SAY ' WARNING! Detected truncated resource string - shorten workgroup name, server name, share name until this message goes away!'
3569 end
3570 /* this should be done unconditionally if the resource string is never truncated */
3571 else resource = left(resource,length(resource)-length(p_rw))
3572
3573 call ParseResParmString
3574
3575 if p_master = "" then p_master = "WORKGROUP"
3576 if p_mtype = "" then p_mtype = "1"
3577 if p_loglevel = "" then p_loglevel = "0"
3578 if p_memlen = "" then p_memlen = "2"
3579
3580 /* Also works around for a truncated resource string! */
3581 if p_easupport= "" | p_easupport= " " then p_easupport = strip(options.!easupport)
3582
3583 if p_password <> "" & p_spassword = "" then do
3584 p_spassword = c2x(p_password)
3585 p_password = ""
3586 end
3587
3588 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)
3589 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password, cd.spasswordfh, p_spassword, cd.masterfh, p_master, cd.mtypefh, p_mtype)
3590 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout, cd.cldFH, p_cachelistings)
3591 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)
3592 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!active) /* Active */
3593 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!active) /* Active */
3594
3595 hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
3596
3597 md5 = rexx_md5(hashstr)
3598
3599 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh,md5)
3600
3601 SELECT
3602 WHEN p_share == '' & p_server \= '' THEN DO /* all shares on server */
3603 IF p_workgroup == '' THEN
3604 userdata = userdata';\\'p_server'\*'
3605 ELSE
3606 userdata = userdata';'p_workgroup':\\'p_server'\*'
3607 END
3608 WHEN p_server == '' & p_workgroup \= '' THEN /* all servers in workgroup */
3609 userdata = userdata';'p_workgroup':\\*'
3610 WHEN p_server == '' & p_workgroup == '' THEN /* all workgroups */
3611 userdata = userdata';*:\\*'
3612 OTHERWISE DO
3613 IF p_workgroup == '' THEN
3614 userdata = userdata';\\'p_server'\'p_share
3615 ELSE
3616 userdata = userdata';'p_workgroup':\\'p_server'\'p_share
3617 END
3618 END
3619 end
3620
3621 IF options.!debug == 1 THEN SAY ' returning "'userdata'"'
3622 IF options.!debug == 1 THEN SAY time()' ParseResourceData done'
3623RETURN userdata
3624
3625/*:VRX ParseResParmString
3626*/
3627ParseResParmString:
3628 PARSE VAR resource . ';WORKGROUP=' p_workgroup ';' .
3629 PARSE VAR resource . ';SERVER=' p_server ';' .
3630 PARSE VAR resource . ';SHARE=' p_share ';' .
3631 PARSE VAR resource . ';USER=' p_user ';' .
3632 PARSE VAR resource . ';PASSWORD=' p_password ';' .
3633 PARSE VAR resource . ';SPASSWORD=' p_spassword ';' .
3634 PARSE VAR resource . ';MASTER=' p_master ';' .
3635 PARSE VAR resource . ';MASTERTYPE=' p_mtype ';' .
3636 PARSE VAR resource . ';MEMLEN=' p_memlen ';' .
3637 PARSE VAR resource . ';LOGFILE=' p_logfile ';' .
3638 PARSE VAR resource . ';LOGLEVEL=' p_loglevel ';' .
3639 PARSE VAR resource . ';CTO=' p_cachetimeout ';' .
3640 PARSE VAR resource . ';CLD=' p_cachelistings ';' .
3641 PARSE VAR resource . ';EASUPPORT=' p_easupport ' '
3642return
3643/*:VRX PB_ABOUT_CLOSE_Click
3644*/
3645PB_ABOUT_CLOSE_Click:
3646 CALL SW_ABOUT_Close
3647return
3648
3649/*:VRX PB_ABOUT_COPY_Click
3650*/
3651PB_ABOUT_COPY_Click:
3652 ok = VRMethod( "Application", "PutClipboard", AboutStr )
3653 call beep 880*2,10
3654 CALL SW_ABOUT_Close
3655return
3656
3657/*:VRX PB_ADVANCED_APPLY_Click
3658*/
3659PB_ADVANCED_APPLY_Click:
3660 advanced.!easupport = VRGet( "CB_EAS", "Set" )
3661 advanced.!readonly = VRGet( "CB_READONLY", "Set" )
3662 advanced.!alwaysmp = VRGet( "CB_ALWAYSMP", "Set" )
3663 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT", "Value" )
3664 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS", "Value" )
3665
3666 /* Obsolete */
3667 advanced.!memlen = VRGet( "SPB_MEMLEN", "Value" )
3668return
3669
3670/*:VRX PB_ADVANCED_HELP_Click
3671*/
3672PB_ADVANCED_HELP_Click:
3673 CALL VRMethod 'SW_ADVANCED', 'InvokeHelp'
3674return
3675
3676/*:VRX PB_ADVANCED_UNDO_Click
3677*/
3678PB_ADVANCED_UNDO_Click:
3679 CALL SW_ADVANCED_Init_Content
3680RETURN
3681
3682/*:VRX PB_CONDET_HELP_Click
3683*/
3684PB_CONDET_HELP_Click:
3685 CALL VRMethod 'GB_CONDET', 'InvokeHelp'
3686return
3687
3688/*:VRX PB_CONDET_LOAD_Click
3689*/
3690PB_CONDET_LOAD_Click:
3691 IF options.!debug == 1 THEN SAY time()' '||"PB_CONDET_LOAD_Click started"
3692 call Menu_File_Load_Click
3693 IF options.!debug == 1 THEN SAY time()' '||"PB_CONDET_LOAD_Click done"
3694RETURN
3695
3696/*:VRX PB_CONDET_SAVE_Click
3697*/
3698PB_CONDET_SAVE_Click: PROCEDURE EXPOSE settings. options. icons. Profile fs. cd. advanced. samba.
3699 IF options.!debug == 1 THEN SAY time()' '||"PB_CONDET_SAVE_Click started"
3700
3701 if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
3702 ELSE filename = Profile
3703
3704 IF filename == '' THEN RETURN
3705
3706 IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
3707 btns.0 = 2
3708 btns.1 = NLVGetMessage( 6 )
3709 if btns.1 = "" then btns.1 = '[Yes]'
3710 btns.2 = NLVGetMessage( 7 )
3711 if btns.2 = "" then btns.2 = '[No]'
3712 Title = NLVGetMessage( 53 )
3713 if Title = "" then Title = "[File exists]"
3714 Text = NLVGetMessage( 54, filename )
3715 if Text = "" then Text = "[File "filename" exists? Overwrite?]"
3716
3717 confirm = VRMessage('Main', Text, Title, 'W', 'btns.', 1, 2 )
3718 IF confirm \= 1 THEN RETURN
3719 CALL VRChAttr filename,, 'HSR'
3720 CALL VRDeleteFile filename
3721 END
3722
3723 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
3724 DO i = 1 TO records.0
3725 resource = ""
3726 resource = resource||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
3727 resource = resource||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgroupfh)
3728 resource = resource||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3729 resource = resource||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3730 resource = resource||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3731 resource = resource||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgroupfh)
3732 resource = resource||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3733 resource = resource||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3734 resource = resource||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3735 resource = resource||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
3736 resource = resource||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
3737 resource = resource||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
3738 resource = resource||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
3739 resource = resource||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
3740 resource = resource||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
3741/* resource = resource||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
3742 resource = resource||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
3743 resource = resource||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
3744 resource = resource||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
3745 resource = resource||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
3746 call lineout filename, resource
3747 END
3748 CALL STREAM filename, 'C', 'CLOSE'
3749
3750 if options.!autostart == 0 THEN do
3751 Title = NLVGetMessage( 51 )
3752 if Title = "" then Title = "[Profile saved]"
3753 Text = NLVGetMessage( 52, filename )
3754 if Text = "" then Text = "[Profile saved to "filename"!]"
3755 CALL VRMessage 'Main', Text , Title, 'I'
3756 end
3757
3758 IF options.!debug == 1 THEN SAY time()' '||"PB_CONDET_SAVE_Click done"
3759RETURN
3760
3761/*:VRX PB_DETACH_Click
3762*/
3763PB_DETACH_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
3764 IF options.!debug == 1 THEN SAY time()' '||"PB_DETACH_Click started"
3765 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
3766 IF select.0 < 1 THEN RETURN
3767
3768 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
3769 PARSE VAR userdata mountpoint ';' mounts ';' .
3770 drive = STRIP( mountpoint, 'T', '\')
3771
3772 btns.0 = 2
3773 btns.1 = NLVGetMessage( 6 )
3774 btns.2 = NLVGetMessage( 7 )
3775 confirm = VRMessage('Main', NLVGetMessage( 58, drive ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3776 IF confirm \= 1 THEN RETURN
3777
3778 /* TODO: ?? Unmount & delete all child mountpoints? - Do we need this? */
3779 /* FIXME: This is potentially dangerous on Netdrive - what happens with unknown mount types? */
3780 /* FIXME: Unclear under which circumstances we have an alpha value here (which crahed EVFSGUI) */
3781 if datatype(mounts) = 'NUM' then do
3782 /* Unmount any resources */
3783 DO i = 1 TO mounts
3784 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
3785 END
3786 end
3787 else IF options.!debug == 1 THEN SAY ' '||"mounts = "mounts
3788
3789 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"drive"')"
3790
3791 CALL Refresh
3792 IF options.!debug == 1 THEN SAY time()' '||"PB_DETACH_Click done"
3793RETURN
3794
3795/*:VRX PB_DIALOG_HELP_Click
3796*/
3797PB_DIALOG_HELP_Click:
3798 CALL VRMethod 'GB_DIALOG', 'InvokeHelp'
3799return
3800
3801/*:VRX PB_EDIT_CANCEL_Click
3802*/
3803PB_EDIT_CANCEL_Click:
3804 options.!editmode = 0
3805 CALL VRSet "PB_UNMOUNT","Enabled", 1
3806 CALL VRSet "GB_CURRENT", "ENABLED", 1
3807 ok = VRSet("PB_EDIT_CANCEL","Visible", 0)
3808 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(13)" " )
3809/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
3810RETURN 0
3811
3812/*:VRX PB_INFO_OK_Click
3813*/
3814PB_INFO_OK_Click:
3815 call SW_INFO_Close
3816RETURN
3817
3818/*:VRX PB_LOGIN_CANCEL_Click
3819*/
3820PB_LOGIN_CANCEL_Click:
3821 credentials.!entered = 0
3822 call SW_LOGIN_Close
3823RETURN
3824
3825/*:VRX PB_LOGIN_OK_Click
3826*/
3827PB_LOGIN_OK_Click:
3828 ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
3829 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value"))
3830 options.!storecreds = VRGet("CB_STORECREDS1","Set")
3831 credentials.!entered = 1
3832
3833 if p_server <> "" then do
3834 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
3835
3836 if word(ok,1) = "1" then do
3837 ok = VRSet("DT_STATUSBAR","Caption", NLVGetMessage(107, rpc.queryuser.FULL_NAME))
3838 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
3839 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
3840 end
3841 else do
3842 CALL VRMessage 'Main', VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS, NLVGetMessage(5), "E"
3843 end
3844 end
3845
3846 call SW_LOGIN_Close
3847RETURN
3848
3849/*:VRX PB_MOUNT_Click
3850*/
3851PB_MOUNT_Click:
3852 IF options.!debug == 1 THEN SAY time()' '||"PB_MOUNT_Click started"
3853 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
3854 say " network = "network
3855 if options.!editmode = 1 then do
3856 CALL PB_UNMOUNT_Click
3857 options.!editmode = 0
3858 ok = VRMethod("TDL_1","SetTabText", " "strip(NLVGetMessage(13))" ")
3859/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
3860
3861 CALL VRSet "PB_UNMOUNT","Enabled", 1
3862 CALL VRSet "GB_CURRENT", "ENABLED", 1
3863 end
3864
3865 options.!workgroup = ''
3866 options.!server = ''
3867 options.!share = ''
3868 options.!user = ''
3869 options.!password = ''
3870 options.!master = ''
3871 options.!mastertype = ''
3872 options.!memlen = advanced.!memlen
3873 options.!easupport = advanced.!easupport
3874 options.!readonly = advanced.!readonly
3875 options.!loglevel = advanced.!loglevel
3876 options.!logfile = advanced.!logfile
3877 options.!cachetimeout = advanced.!cachetimeout
3878 options.!cachelistings = advanced.!cachelistings
3879
3880 vfs.!drive = ''
3881 vfs.!mountpoint = ''
3882
3883 stype = VRGet( "CB_MOUNT", "Selected" )
3884 share = STRIP( VRGet( "EF_SHARE", "Value" ))
3885 server = STRIP( VRGet( "EF_SERVER", "Value" ))
3886 network = STRIP( VRGet( "EF_NETWORK", "Value" ))
3887 mtype = VRGet( "CHK_MTYPE", "Set" )
3888 userid = STRIP( VRGet( "EF_USER", "Value" ))
3889 password = STRIP( VRGet( "EF_PASSWORD", "Value" ))
3890 mdrive = VRGet( "CB_DRIVES", "SelectedText" )
3891 if mdrive = "" then mdrive = VRGet( "CB_DRIVES", "Value" )
3892 mpath = STRIP( VRGet( "EF_DIRECTORY", "Value" ))
3893
3894 IF ( stype < 1 | stype > 4 ) THEN stype = 1
3895
3896 /* The required/optional/ignored parameters depend on the type of mount
3897 * requested. (Note, however, that the user, password, easupport and
3898 * memlen parameters are always optional.)
3899 */
3900 SELECT
3901 /* Scenario 1: Mount a single share.
3902 * Required: share, server
3903 * Optional: workgroup
3904 * Unused: master, mastertype
3905 */
3906 WHEN stype = 1 THEN DO
3907 IF server == '' | share == '' THEN DO
3908 /* error */
3909 RETURN 1
3910 END
3911 options.!server = server
3912 options.!share = share
3913 options.!workgroup = network
3914 END
3915
3916 /* Scenario 2: Mount all shares on a server.
3917 * Required: server
3918 * Optional: workgroup
3919 * Unused: share, master, mastertype
3920 */
3921 WHEN stype = 2 THEN DO
3922 IF server == '' THEN DO
3923 /* error */
3924 RETURN 1
3925 END
3926 options.!server = server
3927 options.!workgroup = network
3928 END
3929
3930 /* Scenario 3: Mount all servers in a workgroup.
3931 * Required: workgroup
3932 * Optional: -
3933 * Unused: share, server, master, mastertype
3934 */
3935 WHEN stype = 3 THEN DO
3936 IF workgroup == '' THEN DO
3937 /* error */
3938 RETURN 1
3939 END
3940 options.!workgroup = network
3941 END
3942
3943 /* Scenario 4: Mount all workgroups known to a master.
3944 * Required: master, mastertype
3945 * Optional: -
3946 * Unused: share, server, workgroup
3947 */
3948 WHEN stype = 4 THEN DO
3949 IF master == '' | mastertype == '' THEN DO
3950 /* error */
3951 RETURN 1
3952 END
3953 options.!master = network
3954 options.!mastertype = mtype
3955 END
3956 END
3957
3958 options.!user = userid
3959 options.!password = password
3960
3961 vfs.!drive = mdrive
3962 vfs.!mountpoint = mdrive'\'mpath
3963
3964 CALL Mount
3965 CALL Refresh
3966 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 1)
3967 IF options.!debug == 1 THEN SAY time()' '||"PB_MOUNT_Click done"
3968RETURN 0
3969
3970/*:VRX PB_NEWMOUNTPOINTCANCEL_Click
3971*/
3972PB_NEWMOUNTPOINTCANCEL_Click:
3973 ok = VRSet("CB_DRIVES","Value","")
3974 ok = VRSet("EF_DIRECTORY","Value","")
3975 call SW_MOUNTPOINT_Close
3976RETURN 0
3977
3978/*:VRX PB_NEWMOUNTPOINTOK_Click
3979*/
3980PB_NEWMOUNTPOINTOK_Click:
3981 ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
3982 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
3983
3984 advanced.!readonly = VRGet("CB_READONLY1","Set")
3985 advanced.!easupport = VRGet("CB_EAS1","Set")
3986 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
3987 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
3988 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
3989
3990 call SW_MOUNTPOINT_Close
3991RETURN
3992
3993/*:VRX PB_NEWPORTCANCEL_Click
3994*/
3995PB_NEWPORTCANCEL_Click:
3996/* ok = VRSet("CB_DRIVES","Value","")
3997 ok = VRSet("EF_DIRECTORY","Value","")
3998 call SW_MOUNTPOINT_Close */
3999RETURN 0
4000
4001/*:VRX PB_NEWPORTCONNECT_Click
4002*/
4003PB_NEWPORTCONNECT_Click:
4004/* ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4005 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4006
4007 advanced.!readonly = VRGet("CB_READONLY1","Set")
4008 advanced.!easupport = VRGet("CB_EAS1","Set")
4009 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4010 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4011 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4012
4013 call SW_MOUNTPOINT_Close */
4014RETURN
4015
4016/*:VRX PB_PROGRESS_ABORT_Click
4017*/
4018PB_PROGRESS_ABORT_Click:
4019 options.!delay = 0
4020 options.!autoload = 0
4021 options.!autoclose = 0
4022 call SW_PROGRESS_Close
4023return
4024
4025/*:VRX PB_SETTINGS_APPLY_Click
4026*/
4027PB_SETTINGS_APPLY_Click:
4028 advanced.!loglevel = VRGet("SPIN_LOGLEVEL", "Value" )
4029 advanced.!logfile = VRGet("EF_LOGFILE", "Value" )
4030 advanced.!browseauth = VRGet("CB_BROWSEAUTH", "Set" )
4031 advanced.!browseimme = VRGet("CB_BROWSEIMME", "Set" )
4032 advanced.!special = VRGet("CB_SPECIAL", "Set" )
4033 advanced.!savepassive = VRGet("CB_SAVEPASSIVE","Set" )
4034 advanced.!lmhosts = VRGet("CB_LMHOSTS", "Set" )
4035 advanced.!broadcast = VRGet("CB_BROADCAST", "Set" )
4036 advanced.!miniicons = VRGet("CB_MINIICONS", "Set" )
4037
4038 /* Note: CB_LOGGING has its own event tied to the click */
4039 options.!storecreds = VRGet("CB_STORECREDS", "Set" )
4040 options.!debug = VRGet("CB_DEBUG", "Set" )
4041
4042 if options.!debug == 1 then do /* Turn on additional columns in connection details view */
4043 ok = VRRedirectStdio("ON")
4044 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 1)
4045 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 1)
4046 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 1)
4047 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 1)
4048 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 1)
4049 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 1)
4050 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 1)
4051 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 1)
4052 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 1)
4053 end
4054 else do /* Turn on additional columns in connection details view */
4055 ok = VRRedirectStdio("OFF")
4056 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 0)
4057 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 0)
4058 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 0)
4059 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 0)
4060 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 0)
4061 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 0)
4062 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 0)
4063 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 0)
4064 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 0)
4065 end
4066
4067 ok = VRset("CN_CURRENT", "MiniIcons", advanced.!miniicons)
4068 ok = VRset("CN_SMBTREE", "MiniIcons", advanced.!miniicons)
4069 ok = VRset("CN_CONDET", "MiniIcons", advanced.!miniicons)
4070
4071 if advanced.!lmhosts = 1 then do
4072 call _LMHostsRead
4073 call _LMHostsUpdate
4074 end
4075 if advanced.!smbconfchanged = 1 then do
4076 name_resolve_order = VRGet("SPIN_NRO1","value")' 'VRGet("SPIN_NRO2","value")' 'VRGet("SPIN_NRO3","value")' 'VRGet("SPIN_NRO4","value")
4077 handle = IniOpen('global', samba.!smbconf)
4078 call IniSet 'name resolve order', name_resolve_order, handle
4079 /* FIXME: Throw an error in this case */
4080 if \_IsValidIPAddress(VRGet("EF_WINS_SERVER","Value")) then ok = VRSet("EF_WINS_SERVER","Value","")
4081 call IniSet 'wins server', VRGet("EF_WINS_SERVER","Value"), handle
4082 call IniSave handle
4083 call IniClose handle
4084 advanced.!smbconfchanged = 0
4085 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 0)
4086 end
4087return
4088
4089/*:VRX PB_SETTINGS_HELP_Click
4090*/
4091PB_SETTINGS_HELP_Click:
4092 CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
4093return
4094
4095/*:VRX PB_SETTINGS_UNDO_Click
4096*/
4097PB_SETTINGS_UNDO_Click:
4098 call SW_SETTINGS_Init_Content
4099return
4100
4101/*:VRX PB_SMBTREE_CONNECT_Click
4102*/
4103PB_SMBTREE_CONNECT_Click: PROCEDURE EXPOSE settings. options. icons. fs. advanced. cd. samba.
4104 IF options.!debug == 1 THEN SAY time()' '||"PB_CONNECT_Click started"
4105
4106 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
4107
4108 if SelRH.0 = 0 then do
4109 IF options.!debug == 1 THEN SAY time()' '||"PB_CONNECT_Click aborted"
4110 return
4111 end
4112
4113 p_workgroup = ''
4114 p_server = ''
4115 p_share = ''
4116
4117 srcFile = ""
4118 srcCtn = VRGet("CN_SMBTREE","Self")
4119 srcRec = SelRH.1
4120 trgCtn = VRGet("CN_CURRENT","Self")
4121 trgRec = ""
4122
4123 IF options.!debug == 1 THEN do
4124 say ' srcCtn = "'srcCtn'"'
4125 if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
4126 say ' srcRec = "'srcRec'"'
4127 say ' trgCtn = "'trgCtn'"'
4128 if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
4129 say ' trgRec = "'trgRec'"'
4130 end
4131
4132 ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
4133
4134 DragCapt = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Caption")
4135 ParentRH = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Parent")
4136
4137 if ParentRH = "" then do /* A workgroup was dragged */
4138 say "Workgroup dragged!"
4139 parse var DragCapt p_workgroup '0D0A'x .
4140 p_workgroup = strip(p_workgroup)
4141 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4142 call _UpdateObject "EF_SERVER", ""
4143 ok = VRSet("EF_SHARE","Value","")
4144
4145 ShareLevel = 3
4146 end
4147 else do
4148 ParDragCapt = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Caption")
4149 GParentRH = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Parent")
4150
4151 if GParentRH = "" then do /* A server was dragged */
4152 say "Server dragged!"
4153 parse var ParDragCapt p_workgroup '0D0A'x .
4154 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4155 p_workgroup = strip(p_workgroup)
4156
4157 parse var DragCapt p_server '0D0A'x .
4158 p_server = strip(p_server)
4159 call _UpdateObject "EF_SERVER", p_server
4160 ok = VRSet("EF_Share","Value","")
4161
4162 ShareLevel = 2
4163 end
4164 else do /* A share was dragged */
4165 say "Share dragged!"
4166 GParDragCapt = VRMethod(srcCtn, "GetRecordAttr", GParentRH, "Caption")
4167
4168 parse var GParDragCapt p_workgroup '0D0A'x .
4169 p_workgroup = strip(p_workgroup)
4170 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4171
4172 parse var ParDragCapt p_server '0D0A'x .
4173 p_server = strip(p_server)
4174 call _UpdateObject "EF_SERVER", p_server
4175
4176 parse var DragCapt p_share '0D0A'x .
4177 p_share = strip(p_share)
4178 ok = VRSet("EF_Share","Value",strip(p_share))
4179
4180 ShareLevel = 1
4181 end
4182 end
4183
4184 say 'p_workgroup = "'p_workgroup'"'
4185 say 'p_server = "'p_server'"'
4186 say 'p_share = "'p_share'"'
4187
4188 ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
4189 call CB_MOUNT_Change
4190
4191 if trgRec = "" then do
4192 window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
4193 if VRGet("CB_DRIVES","Value") = "" then return
4194 end
4195 else do
4196
4197 TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
4198
4199 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
4200
4201 do while parTrgRH <> ""
4202 partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
4203 TargetString = partrgCapt||'\'||TargetString
4204 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
4205 end
4206 say 'TargetString = "'TargetString'"'
4207 ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
4208 ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
4209 end
4210
4211 window = VRLoadSecondary( "SW_LOGIN", "W" )
4212 if credentials.!entered = 1 then call PB_MOUNT_CLICK
4213
4214 IF options.!debug == 1 THEN SAY time()' '||"PB_CONNECT_Click done"
4215RETURN
4216
4217/*:VRX PB_SMBTREE_HELP_Click
4218*/
4219PB_SMBTREE_HELP_Click:
4220 CALL VRMethod 'GB_SMBTREE', 'InvokeHelp'
4221return
4222
4223/*:VRX PB_SMBTREE_REFRESH_Click
4224*/
4225PB_SMBTREE_REFRESH_Click: /* PROCEDURE EXPOSE settings. options. icons. fs. samba. debuglevel advanced. UserCred Refreshmode Tempdir */
4226 IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click started"
4227
4228 if advanced.!browseauth = 1 & (UserCred = "--user=%" | UserCred = "" ) then do
4229 window = VRLoadSecondary( "SW_LOGIN", "W" )
4230 end
4231
4232 call _UserCredUpdate
4233 ok = VRset("Pict_Throbber", "Visible", 1)
4234 ok = VRset("Menu_Selected_Connect", "Visible", 0)
4235 ok = VRset("TM_Throbber", "Enabled", 1)
4236 ShowHidden = advanced.!special
4237 BroadCast = advanced.!broadcast
4238 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
4239 ok = time('R')
4240 call _RefreshTree
4241 IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click done"
4242RETURN
4243
4244/*:VRX PB_UNMOUNT_Click
4245*/
4246PB_UNMOUNT_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
4247 IF options.!debug == 1 THEN SAY time()' '||"PB_UNMOUNT_Click started"
4248 IF options.!debug == 1 THEN SAY time()' '||'options.!editmode = 'options.!editmode
4249 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
4250 IF select.0 < 1 THEN RETURN
4251
4252 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
4253 PARSE VAR userdata mountpoint ';' mounts ';' .
4254say 'userdata="'userdata'"'
4255 IF mounts > 0 & options.!editmode = 0 THEN DO
4256 btns.0 = 2
4257 btns.1 = NLVGetMessage( 6 )
4258 btns.2 = NLVGetMessage( 7 )
4259 confirm = VRMessage('Main', NLVGetMessage( 57, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
4260 IF confirm \= 1 THEN RETURN
4261 END
4262
4263 /* Unmount any resources */
4264 DO i = 1 TO mounts
4265 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
4266 END
4267
4268 /* Delete mountpoint */
4269 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', select.1, 'Parent')
4270 IF parent \= '' THEN DO
4271 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"mountpoint"')"
4272 END
4273
4274 CALL Refresh
4275 IF options.!debug == 1 THEN SAY time()' '||"PB_UNMOUNT_Click done"
4276RETURN 0
4277
4278/*:VRX Quit
4279*/
4280Quit:
4281 if Fatal <> 1 then CALL _INISave
4282 ok = VRREdirectSTdio("OFF")
4283 window = VRWindow()
4284 call VRSet window, "Shutdown", 1
4285 drop window
4286RETURN
4287
4288/*:VRX Refresh
4289*/
4290Refresh:
4291 IF options.!debug == 1 THEN SAY time()' Refresh started'
4292 CALL VRSet "CN_CURRENT", 'Painting', 0
4293
4294 CALL VRMethod "CN_CURRENT", 'RemoveRecord', 'All'
4295
4296 /* Remove Active connections from details view */
4297 ok = VRMethod( "CN_CONDET", "GetRecordList", 'All', "rh." )
4298
4299 do I = 1 to rh.0
4300 /* This catches the bug we observed exactly once and were unable to reproduce! */
4301 if cd.statusfh = 'CD.STATUSFH' then do
4302 call beep 880, 50
4303 call beep 880, 50
4304 IF options.!debug == 1 THEN say " cd.statusfh is undefined - check why!!!!!!"
4305 leave
4306 end
4307 IF options.!debug == 1 THEN say ' Icon.'i' = "'||VRMethod( "CN_CONDET", "GetFieldData", rh.i, cd.statusfh)'"'
4308 if VRMethod("CN_CONDET","GetFieldData", rh.i, cd.statusfh) = icons.!active then CALL VRMethod "CN_CONDET", 'RemoveRecord', rh.i
4309 end
4310
4311/* call _AddTemplates */
4312 CALL VRSet "PB_DETACH", "Enabled", 0
4313 CALL VRSet "PB_UNMOUNT", "Enabled", 0
4314
4315 ok = VRSet("MENU_CONTEXT_OPEN", "Visible", 0)
4316/* ok = VRSet("MENU_CONTEXT_SEP1", "Visible", 0) */
4317 ok = VRSet("MENU_CONTEXT_DETACH", "Visible", 0)
4318 ok = VRSet("MENU_CONTEXT_UNMOUNT", "Visible", 0)
4319 ok = VRSet("MENU_CONTEXT_EDIT", "Visible", 0)
4320
4321 ok = VRSet("MENU_SELECTED_REMOVE", "Visible", 0)
4322 ok = VRSet("MENU_SELECTED_RETRY", "Visible", 0)
4323
4324 IF options.!debug == 1 THEN SAY ' Remove records, disable buttons done.'
4325
4326 CALL VRMethod 'CB_DRIVES', 'Clear'
4327
4328 CALL VRSet "CN_CURRENT", "Caption", fs.!Name' 'fs.!version
4329
4330 /* Herwig B.: Attention! The SysDrivemap function with the "free" parameter causes hangs in case it is called repeatedly! */
4331 drvs = MyFreeDriveMap('C:', 'FREE')
4332
4333 DO i = 1 TO WORDS( drvs )
4334 drvstem.i = WORD( drvs, i )
4335 END
4336
4337 drvstem.0 = WORDS( drvs )
4338
4339 /* Add any existing EVFS drives */
4340 CALL GetMountPoints
4341
4342 CALL VRMethod "CB_DRIVES", "AddStringList", "drvstem."
4343 CALL VRSet "CN_CURRENT", 'Painting', 1
4344 IF options.!debug == 1 THEN SAY time()' '||"Refresh done"
4345RETURN 0
4346
4347/*:VRX SPIN_NRO1_Change
4348*/
4349SPIN_NRO1_Change:
4350 advanced.!smbconfchanged = 1
4351return
4352
4353/*:VRX SPIN_NRO2_Change
4354*/
4355SPIN_NRO2_Change:
4356 advanced.!smbconfchanged = 1
4357return
4358
4359/*:VRX SPIN_NRO3_Change
4360*/
4361SPIN_NRO3_Change:
4362 advanced.!smbconfchanged = 1
4363return
4364
4365/*:VRX SPIN_NRO4_Change
4366*/
4367SPIN_NRO4_Change:
4368 advanced.!smbconfchanged = 1
4369return
4370
4371/*:VRX SPLIT_Main_Move
4372*/
4373SPLIT_Main_Move:
4374 ok = VRset("Main", "Painting", 0)
4375 NewPos = VRInfo("Left")
4376 OldPos = VRGet("SPLIT_Main","Left")
4377 ok = VRSet("SPLIT_Main","Left", NewPos)
4378 ok = VRset("GB_SMBTREE","Left", NewPos+60)
4379 call Main_Resize
4380 ok = VRset("Main", "Painting", 1)
4381return
4382
4383/*:VRX SW_ABOUT_Close
4384*/
4385SW_ABOUT_Close:
4386 call SW_ABOUT_Fini
4387return
4388
4389/*:VRX SW_ABOUT_Create
4390*/
4391SW_ABOUT_Create:
4392 call SW_ABOUT_Init
4393
4394 CALL NLVSetText 'SW_ABOUT', "Caption", 1
4395 CALL NLVSetText 'PB_ABOUT_CLOSE', "Caption", 29
4396 CALL NLVSetText 'PB_ABOUT_COPY', "Caption", 121
4397 CALL NLVSetText 'CB_TRAC', "Caption", 134
4398
4399 ok = VRSet("DT_About","Caption", Program' (c) 2007-2012 Alexander Taylor and Herwig Bauernfeind')
4400
4401 About.DscFH = VRMethod( "CN_ABOUT", "AddField", "String", "Component" )
4402 About.ValFH = VRMethod( "CN_ABOUT", "AddField", "String", "Version" )
4403
4404 call _AboutSambaClientGetInfo
4405
4406return
4407/*:VRX SW_ABOUT_Fini
4408*/
4409SW_ABOUT_Fini:
4410 window = VRInfo( "Window" )
4411 call VRDestroy window
4412 drop window
4413return
4414/*:VRX SW_ABOUT_Init
4415*/
4416SW_ABOUT_Init:
4417 window = VRInfo( "Object" )
4418 if( \VRIsChildOf( window, "Notebook" ) ) then do
4419 call VRMethod window, "CenterWindow"
4420 call VRSet window, "Visible", 1
4421 call VRMethod window, "Activate"
4422 end
4423 drop window
4424return
4425
4426/*:VRX SW_ADVANCED_Close
4427*/
4428SW_ADVANCED_Close:
4429 call SW_ADVANCED_Fini
4430return
4431
4432/*:VRX SW_ADVANCED_Create
4433*/
4434SW_ADVANCED_Create:
4435 call SW_ADVANCED_Init
4436return
4437
4438/*:VRX SW_ADVANCED_Fini
4439*/
4440SW_ADVANCED_Fini:
4441 window = VRInfo( "Window" )
4442 call VRDestroy window
4443 drop window
4444return
4445/*:VRX SW_ADVANCED_Init
4446*/
4447SW_ADVANCED_Init:
4448 /* Title bar */
4449 CALL NLVSetText "SW_ADVANCED", "Caption", 40
4450
4451 /* Options */
4452 CALL NLVSetText "GB_ADVANCED", "Caption", 43
4453 CALL NLVSetText "CB_EAS", "Caption", 44
4454 CALL NLVSetText "CB_READONLY", "Caption", 45
4455 CALL NLVSetText "CB_ALWAYSMP", "Caption", 65
4456 CALL NLVSetText "DT_CACHETIMEOUT", "Caption", 130
4457 CALL NLVSetText "DT_CACHELISTINGS", "Caption", 131
4458
4459 /* Buttons */
4460 CALL NLVSetText "PB_ADVANCED_APPLY", "Caption", 122
4461 CALL NLVSetText "PB_ADVANCED_UNDO", "Caption", 123
4462 CALL NLVSetText "PB_ADVANCED_HELP", "Caption", 4
4463
4464 CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40)
4465
4466/* call VRMethod "SW_ADVANCED", "CenterWindow" */
4467 ok = VRSet("SW_ADVANCED", "Visible", 1)
4468/* call VRMethod "SW_ADVANCED", "Activate" */
4469return
4470
4471/*:VRX SW_ADVANCED_Init_Content
4472*/
4473SW_ADVANCED_Init_Content:
4474 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS", "Set", advanced.!easupport)
4475 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY","Set", advanced.!readonly)
4476 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP","Set", advanced.!alwaysmp)
4477 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT", "Value", advanced.!cachetimeout)
4478 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS", "Value", advanced.!cachelistings)
4479
4480 /* Obsolete */
4481 IF advanced.!memlen \= "" THEN ok = VRSet("SPB_MEMLEN", "Value", advanced.!memlen)
4482return
4483
4484/*:VRX SW_CONDET_Close
4485*/
4486SW_CONDET_Close:
4487 call SW_CONDET_Fini
4488return
4489
4490/*:VRX SW_CONDET_Create
4491*/
4492SW_CONDET_Create:
4493 call SW_CONDET_Init
4494return
4495
4496/*:VRX SW_CONDET_Fini
4497*/
4498SW_CONDET_Fini:
4499 window = VRInfo( "Window" )
4500 call VRDestroy window
4501 drop window
4502return
4503/*:VRX SW_CONDET_Init
4504*/
4505SW_CONDET_Init:
4506
4507return
4508
4509/*:VRX SW_CONDET_Init_Content
4510*/
4511SW_CONDET_Init_Content:
4512 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
4513
4514 /* Hide any "foreign" menu entries */
4515 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
4516return
4517
4518/*:VRX SW_DIALOG_Close
4519*/
4520SW_DIALOG_Close:
4521 call SW_DIALOG_Fini
4522return
4523
4524/*:VRX SW_DIALOG_Create
4525*/
4526SW_DIALOG_Create:
4527 call SW_DIALOG_Init
4528return
4529
4530/*:VRX SW_DIALOG_Fini
4531*/
4532SW_DIALOG_Fini:
4533 window = VRInfo( "Window" )
4534 call VRDestroy window
4535 drop window
4536return
4537/*:VRX SW_DIALOG_Init
4538*/
4539SW_DIALOG_Init:
4540
4541return
4542
4543/*:VRX SW_DIALOG_Init_Content
4544*/
4545SW_DIALOG_Init_Content:
4546 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
4547
4548 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
4549 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
4550 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
4551
4552 call _DialogPopulate
4553return
4554
4555/*:VRX SW_INFO_Close
4556*/
4557SW_INFO_Close:
4558 call SW_INFO_Fini
4559return
4560
4561/*:VRX SW_INFO_Create
4562*/
4563SW_INFO_Create:
4564 IF options.!debug == 1 THEN SAY time()' SW_INFO_Create started'
4565 call SW_INFO_Init
4566 CALL NLVSetText 'SW_INFO', "Caption", 92
4567 CALL NLVSetText 'PB_INFO_OK', "Caption", 2
4568 Info.TypeFH = VRMethod( "CN_INFO", "AddField", "String", "Type" )
4569 Info.ValueFH = VRMethod( "CN_INFO", "AddField", "String", "Value" )
4570
4571 IF options.!debug == 1 THEN do
4572 SAY ' Handle: "'SMBObj.rh'"'
4573 SAY ' Resource: "'SMBObj.resname'"'
4574 SAY ' Comment: "'SMBObj.comment'"'
4575 SAY ' Type: "'SMBObj.udatatype'"'
4576 SAY ' Message: "'SMBObj.udatamsg'"'
4577 SAY ' Icon: "'SMBObj.icon'"'
4578 end
4579
4580 rpc_success = _rpcsrvinfo(SMBObj.resname,credentials.!username,credentials.!password)
4581
4582 Info.!nbname = VRMethod( "CN_INFO", "AddRecord")
4583 Info.!comment = VRMethod( "CN_INFO", "AddRecord")
4584 Info.!domain = VRMethod( "CN_INFO", "AddRecord")
4585 Info.!DMBLMB = VRMethod( "CN_INFO", "AddRecord")
4586 if rpc_success = 1 then Info.!capabilities = VRMethod( "CN_INFO", "AddRecord")
4587 Info.!os = VRMethod( "CN_INFO", "AddRecord")
4588 Info.!server = VRMethod( "CN_INFO", "AddRecord")
4589 if rpc_success = 1 then Info.!version = VRMethod( "CN_INFO", "AddRecord")
4590 Info.!status = VRMethod( "CN_INFO", "AddRecord")
4591 Info.!IP = VRMethod( "CN_INFO", "AddRecord")
4592 Info.!MAC = VRMethod( "CN_INFO", "AddRecord")
4593
4594 if rpc_success = 1 then do
4595 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, rpc.srvinfo.NETBIOSNAME)
4596 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, rpc.srvinfo.SERVERSTRING)
4597 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!capabilities, Info.TypeFH, strip(NLVGetMessage(138),'T',':'),Info.ValueFH, rpc.srvinfo.CAPABILITIES)
4598 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!version,Info.TypeFH, strip(NLVGetMessage(139),'T',':'),Info.ValueFH, rpc.srvinfo.OS_VERSION)
4599 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'),Info.ValueFH, rpc.srvinfo.LOGONSTATUS )
4600 end
4601 else do
4602 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
4603 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
4604 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'), Info.ValueFH, SMBObj.udatamsg)
4605 end
4606
4607 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, WorkGroupFH ))
4608 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os, Info.TypeFH, strip(NLVGetMessage(93), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, OSFH ))
4609 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, VersionFH ))
4610 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!DMBLMB, Info.TypeFH, strip(NLVGetMessage(124),'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MBFH ))
4611 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!IP, Info.TypeFH, "IP" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, IPFH ))
4612 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!MAC, Info.TypeFH, "MAC" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MacFH ))
4613
4614 IF options.!debug == 1 THEN SAY time()' SW_INFO_Create done'
4615return
4616
4617/*:VRX SW_INFO_Fini
4618*/
4619SW_INFO_Fini:
4620 window = VRInfo( "Window" )
4621 call VRDestroy window
4622 drop window
4623return
4624/*:VRX SW_INFO_Init
4625*/
4626SW_INFO_Init:
4627 window = VRInfo( "Object" )
4628 if( \VRIsChildOf( window, "Notebook" ) ) then do
4629 call VRMethod window, "CenterWindow"
4630 call VRSet window, "Visible", 1
4631 call VRMethod window, "Activate"
4632 end
4633 drop window
4634return
4635
4636/*:VRX SW_LOGIN_Close
4637*/
4638SW_LOGIN_Close:
4639 call SW_LOGIN_Fini
4640return
4641
4642/*:VRX SW_LOGIN_Create
4643*/
4644SW_LOGIN_Create:
4645 call SW_LOGIN_Init
4646 ok = VRSet("SW_LOGIN","Caption",NLVGetMessage(136)' 'strip(p_workgroup' \\'p_server'\'p_share,'T','\'))
4647 CALL NLVSetText 'DT_USER1', "Caption", 25
4648 CALL NLVSetText 'DT_PASSWORD1', "Caption", 26
4649 CALL NLVSetText 'CB_STORECREDS1', "Caption", 135
4650 CALL NLVSetText 'PB_LOGIN_OK', "Caption", 2
4651 CALL NLVSetText 'PB_LOGIN_CANCEL',"Caption", 3
4652
4653 select
4654 when pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.rh, MBFH)) > 0 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
4655 when SMBObj.udatatype = "WORKGROUP" then LoginIcon = SMBObj.Icon
4656 when SMBObj.udatatype = "SERVER" then LoginIcon = SMBObj.Icon
4657 when SMBObj.udatatype = "DISK" then do
4658 if pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.parentrh, MBFH)) > 0
4659 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
4660 else LoginIcon = "#35:PMWP.DLL" /* icons.!pdc */
4661 end
4662 otherwise LoginIcon = "#35:PMWP.DLL" /* icons.!machine_awake */
4663 end
4664say loginicon
4665 ok = VRSet("Pict_Login","PicturePath", LoginIcon)
4666 ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
4667 ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value"))
4668 ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
4669return
4670
4671/*:VRX SW_LOGIN_Fini
4672*/
4673SW_LOGIN_Fini:
4674 window = VRInfo( "Window" )
4675 call VRDestroy window
4676 drop window
4677return
4678/*:VRX SW_LOGIN_Init
4679*/
4680SW_LOGIN_Init:
4681 window = VRInfo( "Object" )
4682 if( \VRIsChildOf( window, "Notebook" ) ) then do
4683 call VRMethod window, "CenterWindow"
4684 call VRSet window, "Visible", 1
4685 call VRMethod window, "Activate"
4686 end
4687 drop window
4688return
4689
4690/*:VRX SW_LOGIN_KeyPress
4691*/
4692SW_LOGIN_KeyPress:
4693 obj = VRInfo( "Object" )
4694 keystr = VRGet( obj, "KeyString" )
4695/* say keystr */
4696 select
4697 when keystr = "{Enter}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
4698 when keystr = "{Newline}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
4699 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
4700 otherwise nop
4701 end
4702return
4703
4704/*:VRX SW_MOUNTPOINT_Close
4705*/
4706SW_MOUNTPOINT_Close:
4707 call SW_MOUNTPOINT_Fini
4708return
4709
4710/*:VRX SW_MOUNTPOINT_Create
4711*/
4712SW_MOUNTPOINT_Create:
4713 call SW_MOUNTPOINT_Init
4714
4715 ok = VRSet("SW_MOUNTPOINT","Caption",strip(p_workgroup' \\'p_server'\'p_share,'T','\')) /* NLVGetMessage(14)' ' */
4716 CALL NLVSetText 'DT_MPOINT1', "Caption", 27
4717 CALL NLVSetText 'PB_NEWMOUNTPOINTOK', "Caption", 2
4718 CALL NLVSetText 'PB_NEWMOUNTPOINTCANCEL',"Caption", 3
4719 CALL NLVSetText 'CB_EAS1', "Caption", 44
4720 CALL NLVSetText 'CB_READONLY1', "Caption", 45
4721 CALL NLVSetText 'CB_ALWAYSMP1', "Caption", 65
4722 CALL NLVSetText "DT_CACHETIMEOUT1", "Caption", 130
4723 CALL NLVSetText "DT_CACHELISTINGS1", "Caption", 131
4724
4725 ok = VRMethod( "CB_DRIVES", "GetStringList", "freedrives." )
4726 ok = VRMethod( "CB_DRIVES1", "AddStringList", "freedrives." )
4727 ok = VRSet("CB_DRIVES1", "Value", VRGet("CB_Drives","Value"))
4728
4729 if VRGet("EF_Directory","Value") = "" then ok = VRSet("EF_DIRECTORY1", "Value", VRGet("EF_Directory","Value"))
4730
4731 ok = VRMethod("EF_DIRECTORY1","AddString",p_share)
4732
4733 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS1", "Set", advanced.!easupport)
4734 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY1", "Set", advanced.!readonly)
4735 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP1", "Set", advanced.!alwaysmp)
4736 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT1", "Value", advanced.!cachetimeout)
4737 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS1","Value", advanced.!cachelistings)
4738return
4739
4740/*:VRX SW_MOUNTPOINT_Fini
4741*/
4742SW_MOUNTPOINT_Fini:
4743 window = VRInfo( "Window" )
4744 call VRDestroy window
4745 drop window
4746return
4747/*:VRX SW_MOUNTPOINT_Init
4748*/
4749SW_MOUNTPOINT_Init:
4750 window = VRInfo( "Object" )
4751 if( \VRIsChildOf( window, "Notebook" ) ) then do
4752 call VRMethod window, "CenterWindow"
4753 call VRSet window, "Visible", 1
4754 call VRMethod window, "Activate"
4755 end
4756 drop window
4757return
4758
4759/*:VRX SW_PORTCONNECT_Close
4760*/
4761SW_PORTCONNECT_Close:
4762 call SW_PORTCONNECT_Fini
4763return
4764
4765/*:VRX SW_PORTCONNECT_Create
4766*/
4767SW_PORTCONNECT_Create:
4768 call SW_PORTCONNECT_Init
4769
4770 ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
4771
4772 if ok = "" then do
4773
4774 end
4775 else do
4776 say "Samba Spooler Port driver installed!"
4777 ok = SysINI("SYSTEM","PM_SPOOLER_PORT","ALL:","ports")
4778 smbport.0 = 0
4779 do I = 1 to ports.0
4780 if left(ports.I,3) = "SMB" then do
4781 X = smbport.0
4782 X = X + 1
4783 smbport.0 = X
4784 smbport.X = ports.I
4785 end
4786 end
4787 do I = 1 to smbport.0
4788 say smbport.I
4789 end
4790 end
4791
4792return
4793
4794/*:VRX SW_PORTCONNECT_Fini
4795*/
4796SW_PORTCONNECT_Fini:
4797 window = VRInfo( "Window" )
4798 call VRDestroy window
4799 drop window
4800return
4801/*:VRX SW_PORTCONNECT_Init
4802*/
4803SW_PORTCONNECT_Init:
4804 window = VRInfo( "Object" )
4805 if( \VRIsChildOf( window, "Notebook" ) ) then do
4806 call VRMethod window, "CenterWindow"
4807 call VRSet window, "Visible", 1
4808 call VRMethod window, "Activate"
4809 end
4810 drop window
4811return
4812
4813/*:VRX SW_PROGRESS_Close
4814*/
4815SW_PROGRESS_Close:
4816 options.!delay = 0
4817 call Main_Resize
4818 call VRSet 'Main', 'Visible', 1
4819 call SW_PROGRESS_Fini
4820return
4821
4822/*:VRX SW_PROGRESS_Create
4823*/
4824SW_PROGRESS_Create:
4825 call SW_PROGRESS_Init
4826 CALL NLVSetText 'SW_PROGRESS', "Caption", 1
4827 CALL NLVSetText 'DT_PROGRESS', "Caption", 34
4828 CALL NLVSetText 'PB_PROGRESS_ABORT', "Caption", 3
4829
4830 if options.!delay > 0 then ok = VRSet("TM_TheCloser","Delay", options.!delay*1000)
4831
4832 CALL VRSet "TM_Progress_Throbber","Enabled", 1
4833 CALL VRSet "TM_TheCloser","Enabled", 1
4834return
4835
4836/*:VRX SW_PROGRESS_Fini
4837*/
4838SW_PROGRESS_Fini:
4839 call VRDestroy "SW_PROGRESS"
4840return
4841/*:VRX SW_PROGRESS_Init
4842*/
4843SW_PROGRESS_Init:
4844 call VRMethod "SW_PROGRESS", "CenterWindow", "Parent"
4845 call VRSet "SW_PROGRESS", "Visible", 1
4846 call VRMethod "SW_PROGRESS", "Activate"
4847return
4848
4849/*:VRX SW_SETTINGS_Close
4850*/
4851SW_SETTINGS_Close:
4852 call SW_SETTINGS_Fini
4853return
4854
4855/*:VRX SW_SETTINGS_Create
4856*/
4857SW_SETTINGS_Create:
4858 call SW_SETTINGS_Init
4859return
4860
4861/*:VRX SW_SETTINGS_Fini
4862*/
4863SW_SETTINGS_Fini:
4864 window = VRInfo( "Window" )
4865 call VRDestroy window
4866 drop window
4867return
4868/*:VRX SW_SETTINGS_Init
4869*/
4870SW_SETTINGS_Init:
4871 /* Title bar */
4872 call NLVSetText "SW_SETTINGS", "Caption", 47
4873
4874 /* Options */
4875 call NLVSetText "GB_GLOBAL", "Caption", 47
4876 call NLVSetText "CB_DEBUG", "Caption", 42
4877 call NLVSetText "CB_LOGGING", "Caption", 46
4878 call NLVSetText "CB_BROWSEIMME", "Caption", 48
4879 call NLVSetText "CB_BROWSEAUTH", "Caption", 49
4880 call NLVSetText "CB_SPECIAL", "Caption", 66
4881 call NLVSetText "CB_SAVEPASSIVE", "Caption", 73
4882 call NLVSetText "CB_LMHOSTS", "Caption", 133
4883 call NLVSetText "CB_BROADCAST", "Caption", 74
4884 call NLVSetText "CB_MINIICONS", "Caption", 70
4885 call NLVSetText "CB_STORECREDS", "Caption", 135
4886
4887 /* Buttons */
4888 call NLVSetText "PB_SETTINGS_APPLY", "Caption", 122
4889 call NLVSetText "PB_SETTINGS_UNDO", "Caption", 123
4890 call NLVSetText "PB_SETTINGS_HELP", "Caption", 4
4891
4892/* call VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40) */
4893
4894/* call VRMethod "SW_SETTINGS", "CenterWindow" */
4895 ok = VRSet("SW_SETTINGS", "Visible", 1)
4896/* call VRMethod "SW_SETTINGS", "Activate" */
4897return
4898
4899/*:VRX SW_SETTINGS_Init_Content
4900*/
4901SW_SETTINGS_Init_Content:
4902 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 1)
4903
4904 if advanced.!browseauth \= "" then ok = VRSet("CB_BROWSEAUTH", "Set", advanced.!browseauth)
4905 if advanced.!browseimme \= "" then ok = VRSet("CB_BROWSEIMME", "Set", advanced.!browseimme)
4906 if advanced.!broadcast \= "" then ok = VRSet("CB_BROADCAST", "Set", advanced.!broadcast)
4907 if advanced.!special \= "" then ok = VRSet("CB_SPECIAL", "Set", advanced.!special)
4908 if advanced.!savepassive \= "" then ok = VRSet("CB_SAVEPASSIVE","Set", advanced.!savepassive)
4909 if advanced.!lmhosts \= "" then ok = VRSet("CB_LMHOSTS", "Set", advanced.!lmhosts)
4910
4911 call VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()"\ndpsmb.dbg")
4912 if options.!debug \= "" then ok = VRSet("CB_debug", "Set", options.!debug)
4913 if options.!storecreds \= "" then ok = VRSet("CB_STORECREDS", "Set", options.!storecreds)
4914
4915 if advanced.!miniicons \= "" then ok = VRSet("CB_MINIICONS", "Set", advanced.!miniicons)
4916
4917 /* Obsolete */
4918 if advanced.!logfile \= "" then ok = VRSet("EF_LOGFILE", "Value", advanced.!logfile)
4919 if advanced.!loglevel \= "0" then ok = VRSet("SPIN_LOGLEVEL", "Value", advanced.!loglevel)
4920
4921 call _SmbConfCreateShadowCopy
4922
4923 wins_support = translate(IniGet('wins support', 'global', samba.!shadowsmbconf))
4924
4925 if wins_support = "YES" then do /* we are a WINS server ourself */
4926 ok = VRSet("DT_WINS_SERVER","Enabled", 0)
4927 ok = VRSet("EF_WINS_SERVER","BackColor", "PaleGray")
4928 ok = VRSet("EF_WINS_SERVER","Value", "")
4929 ok = VRSet("EF_WINS_SERVER","Enabled", 0)
4930 end
4931 else do
4932 ok = VRSet("EF_WINS_SERVER","Value", IniGet('wins server', 'global', samba.!shadowsmbconf))
4933 end
4934
4935 name_resolve_order = IniGet('name resolve order', 'global', samba.!shadowsmbconf)
4936
4937 do I = 1 to words(name_resolve_order)
4938 ok = VRSet("SPIN_NRO"||I, "value", word(name_resolve_order,I))
4939 end
4940
4941 advanced.!smbconfchanged = 0
4942return
4943
4944/*:VRX SW_SMBTREE_Close
4945*/
4946SW_SMBTREE_Close:
4947 call SW_SMBTREE_Fini
4948return
4949
4950/*:VRX SW_SMBTREE_Create
4951*/
4952SW_SMBTREE_Create:
4953 call SW_SMBTREE_Init
4954return
4955
4956/*:VRX SW_SMBTREE_Fini
4957*/
4958SW_SMBTREE_Fini:
4959 window = VRInfo( "Window" )
4960 call VRDestroy window
4961 drop window
4962return
4963/*:VRX SW_SMBTREE_Init
4964*/
4965SW_SMBTREE_Init:
4966
4967return
4968
4969/*:VRX SW_SMBTREE_Init_Content
4970*/
4971SW_SMBTREE_Init_Content:
4972 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 1)
4973
4974 /* Hide any "foreign" menu entries */
4975 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
4976 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
4977return
4978
4979/*:VRX TDL_1_PageSelected
4980*/
4981TDL_1_PageSelected:
4982 page = VRInfo("Page")
4983
4984 /* call _TabsStrip */
4985 select
4986 when page = 1 then do /* dialog */
4987 call _TabFix 1
4988 end
4989 when page = 2 then do /* advanced */
4990 call SW_ADVANCED_Init_Content
4991 end
4992 when page = 3 then do /* smbtree */
4993 call SW_SMBTREE_Init_Content
4994 end
4995 when page = 4 then do /* condet */
4996 call SW_CONDET_Init_Content
4997 end
4998 when page = 5 then do /* Settings */
4999 call SW_SETTINGS_Init_Content
5000 end
5001 otherwise nop
5002 end
5003return
5004
5005/*:VRX TM_AutoClose_Trigger
5006*/
5007TM_AutoClose_Trigger:
5008 call Quit
5009return
5010
5011/*:VRX TM_Progress_Throbber_Trigger
5012*/
5013TM_Progress_Throbber_Trigger:
5014 pIdx = VRGet("Pict_Progress_Throbber","PicturePath")
5015 parse var pIdx '#' pidx
5016 pidx = pidx + 1
5017 if pidx = 36 then pidx = 11
5018 ok = VRSet("Pict_Progress_Throbber","PicturePath","#"pidx)
5019return
5020
5021/*:VRX TM_RefreshCurrentDisplay_Trigger
5022*/
5023TM_RefreshCurrentDisplay_Trigger:
5024 if RefreshMode <> "" then return
5025 if _DaemonRunning() = 0 then do
5026 say " Daemon not running - disable GUI"
5027 ok = VRset("GB_CURRENT", "Enabled", 0)
5028 ok = VRset("TDL_1", "Enabled", 0)
5029 ok = VRSet("Menu_File_Daemon_Start","Enabled", 1)
5030 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 0)
5031 end
5032 else do
5033 say " Daemon running - enable GUI"
5034 ok = VRset("GB_CURRENT", "Enabled", 1)
5035 ok = VRset("TDL_1", "Enabled", 1)
5036 ok = VRSet("Menu_File_Daemon_Start","Enabled", 0)
5037 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 1)
5038 end
5039 CALL REFRESH
5040return
5041
5042/*:VRX TM_RefreshTreeDisplay_Trigger
5043*/
5044TM_RefreshTreeDisplay_Trigger:
5045 ShowHidden = advanced.!special
5046 BroadCast = advanced.!broadcast
5047 DoLMHosts = advanced.!lmhosts
5048
5049 select
5050 when RefreshMode = "TREE" then do
5051 call _RefreshTreeDisplay
5052
5053 if smbtree.!workgroup <> 'SMBTREE.!WORKGROUP' then do
5054 ok = VRset("Menu_Selected_Connect", "Visible", VRMethod("CN_SMBTREE", "ValidateRecord", smbtree.!workgroup ) )
5055 end
5056 end
5057 when RefreshMode = "SHARE" then do
5058 call _AddSharesDisplay
5059 end
5060 otherwise say "RefreshMode = "RefreshMode
5061 end
5062 call _DialogPopulate
5063return
5064
5065/*:VRX TM_TheCloser_Trigger
5066*/
5067TM_TheCloser_Trigger:
5068 call SW_PROGRESS_Close
5069return
5070
5071/*:VRX TM_Throbber_Trigger
5072*/
5073TM_Throbber_Trigger:
5074 pIdx = VRGet("Pict_Throbber","PicturePath")
5075 parse var pIdx '#' pidx
5076 pidx = pidx + 1
5077 if pidx = 36 then pidx = 11
5078 ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
5079return
5080
Note: See TracBrowser for help on using the repository browser.