Commit a860f128 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[JM-65] Finished up roster viewer/editor support.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8749 b35dd754-fafc-0310-a699-88a17e54d16e
parent 66eb8709
...@@ -220,6 +220,8 @@ ...@@ -220,6 +220,8 @@
## Added key: 'user.roster.item.settings' ## Added key: 'user.roster.item.settings'
## Added key: 'user.roster.add.illegal_jid' ## Added key: 'user.roster.add.illegal_jid'
## Added key: 'user.roster.shared_groups' ## Added key: 'user.roster.shared_groups'
## Added key: 'user.roster.click_view'
## Added key: 'user.roster.cant_delete'
# Openfire # Openfire
...@@ -1912,7 +1914,7 @@ user.properties.registered=Registered ...@@ -1912,7 +1914,7 @@ user.properties.registered=Registered
# User roster Page # User roster Page
user.roster.title=User Roster user.roster.title=User Roster
user.roster.info=Below is the list of roster items for user {0}. user.roster.info=Below is the list of roster items for user {0}. Shared groups are underlined.
user.roster.jid=JID user.roster.jid=JID
user.roster.nickname=Nickname user.roster.nickname=Nickname
user.roster.groups=Groups user.roster.groups=Groups
...@@ -1925,6 +1927,7 @@ user.roster.items_per_page=Items per page ...@@ -1925,6 +1927,7 @@ user.roster.items_per_page=Items per page
user.roster.edit=Edit user.roster.edit=Edit
user.roster.add=Add New Item user.roster.add=Add New Item
user.roster.none_found=No roster items found. user.roster.none_found=No roster items found.
user.roster.click_view=Click to view...
user.roster.deleted=Roster item deleted successfully. user.roster.deleted=Roster item deleted successfully.
user.roster.delete.title=Delete Roster Item user.roster.delete.title=Delete Roster Item
user.roster.delete.delete=Delete Roster Item user.roster.delete.delete=Delete Roster Item
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
</tr> </tr>
<tr> <tr>
<td class="c1"> <td class="c1">
<fmt:message key="user.roster.shared_groups" />: <a href="group-summary.jsp"><fmt:message key="user.roster.shared_groups" /></a>:
</td> </td>
<td> <td>
<% <%
...@@ -139,7 +139,9 @@ ...@@ -139,7 +139,9 @@
if (count != 0) { if (count != 0) {
out.print(","); out.print(",");
} }
out.print("<a href='group-edit.jsp?group="+URLEncoder.encode(group.getName(), "UTF-8")+"'>");
out.print(group.getName()); out.print(group.getName());
out.print("</a>");
count++; count++;
} }
} }
......
<%--
- $Revision$
- $Date$
-
- Copyright (C) 2007 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.
--%>
<%@ page import="org.jivesoftware.util.ParamUtils,
java.net.URLEncoder"
errorPage="error.jsp"
%><%@ page import="org.xmpp.packet.JID"%>
<%@ page import="org.jivesoftware.openfire.roster.Roster" %>
<%@ page import="org.jivesoftware.openfire.roster.RosterItem" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="org.jivesoftware.openfire.group.Group" %>
<%@ page import="java.util.Collection" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
<% // Get parameters
boolean cancel = request.getParameter("cancel") != null;
String username = ParamUtils.getParameter(request, "username");
String jid = ParamUtils.getParameter(request, "jid");
String nickname = ParamUtils.getParameter(request, "nickname");
String groups = ParamUtils.getParameter(request, "groups");
Integer sub = ParamUtils.getIntParameter(request, "sub", 0);
boolean save = ParamUtils.getBooleanParameter(request, "save");
// Handle a cancel
if (cancel) {
response.sendRedirect("user-roster.jsp?username=" + URLEncoder.encode(username, "UTF-8"));
return;
}
// Load the user's roster object
Roster roster = webManager.getRosterManager().getRoster(username);
// Load the roster item from the user's roster.
RosterItem item = roster.getRosterItem(new JID(jid));
// Handle a roster item delete:
if (save) {
List<String> groupList = new ArrayList<String>();
if (groups != null) {
for (String group : groups.split(",")) {
groupList.add(group.trim());
}
}
item.setNickname(nickname);
item.setGroups(groupList);
item.setSubStatus(RosterItem.SubType.getTypeFromInt(sub));
// Delete the roster item
roster.updateRosterItem(item);
// Done, so redirect
response.sendRedirect("user-roster.jsp?username=" + URLEncoder.encode(username, "UTF-8") + "&editsuccess=true");
return;
}
%>
<html>
<head>
<title><fmt:message key="user.roster.edit.title"/></title>
<meta name="subPageID" content="user-roster"/>
<meta name="extraParams" content="<%= "username="+URLEncoder.encode(username, "UTF-8") %>"/>
</head>
<body>
<p>
<fmt:message key="user.roster.edit.info">
<fmt:param value="<%= username %>"/>
</fmt:message>
</p>
<fieldset>
<legend><fmt:message key="user.roster.item.settings" /></legend>
<div>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td class="c1">
<fmt:message key="user.roster.jid" />:
</td>
<td>
<%= jid %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="user.roster.nickname" />:
</td>
<td>
<%= item.getNickname() %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="user.roster.groups" />:
</td>
<td>
<%
List<String> groupList = item.getGroups();
if (!groupList.isEmpty()) {
int count = 0;
for (String group : groupList) {
if (count != 0) {
out.print(",");
}
out.print(group);
count++;
}
}
else {
out.print("<i>None</i>");
}
%>
</td>
</tr>
<tr>
<td class="c1">
<a href="group-summary.jsp"><fmt:message key="user.roster.shared_groups" /></a>:
</td>
<td>
<%
Collection<Group> sharedGroups = item.getSharedGroups();
if (!sharedGroups.isEmpty()) {
int count = 0;
for (Group group : sharedGroups) {
if (count != 0) {
out.print(",");
}
out.print("<a href='group-edit.jsp?group="+URLEncoder.encode(group.getName(), "UTF-8")+"'>");
out.print(group.getName());
out.print("</a>");
count++;
}
}
else {
out.print("<i>None</i>");
}
%>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="user.roster.subscription" />:
</td>
<td>
<%= item.getSubStatus().getName() %>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br><br>
<form style="display: inline" action="user-roster-edit.jsp">
<input type="hidden" name="jid" value="<%= jid %>">
<input type="hidden" name="username" value="<%= username %>">
<input type="submit" value="<fmt:message key="user.roster.edit" />">
</form>
<form style="display: inline" action="user-roster-delete.jsp">
<input type="hidden" name="jid" value="<%= jid %>">
<input type="hidden" name="username" value="<%= username %>">
<input type="submit" value="<fmt:message key="global.delete" />">
</form>
</body>
</html>
\ No newline at end of file
...@@ -242,7 +242,9 @@ ...@@ -242,7 +242,9 @@
<%= i %> <%= i %>
</td> </td>
<td> <td>
<%= rosterItem.getJid() %> <a href="user-roster-view.jsp?username=<%= URLEncoder.encode(username, "UTF-8") %>&jid=<%= URLEncoder.encode(rosterItem.getJid().toString(), "UTF-8") %>"
title="<fmt:message key="user.roster.click_view" />"
><%= rosterItem.getJid() %></a>
</td> </td>
<td> <td>
<%= (rosterItem.getNickname() != null ? rosterItem.getNickname() : "<i>None</i>") %> <%= (rosterItem.getNickname() != null ? rosterItem.getNickname() : "<i>None</i>") %>
...@@ -266,7 +268,7 @@ ...@@ -266,7 +268,7 @@
if (count != 0) { if (count != 0) {
out.print(", "); out.print(", ");
} }
out.print("<i>"+group.getName()+"</i>"); out.print("<u>"+group.getName()+"</u>");
count++; count++;
} }
} }
......
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