session-filter.jsp 3.93 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4 5 6 7 8
<%--
  -	$RCSfile$
  -	$Revision$
  -	$Date$
--%>

<%@ page import="org.jivesoftware.util.*,
                 org.jivesoftware.messenger.SessionManager,
Matt Tucker's avatar
Matt Tucker committed
9
                 java.util.*,
Matt Tucker's avatar
Matt Tucker committed
10 11 12
                 org.jivesoftware.messenger.Session" %>

<%@ include file="global.jsp" %>
13
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
Matt Tucker's avatar
Matt Tucker committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
<%  // Check to see if the server is down.
    if (xmppServer == null) {
        response.sendRedirect("error-serverdown.jsp");
        return;
    }
%>

<%  // Get parameters
    boolean doFilter = ParamUtils.getBooleanParameter(request, "doFilter");
    boolean choose = ParamUtils.getBooleanParameter(request,"choose");
    boolean remove = ParamUtils.getBooleanParameter(request, "remove");
    String username = ParamUtils.getParameter(request, "username");
    String usernameTF = ParamUtils.getParameter(request, "usernameTF");
    String usernameSEL = ParamUtils.getParameter(request, "usernameSEL");
    if (username == null) {
        if (choose) {
            username = usernameSEL;
        }
        else {
            username = usernameTF;
        }
    }

    boolean errors = false;
    if (doFilter) {
        if (username == null) {
            errors = true;
        }
        else {
            // Set the username in the session, return to the session summary page:
            session.setAttribute("messenger.admin.session-summary.username",username);
            response.sendRedirect("session-summary.jsp");
            return;
        }
    }

    if (remove) {
        // Remove the filtered username from the session:
        session.removeAttribute("messenger.admin.session-summary.username");
        response.sendRedirect("session-summary.jsp");
        return;
    }
%>

Bill Lynch's avatar
Bill Lynch committed
58
<jsp:include page="header.jsp" flush="true" />
Matt Tucker's avatar
Matt Tucker committed
59 60

<%  // Title of this page and breadcrumbs
61
    String title = LocaleUtils.getLocalizedString("session.filter.title");
Matt Tucker's avatar
Matt Tucker committed
62
    String[][] breadcrumbs = {
Bill Lynch's avatar
Bill Lynch committed
63
        {"Home", "index.jsp"},
Matt Tucker's avatar
Matt Tucker committed
64 65 66 67
        {"Session Summary", "session-summary.jsp"},
        {title, "session-filter.jsp"}
    };
%>
Bill Lynch's avatar
Bill Lynch committed
68
<jsp:include page="title.jsp" flush="true" />
Matt Tucker's avatar
Matt Tucker committed
69 70

<p>
71
<fmt:message key="session.filter.info" />
Matt Tucker's avatar
Matt Tucker committed
72 73 74 75 76
</p>

<%  if (errors) { %>

    <p class="jive-error-text">
77
    <fmt:message key="session.filter.enter_username" />
Matt Tucker's avatar
Matt Tucker committed
78 79 80 81 82 83 84 85 86 87 88 89 90
    </p>

<%  } %>

<form action="session-filter.jsp" name="filterform">
<input type="hidden" name="doFilter" value="true">

<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr valign="top">
    <td width="1%" nowrap align="center">
        <input type="radio" name="choose" value="false">
    </td>
    <td width="1%" nowrap>
91
        <fmt:message key="session.filter.specify_username" />
Matt Tucker's avatar
Matt Tucker committed
92 93 94 95 96 97 98 99 100 101 102 103
    </td>
    <td width="98%">
        <input type="text" name="usernameTF" size="30" maxlength="100"
         value="<%= ((username != null) ? username : "") %>"
         onfocus="this.form.choose[0].checked=true;">
    </td>
</tr>
<tr valign="top">
    <td width="1%" nowrap align="center">
        <input type="radio" name="choose" value="true">
    </td>
    <td width="1%" nowrap>
104
        <fmt:message key="session.filter.choose_user" />
Matt Tucker's avatar
Matt Tucker committed
105 106 107
    </td>
    <td width="98%">
        <select size="1" name="usernameSEL" onfocus="this.form.choose[1].checked=true;">
Matt Tucker's avatar
Matt Tucker committed
108 109 110
            <%
                Collection<User> users = userManager.getUsers();
                for (User user: users) {
Matt Tucker's avatar
Matt Tucker committed
111 112 113 114 115 116 117 118 119 120 121 122
            %>
                <option value="<%= user.getUsername() %>"><%= user.getUsername() %></option>

            <%  } %>
        </select>
    </td>
</tr>
</table>

<br>

<input type="submit" value="Save and Return">
123
<input type="submit" value="<fmt:message key="global.cancel" />" onclick="location.href='session-summary.jsp';">
Matt Tucker's avatar
Matt Tucker committed
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142

</form>

<script language="JavaScript" type="text/javascript">
<%  if (!doFilter) { %>

    document.filterform.usernameTF.focus();

<%  } else { %>

    <%  if (usernameSEL == null) { %>

        document.filterform.usernameTF.focus();

    <%  } %>

<%  } %>
</script>

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