'encoding UTF-8 Do not remove or change this line!
'*************************************************************************
'
' Licensed to the Apache Software Foundation (ASF) under one
' or more contributor license agreements. See the NOTICE file
' distributed with this work for additional information
' regarding copyright ownership. The ASF licenses this file
' to you under the Apache License, Version 2.0 (the
' "License"); you may not use this file except in compliance
' with the License. You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing,
' software distributed under the License is distributed on an
' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
' KIND, either express or implied. See the License for the
' specific language governing permissions and limitations
' under the License.
'
'*************************************************************************
'*
'* short description : Tools to ease working with web functionality
'*
'\******************************************************************************
function hSetProxies( HTTP_Server as string, HTTP_Port as string, _
FTP_Server as string, FTP_Port as string, _
NoProxyFor as string ) as integer
use "global\tools\includes\optional\t_control_objects.inc"
'///
Configure proxy settings via Tools/Options Internet page
'///Starting point is a plain document of any type
'///If all fields are empty The proxy will be set to "None"
'///Input:
'///
'///+- HTTP Server name (string)
'///
'///+- As name, e.g. myProxy.com (FQDN recommended)
'///+- As IP, e.g. 192.168.1.254
'///+- Non optional parameter which may be an empty string
'///+- Requires HTTP Server port to be set
'///
'///+- HTTP Server port
'///
'///+- e.g. 8080, 3128
'///+- Non optional parameter which may be an empty string
'///
'///+- FTP Server name (string)
'///
'///+- As name, e.g. myProxy.com (FQDN recommended)
'///+- As IP, e.g. 192.168.1.254
'///+- Non optional parameter which may be an empty string
'///+- Requires FTP Server port to be set
'///
'///+- FTP Server port
'///
'///+- e.g. 8080, 3128
'///+- Non optional parameter which may be an empty string
'///
'///+- Exclude domains (string)
'///
'///+- e.g. .Sun.COM;.Germany.Sun.Com;MyServer.Sun.Com
'///+- Non optional parameter which may be an empty string
'///
'///
'///Returns:
'///
'///+- Errorcondition
'///
'///+- 0 = Successfully set/unset proxies
'///+- 1 - 5 = Number of failed actions
'///
'///
'///Description:
'///
const CFN = "hSetProxies::"
dim iControlStatus as integer
dim irc as integer
irc = 0
'///+- Open Tools/Options
ToolsOptions
'///+- Go to the Proxy Settings (Internet/Proxy)
hToolsOptions( "Internet", "Proxy" )
'///+- Select Manual Proxy (3. Item in the list)
ProxyServer.select( 3 )
'///+- Set the new values
'///
'///+- HTTP-Proxy
iControlStatus = hSetControlValue( HTTPProxy , HTTP_Server )
if ( iControlStatus <> 0 ) then
qaerrorlog( CFN & "Failed to set HTTP-Proxy" )
irc = irc + 1
endif
'///+- HTTP-Port
iControlStatus = hSetControlValue( HTTPPort , HTTP_Port )
if ( iControlStatus <> 0 ) then
qaerrorlog( CFN & "Failed to set HTTP-Port" )
irc = irc + 1
endif
'///+- FTP-Proxy
iControlStatus = hSetControlValue( FTPProxy , FTP_Server )
if ( iControlStatus <> 0 ) then
qaerrorlog( CFN & "Failed to set FTP-Proxy" )
irc = irc + 1
endif
'///+- FTP-Port
iControlStatus = hSetControlValue( FTPPort , FTP_Port )
if ( iControlStatus <> 0 ) then
qaerrorlog( CFN & "Failed to set FTP-Port" )
irc = irc + 1
endif
'///+- Exclusion list
iControlStatus = hSetControlValue( NoProxy , NoProxyFor )
if ( iControlStatus <> 0 ) then
qaerrorlog( CFN & "Failed to set exclusion list" )
irc = irc + 1
endif
'///
if ( irc = 0 ) then
printlog( CFN & "Successfully updated proxy configuration" )
endif
'///+- Close Tools/Options
Kontext "ExtrasOptionenDlg"
ExtrasOptionenDlg.OK()
hSetProxies() = irc
'///
end function