<%-- - $Revision$ - $Date$ - - Copyright (C) 2004-2005 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. --%> <%@ page import="org.jivesoftware.openfire.SessionManager, org.jivesoftware.openfire.SessionResultFilter, org.jivesoftware.openfire.session.ClientSession, org.jivesoftware.util.JiveGlobals, org.jivesoftware.util.ParamUtils, java.util.Collection" errorPage="error.jsp" %> <%@ page import="java.util.Date" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <%! static final String NONE = LocaleUtils.getLocalizedString("global.none"); final int DEFAULT_RANGE = 15; final int[] RANGE_PRESETS = {15, 25, 50, 75, 100}; static final int[] REFRESHES = {0, 10, 30, 60, 90}; static final String[] REFRESHES_LABELS = {NONE,"10","30","60","90"}; %> <% webManager.init(request, response, session, application, out ); %> <% // Get parameters int start = ParamUtils.getIntParameter(request,"start",0); int range = ParamUtils.getIntParameter(request,"range",webManager.getRowsPerPage("session-summary", DEFAULT_RANGE)); int refresh = ParamUtils.getIntParameter(request,"refresh",webManager.getRefreshValue("session-summary", 0)); boolean close = ParamUtils.getBooleanParameter(request,"close"); int order = ParamUtils.getIntParameter(request, "order", webManager.getPageProperty("session-summary", "console.order", SessionResultFilter.ASCENDING)); String jid = ParamUtils.getParameter(request,"jid"); if (request.getParameter("range") != null) { webManager.setRowsPerPage("session-summary", range); } if (request.getParameter("refresh") != null) { webManager.setRefreshValue("session-summary", refresh); } if (request.getParameter("order") != null) { webManager.setPageProperty("session-summary", "console.order", order); } // Get the user manager SessionManager sessionManager = webManager.getSessionManager(); // Get the session count int sessionCount = sessionManager.getUserSessionsCount(false); // Close a connection if requested if (close) { JID address = new JID(jid); try { Session sess = sessionManager.getSession(address); sess.close(); // wait one second Thread.sleep(1000L); } catch (Exception ignored) { // Session might have disappeared on its own } // Redirect back to this page response.sendRedirect("session-summary.jsp?close=success"); return; } // paginator vars int numPages = (int)Math.ceil((double)sessionCount/(double)range); int curPage = (start/range) + 1; %> <fmt:message key="session.summary.title"/> <% if ("success".equals(request.getParameter("close"))) { %>

<% } %> <% if (refresh > 0) { %> <% } %>
: <%= sessionCount %> <% if (numPages > 1) { %> -- <%= (start+1) %>-<%= (start+range) %> <% } %> <% if (numPages > 1) { %>

: [ <% for (int i=0; i " ><%= (i+1) %><%= sep %> <% } %> ] <% } %> -- :

: ()

<% // Get the iterator of sessions, print out session info if any exist. SessionResultFilter filter = SessionResultFilter.createDefaultSessionFilter(); filter.setSortOrder(order); filter.setStartIndex(start); filter.setNumResults(range); Collection sessions = sessionManager.getSessions(filter); %>
<% if (sessions.isEmpty()) { %> <% } %> <% int count = start; boolean current = false; // needed in session-row.jspf String linkURL = "session-details.jsp"; for (ClientSession sess : sessions) { count++; %> <%@ include file="session-row.jspf" %> <% } %>
  <% if (filter.getSortField() == SessionResultFilter.SORT_USER) { if (filter.getSortOrder() == SessionResultFilter.DESCENDING) { %>
<% } else { %>
<% } } else { %> <% } %>
<% if (numPages > 1) { %>

: [ <% for (int i=0; i " ><%= (i+1) %><%= sep %> <% } %> ]

<% } %>

: <%= JiveGlobals.formatDateTime(new Date()) %>