1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
'encoding UTF-8 Do not remove or change this line!
'**************************************************************************
' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'
' Copyright 2000, 2010 Oracle and/or its affiliates.
'
' OpenOffice.org - a multi-platform office productivity suite
'
' This file is part of OpenOffice.org.
'
' OpenOffice.org is free software: you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License version 3
' only, as published by the Free Software Foundation.
'
' OpenOffice.org is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU Lesser General Public License version 3 for more details
' (a copy is included in the LICENSE file that accompanied this code).
'
' You should have received a copy of the GNU Lesser General Public License
' version 3 along with OpenOffice.org. If not, see
' <http://www.openoffice.org/license.html>
' for a copy of the LGPLv3 License.
'
'/******************************************************************************
'*
'* owner : joerg.skottke@oracle.com
'*
'* 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"
'///<h3>Configure proxy settings via Tools/Options Internet page</h3>
'///<i>Starting point is a plain document of any type</i><br>
'///<i>If all fields are empty The proxy will be set to "None"</i><br>
'///<u>Input</u>:
'///<ol>
'///+<li>HTTP Server name (string)</li>
'///<ul>
'///+<li>As name, e.g. myProxy.com (FQDN recommended)</li>
'///+<li>As IP, e.g. 192.168.1.254</li>
'///+<li>Non optional parameter which may be an empty string</li>
'///+<li>Requires HTTP Server port to be set</li>
'///</ul>
'///+<li>HTTP Server port</li>
'///<ul>
'///+<li>e.g. 8080, 3128</li>
'///+<li>Non optional parameter which may be an empty string</li>
'///</ul>
'///+<li>FTP Server name (string)</li>
'///<ul>
'///+<li>As name, e.g. myProxy.com (FQDN recommended)</li>
'///+<li>As IP, e.g. 192.168.1.254</li>
'///+<li>Non optional parameter which may be an empty string</li>
'///+<li>Requires FTP Server port to be set</li>
'///</ul>
'///+<li>FTP Server port</li>
'///<ul>
'///+<li>e.g. 8080, 3128</li>
'///+<li>Non optional parameter which may be an empty string</li>
'///</ul>
'///+<li>Exclude domains (string)</li>
'///<ul>
'///+<li>e.g. .Sun.COM;.Germany.Sun.Com;MyServer.Sun.Com</li>
'///+<li>Non optional parameter which may be an empty string</li>
'///</ul>
'///</ol>
'///<u>Returns</u>:
'///<ol>
'///+<li>Errorcondition</li>
'///<ul>
'///+<li>0 = Successfully set/unset proxies</li>
'///+<li>1 - 5 = Number of failed actions</li>
'///</ul>
'///</ol>
'///<u>Description</u>:
'///<ul>
const CFN = "hSetProxies::"
dim iControlStatus as integer
dim irc as integer
irc = 0
'///+<li>Open Tools/Options</li>
ToolsOptions
'///+<li>Go to the Proxy Settings (Internet/Proxy)</li>
hToolsOptions( "Internet", "Proxy" )
'///+<li>Select Manual Proxy (3. Item in the list)</li>
ProxyServer.select( 3 )
'///+<li>Set the new values</li>
'///<ol>
'///+<li>HTTP-Proxy</li>
iControlStatus = hSetControlValue( HTTPProxy , HTTP_Server )
if ( iControlStatus <> 0 ) then
qaerrorlog( CFN & "Failed to set HTTP-Proxy" )
irc = irc + 1
endif
'///+<li>HTTP-Port</li>
iControlStatus = hSetControlValue( HTTPPort , HTTP_Port )
if ( iControlStatus <> 0 ) then
qaerrorlog( CFN & "Failed to set HTTP-Port" )
irc = irc + 1
endif
'///+<li>FTP-Proxy</li>
iControlStatus = hSetControlValue( FTPProxy , FTP_Server )
if ( iControlStatus <> 0 ) then
qaerrorlog( CFN & "Failed to set FTP-Proxy" )
irc = irc + 1
endif
'///+<li>FTP-Port</li>
iControlStatus = hSetControlValue( FTPPort , FTP_Port )
if ( iControlStatus <> 0 ) then
qaerrorlog( CFN & "Failed to set FTP-Port" )
irc = irc + 1
endif
'///+<li>Exclusion list</li>
iControlStatus = hSetControlValue( NoProxy , NoProxyFor )
if ( iControlStatus <> 0 ) then
qaerrorlog( CFN & "Failed to set exclusion list" )
irc = irc + 1
endif
'///</ol>
if ( irc = 0 ) then
printlog( CFN & "Successfully updated proxy configuration" )
endif
'///+<li>Close Tools/Options</li>
Kontext "ExtrasOptionenDlg"
ExtrasOptionenDlg.OK()
hSetProxies() = irc
'///</ul>
end function
|