Commit bd06fdaa authored by Derek DeMoro's avatar Derek DeMoro Committed by derek

Group Edit Admin


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@806 b35dd754-fafc-0310-a699-88a17e54d16e
parent dc032158
......@@ -22,7 +22,8 @@ import ="org.jivesoftware.util.*,
java.io.PrintStream,
org.dom4j.xpath.DefaultXPath,
org.dom4j.*,
org.jivesoftware.messenger.group.*"
org.jivesoftware.messenger.group.*,
java.net.URLEncoder"
errorPage="error.jsp"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"/>
......@@ -35,7 +36,7 @@ errorPage="error.jsp"%>
boolean cancel = request.getParameter("cancel") != null;
String name = ParamUtils.getParameter(request, "name");
String description = ParamUtils.getParameter(request, "description");
String users = ParamUtils.getParameter(request, "users");
String users = ParamUtils.getParameter(request, "users", true);
// Handle a cancel
if (cancel) {
response.sendRedirect("group-summary.jsp");
......@@ -54,6 +55,8 @@ errorPage="error.jsp"%>
if (description != null) {
newGroup.setDescription(description);
}
if(users.length() > 0){
String hostName = webManager.getXMPPServer().getServerInfo().getName();
StringTokenizer tokenizer = new StringTokenizer(users, ",");
while (tokenizer.hasMoreTokens()) {
......@@ -64,8 +67,9 @@ errorPage="error.jsp"%>
}
newGroup.getMembers().add(address);
}
}
// Successful, so redirect
response.sendRedirect("group-properties.jsp?success=true&group=" + newGroup.getName());
response.sendRedirect("group-properties.jsp?success=true&group=" + URLEncoder.encode(newGroup.getName(), "UTF-8"));
return;
}
catch (GroupAlreadyExistsException e) {
......
......@@ -6,7 +6,9 @@ import="java.text.DateFormat,
org.jivesoftware.admin.*,
org.xmpp.packet.JID,
org.jivesoftware.messenger.group.GroupManager,
org.jivesoftware.messenger.group.Group"%>
org.jivesoftware.messenger.group.Group,
java.net.URLEncoder,
java.net.URLDecoder"%>
<!-- Define Administration Bean -->
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"/>
<%
......@@ -22,7 +24,18 @@ import="java.text.DateFormat,
String [] deleteMembers = ParamUtils.getParameters(request, "delete");
String groupName = ParamUtils.getParameter(request, "group");
GroupManager groupManager = webManager.getGroupManager();
boolean edit = ParamUtils.getBooleanParameter(request, "edit", false);
String newName = ParamUtils.getParameter(request, "newName");
Group group = groupManager.getGroup(groupName);
boolean nameChanged = false;
if(newName != null && newName.length() > 0){
group.setName(newName);
groupName = newName;
nameChanged = true;
}
if (update) {
Set adminIDSet = new HashSet();
for (int i = 0; i < adminIDs.length; i++) {
......@@ -50,7 +63,7 @@ import="java.text.DateFormat,
group.getMembers().add(m);
}
// Get admin list and compare it the admin posted list.
response.sendRedirect("group-edit-form.jsp?group=" + groupName + "&updatesuccess=true");
response.sendRedirect("group-edit.jsp?group=" + URLEncoder.encode(groupName, "UTF-8") + "&updatesuccess=true");
return;
}
else if (add && users != null) {
......@@ -67,7 +80,7 @@ import="java.text.DateFormat,
group.getMembers().add(address);
}
}
response.sendRedirect("group-edit-form.jsp?group=" + groupName + "&success=true");
response.sendRedirect("group-edit.jsp?group=" + URLEncoder.encode(groupName, "UTF-8") + "&success=true");
return;
}
else if (delete) {
......@@ -76,7 +89,7 @@ import="java.text.DateFormat,
group.getMembers().remove(member);
group.getAdmins().remove(member);
}
response.sendRedirect("group-edit-form.jsp?group=" + groupName + "&deletesuccess=true");
response.sendRedirect("group-edit.jsp?group=" + URLEncoder.encode(groupName, "UTF-8") + "&deletesuccess=true");
return;
}
DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM);
......@@ -86,9 +99,9 @@ import="java.text.DateFormat,
String title = "Edit Group";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "group-edit-form.jsp"));
pageinfo.setPageID("group-edit");
pageinfo.setExtraParams("group=" + groupName);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "group-edit.jsp"));
pageinfo.setPageID("group-summary");
pageinfo.setExtraParams("group="+groupName);
%>
<jsp:include page="top.jsp" flush="true"/>
<jsp:include page="title.jsp" flush="true"/>
......@@ -103,6 +116,15 @@ import="java.text.DateFormat,
Below is a summary of properties for the group as well as admins and members. Use the forms on the page to add
members and optionally designate them as groups administrators.
</p>
<%
if (nameChanged){
%>
<p class="jive-success-text">
Name has been changed successfully.
</p>
<%
}
%>
<%
if ("true".equals(request.getParameter("success"))) {
%>
......@@ -128,30 +150,43 @@ import="java.text.DateFormat,
%>
<fieldset>
<legend>
User Group Summary
</legend>
Group Summary
</legend><form name="ff" action="group-edit.jsp">
<input type="hidden" name="group" value="<%= groupName %>"/>
<table cellpadding="3" cellspacing="1" border="0">
<tr>
<td class="c1">
<td width="1%">
Name:
</td>
<td class="c2">
<td align=left nowrap width="1%">
<b><%= group.getName() %></b>
</td>
</tr>
<% if(!edit) { %>
<td>
<a href="group-edit.jsp?edit=true&group=<%= URLEncoder.encode(groupName, "UTF-8") %>">
<img src="images/edit-16x16.gif" border="0">
</a>
</td>
<% }else { %>
<td>
New Name:<input type="text" name="newName"><input type="submit" value="Change">
</td>
<% } %>
<tr>
<td class="c1">
<td width="1%">
Description:
</td>
<td class="c2">
<td colspan="3">
<%= ((group.getDescription() != null) ? group.getDescription() : "No Description") %>
</td>
</tr>
</table>
</fieldset>
</fieldset> </form>
<br>
<form action="group-edit-form.jsp" method="post" name="f">
<form action="group-edit.jsp" method="post" name="f">
<input type="hidden" name="group" value="<%= groupName %>">
<input type="hidden" name="add" value="Add"/>
<table cellpadding="3" cellspacing="1" border="0">
......@@ -173,7 +208,7 @@ import="java.text.DateFormat,
</table>
</form>
<form action="group-edit-form.jsp" method="post" name="main">
<form action="group-edit.jsp" method="post" name="main">
<input type="hidden" name="group" value="<%= groupName %>">
<table class="jive-table" cellpadding="3" cellspacing="0" border="0" width="600">
<tr>
......
......@@ -16,7 +16,8 @@
org.jivesoftware.admin.*,
org.jivesoftware.messenger.*,
org.jivesoftware.messenger.group.Group,
org.jivesoftware.messenger.group.GroupNotFoundException"
org.jivesoftware.messenger.group.GroupNotFoundException,
java.net.URLEncoder"
errorPage="error.jsp"
%>
......@@ -37,7 +38,7 @@
// Handle a delete
if (delete) {
response.sendRedirect("group-delete.jsp?group=" + groupName);
response.sendRedirect("group-delete.jsp?group=" + URLEncoder.encode(groupName, "UTF-8"));
return;
}
......@@ -61,7 +62,7 @@
String title = "Group Properties";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "group-properties.jsp?group="+groupName));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "group-properties.jsp?group="+URLEncoder.encode(groupName)));
pageinfo.setSubPageID("group-properties");
pageinfo.setExtraParams("group="+groupName);
%>
......@@ -140,8 +141,8 @@ Below is a summary of the group. To edit properties, click the "Edit" button bel
<br><br>
<form action="group-edit-form.jsp">
<input type="hidden" name="group" value="<%= group.getName() %>">
<form action="group-edit.jsp">
<input type="hidden" name="group" value="<%= URLEncoder.encode(group.getName(), "UTF-8") %>">
<input type="submit" value="Edit Properties">
</form>
......
......@@ -14,7 +14,9 @@
java.util.*,
java.text.DateFormat,
org.jivesoftware.admin.*,
org.jivesoftware.messenger.group.*"
org.jivesoftware.messenger.group.*,
java.net.URLDecoder,
java.net.URLEncoder"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
......@@ -120,6 +122,7 @@ Total Groups: <%= webManager.getGroupManager().getGroupCount() %>,
}
int i = start;
for (Group group : groups) {
String groupName = URLEncoder.encode(group.getName(), "UTF-8");
i++;
%>
<tr class="jive-<%= (((i%2)==0) ? "even" : "odd") %>">
......@@ -127,7 +130,7 @@ Total Groups: <%= webManager.getGroupManager().getGroupCount() %>,
<%= i %>
</td>
<td width="60%">
<a href="group-properties.jsp?group=<%= group.getName() %>"><%= group.getName() %></a>
<a href="group-edit.jsp?group=<%= groupName %>"><%= group.getName() %></a>
<% if (group.getDescription() != null) { %>
<br>
<span class="jive-description">
......@@ -142,12 +145,12 @@ Total Groups: <%= webManager.getGroupManager().getGroupCount() %>,
<%= group.getAdmins().size() %>
</td>
<td width="1%" align="center">
<a href="group-edit-form.jsp?group=<%= group.getName() %>"
<a href="group-edit.jsp?group=<%= groupName %>"
title="Click to edit..."
><img src="images/edit-16x16.gif" width="17" height="17" border="0"></a>
</td>
<td width="1%" align="center" style="border-right:1px #ccc solid;">
<a href="group-delete.jsp?group=<%= group.getName() %>"
<a href="group-delete.jsp?group=<%= groupName %>"
title="Click to delete..."
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td>
......
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