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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<%--
- $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.util.*,
java.util.*,
org.jivesoftware.messenger.*,
java.util.Date,
org.jivesoftware.admin.*,
java.text.DateFormat,
org.xmpp.packet.JID"
errorPage="error.jsp"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<% admin.init(request, response, session, application, out ); %>
<% // Get parameters
int start = ParamUtils.getIntParameter(request,"start",0);
int range = ParamUtils.getIntParameter(request,"range",15);
boolean close = ParamUtils.getBooleanParameter(request,"close");
String jid = ParamUtils.getParameter(request,"jid");
// Get the user manager
SessionManager sessionManager = admin.getSessionManager();
// Get the session count
int sessionCount = sessionManager.getSessionCount();
// Close a connection if requested
if (close) {
JID address = new JID(jid);
try {
Session sess = sessionManager.getSession(address);
sess.getConnection().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;
%>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<% // Title of this page and breadcrumbs
String title = LocaleUtils.getLocalizedString("session.summary.title");
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "session-summary.jsp"));
pageinfo.setPageID("session-summary");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<% if ("success".equals(request.getParameter("close"))) { %>
<p class="jive-success-text">
<fmt:message key="session.summary.close" />
</p>
<% } %>
<fmt:message key="session.summary.active" />: <b><%= sessionCount %></b>
<% if (numPages > 1) { %>
- <fmt:message key="session.summary.showing" /> <%= (start+1) %>-<%= (start+range) %>
<% } %>
</p>
<% if (numPages > 1) { %>
<p>
<fmt:message key="session.summary.page" />:
[
<% for (int i=0; i<numPages; i++) {
String sep = ((i+1)<numPages) ? " " : "";
boolean isCurrent = (i+1) == curPage;
%>
<a href="session-summary.jsp?start=<%= (i*range) %>"
class="<%= ((isCurrent) ? "jive-current" : "") %>"
><%= (i+1) %></a><%= sep %>
<% } %>
]
</p>
<% } %>
<p>
<fmt:message key="session.summary.info" />
</p>
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th> </th>
<th nowrap><fmt:message key="session.details.name" /></th>
<th nowrap><fmt:message key="session.details.resource" /></th>
<th nowrap colspan="2"><fmt:message key="session.details.status" /></th>
<th nowrap colspan="2"><fmt:message key="session.details.presence" /></th>
<th nowrap><fmt:message key="session.details.clientip" /></th>
<th nowrap><fmt:message key="session.details.close_connect" /></th>
</tr>
</thead>
<tbody>
<% // Get the iterator of sessions, print out session info if any exist.
SessionResultFilter filter = new SessionResultFilter();
filter.setStartIndex(start);
filter.setNumResults(range);
Collection<ClientSession> sessions = sessionManager.getSessions(filter);
if (sessions.isEmpty()) {
%>
<tr>
<td colspan="9">
<fmt:message key="session.summary.not_session" />
</td>
</tr>
<% } %>
<% 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" %>
<% } %>
</tbody>
</table>
</div>
<% if (numPages > 1) { %>
<p>
<fmt:message key="session.summary.page" />:
[
<% for (int i=0; i<numPages; i++) {
String sep = ((i+1)<numPages) ? " " : "";
boolean isCurrent = (i+1) == curPage;
%>
<a href="session-summary.jsp?start=<%= (i*range) %>"
class="<%= ((isCurrent) ? "jive-current" : "") %>"
><%= (i+1) %></a><%= sep %>
<% } %>
]
</p>
<% } %>
<br>
<p>
<fmt:message key="session.summary.last_update" />: <%= JiveGlobals.formatDateTime(new Date()) %>
</p>
<jsp:include page="bottom.jsp" flush="true" />