Commit 5190e1d8 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Added ability to set display name of group in roster and to configure if the...

Added ability to set display name of group in roster and to configure if the group should be considered a shared group in members' rosters. JM-109


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@839 b35dd754-fafc-0310-a699-88a17e54d16e
parent 12ec829b
......@@ -38,6 +38,8 @@ errorPage="error.jsp"%>
boolean cancel = request.getParameter("cancel") != null;
String name = ParamUtils.getParameter(request, "name");
String description = ParamUtils.getParameter(request, "description");
boolean showInRoster = ParamUtils.getBooleanParameter(request, "show", false);
String displayName = ParamUtils.getParameter(request, "display");
String users = ParamUtils.getParameter(request, "users", true);
// Handle a cancel
if (cancel) {
......@@ -50,6 +52,9 @@ errorPage="error.jsp"%>
if (name == null) {
errors.put("name", "");
}
if (showInRoster && (displayName == null || displayName.length() == 0)) {
errors.put("display", "");
}
// do a create if there were no errors
if (errors.size() == 0) {
try {
......@@ -57,6 +62,14 @@ errorPage="error.jsp"%>
if (description != null) {
newGroup.setDescription(description);
}
if (showInRoster) {
newGroup.getProperties().put("showInRoster", "true");
newGroup.getProperties().put("displayName", displayName);
}
else {
newGroup.getProperties().put("showInRoster", "false");
newGroup.getProperties().put("displayName", "");
}
if(users.length() > 0){
StringTokenizer tokenizer = new StringTokenizer(users, ",");
......@@ -162,6 +175,29 @@ errorPage="error.jsp"%>
<span class="jive-error-text"> Invalid description. </span>
<%
}
%>
</td>
</tr>
<tr>
<td width="1%" nowrap>
<label for="gshow">Show group in group members' rosters:</label>
</td>
<td width="99%">
<input type="checkbox" name="show" value="true" id="gshow"/>
</td>
</tr>
<tr>
<td nowrap width="1%">
<label for="gdisplay">Display name in roster:</label>
</td>
<td nowrap class="c1" align="left">
<input type="text" size="40" name="display" id="gdisplay"/>
<%
if (errors.get("display") != null) {
%>
<span class="jive-error-text"> Please enter a display name. </span>
<%
}
%>
</td>
</tr>
......
......@@ -14,6 +14,7 @@ import="java.text.DateFormat,
org.jivesoftware.stringprep.Stringprep"%>
<!-- Define Administration Bean -->
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"/>
<jsp:useBean id="errors" class="java.util.HashMap"/>
<%
webManager.init(pageContext);
%>
......@@ -30,6 +31,8 @@ import="java.text.DateFormat,
boolean edit = ParamUtils.getBooleanParameter(request, "edit", false);
String newName = ParamUtils.getParameter(request, "newName");
String newDescription = ParamUtils.getParameter(request, "newDescription");
boolean newShowInRoster = ParamUtils.getBooleanParameter(request, "newShow", false);
String newDisplayName = ParamUtils.getParameter(request, "newDisplay");
boolean groupInfoChanged = ParamUtils.getBooleanParameter(request, "groupChanged", false);
Group group = groupManager.getGroup(groupName);
......@@ -38,13 +41,30 @@ import="java.text.DateFormat,
if (newName != null && newName.length() > 0) {
group.setName(newName);
group.setDescription(newDescription);
groupName = newName;
groupInfoChanged = true;
// Get admin list and compare it the admin posted list.
response.sendRedirect("group-edit.jsp?group=" + URLEncoder.encode(groupName, "UTF-8") + "&groupChanged=true");
return;
if (newShowInRoster && (newDisplayName == null || newDisplayName.length() == 0)) {
errors.put("display", "");
}
if (errors.isEmpty()) {
group.setName(newName);
group.setDescription(newDescription);
if (newShowInRoster) {
group.getProperties().put("showInRoster", "true");
group.getProperties().put("displayName", newDisplayName);
}
else {
group.getProperties().put("showInRoster", "false");
group.getProperties().put("displayName", "");
}
groupName = newName;
groupInfoChanged = true;
// Get admin list and compare it the admin posted list.
response.sendRedirect("group-edit.jsp?group=" + URLEncoder.encode(groupName, "UTF-8") + "&groupChanged=true");
return;
}
else {
// Continue editing since there are some errors
edit = true;
}
}
......@@ -219,7 +239,7 @@ import="java.text.DateFormat,
Description:
</td>
<% if(!edit) { %>
<td colspan="3">
<td colspan="2">
<%= ((group.getDescription() != null) ? group.getDescription() : "<i>No Description</i>") %>
</td>
<% } else { %>
......@@ -230,6 +250,47 @@ import="java.text.DateFormat,
<% } %>
</tr>
<tr>
<td width="1%" nowrap>
Show group in group members' rosters:
</td>
<% boolean showInRoster = "true".equals(group.getProperties().get("showInRoster"));
if(!edit) { %>
<td colspan="2">
<%= (showInRoster ? "Enabled" : "Disabled") %>
</td>
<% } else { %>
<td>
<input type="checkbox" name="newShow" value="true" <%= (showInRoster ? "checked" : "") %>/>
</td>
<% } %>
</tr>
<tr>
<td width="1%" nowrap>
Display name in roster:
</td>
<% String displayName = (group.getProperties().get("displayName") == null ? "" : group.getProperties().get("displayName"));
if(!edit) { %>
<td colspan="2">
<%= displayName %>
</td>
<% } else { %>
<td>
<input type="text" size="40" name="newDisplay" value="<%= displayName %>"/>
<%
if (errors.get("display") != null) {
%>
<span class="jive-error-text"> Please enter a display name. </span>
<%
}
%>
</td>
<% } %>
</tr>
<% if(edit) { %>
<tr>
<td colspan="3">
......
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