muc-room-summary.jsp 6.17 KB
Newer Older
Gaston Dombiak's avatar
Gaston Dombiak committed
1 2 3 4
<%--
  -	$Revision$
  -	$Date$
  -
5
  - Copyright (C) 2004-2005 Jive Software. All rights reserved.
Gaston Dombiak's avatar
Gaston Dombiak committed
6 7 8 9 10 11 12
  -
  - This software is the proprietary information of Jive Software.
  - Use is subject to license terms.
--%>

<%@ page import="org.jivesoftware.util.*,
                 org.jivesoftware.admin.*,
13
                 org.jivesoftware.wildfire.muc.MUCRoom,
Gaston Dombiak's avatar
Gaston Dombiak committed
14 15
                 java.util.*,
                 java.net.URLEncoder"
Gaston Dombiak's avatar
Gaston Dombiak committed
16 17 18 19
    errorPage="error.jsp"
%>

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
20
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
Gaston Dombiak's avatar
Gaston Dombiak committed
21 22 23
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"  />
<% webManager.init(request, response, session, application, out ); %>

24 25 26 27 28 29 30
<html>
    <head>
        <title><fmt:message key="muc.room.summary.title"/></title>
        <meta name="pageID" content="muc-room-summary"/>
        <meta name="helpPage" content="edit_group_chat_room_settings.html"/>
    </head>
    <body>
Gaston Dombiak's avatar
Gaston Dombiak committed
31 32 33

<%  // Get parameters
    int start = ParamUtils.getIntParameter(request,"start",0);
34 35 36 37 38
    int range = ParamUtils.getIntParameter(request,"range",webManager.getRowsPerPage("muc-room-summary", 15));

    if (request.getParameter("range") != null) {
        webManager.setRowsPerPage("muc-room-summary", range);
    }
