| 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\inittempdir.vrs
|
|---|
| 94 | #append U:\Develop\Samba\guitools-1.0\shared\sambainit.vrs
|
|---|
| 95 | #append U:\Develop\Samba\guitools-1.0\shared\nlv.vrs
|
|---|
| 96 | #append U:\Develop\Samba\guitools-2.0\shared\smbtree.vrs
|
|---|
| 97 | */
|
|---|
| 98 | return
|
|---|
| 99 | /*:VRX _ColumnShow
|
|---|
| 100 | */
|
|---|
| 101 | _ColumnShow:
|
|---|
| 102 | userdata = VRGet(VRInfo("Object"),"Userdata")
|
|---|
| 103 | parse var userdata Container '|' fieldh '|' VisStatus
|
|---|
| 104 | say userdata
|
|---|
| 105 | ok = VRMethod(Container,"SetFieldAttr", fieldh, "Visible", \VisStatus )
|
|---|
| 106 | return
|
|---|
| 107 |
|
|---|
| 108 | /*:VRX _ColumnsMenu
|
|---|
| 109 | */
|
|---|
| 110 | _ColumnsMenu:
|
|---|
| 111 | Container = arg(1)
|
|---|
| 112 | ok = VRMethod(Container, "GetFieldList", "Fields." )
|
|---|
| 113 |
|
|---|
| 114 | do I = 1 to 12
|
|---|
| 115 | if I <= fields.0 then do
|
|---|
| 116 | /* say "Columns_"||right("0"||I,2)' 'VRMethod(Container, "GetFieldAttr", fields.I, "Title" ) */
|
|---|
| 117 | ok = VRset("Columns_"||right("0"||I,2), "Visible", 1)
|
|---|
| 118 | ok = VRset("Columns_"||right("0"||I,2), "Caption", VRMethod(Container, "GetFieldAttr", fields.I, "Title" ))
|
|---|
| 119 | ok = VRset("Columns_"||right("0"||I,2), "Checked", VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
|
|---|
| 120 | ok = VRset("Columns_"||right("0"||I,2), "Userdata", Container'|'fields.I'|'VRMethod(Container, "GetFieldAttr", fields.I, "Visible" ))
|
|---|
| 121 | end
|
|---|
| 122 | else ok = VRset("Columns_"||right("0"||I,2), "Visible", 0)
|
|---|
| 123 | end
|
|---|
| 124 | ok = VRMethod( "Columns", "Popup", , , "", "" )
|
|---|
| 125 | return
|
|---|
| 126 |
|
|---|
| 127 | /*:VRX _ContainerInit
|
|---|
| 128 | */
|
|---|
| 129 | _ContainerInit:
|
|---|
| 130 | say '_ContainerInit() started.'
|
|---|
| 131 |
|
|---|
| 132 | /* User */
|
|---|
| 133 | UIconH = VRMethod( "CN_Users", "AddField", "Icon", NLVGetMessage(148) )
|
|---|
| 134 | UsernameFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(131) )
|
|---|
| 135 | GroupFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(132) )
|
|---|
| 136 | UMachineFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(133) )
|
|---|
| 137 | UIPAdrFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(147) )
|
|---|
| 138 | UPIDFH = VRMethod( "CN_Users", "AddField", "String", NLVGetMessage(130) )
|
|---|
| 139 |
|
|---|
| 140 | /* Files */
|
|---|
| 141 | FIconH = VRMethod( "CN_Files", "AddField", "Icon", NLVGetMessage(148) )
|
|---|
| 142 | FileFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(134) )
|
|---|
| 143 | FUserFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(131) )
|
|---|
| 144 | FPIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(130) )
|
|---|
| 145 | DenyModeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(135) )
|
|---|
| 146 | TimeFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(136) )
|
|---|
| 147 | DateFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(149) )
|
|---|
| 148 | AccessFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(137) )
|
|---|
| 149 | RWFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(138) )
|
|---|
| 150 | OplockFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(139) )
|
|---|
| 151 | UIDFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(140) )
|
|---|
| 152 | SharePathFH= VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(141) )
|
|---|
| 153 | NameFH = VRMethod( "CN_Files", "AddField", "String", NLVGetMessage(142) )
|
|---|
| 154 |
|
|---|
| 155 | /* service */
|
|---|
| 156 | SIconH = VRMethod( "CN_Service", "AddField", "Icon", NLVGetMessage(148) )
|
|---|
| 157 | SPIDFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(130) )
|
|---|
| 158 | ServiceFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(143) )
|
|---|
| 159 | SMachineFH = VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(133) )
|
|---|
| 160 | ConnectedFH= VRMethod( "CN_Service", "AddField", "String", NLVGetMessage(144) )
|
|---|
| 161 |
|
|---|
| 162 | /* daemons */
|
|---|
| 163 | DaemonFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(145) )
|
|---|
| 164 | DStatusFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(146) )
|
|---|
| 165 | DPidsFH = VRMethod( "CN_Daemons", "AddField", "String", NLVGetMessage(130) )
|
|---|
| 166 |
|
|---|
| 167 | /* Browse tree */
|
|---|
| 168 | WorkgroupFH= VRMethod( "CN_smbtree", "AddField", "String", NLVGetMessage(150) )
|
|---|
| 169 | NBFH = VRMethod( "CN_smbtree", "AddField", "String", "NetBIOS name" )
|
|---|
| 170 | IpFH = VRMethod( "CN_smbtree", "AddField", "String", NLVGetMessage(147) )
|
|---|
| 171 | MBFH = VRMethod( "CN_smbtree", "AddField", "String", "DMB/LMB" )
|
|---|
| 172 |
|
|---|
| 173 | OSFH = VRMethod( "CN_smbtree", "AddField", "String", "OS" )
|
|---|
| 174 | /* VersionFH = VRMethod( "CN_SmbTree", "AddField", "String", "Version" ) */
|
|---|
| 175 | CommentFH = VRMethod( "CN_smbtree", "AddField", "String", NLVGetMessage(151) )
|
|---|
| 176 | MacFH = VRMethod( "CN_smbtree", "AddField", "String", "MAC" )
|
|---|
| 177 |
|
|---|
| 178 | ok = VRMethod("CN_smbtree","SetfieldAttr",IPFH, "ReadOnly", 1)
|
|---|
| 179 | ok = VRMethod("CN_smbtree","SetfieldAttr",NBFH, "ReadOnly", 1)
|
|---|
| 180 | ok = VRMethod("CN_smbtree","SetfieldAttr",MBFH, "ReadOnly", 1)
|
|---|
| 181 | ok = VRMethod("CN_smbtree","SetfieldAttr",WorkGroupFH,"ReadOnly", 1)
|
|---|
| 182 | ok = VRMethod("CN_smbtree","SetfieldAttr",OSFH, "ReadOnly", 1)
|
|---|
| 183 | ok = VRMethod("CN_smbtree","SetfieldAttr",MacFH, "ReadOnly", 1)
|
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 | /* add records for the 3 daemons */
|
|---|
| 187 | smbdHandle = VRMethod("CN_Daemons", "Addrecord",, ,"smbd.exe","$41")
|
|---|
| 188 | ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DaemonFH, "smbd.exe")
|
|---|
| 189 | nmbdHandle = VRMethod("CN_Daemons", "Addrecord", ,,"nmbd.exe","$41")
|
|---|
| 190 | ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DaemonFH, "nmbd.exe")
|
|---|
| 191 | winbHandle = VRMethod("CN_Daemons", "Addrecord",, ,"winbindd.exe","$41")
|
|---|
| 192 | ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DaemonFH, "winbindd.exe")
|
|---|
| 193 | ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
|
|---|
| 194 | ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
|
|---|
| 195 |
|
|---|
| 196 | ok = VRMethod("CN_Daemons","SetRecordAttr","All", "Collapsed", 0 )
|
|---|
| 197 |
|
|---|
| 198 | say '_ContainerInit() done.'
|
|---|
| 199 | return
|
|---|
| 200 | /*:VRX _GuessIcon
|
|---|
| 201 | */
|
|---|
| 202 | _GuessIcon: procedure
|
|---|
| 203 | text = arg(1)
|
|---|
| 204 | select /* Printer guessing */
|
|---|
| 205 | when pos('LJ',text) > 0 then res = '#65:PMWP.DLL'
|
|---|
| 206 | when pos('LASER',text) > 0 then res = '#65:PMWP.DLL'
|
|---|
| 207 | when pos('EPSON',text) > 0 then res = '#65:PMWP.DLL'
|
|---|
| 208 | when pos('PRINT',text) > 0 then res = '#65:PMWP.DLL'
|
|---|
| 209 | when pos('PRT',text) > 0 then res = '#65:PMWP.DLL'
|
|---|
| 210 | when pos('CANON',text) > 0 then res = '#65:PMWP.DLL'
|
|---|
| 211 | when pos('MINOLTA',text) > 0 then res = '#65:PMWP.DLL'
|
|---|
| 212 | when pos('FAX',text) > 0 then res = '#65:PMWP.DLL'
|
|---|
| 213 | when pos('LEXMARK',text) > 0 then res = '#65:PMWP.DLL'
|
|---|
| 214 | when pos('IPC$',text) > 0 then res = '#59:PMWP.DLL'
|
|---|
| 215 | otherwise res = "#34:PMWP.DLL"
|
|---|
| 216 | end
|
|---|
| 217 | return res
|
|---|
| 218 |
|
|---|
| 219 | /*:VRX _GUIInit
|
|---|
| 220 | */
|
|---|
| 221 | _GUIInit:
|
|---|
| 222 | say '_GUIInit() started'
|
|---|
| 223 |
|
|---|
| 224 | call Paper_Init
|
|---|
| 225 |
|
|---|
| 226 | if datatype(Top) = 'NUM' then do
|
|---|
| 227 | ok = VRset("Main","Top",Top)
|
|---|
| 228 | ok = VRset("Main","Left",Left)
|
|---|
| 229 | ok = VRset("Main","Width",Width)
|
|---|
| 230 | ok = VRset("Main","Height",Height)
|
|---|
| 231 | end
|
|---|
| 232 | ok = VRSet("Main","Font", Font_Main)
|
|---|
| 233 | ok = VRSet("Main","Statusfont", Font_Status)
|
|---|
| 234 | ok = VRSet("Page_1","Font", Font_Page_1)
|
|---|
| 235 | ok = VRSet("Page_2","Font", Font_Page_2)
|
|---|
| 236 | ok = VRSet("Page_3","Font", Font_Page_3)
|
|---|
| 237 | ok = VRSet("Page_4","Font", Font_Page_4)
|
|---|
| 238 | ok = VRSet("Page_5","Font", Font_Page_5)
|
|---|
| 239 | ok = VRSet("Page_6","Font", Font_Page_6)
|
|---|
| 240 | Buttonwidth = VRMethod( "Screen", "PixelsToTwips", 32 )
|
|---|
| 241 |
|
|---|
| 242 | ok = VRSet("SPIN_Intervall", "Value", Intervall)
|
|---|
| 243 | ok = VRSet("SPIN_IntervallMin","Value", IntervallMin)
|
|---|
| 244 | ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
|
|---|
| 245 |
|
|---|
| 246 | ok = VRSet("IPB_Start", "Enabled", VRFileExists(samba.!smbcmd))
|
|---|
| 247 | ok = VRSet("IPB_Stop", "Enabled", VRFileExists(samba.!smbcmd))
|
|---|
| 248 | ok = VRSet("IPB_Restart","Enabled", VRFileExists(samba.!smbcmd))
|
|---|
| 249 | ok = VRSet("IPB_Reload", "Enabled", VRFileExists(samba.!smbcmd))
|
|---|
| 250 |
|
|---|
| 251 | ok = VRSet("CN_Daemons", "View", DaemonView)
|
|---|
| 252 | ok = VRSet("CN_smbtree", "View", TreeView)
|
|---|
| 253 | ok = VRSet("CB_NoMsgBox","Set", NoMsgBox)
|
|---|
| 254 |
|
|---|
| 255 | call _INILayoutRead "CN_Users"
|
|---|
| 256 | call _INILayoutRead "CN_Files"
|
|---|
| 257 | call _INILayoutRead "CN_Service"
|
|---|
| 258 | call _INILayoutRead "CN_Daemons"
|
|---|
| 259 | call _INILayoutRead "CN_smbtree"
|
|---|
| 260 |
|
|---|
| 261 | if _ChkTempFreeSpace() < 262144 then do
|
|---|
| 262 | Msg.Type = "W"
|
|---|
| 263 | Msg.Text = NLVGetMessage(116, TempDir)
|
|---|
| 264 | call _ShowMsg
|
|---|
| 265 | end
|
|---|
| 266 |
|
|---|
| 267 | call Main_Resize
|
|---|
| 268 |
|
|---|
| 269 |
|
|---|
| 270 | ok = VRSet("Main", "Visible", 1)
|
|---|
| 271 | say '_GUIInit() done'
|
|---|
| 272 | return
|
|---|
| 273 |
|
|---|
| 274 | /*:VRX _INILayoutRead
|
|---|
| 275 | */
|
|---|
| 276 | _INILayoutRead:
|
|---|
| 277 | Container = arg(1)
|
|---|
| 278 | ok = VRMethod(Container, "GetFieldList", "Fields." )
|
|---|
| 279 | Layout = VRGetIni( "Layout", Container, OurINI )
|
|---|
| 280 | if Layout = "" then return
|
|---|
| 281 | do I = 1 to Fields.0
|
|---|
| 282 | ok = VRMethod(Container, "SetFieldAttr", fields.I,"Visible", substr(Layout,I,1))
|
|---|
| 283 | end
|
|---|
| 284 | return
|
|---|
| 285 |
|
|---|
| 286 | /*:VRX _INILayoutWrite
|
|---|
| 287 | */
|
|---|
| 288 | _INILayoutWrite:
|
|---|
| 289 | Container = arg(1)
|
|---|
| 290 | ok = VRMethod(Container, "GetFieldList", "Fields." )
|
|---|
| 291 | Layout = ""
|
|---|
| 292 | do I = 1 to fields.0
|
|---|
| 293 | Layout = Layout||VRMethod(Container, "GetFieldAttr", fields.I, "Visible" )
|
|---|
| 294 | end
|
|---|
| 295 | ok = VRSetIni( "Layout", Container , Layout, OurINI, 'NoClose' )
|
|---|
| 296 | return
|
|---|
| 297 |
|
|---|
| 298 | /*:VRX _INIRead
|
|---|
| 299 | */
|
|---|
| 300 | _INIRead:
|
|---|
| 301 | say '_INIRead() started.'
|
|---|
| 302 |
|
|---|
| 303 | OurINI = strip(VRParseFileName(VRget("Application","Program"),'DP')'\SMBSTATUS.INI',,'\')
|
|---|
| 304 | ok = SysFileTree(OurINI, INIFound.,'FO')
|
|---|
| 305 | if INIFound.0 = 1 then OurINI = VRParseFileName(INIFound.1,'DPNE')
|
|---|
| 306 | say 'OurINI='OurINI
|
|---|
| 307 | HelpFIle = VRParseFileName(OurINI,'DPN')'.HLP'
|
|---|
| 308 | say 'HelpFile='HelpFile
|
|---|
| 309 |
|
|---|
| 310 | Top = VRGetIni( "Pos", "Top", OurINI , 'NoClose')
|
|---|
| 311 | Left = VRGetIni( "Pos", "Left", OurINI , 'NoClose')
|
|---|
| 312 | Width = VRGetIni( "Pos", "Width", OurINI , 'NoClose')
|
|---|
| 313 | Height= VRGetIni( "Pos", "Height", OurINI , 'NoClose')
|
|---|
| 314 |
|
|---|
| 315 | Font_Page_1 = VRGetIni( "Fonts", "Page_1", OurINI , 'NoClose' )
|
|---|
| 316 | Font_Page_2 = VRGetIni( "Fonts", "Page_2", OurINI , 'NoClose' )
|
|---|
| 317 | Font_Page_3 = VRGetIni( "Fonts", "Page_3", OurINI , 'NoClose' )
|
|---|
| 318 | Font_Page_4 = VRGetIni( "Fonts", "Page_4", OurINI , 'NoClose' )
|
|---|
| 319 | Font_Page_5 = VRGetIni( "Fonts", "Page_5", OurINI , 'NoClose' )
|
|---|
| 320 | Font_Page_6 = VRGetIni( "Fonts", "Page_6", OurINI , 'NoClose' )
|
|---|
| 321 | Font_Main = VRGetIni( "Fonts", "Main", OurINI , 'NoClose' )
|
|---|
| 322 | Font_Status = VRGetIni( "Fonts", "Statusfont", OurINI , 'NoClose' )
|
|---|
| 323 |
|
|---|
| 324 | if Font_Page_1 = "" then Font_Page_1 = "8.Helv"
|
|---|
| 325 | if Font_Page_2 = "" then Font_Page_2 = "8.Helv"
|
|---|
| 326 | if Font_Page_3 = "" then Font_Page_3 = "8.Helv"
|
|---|
| 327 | if Font_Page_4 = "" then Font_Page_4 = "8.Helv"
|
|---|
| 328 | if Font_Page_5 = "" then Font_Page_5 = "8.Helv"
|
|---|
| 329 | if Font_Main = "" then Font_Main = "8.Helv"
|
|---|
| 330 | if Font_Status = "" then Font_Status = "8.Helv"
|
|---|
| 331 |
|
|---|
| 332 | Intervall = VRGetIni( "Settings", "Intervall", OurINI)
|
|---|
| 333 | if Intervall = "" then Intervall = 60
|
|---|
| 334 |
|
|---|
| 335 | IntervallMin = VRGetIni( "Settings", "IntervallMin", OurINI)
|
|---|
| 336 | if IntervallMin = "" then IntervallMin = 180
|
|---|
| 337 |
|
|---|
| 338 | CurrentPageNr = VRGetIni( "Settings", "CurrentPageNr", OurINI)
|
|---|
| 339 | if CurrentPageNr = "" then CurrentPageNr = 4
|
|---|
| 340 |
|
|---|
| 341 | DaemonView = VRGetIni( "Settings", "DaemonView", OurINI)
|
|---|
| 342 | if DaemonView = "" then DaemonView = "Detail"
|
|---|
| 343 |
|
|---|
| 344 | TreeView = VRGetIni( "Settings", "TreeView", OurINI)
|
|---|
| 345 | if TreeView = "" then TreeView = "IconTree"
|
|---|
| 346 |
|
|---|
| 347 | NoMsgBox = VRGetIni( "Settings", "NoMsgBox", OurINI)
|
|---|
| 348 | if NoMsgBox = "" then NoMsgBox = 0
|
|---|
| 349 |
|
|---|
| 350 | options.!debug = VRGetIni( "Options", "Debug", OurINI)
|
|---|
| 351 | if options.!debug = "" then options.!debug = 0
|
|---|
| 352 |
|
|---|
| 353 | ok = VRSet("CB_Debug","set",options.!Debug)
|
|---|
| 354 | if options.!Debug then ok = VRREdirectStdIO("ON")
|
|---|
| 355 | else ok = VRREdirectStdIO("OFF")
|
|---|
| 356 |
|
|---|
| 357 | /* For Browse page */
|
|---|
| 358 | FirstRun = 1
|
|---|
| 359 | /* For Users page in case connections.tdb is not initialised */
|
|---|
| 360 | IgnoreSmbNoInit = 1
|
|---|
| 361 |
|
|---|
| 362 | smbdpidhandle.0 = 0
|
|---|
| 363 | nmbdpidhandle.0 = 0
|
|---|
| 364 | winbpidhandle.0 = 0
|
|---|
| 365 |
|
|---|
| 366 | prevsmbdct = 0
|
|---|
| 367 | prevnmbdct = 0
|
|---|
| 368 | prevwinbct = 0
|
|---|
| 369 |
|
|---|
| 370 | smbdoutput = TempDir'smbd.out'
|
|---|
| 371 | say '_INIRead() done.'
|
|---|
| 372 | return
|
|---|
| 373 |
|
|---|
| 374 | /*:VRX _INIWrite
|
|---|
| 375 | */
|
|---|
| 376 | _INIWrite:
|
|---|
| 377 | say 'start _INIWrite()'
|
|---|
| 378 | ok = VRSetIni( "Pos", "Top", VRGet("Main","Top"), OurINI, 'NoClose' )
|
|---|
| 379 | ok = VRSetIni( "Pos", "Left", VRGet("Main","Left"), OurINI, 'NoClose' )
|
|---|
| 380 | ok = VRSetIni( "Pos", "Width", VRGet("Main","Width"), OurINI, 'NoClose' )
|
|---|
| 381 | ok = VRSetIni( "Pos", "Height", VRGet("Main","Height"), OurINI, 'NoClose' )
|
|---|
| 382 |
|
|---|
| 383 | ok = VRSetIni( "Settings", "Intervall", VRGet("SPIN_Intervall","Value"),OurINI,'NoClose')
|
|---|
| 384 | ok = VRSetIni( "Settings", "IntervallMin", VRGet("SPIN_IntervallMin","Value"),OurINI,'NoClose')
|
|---|
| 385 | ok = VRSetIni( "Settings", "CurrentPageNr",CurrentPageNr, OurINI,'NoClose')
|
|---|
| 386 | ok = VRSetIni( "Settings", "DaemonView", VRGet("CN_Daemons","View"), OurINI,'NoClose')
|
|---|
| 387 | ok = VRSetIni( "Settings", "TreeView", VRGet("CN_smbtree","View"), OurINI,'NoClose')
|
|---|
| 388 | ok = VRSetIni( "Settings", "NoMsgBox", NoMsgBox, OurINI,'NoClose')
|
|---|
| 389 |
|
|---|
| 390 | ok = VRSetIni( "Options", "Debug", options.!debug, OurINI, 'NoClose' )
|
|---|
| 391 |
|
|---|
| 392 | call _INILayoutWrite "CN_Users"
|
|---|
| 393 | call _INILayoutWrite "CN_Files"
|
|---|
| 394 | call _INILayoutWrite "CN_Service"
|
|---|
| 395 | call _INILayoutWrite "CN_Daemons"
|
|---|
| 396 | call _INILayoutWrite "CN_smbtree"
|
|---|
| 397 |
|
|---|
| 398 | ok = VRSetIni( "Fonts", "Page_1", VRGet("Page_1","Font"), OurINI, 'NoClose' )
|
|---|
| 399 | ok = VRSetIni( "Fonts", "Page_2", VRGet("Page_2","Font"), OurINI, 'NoClose' )
|
|---|
| 400 | if VRget("CN_Users", "Font") <> "<default>" then ok = VRset("Page_1", "Font", VRget("CN_Users", "Font"))
|
|---|
| 401 | if VRget("CN_Files", "Font") <> "<default>" then ok = VRset("Page_2", "Font", VRget("CN_Files", "Font"))
|
|---|
| 402 | if VRget("CN_Service", "Font") <> "<default>" then ok = VRset("Page_3", "Font", VRget("CN_Service", "Font"))
|
|---|
| 403 | if VRget("CN_Daemons", "Font") <> "<default>" then ok = VRset("Page_4", "Font", VRget("CN_Daemons", "Font"))
|
|---|
| 404 | ok = VRSetIni( "Fonts", "Page_3", VRGet("Page_3","Font"), OurINI, 'NoClose' )
|
|---|
| 405 | ok = VRSetIni( "Fonts", "Page_4", VRGet("Page_4","Font"), OurINI, 'NoClose' )
|
|---|
| 406 | ok = VRSetIni( "Fonts", "Page_5", VRGet("Page_5","Font"), OurINI, 'NoClose' )
|
|---|
| 407 | ok = VRSetIni( "Fonts", "Page_6", VRGet("Page_6","Font"), OurINI, 'NoClose' )
|
|---|
| 408 | ok = VRSetIni( "Fonts", "Statusfont", VRGet("Main","Statusfont"), OurINI, 'NoClose' )
|
|---|
| 409 | ok = VRSetIni( "Fonts", "Main", VRGet("Main","Font"), OurINI )
|
|---|
| 410 | say 'done _INIWrite()'
|
|---|
| 411 | return
|
|---|
| 412 |
|
|---|
| 413 | /*:VRX _LoadotherFuncs
|
|---|
| 414 | */
|
|---|
| 415 | _LoadotherFuncs:
|
|---|
| 416 | ok = VRRedirectStdIO("OFF")
|
|---|
| 417 |
|
|---|
| 418 | call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
|
|---|
| 419 | call SysLoadFuncs
|
|---|
| 420 |
|
|---|
| 421 | call RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
|
|---|
| 422 | call PRLoadFuncs
|
|---|
| 423 |
|
|---|
| 424 | return
|
|---|
| 425 |
|
|---|
| 426 | /*:VRX _MsgYesNo
|
|---|
| 427 | */
|
|---|
| 428 | _MsgYesNo:
|
|---|
| 429 | say "_MsgYesNo() started"
|
|---|
| 430 | buttons.0 = 2
|
|---|
| 431 | buttons.1 = NLVGetMessage(6)
|
|---|
| 432 | buttons.2 = NLVGetMessage(7)
|
|---|
| 433 | default = 2
|
|---|
| 434 | buttons.default = NLVGetMessage(7)
|
|---|
| 435 | esc = 2
|
|---|
| 436 | buttons.esc = NLVGetMessage(7)
|
|---|
| 437 | RC = VRMessage( VRWindow(), Msg.Text, Msg.Title,"Q","buttons.",default, esc )
|
|---|
| 438 | say "_MsgYesNo() done, answer "RC
|
|---|
| 439 | return RC
|
|---|
| 440 |
|
|---|
| 441 | /*:VRX _NLVSetup
|
|---|
| 442 | */
|
|---|
| 443 | _NLVSetup:
|
|---|
| 444 | call NLVSetup
|
|---|
| 445 | Msg.Title = NLVGetMessage(1)
|
|---|
| 446 | ok = VRSet("Main","helpFile", settings.!helpfile)
|
|---|
| 447 |
|
|---|
| 448 | CALL NLVSetText 'PB_Refresh', 'Caption', 11
|
|---|
| 449 | CALL NLVSetText 'PB_Cancel', 'Caption', 12
|
|---|
| 450 | CALL NLVSetText 'PB_Help', 'Caption', 13
|
|---|
| 451 | CALL NLVSetText 'PB_About', 'Caption', 14
|
|---|
| 452 |
|
|---|
| 453 | CALL NLVSetText 'PB_Refresh', 'Hinttext', 51
|
|---|
| 454 | CALL NLVSetText 'PB_Cancel', 'Hinttext', 54
|
|---|
| 455 | CALL NLVSetText 'PB_Help', 'Hinttext', 52
|
|---|
| 456 | CALL NLVSetText 'PB_About', 'Hinttext', 53
|
|---|
| 457 |
|
|---|
| 458 | CALL NLVSetText 'TAB_1', 'Userdata', 15
|
|---|
| 459 | CALL NLVSetText 'TAB_2', 'Userdata', 16
|
|---|
| 460 | CALL NLVSetText 'TAB_3', 'Userdata', 17
|
|---|
| 461 | CALL NLVSetText 'TAB_4', 'Userdata', 18
|
|---|
| 462 | CALL NLVSetText 'TAB_5', 'Userdata', 19
|
|---|
| 463 | CALL NLVSetText 'TAB_6', 'Userdata', 24
|
|---|
| 464 |
|
|---|
| 465 | CALL NLVSetText 'TAB_1', 'Hinttext', 55
|
|---|
| 466 | CALL NLVSetText 'TAB_2', 'Hinttext', 56
|
|---|
| 467 | CALL NLVSetText 'TAB_3', 'Hinttext', 57
|
|---|
| 468 | CALL NLVSetText 'TAB_4', 'Hinttext', 58
|
|---|
| 469 | CALL NLVSetText 'TAB_5', 'Hinttext', 59
|
|---|
| 470 | CALL NLVSetText 'TAB_6', 'Hinttext', 60
|
|---|
| 471 |
|
|---|
| 472 | CALL NLVSetText 'Page_1', 'Hinttext', 55
|
|---|
| 473 | CALL NLVSetText 'Page_2', 'Hinttext', 56
|
|---|
| 474 | CALL NLVSetText 'Page_3', 'Hinttext', 57
|
|---|
| 475 | CALL NLVSetText 'Page_4', 'Hinttext', 58
|
|---|
| 476 | CALL NLVSetText 'Page_5', 'Hinttext', 59
|
|---|
| 477 | CALL NLVSetText 'Page_6', 'Hinttext', 60
|
|---|
| 478 |
|
|---|
| 479 | CALL NLVSetText 'DT_Refresh', 'Caption', 25
|
|---|
| 480 | CALL NLVSetText 'DT_RefreshMin', 'Caption', 25
|
|---|
| 481 | CALL NLVSetText 'DT_Intervall', 'Caption', 26
|
|---|
| 482 | ok = VRSet("DT_IntervallMin","Caption", NLVGetMessage(26)' 'NLVGetMessage(28))
|
|---|
| 483 | CALL NLVSetText 'CB_NoMsgBox', 'Caption', 27
|
|---|
| 484 |
|
|---|
| 485 | CALL NLVSetText 'ContextMenu_Daemons_View', 'Caption', 31
|
|---|
| 486 | CALL NLVSetText 'ContextMenu_Daemons_Ping', 'Caption', 32
|
|---|
| 487 | CALL NLVSetText 'ContextMenu_Daemons_Details','Caption', 118
|
|---|
| 488 | CALL NLVSetText 'ContextMenu_Daemons_Tree', 'Caption', 120
|
|---|
| 489 |
|
|---|
| 490 | CALL NLVSetText 'ContextMenu_Service_CloseSHare', 'Caption', 70
|
|---|
| 491 |
|
|---|
| 492 | CALL NLVSetText 'ContextMenu_Users_SendMsg', 'Caption', 80
|
|---|
| 493 | CALL NLVSetText 'ContextMenu_Tree_SendMsg', 'Caption', 80
|
|---|
| 494 | CALL NLVSetText 'ContextMenu_Tree_View', 'Caption', 31
|
|---|
| 495 | CALL NLVSetText 'ContextMenu_Tree_Tree', 'Caption', 120
|
|---|
| 496 | CALL NLVSetText 'ContextMenu_Tree_Details', 'Caption', 118
|
|---|
| 497 | return
|
|---|
| 498 |
|
|---|
| 499 | /*:VRX _Refresh
|
|---|
| 500 | */
|
|---|
| 501 | _Refresh:
|
|---|
| 502 | say "_Refresh() started"
|
|---|
| 503 | ok = VRSet("TM_refresh","Enabled", 0)
|
|---|
| 504 | SmbNoInit = 0
|
|---|
| 505 |
|
|---|
| 506 | refreshoutput = TempDir'refresh.out'
|
|---|
| 507 | refresherr = TempDir'refresh.err'
|
|---|
| 508 |
|
|---|
| 509 | say ' 'samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput
|
|---|
| 510 | address cmd samba.!smbd' -V --debuglevel=0 2>'refresherr' 1>'refreshoutput
|
|---|
| 511 |
|
|---|
| 512 | SambaVer = "Samba "||strip(linein(refreshoutput))
|
|---|
| 513 | say ' smbd.exe: "'SambaVer'"'
|
|---|
| 514 | ok = stream(refreshoutput,'c','close')
|
|---|
| 515 |
|
|---|
| 516 | say ' 'samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput
|
|---|
| 517 | address cmd samba.!smbstatusexe' smbd 'DebugLevel' 2>'refresherr' 1>'refreshoutput
|
|---|
| 518 |
|
|---|
| 519 | /* First line is usually empty */
|
|---|
| 520 | Hdr = linein(refreshoutput)
|
|---|
| 521 | SambaStVer = strip(linein(refreshoutput)) /* we can detect version mismatches here */
|
|---|
| 522 | say ' smbstatus: "'SambaStVer'"'
|
|---|
| 523 |
|
|---|
| 524 | select
|
|---|
| 525 | when pos('not initialised',SambaStVer) > 0 then do
|
|---|
| 526 | SambaVer = SambaVer||" (Init)"
|
|---|
| 527 | SmbNoInit = 1
|
|---|
| 528 | end
|
|---|
| 529 | when translate(SambaStVer) <> translate(SambaVer) then SambaVer = SambaVer||" (Hybrid)"
|
|---|
| 530 | otherwise nop
|
|---|
| 531 | end
|
|---|
| 532 |
|
|---|
| 533 | Ok = VRSet("Main", "Caption", SambaVer' - 'NLVGetMessage(146))
|
|---|
| 534 |
|
|---|
| 535 | /* Active User */
|
|---|
| 536 | Hdr1 = linein(refreshoutput)
|
|---|
| 537 | /* say ' 1:'hdr1 */
|
|---|
| 538 | Hdr2 = linein(refreshoutput)
|
|---|
| 539 | /* say ' 2:'hdr2 */
|
|---|
| 540 | Zeile = linein(refreshoutput)
|
|---|
| 541 | say ' 'Zeile
|
|---|
| 542 | if SmbNoInit then do
|
|---|
| 543 | call lineout samba.!msg, SambaStVer
|
|---|
| 544 | call lineout samba.!msg, Hdr1
|
|---|
| 545 | call lineout samba.!msg, Hdr2
|
|---|
| 546 | call lineout samba.!msg, Zeile
|
|---|
| 547 | ok = stream(samba.!msg,'c','close')
|
|---|
| 548 | if IgnoreSmbNoInit then do
|
|---|
| 549 | call _SambaShowMsg
|
|---|
| 550 | IgnoreSmbNoInit = 0
|
|---|
| 551 | end
|
|---|
| 552 | end
|
|---|
| 553 |
|
|---|
| 554 | say 'SmbNoInit = 'SmbNoInit
|
|---|
| 555 |
|
|---|
| 556 | ok = VRSet("CN_Users","Painting", 0)
|
|---|
| 557 | ok = VRMethod("CN_Users", "RemoveRecord", "ALL")
|
|---|
| 558 | Username.0 = 0
|
|---|
| 559 | IP.0 = 0
|
|---|
| 560 | Group.0 = 0
|
|---|
| 561 | I = 0
|
|---|
| 562 | if \SmbNoInit then do
|
|---|
| 563 | do while Zeile <> ''
|
|---|
| 564 | parse var Zeile UPID Username Group Machine IP
|
|---|
| 565 | I = I + 1
|
|---|
| 566 | UPID.I = UPID
|
|---|
| 567 | Username.I = Username
|
|---|
| 568 | Group.I = Group
|
|---|
| 569 | IP = strip(IP)
|
|---|
| 570 | parse var IP '('IP.I')'
|
|---|
| 571 | RecHandle = VRMethod("CN_Users", "Addrecord")
|
|---|
| 572 | ok = VRMethod("CN_Users", "SetFieldData", RecHandle, UIconH, "$44", UPIDFH, UPID, UsernameFH, Username, GroupFH, Group, UMachineFH, Machine, UIPAdrFH, IP.I)
|
|---|
| 573 | Zeile = linein(refreshoutput)
|
|---|
| 574 | end
|
|---|
| 575 | end
|
|---|
| 576 | Username.0 = I
|
|---|
| 577 | Group.0 = I
|
|---|
| 578 | UPID.0 = I
|
|---|
| 579 | ok = VRSet("CN_Users","Painting", 1)
|
|---|
| 580 |
|
|---|
| 581 | /* Active Services */
|
|---|
| 582 | Hdr = linein(refreshoutput)
|
|---|
| 583 | Hdr = linein(refreshoutput)
|
|---|
| 584 | I = 0
|
|---|
| 585 | Zeile = linein(refreshoutput)
|
|---|
| 586 | ok = VRSet("CN_Service","Painting", 0)
|
|---|
| 587 | ok = VRMethod("CN_Service", "RemoveRecord", "ALL")
|
|---|
| 588 | do while Zeile <> ''
|
|---|
| 589 | parse var Zeile Service SPId Machine Connected
|
|---|
| 590 | I = I + 1
|
|---|
| 591 | SPid.I = SPid
|
|---|
| 592 | Machine.I = Machine
|
|---|
| 593 | Service.I = Service
|
|---|
| 594 | Icon = _GuessIcon(Service.I)
|
|---|
| 595 |
|
|---|
| 596 | Connected = strip(Connected)
|
|---|
| 597 | T. = ""
|
|---|
| 598 | parse var Connected T.WDay T.Month T.DoM T.TimeoD T.Year
|
|---|
| 599 | Connected = T.TimeoD', 'T.WDay' 'T.DoM' 'T.Month' 'T.Year
|
|---|
| 600 |
|
|---|
| 601 | RecHandle = VRMethod("CN_Service", "Addrecord")
|
|---|
| 602 | ok = VRMethod("CN_Service", "SetFieldData", RecHandle, SIconH, Icon, ServiceFH, Service, SPIDFH, SPID, SMachineFH, Machine, ConnectedFH, Connected)
|
|---|
| 603 | Zeile = linein(refreshoutput)
|
|---|
| 604 | end
|
|---|
| 605 | SPid.0 = I
|
|---|
| 606 | Machine.0 = I
|
|---|
| 607 | Service.0 = I
|
|---|
| 608 |
|
|---|
| 609 | ok = VRSet("CN_Service","Painting", 1)
|
|---|
| 610 |
|
|---|
| 611 | /* Active Services */
|
|---|
| 612 | Hdr = linein(refreshoutput)
|
|---|
| 613 | Hdr = linein(refreshoutput)
|
|---|
| 614 | Hdr = linein(refreshoutput)
|
|---|
| 615 |
|
|---|
| 616 | Zeile = linein(refreshoutput)
|
|---|
| 617 | ok = VRSet("CN_Files","Painting", 0)
|
|---|
| 618 | ok = VRMethod("CN_Files", "RemoveRecord", "ALL")
|
|---|
| 619 | File.0 = 0
|
|---|
| 620 | FPID.0 = 0
|
|---|
| 621 | do while Zeile <> ''
|
|---|
| 622 | parse var Zeile FPid Uid DenyMode Access RW Oplock Sharepath Rest
|
|---|
| 623 | TimeDate = right(rest,25)
|
|---|
| 624 | Name = strip(left(Rest,length(Rest)-25))
|
|---|
| 625 | I = I + 1
|
|---|
| 626 | sharepath = strip(translate(left(sharepath,1))||translate(substr(SharePath,2),'\','/'),'T','\')
|
|---|
| 627 | Username = UID
|
|---|
| 628 | do J = 1 to UPID.0
|
|---|
| 629 | if FPID = UPID.J then do
|
|---|
| 630 | Username = Username.J
|
|---|
| 631 | leave
|
|---|
| 632 | end
|
|---|
| 633 | end
|
|---|
| 634 | File = SharePath||'\'||translate(Name,'\','/')
|
|---|
| 635 | File.I = File
|
|---|
| 636 | FPID.I = FPID
|
|---|
| 637 | TimeDate = strip(TimeDate)
|
|---|
| 638 | say Timedate
|
|---|
| 639 | T. = ""
|
|---|
| 640 | parse var TimeDate T.WDay T.Month T.DoM T.TimeoD T.Year
|
|---|
| 641 | FileTime = T.TimeoD
|
|---|
| 642 | FileDate = T.WDay' 'T.DoM' 'T.Month' 'T.Year
|
|---|
| 643 | RecHandle = VRMethod("CN_Files", "Addrecord")
|
|---|
| 644 | ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FPidFH, FPid, FileFH, File, FUserFH, Username, UidFH, Uid, DenyModeFH, DenyMode, AccessFH, Access, RWFH, RW)
|
|---|
| 645 | ok = VRMethod("CN_Files", "SetFieldData", RecHandle, FIconH, "$45", TimeFH, FileTime, DateFH, FileDate, OplockFH, Oplock, SharePathFH, Sharepath, NameFH, Name)
|
|---|
| 646 | Zeile = linein(refreshoutput)
|
|---|
| 647 | end
|
|---|
| 648 | File.0 = I
|
|---|
| 649 | FPID.0 = I
|
|---|
| 650 |
|
|---|
| 651 | ok = stream(refreshoutput, 'c','close')
|
|---|
| 652 | ok = SysFileDelete(refreshoutput)
|
|---|
| 653 | ok = stream(refresherr, 'c','close')
|
|---|
| 654 | ok = SysFileDelete(refreshouterr)
|
|---|
| 655 |
|
|---|
| 656 | call _RefreshDaemons
|
|---|
| 657 | ok = VRSet("CN_Files","Painting", 1)
|
|---|
| 658 | if VRGet("Main", "WindowState") = "Minimized" then do
|
|---|
| 659 | ok = VRSet("TM_Refresh","Delay", IntervallMin * 1000)
|
|---|
| 660 | end
|
|---|
| 661 | else do
|
|---|
| 662 | ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
|
|---|
| 663 | end
|
|---|
| 664 | ok = VRSet("TM_refresh","Enabled", 1)
|
|---|
| 665 | say "_Refresh() done"
|
|---|
| 666 | return
|
|---|
| 667 | /*:VRX _RefreshDaemons
|
|---|
| 668 | */
|
|---|
| 669 | _RefreshDaemons:
|
|---|
| 670 | say "_RefreshDaemons() started"
|
|---|
| 671 | ok = VRSet("CN_Daemons","Painting", 0 )
|
|---|
| 672 |
|
|---|
| 673 | call VRSet VRWindow(), 'Pointer', 'Wait'
|
|---|
| 674 |
|
|---|
| 675 | do I = 1 to smbdpidhandle.0
|
|---|
| 676 | ok = VRMethod("CN_Daemons", "RemoveRecord", smbdpidhandle.I )
|
|---|
| 677 | end
|
|---|
| 678 |
|
|---|
| 679 | do I = 1 to nmbdpidhandle.0
|
|---|
| 680 | ok = VRMethod("CN_Daemons", "RemoveRecord", nmbdpidhandle.I )
|
|---|
| 681 | end
|
|---|
| 682 |
|
|---|
| 683 | do I = 1 to winbpidhandle.0
|
|---|
| 684 | ok = VRMethod("CN_Daemons", "RemoveRecord", winbpidhandle.I )
|
|---|
| 685 | end
|
|---|
| 686 |
|
|---|
| 687 | Running = _SambaRunning()
|
|---|
| 688 |
|
|---|
| 689 | call VRSet VRWindow(), 'Pointer', '<default>'
|
|---|
| 690 |
|
|---|
| 691 | smbdpids = pids.!smbd
|
|---|
| 692 | nmbdpids = pids.!nmbd
|
|---|
| 693 | winbpids = pids.!nmbd
|
|---|
| 694 |
|
|---|
| 695 | smbdRunning = running.!smbd
|
|---|
| 696 | nmbdRunning = running.!nmbd
|
|---|
| 697 | winbRunning = running.!winb
|
|---|
| 698 |
|
|---|
| 699 | if smbdRunning then do
|
|---|
| 700 | ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, smbdpids)
|
|---|
| 701 | ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$46")
|
|---|
| 702 | smbdpidhandle.0 = words(smbdpids)
|
|---|
| 703 | if options.!debug = 1 then do
|
|---|
| 704 | if smbdpidhandle.0 > prevsmbdct then do
|
|---|
| 705 | prevsmbdct = smbdpidhandle.0
|
|---|
| 706 | call beep 880*1, 10
|
|---|
| 707 | call beep 880*2, 10
|
|---|
| 708 | call beep 880*4, 10
|
|---|
| 709 | end
|
|---|
| 710 | if smbdpidhandle.0 < prevsmbdct then do
|
|---|
| 711 | prevsmbdct = smbdpidhandle.0
|
|---|
| 712 | call beep 880*4, 10
|
|---|
| 713 | call beep 880*2, 10
|
|---|
| 714 | call beep 880*1, 10
|
|---|
| 715 | end
|
|---|
| 716 | end
|
|---|
| 717 |
|
|---|
| 718 | do I = 1 to words(smbdpids)
|
|---|
| 719 | Username = ""
|
|---|
| 720 | do J = 1 to UPID.0
|
|---|
| 721 | if UPID.J = word(smbdpids,I) then do
|
|---|
| 722 | Username = ' 'Username.J
|
|---|
| 723 | leave
|
|---|
| 724 | end
|
|---|
| 725 | end
|
|---|
| 726 | smbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", smbdhandle, , 'PID 'word(smbdpids,I)' ('d2x(word(smbdpids,I))'x)', "$48")
|
|---|
| 727 | if Username <> "" then do
|
|---|
| 728 | smbdpidhandle.I.user = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I, , Username, "$44")
|
|---|
| 729 | do J = 1 to FPID.0
|
|---|
| 730 | if FPID.J = word(smbdpids,I) then do
|
|---|
| 731 | dummyHandle = VRMethod( "CN_Daemons", "AddRecord", smbdpidhandle.I.user, , File.J, "$45")
|
|---|
| 732 | end
|
|---|
| 733 | end
|
|---|
| 734 | end
|
|---|
| 735 | end
|
|---|
| 736 | end
|
|---|
| 737 | else do
|
|---|
| 738 | ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
|
|---|
| 739 | ok = VRMethod("CN_Daemons", "SetRecordAttr", smbdHandle, "Icon", "$47")
|
|---|
| 740 | if options.!debug = 1 then do
|
|---|
| 741 | if prevsmbdct > 0 then do
|
|---|
| 742 | prevsmbdct = 0
|
|---|
| 743 | call beep 880*4, 10
|
|---|
| 744 | call beep 880*2, 10
|
|---|
| 745 | call beep 880*1, 10
|
|---|
| 746 | end
|
|---|
| 747 | end
|
|---|
| 748 | end
|
|---|
| 749 |
|
|---|
| 750 | if nmbdRunning then do
|
|---|
| 751 | ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(40), DPidsFH, nmbdpids)
|
|---|
| 752 | ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$46")
|
|---|
| 753 | nmbdpidhandle.0 = words(nmbdpids)
|
|---|
| 754 | do I = 1 to words(nmbdpids)
|
|---|
| 755 | nmbdpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", nmbdhandle, , 'PID 'word(nmbdpids,I)' ('d2x(word(nmbdpids,I))'x)', "$48")
|
|---|
| 756 | end
|
|---|
| 757 | end
|
|---|
| 758 | else do
|
|---|
| 759 | ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
|
|---|
| 760 | ok = VRMethod("CN_Daemons", "SetRecordAttr", nmbdHandle, "Icon", "$47")
|
|---|
| 761 | end
|
|---|
| 762 |
|
|---|
| 763 | if winbRunning then do
|
|---|
| 764 | ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(40), DPidsFH, winbpids)
|
|---|
| 765 | ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$46")
|
|---|
| 766 | winbpidhandle.0 = words(winbpids)
|
|---|
| 767 | do I = 1 to words(winbpids)
|
|---|
| 768 | winbpidhandle.I = VRMethod( "CN_Daemons", "AddRecord", winbhandle, , 'PID 'word(winbpids,I)' ('d2x(word(winbpids,I))'x)', "$48")
|
|---|
| 769 | end
|
|---|
| 770 | end
|
|---|
| 771 | else do
|
|---|
| 772 | ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DStatusFH, NLVGetMessage(41), DPidsFH, "")
|
|---|
| 773 | ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Icon", "$47")
|
|---|
| 774 | end
|
|---|
| 775 |
|
|---|
| 776 | if \(smbdrunning|nmbdrunning|winbrunning) then do
|
|---|
| 777 | ok = VRSet("IPB_Start", "Visible", 1)
|
|---|
| 778 | ok = VRSet("IPB_Stop", "Visible", 0)
|
|---|
| 779 | ok = VRSet("IPB_ReStart", "Enabled", 0)
|
|---|
| 780 | ok = VRSet("IPB_ReLoad", "Enabled", 0)
|
|---|
| 781 | end
|
|---|
| 782 | else do
|
|---|
| 783 | ok = VRSet("IPB_Start", "Visible", 0)
|
|---|
| 784 | ok = VRSet("IPB_Stop", "Visible", 1)
|
|---|
| 785 | ok = VRSet("IPB_ReStart", "Enabled", 1)
|
|---|
| 786 | ok = VRSet("IPB_ReLoad", "Enabled", 1)
|
|---|
| 787 | end
|
|---|
| 788 |
|
|---|
| 789 | ok = (stream(samba.!bin'\winbindd.exe','c','query exists') <> "")
|
|---|
| 790 | ok = VRMethod("CN_Daemons", "SetRecordAttr", winbHandle, "Visible", ok)
|
|---|
| 791 | ok = VRSet("CN_Daemons","Painting", 1 )
|
|---|
| 792 | if Running then call _SambaUptime
|
|---|
| 793 | say "_RefreshDaemons() done"
|
|---|
| 794 | return
|
|---|
| 795 |
|
|---|
| 796 | /*
|
|---|
| 797 | _pids: procedure
|
|---|
| 798 | pongfile = arg(1)
|
|---|
| 799 | pids = ''
|
|---|
| 800 | do until lines(pongfile) = 0
|
|---|
| 801 | pongline = linein(pongfile)
|
|---|
| 802 | if word(Pongline,1) = 'PONG' then do
|
|---|
| 803 | parse var pongline pong from tpid pid
|
|---|
| 804 | pids = pids||pid', '
|
|---|
| 805 | end
|
|---|
| 806 | else pids = pids||pongline
|
|---|
| 807 | end
|
|---|
| 808 | pids = strip(strip(pids),,',')
|
|---|
| 809 | ok = stream(pongfile,'c','close')
|
|---|
| 810 | ok = SysFileDelete(pongfile)
|
|---|
| 811 | return pids
|
|---|
| 812 | */
|
|---|
| 813 |
|
|---|
| 814 | /* pingout = 'ping.out'
|
|---|
| 815 | '@smbcontrol -t 2 smbd ping -d 0 1>'pingout
|
|---|
| 816 | if rc = 0 then smbdRunning = 1
|
|---|
| 817 | ok = VRMethod("CN_Daemons", "SetFieldData", smbdHandle, DPidsFH, _pids(pingout))
|
|---|
| 818 |
|
|---|
| 819 | '@smbcontrol -t 2 nmbd ping -d 0 1>'pingout
|
|---|
| 820 | if rc = 0 then nmbdRunning = 1
|
|---|
| 821 | ok = VRMethod("CN_Daemons", "SetFieldData", nmbdHandle, DPidsFH, _pids(pingout))
|
|---|
| 822 |
|
|---|
| 823 | '@smbcontrol -t 1 winbindd ping -d 0 1>'pingout
|
|---|
| 824 | if rc = 0 then winbRunning = 1
|
|---|
| 825 | ok = VRMethod("CN_Daemons", "SetFieldData", winbHandle, DPidsFH, _pids(pingout))
|
|---|
| 826 |
|
|---|
| 827 | ok = SysFileDelete(PingOut)
|
|---|
| 828 | */
|
|---|
| 829 | /*:VRX _SambaFindPIDfile
|
|---|
| 830 | */
|
|---|
| 831 | _SambaFindPIDfile:
|
|---|
| 832 | say "_SambaFindPIDfile() started"
|
|---|
| 833 | ok = SysFileTree(ETC'\samba\pid\nmbd*pid',nmbdpid.,'FO')
|
|---|
| 834 | if nmbdpid.0 = 1 then nmbdpidfile = nmbdpid.1; else nmbdpidfile = ""
|
|---|
| 835 | say " nmbdpidfile = "nmbdpidfile
|
|---|
| 836 | say "_SambaFindPIDfile() done"
|
|---|
| 837 | return
|
|---|
| 838 |
|
|---|
| 839 | /*:VRX _SambaShowError
|
|---|
| 840 | */
|
|---|
| 841 | _SambaShowError: procedure expose samba. settings. options.
|
|---|
| 842 | I = 0
|
|---|
| 843 | do while lines(samba.!error) <> 0
|
|---|
| 844 | I = I + 1
|
|---|
| 845 | smberr.I = linein(samba.!error)
|
|---|
| 846 | end
|
|---|
| 847 | ok = stream(Samba.!error,"c","close")
|
|---|
| 848 | smberr.0 = I
|
|---|
| 849 | Buttons.1 = "OK" /* NLVGetMessage(2) */
|
|---|
| 850 | Buttons.0 = 1
|
|---|
| 851 | id = VRMessageStem( VRWindow(), "smberr.", VRGet("Main", "Caption") , "Error", "Buttons.", buttons.1, buttons.1 )
|
|---|
| 852 | ok = SysFileDelete(Samba.!error)
|
|---|
| 853 | return
|
|---|
| 854 |
|
|---|
| 855 | /*:VRX _SambaShowMsg
|
|---|
| 856 | */
|
|---|
| 857 | _SambaShowMsg: procedure expose samba. settings. options.
|
|---|
| 858 | say "SambaShowMsg started"
|
|---|
| 859 | skipWords = arg(1)
|
|---|
| 860 | skip.0 = words(skipWords)
|
|---|
| 861 | do J = 1 to skip.0
|
|---|
| 862 | skip.J = translate(word(skipWords,J))
|
|---|
| 863 | end
|
|---|
| 864 | I = 0
|
|---|
| 865 | do while lines(samba.!msg) <> 0
|
|---|
| 866 | msgline = linein(samba.!msg)
|
|---|
| 867 | SkipIt = 0
|
|---|
| 868 | do J = 1 to skip.0
|
|---|
| 869 | if pos(skip.J,translate(msgline)) > 0 then do
|
|---|
| 870 | skipit = 1
|
|---|
| 871 | leave
|
|---|
| 872 | end
|
|---|
| 873 | end
|
|---|
| 874 | if \SkipIt then do
|
|---|
| 875 | I = I + 1
|
|---|
| 876 | smbmsg.I = strip(MsgLine)
|
|---|
| 877 | end
|
|---|
| 878 | end
|
|---|
| 879 | ok = stream(Samba.!msg,"c","close")
|
|---|
| 880 | say " stream close "Samba.!msg" = "ok
|
|---|
| 881 | smbmsg.0 = I
|
|---|
| 882 | if smbmsg.0 > 0 then do
|
|---|
| 883 | Buttons.1 = "OK" /* NLVGetMessage(2) */
|
|---|
| 884 | Buttons.0 = 1
|
|---|
| 885 | id = VRMessageStem( VRWindow(), "smbmsg.", VRGet("Main", "Caption") , "I", "Buttons.", buttons.1, buttons.1 )
|
|---|
| 886 | end
|
|---|
| 887 | ok = SysFileDelete(Samba.!msg)
|
|---|
| 888 | say " Delete "Samba.!msg" = "ok
|
|---|
| 889 | say "SambaShowMsg done"
|
|---|
| 890 | return
|
|---|
| 891 | /*:VRX _SambaUptime
|
|---|
| 892 | */
|
|---|
| 893 | _SambaUptime:
|
|---|
| 894 | say "_SambaUptime() started"
|
|---|
| 895 | call _SambaFindPIDfile
|
|---|
| 896 | if nmbdpidfile = "" then do
|
|---|
| 897 | ok = VRset("CN_Daemons", "Caption", NLVGetMessage(42)||" "||NLVGetMessage(41))
|
|---|
| 898 | return
|
|---|
| 899 | end
|
|---|
| 900 |
|
|---|
| 901 | StartTime = SysGetFileDateTime(nmbdpidfile)
|
|---|
| 902 | if StartTime = -1 then return
|
|---|
| 903 |
|
|---|
| 904 | NowTime = substr(date('S'),1,4)'-'substr(date('S'),5,2)'-'substr(date('S'),7,2)' 'time()
|
|---|
| 905 |
|
|---|
| 906 | /* StartTime = "2007-12-31 00:00:00"
|
|---|
| 907 | NowTime = "2008-03-05 08:59:50" */
|
|---|
| 908 |
|
|---|
| 909 | say StartTime
|
|---|
| 910 | say NowTime
|
|---|
| 911 |
|
|---|
| 912 | doM.0 = 12
|
|---|
| 913 | doM.1 = 31; doM.2 = 28; doM.3 = 31; doM.4 = 30; doM.5 = 31; doM.6 = 30;
|
|---|
| 914 | doM.7 = 31; doM.8 = 31; doM.9 = 30; doM.10= 31; doM.11= 30; doM.12= 31
|
|---|
| 915 |
|
|---|
| 916 | parse var StartTime sY'-'sM'-'sD' 'sH':'sMi':'sS
|
|---|
| 917 | parse var NowTime nY'-'nM'-'nD' 'nH':'nMi':'nS
|
|---|
| 918 |
|
|---|
| 919 | if nY//4 = 0 & nY//400 <> 0 then doM.2 = 29
|
|---|
| 920 |
|
|---|
| 921 | say doM.2
|
|---|
| 922 |
|
|---|
| 923 | uY =nY-sY
|
|---|
| 924 | uM =nM-sM
|
|---|
| 925 | uD =nD-sD
|
|---|
| 926 | uH =nH-sH
|
|---|
| 927 | uMi=nMi-sMi
|
|---|
| 928 | uS =nS-sS
|
|---|
| 929 |
|
|---|
| 930 |
|
|---|
| 931 |
|
|---|
| 932 | if uS < 0 then do; uMi= uMi- 1; uS = uS + 60; end
|
|---|
| 933 | if uMi< 0 then do; uH = uH - 1; uMi= uMi+ 60; end
|
|---|
| 934 | if uH < 0 then do; uD = uD - 1; uH = uH + 24; end
|
|---|
| 935 | if uD < 0 then do;
|
|---|
| 936 | /* uM = uM - 1; */
|
|---|
| 937 | if uM < 0 then uMx = uM + 12; else uMx = uM
|
|---|
| 938 | uD = uD + doM.uMx - 1;
|
|---|
| 939 | end
|
|---|
| 940 | if uM < 0 then do; uY = uY - 1; uM = uM + 12; end
|
|---|
| 941 |
|
|---|
| 942 | say uY uM uD uH uMi uS
|
|---|
| 943 |
|
|---|
| 944 | UpTimeStr = ' 'NlvGetMessage(43)':'
|
|---|
| 945 | if uY <> 0 then UpTimeStr = UpTimeStr' 'uY' 'NlvGetMessage(44)
|
|---|
| 946 | if uM <> 0 then UpTimeStr = UpTimeStr' 'uM' 'NlvGetMessage(45)
|
|---|
| 947 | if uD <> 0 then UpTimeStr = UpTimeStr' 'uD' 'NlvGetMessage(46)
|
|---|
| 948 | if uH <> 0 then UpTimeStr = UpTimeStr' 'uH' 'NlvGetMessage(47)
|
|---|
| 949 | if uMi<> 0 then UpTimeStr = UpTimeStr' 'uMi' 'NlvGetMessage(48)
|
|---|
| 950 | if uS <> 0 | UpTimeStr = ' 'NlvGetMessage(43)':' then UpTimeStr = UpTimeStr' 'uS' 'NlvGetMessage(49)
|
|---|
| 951 |
|
|---|
| 952 | ok = VRset("CN_Daemons", "Caption", UpTimeStr)
|
|---|
| 953 | say "_SambaUptime() done"
|
|---|
| 954 | return
|
|---|
| 955 |
|
|---|
| 956 | /*:VRX _SendMsg
|
|---|
| 957 | */
|
|---|
| 958 | _SendMsg:
|
|---|
| 959 | Buttons.1 = NLVGetMessage( 2 )
|
|---|
| 960 | Buttons.2 = NLVGetMessage( 3 )
|
|---|
| 961 | Buttons.0 = 2
|
|---|
| 962 | Message = "Blurp!"
|
|---|
| 963 | id = VRPrompt( VRWindow(), NLVGetMessage( 85 , CurMachine), "Message", NLVGetMessage( 80 ), "Buttons.", buttons.1, buttons.2 )
|
|---|
| 964 |
|
|---|
| 965 | MsgFile = SysTempFileName(TempDir'\smbmsg.'??? )
|
|---|
| 966 | call lineout MsgFile, Message
|
|---|
| 967 | ok = stream(MsgFile,'c','close')
|
|---|
| 968 | say Message
|
|---|
| 969 | address cmd samba.!smbclientexe' --message='CurMachine' 'DebugLevel' <'MsgFile' 2>&1>'samba.!msg
|
|---|
| 970 | /* if rc <> 0 then call _SambaShowError; else */
|
|---|
| 971 | call _SambaShowMsg
|
|---|
| 972 | ok = SysFileDelete(MsgFile)
|
|---|
| 973 | return
|
|---|
| 974 |
|
|---|
| 975 | /*:VRX _ShowMsg
|
|---|
| 976 | */
|
|---|
| 977 | _ShowMsg:
|
|---|
| 978 | Buttons.1 = NLVGetMessage(2)
|
|---|
| 979 | Buttons.0 = 1
|
|---|
| 980 | id = VRMessage( VRWindow(), Msg.Text, Msg.Title, Msg.Type, "Buttons.", buttons.1, buttons.1 )
|
|---|
| 981 | return
|
|---|
| 982 |
|
|---|
| 983 | /*:VRX About_Close
|
|---|
| 984 | */
|
|---|
| 985 | About_Close:
|
|---|
| 986 | call About_Fini
|
|---|
| 987 | return
|
|---|
| 988 |
|
|---|
| 989 | /*:VRX About_Create
|
|---|
| 990 | */
|
|---|
| 991 | About_Create:
|
|---|
| 992 | call About_Init
|
|---|
| 993 | ok = VRSet("About","Caption", NLVGetMessage(20))
|
|---|
| 994 | ok = VRSet("PB_AboutOK","Caption", NLVGetMessage(2))
|
|---|
| 995 | SambaTeam.0 = 8
|
|---|
| 996 | SambaTeam.1 = 'Paul Smedley'
|
|---|
| 997 | SambaTeam.2 = 'Yuri Dario'
|
|---|
| 998 | SambaTeam.3 = 'Herwig Bauernfeind'
|
|---|
| 999 | SambaTeam.4 = 'Silvan Scherrer'
|
|---|
| 1000 | SambaTeam.5 = 'Alex Taylor'
|
|---|
| 1001 | SambaTeam.6 = 'Nikolay Kolosov'
|
|---|
| 1002 | SambaTeam.7 = 'All the Samba people'
|
|---|
| 1003 | SambaTeam.8 = 'All the netlabs people'
|
|---|
| 1004 | ok = VRSet("About","Font", VRGet("Page_6","Font"))
|
|---|
| 1005 | ok = VRMethod("LB_SambaTeam","AddStringList", "SambaTeam." )
|
|---|
| 1006 | ok = VRSet("DT_SambaTeam","Caption", NLVGetMessage(21))
|
|---|
| 1007 | ok = VRSet("MLE_Version","Value", NLVGetMessage(1)||'0D0A'x||VRGet("Main", "Hinttext")||'0D0A'x||'0D0A'x||SambaVer)
|
|---|
| 1008 | return
|
|---|
| 1009 |
|
|---|
| 1010 | /*:VRX About_Fini
|
|---|
| 1011 | */
|
|---|
| 1012 | About_Fini:
|
|---|
| 1013 | window = VRInfo( "Window" )
|
|---|
| 1014 | call VRDestroy window
|
|---|
| 1015 | drop window
|
|---|
| 1016 | return
|
|---|
| 1017 | /*:VRX About_Init
|
|---|
| 1018 | */
|
|---|
| 1019 | About_Init:
|
|---|
| 1020 | window = VRInfo( "Object" )
|
|---|
| 1021 | if( \VRIsChildOf( window, "Notebook" ) ) then do
|
|---|
| 1022 | call VRMethod window, "CenterWindow"
|
|---|
| 1023 | call VRSet window, "Visible", 1
|
|---|
| 1024 | call VRMethod window, "Activate"
|
|---|
| 1025 | end
|
|---|
| 1026 | drop window
|
|---|
| 1027 | return
|
|---|
| 1028 |
|
|---|
| 1029 | /*:VRX Activate
|
|---|
| 1030 | */
|
|---|
| 1031 | Activate:
|
|---|
| 1032 | parse arg Nr
|
|---|
| 1033 | call PushbackAll
|
|---|
| 1034 | CurrentPageNr = Nr
|
|---|
| 1035 | /* ok = VRSet("PB_"Nr,"Font","9.WarpSans Bold") */
|
|---|
| 1036 | ok = VRSet("TAB_"Nr,"Top", TabTop-8)
|
|---|
| 1037 | ok = VRSet("TAB_"Nr,"Left",TabWidth*(Nr-1)+PageLeft)
|
|---|
| 1038 | ok = VRSet("TAB_"Nr,"PicturePath", "#1"||Nr||";#1"||Nr)
|
|---|
| 1039 | ok = VRset("DT_PageName", "Caption", VRGet("TAB_"Nr, "UserData"))
|
|---|
| 1040 | ok = VRSet("Page_"Nr,"Visible", 1)
|
|---|
| 1041 | select
|
|---|
| 1042 | when Nr = 1 then ok = VRSet("IPB_paper","PicturePath","#4;#4")
|
|---|
| 1043 | when Nr = Pages then ok = VRSet("IPB_paper","PicturePath","#6;#6")
|
|---|
| 1044 | otherwise ok = VRSet("IPB_paper","PicturePath","#5;#5")
|
|---|
| 1045 | end
|
|---|
| 1046 | return
|
|---|
| 1047 |
|
|---|
| 1048 | /*:VRX CB_Debug_Click
|
|---|
| 1049 | */
|
|---|
| 1050 | CB_Debug_Click:
|
|---|
| 1051 | options.!Debug = VRGet("CB_Debug","set")
|
|---|
| 1052 | if options.!Debug then ok = VRREdirectStdIO("ON")
|
|---|
| 1053 | else ok = VRREdirectStdIO("OFF")
|
|---|
| 1054 | return
|
|---|
| 1055 |
|
|---|
| 1056 | /*:VRX CB_NoMsgBox_Click
|
|---|
| 1057 | */
|
|---|
| 1058 | CB_NoMsgBox_Click:
|
|---|
| 1059 | NoMsgBox = VRGet("CB_NoMsgBox","set")
|
|---|
| 1060 | say 'NoMsgBox = "'NoMsgBox'"'
|
|---|
| 1061 | return
|
|---|
| 1062 |
|
|---|
| 1063 | /*:VRX CN_Daemons_ContextMenu
|
|---|
| 1064 | */
|
|---|
| 1065 | CN_Daemons_ContextMenu:
|
|---|
| 1066 | if VRInfo("Top") < 1325 & VRGet("CN_Daemons", "View") = "Detail" then call _ColumnsMenu "CN_Daemons"
|
|---|
| 1067 | else do
|
|---|
| 1068 | ok = VRSet("TM_refresh","Enabled", 0)
|
|---|
| 1069 | DRH = VRInfo("Record")
|
|---|
| 1070 | ok = VRset("ContextMenu_Daemons_Sep1","Visible", 0 )
|
|---|
| 1071 | ok = VRset("ContextMenu_Daemons_Ping","Visible", (DRH <> "") )
|
|---|
| 1072 | ok = VRset("ContextMenu_Daemons_Shutdown","Visible", 0 )
|
|---|
| 1073 | RecCap = ""
|
|---|
| 1074 | if DRH <> "" then RecCap = VRMethod("CN_Daemons", "GetRecordAttr", DRH, "Caption")
|
|---|
| 1075 | select
|
|---|
| 1076 | when Words(RecCap) = 3 then do
|
|---|
| 1077 | RecCap = word(RecCap,2)
|
|---|
| 1078 | ok = VRset("ContextMenu_Daemons_Sep1","Visible", 1 )
|
|---|
| 1079 | end
|
|---|
| 1080 | when Words(RecCap) = 1 then do
|
|---|
| 1081 | parse var RecCap RecCap'.exe'
|
|---|
| 1082 | if strip(VRMethod("CN_Daemons", "GetFieldData", DRH, DPidsFH)) <> "" then do
|
|---|
| 1083 | ok = VRSet("ContextMenu_Daemons_Shutdown", "Caption", NLVGetMessage( 33, RecCap))
|
|---|
| 1084 | ok = VRset("ContextMenu_Daemons_Shutdown", "Visible", 1 )
|
|---|
| 1085 | ok = VRset("ContextMenu_Daemons_Sep1","Visible", 1 )
|
|---|
| 1086 | end
|
|---|
| 1087 | else ok = VRset("ContextMenu_Daemons_Ping","Visible", 0 )
|
|---|
| 1088 | end
|
|---|
| 1089 | otherwise nop
|
|---|
| 1090 | end
|
|---|
| 1091 | say ' Daemon is "'RecCap'"'
|
|---|
| 1092 | ok = VRMethod( "ContextMenu_Daemons", "Popup", , , "", "" )
|
|---|
| 1093 | end
|
|---|
| 1094 | return
|
|---|
| 1095 |
|
|---|
| 1096 | /*:VRX CN_Files_ContextMenu
|
|---|
| 1097 | */
|
|---|
| 1098 | CN_Files_ContextMenu:
|
|---|
| 1099 | if VRInfo("Top") < 1325 & VRGet("CN_Files", "View") = "Detail" then call _ColumnsMenu "CN_Files"
|
|---|
| 1100 | else do
|
|---|
| 1101 | RH = VRInfo("Record")
|
|---|
| 1102 | if RH <> "" then do
|
|---|
| 1103 | /* Does not exist yet
|
|---|
| 1104 | ok = VRMethod( "Contextmenu_Files", "Popup", , , "", "PositionOnItem" ) */
|
|---|
| 1105 | end
|
|---|
| 1106 | end
|
|---|
| 1107 | return
|
|---|
| 1108 |
|
|---|
| 1109 | /*:VRX CN_Service_ContextMenu
|
|---|
| 1110 | */
|
|---|
| 1111 | CN_Service_ContextMenu:
|
|---|
| 1112 | if VRInfo("Top") < 1325 & VRGet("CN_Service", "View") = "Detail" then call _ColumnsMenu "CN_Service"
|
|---|
| 1113 | else do
|
|---|
| 1114 | ok = VRSet("TM_refresh","Enabled", 0)
|
|---|
| 1115 | SRH = VRInfo("Record")
|
|---|
| 1116 | if SRH <> "" then do
|
|---|
| 1117 | Service = VRMethod("CN_Service", "GetFieldData", SRH, ServiceFH)
|
|---|
| 1118 | say ' Service is "'Service'"'
|
|---|
| 1119 | ok = VRMethod( "ContextMenu_Service", "Popup", , , "", "" )
|
|---|
| 1120 | end
|
|---|
| 1121 | end
|
|---|
| 1122 | return
|
|---|
| 1123 |
|
|---|
| 1124 | /*:VRX CN_smbtree_ContextMenu
|
|---|
| 1125 | */
|
|---|
| 1126 | CN_smbtree_ContextMenu:
|
|---|
| 1127 | if VRInfo("Top") < 1325 & VRGet("CN_smbtree", "View") = "Detail" then call _ColumnsMenu "CN_smbtree"
|
|---|
| 1128 | else do
|
|---|
| 1129 | RH = VRInfo("Record")
|
|---|
| 1130 | if RH <> "" then do
|
|---|
| 1131 | CurMachine = word(VRMethod( "CN_smbtree", "GetRecordAttr", RH, "Caption" ),1)
|
|---|
| 1132 | ok = VRMethod( "Contextmenu_Tree", "Popup", , , "", "PositionOnItem" )
|
|---|
| 1133 | end
|
|---|
| 1134 | end
|
|---|
| 1135 | return
|
|---|
| 1136 |
|
|---|
| 1137 | /*:VRX CN_Users_ContextMenu
|
|---|
| 1138 | */
|
|---|
| 1139 | CN_Users_ContextMenu:
|
|---|
| 1140 | if VRInfo("Top") < 1325 & VRGet("CN_users", "View") = "Detail" then call _ColumnsMenu "CN_users"
|
|---|
| 1141 | else do
|
|---|
| 1142 | RH = VRInfo("Record")
|
|---|
| 1143 | if RH <> "" then do
|
|---|
| 1144 | CurMachine = VRMethod( "CN_users", "GetFieldData", RH, UMachineFH )
|
|---|
| 1145 | ok = VRMethod( "Contextmenu_Users", "Popup", , , "", "PositionOnItem" )
|
|---|
| 1146 | end
|
|---|
| 1147 | end
|
|---|
| 1148 | return
|
|---|
| 1149 |
|
|---|
| 1150 | /*:VRX Columns_01_Click
|
|---|
| 1151 | */
|
|---|
| 1152 | Columns_01_Click:
|
|---|
| 1153 | call _ColumnShow
|
|---|
| 1154 | return
|
|---|
| 1155 |
|
|---|
| 1156 | /*:VRX Columns_02_Click
|
|---|
| 1157 | */
|
|---|
| 1158 | Columns_02_Click:
|
|---|
| 1159 | call _ColumnShow
|
|---|
| 1160 | return
|
|---|
| 1161 |
|
|---|
| 1162 | /*:VRX Columns_03_Click
|
|---|
| 1163 | */
|
|---|
| 1164 | Columns_03_Click:
|
|---|
| 1165 | call _ColumnShow
|
|---|
| 1166 | return
|
|---|
| 1167 |
|
|---|
| 1168 | /*:VRX Columns_04_Click
|
|---|
| 1169 | */
|
|---|
| 1170 | Columns_04_Click:
|
|---|
| 1171 | call _ColumnShow
|
|---|
| 1172 | return
|
|---|
| 1173 |
|
|---|
| 1174 | /*:VRX Columns_05_Click
|
|---|
| 1175 | */
|
|---|
| 1176 | Columns_05_Click:
|
|---|
| 1177 | call _ColumnShow
|
|---|
| 1178 | return
|
|---|
| 1179 |
|
|---|
| 1180 | /*:VRX Columns_06_Click
|
|---|
| 1181 | */
|
|---|
| 1182 | Columns_06_Click:
|
|---|
| 1183 | call _ColumnShow
|
|---|
| 1184 | return
|
|---|
| 1185 |
|
|---|
| 1186 | /*:VRX Columns_07_Click
|
|---|
| 1187 | */
|
|---|
| 1188 | Columns_07_Click:
|
|---|
| 1189 | call _ColumnShow
|
|---|
| 1190 | return
|
|---|
| 1191 |
|
|---|
| 1192 | /*:VRX Columns_08_Click
|
|---|
| 1193 | */
|
|---|
| 1194 | Columns_08_Click:
|
|---|
| 1195 | call _ColumnShow
|
|---|
| 1196 | return
|
|---|
| 1197 |
|
|---|
| 1198 | /*:VRX Columns_09_Click
|
|---|
| 1199 | */
|
|---|
| 1200 | Columns_09_Click:
|
|---|
| 1201 | call _ColumnShow
|
|---|
| 1202 | return
|
|---|
| 1203 |
|
|---|
| 1204 | /*:VRX Columns_10_Click
|
|---|
| 1205 | */
|
|---|
| 1206 | Columns_10_Click:
|
|---|
| 1207 | call _ColumnShow
|
|---|
| 1208 | return
|
|---|
| 1209 |
|
|---|
| 1210 | /*:VRX Columns_11_Click
|
|---|
| 1211 | */
|
|---|
| 1212 | Columns_11_Click:
|
|---|
| 1213 | call _ColumnShow
|
|---|
| 1214 | return
|
|---|
| 1215 |
|
|---|
| 1216 | /*:VRX Columns_12_Click
|
|---|
| 1217 | */
|
|---|
| 1218 | Columns_12_Click:
|
|---|
| 1219 | call _ColumnShow
|
|---|
| 1220 | return
|
|---|
| 1221 |
|
|---|
| 1222 | /*:VRX ContextMenu_Daemons_Details_Click
|
|---|
| 1223 | */
|
|---|
| 1224 | ContextMenu_Daemons_Details_Click:
|
|---|
| 1225 | ok = VRset("CN_Daemons","View","Detail")
|
|---|
| 1226 | ok = VRset("ContextMenu_Daemons_Tree","Enabled",1)
|
|---|
| 1227 | ok = VRset("ContextMenu_Daemons_Details","Enabled",0)
|
|---|
| 1228 | ok = VRSet("TM_refresh","Enabled", 1)
|
|---|
| 1229 | return
|
|---|
| 1230 |
|
|---|
| 1231 | /*:VRX ContextMenu_Daemons_Ping_Click
|
|---|
| 1232 | */
|
|---|
| 1233 | ContextMenu_Daemons_Ping_Click:
|
|---|
| 1234 | ok = VRSet("Main", 'Pointer', 'Wait' )
|
|---|
| 1235 | address cmd samba.!smbcontrolexe' 'RecCap' ping --timeout=3 --debuglevel=0 2>'samba.!error' 1>'samba.!msg
|
|---|
| 1236 | call _SambaShowMsg "section table registered"
|
|---|
| 1237 |
|
|---|
| 1238 | ok = VRSet("Main", 'Pointer', '<default>' )
|
|---|
| 1239 | ok = VRSet("TM_refresh","Enabled", 1)
|
|---|
| 1240 | return
|
|---|
| 1241 |
|
|---|
| 1242 | /*:VRX ContextMenu_Daemons_Shutdown_Click
|
|---|
| 1243 | */
|
|---|
| 1244 | ContextMenu_Daemons_Shutdown_Click:
|
|---|
| 1245 | Msg.Text = NLVGetMessage(34, RecCap)
|
|---|
| 1246 | Msg.Type = 'Q'
|
|---|
| 1247 | if _MsgYesNo() = 1 then do
|
|---|
| 1248 | address cmd samba.!smbcontrolexe' 'RecCap' shutdown 2>'samba.!error' 1>'samba.!msg
|
|---|
| 1249 | call _SambaShowMsg "section table registered"
|
|---|
| 1250 | end
|
|---|
| 1251 | ok = VRSet("TM_refresh","Enabled", 1)
|
|---|
| 1252 | return
|
|---|
| 1253 |
|
|---|
| 1254 | /*:VRX ContextMenu_Daemons_Tree_Click
|
|---|
| 1255 | */
|
|---|
| 1256 | ContextMenu_Daemons_Tree_Click:
|
|---|
| 1257 | ok = VRset("CN_Daemons","View","IconTree")
|
|---|
| 1258 | ok = VRset("ContextMenu_Daemons_Tree","Enabled",0)
|
|---|
| 1259 | ok = VRset("ContextMenu_Daemons_Details","Enabled",1)
|
|---|
| 1260 | ok = VRSet("TM_refresh","Enabled", 1)
|
|---|
| 1261 | return
|
|---|
| 1262 |
|
|---|
| 1263 | /*:VRX ContextMenu_Service_CloseShare_Click
|
|---|
| 1264 | */
|
|---|
| 1265 | ContextMenu_Service_CloseShare_Click:
|
|---|
| 1266 | Msg.Text = NLVGetMessage(75, Service)
|
|---|
| 1267 | Msg.Type = 'Q'
|
|---|
| 1268 | if _MsgYesNo() = 1 then do
|
|---|
| 1269 | address cmd samba.!smbcontrolexe' smbd close-share 'Service' --debuglevel=0' /* ' 2>'samba.!error' 1>'samba.!msg */
|
|---|
| 1270 | /* No usable output from Samba here ! */
|
|---|
| 1271 | /* call _SambaShowMsg */
|
|---|
| 1272 | Msg.Text = NLVGetMessage(76, Service)
|
|---|
| 1273 | Msg.Type = 'I'
|
|---|
| 1274 | call _ShowMsg
|
|---|
| 1275 | end
|
|---|
| 1276 | ok = VRSet("TM_refresh","Enabled", 1)
|
|---|
| 1277 | return
|
|---|
| 1278 |
|
|---|
| 1279 | /*:VRX ContextMenu_Tree_Details_Click
|
|---|
| 1280 | */
|
|---|
| 1281 | ContextMenu_Tree_Details_Click:
|
|---|
| 1282 | ok = VRset("CN_smbtree","View","Detail")
|
|---|
| 1283 | ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
|
|---|
| 1284 | ok = VRset("ContextMenu_Tree_Details","Enabled",0)
|
|---|
| 1285 | ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
|
|---|
| 1286 | call _RefreshTree
|
|---|
| 1287 | return
|
|---|
| 1288 |
|
|---|
| 1289 | /*:VRX ContextMenu_Tree_Icons_Click
|
|---|
| 1290 | */
|
|---|
| 1291 | ContextMenu_Tree_Icons_Click:
|
|---|
| 1292 | ok = VRset("CN_smbtree","View","Icon")
|
|---|
| 1293 | ok = VRset("ContextMenu_Tree_Icons","Enabled",0)
|
|---|
| 1294 | ok = VRset("ContextMenu_Tree_Tree","Enabled",1)
|
|---|
| 1295 | ok = VRset("ContextMenu_Tree_Details","Enabled",1)
|
|---|
| 1296 | call _RefreshTree
|
|---|
| 1297 | return
|
|---|
| 1298 |
|
|---|
| 1299 | /*:VRX ContextMenu_Tree_SendMsg_Click
|
|---|
| 1300 | */
|
|---|
| 1301 | ContextMenu_Tree_SendMsg_Click:
|
|---|
| 1302 | call _SendMsg
|
|---|
| 1303 | return
|
|---|
| 1304 |
|
|---|
| 1305 | /*:VRX ContextMenu_Tree_Tree_Click
|
|---|
| 1306 | */
|
|---|
| 1307 | ContextMenu_Tree_Tree_Click:
|
|---|
| 1308 | ok = VRset("CN_smbtree","View","IconTree")
|
|---|
| 1309 | ok = VRset("ContextMenu_Tree_Tree","Enabled",0)
|
|---|
| 1310 | ok = VRset("ContextMenu_Tree_Details","Enabled",1)
|
|---|
| 1311 | ok = VRset("ContextMenu_Tree_Icons","Enabled",1)
|
|---|
| 1312 | call _RefreshTree
|
|---|
| 1313 | return
|
|---|
| 1314 |
|
|---|
| 1315 | /*:VRX ContextMenu_Users_SendMsg_Click
|
|---|
| 1316 | */
|
|---|
| 1317 | ContextMenu_Users_SendMsg_Click:
|
|---|
| 1318 | call _SendMsg
|
|---|
| 1319 | return
|
|---|
| 1320 |
|
|---|
| 1321 | /*:VRX Fini
|
|---|
| 1322 | */
|
|---|
| 1323 | Fini:
|
|---|
| 1324 | window = VRWindow()
|
|---|
| 1325 | call VRSet window, "Visible", 0
|
|---|
| 1326 | drop window
|
|---|
| 1327 | return 0
|
|---|
| 1328 |
|
|---|
| 1329 | /*:VRX GetBootDrive
|
|---|
| 1330 | */
|
|---|
| 1331 | GetBootDrive:
|
|---|
| 1332 | /* Use SysBootDrive if possible */
|
|---|
| 1333 | If Rxfuncadd('SysBootDrive', 'RexxUtil', 'SysBootDrive') Then
|
|---|
| 1334 | Return Left(Value('RUNWORKPLACE',,'OS2ENVIRONMENT'),2)
|
|---|
| 1335 | Else
|
|---|
| 1336 | Return SysBootDrive()
|
|---|
| 1337 |
|
|---|
| 1338 |
|
|---|
| 1339 | /*:VRX Halt
|
|---|
| 1340 | */
|
|---|
| 1341 | Halt:
|
|---|
| 1342 | signal _VREHalt
|
|---|
| 1343 | return
|
|---|
| 1344 |
|
|---|
| 1345 | /*:VRX Init
|
|---|
| 1346 | */
|
|---|
| 1347 | Init:
|
|---|
| 1348 | window = VRWindow()
|
|---|
| 1349 | call VRMethod window, "CenterWindow"
|
|---|
| 1350 | call VRSet window, "Visible", 0
|
|---|
| 1351 | call VRMethod window, "Activate"
|
|---|
| 1352 | drop window
|
|---|
| 1353 | return
|
|---|
| 1354 |
|
|---|
| 1355 | /*:VRX IPB_Paper_Click
|
|---|
| 1356 | */
|
|---|
| 1357 | IPB_Paper_Click:
|
|---|
| 1358 | if VRInfo("Left") > VRInfo("Top") then call Activate min(CurrentPageNr+1,Pages)
|
|---|
| 1359 | if VRInfo("Left") <= VRInfo("Top") then call Activate max(CurrentPageNr-1,1)
|
|---|
| 1360 | return
|
|---|
| 1361 |
|
|---|
| 1362 | /*:VRX IPB_Reload_Click
|
|---|
| 1363 | */
|
|---|
| 1364 | IPB_Reload_Click:
|
|---|
| 1365 | call VRSet VRWindow(), 'Pointer', 'Wait'
|
|---|
| 1366 | address CMD samba.!smbcmd' reload '
|
|---|
| 1367 |
|
|---|
| 1368 | /* 2>'samba.!error' 1>'samba.!msg
|
|---|
| 1369 | if \NoMsgBox then call _SambaShowMsg "[32 Done" */
|
|---|
| 1370 |
|
|---|
| 1371 | ok = VRSet("TM_Refresh","Delay", 1000)
|
|---|
| 1372 | call VRSet VRWindow(), 'Pointer', '<default>'
|
|---|
| 1373 | return
|
|---|
| 1374 |
|
|---|
| 1375 | /*:VRX IPB_Restart_Click
|
|---|
| 1376 | */
|
|---|
| 1377 | IPB_Restart_Click:
|
|---|
| 1378 | call VRSet VRWindow(), 'Pointer', 'Wait'
|
|---|
| 1379 | address CMD samba.!smbcmd' restart '
|
|---|
| 1380 |
|
|---|
| 1381 | /* 2>'samba.!error' 1>'samba.!msg
|
|---|
| 1382 | if \NoMsgBox then call _SambaShowMsg "[32 Done" */
|
|---|
| 1383 |
|
|---|
| 1384 | ok = VRSet("TM_Refresh","Delay", 1000)
|
|---|
| 1385 | call VRSet VRWindow(), 'Pointer', '<default>'
|
|---|
| 1386 | return
|
|---|
| 1387 |
|
|---|
| 1388 | /*:VRX IPB_Start_Click
|
|---|
| 1389 | */
|
|---|
| 1390 | IPB_Start_Click:
|
|---|
| 1391 | say "IPB_Start_Click started"
|
|---|
| 1392 | call VRSet VRWindow(), 'Pointer', 'Wait'
|
|---|
| 1393 |
|
|---|
| 1394 | say " "samba.!smbcmd' start '
|
|---|
| 1395 | /* 2>'samba.!error' 1>'samba.!msg */
|
|---|
| 1396 |
|
|---|
| 1397 | address CMD samba.!smbcmd' start '
|
|---|
| 1398 |
|
|---|
| 1399 | /* 2>'samba.!error' 1>'samba.!msg
|
|---|
| 1400 | if \NoMsgBox then call _SambaShowMsg "[32 Done"
|
|---|
| 1401 | else do
|
|---|
| 1402 | say "Start no msg"
|
|---|
| 1403 | ok = stream(Samba.!msg,"c","close")
|
|---|
| 1404 | say " stream close "Samba.!msg" = "ok
|
|---|
| 1405 | ok = SysFileDelete(Samba.!msg)
|
|---|
| 1406 | say " Delete "Samba.!msg" = "ok
|
|---|
| 1407 | end */
|
|---|
| 1408 | ok = VRSet("TM_Refresh","Delay", 1000)
|
|---|
| 1409 | call VRSet VRWindow(), 'Pointer', '<default>'
|
|---|
| 1410 | say "IPB_Start_Click done"
|
|---|
| 1411 | return
|
|---|
| 1412 |
|
|---|
| 1413 | /*:VRX IPB_Stop_Click
|
|---|
| 1414 | */
|
|---|
| 1415 | IPB_Stop_Click:
|
|---|
| 1416 | say "IPB_Stop_Click started"
|
|---|
| 1417 | call VRSet VRWindow(), 'Pointer', 'Wait'
|
|---|
| 1418 | say " "samba.!smbcmd' stop '
|
|---|
| 1419 | /* 2>'samba.!error' 1>'samba.!msg */
|
|---|
| 1420 |
|
|---|
| 1421 | address CMD samba.!smbcmd' stop'
|
|---|
| 1422 |
|
|---|
| 1423 | /* 2>'samba.!error' 1>'samba.!msg
|
|---|
| 1424 | if \NoMsgBox then call _SambaShowMsg "[32 Done"
|
|---|
| 1425 | else do
|
|---|
| 1426 | say " Stop no msg"
|
|---|
| 1427 | ok = stream(Samba.!msg,"c","close")
|
|---|
| 1428 | say " stream close "Samba.!msg" = "ok
|
|---|
| 1429 | ok = SysFileDelete(Samba.!msg)
|
|---|
| 1430 | say " Delete "Samba.!msg" = "ok
|
|---|
| 1431 | end */
|
|---|
| 1432 | ok = VRSet("TM_Refresh","Delay", 1000)
|
|---|
| 1433 |
|
|---|
| 1434 | call VRSet VRWindow(), 'Pointer', '<default>'
|
|---|
| 1435 | say "IPB_Stop_Click done"
|
|---|
| 1436 | return
|
|---|
| 1437 |
|
|---|
| 1438 | /*:VRX Main_Activate
|
|---|
| 1439 | */
|
|---|
| 1440 | Main_Activate:
|
|---|
| 1441 | call TM_Refresh_Trigger
|
|---|
| 1442 | ok = VRset("TM_Refresh", "Enabled", 1)
|
|---|
| 1443 | return
|
|---|
| 1444 |
|
|---|
| 1445 | /*:VRX Main_Close
|
|---|
| 1446 | */
|
|---|
| 1447 | Main_Close:
|
|---|
| 1448 | call Quit
|
|---|
| 1449 | return
|
|---|
| 1450 |
|
|---|
| 1451 | /*:VRX Main_Create
|
|---|
| 1452 | */
|
|---|
| 1453 | Main_Create:
|
|---|
| 1454 | call _LoadOtherFuncs
|
|---|
| 1455 | call _InitTempDir
|
|---|
| 1456 | call _IniRead
|
|---|
| 1457 | call _NLVSetup
|
|---|
| 1458 | call _SambaInit
|
|---|
| 1459 | if _SambaRunning() then call _SambaFindPIDfile
|
|---|
| 1460 | call _ContainerInit
|
|---|
| 1461 | call _GUIInit
|
|---|
| 1462 |
|
|---|
| 1463 | str = 'call TAB_'CurrentPageNr'_Click'; interpret str
|
|---|
| 1464 | ok = VRMethod("PB_Refresh","SetFocus")
|
|---|
| 1465 | call _Refresh
|
|---|
| 1466 | if FirstRun = 1 & CurrentPageNr = 5 then call _RefreshTree
|
|---|
| 1467 | return
|
|---|
| 1468 | /*:VRX Main_Deactivate
|
|---|
| 1469 | */
|
|---|
| 1470 | Main_Deactivate:
|
|---|
| 1471 | ok = VRset("TM_Refresh", "Enabled", 0)
|
|---|
| 1472 | return
|
|---|
| 1473 |
|
|---|
| 1474 | /*:VRX Main_Resize
|
|---|
| 1475 | */
|
|---|
| 1476 | Main_Resize:
|
|---|
| 1477 | say 'Mainresize() started'
|
|---|
| 1478 | MainWin = "Main"
|
|---|
| 1479 | ok = VRSet(MainWin,"Painting", 0)
|
|---|
| 1480 | if datatype(Pages) <> "NUM" then call PushbackAll
|
|---|
| 1481 | ok = VRSet(MainWin,"Width",max(VRget(MainWin,"Width"),Pages*TabWidth+300))
|
|---|
| 1482 | ok = VRset("GB_Main","width",VRget(MainWin,"Width")-150)
|
|---|
| 1483 | ok = VRset("GB_Main","Height",VRget(MainWin,"Height")-1175-240)
|
|---|
| 1484 | ok = VRset("GB_Main2","width",VRget("GB_Main","Width")-260)
|
|---|
| 1485 | ok = VRset("GB_Main2","Height",VRget("GB_Main","Height")-275)
|
|---|
| 1486 | ok = VRset("GB_VerticalLine","Left",VRget("GB_Main2","Width")-60)
|
|---|
| 1487 | ok = VRset("GB_VerticalLine","Height",VRget("GB_Main2","Height")-410)
|
|---|
| 1488 | ok = VRset("IPB_Paper","Left",VRget("GB_Main2","width")-420)
|
|---|
| 1489 | ok = VRset("GB_HorLineTop","Width",VRget("GB_Main2","width")-440)
|
|---|
| 1490 | ok = VRset("GB_HorLineTop","Width",VRget("GB_Main2","width")-440)
|
|---|
| 1491 | ok = VRset("GB_LineSubtitle","Width",VRget("GB_Main2","width")-480)
|
|---|
| 1492 | do I = 1 to Pages
|
|---|
| 1493 | /*say 'Page_'I'='max(PageHeight,VRget("GB_Main2","Height")-600) */
|
|---|
| 1494 | ok = VRSet("Page_"I,"Height", max(PageHeight,VRget("GB_Main2","Height")-600))
|
|---|
| 1495 | ok = VRSet("Page_"I,"Width", max(PageWidth,VRget("GB_Main2","Width")-450))
|
|---|
| 1496 | end
|
|---|
| 1497 |
|
|---|
| 1498 | ok = VRSEt("PB_Refresh","top",VRGet("GB_Main","Height")+305)
|
|---|
| 1499 | ok = VRSEt("PB_Help", "top",VRGet("GB_Main","Height")+305)
|
|---|
| 1500 | ok = VRSEt("PB_Cancel", "top",VRGet("GB_Main","Height")+305)
|
|---|
| 1501 | ok = VRSEt("PB_About", "top",VRGet("GB_Main","Height")+305)
|
|---|
| 1502 |
|
|---|
| 1503 | ok = VRset("CN_Users","Top", 120)
|
|---|
| 1504 | ok = VRset("CN_Users","Left", 20)
|
|---|
| 1505 | ok = VRset("CN_Users","Width", VRGet("Page_1","Width")-600)
|
|---|
| 1506 | ok = VRset("CN_Users","Height", VRGet("Page_1","Height")-120)
|
|---|
| 1507 |
|
|---|
| 1508 | ok = VRset("CN_Files","Top", 120)
|
|---|
| 1509 | ok = VRset("CN_Files","Left", 20)
|
|---|
| 1510 | ok = VRset("CN_Files","Width", VRGet("Page_2","Width")-600)
|
|---|
| 1511 | ok = VRset("CN_Files","Height", VRGet("Page_2","Height")-120)
|
|---|
| 1512 |
|
|---|
| 1513 | ok = VRset("CN_Service","Top", 120)
|
|---|
| 1514 | ok = VRset("CN_Service","Left", 20)
|
|---|
| 1515 | ok = VRset("CN_Service","Width", VRGet("Page_2","Width")-600)
|
|---|
| 1516 | ok = VRset("CN_Service","Height", VRGet("Page_2","Height")-120)
|
|---|
| 1517 |
|
|---|
| 1518 | ok = VRset("CN_Daemons","Top", 120)
|
|---|
| 1519 | ok = VRset("CN_Daemons","Left", 20)
|
|---|
| 1520 | ok = VRset("CN_Daemons","Width", VRGet("Page_2","Width")-600)
|
|---|
| 1521 | ok = VRset("CN_Daemons","Height", VRGet("Page_2","Height")-120)
|
|---|
| 1522 |
|
|---|
| 1523 | ok = VRSet("IPB_Start","Left", VRGet("CN_Daemons","Width") + 120)
|
|---|
| 1524 | ok = VRSet("IPB_Stop","Top", VRGet("IPB_Start","Top"))
|
|---|
| 1525 | ok = VRSet("IPB_Stop","Left", VRGet("CN_Daemons","Width") + 120)
|
|---|
| 1526 | ok = VRSet("IPB_Restart","Left", VRGet("CN_Daemons","Width") + 120)
|
|---|
| 1527 | ok = VRSet("IPB_Reload","Left", VRGet("CN_Daemons","Width") + 120)
|
|---|
| 1528 |
|
|---|
| 1529 | ok = VRset("CN_smbtree","Top", 120)
|
|---|
| 1530 | ok = VRset("CN_smbtree","Left", 20)
|
|---|
| 1531 | ok = VRset("CN_smbtree","Width", VRGet("Page_5","Width")-120)
|
|---|
| 1532 | ok = VRset("CN_smbtree","Height", VRGet("Page_5","Height")-120)
|
|---|
| 1533 |
|
|---|
| 1534 |
|
|---|
| 1535 |
|
|---|
| 1536 | ButtonDist= 980
|
|---|
| 1537 | ButtonNr = 4
|
|---|
| 1538 | ButtonPos = format(max((VRget(MainWin,"Width")-ButtonDist*ButtonNr)/2,0),,0)
|
|---|
| 1539 | ok = VRSEt("PB_Refresh","left",ButtonPos+ButtonDist*(ButtonNr-4))
|
|---|
| 1540 | ok = VRSEt("PB_Help", "left",ButtonPos+ButtonDist*(ButtonNr-3))
|
|---|
| 1541 | ok = VRSEt("PB_About", "left",ButtonPos+ButtonDist*(ButtonNr-2))
|
|---|
| 1542 | ok = VRSEt("PB_Cancel", "left",ButtonPos+ButtonDist*(ButtonNr-1))
|
|---|
| 1543 |
|
|---|
| 1544 | /* check and empty event queue, trash spurious resize events */
|
|---|
| 1545 | EventString = ''
|
|---|
| 1546 | TrashedResize = 0
|
|---|
| 1547 | do until EventString = 'nop'
|
|---|
| 1548 | EventString = VREvent('N')
|
|---|
| 1549 | if EventString <> 'nop' then do
|
|---|
| 1550 | if EventString = 'CALL 'MainWin'_Resize' then TrashedResize = 1
|
|---|
| 1551 | else interpret eventString
|
|---|
| 1552 | end
|
|---|
| 1553 | end
|
|---|
| 1554 | if TrashedResize then CALL Main_Resize
|
|---|
| 1555 | ok = VRSet(MainWin, "Painting", 1)
|
|---|
| 1556 |
|
|---|
| 1557 | /* ok = VRset(MainWin,"Visible", 1) */
|
|---|
| 1558 | say 'Mainresize() done'
|
|---|
| 1559 | return
|
|---|
| 1560 |
|
|---|
| 1561 | /*:VRX Page1_Create
|
|---|
| 1562 | */
|
|---|
| 1563 | Page1_Create:
|
|---|
| 1564 |
|
|---|
| 1565 | Return
|
|---|
| 1566 |
|
|---|
| 1567 | /*:VRX Page1_Init
|
|---|
| 1568 | */
|
|---|
| 1569 | Page1_Init:
|
|---|
| 1570 | call _ContainerInit
|
|---|
| 1571 | return
|
|---|
| 1572 |
|
|---|
| 1573 | /*:VRX Page2_Create
|
|---|
| 1574 | */
|
|---|
| 1575 | Page2_create:
|
|---|
| 1576 |
|
|---|
| 1577 | Return
|
|---|
| 1578 | /*:VRX Page2_init
|
|---|
| 1579 | */
|
|---|
| 1580 | Page2_init:
|
|---|
| 1581 |
|
|---|
| 1582 | return
|
|---|
| 1583 |
|
|---|
| 1584 | /*:VRX Page3_Create
|
|---|
| 1585 | */
|
|---|
| 1586 | Page3_create:
|
|---|
| 1587 |
|
|---|
| 1588 | Return
|
|---|
| 1589 | /*:VRX Page3_Init
|
|---|
| 1590 | */
|
|---|
| 1591 | Page3_Init:
|
|---|
| 1592 |
|
|---|
| 1593 | return
|
|---|
| 1594 |
|
|---|
| 1595 | /*:VRX Page4_Create
|
|---|
| 1596 | */
|
|---|
| 1597 | Page4_Create:
|
|---|
| 1598 |
|
|---|
| 1599 | Return
|
|---|
| 1600 | /*:VRX Page4_init
|
|---|
| 1601 | */
|
|---|
| 1602 | Page4_init:
|
|---|
| 1603 |
|
|---|
| 1604 | return
|
|---|
| 1605 |
|
|---|
| 1606 | /*:VRX Page5_Create
|
|---|
| 1607 | */
|
|---|
| 1608 | Page5_Create:
|
|---|
| 1609 |
|
|---|
| 1610 | return
|
|---|
| 1611 |
|
|---|
| 1612 | /*:VRX Page5_Init
|
|---|
| 1613 | */
|
|---|
| 1614 | Page5_Init:
|
|---|
| 1615 |
|
|---|
| 1616 | return
|
|---|
| 1617 |
|
|---|
| 1618 | /*:VRX Paper_Init
|
|---|
| 1619 | */
|
|---|
| 1620 | Paper_Init:
|
|---|
| 1621 | ok = VRSet("IPB_Paper","Width" ,VRMethod( "Screen", "PixelsToTwips", 32 ))
|
|---|
| 1622 | ok = VRSet("IPB_Paper","Height",VRMethod( "Screen", "PixelsToTwips", 32 ))
|
|---|
| 1623 | ok = VRset("IPB_Paper","Left",VRget("GB_Main2","width")-420)
|
|---|
| 1624 | return
|
|---|
| 1625 |
|
|---|
| 1626 | /*:VRX PB_About_Click
|
|---|
| 1627 | */
|
|---|
| 1628 | PB_About_Click:
|
|---|
| 1629 | window = VRLoadSecondary( "About", "W" )
|
|---|
| 1630 | return
|
|---|
| 1631 |
|
|---|
| 1632 | /*:VRX PB_AboutOK_Click
|
|---|
| 1633 | */
|
|---|
| 1634 | PB_AboutOK_Click:
|
|---|
| 1635 | call About_Close
|
|---|
| 1636 | return
|
|---|
| 1637 |
|
|---|
| 1638 | /*:VRX PB_Cancel_Click
|
|---|
| 1639 | */
|
|---|
| 1640 | PB_Cancel_Click:
|
|---|
| 1641 | say 'start PB_Cancel_Click'
|
|---|
| 1642 | Call Quit
|
|---|
| 1643 | say 'done PB_Cancel_Click'
|
|---|
| 1644 | return
|
|---|
| 1645 |
|
|---|
| 1646 | /*:VRX PB_Help_Click
|
|---|
| 1647 | */
|
|---|
| 1648 | PB_Help_Click:
|
|---|
| 1649 | ok = VRMethod("Page_"CurrentPageNr, "InvokeHelp" )
|
|---|
| 1650 | return
|
|---|
| 1651 |
|
|---|
| 1652 | /*:VRX PB_Refresh_Click
|
|---|
| 1653 | */
|
|---|
| 1654 | PB_Refresh_Click:
|
|---|
| 1655 | ok = SysSleep(0.3)
|
|---|
| 1656 | if CurrentPageNr = 5
|
|---|
| 1657 | then call _RefreshTree
|
|---|
| 1658 | else call _Refresh
|
|---|
| 1659 | return
|
|---|
| 1660 |
|
|---|
| 1661 | /*:VRX PushbackAll
|
|---|
| 1662 | */
|
|---|
| 1663 | PushbackAll:
|
|---|
| 1664 | Pages = 6
|
|---|
| 1665 | /* Tab distance from top */
|
|---|
| 1666 | TabTop = 20
|
|---|
| 1667 | TabWidth = VRMethod( "Screen", "PixelsToTwips", 78 )
|
|---|
| 1668 | TabHeight= VRMethod( "Screen", "PixelsToTwips", 24 )
|
|---|
| 1669 |
|
|---|
| 1670 | /* Page Position */
|
|---|
| 1671 | PageLeft = 120
|
|---|
| 1672 | PageTop = PageLeft + TabTop + 330
|
|---|
| 1673 |
|
|---|
| 1674 | /* Page size */
|
|---|
| 1675 | PageHeight = 3000
|
|---|
| 1676 | PageWidth = 3000
|
|---|
| 1677 | ok = VRset("DT_PageName", "Caption", "")
|
|---|
| 1678 | ok = VRSet("GB_Main","Left", 0)
|
|---|
| 1679 | ok = VRSet("GB_Main","Top", TabTop+230)
|
|---|
| 1680 | do I = 1 to Pages
|
|---|
| 1681 | ok = VRSet("TAB_"I,"Top", TabTop)
|
|---|
| 1682 | ok = VRSet("TAB_"I,"PicturePath","#2"||I||";#2"||I)
|
|---|
| 1683 | ok = VRSet("TAB_"I,"Left",TabWidth*(I-1)+PageLeft)
|
|---|
| 1684 | ok = VRSet("TAB_"I,"Width",TabWidth)
|
|---|
| 1685 | ok = VRSet("TAB_"I,"Height",TabHeight)
|
|---|
| 1686 | ok = VRSet("Page_"I,"Height", max(PageHeight,VRget("GB_Main2","Height")-600))
|
|---|
| 1687 | ok = VRSet("Page_"I,"Width", max(PageWidth,VRget("GB_Main2","Width")-450))
|
|---|
| 1688 | ok = VRSet("Page_"I,"Left", PageLeft)
|
|---|
| 1689 | ok = VRSet("Page_"I,"Top", PageTop)
|
|---|
| 1690 | ok = VRSet("Page_"I,"Visible", 0)
|
|---|
| 1691 | ok = VRSet("Page_"I,"BackColor", "<default>")
|
|---|
| 1692 | end
|
|---|
| 1693 | return
|
|---|
| 1694 |
|
|---|
| 1695 | /*:VRX Quit
|
|---|
| 1696 | */
|
|---|
| 1697 | Quit:
|
|---|
| 1698 | call _IniWrite
|
|---|
| 1699 | ok = VRRedirectStdIO("OFF")
|
|---|
| 1700 | call _SambaFinish
|
|---|
| 1701 |
|
|---|
| 1702 | ok = SysFileDelete(smbdoutput)
|
|---|
| 1703 |
|
|---|
| 1704 | window = VRWindow()
|
|---|
| 1705 | call VRSet window, "Shutdown", 1
|
|---|
| 1706 | drop window
|
|---|
| 1707 | return
|
|---|
| 1708 |
|
|---|
| 1709 | /*:VRX SPIN_Intervall_Change
|
|---|
| 1710 | */
|
|---|
| 1711 | SPIN_Intervall_Change:
|
|---|
| 1712 | Intervall = VRGet("SPIN_Intervall","Value")
|
|---|
| 1713 | ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
|
|---|
| 1714 | return
|
|---|
| 1715 |
|
|---|
| 1716 | /*:VRX SPIN_IntervallMin_Change
|
|---|
| 1717 | */
|
|---|
| 1718 | SPIN_IntervallMin_Change:
|
|---|
| 1719 | IntervallMin = VRGet("SPIN_IntervallMin","Value")
|
|---|
| 1720 | return
|
|---|
| 1721 |
|
|---|
| 1722 | /*:VRX TAB_1_Click
|
|---|
| 1723 | */
|
|---|
| 1724 | TAB_1_Click:
|
|---|
| 1725 | call Activate 1
|
|---|
| 1726 | return
|
|---|
| 1727 |
|
|---|
| 1728 | /*:VRX TAB_2_Click
|
|---|
| 1729 | */
|
|---|
| 1730 | TAB_2_Click:
|
|---|
| 1731 | call Activate 2
|
|---|
| 1732 | return
|
|---|
| 1733 |
|
|---|
| 1734 | /*:VRX TAB_3_Click
|
|---|
| 1735 | */
|
|---|
| 1736 | TAB_3_Click:
|
|---|
| 1737 | call Activate 3
|
|---|
| 1738 | return
|
|---|
| 1739 |
|
|---|
| 1740 | /*:VRX TAB_4_Click
|
|---|
| 1741 | */
|
|---|
| 1742 | TAB_4_Click:
|
|---|
| 1743 | call Activate 4
|
|---|
| 1744 | return
|
|---|
| 1745 |
|
|---|
| 1746 | /*:VRX TAB_5_Click
|
|---|
| 1747 | */
|
|---|
| 1748 | TAB_5_Click:
|
|---|
| 1749 | call Activate 5
|
|---|
| 1750 | if FirstRun = 1 then call _RefreshTree
|
|---|
| 1751 | return
|
|---|
| 1752 |
|
|---|
| 1753 | /*:VRX TAB_6_Click
|
|---|
| 1754 | */
|
|---|
| 1755 | TAB_6_Click:
|
|---|
| 1756 | call Activate 6
|
|---|
| 1757 | return
|
|---|
| 1758 |
|
|---|
| 1759 | /*:VRX TM_Refresh_Trigger
|
|---|
| 1760 | */
|
|---|
| 1761 | TM_Refresh_Trigger:
|
|---|
| 1762 | ok = VRSet("TM_Refresh","Delay", Intervall * 1000)
|
|---|
| 1763 | call _Refresh
|
|---|
| 1764 | return
|
|---|
| 1765 |
|
|---|
| 1766 | /*:VRX TM_RefreshTreeDisplay_Trigger
|
|---|
| 1767 | */
|
|---|
| 1768 | TM_RefreshTreeDisplay_Trigger:
|
|---|
| 1769 | call _RefreshTreeDisplay
|
|---|
| 1770 | return
|
|---|
| 1771 |
|
|---|