Commit 2797de91 authored by Bill Lynch's avatar Bill Lynch Committed by bill

More dev, fixes


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@287 b35dd754-fafc-0310-a699-88a17e54d16e
parent cf9745ae
......@@ -49,22 +49,6 @@ Below are properties for this server. Click the "Edit Properties" button below t
some of the server settings. Some settings can not be changed.
</p>
<% if ("true".equals(request.getParameter("success"))) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">
Server properties updated successfully. You'll need to restart the server to see
the changes.
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
......@@ -140,32 +124,22 @@ some of the server settings. Some settings can not be changed.
</td>
</tr>
</c:if>
</tbody>
<thead>
<tr>
<th colspan="2">Server Ports</th>
</tr>
</thead>
<tbody>
<% int i=0; %>
<c:forEach var="port" items="${webManager.serverInfo.serverPorts}">
<% i++; %>
<tr>
<td class="c1">
IP and Port:
</td>
<td class="c2">
<c:out value="${port.IPAddress}" />:<c:out value="${port.port}" />
</td>
</tr>
<tr valign="top">
<td class="c1">
Domain Name(s):
<%= i %>: IP:Port, Security:
</td>
<td class="c2">
<c:set var="sep" value="" />
<c:forEach var="name" items="${port.domainNames}">
<c:out value="${sep}" /><c:out value="${name}" />
<c:set var="set" value=", " />
</c:forEach>
</td>
</tr>
<tr>
<td class="c1">
Security Type:
</td>
<td>
<c:out value="${port.IPAddress}" />:<c:out value="${port.port}" />,
<c:choose>
<c:when test="${empty port.securityType}">
NORMAL
......@@ -183,6 +157,18 @@ some of the server settings. Some settings can not be changed.
</c:choose>
</td>
</tr>
<tr valign="top">
<td class="c1">
<nobr>&nbsp;&nbsp;&nbsp; Domain Name(s):</nobr>
</td>
<td class="c2">
<c:set var="sep" value="" />
<c:forEach var="name" items="${port.domainNames}">
<c:out value="${sep}" /><c:out value="${name}" />
<c:set var="set" value=", " />
</c:forEach>
</td>
</tr>
</c:forEach>
</tbody>
<thead>
......@@ -222,7 +208,7 @@ some of the server settings. Some settings can not be changed.
<br>
<form action="server-props.jsp">
<input type="submit" name="edit" value="Edit Properties">
<input type="submit" value="Edit Properties">
</form>
<jsp:include page="bottom.jsp" flush="true" />
\ No newline at end of file
......@@ -14,7 +14,9 @@
org.jivesoftware.messenger.ServerPort,
org.jivesoftware.admin.AdminPageBean,
java.util.*,
org.jivesoftware.messenger.XMPPServer"
org.jivesoftware.messenger.XMPPServer,
java.net.InetAddress,
org.jivesoftware.messenger.JiveGlobals"
%>
<%@ taglib uri="core" prefix="c" %>
......@@ -31,7 +33,12 @@
// Get parameters
String serverName = ParamUtils.getParameter(request,"serverName");
String groupChatName = ParamUtils.getParameter(request,"groupChatName");
int port = ParamUtils.getIntParameter(request,"port",-1);
int sslPort = ParamUtils.getIntParameter(request,"sslPort",-1);
int embeddedPort = ParamUtils.getIntParameter(request,"embeddedPort",-1);
boolean sslEnabled = ParamUtils.getBooleanParameter(request,"sslEnabled");
boolean save = request.getParameter("save") != null;
boolean defaults = request.getParameter("defaults") != null;
boolean cancel = request.getParameter("cancel") != null;
if (cancel) {
......@@ -39,6 +46,16 @@
return;
}
if (defaults) {
serverName = InetAddress.getLocalHost().getHostName();
groupChatName = "conference." + serverName;
port = 5222;
sslPort = 5223;
embeddedPort = 9090;
sslEnabled = true;
save = true;
}
XMPPServer server = admin.getXMPPServer();
Map errors = new HashMap();
if (save) {
......@@ -48,10 +65,28 @@
if (groupChatName == null) {
errors.put("groupChatName","");
}
if (port < 1) {
errors.put("port","");
}
if (sslPort < 1) {
errors.put("sslPort","");
}
if (embeddedPort < 1) {
errors.put("embeddedPort","");
}
if (port > 0 && sslPort > 0) {
if (port == sslPort) {
errors.put("portsEqual","");
}
}
if (errors.size() == 0) {
server.getServerInfo().setName(serverName);
admin.getMultiUserChatServer().setServiceName(groupChatName);
response.sendRedirect("index.jsp?success=true");
JiveGlobals.setProperty("xmpp.socket.plain.port", String.valueOf(port));
JiveGlobals.setProperty("embedded-web.port", String.valueOf(embeddedPort));
JiveGlobals.setProperty("xmpp.socket.ssl.active", String.valueOf(sslEnabled));
JiveGlobals.setProperty("xmpp.socket.ssl.port", String.valueOf(sslPort));
response.sendRedirect("server-props.jsp?success=true");
return;
}
}
......@@ -59,6 +94,10 @@
if (errors.size() == 0) {
serverName = server.getServerInfo().getName();
groupChatName = admin.getMultiUserChatServer().getServiceName();
sslEnabled = "true".equals(JiveGlobals.getProperty("xmpp.socket.ssl.active"));
try { port = Integer.parseInt(JiveGlobals.getProperty("xmpp.socket.plain.port")); } catch (Exception ignored) {}
try { embeddedPort = Integer.parseInt(JiveGlobals.getProperty("embedded-web.port")); } catch (Exception ignored) {}
try { sslPort = Integer.parseInt(JiveGlobals.getProperty("xmpp.socket.ssl.port")); } catch (Exception ignored) {}
}
%>
......@@ -73,11 +112,33 @@
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<style type="text/css">
.c1 {
width : 30%;
}
</style>
<p>
Use the form below to edit server properties.
</p>
<form action="server-props.jsp">
<% if ("true".equals(request.getParameter("success"))) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">
Server properties updated successfully. You'll need to <b>restart</b> the server to have
the changes take effect.
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<form action="server-props.jsp" name="editform" method="post">
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
......@@ -96,6 +157,36 @@ Use the form below to edit server properties.
<td class="c2">
<input type="text" name="serverName" value="<%= (serverName != null) ? serverName : "" %>"
size="30" maxlength="40">
<% if (errors.containsKey("serverName")) { %>
<br>
<span class="jive-error-text">
Please enter a valid server host name or
<a href="#" onclick="document.editform.serverName.value='<%= InetAddress.getLocalHost().getHostName() %>';"
>restore the default</a>.
</span>
<% } %>
</td>
</tr>
<tr>
<td class="c1">
Port:
</td>
<td class="c2">
<input type="text" name="port" value="<%= (port > 0 ? String.valueOf(port) : "") %>"
size="5" maxlength="5">
<% if (errors.containsKey("port")) { %>
<br>
<span class="jive-error-text">
Please enter a valid port number or
<a href="#" onclick="document.editform.port.value='5222';"
>restore the default</a>.
</span>
<% } else if (errors.containsKey("portsEqual")) { %>
<br>
<span class="jive-error-text">
Error -- this port and the SSL port can not be equal.
</span>
<% } %>
</td>
</tr>
<tr>
......@@ -105,6 +196,73 @@ Use the form below to edit server properties.
<td class="c2">
<input type="text" name="groupChatName" value="<%= (groupChatName != null) ? groupChatName : "" %>"
size="30" maxlength="40">
<% if (errors.containsKey("groupChatName")) { %>
<br>
<span class="jive-error-text">
Please enter a valid group chat service name or
<a href="#" onclick="document.editform.groupChatName.value='<%= "conference." + InetAddress.getLocalHost().getHostName() %>';"
>restore the default</a>.
</span>
<% } %>
</td>
</tr>
<tr>
<td class="c1">
SSL Enabled:
</td>
<td class="c2">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td>
<input type="radio" name="sslEnabed" value="true" <%= (sslEnabled ? "checked" : "") %>
id="SSL01">
</td>
<td><label for="SSL01">Enabled</label></td>
</tr>
<tr>
<td>
<input type="radio" name="sslEnabed" value="false" <%= (!sslEnabled ? "checked" : "") %>
id="SSL02">
</td>
<td><label for="SSL02">Disabled</label></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="c1">
SSL Port:
</td>
<td class="c2">
<input type="text" name="sslPort" value="<%= (sslPort > 0 ? String.valueOf(sslPort) : "") %>"
size="5" maxlength="5">
<% if (errors.containsKey("sslPort")) { %>
<br>
<span class="jive-error-text">
Please enter a valid SSL port number or
<a href="#" onclick="document.editform.sslPort.value='5223';"
>restore the default</a>.
</span>
<% } %>
</td>
</tr>
<tr>
<td class="c1">
Embedded Web Server Port:
</td>
<td class="c2">
<input type="text" name="embeddedPort" value="<%= (embeddedPort > 0 ? String.valueOf(embeddedPort) : "") %>"
size="5" maxlength="5">
<% if (errors.containsKey("embeddedPort")) { %>
<br>
<span class="jive-error-text">
Please enter a valid port number or
<a href="#" onclick="document.editform.embeddedPort.value='9090';"
>restore the default</a>.
</span>
<% } %>
</td>
</tr>
</tbody>
......@@ -112,6 +270,7 @@ Use the form below to edit server properties.
<tr>
<td colspan="2">
<input type="submit" name="save" value="Save">
<input type="submit" name="defaults" value="Restore Defaults">
<input type="submit" name="cancel" value="Cancel">
</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment