<%-- - $Revision$ - $Date$ --%> <%@ page import="org.jivesoftware.openfire.session.IncomingServerSession, org.jivesoftware.util.JiveGlobals, java.net.URLEncoder, java.util.Calendar, java.util.Date"%> <%-- - This page is meant to be included in other pages. It assumes 4 variables: - * 'host', the name of the remote server - * 'inSession', an IncomingServerSession object - * 'outSession', an OutgoingServerSession object - * 'count', an int representing the row number we're on. --%> <% // Show the secured icon only if ALL sessions are secure boolean isSecured = true; // Check if all incoming sessions are secured for (org.jivesoftware.openfire.session.IncomingServerSession inSession : inSessions) { if (!inSession.isSecure()) { isSecured = false; break; } } // Check if outgoing session is secured (only if incoming sessions are secured) if (isSecured && outSession != null) { isSecured = outSession.isSecure(); } %> "> <%= count %>
" title=""><%= host %>
<% if (isSecured) { %> <% } else { %> <% } %> <% if (!inSessions.isEmpty() && outSession == null) { %> "> <% } else if (inSessions.isEmpty() && outSession != null) { %> "> <% } else { %> "> <% } %> <% Date creationDate = null; Date lastActiveDate = null; if (!inSessions.isEmpty() && outSession == null) { for (IncomingServerSession inSession : inSessions) { if (creationDate == null || creationDate.after(inSession.getCreationDate())) { // Use the creation date of the oldest incoming session creationDate = inSession.getCreationDate(); } if (lastActiveDate == null || lastActiveDate.before(inSession.getLastActiveDate())) { // Use the last active date of the newest incoming session lastActiveDate = inSession.getLastActiveDate(); } } } else if (inSessions.isEmpty() && outSession != null) { creationDate = outSession.getCreationDate(); lastActiveDate = outSession.getLastActiveDate(); } else { for (IncomingServerSession inSession : inSessions) { if (creationDate == null || creationDate.after(inSession.getCreationDate())) { // Use the creation date of the oldest incoming session creationDate = inSession.getCreationDate(); } if (lastActiveDate == null || lastActiveDate.before(inSession.getLastActiveDate())) { // Use the last active date of the newest incoming session lastActiveDate = inSession.getLastActiveDate(); } } creationDate = creationDate.before(outSession.getCreationDate()) ? creationDate : outSession.getCreationDate(); lastActiveDate = lastActiveDate.after(outSession.getLastActiveDate()) ? lastActiveDate : outSession.getLastActiveDate(); } Calendar creationCal = Calendar.getInstance(); creationCal.setTime(creationDate); 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); %> <%= sameCreationDay ? JiveGlobals.formatTime(creationDate) : JiveGlobals.formatDateTime(creationDate) %> <%= sameActiveDay ? JiveGlobals.formatTime(lastActiveDate) : JiveGlobals.formatDateTime(lastActiveDate) %> &close=true" title="" onclick="return confirm('');" >