1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: webtools.inc,v $
13 '* last change: $Author: jsk $ $Date: 2008-06-20 08:03:54 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/******************************************************************************
34 '* owner : joerg.skottke@sun.com
36 '* short description : Tools to ease working with web functionality
38 '\******************************************************************************
40 function hSetProxies( HTTP_Server as string, HTTP_Port as string, _
41 FTP_Server as string, FTP_Port as string, _
42 NoProxyFor as string ) as integer
44 use "global\tools\includes\optional\t_control_objects.inc"
46 '///<h3>Configure proxy settings via Tools/Options Internet page</h3>
47 '///<i>Starting point is a plain document of any type</i><br>
48 '///<i>If all fields are empty The proxy will be set to "None"</i><br>
51 '///+<li>HTTP Server name (string)</li>
53 '///+<li>As name, e.g. myProxy.com (FQDN recommended)</li>
54 '///+<li>As IP, e.g. 192.168.1.254</li>
55 '///+<li>Non optional parameter which may be an empty string</li>
56 '///+<li>Requires HTTP Server port to be set</li>
58 '///+<li>HTTP Server port</li>
60 '///+<li>e.g. 8080, 3128</li>
61 '///+<li>Non optional parameter which may be an empty string</li>
63 '///+<li>FTP Server name (string)</li>
65 '///+<li>As name, e.g. myProxy.com (FQDN recommended)</li>
66 '///+<li>As IP, e.g. 192.168.1.254</li>
67 '///+<li>Non optional parameter which may be an empty string</li>
68 '///+<li>Requires FTP Server port to be set</li>
70 '///+<li>FTP Server port</li>
72 '///+<li>e.g. 8080, 3128</li>
73 '///+<li>Non optional parameter which may be an empty string</li>
75 '///+<li>Exclude domains (string)</li>
77 '///+<li>e.g. .Sun.COM;.Germany.Sun.Com;MyServer.Sun.Com</li>
78 '///+<li>Non optional parameter which may be an empty string</li>
83 '///+<li>Errorcondition</li>
85 '///+<li>0 = Successfully set/unset proxies</li>
86 '///+<li>1 - 5 = Number of failed actions</li>
89 '///<u>Description</u>:
92 const CFN = "hSetProxies::"
93 dim iControlStatus as integer
97 '///+<li>Open Tools/Options</li>
100 '///+<li>Go to the Proxy Settings (Internet/Proxy)</li>
101 hToolsOptions( "Internet", "Proxy" )
103 '///+<li>Select Manual Proxy (3. Item in the list)</li>
104 ProxyServer.select( 3 )
106 '///+<li>Set the new values</li>
109 '///+<li>HTTP-Proxy</li>
110 iControlStatus = hSetControlValue( HTTPProxy , HTTP_Server )
111 if ( iControlStatus <> 0 ) then
112 qaerrorlog( CFN & "Failed to set HTTP-Proxy" )
116 '///+<li>HTTP-Port</li>
117 iControlStatus = hSetControlValue( HTTPPort , HTTP_Port )
118 if ( iControlStatus <> 0 ) then
119 qaerrorlog( CFN & "Failed to set HTTP-Port" )
123 '///+<li>FTP-Proxy</li>
124 iControlStatus = hSetControlValue( FTPProxy , FTP_Server )
125 if ( iControlStatus <> 0 ) then
126 qaerrorlog( CFN & "Failed to set FTP-Proxy" )
130 '///+<li>FTP-Port</li>
131 iControlStatus = hSetControlValue( FTPPort , FTP_Port )
132 if ( iControlStatus <> 0 ) then
133 qaerrorlog( CFN & "Failed to set FTP-Port" )
137 '///+<li>Exclusion list</li>
138 iControlStatus = hSetControlValue( NoProxy , NoProxyFor )
139 if ( iControlStatus <> 0 ) then
140 qaerrorlog( CFN & "Failed to set exclusion list" )
146 printlog( CFN & "Successfully updated proxy configuration" )
149 '///+<li>Close Tools/Options</li>
150 Kontext "ExtrasOptionenDlg"
151 ExtrasOptionenDlg.OK()