Commit 593c73cc authored by Bill Lynch's avatar Bill Lynch Committed by bill

Fix for saving service name


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@417 b35dd754-fafc-0310-a699-88a17e54d16e
parent f1ad0c94
...@@ -27,21 +27,9 @@ ...@@ -27,21 +27,9 @@
<c:set var="admin" value="${admin.manager}" /> <c:set var="admin" value="${admin.manager}" />
<% admin.init(request, response, session, application, out ); %> <% admin.init(request, response, session, application, out ); %>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<% // Title of this page and breadcrumbs
String title = "Group Chat Properties";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "muc-server-props-edit-form.jsp"));
pageinfo.setPageID("muc-server-props");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<% // Get parameters <% // Get parameters
boolean save = ParamUtils.getBooleanParameter(request,"save"); boolean save = request.getParameter("save") != null;
boolean success = false; boolean success = request.getParameter("success") != null;
String name = ParamUtils.getParameter(request,"servername"); String name = ParamUtils.getParameter(request,"servername");
String muc = ParamUtils.getParameter(request,"mucname"); String muc = ParamUtils.getParameter(request,"mucname");
...@@ -49,14 +37,15 @@ ...@@ -49,14 +37,15 @@
Map errors = new HashMap(); Map errors = new HashMap();
if (save) { if (save) {
// do validation // do validation
System.err.println("muc: " + muc);
if (muc == null || muc.indexOf('.') >= 0) { if (muc == null || muc.indexOf('.') >= 0) {
errors.put("mucname","mucname"); errors.put("mucname","mucname");
} }
if (errors.size() == 0) { if (errors.size() == 0) {
admin.getMultiUserChatServer().setServiceName(muc); admin.getMultiUserChatServer().setServiceName(muc);
success = true; response.sendRedirect("muc-server-props-edit-form.jsp?success=true");
return;
} }
name = admin.getServerInfo().getName() == null ? "" : admin.getServerInfo().getName();
} }
else { else {
name = admin.getServerInfo().getName() == null ? "" : admin.getServerInfo().getName(); name = admin.getServerInfo().getName() == null ? "" : admin.getServerInfo().getName();
...@@ -67,17 +56,52 @@ ...@@ -67,17 +56,52 @@
muc = muc.substring(0, index); muc = muc.substring(0, index);
} }
} }
%>
name = admin.getServerInfo().getName();
if (errors.size() == 0) {
muc = admin.getMultiUserChatServer().getServiceName();
int pos = muc.lastIndexOf("." + name);
muc = muc.substring(0, pos);
}
%>
<br> <jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<% // Title of this page and breadcrumbs
String title = "Group Chat Properties";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "muc-server-props-edit-form.jsp"));
pageinfo.setPageID("muc-server-props");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<% if (success) { %> <% if (success) { %>
<p class="jive-success-text"> <div class="jive-success">
Server properties edited successfully. You must restart the server in order for <table cellpadding="0" cellspacing="0" border="0">
the changes to take effect (see <a href="server-status.jsp">Server Status</a>). <tbody>
</p> <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 edited successfully. You must <b>restart</b> the server in order for
the changes to take effect.
</td></tr>
</tbody>
</table>
</div><br>
<% } else if (errors.size() > 0) { %>
<div class="jive-error">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr><td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">
Error setting the service name.
</td></tr>
</tbody>
</table>
</div><br>
<% } %> <% } %>
...@@ -88,9 +112,9 @@ Use the form below to edit group chat service settings. ...@@ -88,9 +112,9 @@ Use the form below to edit group chat service settings.
<input type="hidden" name="save" value="true"> <input type="hidden" name="save" value="true">
<div > <div>
<table class="jive-table" cellpadding="3" cellspacing="1" border="0"> <table class="jive-table" cellpadding="3" cellspacing="1" border="0">
<form action="muc-server-props-edit-form.jsp"> <form action="muc-server-props-edit-form.jsp" method="post">
<tr> <tr>
<td class="c1"> <td class="c1">
Server name: Server name:
...@@ -104,12 +128,12 @@ Use the form below to edit group chat service settings. ...@@ -104,12 +128,12 @@ Use the form below to edit group chat service settings.
Group chat service name: Group chat service name:
</td> </td>
<td> <td>
<input type="text" size="30" maxlength="150" name="mucname" value="<%= muc %>">.<%=name%> <input type="text" size="30" maxlength="150" name="mucname" value="<%= (muc != null ? muc : "") %>">.<%=name%>
<% if (errors.get("mucname") != null) { %> <% if (errors.get("mucname") != null) { %>
<span class="jive-error-text"> <span class="jive-error-text">
Please enter a valid name. <br>Please enter a valid name.
</span> </span>
<% } %> <% } %>
...@@ -120,7 +144,7 @@ Use the form below to edit group chat service settings. ...@@ -120,7 +144,7 @@ Use the form below to edit group chat service settings.
<br> <br>
<input type="submit" value="Save Properties"> <input type="submit" name="save" value="Save Properties">
<input type="submit" name="cancel" value="Cancel"> <input type="submit" name="cancel" value="Cancel">
</form> </form>
......
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