user-properties.jsp 7.65 KB
Newer Older
Bill Lynch's avatar
Bill Lynch committed
1
<%--
Matt Tucker's avatar
Matt Tucker committed
2 3
  -	$Revision$
  -	$Date$
Bill Lynch's avatar
Bill Lynch committed
4
  -
5
  - Copyright (C) 2004-2005 Jive Software. All rights reserved.
Bill Lynch's avatar
Bill Lynch committed
6 7 8
  -
  - This software is published under the terms of the GNU Public License (GPL),
  - a copy of which is included in this distribution.
Matt Tucker's avatar
Matt Tucker committed
9 10
--%>

11 12 13 14 15 16
<%@ page import="org.jivesoftware.util.JiveGlobals,
                 org.jivesoftware.util.ParamUtils,
                 org.jivesoftware.wildfire.PresenceManager,
                 org.jivesoftware.wildfire.group.Group,
                 org.jivesoftware.wildfire.user.User,
                 org.jivesoftware.wildfire.user.UserNotFoundException"
Bill Lynch's avatar
Bill Lynch committed
17
    errorPage="error.jsp"
Matt Tucker's avatar
Matt Tucker committed
18
%>
19 20
<%@ page import="org.xmpp.packet.Presence"%>
<%@ page import="java.net.URLEncoder"%>
Matt Tucker's avatar
Matt Tucker committed
21
<%@ page import="java.util.Collection"%>
22
<%@ page import="java.util.Iterator"%>
Matt Tucker's avatar
Matt Tucker committed
23

24
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
25
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
Bill Lynch's avatar
Bill Lynch committed
26
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
Matt Tucker's avatar
Matt Tucker committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42

<%  // Get parameters //
    boolean cancel = request.getParameter("cancel") != null;
    boolean delete = request.getParameter("delete") != null;
    boolean email = request.getParameter("email") != null;
    boolean password = request.getParameter("password") != null;
    String username = ParamUtils.getParameter(request,"username");

    // Handle a cancel
    if (cancel) {
        response.sendRedirect("user-summary.jsp");
        return;
    }

    // Handle a delete
    if (delete) {
43
        response.sendRedirect("user-delete.jsp?username=" + URLEncoder.encode(username, "UTF-8"));
Matt Tucker's avatar
Matt Tucker committed
44 45 46
        return;
    }

47
    // Handle password change
Matt Tucker's avatar
Matt Tucker committed
48
    if (password) {
49
        response.sendRedirect("user-password.jsp?username=" + URLEncoder.encode(username, "UTF-8"));
Matt Tucker's avatar
Matt Tucker committed
50 51 52 53 54 55
        return;
    }

    // Load the user object
    User user = null;
    try {
Derek DeMoro's avatar
Derek DeMoro committed
56
        user = webManager.getUserManager().getUser(username);
Matt Tucker's avatar
Matt Tucker committed
57 58
    }
    catch (UserNotFoundException unfe) {
Derek DeMoro's avatar
Derek DeMoro committed
59
        user = webManager.getUserManager().getUser(username);
Matt Tucker's avatar
Matt Tucker committed
60 61
    }

Bill Lynch's avatar
Bill Lynch committed
62
    PresenceManager presenceManager = webManager.getPresenceManager();
Matt Tucker's avatar
Matt Tucker committed
63
%>
Bill Lynch's avatar
Bill Lynch committed
64

65 66 67 68 69 70 71 72
<html>
    <head>
        <title><fmt:message key="user.properties.title"/></title>
        <meta name="subPageID" content="user-properties"/>
        <meta name="extraParams" content="<%= "username="+URLEncoder.encode(username, "UTF-8") %>"/>
        <meta name="helpPage" content="edit_user_properties.html"/>
    </head>
    <body>
Matt Tucker's avatar
Matt Tucker committed
73

Bill Lynch's avatar
Bill Lynch committed
74
<p>
75
<fmt:message key="user.properties.info" />
Bill Lynch's avatar
Bill Lynch committed
76 77
</p>

Bill Lynch's avatar
Bill Lynch committed
78 79 80 81 82 83 84
<%  if (request.getParameter("success") != null) { %>

    <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">
85
        <fmt:message key="user.properties.created" />
Bill Lynch's avatar
Bill Lynch committed
86 87 88 89 90
        </td></tr>
    </tbody>
    </table>
    </div><br>

Bill Lynch's avatar
Bill Lynch committed
91 92 93 94 95 96 97
<%  } else if (request.getParameter("editsuccess") != null) { %>

    <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">
98
        <fmt:message key="user.properties.update" />
Bill Lynch's avatar
Bill Lynch committed
99 100 101 102 103
        </td></tr>
    </tbody>
    </table>
    </div><br>

Bill Lynch's avatar
Bill Lynch committed
104 105
<%  } %>

Bill Lynch's avatar
Bill Lynch committed
106 107 108 109 110
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
    <tr>
        <th colspan="2">
111
            <fmt:message key="user.properties.title" />
Bill Lynch's avatar
Bill Lynch committed
112 113 114 115 116 117
        </th>
    </tr>
</thead>
<tbody>
    <tr>
        <td class="c1">
118
            <fmt:message key="user.create.username" />:
Bill Lynch's avatar
Bill Lynch committed
119 120 121 122 123 124 125
        </td>
        <td>
            <%= user.getUsername() %>
        </td>
    </tr>
    <tr>
        <td class="c1">
126
            <fmt:message key="session.details.status" />:
