1
2
3
4
5
6
7
8
9
10
11
12
13
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<%@ page import="org.jivesoftware.messenger.Session,
org.xmpp.packet.Presence,
java.net.URLEncoder,
org.jivesoftware.util.LocaleUtils,
org.jivesoftware.util.JiveGlobals,
java.util.Date,
java.util.Calendar,
javax.swing.*,
java.net.URL"%>
<%--
- $RCSfile$
- $Revision$
- $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.
--%>
<tr class="jive-<%= (((count % 2) == 0) ? "even" : "odd") %>">
<td width="1%" nowrap><%= count %></td>
<td width="47%" nowrap>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<% Object content = null;
try {
content = new URL("http://"+host+"/favicon.ico").openConnection().getContent();
}
catch (Exception e) {}
if (content != null) { %>
<td width="1%" ><img src="http://<%=host%>/favicon.ico" width="16" height="16"></td>
<% } else { %>
<td width="1%" ><img src="images/server_16x16.gif" width="16" height="16"></td>
<% } %>
<td><a href="server-session-details.jsp?hostname=<%= URLEncoder.encode(host, "UTF-8") %>" title="<fmt:message key="session.row.cliked" />"><%= host %></a></td>
</tr>
</table>
</td>
<% if (inSession != null && outSession == null) { %>
<td width="1%">
<img src="images/incoming_32x16.gif" width="32" height="16" border="0" title="<fmt:message key="server.session.connection.incoming" />">
</td>
<td width="10%"><fmt:message key="server.session.connection.incoming" /></td>
<% } else if (inSession == null && outSession != null) { %>
<td width="1%">
<img src="images/outgoing_32x16.gif" width="32" height="16" border="0" title="<fmt:message key="server.session.connection.outgoing" />">
</td>
<td width="10%"><fmt:message key="server.session.connection.outgoing" /></td>
<% } else { %>
<td width="1%">
<img src="images/both_32x16.gif" width="32" height="16" border="0" title="<fmt:message key="server.session.connection.both" />">
</td>
<td width="10%"><fmt:message key="server.session.connection.both" /></td>
<% } %>
<% Date creationDate = null;
Date lastActiveDate = null;
if (inSession != null && outSession == null) {
creationDate = inSession.getCreationDate();
lastActiveDate = inSession.getLastActiveDate();
}
else if (inSession == null && outSession != null) {
creationDate = outSession.getCreationDate();
lastActiveDate = outSession.getLastActiveDate();
}
else {
creationDate = inSession.getCreationDate().before(outSession.getCreationDate()) ? inSession.getCreationDate() : outSession.getCreationDate();
lastActiveDate = inSession.getLastActiveDate().after(outSession.getLastActiveDate()) ? inSession.getLastActiveDate() : 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);
%>
<td align="center" width="20%" nowrap>
<%= sameCreationDay ? JiveGlobals.formatTime(creationDate) : JiveGlobals.formatDateTime(creationDate) %>
</td>
<td align="center" width="20%" nowrap>
<%= sameActiveDay ? JiveGlobals.formatTime(lastActiveDate) : JiveGlobals.formatDateTime(lastActiveDate) %>
</td>
<td width="1%" nowrap align="center" style="border-right:1px #ccc solid;">
<a href="server-session-summary.jsp?hostname=<%= URLEncoder.encode(host, "UTF-8") %>&close=true"
title="<fmt:message key="session.row.cliked_kill_session" />"
onclick="return confirm('<fmt:message key="session.row.confirm_close" />');"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td>
</tr>