1 | /*:VRX Main
|
---|
2 | */
|
---|
3 | /* Main
|
---|
4 | */
|
---|
5 | Main:
|
---|
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
|
---|
58 | exit _VREReturnValue
|
---|
59 |
|
---|
60 | VRLoadSecondary:
|
---|
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:
|
---|
87 | return __vrlsHWnd
|
---|
88 |
|
---|
89 | /*:VRX __VXREXX____APPENDS__
|
---|
90 | */
|
---|
91 | __VXREXX____APPENDS__:
|
---|
92 | /*
|
---|
93 | #append U:\Develop\Samba\guitools-2.0\shared\nlv.vrs
|
---|
94 | #append U:\Develop\Samba\guitools-2.0\shared\inittempdir.vrs
|
---|
95 | #append U:\Develop\Samba\guitools-2.0\shared\sambainit.vrs
|
---|
96 | #append U:\Develop\Samba\guitools-2.0\shared\smbtree.vrs
|
---|
97 | */
|
---|
98 | return
|
---|
99 | /*:VRX _ContainerInit
|
---|
100 | */
|
---|
101 | _ContainerInit:
|
---|
102 | if options.!debug == 1 THEN SAY time()' _ContainerInit() started.'
|
---|
103 |
|
---|
104 | /* User */
|
---|
105 | UIconH = VRMethod( "CN_Users", "AddField", "Icon", NLVGetMessage(148) )
|
---|
106 | UsernameFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(131) )
|
---|
107 | GroupFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(132) )
|
---|
108 | UMachineFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(133) )
|
---|
109 | UIPAdrFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(147) )
|
---|
110 | UPIDFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(130) )
|
---|
111 |
|
---|
112 | /* Files */
|
---|
113 | FIconH = VRMethod( "CN_Files", "AddField", "Icon", NLVGetMessage(148) )
|
---|
114 | FileFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(134) )
|
---|
115 | FUserFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(131) )
|
---|
116 | FPIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(130) )
|
---|
117 | DenyModeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(135) )
|
---|
118 | TimeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(136) )
|
---|
119 | DateFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(149) )
|
---|
120 | AccessFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(137) )
|
---|
121 | RWFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(138) )
|
---|
122 | OplockFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(139) )
|
---|
123 | UIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(140) )
|
---|
124 | SharePathFH= VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(141) )
|
---|
125 | NameFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(142) )
|
---|
126 |
|
---|
127 | /* service */
|
---|
128 | SIconH = VRMethod( "CN_Service", "AddField", "Icon", NLVGetMessage(148) )
|
---|
129 | SPIDFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(130) )
|
---|
130 | ServiceFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(143) )
|
---|
131 | SMachineFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(133) )
|
---|
132 | ConnectedFH= VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(144) )
|
---|
133 |
|
---|
134 | /* daemons */
|
---|
135 | DaemonFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(145) )
|
---|
136 | DStatusFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(146) )
|
---|
137 | DPidsFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(130) )
|
---|
138 |
|
---|
139 | /* Browse tree */
|
---|
140 | WorkgroupFH= VRMethod( "CN_smbtree", "AddField", "String", NLVGetMessage(150) )
|
---|
141 | NBFH = VRMethod( "CN_smbtree", "AddField", "String", "NetBIOS name" )
|
---|
142 | IpFH = VRMethod( "CN_smbtree", "AddField", "String", NLVGetMessage(147) )
|
---|
143 | MBFH = VRMethod( "CN_smbtree", "AddField", "String", "DMB/LMB" )
|
---|
144 |
|
---|
145 | OSFH = VRMethod( "CN_smbtree", "AddField", "String", "OS" )
|
---|
146 | /* VersionFH = VRMethod( "CN_SmbTree", "AddField", "String", "Version" ) */
|
---|
147 | CommentFH = VRMethod( "CN_smbtree", "AddField", "String", NLVGetMessage(151) )
|
---|
148 | MacFH = VRMethod( "CN_smbtree", "AddField", "String", "MAC" )
|
---|
149 |
|
---|
150 | ok = VRMethod("CN_smbtree","SetfieldAttr",IPFH, "ReadOnly", 1)
|
---|
151 | ok = VRMethod("CN_smbtree","SetfieldAttr",NBFH, "ReadOnly", 1)
|
---|
152 | ok = VRMethod("CN_smbtree","SetfieldAttr",MBFH, "ReadOnly", 1)
|
---|
153 | ok = VRMethod("CN_smbtree","SetfieldAttr",WorkGroupFH,"ReadOnly", 1)
|
---|
154 | ok = VRMethod("CN_smbtree","SetfieldAttr",OSFH, "ReadOnly", 1)
|
---|
155 | ok = VRMethod("CN_smbtree","SetfieldAttr",MacFH, "ReadOnly", 1)
|
---|
156 |
|
---|
157 | ok = VRMethod("CN_Users","SetFieldAttr", UsernameFH, "VertJustification", "top")
|
---|
158 |
|
---|
159 | /* add records for the 3 daemons */
|
---|
160 | smbdHandle = VRMethod("CN_Daemons", "Addrecord",, ,"smbd.exe","$41")
|
---|
161 | ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DaemonFH, "smbd.exe")
|
---|
162 | nmbdHandle = VRMethod("CN_Daemons", "Addrecord", ,,"nmbd.exe","$41")
|
---|
163 | ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DaemonFH, "nmbd.exe")
|
---|
164 | winbHandle = VRMethod("CN_Daemons", "Addrecord",, ,"winbindd.exe","$41")
|
---|
165 | ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DaemonFH, "winbindd.exe")
|
---|
166 | ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
|
---|
167 | ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
|
---|
168 |
|
---|
169 | ok = VRMethod("CN_Daemons","SetRecordAttr","All", "Collapsed", 0 )
|
---|
170 |
|
---|
171 | if options.!debug == 1 THEN SAY time()' _ContainerInit() done.'
|
---|
172 | return
|
---|
173 |
|
---|
174 | /*:VRX _GuessIcon
|
---|
175 | */
|
---|
176 | _GuessIcon: procedure
|
---|
177 | text = arg(1)
|
---|
178 | select /* Printer guessing */
|
---|
179 | when pos('LJ',text) > 0 then res = '#65:PMWP.DLL'
|
---|
180 | when pos('LASER',text) > 0 then res = '#65:PMWP.DLL'
|
---|
181 | when pos('EPSON',text) > 0 then res = '#65:PMWP.DLL'
|
---|
182 | when pos('PRINT',text) > 0 then res = '#65:PMWP.DLL'
|
---|
183 | when pos('PRT',text) > 0 then res = '#65:PMWP.DLL'
|
---|
184 | when pos('CANON',text) > 0 then res = '#65:PMWP.DLL'
|
---|
185 | when pos('MINOLTA',text) > 0 then res = '#65:PMWP.DLL'
|
---|
186 | when pos('FAX',text) > 0 then res = '#65:PMWP.DLL'
|
---|
187 | when pos('LEXMARK',text) > 0 then res = '#65:PMWP.DLL'
|
---|
188 | when pos('IPC$',text) > 0 then res = '#59:PMWP.DLL'
|
---|
189 | otherwise res = "#34:PMWP.DLL"
|
---|
190 | end
|
---|
191 | return res
|
---|
192 |
|
---|
193 | /*:VRX _GUIInit
|
---|
194 | */
|
---|
195 | _GUIInit:
|
---|
196 |
|
---|
197 |
|
---|
198 | if datatype(Top) = 'NUM' then do
|
---|
199 | ok = VRset("Main","Top",Top)
|
---|
200 | ok = VRset("Main","Left",Left)
|
---|
201 | ok = VRset("Main","Width",Width)
|
---|
202 | ok = VRset("Main","Height",Height)
|
---|
203 | end
|
---|
204 |
|
---|
205 | /* Initialize Notebook pages */
|
---|
206 |
|
---|
207 | wh.1 = VRLoad( "TDL_1", VRWindowPath(), "SW_1" ) /* Users */
|
---|
208 | ok = VRMethod( "TDL_1", "InsertPage", wh.1, "+"NLVGetMessage(15) )
|
---|
209 |
|
---|
210 | wh.2 = VRLoad( "TDL_1", VRWindowPath(), "SW_2" ) /* Files */
|
---|
211 | ok = VRMethod( "TDL_1", "InsertPage", wh.2, "+"NLVGetMessage(16) )
|
---|
212 |
|
---|
213 | wh.3 = VRLoad( "TDL_1", VRWindowPath(), "SW_3" ) /* Service */
|
---|
214 | ok = VRMethod( "TDL_1", "InsertPage", wh.3, "+"NLVGetMessage(17) )
|
---|
215 |
|
---|
216 | wh.4 = VRLoad( "TDL_1", VRWindowPath(), "SW_4" ) /* Daemons */
|
---|
217 | ok = VRMethod( "TDL_1", "InsertPage", wh.4, "+"NLVGetMessage(18) )
|
---|
218 |
|
---|
219 | wh.5 = VRLoad( "TDL_1", VRWindowPath(), "SW_5" ) /* Browse */
|
---|
220 | ok = VRMethod( "TDL_1", "InsertPage", wh.5, "+"NLVGetMessage(19) )
|
---|
221 |
|
---|
222 | wh.6 = VRLoad( "TDL_1", VRWindowPath(), "SW_6" ) /* Settings */
|
---|
223 | ok = VRMethod( "TDL_1", "InsertPage", wh.6, "+"NLVGetMessage(24) )
|
---|
224 |
|
---|
225 | call _ContainerInit
|
---|
226 |
|
---|
227 | ok = VRSet("CB_Debug","set",options.!Debug)
|
---|
228 | if options.!Debug then ok = VRREdirectStdIO("ON")
|
---|
229 | else ok = VRREdirectStdIO("OFF")
|
---|
230 | ok = VRSet("SPIN_Intervall", "Value", settings.!intervall)
|
---|
231 | ok = VRSet("SPIN_IntervallMin","Value", settings.!intervallMin)
|
---|
232 | ok = VRSet("TM_Refresh","Delay", settings.!intervall * 1000)
|
---|
233 |
|
---|
234 | ok = VRSet("CB_NoMsgBox","Set", settings.!NoMsgBox)
|
---|
235 |
|
---|
236 | /* CALL NLVSetText 'SW_1', 'Userdata', 15
|
---|
237 | CALL NLVSetText 'SW_2', 'Userdata', 16
|
---|
238 | CALL NLVSetText 'SW_3', 'Userdata', 17
|
---|
239 | CALL NLVSetText 'SW_4', 'Userdata', 18
|
---|
240 | CALL NLVSetText 'SW_5', 'Userdata', 19
|
---|
241 | CALL NLVSetText 'SW_6', 'Userdata', 24 */
|
---|
242 |
|
---|
243 | CALL NLVSetText 'SW_1', 'Hinttext', 55
|
---|
244 | CALL NLVSetText 'SW_2', 'Hinttext', 56
|
---|
245 | CALL NLVSetText 'SW_3', 'Hinttext', 57
|
---|
246 | CALL NLVSetText 'SW_4', 'Hinttext', 58
|
---|
247 | CALL NLVSetText 'SW_5', 'Hinttext', 59
|
---|
248 | CALL NLVSetText 'SW_6', 'Hinttext', 60
|
---|
249 |
|
---|
250 | CALL NLVSetText 'DT_Refresh', 'Caption', 25
|
---|
251 | CALL NLVSetText 'DT_RefreshMin', 'Caption', 25
|
---|
252 | CALL NLVSetText 'DT_Intervall', 'Caption', 26
|
---|
253 | ok = VRSet("DT_IntervallMin","Caption", NLVGetMessage(26)' 'NLVGetMessage(28))
|
---|
254 | CALL NLVSetText 'CB_NoMsgBox', 'Caption', 27
|
---|
255 | return
|
---|
256 |
|
---|
257 | /*:VRX _INIRead
|
---|
258 | */
|
---|
259 | _INIRead:
|
---|
260 | if options.!debug == 1 THEN SAY time()' _INIRead() started'
|
---|
261 | OurINI = strip(VRParseFileName(VRget("Application","Program"),'DP')'\SMBMON.INI',,'\')
|
---|
262 | ok = SysFileTree(OurINI, INIFound.,'FO')
|
---|
263 | if INIFound.0 = 1 then OurINI = VRParseFileName(INIFound.1,'DPNE')
|
---|
264 |
|
---|
265 | if options.!debug == 1 then say ' OurINI='OurINI
|
---|
266 |
|
---|
267 | /* Main Window Position */
|
---|
268 | Top = VRGetIni( "Pos", "Top", OurINI , 'NoClose')
|
---|
269 | Left = VRGetIni( "Pos", "Left", OurINI , 'NoClose')
|
---|
270 | Width = VRGetIni( "Pos", "Width", OurINI , 'NoClose')
|
---|
271 | Height= VRGetIni( "Pos", "Height", OurINI , 'NoClose')
|
---|
272 |
|
---|
273 | settings.!intervall = VRGetIni( "Settings", "Intervall", OurINI)
|
---|
274 | if settings.!intervall = "" then settings.!intervall = 60
|
---|
275 |
|
---|
276 | settings.!intervallMin = VRGetIni( "Settings", "IntervallMin", OurINI)
|
---|
277 | if settings.!intervallMin = "" then settings.!intervallMin = 180
|
---|
278 |
|
---|
279 | settings.!NoMsgBox = VRGetIni( "Settings", "NoMsgBox", OurINI)
|
---|
280 | if settings.!NoMsgBox = "" then settings.!NoMsgBox = 0
|
---|
281 |
|
---|
282 | options.!debug = VRGetIni( "Options", "Debug", OurINI)
|
---|
283 | if options.!debug = "" then options.!debug = 0
|
---|
284 |
|
---|
285 | /* For Users page in case connections.tdb is not initialised */
|
---|
286 | IgnoreSmbNoInit = 1
|
---|
287 |
|
---|
288 | /* For Browse page */
|
---|
289 | FirstRun = 1
|
---|
290 |
|
---|
291 | /* For Refresh tree display code */
|
---|
292 | RefreshMode =""
|
---|
293 |
|
---|
294 | smbdpidhandle.0 = 0
|
---|
295 | nmbdpidhandle.0 = 0
|
---|
296 | winbpidhandle.0 = 0
|
---|
297 |
|
---|
298 | prevsmbdct = 0
|
---|
299 | prevnmbdct = 0
|
---|
300 | prevwinbct = 0
|
---|
301 |
|
---|
302 | if options.!debug == 1 THEN SAY time()' _INIRead() done'
|
---|
303 | return
|
---|
304 |
|
---|
305 | /*:VRX _INIWrite
|
---|
306 | */
|
---|
307 | _INIWrite:
|
---|
308 | if options.!debug == 1 THEN SAY time()' _INIWrite() started'
|
---|
309 | ok = VRSetIni( "Pos", "Top", VRGet("Main","Top"), OurINI, 'NoClose' )
|
---|
310 | ok = VRSetIni( "Pos", "Left", VRGet("Main","Left"), OurINI, 'NoClose' )
|
---|
311 | ok = VRSetIni( "Pos", "Width", VRGet("Main","Width"), OurINI, 'NoClose' )
|
---|
312 | ok = VRSetIni( "Pos", "Height", VRGet("Main","Height"), OurINI, 'NoClose' )
|
---|
313 |
|
---|
314 | ok = VRSetIni( "Settings", "Intervall", settings.!intervall, OurINI, 'NoClose' )
|
---|
315 | ok = VRSetIni( "Settings", "IntervallMin", settings.!intervallmin, OurINI, 'NoClose' )
|
---|
316 | ok = VRSetIni( "Settings", "NoMsgBox", settings.!NoMsgBox, OurINI, 'NoClose' )
|
---|
317 | ok = VRSetIni( "Options", "Debug", options.!debug, OurINI, 'NoClose' )
|
---|
318 |
|
---|
319 | /* ok = VRSetIni( "Settings", "BigIcons", \VRGet("CN_SMBTREE", "MiniIcons"),OurINI,'NoClose')
|
---|
320 | ok = VRSetIni( "Settings", "CurrentPageNr",CurrentPageNr, OurINI,'NoClose')
|
---|
321 | ok = VRSetIni( "Settings", "DaemonView", VRGet("CN_Daemons","View"), OurINI,'NoClose')
|
---|
322 | ok = VRSetIni( "Settings", "TreeView", VRGet("CN_smbtree","View"), OurINI,'NoClose') */
|
---|
323 |
|
---|
324 | if options.!debug == 1 THEN SAY time()' _INIWrite() done'
|
---|
325 | return
|
---|
326 |
|
---|
327 | /*:VRX _LoadOtherFuncs
|
---|
328 | */
|
---|
329 | _LoadOtherFuncs:
|
---|
330 | if options.!debug == 1 then ok = VRRedirectStdIO("ON")
|
---|
331 | else ok = VRRedirectStdIO("OFF")
|
---|
332 |
|
---|
333 | call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
|
---|
334 | call SysLoadFuncs
|
---|
335 |
|
---|
336 | call RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
|
---|
337 | call PRLoadFuncs
|
---|
338 | return
|
---|
339 |
|
---|
340 | /*:VRX _NLVSetup
|
---|
341 | */
|
---|
342 | _NLVSetup:
|
---|
343 | if options.!debug == 1 THEN SAY time()' _NLVSetup() started'
|
---|
344 | call NLVSetup
|
---|
345 | Msg.Title = NLVGetMessage(1)
|
---|
346 | ok = VRSet("Main","helpFile", settings.!helpfile)
|
---|
347 |
|
---|
348 | CALL NLVSetText 'PB_Refresh', 'Caption', 11
|
---|
349 | CALL NLVSetText 'PB_Cancel', 'Caption', 12
|
---|
350 | CALL NLVSetText 'PB_Help', 'Caption', 13
|
---|
351 | CALL NLVSetText 'PB_About', 'Caption', 14
|
---|
352 |
|
---|
353 | CALL NLVSetText 'PB_Refresh', 'Hinttext', 51
|
---|
354 | CALL NLVSetText 'PB_Cancel', 'Hinttext', 54
|
---|
355 | CALL NLVSetText 'PB_Help', 'Hinttext', 52
|
---|
356 | CALL NLVSetText 'PB_About', 'Hinttext', 53
|
---|
357 |
|
---|
358 |
|
---|
359 | /* CALL NLVSetText 'ContextMenu_Daemons_Sort', 'Caption', 35
|
---|
360 | CALL NLVSetText 'ContextMenu_Daemons_Ping', 'Caption', 32
|
---|
361 | CALL NLVSetText 'ContextMenu_Daemons_Details','Caption', 118
|
---|
362 | CALL NLVSetText 'ContextMenu_Daemons_Tree', 'Caption', 120
|
---|
363 |
|
---|
364 | CALL NLVSetText 'ContextMenu_Files_Sort', 'Caption', 35
|
---|
365 |
|
---|
366 | CALL NLVSetText 'ContextMenu_Service_Sort', 'Caption', 35
|
---|
367 | CALL NLVSetText 'ContextMenu_Service_CloseSHare', 'Caption', 70
|
---|
368 |
|
---|
369 | CALL NLVSetText 'ContextMenu_Users_SendMsg', 'Caption', 80
|
---|
370 | CALL NLVSetText 'ContextMenu_Users_Sort', 'Caption', 35
|
---|
371 |
|
---|
372 | CALL NLVSetText 'ContextMenu_Tree_SendMsg', 'Caption', 80
|
---|
373 | CALL NLVSetText 'ContextMenu_Tree_Sort', 'Caption', 35
|
---|
374 | CALL NLVSetText 'ContextMenu_Tree_Tree', 'Caption', 120
|
---|
375 | CALL NLVSetText 'ContextMenu_Tree_Details', 'Caption', 118 */
|
---|
376 | if options.!debug == 1 THEN SAY time()' _NLVSetup() done'
|
---|
377 | return
|
---|
378 |
|
---|
379 | /*:VRX _Refresh
|
---|
380 | */
|
---|
381 | _Refresh:
|
---|
382 | if options.!debug == 1 THEN SAY time()" _Refresh() started"
|
---|
383 | ok = VRSet("TM_refresh","Enabled", 0)
|
---|
384 | SmbNoInit = 0
|
---|
385 |
|
---|
386 | rfout = TempDir'refresh.out'
|
---|
387 | rferr = TempDir'refresh.err'
|
---|
388 |
|
---|
389 | call _SambaExe samba.!smbd' -V --debuglevel=0 2>'rferr' 1>'rfout
|
---|
390 |
|
---|
391 | SambaVer = "Samba "||strip(linein(rfout))
|
---|
392 | if options.!debug == 1 THEN SAY ' smbd.exe: "'SambaVer'"'
|
---|
393 | ok = stream(rfout,'c','close')
|
---|
394 |
|
---|
395 | call _SambaExe samba.!smbstatusexe' smbd 'DebugLevel' 2>'rferr' 1>'rfout
|
---|
396 |
|
---|
397 | /* First line is usually empty */
|
---|
398 | Hdr = linein(rfout)
|
---|
399 | SambaStVer = strip(linein(rfout)) /* we can detect version mismatches here */
|
---|
400 | if options.!debug == 1 THEN SAY ' smbstatus: "'SambaStVer'"'
|
---|
401 |
|
---|
402 | select
|
---|
403 | when pos('not initialised',SambaStVer) > 0 then do
|
---|
404 | SambaVer = SambaVer||" (Init)"
|
---|
405 | SmbNoInit = 1
|
---|
406 | end
|
---|
407 | when translate(SambaStVer) <> translate(SambaVer) then SambaVer = SambaVer||" (Hybrid)"
|
---|
408 | otherwise nop
|
---|
409 | end
|
---|
410 |
|
---|
411 | Ok = VRSet("Main", "Caption", SambaVer' - 'NLVGetMessage(146))
|
---|
412 |
|
---|
413 | /* Active User */
|
---|
414 | Hdr1 = linein(rfout)
|
---|
415 | /* say ' 1:'hdr1 */
|
---|
416 | Hdr2 = linein(rfout)
|
---|
417 | /* say ' 2:'hdr2 */
|
---|
418 | Zeile = linein(rfout)
|
---|
419 | if options.!debug == 1 THEN say ' 'Zeile
|
---|
420 | if SmbNoInit then do
|
---|
421 | call lineout samba.!msg, SambaStVer
|
---|
422 | call lineout samba.!msg, Hdr1
|
---|
423 | call lineout samba.!msg, Hdr2
|
---|
424 | call lineout samba.!msg, Zeile
|
---|
425 | ok = stream(samba.!msg,'c','close')
|
---|
426 | if IgnoreSmbNoInit then do
|
---|
427 | call _SambaShowMsg
|
---|
428 | IgnoreSmbNoInit = 0
|
---|
429 | end
|
---|
430 | end
|
---|
431 |
|
---|
432 | if options.!debug == 1 THEN SAY ' SmbNoInit = 'SmbNoInit
|
---|
433 |
|
---|
434 | /* Users page */
|
---|
435 | ok = VRSet("CN_Users","Painting", 0)
|
---|
436 | ok = VRMethod("CN_Users", "RemoveRecord", "ALL")
|
---|
437 |
|
---|
438 | Username.0 = 0
|
---|
439 | IP.0 = 0
|
---|
440 | Group.0 = 0
|
---|
441 | I = 0
|
---|
442 | if \SmbNoInit then do
|
---|
443 | do while Zeile <> ''
|
---|
444 | parse var Zeile UPID Username Group Machine IP
|
---|
445 | I = I + 1
|
---|
446 | UPID.I = UPID
|
---|
447 | Username.I = Username
|
---|
448 | Group.I = Group
|
---|
449 | IP = strip(IP)
|
---|
450 | parse var IP '('IP.I')'
|
---|
451 | RecHandle = VRMethod("CN_Users", "Addrecord")
|
---|
452 | ok = VRMethod("CN_Users", "SetFieldData", RecHandle, UIconH, "$44", UPIDFH, UPID, UsernameFH, Username, GroupFH, Group, UMachineFH, Machine, UIPAdrFH, IP.I)
|
---|
453 | Zeile = linein(rfout)
|
---|
454 | end
|
---|
455 | end
|
---|
456 | Username.0 = I
|
---|
457 | Group.0 = I
|
---|
458 | UPID.0 = I
|
---|
459 | ok = VRSet("CN_Users","Painting", 1)
|
---|
460 |
|
---|
461 | /* Active Services page */
|
---|
462 | Hdr = linein(rfout)
|
---|
463 | Hdr = linein(rfout)
|
---|
464 | I = 0
|
---|
465 | Zeile = linein(rfout)
|
---|
466 | ok = VRSet("CN_Service","Painting", 0)
|
---|
467 | ok = VRMethod("CN_Service", "RemoveRecord", "ALL")
|
---|
468 | do while Zeile <> ''
|
---|
469 | parse var Zeile Service SPId Machine Connected
|
---|
470 | I = I + 1
|
---|
471 | SPid.I = SPid
|
---|
472 | Machine.I = Machine
|
---|
473 | Service.I = Service
|
---|
474 | Icon = _GuessIcon(Service.I)
|
---|
475 |
|
---|
476 | Connected = strip(Connected)
|
---|
477 | T. = ""
|
---|
478 | parse var Connected T.WDay T.Month T.DoM T.TimeoD T.Year
|
---|
479 | Connected = T.TimeoD', 'T.WDay' 'T.DoM' 'T.Month' 'T.Year
|
---|
480 |
|
---|
481 | RecHandle = VRMethod("CN_Service", "Addrecord")
|
---|
482 | ok = VRMethod("CN_Service", "SetFieldData", RecHandle, SIconH, Icon, ServiceFH, Service, SPIDFH, SPID, SMachineFH, Machine, ConnectedFH, Connected)
|
---|
483 | Zeile = linein(rfout)
|
---|
484 | end
|
---|
485 | SPid.0 = I
|
---|
486 | Machine.0 = I
|
---|
487 | Service.0 = I
|
---|
488 |
|
---|
489 | ok = VRSet("CN_Service","Painting", 1)
|
---|
490 |
|
---|
491 | /* Open Files */
|
---|
492 | Hdr = linein(rfout)
|
---|
493 | Hdr = linein(rfout)
|
---|
494 | Hdr = linein(rfout)
|
---|
495 |
|
---|
496 | Zeile = linein(rfout)
|
---|
497 | ok = VRSet("CN_Files","Painting", 0)
|
---|
498 | ok = VRMethod("CN_Files", "RemoveRecord", "ALL")
|
---|
499 | File.0 = 0
|
---|
500 | FPID.0 = 0
|
---|
501 | do while Zeile <> ''
|
---|
502 | parse var Zeile FPid Uid DenyMode Access RW Oplock Sharepath Rest
|
---|
503 | TimeDate = right(rest,25)
|
---|
504 | Name = strip(left(Rest,max(length(Rest)-25),1))
|
---|
505 | I = I + 1
|
---|
506 | sharepath = strip(translate(left(sharepath,1))||translate(substr(SharePath,2),'\','/'),'T','\')
|
---|
507 | Username = UID
|
---|
508 | do J = 1 to UPID.0
|
---|
509 | if FPID = UPID.J then do
|
---|
510 | Username = Username.J
|
---|
511 | leave
|
---|
512 | end
|
---|
513 | end
|
---|
514 | File = SharePath||'\'||translate(Name,'\','/')
|
---|
515 | File.I = File
|
---|
516 | FPID.I = FPID
|
---|
517 | TimeDate = strip(TimeDate)
|
---|
518 | if options.!debug == 1 THEN say Timedate
|
---|
519 | T. = ""
|
---|
520 | parse var TimeDate T.WDay T.Month T.DoM T.TimeoD T.Year
|
---|
521 | FileTime = T.TimeoD
|
---|
522 | FileDate = T.WDay' 'T.DoM' 'T.Month' 'T.Year
|
---|
523 | RecHandle = VRMethod("CN_Files", "Addrecord")
|
---|
524 | ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FPidFH, FPid, FileFH, File, FUserFH, Username, UidFH, Uid, DenyModeFH, DenyMode, AccessFH, Access, RWFH, RW)
|
---|
525 | ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FIconH, "$45", TimeFH, FileTime, DateFH, FileDate, OplockFH, Oplock, SharePathFH, Sharepath, NameFH, Name)
|
---|
526 | Zeile = linein(rfout)
|
---|
527 | end
|
---|
528 | File.0 = I
|
---|
529 | FPID.0 = I
|
---|
530 |
|
---|
531 | ok = stream(rfout, 'c','close')
|
---|
532 | ok = stream(rferr, 'c','close')
|
---|
533 | ok = SysFileDelete(rfout)
|
---|
534 | ok = SysFileDelete(rferr)
|
---|
535 |
|
---|
536 | call _RefreshDaemons
|
---|
537 |
|
---|
538 | ok = VRSet("CN_Files","Painting", 1)
|
---|
539 |
|
---|
540 | if VRGet("Main", "WindowState") = "Minimized"
|
---|
541 | then ok = VRSet("TM_Refresh","Delay", settings.!intervallMin * 1000)
|
---|
542 | else ok = VRSet("TM_Refresh","Delay", settings.!intervall * 1000)
|
---|
543 |
|
---|
544 | ok = VRSet("TM_refresh","Enabled", 1)
|
---|
545 | if options.!debug == 1 THEN SAY time()" _Refresh() done"
|
---|
546 | return
|
---|
547 |
|
---|
548 | /*:VRX _RefreshDaemons
|
---|
549 | */
|
---|
550 | _RefreshDaemons:
|
---|
551 | if options.!debug == 1 THEN SAY time()' _RefreshDaemons() started'
|
---|
552 | ok = VRSet("CN_Daemons","Painting", 0 )
|
---|
553 |
|
---|
554 | call VRSet VRWindow(), 'Pointer', 'Wait'
|
---|
555 |
|
---|
556 | do I = 1 to smbdpidhandle.0
|
---|
557 | ok = VRMethod("CN_Daemons", "RemoveRecord", smbdpidhandle.I )
|
---|
558 | end
|
---|
559 |
|
---|
560 | do I = 1 to nmbdpidhandle.0
|
---|
561 | ok = VRMethod("CN_Daemons", "RemoveRecord", nmbdpidhandle.I )
|
---|
562 | end
|
---|
563 |
|
---|
564 | do I = 1 to winbpidhandle.0
|
---|
565 | ok = VRMethod("CN_Daemons", "RemoveRecord", winbpidhandle.I )
|
---|
566 | end
|
---|
567 |
|
---|
568 | Running = _SambaRunning()
|
---|
569 |
|
---|
570 | call VRSet VRWindow(), 'Pointer', '<default>'
|
---|
571 |
|
---|
572 | smbdpids = pids.!smbd
|
---|
573 | nmbdpids = pids.!nmbd
|
---|
574 | winbpids = pids.!nmbd
|
---|
575 |
|
---|
576 | smbdRunning = running.!smbd
|
---|
577 | nmbdRunning = running.!nmbd
|
---|
578 | winbRunning = running.!winb
|
---|
579 |
|
---|
580 | if smbdRunning then do
|
---|
581 | ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, smbdpids)
|
---|
582 | ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$46")
|
---|
583 | smbdpidhandle.0 = words(smbdpids)
|
---|
584 | if options.!debug = 1 then do
|
---|
585 | if smbdpidhandle.0 > prevsmbdct then do
|
---|
586 | prevsmbdct = smbdpidhandle.0
|
---|
587 | call beep 880*1, 10
|
---|
588 | call beep 880*2, 10
|
---|
589 | call beep 880*4, 10
|
---|
590 | end
|
---|
591 | if smbdpidhandle.0 < prevsmbdct then do
|
---|
592 | prevsmbdct = smbdpidhandle.0
|
---|
593 | call beep 880*4, 10
|
---|
594 | call beep 880*2, 10
|
---|
595 | call beep 880*1, 10
|
---|
596 | end
|
---|
597 | end
|
---|
598 |
|
---|
599 | do I = 1 to words(smbdpids)
|
---|
600 | Username = ""
|
---|
601 | do J = 1 to UPID.0
|
---|
602 | if UPID.J = word(smbdpids,I) then do
|
---|
603 | Username = ' 'Username.J
|
---|
604 | leave
|
---|
605 | end
|
---|
606 | end
|
---|
607 | smbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", smbdhandle, , 'PID 'word(smbdpids,I)' ('d2x(word(smbdpids,I))'x)', "$48")
|
---|
608 | if Username <> "" then do
|
---|
609 | smbdpidhandle.I.user = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I, , Username, "$44")
|
---|
610 | do J = 1 to FPID.0
|
---|
611 | if FPID.J = word(smbdpids,I) then do
|
---|
612 | dummyHandle = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I.user, , File.J, "$45")
|
---|
613 | end
|
---|
614 | end
|
---|
615 | end
|
---|
616 | end
|
---|
617 | end
|
---|
618 | else do
|
---|
619 | ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
|
---|
620 | ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$47")
|
---|
621 | if options.!debug = 1 then do
|
---|
622 | if prevsmbdct > 0 then do
|
---|
623 | prevsmbdct = 0
|
---|
624 | call beep 880*4, 10
|
---|
625 | call beep 880*2, 10
|
---|
626 | call beep 880*1, 10
|
---|
627 | end
|
---|
628 | end
|
---|
629 | end
|
---|
630 |
|
---|
631 | if nmbdRunning then do
|
---|
632 | ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, nmbdpids)
|
---|
633 | ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$46")
|
---|
634 | nmbdpidhandle.0 = words(nmbdpids)
|
---|
635 | do I = 1 to words(nmbdpids)
|
---|
636 | nmbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", nmbdhandle, , 'PID 'word(nmbdpids,I)' ('d2x(word(nmbdpids,I))'x)', "$48")
|
---|
637 | end
|
---|
638 | end
|
---|
639 | else do
|
---|
640 | ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
|
---|
641 | ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$47")
|
---|
642 | end
|
---|
643 |
|
---|
644 | if winbRunning then do
|
---|
645 | ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(40), DPidsFH, winbpids)
|
---|
646 | ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$46")
|
---|
647 | winbpidhandle.0 = words(winbpids)
|
---|
648 | do I = 1 to words(winbpids)
|
---|
649 | winbpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", winbhandle, , 'PID 'word(winbpids,I)' ('d2x(word(winbpids,I))'x)', "$48")
|
---|
650 | end
|
---|
651 | end
|
---|
652 | else do
|
---|
653 | ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
|
---|
654 | ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$47")
|
---|
655 | end
|
---|
656 |
|
---|
657 | /* if \(smbdrunning|nmbdrunning|winbrunning) then do
|
---|
658 | ok = VRSet("IPB_Start", "Visible", 1)
|
---|
659 | ok = VRSet("IPB_Stop", "Visible", 0)
|
---|
660 | ok = VRSet("IPB_ReStart", "Enabled", 0)
|
---|
661 | ok = VRSet("IPB_ReLoad", "Enabled", 0)
|
---|
662 | end
|
---|
663 | else do
|
---|
664 | ok = VRSet("IPB_Start", "Visible", 0)
|
---|
665 | ok = VRSet("IPB_Stop", "Visible", 1)
|
---|
666 | ok = VRSet("IPB_ReStart", "Enabled", 1)
|
---|
667 | ok = VRSet("IPB_ReLoad", "Enabled", 1)
|
---|
668 | end */
|
---|
669 |
|
---|
670 | ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
|
---|
671 | ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
|
---|
672 | ok = VRSet("CN_Daemons","Painting", 1 )
|
---|
673 | if Running then call _SambaUptime
|
---|
674 | if options.!debug == 1 THEN SAY time()' _RefreshDaemons() done'
|
---|
675 | return
|
---|
676 |
|
---|
677 | /*:VRX _SambaExe
|
---|
678 | */
|
---|
679 | _SambaExe: procedure expose samba. options. settings.
|
---|
680 | if options.!debug == 1 then say time()' _SambaExe() started.'
|
---|
681 | cmdline = arg(1)
|
---|
682 | if options.!debug == 1 THEN SAY ' Executing "'cmdline'"'
|
---|
683 | address cmd cmdline
|
---|
684 | if options.!debug == 1 then say time()' _SambaExe() done.'
|
---|
685 | return
|
---|
686 |
|
---|
687 | /*:VRX _SambaFindPIDFile
|
---|
688 | */
|
---|
689 | _SambaFindPIDFile:
|
---|
690 | if options.!debug == 1 THEN SAY time()' _SambaFindPIDfile() started'
|
---|
691 | ok = SysFileTree(ETC'\samba\pid\nmbd*pid',nmbdpid.,'FO')
|
---|
692 | if nmbdpid.0 = 1 then nmbdpidfile = nmbdpid.1; else nmbdpidfile = ""
|
---|
693 | if options.!debug == 1 THEN SAY " nmbdpidfile = "nmbdpidfile
|
---|
694 | if options.!debug == 1 THEN SAY time()' _SambaFindPIDfile() done'
|
---|
695 | return
|
---|
696 |
|
---|
697 | /*:VRX _SambaShowError
|
---|
698 | */
|
---|
699 | _SambaShowError: procedure expose samba. settings. options.
|
---|
700 | I = 0
|
---|
701 | do while lines(samba.!error) <> 0
|
---|
702 | I = I + 1
|
---|
703 | smberr.I = linein(samba.!error)
|
---|
704 | end
|
---|
705 | ok = stream(Samba.!error,"c","close")
|
---|
706 | smberr.0 = I
|
---|
707 | Buttons.1 = "OK" /* NLVGetMessage(2) */
|
---|
708 | Buttons.0 = 1
|
---|
709 | id = VRMessageStem( VRWindow(), "smberr.", VRGet("Main", "Caption") , "Error", "Buttons.", buttons.1, buttons.1 )
|
---|
710 | ok = SysFileDelete(Samba.!error)
|
---|
711 | return
|
---|
712 |
|
---|
713 | /*:VRX _SambaShowMsg
|
---|
714 | */
|
---|
715 | _SambaShowMsg: procedure expose samba. settings. options.
|
---|
716 | if options.!debug == 1 THEN SAY time()" _SambaShowMsg started"
|
---|
717 | skipWords = arg(1)
|
---|
718 | skip.0 = words(skipWords)
|
---|
719 | do J = 1 to skip.0
|
---|
720 | skip.J = translate(word(skipWords,J))
|
---|
721 | end
|
---|
722 | I = 0
|
---|
723 | do while lines(samba.!msg) <> 0
|
---|
724 | msgline = linein(samba.!msg)
|
---|
725 | SkipIt = 0
|
---|
726 | do J = 1 to skip.0
|
---|
727 | if pos(skip.J,translate(msgline)) > 0 then do
|
---|
728 | skipit = 1
|
---|
729 | leave
|
---|
730 | end
|
---|
731 | end
|
---|
732 | if \SkipIt then do
|
---|
733 | I = I + 1
|
---|
734 | smbmsg.I = strip(MsgLine)
|
---|
735 | end
|
---|
736 | end
|
---|
737 | ok = stream(Samba.!msg,"c","close")
|
---|
738 | say " stream close "Samba.!msg" = "ok
|
---|
739 | smbmsg.0 = I
|
---|
740 | if smbmsg.0 > 0 then do
|
---|
741 | Buttons.1 = "OK" /* NLVGetMessage(2) */
|
---|
742 | Buttons.0 = 1
|
---|
743 | id = VRMessageStem( VRWindow(), "smbmsg.", VRGet("Main", "Caption") , "I", "Buttons.", buttons.1, buttons.1 )
|
---|
744 | end
|
---|
745 | ok = SysFileDelete(Samba.!msg)
|
---|
746 | say " Delete "Samba.!msg" = "ok
|
---|
747 | if options.!debug == 1 THEN SAY time()" _SambaShowMsg done"
|
---|
748 | return
|
---|
749 |
|
---|
750 | /*:VRX _SambaUptime
|
---|
751 | */
|
---|
752 | _SambaUptime:
|
---|
753 | if options.!debug == 1 then say time()' _SambaUptime() started'
|
---|
754 | call _SambaFindPIDfile
|
---|
755 | if nmbdpidfile = "" then do
|
---|
756 | ok = VRset("CN_Daemons", "Caption", NLVGetMessage(42)||" "||NLVGetMessage(41))
|
---|
757 | return
|
---|
758 | end
|
---|
759 |
|
---|
760 | StartTime = SysGetFileDateTime(nmbdpidfile)
|
---|
761 | if StartTime = -1 then return
|
---|
762 |
|
---|
763 | NowTime = substr(date('S'),1,4)'-'substr(date('S'),5,2)'-'substr(date('S'),7,2)' 'time()
|
---|
764 |
|
---|
765 | /* StartTime = "2007-12-31 00:00:00"
|
---|
766 | NowTime = "2008-03-05 08:59:50" */
|
---|
767 |
|
---|
768 | if options.!debug == 1 then do
|
---|
769 | say ' started at "'StartTime'"'
|
---|
770 | say ' now it is "'NowTime'"'
|
---|
771 | end
|
---|
772 |
|
---|
773 | doM.0 = 12
|
---|
774 | doM.1 = 31; doM.2 = 28; doM.3 = 31; doM.4 = 30; doM.5 = 31; doM.6 = 30;
|
---|
775 | doM.7 = 31; doM.8 = 31; doM.9 = 30; doM.10= 31; doM.11= 30; doM.12= 31
|
---|
776 |
|
---|
777 | parse var StartTime sY'-'sM'-'sD' 'sH':'sMi':'sS
|
---|
778 | parse var NowTime nY'-'nM'-'nD' 'nH':'nMi':'nS
|
---|
779 |
|
---|
780 | if nY//4 = 0 & nY//400 <> 0 then doM.2 = 29
|
---|
781 |
|
---|
782 | uY =nY-sY
|
---|
783 | uM =nM-sM
|
---|
784 | uD =nD-sD
|
---|
785 | uH =nH-sH
|
---|
786 | uMi=nMi-sMi
|
---|
787 | uS =nS-sS
|
---|
788 |
|
---|
789 | if uS < 0 then do; uMi= uMi- 1; uS = uS + 60; end
|
---|
790 | if uMi< 0 then do; uH = uH - 1; uMi= uMi+ 60; end
|
---|
791 | if uH < 0 then do; uD = uD - 1; uH = uH + 24; end
|
---|
792 | if uD < 0 then do;
|
---|
793 | /* uM = uM - 1; */
|
---|
794 | if uM < 0 then uMx = uM + 12; else uMx = uM
|
---|
795 | uD = uD + doM.uMx - 1;
|
---|
796 | end
|
---|
797 | if uM < 0 then do; uY = uY - 1; uM = uM + 12; end
|
---|
798 |
|
---|
799 | if options.!debug == 1 then say ' uptime is 'uY uM uD uH uMi uS
|
---|
800 |
|
---|
801 | UpTimeStr = ' 'NlvGetMessage(43)':'
|
---|
802 | if uY <> 0 then UpTimeStr = UpTimeStr' 'uY' 'NlvGetMessage(44)
|
---|
803 | if uM <> 0 then UpTimeStr = UpTimeStr' 'uM' 'NlvGetMessage(45)
|
---|
804 | if uD <> 0 then UpTimeStr = UpTimeStr' 'uD' 'NlvGetMessage(46)
|
---|
805 | if uH <> 0 then UpTimeStr = UpTimeStr' 'uH' 'NlvGetMessage(47)
|
---|
806 | if uMi<> 0 then UpTimeStr = UpTimeStr' 'uMi' 'NlvGetMessage(48)
|
---|
807 | if uS <> 0 | UpTimeStr = ' 'NlvGetMessage(43)':' then UpTimeStr = UpTimeStr' 'uS' 'NlvGetMessage(49)
|
---|
808 |
|
---|
809 | ok = VRset("CN_Daemons", "Caption", UpTimeStr)
|
---|
810 | if options.!debug == 1 then say time()' _SambaUptime() done'
|
---|
811 | return
|
---|
812 |
|
---|
813 | /*:VRX _ShowMsg
|
---|
814 | */
|
---|
815 | _ShowMsg:
|
---|
816 | Buttons.1 = NLVGetMessage(2)
|
---|
817 | Buttons.0 = 1
|
---|
818 | id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 )
|
---|
819 | return
|
---|
820 |
|
---|
821 | /*:VRX CB_Debug_Click
|
---|
822 | */
|
---|
823 | CB_Debug_Click:
|
---|
824 | options.!debug = VRGet("CB_Debug","Set")
|
---|
825 | if options.!Debug then ok = VRREdirectStdIO("ON")
|
---|
826 | else ok = VRREdirectStdIO("OFF")
|
---|
827 | return
|
---|
828 |
|
---|
829 | /*:VRX CB_NoMsgBox_Click
|
---|
830 | */
|
---|
831 | CB_NoMsgBox_Click:
|
---|
832 | settings.!NoMsgBox = VRGet("CB_NoMsgBox","Set")
|
---|
833 | return
|
---|
834 |
|
---|
835 | /*:VRX Fini
|
---|
836 | */
|
---|
837 | Fini:
|
---|
838 | window = VRWindow()
|
---|
839 | call VRSet window, "Visible", 0
|
---|
840 | drop window
|
---|
841 | return 0
|
---|
842 |
|
---|
843 | /*:VRX Halt
|
---|
844 | */
|
---|
845 | Halt:
|
---|
846 | signal _VREHalt
|
---|
847 | return
|
---|
848 |
|
---|
849 | /*:VRX Init
|
---|
850 | */
|
---|
851 | Init:
|
---|
852 | window = VRWindow()
|
---|
853 | call VRMethod window, "CenterWindow"
|
---|
854 | call VRSet window, "Visible", 0
|
---|
855 | call VRMethod window, "Activate"
|
---|
856 | drop window
|
---|
857 | return
|
---|
858 |
|
---|
859 | /*:VRX Main_Close
|
---|
860 | */
|
---|
861 | Main_Close:
|
---|
862 | call Quit
|
---|
863 | return
|
---|
864 |
|
---|
865 | /*:VRX Main_Create
|
---|
866 | */
|
---|
867 | Main_Create:
|
---|
868 | options.!debug = 1
|
---|
869 |
|
---|
870 | call _LoadOtherFuncs
|
---|
871 | call _InitTempDir
|
---|
872 | call _SambaInit
|
---|
873 | if _SambaRunning() then call _SambaFindPIDfile
|
---|
874 | call _INIRead
|
---|
875 | call _NLVSetup
|
---|
876 | call _GUIInit
|
---|
877 |
|
---|
878 | call VRSet "Main", "Visible", 1
|
---|
879 | ok = VRMethod("PB_Refresh","SetFocus")
|
---|
880 | call PB_Refresh_Click
|
---|
881 | return
|
---|
882 |
|
---|
883 | /*:VRX Main_Resize
|
---|
884 | */
|
---|
885 | Main_Resize:
|
---|
886 | ok = VRSet("Main","Painting", 0)
|
---|
887 |
|
---|
888 | iWidth = VRget("Main", "InteriorWidth")
|
---|
889 | iHeight = VRget("Main", "InteriorHeight")
|
---|
890 | ok = VRSet("TDL_1","Width",iWidth)
|
---|
891 | ok = VRSet("TDL_1","Height",iHeight-500)
|
---|
892 |
|
---|
893 | ButtonNr = 4
|
---|
894 | ButtonHDist = 980
|
---|
895 | ButtonVDist = 450
|
---|
896 | ButtonHPos = format(max((iWidth-ButtonHDist*ButtonNr)/2,0),,0)
|
---|
897 |
|
---|
898 | ok = VRSet("PB_Refresh","Top", iHeight - ButtonVDist)
|
---|
899 | ok = VRSet("PB_About", "Top", iHeight - ButtonVDist)
|
---|
900 | ok = VRSet("PB_Help", "Top", iHeight - ButtonVDist)
|
---|
901 | ok = VRSet("PB_Cancel", "Top", iHeight - ButtonVDist)
|
---|
902 |
|
---|
903 | ok = VRSEt("PB_Refresh","Left",ButtonHPos+ButtonHDist*(ButtonNr-4))
|
---|
904 | ok = VRSEt("PB_About", "Left",ButtonHPos+ButtonHDist*(ButtonNr-3))
|
---|
905 | ok = VRSEt("PB_Help", "Left",ButtonHPos+ButtonHDist*(ButtonNr-2))
|
---|
906 | ok = VRSEt("PB_Cancel", "Left",ButtonHPos+ButtonHDist*(ButtonNr-1))
|
---|
907 |
|
---|
908 | cLeft = 120
|
---|
909 | cTop = 120
|
---|
910 | cWidth = iWidth - 1200
|
---|
911 | cHeight = iHeight- 1660
|
---|
912 |
|
---|
913 | if VRIsValidObject("CN_Users") then do
|
---|
914 | ok = VRset("CN_Users","Top", cTop)
|
---|
915 | ok = VRset("CN_Users","Left", cLeft)
|
---|
916 | ok = VRset("CN_Users","Width", cWidth)
|
---|
917 | ok = VRset("CN_Users","Height", cHeight)
|
---|
918 | end
|
---|
919 |
|
---|
920 | if VRIsValidObject("CN_Files") then do
|
---|
921 | ok = VRset("CN_Files","Top", cTop)
|
---|
922 | ok = VRset("CN_Files","Left", cLeft)
|
---|
923 | ok = VRset("CN_Files","Width", cWidth)
|
---|
924 | ok = VRset("CN_Files","Height", cHeight)
|
---|
925 | end
|
---|
926 |
|
---|
927 | if VRIsValidObject("CN_Service") then do
|
---|
928 | ok = VRset("CN_Service","Top", cTop)
|
---|
929 | ok = VRset("CN_Service","Left", cLeft)
|
---|
930 | ok = VRset("CN_Service","Width", cWidth)
|
---|
931 | ok = VRset("CN_Service","Height", cHeight)
|
---|
932 | end
|
---|
933 |
|
---|
934 | if VRIsValidObject("CN_Daemons") then do
|
---|
935 | ok = VRset("CN_Daemons","Top", cTop)
|
---|
936 | ok = VRset("CN_Daemons","Left", cLeft)
|
---|
937 | ok = VRset("CN_Daemons","Width", cWidth)
|
---|
938 | ok = VRset("CN_Daemons","Height", cHeight)
|
---|
939 | end
|
---|
940 |
|
---|
941 | if VRIsValidObject("CN_SmbTree") then do
|
---|
942 | ok = VRset("CN_SmbTree","Top", cTop)
|
---|
943 | ok = VRset("CN_SmbTree","Left", cLeft)
|
---|
944 | ok = VRset("CN_SmbTree","Width", cWidth)
|
---|
945 | ok = VRset("CN_SmbTree","Height", cHeight)
|
---|
946 | end
|
---|
947 |
|
---|
948 | /* check and empty event queue, trash spurious resize events */
|
---|
949 | EventString = ''
|
---|
950 | TrashedResize = 0
|
---|
951 | do until EventString = 'nop'
|
---|
952 | EventString = VREvent('N')
|
---|
953 | if EventString <> 'nop' then do
|
---|
954 | if EventString = 'CALL 'MainWin'_Resize' then TrashedResize = 1
|
---|
955 | else interpret eventString
|
---|
956 | end
|
---|
957 | end
|
---|
958 |
|
---|
959 | ok = VRSet("Main","Painting", 1)
|
---|
960 | return
|
---|
961 |
|
---|
962 | /*:VRX PB_Cancel_Click
|
---|
963 | */
|
---|
964 | PB_Cancel_Click:
|
---|
965 | call Quit
|
---|
966 | return
|
---|
967 |
|
---|
968 | /*:VRX PB_Refresh_Click
|
---|
969 | */
|
---|
970 | PB_Refresh_Click:
|
---|
971 | call _Refresh
|
---|
972 | call _RefreshTree
|
---|
973 | return
|
---|
974 |
|
---|
975 | /*:VRX Quit
|
---|
976 | */
|
---|
977 | Quit:
|
---|
978 | call _INIWrite
|
---|
979 | window = VRWindow()
|
---|
980 | call VRSet window, "Shutdown", 1
|
---|
981 | drop window
|
---|
982 | return
|
---|
983 |
|
---|
984 | /*:VRX SPIN_Intervall_Change
|
---|
985 | */
|
---|
986 | SPIN_Intervall_Change:
|
---|
987 | settings.!intervall = VRget("SPIN_Intervall","Value")
|
---|
988 | ok = VRSet("TM_Refresh","Delay", settings.!intervall * 1000)
|
---|
989 | return
|
---|
990 |
|
---|
991 | /*:VRX SPIN_IntervallMin_Change
|
---|
992 | */
|
---|
993 | SPIN_IntervallMin_Change:
|
---|
994 | settings.!intervallmin = VRget("SPIN_IntervallMin","Value")
|
---|
995 | return
|
---|
996 |
|
---|
997 | /*:VRX SW_1_Close
|
---|
998 | */
|
---|
999 | SW_1_Close:
|
---|
1000 | call SW_1_Fini
|
---|
1001 | return
|
---|
1002 |
|
---|
1003 | /*:VRX SW_1_Create
|
---|
1004 | */
|
---|
1005 | SW_1_Create:
|
---|
1006 | call SW_1_Init
|
---|
1007 | return
|
---|
1008 |
|
---|
1009 | /*:VRX SW_1_Fini
|
---|
1010 | */
|
---|
1011 | SW_1_Fini:
|
---|
1012 | window = VRInfo( "Window" )
|
---|
1013 | call VRDestroy window
|
---|
1014 | drop window
|
---|
1015 | return
|
---|
1016 | /*:VRX SW_1_Init
|
---|
1017 | */
|
---|
1018 | SW_1_Init:
|
---|
1019 | window = VRInfo( "Object" )
|
---|
1020 | if( \VRIsChildOf( window, "Notebook" ) ) then do
|
---|
1021 | call VRMethod window, "CenterWindow"
|
---|
1022 | call VRSet window, "Visible", 1
|
---|
1023 | call VRMethod window, "Activate"
|
---|
1024 | end
|
---|
1025 | drop window
|
---|
1026 | return
|
---|
1027 |
|
---|
1028 | /*:VRX SW_2_Close
|
---|
1029 | */
|
---|
1030 | SW_2_Close:
|
---|
1031 | call SW_2_Fini
|
---|
1032 | return
|
---|
1033 |
|
---|
1034 | /*:VRX SW_2_Create
|
---|
1035 | */
|
---|
1036 | SW_2_Create:
|
---|
1037 | call SW_2_Init
|
---|
1038 | return
|
---|
1039 |
|
---|
1040 | /*:VRX SW_2_Fini
|
---|
1041 | */
|
---|
1042 | SW_2_Fini:
|
---|
1043 | window = VRInfo( "Window" )
|
---|
1044 | call VRDestroy window
|
---|
1045 | drop window
|
---|
1046 | return
|
---|
1047 | /*:VRX SW_2_Init
|
---|
1048 | */
|
---|
1049 | SW_2_Init:
|
---|
1050 | window = VRInfo( "Object" )
|
---|
1051 | if( \VRIsChildOf( window, "Notebook" ) ) then do
|
---|
1052 | call VRMethod window, "CenterWindow"
|
---|
1053 | call VRSet window, "Visible", 1
|
---|
1054 | call VRMethod window, "Activate"
|
---|
1055 | end
|
---|
1056 | drop window
|
---|
1057 | return
|
---|
1058 |
|
---|
1059 | /*:VRX SW_3_Close
|
---|
1060 | */
|
---|
1061 | SW_3_Close:
|
---|
1062 | call SW_3_Fini
|
---|
1063 | return
|
---|
1064 |
|
---|
1065 | /*:VRX SW_3_Create
|
---|
1066 | */
|
---|
1067 | SW_3_Create:
|
---|
1068 | call SW_3_Init
|
---|
1069 | return
|
---|
1070 |
|
---|
1071 | /*:VRX SW_3_Fini
|
---|
1072 | */
|
---|
1073 | SW_3_Fini:
|
---|
1074 | window = VRInfo( "Window" )
|
---|
1075 | call VRDestroy window
|
---|
1076 | drop window
|
---|
1077 | return
|
---|
1078 | /*:VRX SW_3_Init
|
---|
1079 | */
|
---|
1080 | SW_3_Init:
|
---|
1081 | window = VRInfo( "Object" )
|
---|
1082 | if( \VRIsChildOf( window, "Notebook" ) ) then do
|
---|
1083 | call VRMethod window, "CenterWindow"
|
---|
1084 | call VRSet window, "Visible", 1
|
---|
1085 | call VRMethod window, "Activate"
|
---|
1086 | end
|
---|
1087 | drop window
|
---|
1088 | return
|
---|
1089 |
|
---|
1090 | /*:VRX SW_4_Close
|
---|
1091 | */
|
---|
1092 | SW_4_Close:
|
---|
1093 | call SW_4_Fini
|
---|
1094 | return
|
---|
1095 |
|
---|
1096 | /*:VRX SW_4_Create
|
---|
1097 | */
|
---|
1098 | SW_4_Create:
|
---|
1099 | call SW_4_Init
|
---|
1100 | return
|
---|
1101 |
|
---|
1102 | /*:VRX SW_4_Fini
|
---|
1103 | */
|
---|
1104 | SW_4_Fini:
|
---|
1105 | window = VRInfo( "Window" )
|
---|
1106 | call VRDestroy window
|
---|
1107 | drop window
|
---|
1108 | return
|
---|
1109 | /*:VRX SW_4_Init
|
---|
1110 | */
|
---|
1111 | SW_4_Init:
|
---|
1112 | window = VRInfo( "Object" )
|
---|
1113 | if( \VRIsChildOf( window, "Notebook" ) ) then do
|
---|
1114 | call VRMethod window, "CenterWindow"
|
---|
1115 | call VRSet window, "Visible", 1
|
---|
1116 | call VRMethod window, "Activate"
|
---|
1117 | end
|
---|
1118 | drop window
|
---|
1119 | return
|
---|
1120 |
|
---|
1121 | /*:VRX SW_5_Close
|
---|
1122 | */
|
---|
1123 | SW_5_Close:
|
---|
1124 | call SW_5_Fini
|
---|
1125 | return
|
---|
1126 |
|
---|
1127 | /*:VRX SW_5_Create
|
---|
1128 | */
|
---|
1129 | SW_5_Create:
|
---|
1130 | call SW_5_Init
|
---|
1131 | return
|
---|
1132 |
|
---|
1133 | /*:VRX SW_5_Fini
|
---|
1134 | */
|
---|
1135 | SW_5_Fini:
|
---|
1136 | window = VRInfo( "Window" )
|
---|
1137 | call VRDestroy window
|
---|
1138 | drop window
|
---|
1139 | return
|
---|
1140 | /*:VRX SW_5_Init
|
---|
1141 | */
|
---|
1142 | SW_5_Init:
|
---|
1143 | window = VRInfo( "Object" )
|
---|
1144 | if( \VRIsChildOf( window, "Notebook" ) ) then do
|
---|
1145 | call VRMethod window, "CenterWindow"
|
---|
1146 | call VRSet window, "Visible", 1
|
---|
1147 | call VRMethod window, "Activate"
|
---|
1148 | end
|
---|
1149 | drop window
|
---|
1150 | return
|
---|
1151 |
|
---|
1152 | /*:VRX SW_6_Close
|
---|
1153 | */
|
---|
1154 | SW_6_Close:
|
---|
1155 | call SW_6_Fini
|
---|
1156 | return
|
---|
1157 |
|
---|
1158 | /*:VRX SW_6_Create
|
---|
1159 | */
|
---|
1160 | SW_6_Create:
|
---|
1161 | call SW_6_Init
|
---|
1162 | return
|
---|
1163 |
|
---|
1164 | /*:VRX SW_6_Fini
|
---|
1165 | */
|
---|
1166 | SW_6_Fini:
|
---|
1167 | window = VRInfo( "Window" )
|
---|
1168 | call VRDestroy window
|
---|
1169 | drop window
|
---|
1170 | return
|
---|
1171 | /*:VRX SW_6_Init
|
---|
1172 | */
|
---|
1173 | SW_6_Init:
|
---|
1174 | window = VRInfo( "Object" )
|
---|
1175 | if( \VRIsChildOf( window, "Notebook" ) ) then do
|
---|
1176 | call VRMethod window, "CenterWindow"
|
---|
1177 | call VRSet window, "Visible", 1
|
---|
1178 | call VRMethod window, "Activate"
|
---|
1179 | end
|
---|
1180 | drop window
|
---|
1181 | return
|
---|
1182 |
|
---|
1183 | /*:VRX TDL_1_PageSelected
|
---|
1184 | */
|
---|
1185 | TDL_1_PageSelected:
|
---|
1186 | say VRInfo("OldPage")
|
---|
1187 | say VRInfo("OldPageWindow")
|
---|
1188 | say VRInfo("Page")
|
---|
1189 | return
|
---|
1190 |
|
---|
1191 | /*:VRX TM_Refresh_Trigger
|
---|
1192 | */
|
---|
1193 | TM_Refresh_Trigger:
|
---|
1194 | call PB_Refresh_Click
|
---|
1195 | return
|
---|
1196 |
|
---|
1197 | /*:VRX TM_RefreshTreeDisplay_Trigger
|
---|
1198 | */
|
---|
1199 | TM_RefreshTreeDisplay_Trigger:
|
---|
1200 | select
|
---|
1201 | when RefreshMode = "TREE" then do
|
---|
1202 | call _RefreshTreeDisplay
|
---|
1203 | end
|
---|
1204 | when RefreshMode = "SHARE" then do
|
---|
1205 | call _AddSharesDisplay
|
---|
1206 | end
|
---|
1207 | otherwise say "RefreshMode = "RefreshMode
|
---|
1208 | end
|
---|
1209 | return
|
---|
1210 |
|
---|