<%-- - $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.*, org.jivesoftware.openfire.muc.MUCRoom, java.util.*, java.net.URLEncoder" errorPage="error.jsp" %> <%@ page import="org.jivesoftware.openfire.muc.MultiUserChatService" %> <%@ page import="org.xmpp.packet.JID" %> <%@ 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("muc-room-summary", 15)); String mucname = ParamUtils.getParameter(request,"mucname"); String roomJIDStr = ParamUtils.getParameter(request,"roomJID"); JID roomJID = null; if (roomJIDStr != null) roomJID = new JID(roomJIDStr); MultiUserChatService mucService = null; if (roomJID != null) { mucService = webManager.getMultiUserChatManager().getMultiUserChatService(roomJID); } else if (mucname != null && webManager.getMultiUserChatManager().isServiceRegistered(mucname)) { mucService = webManager.getMultiUserChatManager().getMultiUserChatService(mucname); } else { for (MultiUserChatService muc : webManager.getMultiUserChatManager().getMultiUserChatServices()) { if (muc.isHidden()) { // Private and hidden, skip it. continue; } mucService = muc; break; } } if (mucService == null) { // No services exist, so redirect to where one can configure the services response.sendRedirect("muc-service-summary.jsp"); return; } if (request.getParameter("range") != null) { webManager.setRowsPerPage("muc-room-summary", range); } // Get the rooms in the server List rooms = mucService.getChatRooms(); Collections.sort(rooms, new Comparator() { public int compare(MUCRoom room1, MUCRoom room2) { return room1.getName().toLowerCase().compareTo(room2.getName().toLowerCase()); } }); int roomsCount = rooms.size(); // paginator vars int numPages = (int)Math.ceil((double)roomsCount/(double)range); int curPage = (start/range) + 1; int maxRoomIndex = (start+range <= roomsCount ? start+range : roomsCount); %> <fmt:message key="muc.room.summary.title"/>

"><%= mucService.getServiceDomain() %>

<% if (request.getParameter("deletesuccess") != null) { %>

<% } %>

: <%= roomsCount %>, <% if (numPages > 1) { %> <%= (start+1) %>-<%= (maxRoomIndex) %>, <% } %> <% if (webManager.getMultiUserChatManager().getMultiUserChatServicesCount() > 1) { %> -- : <% } %>

<% if (numPages > 1) { %>

: [ <% for (int i=0; i &start=<%= (i*range) %>" class="<%= ((isCurrent) ? "jive-current" : "") %>" ><%= (i+1) %><%= sep %> <% } %> ]

<% } %>
<% // Print the list of rooms Iterator roomsPage = rooms.subList(start, maxRoomIndex).iterator(); if (!roomsPage.hasNext()) { %> <% } int i = start; while (roomsPage.hasNext()) { MUCRoom room = roomsPage.next(); i++; %> "> <% } %>
 
<%= i %> <% if (room.getName().equals(room.getNaturalLanguageName())) { %> "title=""> <%= StringUtils.escapeHTMLTags(room.getName()) %> <% } else { %> "title=""> <%= StringUtils.escapeHTMLTags(room.getNaturalLanguageName()) %> (<%= StringUtils.escapeHTMLTags(room.getName()) %>) <% } %> <% if (!"".equals(room.getDescription())) { %> <%= StringUtils.escapeHTMLTags(room.getDescription()) %> <% } else { %>   <% } %> <% if (room.isPersistent()) { %> <fmt:message key="> <% } else { %> <fmt:message key="> <% } %> <%= room.getOccupantsCount() %> / <%= room.getMaxUsers() %> " title="" > " title="" >
<% if (numPages > 1) { %>

: [ <% for (i=0; i &start=<%= (i*range) %>" class="<%= ((isCurrent) ? "jive-current" : "") %>" ><%= (i+1) %><%= sep %> <% } %> ]

<% } %>