%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2004-2008 Jive Software. All rights reserved.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--%>
<%@ page import="org.jivesoftware.util.*,
java.util.*,
org.jivesoftware.openfire.group.*,
java.net.URLEncoder"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<% webManager.init(request, response, session, application, out ); %>
<% // Get parameters
int start = ParamUtils.getIntParameter(request,"start",0);
int range = ParamUtils.getIntParameter(request,"range",webManager.getRowsPerPage("group-summary", 15));
if (request.getParameter("range") != null) {
webManager.setRowsPerPage("group-summary", range);
}
int groupCount = webManager.getGroupManager().getGroupCount();
Collection groups = webManager.getGroupManager().getGroups(start, range);
String search = null;
if (webManager.getGroupManager().isSearchSupported() && request.getParameter("search") != null
&& !request.getParameter("search").trim().equals(""))
{
search = request.getParameter("search");
// Santize variables to prevent vulnerabilities
search = StringUtils.escapeHTMLTags(search);
// Use the search terms to get the list of groups and group count.
groups = webManager.getGroupManager().search(search, start, range);
// Get the count as a search for *all* groups. That will let us do pagination even
// though it's a bummer to execute the search twice.
groupCount = webManager.getGroupManager().search(search).size();
}
// paginator vars
int numPages = (int)Math.ceil((double)groupCount/(double)range);
int curPage = (start/range) + 1;
%>
<% if (request.getParameter("deletesuccess") != null) { %>
<% } %>
<% if (webManager.getGroupManager().isSearchSupported()) { %>
<% }
// Otherwise, searching is not supported.
else {
%>
<%= groupCount %>
<% if (numPages > 1) { %>
, <%= (start+1) %>-<%= (start+range) %>
<% } %>
<% } %>
<% if (numPages > 1) { %>
[
<% for (int i=0; i
"
class="<%= ((isCurrent) ? "jive-current" : "") %>"
><%= (i+1) %><%= sep %>
<% } %>
]
<% } %>
| |
|
|
|
<% // Only show edit and delete options if the groups aren't read-only.
if (!webManager.getGroupManager().isReadOnly()) { %>
|
|
<% } %>
<% // Print the list of groups
if (groups.isEmpty()) {
%>
|
|
<%
}
int i = start;
for (Group group : groups) {
String groupName = URLEncoder.encode(group.getName(), "UTF-8");
i++;
%>
">
|
<%= i %>
|
<%= group.getName() %>
<% if (group.getDescription() != null) { %>
<%= group.getDescription() %>
<% } %>
|
<%= group.getMembers().size() %>
|
<%= group.getAdmins().size() %>
|
<% // Only show edit and delete options if the groups aren't read-only.
if (!webManager.getGroupManager().isReadOnly()) { %>
>
|
>
|
<% } %>
<%
}
%>
<% if (numPages > 1) { %>
[
<% for (i=0; i
"
class="<%= ((isCurrent) ? "jive-current" : "") %>"
><%= (i+1) %><%= sep %>
<% } %>
]
<% } %>