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

Last change on this file since 729 was 703, checked in by Herwig Bauernfeind, 13 years ago

GUI-Tools: Updates in EVFSGUI/SMBMON/Shared code

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