Gaston Dombiak's avatar
Gaston Dombiak committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57

    // Get the rooms in the server
    List<MUCRoom> rooms = webManager.getMultiUserChatServer().getChatRooms();
    Collections.sort(rooms, new Comparator() {
        public int compare(Object o1, Object o2) {
            MUCRoom room1 = (MUCRoom)o1;
            MUCRoom room2 = (MUCRoom)o2;
            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);
%>

<p>
58
<fmt:message key="muc.room.summary.info" />
Gaston Dombiak's avatar
Gaston Dombiak committed
59 60 61 62 63 64 65 66 67
</p>

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

    <div class="jive-success">
    <table cellpadding="0" cellspacing="0" border="0">
    <tbody>
        <tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
        <td class="jive-icon-label">
68
        <fmt:message key="muc.room.summary.destroyed" />
Gaston Dombiak's avatar
Gaston Dombiak committed
69 70 71 72 73 74 75 76
        </td></tr>
    </tbody>
    </table>
    </div><br>

<%  } %>

<p>
77
<fmt:message key="muc.room.summary.total_room" />: <%= roomsCount %>,
Gaston Dombiak's avatar
Gaston Dombiak committed
78 79
<%  if (numPages > 1) { %>

80
    <fmt:message key="global.showing" /> <%= (start+1) %>-<%= (maxRoomIndex) %>,
Gaston Dombiak's avatar
Gaston Dombiak committed
81 82

<%  } %>
83
<fmt:message key="muc.room.summary.sorted_id" />
Gaston Dombiak's avatar
Gaston Dombiak committed
84 85 86 87 88
</p>

<%  if (numPages > 1) { %>

    <p>
89
    <fmt:message key="global.pages" />:
Gaston Dombiak's avatar
Gaston Dombiak committed
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
    [
    <%  for (int i=0; i<numPages; i++) {
            String sep = ((i+1)<numPages) ? " " : "";
            boolean isCurrent = (i+1) == curPage;
    %>
        <a href="muc-room-summary.jsp?start=<%= (i*range) %>"
         class="<%= ((isCurrent) ? "jive-current" : "") %>"
         ><%= (i+1) %></a><%= sep %>

    <%  } %>
    ]
    </p>

<%  } %>

<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
    <tr>
        <th>&nbsp;</th>
Bill Lynch's avatar
Bill Lynch committed
110 111 112 113 114 115
        <th nowrap><fmt:message key="muc.room.summary.room" /></th>
        <th nowrap><fmt:message key="muc.room.summary.description" /></th>
        <th nowrap><fmt:message key="muc.room.summary.persistent" /></th>
        <th nowrap><fmt:message key="muc.room.summary.users" /></th>
        <th nowrap><fmt:message key="muc.room.summary.edit" /></th>
        <th nowrap><fmt:message key="muc.room.summary.destroy" /></th>
Gaston Dombiak's avatar
Gaston Dombiak committed
116 117 118 119 120 121 122 123 124 125
    </tr>
</thead>
<tbody>

<%  // Print the list of rooms
    Iterator<MUCRoom> roomsPage = rooms.subList(start, maxRoomIndex).iterator();
    if (!roomsPage.hasNext()) {
%>
    <tr>
        <td align="center" colspan="7">
126
            <fmt:message key="muc.room.summary.no_room_in_group" />
Gaston Dombiak's avatar
Gaston Dombiak committed
127 128 129 130 131 132 133 134 135 136 137 138 139 140
        </td>
    </tr>

<%
    }
    int i = start;
    while (roomsPage.hasNext()) {
        MUCRoom room = roomsPage.next();
        i++;
%>
    <tr class="jive-<%= (((i%2)==0) ? "even" : "odd") %>">
        <td width="1%">
            <%= i %>
        </td>
Matt Tucker's avatar
Matt Tucker committed
141
        <td width="45%" valign="middle">
Matt Tucker's avatar
Matt Tucker committed
142 143 144 145 146 147
            <% if (room.getName().equals(room.getNaturalLanguageName())) { %>
                <%=  room.getName() %>
            <% }
               else { %>
                <%= room.getNaturalLanguageName() %> (<%=  room.getName() %>)
            <% } %>
Gaston Dombiak's avatar
Gaston Dombiak committed
148
        </td>
Matt Tucker's avatar
Matt Tucker committed
149
        <td width="45%" valign="middle">
Gaston Dombiak's avatar
Gaston Dombiak committed
150 151 152
            <%=  room.getDescription() %>
        </td>
        <td width="1%" align="center">
153
                <% if (room.isPersistent()) { %>
154
                <img src="images/tape.gif" width="16" height="16" border="0" alt="<fmt:message key="muc.room.summary.alt_persistent" />">
Gaston Dombiak's avatar
Gaston Dombiak committed
155
                <% } else { %>
156
                <img src="images/blank.gif" width="16" height="16" border="0" alt="<fmt:message key="muc.room.summary.alt_temporary" />">
Gaston Dombiak's avatar
Gaston Dombiak committed
157 158 159 160 161 162
                <% } %>
        </td>
        <td width="1%" align="center">
            <%= room.getOccupantsCount() %> / <%= room.getMaxUsers() %>
        </td>
        <td width="1%" align="center">
Gaston Dombiak's avatar
Gaston Dombiak committed
163
            <a href="muc-room-edit-form.jsp?roomName=<%= URLEncoder.encode(room.getName(), "UTF-8") %>"
164
             title="<fmt:message key="global.click_edit" />"
Gaston Dombiak's avatar
Gaston Dombiak committed
165 166 167
             ><img src="images/edit-16x16.gif" width="17" height="17" border="0"></a>
        </td>
        <td width="1%" align="center" style="border-right:1px #ccc solid;">
Gaston Dombiak's avatar
Gaston Dombiak committed
168
            <a href="muc-room-delete.jsp?roomName=<%= URLEncoder.encode(room.getName(), "UTF-8") %>"
169
             title="<fmt:message key="global.click_delete" />"
Gaston Dombiak's avatar
Gaston Dombiak committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183
             ><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
        </td>
    </tr>

<%
    }
%>
</tbody>
</table>
</div>

<%  if (numPages > 1) { %>

    <p>
184
    <fmt:message key="global.pages" />:
Gaston Dombiak's avatar
Gaston Dombiak committed
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
    [
    <%  for (i=0; i<numPages; i++) {
            String sep = ((i+1)<numPages) ? " " : "";
            boolean isCurrent = (i+1) == curPage;
    %>
        <a href="muc-room-summary.jsp?start=<%= (i*range) %>"
         class="<%= ((isCurrent) ? "jive-current" : "") %>"
         ><%= (i+1) %></a><%= sep %>

    <%  } %>
    ]
    </p>

<%  } %>

200 201
    </body>
</html>