manage-updates.jsp 8.21 KB
Newer Older
Gaston Dombiak's avatar
Gaston Dombiak committed
1 2 3 4 5
<%--
  -	$RCSfile$
  -	$Revision: $
  -	$Date: $
  -
6
  - Copyright (C) 2005-2008 Jive Software. All rights reserved.
Gaston Dombiak's avatar
Gaston Dombiak committed
7
  -
8 9 10 11 12 13 14 15 16 17 18 19
  - Licensed 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.

Gaston Dombiak's avatar
Gaston Dombiak committed
20 21
--%>

22 23
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
Gaston Dombiak's avatar
Gaston Dombiak committed
24 25

<%@ page import="org.jivesoftware.util.ParamUtils,
Sven Tantau's avatar
Sven Tantau committed
26
                 org.jivesoftware.util.StringUtils,
27 28
                 org.jivesoftware.openfire.XMPPServer,
                 org.jivesoftware.openfire.update.UpdateManager,
Gaston Dombiak's avatar
Gaston Dombiak committed
29 30
                 java.util.HashMap,
                 java.util.Map"
31 32
         errorPage="error.jsp"
        %>
Gaston Dombiak's avatar
Gaston Dombiak committed
33

34 35
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"/>
<%  webManager.init(request, response, session, application, out ); %>
Gaston Dombiak's avatar
Gaston Dombiak committed
36 37

<html>
38 39 40 41 42
<head>
<title><fmt:message key="manage-updates.title"/></title>
<meta name="pageID" content="manage-updates"/>
</head>
<body>
Gaston Dombiak's avatar
Gaston Dombiak committed
43 44 45

<%  // Get parameters
    boolean update = request.getParameter("update") != null;
46 47
    boolean serviceEnabled = ParamUtils.getBooleanParameter(request, "serviceEnabled");
    boolean notificationsEnabled = ParamUtils.getBooleanParameter(request, "notificationsEnabled");
48 49 50
    boolean proxyEnabled = ParamUtils.getBooleanParameter(request,"proxyEnabled");
    String proxyHost = ParamUtils.getParameter(request,"proxyHost");
    int proxyPort = ParamUtils.getIntParameter(request,"proxyPort", -1);
Gaston Dombiak's avatar
Gaston Dombiak committed
51 52 53 54 55 56 57
    boolean updateSucess = false;

    UpdateManager updateManager = XMPPServer.getInstance().getUpdateManager();

    // Update the session kick policy if requested
    Map<String, String> errors = new HashMap<String, String>();
    if (update) {
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77

        // Validate params
        if (proxyEnabled) {
            if (proxyHost == null || proxyHost.trim().length() == 0) {
                errors.put("proxyHost","");
            }
            if (proxyPort <= 0) {
                errors.put("proxyPort","");
            }
        }
        else {
            proxyHost = null;
            proxyPort = -1;
        }
        // If no errors, continue:
        if (errors.isEmpty()) {
            updateManager.setServiceEnabled(serviceEnabled);
            updateManager.setNotificationEnabled(notificationsEnabled);
            updateManager.setProxyHost(proxyHost);
            updateManager.setProxyPort(proxyPort);
78 79
            // Log the event
            webManager.logEvent("edited managed updates settings", "enabeld = "+serviceEnabled+"\nnotificationsenabled = "+notificationsEnabled+"\nproxyhost = "+proxyHost+"\nproxypost = "+proxyPort);
80 81
            updateSucess = true;
        }
Gaston Dombiak's avatar
Gaston Dombiak committed
82 83 84 85 86 87
    }

    // Set page vars
    if (errors.size() == 0) {
        serviceEnabled = updateManager.isServiceEnabled();
        notificationsEnabled = updateManager.isNotificationEnabled();
88 89 90
        proxyEnabled = updateManager.isUsingProxy();
        proxyHost = updateManager.getProxyHost();
        proxyPort = updateManager.getProxyPort();
Gaston Dombiak's avatar
Gaston Dombiak committed
91 92 93 94 95 96 97 98 99 100 101
    }
    else {
    }
%>

<p>
<fmt:message key="manage-updates.info"/>
</p>

<%  if (!errors.isEmpty()) { %>

102 103 104 105
    <div class="jive-error">
    <table cellpadding="0" cellspacing="0" border="0">
    <tbody>
        <tr>
106
            <td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0" alt=""/></td>
107 108 109 110 111 112 113 114 115 116 117
            <td class="jive-icon-label">

                <% if (errors.get("proxyHost") != null) { %>
                <fmt:message key="manage-updates.proxy.valid.host" />
                <% } else if (errors.get("proxyPort") != null) { %>
                <fmt:message key="manage-updates.proxy.valid.port" />
                <% } %>
            </td>
        </tr>
    </tbody>
    </table>
118
    </div><br>
Gaston Dombiak's avatar
Gaston Dombiak committed
119

120 121
<%  }
else if (updateSucess) { %>
Gaston Dombiak's avatar
Gaston Dombiak committed
122

123 124
    <div class="success">
        <fmt:message key="manage-updates.config.updated"/>
Gaston Dombiak's avatar
Gaston Dombiak committed
125 126 127 128 129
    </div><br>

<%  } %>


130

