user-search.jsp 2.71 KB
Newer Older
Derek DeMoro's avatar
Derek DeMoro committed
1
<%--
Matt Tucker's avatar
Matt Tucker committed
2 3 4
  -	$Revision$
  -	$Date$
--%>
5

Matt Tucker's avatar
Matt Tucker committed
6
<%@ page import="org.jivesoftware.util.*,
7
                 org.jivesoftware.openfire.user.*,
Matt Tucker's avatar
Matt Tucker committed
8
                 java.util.HashMap,
9 10
                 java.util.Map,
                 java.net.URLEncoder"
11
%><%@ page import="org.xmpp.packet.JID"%>
12 13

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
14
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
Bill Lynch's avatar
Bill Lynch committed
15
<%-- Define Administration Bean --%>
Derek DeMoro's avatar
Derek DeMoro committed
16 17 18
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"/>
<%   webManager.init(request, response, session, application, out ); %>
<%  
Matt Tucker's avatar
Matt Tucker committed
19 20 21
    // Get parameters
    boolean search = ParamUtils.getBooleanParameter(request,"search");
    String username = ParamUtils.getParameter(request,"username");
22
    username = JID.escapeNode(username);
Matt Tucker's avatar
Matt Tucker committed
23 24 25 26 27 28 29 30

    // Handle a cancel
    if (request.getParameter("cancel") != null) {
        response.sendRedirect("user-summary.jsp");
        return;
    }

    // Handle a search execute:
31
    Map<String,String> errors = new HashMap<String,String>();
Matt Tucker's avatar
Matt Tucker committed
32 33 34
    if (search) {
        User user = null;
        try {
Derek DeMoro's avatar
Derek DeMoro committed
35
            user = webManager.getUserManager().getUser(username);
Matt Tucker's avatar
Matt Tucker committed
36
        }
37 38
        catch (Exception e2) {
            errors.put("username","username");
Matt Tucker's avatar
Matt Tucker committed
39 40 41
        }
        if (user != null) {
            // found the user, so redirect to the user properties page:
42 43
            response.sendRedirect("user-properties.jsp?username=" +
                    URLEncoder.encode(user.getUsername(), "UTF-8"));
Matt Tucker's avatar
Matt Tucker committed
44 45 46 47
            return;
        }
    }
%>
Matt Tucker's avatar
Matt Tucker committed
48

49 50 51 52 53 54 55
<html>
    <head>
        <title><fmt:message key="user.search.title"/></title>
        <meta name="pageID" content="user-search"/>
        <meta name="helpPage" content="search_for_a_user.html"/>
    </head>
    <body>
Matt Tucker's avatar
Matt Tucker committed
56

Derek DeMoro's avatar
Derek DeMoro committed
57
<%    if (errors.size() > 0) { %>
58
<p class="jive-error-text"><fmt:message key="user.search.not_found" /></p>
Derek DeMoro's avatar
Derek DeMoro committed
59
<%    } %>
Derek DeMoro's avatar
Derek DeMoro committed
60
<form name="f" action="user-search.jsp">
Derek DeMoro's avatar
Derek DeMoro committed
61 62
  <input type="hidden" name="search" value="true"/>
  <fieldset>
63
    <legend><fmt:message key="user.search.search_user" /></legend>
Derek DeMoro's avatar
Derek DeMoro committed
64 65
    <table cellpadding="3" cellspacing="1" border="0" width="600">
      <tr class="c1">
Bill Lynch's avatar
Bill Lynch committed
66
        <td width="1%" nowrap><fmt:message key="user.create.username" />:</td>
Derek DeMoro's avatar
Derek DeMoro committed
67
        <td class="c2">
Sven Tantau's avatar
Sven Tantau committed
68
          <input type="text" name="username" value="<%= ((username!=null) ? StringUtils.escapeForXML(username) : "") %>" size="30" maxlength="75"/>
Derek DeMoro's avatar
Derek DeMoro committed
69 70
        </td>
      </tr>
71
     <tr><td colspan="2" nowrap><input type="submit" name="search" value="<fmt:message key="user.search.search" />"/><input type="submit" name="cancel" value="<fmt:message key="global.cancel" />"/></td>
Derek DeMoro's avatar
Derek DeMoro committed
72 73 74
     </tr>
    </table>
  </fieldset>
Matt Tucker's avatar
Matt Tucker committed
75 76 77 78
</form>
<script language="JavaScript" type="text/javascript">
document.f.username.focus();
</script>
79 80 81

    </body>
</html>