Bill Lynch's avatar
Bill Lynch committed
127 128 129 130 131
        </td>
        <td>
            <%  if (presenceManager.isAvailable(user)) {
                    Presence presence = presenceManager.getPresence(user);
            %>
Derek DeMoro's avatar
Derek DeMoro committed
132
                <% if (presence.getShow() == null) { %>
133
                <img src="images/user-green-16x16.gif" width="16" height="16" border="0" title="<fmt:message key="user.properties.available" />" alt="<fmt:message key="user.properties.available" />">
Bill Lynch's avatar
Bill Lynch committed
134
                <% } %>
Derek DeMoro's avatar
Derek DeMoro committed
135
                <% if (presence.getShow() == Presence.Show.chat) { %>
136
                <img src="images/user-green-16x16.gif" width="16" height="16" border="0" title="<fmt:message key="session.details.chat_available" />" alt="<fmt:message key="session.details.chat_available" />">
Bill Lynch's avatar
Bill Lynch committed
137
                <% } %>
Derek DeMoro's avatar
Derek DeMoro committed
138
                <% if (presence.getShow() == Presence.Show.away) { %>
139
                <img src="images/user-yellow-16x16.gif" width="16" height="16" border="0" title="<fmt:message key="session.details.away" />" alt="<fmt:message key="session.details.away" />">
Bill Lynch's avatar
Bill Lynch committed
140
                <% } %>
Derek DeMoro's avatar
Derek DeMoro committed
141
                <% if (presence.getShow() == Presence.Show.xa) { %>
142
                <img src="images/user-yellow-16x16.gif" width="16" height="16" border="0" title="<fmt:message key="session.details.extended" />" alt="<fmt:message key="session.details.extended" />">
Bill Lynch's avatar
Bill Lynch committed
143
                <% } %>
Derek DeMoro's avatar
Derek DeMoro committed
144
                <% if (presence.getShow() == Presence.Show.dnd) { %>
145
                <img src="images/user-red-16x16.gif" width="16" height="16" border="0" title="<fmt:message key="session.details.not_disturb" />" alt="<fmt:message key="session.details.not_disturb" />">
Bill Lynch's avatar
Bill Lynch committed
146 147 148 149
                <% } %>

            <%  } else { %>

150 151
                <img src="images/user-clear-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="user.properties.offline" />">
                (<fmt:message key="user.properties.offline" />)
Bill Lynch's avatar
Bill Lynch committed
152 153 154 155 156 157

            <%  } %>
        </td>
    </tr>
    <tr>
        <td class="c1">
158
            <fmt:message key="user.create.name" />:
Bill Lynch's avatar
Bill Lynch committed
159 160
        </td>
        <td>
161
            <%  if ("".equals(user.getName())) { %>
Bill Lynch's avatar
Bill Lynch committed
162
                <span style="color:#999">
163
                <i><fmt:message key="user.properties.not_set" /></i>
Bill Lynch's avatar
Bill Lynch committed
164 165 166
                </span>

            <%  } else { %>
Matt Tucker's avatar
Matt Tucker committed
167
                <%= user.getName() %>
Bill Lynch's avatar
Bill Lynch committed
168 169 170 171 172 173

            <%  } %>
        </td>
    </tr>
    <tr>
        <td class="c1">
174
            <fmt:message key="user.create.email" />:
Bill Lynch's avatar
Bill Lynch committed
175 176
        </td>
        <td>
177 178
            <%  if (user.getEmail() == null) { %>
                <span style="color:#999">
179
                <i><fmt:message key="user.properties.not_set" /></i>
180 181 182 183 184 185
                </span>

            <%  } else { %>
                <a href="mailto:<%= user.getEmail() %>"><%= user.getEmail() %></a>

            <%  } %>
186
            &nbsp;
Bill Lynch's avatar
Bill Lynch committed
187 188 189 190
        </td>
    </tr>
    <tr>
        <td class="c1">
191
            <fmt:message key="user.properties.registered" />:
Bill Lynch's avatar
Bill Lynch committed
192 193
        </td>
        <td>
Matt Tucker's avatar
Matt Tucker committed
194
            <%= JiveGlobals.formatDate(user.getCreationDate()) %>
Bill Lynch's avatar
Bill Lynch committed
195 196
        </td>
    </tr>
Matt Tucker's avatar
Matt Tucker committed
197 198 199 200 201 202
    <tr>
        <td class="c1">
            Groups:
        </td>
        <td>
            <%
203
                Collection groups = webManager.getGroupManager().getGroups(user);
Matt Tucker's avatar
Matt Tucker committed
204 205 206 207 208 209 210
                if (groups.isEmpty()) {
            %>
                <i>None</i>
            <%
                }
                else {
                    int count = 0;
211 212
                    for (Iterator it=groups.iterator();it.hasNext();) {
                        Group group = (Group) it.next();
Matt Tucker's avatar
Matt Tucker committed
213 214 215 216 217 218 219 220 221 222
                        if (count != 0) {
                            out.print(", ");
                        }
                        out.print(group.getName());
                        count ++;
                    }
                }
            %>
        </td>
    </tr>
Bill Lynch's avatar
Bill Lynch committed
223
</tbody>
Matt Tucker's avatar
Matt Tucker committed
224 225 226
</table>
</div>

Bill Lynch's avatar
Bill Lynch committed
227
<br><br>
Matt Tucker's avatar
Matt Tucker committed
228

Bill Lynch's avatar
Bill Lynch committed
229 230
<form action="user-edit-form.jsp">
<input type="hidden" name="username" value="<%= user.getUsername() %>">
231
<input type="submit" value="<fmt:message key="global.edit_properties" />">
Matt Tucker's avatar
Matt Tucker committed
232 233
</form>

234 235
</body>
</html>