%--
- $RCSfile$
- $Revision: $
- $Date: $
-
- Copyright (C) 2006 Jive Software. All rights reserved.
-
- This software is published under the terms of the GNU Public License (GPL),
- a copy of which is included in this distribution.
--%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<%@ page import="org.jivesoftware.util.ParamUtils,
org.jivesoftware.openfire.XMPPServer,
org.jivesoftware.openfire.update.UpdateManager,
java.util.HashMap,
java.util.Map"
errorPage="error.jsp"
%>
<% // Get parameters
boolean update = request.getParameter("update") != null;
boolean notificationUpdate = request.getParameter("notificationUpdate") != null;
boolean serviceEnabled = ParamUtils.getBooleanParameter(request, "serviceEnabled");
boolean notificationsEnabled = ParamUtils.getBooleanParameter(request, "notificationsEnabled");
boolean proxyEnabled = ParamUtils.getBooleanParameter(request,"proxyEnabled");
String proxyHost = ParamUtils.getParameter(request,"proxyHost");
int proxyPort = ParamUtils.getIntParameter(request,"proxyPort", -1);
boolean updateSucess = false;
UpdateManager updateManager = XMPPServer.getInstance().getUpdateManager();
// Update the session kick policy if requested
Map errors = new HashMap();
if (update) {
// 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);
updateSucess = true;
}
}
// Set page vars
if (errors.size() == 0) {
serviceEnabled = updateManager.isServiceEnabled();
notificationsEnabled = updateManager.isNotificationEnabled();
proxyEnabled = updateManager.isUsingProxy();
proxyHost = updateManager.getProxyHost();
proxyPort = updateManager.getProxyPort();
}
else {
}
%>
<% if (!errors.isEmpty()) { %>
 |
<% if (errors.get("proxyHost") != null) { %>
<% } else if (errors.get("proxyPort") != null) { %>
<% } %>
|
<% }
else if (updateSucess) { %>
<% } %>