user-properties.jsp 7.35 KB
Newer Older
Bill Lynch's avatar
Bill Lynch committed
1
<%--
Matt Tucker's avatar
Matt Tucker committed
2 3 4
  -	$RCSfile$
  -	$Revision$
  -	$Date$
Bill Lynch's avatar
Bill Lynch committed
5 6 7 8 9
  -
  - Copyright (C) 2004 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.
Matt Tucker's avatar
Matt Tucker committed
10 11 12 13 14
--%>

<%@ page import="org.jivesoftware.util.*,
                 org.jivesoftware.messenger.user.*,
                 java.text.DateFormat,
Matt Tucker's avatar
Matt Tucker committed
15
                 java.util.*,
Derek DeMoro's avatar
Derek DeMoro committed
16
                 org.jivesoftware.admin.*,
Derek DeMoro's avatar
Derek DeMoro committed
17
                 org.jivesoftware.messenger.*,
18 19
                 org.xmpp.packet.Presence,
                 java.net.URLEncoder"
Bill Lynch's avatar
Bill Lynch committed
20
    errorPage="error.jsp"
Matt Tucker's avatar
Matt Tucker committed
21 22
%>

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

<%  // 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) {
42
        response.sendRedirect("user-delete.jsp?username=" + URLEncoder.encode(username, "UTF-8"));
Matt Tucker's avatar
Matt Tucker committed
43 44 45
        return;
    }

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

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

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

    // Date formatter for dates
    DateFormat formatter = DateFormat.getDateInstance(DateFormat.MEDIUM);
%>
Bill Lynch's avatar
Bill Lynch committed
66

Derek DeMoro's avatar
Derek DeMoro committed
67 68
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%  // Title of this page and breadcrumbs
69
    String title = LocaleUtils.getLocalizedString("user.properties.title");
Derek DeMoro's avatar
Derek DeMoro committed
70
    pageinfo.setTitle(title);
71
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
72 73
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title,
            "user-properties.jsp?username="+URLEncoder.encode(username, "UTF-8")));
Derek DeMoro's avatar
Derek DeMoro committed
74
    pageinfo.setSubPageID("user-properties");
75
    pageinfo.setExtraParams("username="+URLEncoder.encode(username, "UTF-8"));
Derek DeMoro's avatar
Derek DeMoro committed
76
%>
Bill Lynch's avatar
Bill Lynch committed
77
<jsp:include page="top.jsp" flush="true" />
Derek DeMoro's avatar
Derek DeMoro committed
78
<jsp:include page="title.jsp" flush="true" />
Matt Tucker's avatar
Matt Tucker committed
79

Bill Lynch's avatar
Bill Lynch committed
80
<p>
81
<fmt:message key="user.properties.info" />
Bill Lynch's avatar
Bill Lynch committed
82 83
</p>

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

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

Bill Lynch's avatar
Bill Lynch committed
110 111
<%  } %>

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

            <%  } else { %>

161 162
                <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
163 164 165 166 167 168

            <%  } %>
        </td>
    </tr>
    <tr>
        <td class="c1">
169
            <fmt:message key="user.create.name" />:
Bill Lynch's avatar
Bill Lynch committed
170 171
        </td>
        <td>
172
            <%  if ("".equals(user.getName())) { %>
Bill Lynch's avatar
Bill Lynch committed
173
                <span style="color:#999">
174
                <i><fmt:message key="user.properties.not_set" /></i>
Bill Lynch's avatar
Bill Lynch committed
175 176 177
                </span>

            <%  } else { %>
Matt Tucker's avatar
Matt Tucker committed
178
                <%= user.getName() %>
Bill Lynch's avatar
Bill Lynch committed
179 180 181 182 183 184

            <%  } %>
        </td>
    </tr>
    <tr>
        <td class="c1">
185
            <fmt:message key="user.create.email" />:
Bill Lynch's avatar
Bill Lynch committed
186 187
        </td>
        <td>
188 189
            <%  if (user.getEmail() == null) { %>
                <span style="color:#999">
190
                <i><fmt:message key="user.properties.not_set" /></i>
191 192 193 194 195 196
                </span>

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

            <%  } %>
197
            &nbsp;
Bill Lynch's avatar
Bill Lynch committed
198 199 200 201
        </td>
    </tr>
    <tr>
        <td class="c1">
202
            <fmt:message key="user.properties.registered" />:
Bill Lynch's avatar
Bill Lynch committed
203 204
        </td>
        <td>
Matt Tucker's avatar
Matt Tucker committed
205
            <%= formatter.format(user.getCreationDate()) %>
Bill Lynch's avatar
Bill Lynch committed
206 207 208
        </td>
    </tr>
</tbody>
Matt Tucker's avatar
Matt Tucker committed
209 210 211
</table>
</div>

Bill Lynch's avatar
Bill Lynch committed
212
<br><br>
Matt Tucker's avatar
Matt Tucker committed
213

Bill Lynch's avatar
Bill Lynch committed
214 215
<form action="user-edit-form.jsp">
<input type="hidden" name="username" value="<%= user.getUsername() %>">
216
<input type="submit" value="<fmt:message key="global.edit_properties" />">
Matt Tucker's avatar
Matt Tucker committed
217 218
</form>

Bill Lynch's avatar
Bill Lynch committed
219
<jsp:include page="bottom.jsp" flush="true" />