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

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

GUI-Tools: Updates in EVFSGUI

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