<%-- - $RCSfile$ - $Revision$ - $Date$ - - 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. --%> <%@ page import="org.jivesoftware.openfire.SessionManager, org.jivesoftware.openfire.session.ComponentSession, org.jivesoftware.openfire.session.Session, org.jivesoftware.util.JiveGlobals, org.jivesoftware.util.ParamUtils, java.net.URLEncoder" errorPage="error.jsp" %> <%@ page import="java.util.ArrayList"%> <%@ page import="java.util.Calendar"%> <%@ page import="java.util.Collection"%> <%@ 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" %> <%! final int DEFAULT_RANGE = 15; final int[] RANGE_PRESETS = {15, 25, 50, 75, 100}; %> <% admin.init(request, response, session, application, out ); %> <% // Get parameters int start = ParamUtils.getIntParameter(request, "start", 0); int range = ParamUtils .getIntParameter(request, "range", admin.getRowsPerPage("component-session-summary", DEFAULT_RANGE)); boolean close = ParamUtils.getBooleanParameter(request, "close"); String jid = ParamUtils.getParameter(request, "jid"); if (request.getParameter("range") != null) { admin.setRowsPerPage("component-session-summary", range); } // Get the session manager SessionManager sessionManager = admin.getSessionManager(); Collection sessions = sessionManager.getComponentSessions(); // Get the session count int sessionCount = sessions.size(); // Close the external component connection if (close) { try { Session sess = sessionManager.getComponentSession(jid); if (sess != null) { 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("component-session-summary.jsp?close=success"); return; } // paginator vars int numPages = (int) Math.ceil((double) sessionCount / (double) range); int curPage = (start / range) + 1; int maxIndex = (start + range <= sessionCount ? start + range : sessionCount); %> <fmt:message key="component.session.summary.title"/> <% if ("success".equals(request.getParameter("close"))) { %>

<% } %>

: <%= sessions.size() %> <% if (numPages > 1) { %> - <%= (start+1) %>-<%= (start+range) %> <% } %> - :

<% if (numPages > 1) { %>

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

<% } %>

" %>" /> " %>" />

<% // Check if no out/in connection to/from a remote server exists if (sessions.isEmpty()) { %> <% } %> <% int count = 0; sessions = new ArrayList(sessions).subList(start, maxIndex); for (ComponentSession componentSession : sessions) { count++; %> "> <% Date creationDate = componentSession.getCreationDate(); Calendar creationCal = Calendar.getInstance(); creationCal.setTime(creationDate); Date lastActiveDate = componentSession.getLastActiveDate(); Calendar lastActiveCal = Calendar.getInstance(); lastActiveCal.setTime(lastActiveDate); Calendar nowCal = Calendar.getInstance(); boolean sameCreationDay = nowCal.get(Calendar.DAY_OF_YEAR) == creationCal.get(Calendar.DAY_OF_YEAR) && nowCal.get(Calendar.YEAR) == creationCal.get(Calendar.YEAR); boolean sameActiveDay = nowCal.get(Calendar.DAY_OF_YEAR) == lastActiveCal.get(Calendar.DAY_OF_YEAR) && nowCal.get(Calendar.YEAR) == lastActiveCal.get(Calendar.YEAR); %> <% } %>
 
<%= count %> " title=""><%= componentSession.getAddress() %> <%= componentSession.getExternalComponent().getName() %> <%= componentSession.getExternalComponent().getCategory() %> <% if ("gateway".equals(componentSession.getExternalComponent().getCategory())) { if ("msn".equals(componentSession.getExternalComponent().getType())) { %> <% } else if ("aim".equals(componentSession.getExternalComponent().getType())) { %> <% } else if ("yahoo".equals(componentSession.getExternalComponent().getType())) { %> <% } else if ("icq".equals(componentSession.getExternalComponent().getType())) { %> <% } else if ("irc".equals(componentSession.getExternalComponent().getType())) { %> <% } } else if ("component".equals(componentSession.getExternalComponent().getCategory())) { if ("clearspace".equals(componentSession.getExternalComponent().getType().toLowerCase())) { %> <% } } %>
MSNAIMYahoo!ICQIRCClearspace<%= componentSession.getExternalComponent().getType() %>
<%= sameCreationDay ? JiveGlobals.formatTime(creationDate) : JiveGlobals.formatDateTime(creationDate) %> <%= sameActiveDay ? JiveGlobals.formatTime(lastActiveDate) : JiveGlobals.formatDateTime(lastActiveDate) %> &close=true" title="" onclick="return confirm('');" >
<% if (numPages > 1) { %>

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

<% } %>

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