user-properties.jsp 6.29 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.*,
Matt Tucker's avatar
Matt Tucker committed
17
                 org.jivesoftware.messenger.*"
Bill Lynch's avatar
Bill Lynch committed
18
    errorPage="error.jsp"
Matt Tucker's avatar
Matt Tucker committed
19 20
%>

Bill Lynch's avatar
Bill Lynch committed
21
<%@ taglib uri="core" prefix="c"%>
Matt Tucker's avatar
Matt Tucker committed
22

Bill Lynch's avatar
Bill Lynch committed
23
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
Matt Tucker's avatar
Matt Tucker committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

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

    // Handle an email
    if (email) {
46
        response.sendRedirect("user-email.jsp?username=" + username);
Matt Tucker's avatar
Matt Tucker committed
47 48 49 50 51
        return;
    }

    // Handle an email
    if (password) {
52
        response.sendRedirect("user-password.jsp?username=" + username);
Matt Tucker's avatar
Matt Tucker committed
53 54 55 56 57 58
        return;
    }

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

Bill Lynch's avatar
Bill Lynch committed
65
    PresenceManager presenceManager = webManager.getPresenceManager();
Matt Tucker's avatar
Matt Tucker committed
66 67 68 69

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

Derek DeMoro's avatar
Derek DeMoro committed
71 72 73 74
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%  // Title of this page and breadcrumbs
    String title = "User Properties";
    pageinfo.setTitle(title);
Bill Lynch's avatar
Bill Lynch committed
75
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
Derek DeMoro's avatar
Derek DeMoro committed
76 77 78 79
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "user-properties.jsp"));
    pageinfo.setSubPageID("user-properties");
    pageinfo.setExtraParams("username="+username);
%>
Bill Lynch's avatar
Bill Lynch committed
80
<jsp:include page="top.jsp" flush="true" />
Derek DeMoro's avatar
Derek DeMoro committed
81
<jsp:include page="title.jsp" flush="true" />
Matt Tucker's avatar
Matt Tucker committed
82

Bill Lynch's avatar
Bill Lynch committed
83 84 85 86
<p>
Below is a summary of user properties. To edit properties, click the "Edit" button below.
</p>

Bill Lynch's avatar
Bill Lynch committed
87 88 89 90 91 92 93 94 95 96 97 98 99
<%  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">
        New user created successfully.
        </td></tr>
    </tbody>
    </table>
    </div><br>

Bill Lynch's avatar
Bill Lynch committed
100 101 102 103 104 105 106 107 108 109 110 111 112
<%  } 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">
        User properties updated successfully.
        </td></tr>
    </tbody>
    </table>
    </div><br>

Bill Lynch's avatar
Bill Lynch committed
113 114
<%  } %>

Bill Lynch's avatar
Bill Lynch committed
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
    <tr>
        <th colspan="2">
            User Properties
        </th>
    </tr>
</thead>
<tbody>
    <tr>
        <td class="c1">
            Username:
        </td>
        <td>
            <%= user.getUsername() %>
        </td>
    </tr>
    <tr>
        <td class="c1">
            Status:
        </td>
        <td>
            <%  if (presenceManager.isAvailable(user)) {
                    Presence presence = presenceManager.getPresence(user);
            %>
                <% if (presence.getShow() == Presence.SHOW_NONE) { %>
                    <img src="images/user-green-16x16.gif" width="16" height="16" border="0" alt="Available">
                    Available
                <% } %>
                <% if (presence.getShow() == Presence.SHOW_CHAT) { %>
                    <img src="images/user-green-16x16.gif" width="16" height="16" border="0" alt="Available to Chat">
                    Available to Chat
                <% } %>
                <% if (presence.getShow() == Presence.SHOW_AWAY) { %>
                    <img src="images/user-yellow-16x16.gif" width="16" height="16" border="0" alt="Away">
                    Away
                <% } %>
                <% if (presence.getShow() == Presence.SHOW_XA) { %>
                    <img src="images/user-yellow-16x16.gif" width="16" height="16" border="0" alt="Extended Away">
                    Extended Away
                <% } %>
                <% if (presence.getShow() == Presence.SHOW_DND) { %>
                    <img src="images/user-red-16x16.gif" width="16" height="16" border="0" alt="Do not Disturb">
                    Do not Disturb
                <% } %>

            <%  } else { %>

                <img src="images/user-clear-16x16.gif" width="16" height="16" border="0" alt="Offline">
                (Offline)

            <%  } %>
        </td>
    </tr>
    <tr>
        <td class="c1">
            Name:
        </td>
        <td>
            <%  if (user.getInfo().getName() == null || "".equals(user.getInfo().getName())) { %>

                <span style="color:#999">
                <i>Not set.</i>
                </span>

            <%  } else { %>

                <%= user.getInfo().getName() %>

            <%  } %>
        </td>
    </tr>
    <tr>
        <td class="c1">
            Email:
        </td>
        <td>
193 194
            <a href="mailto:<%= user.getInfo().getEmail() %>"><%= user.getInfo().getEmail() %></a>
            &nbsp;
Bill Lynch's avatar
Bill Lynch committed
195 196 197 198 199 200 201 202 203 204 205
        </td>
    </tr>
    <tr>
        <td class="c1">
            Registered:
        </td>
        <td>
            <%= formatter.format(user.getInfo().getCreationDate()) %>
        </td>
    </tr>
</tbody>
Matt Tucker's avatar
Matt Tucker committed
206 207 208
</table>
</div>

Bill Lynch's avatar
Bill Lynch committed
209
<br><br>
Matt Tucker's avatar
Matt Tucker committed
210

Bill Lynch's avatar
Bill Lynch committed
211 212
<form action="user-edit-form.jsp">
<input type="hidden" name="username" value="<%= user.getUsername() %>">
Bill Lynch's avatar
Bill Lynch committed
213
<input type="submit" value="Edit Properties">
Matt Tucker's avatar
Matt Tucker committed
214 215
</form>

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