131 132 133 134 135 136 137 138 139 140 141 142
<!-- BEGIN manage updates settings -->
<form action="manage-updates.jsp" method="post">
	<!--<div class="jive-contentBoxHeader">

	</div>-->
	<div class="jive-contentBox" style="-moz-border-radius: 3px;">

		<h4><fmt:message key="manage-updates.enabled.legend"/></h4>
		<table cellpadding="3" cellspacing="0" border="0">
		<tbody>
			<tr valign="middle">
				<td width="1%" nowrap>
Matt Tucker's avatar
Matt Tucker committed
143 144
					<input type="radio" name="serviceEnabled" value="true" id="rb02"
					<%= (serviceEnabled ? "checked" : "") %>>
145 146
				</td>
				<td width="99%">
Matt Tucker's avatar
Matt Tucker committed
147 148
					<label for="rb02">
					<b><fmt:message key="manage-updates.label_enable"/></b> - <fmt:message key="manage-updates.label_enable_info"/>
149 150 151
					</label>
				</td>
			</tr>
Matt Tucker's avatar
Matt Tucker committed
152
            <tr valign="middle">
153
				<td width="1%" nowrap>
Matt Tucker's avatar
Matt Tucker committed
154 155
					<input type="radio" name="serviceEnabled" value="false" id="rb01"
					<%= (!serviceEnabled ? "checked" : "") %>>
156 157
				</td>
				<td width="99%">
Matt Tucker's avatar
Matt Tucker committed
158 159
					<label for="rb01">
					<b><fmt:message key="manage-updates.label_disable"/></b> - <fmt:message key="manage-updates.label_disable_info"/>
160 161 162 163 164 165 166 167 168 169 170 171 172 173
					</label>
				</td>
			</tr>
		</tbody>
		</table>

		<br/>
		<br/>

		<h4><fmt:message key="manage-updates.notif.enabled.legend"/></h4>
		<table cellpadding="3" cellspacing="0" border="0">
		<tbody>
			<tr valign="middle">
				<td width="1%" nowrap>
Matt Tucker's avatar
Matt Tucker committed
174 175
					<input type="radio" name="notificationsEnabled" value="true" id="rb04"
					<%= (notificationsEnabled ? "checked" : "") %>>
176 177
				</td>
				<td width="99%">
Matt Tucker's avatar
Matt Tucker committed
178 179
					<label for="rb04">
					<b><fmt:message key="manage-updates.notif.label_enable"/></b> - <fmt:message key="manage-updates.notif.label_enable_info"/>
180 181 182
					</label>
				</td>
			</tr>
Matt Tucker's avatar
Matt Tucker committed
183
            <tr valign="middle">
184
				<td width="1%" nowrap>
Matt Tucker's avatar
Matt Tucker committed
185 186
					<input type="radio" name="notificationsEnabled" value="false" id="rb03"
					<%= (!notificationsEnabled ? "checked" : "") %>>
187 188
				</td>
				<td width="99%">
Matt Tucker's avatar
Matt Tucker committed
189 190
					<label for="rb03">
					<b><fmt:message key="manage-updates.notif.label_disable"/></b> - <fmt:message key="manage-updates.notif.label_disable_info"/>
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
					</label>
				</td>
			</tr>
		</tbody>
		</table>

		<br/>
		<br/>

		<h4><fmt:message key="manage-updates.proxy.enabled.legend"/></h4>
		<table cellpadding="3" cellspacing="0" border="0">
		<tbody>
			<tr valign="middle">
				<td width="1%" nowrap>
					<input type="radio" name="proxyEnabled" value="false" id="rb05"
					<%= (!proxyEnabled ? "checked" : "") %>>
				</td>
				<td width="99%">
					<label for="rb05">
					<b><fmt:message key="manage-updates.proxy.label_disable"/></b> - <fmt:message key="manage-updates.proxy.label_disable_info"/>
					</label>
				</td>
			</tr>
			<tr valign="middle">
				<td width="1%" nowrap>
					<input type="radio" name="proxyEnabled" value="true" id="rb06"
					<%= (proxyEnabled ? "checked" : "") %>>
				</td>
				<td width="99%">
					<label for="rb06">
					<b><fmt:message key="manage-updates.proxy.label_enable"/></b> - <fmt:message key="manage-updates.proxy.label_enable_info"/>
					</label>
				</td>
			</tr>
			<tr valign="top">
				<td width="1%" nowrap>
					&nbsp;
				</td>
				<td width="99%">
					<table cellpadding="3" cellspacing="0" border="0">
						<tr valign="top">
							<td width="1%" nowrap align="right" class="c1">
								<fmt:message key="manage-updates.proxy.host" />
							</td>
							<td width="99%">
								<input type="text" size="15" maxlength="70" name="proxyHost"
Sven Tantau's avatar
Sven Tantau committed
237
								 value="<%= ((proxyHost != null) ? StringUtils.escapeForXML(proxyHost) : "") %>">
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
							</td>
						</tr>
						<tr valign="top">
							<td width="1%" align="right" nowrap class="c1">
								<fmt:message key="manage-updates.proxy.port" />
							</td>
							<td width="99%">
								<input type="text" size="10" maxlength="50" name="proxyPort"
								 value="<%= ((proxyPort > 0) ? proxyPort : "") %>">
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</tbody>
		</table>
	</div>
Ryan Graham's avatar
Ryan Graham committed
255
<input type="submit" name="update" value="<fmt:message key="global.save_settings" />">
256
</form>
257
<!-- END manage updates settings -->
258

Gaston Dombiak's avatar
Gaston Dombiak committed
259 260 261

</body>
</html>