Commit 71d8614f authored by Matt Tucker's avatar Matt Tucker Committed by matt

Added sorting of sessions (JM-633).

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3738 b35dd754-fafc-0310-a699-88a17e54d16e
parent 4ca9a0a2
......@@ -301,7 +301,7 @@ public class WebManager extends WebBean {
setPageProperty(pageName, "console.refresh", newValue);
}
private int getPageProperty(String pageName, String property, int defaultValue) {
public int getPageProperty(String pageName, String property, int defaultValue) {
User user = getUser();
if (user != null) {
String values = user.getProperties().get(property);
......
......@@ -35,6 +35,8 @@
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) {
......@@ -45,6 +47,10 @@
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();
......@@ -153,12 +159,52 @@
</table>
<br>
<% // 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<ClientSession> sessions = sessionManager.getSessions(filter);
%>
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th>&nbsp;</th>
<th nowrap><fmt:message key="session.details.name" /></th>
<th nowrap>
<%
if (filter.getSortField() == SessionResultFilter.SORT_USER) {
if (filter.getSortOrder() == SessionResultFilter.DESCENDING) {
%>
<table border="0"><tr valign="middle"><th>
<a href="session-summary.jsp?order=<%=SessionResultFilter.ASCENDING %>">
<fmt:message key="session.details.name" /></a>
</th><th>
<a href="session-summary.jsp?order=<%=SessionResultFilter.ASCENDING %>">
<img src="images/sort_descending.gif" border="0" width="16" height="16" alt=""></a>
</th></tr></table></div>
<%
}
else {
%>
<table border="0"><tr valign="middle"><th>
<a href="session-summary.jsp?order=<%=SessionResultFilter.DESCENDING %>">
<fmt:message key="session.details.name" /></a>
</th><th>
<a href="session-summary.jsp?order=<%=SessionResultFilter.DESCENDING %>">
<img src="images/sort_ascending.gif" width="16" height="16" border="0" alt=""></a>
</th></tr></table></div>
<%
}
}
else {
%>
<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>
......@@ -167,11 +213,7 @@
</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>
......
......@@ -286,6 +286,14 @@ PRE, TT {
font-size : 8pt;
font-weight : bold;
}
.jive-table TH TABLE TH {
border-right : none;
border-bottom : none;
}
.jive-table TH TABLE TH a {
text-decoration : none;
color: #000;
}
.jive-table TR TD {
border-bottom : 1px #ccc solid;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment