group-summary.jsp 5.58 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<%--
  -	$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.*,
                 org.jivesoftware.messenger.user.*,
                 java.util.*,
                 java.text.DateFormat,
                 org.jivesoftware.admin.*,
Derek DeMoro's avatar
Derek DeMoro committed
17 18 19
                 org.jivesoftware.messenger.group.*,
                 java.net.URLDecoder,
                 java.net.URLEncoder"
Matt Tucker's avatar
Matt Tucker committed
20 21
%>

22
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
23
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
Matt Tucker's avatar
Matt Tucker committed
24 25 26 27 28 29

<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"  />
<% webManager.init(request, response, session, application, out ); %>

<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%  // Title of this page and breadcrumbs
30
    String title = LocaleUtils.getLocalizedString("group.summary.title");
Matt Tucker's avatar
Matt Tucker committed
31
    pageinfo.setTitle(title);
32
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
Matt Tucker's avatar
Matt Tucker committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "group-summary.jsp"));
    pageinfo.setPageID("group-summary");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />

<%  // Get parameters
    int start = ParamUtils.getIntParameter(request,"start",0);
    int range = ParamUtils.getIntParameter(request,"range",15);

    // Get the user manager
    int groupCount = webManager.getGroupManager().getGroupCount();

    // paginator vars
    int numPages = (int)Math.ceil((double)groupCount/(double)range);
    int curPage = (start/range) + 1;
%>             

<p>
52
<fmt:message key="group.summary.list_group" />
Matt Tucker's avatar
Matt Tucker committed
53 54 55 56 57 58 59 60 61
</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">
62
        <fmt:message key="group.summary.delete_group" />
Matt Tucker's avatar
Matt Tucker committed
63 64 65 66 67 68 69 70
        </td></tr>
    </tbody>
    </table>
    </div><br>

<%  } %>

<p>
71
<fmt:message key="group.summary.total_group" /> <%= webManager.getGroupManager().getGroupCount() %>,
Matt Tucker's avatar
Matt Tucker committed
72 73
<%  if (numPages > 1) { %>

74
    <fmt:message key="group.summary.showing" /> <%= (start+1) %>-<%= (start+range) %>,
Matt Tucker's avatar
Matt Tucker committed
75 76 77 78 79 80 81

<%  } %>
</p>

<%  if (numPages > 1) { %>

    <p>
82
    <fmt:message key="group.summary.page" />
Matt Tucker's avatar
Matt Tucker committed
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
    [
    <%  for (int i=0; i<numPages; i++) {
            String sep = ((i+1)<numPages) ? " " : "";
            boolean isCurrent = (i+1) == curPage;
    %>
        <a href="group-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
103 104 105 106 107
        <th nowrap><fmt:message key="group.summary.page_name" /></th>
        <th nowrap><fmt:message key="group.summary.page_member" /></th>
        <th nowrap><fmt:message key="group.summary.page_admin" /></th>
        <th nowrap><fmt:message key="group.summary.page_edit" /></th>
        <th nowrap><fmt:message key="group.summary.page_delete" /></th>
Matt Tucker's avatar
Matt Tucker committed
108 109 110 111 112 113 114 115 116 117
    </tr>
</thead>
<tbody>

<%  // Print the list of groups
    Collection<Group> groups = webManager.getGroupManager().getGroups(start, range);
    if (groups.isEmpty()) {
%>
    <tr>
        <td align="center" colspan="6">
118
            <fmt:message key="group.summary.no_groups" />
Matt Tucker's avatar
Matt Tucker committed
119 120 121 122 123 124 125
        </td>
    </tr>

<%
    }
    int i = start;
    for (Group group : groups) {
Derek DeMoro's avatar
Derek DeMoro committed
126
        String groupName = URLEncoder.encode(group.getName(), "UTF-8");
Matt Tucker's avatar
Matt Tucker committed
127 128 129
        i++;
%>
    <tr class="jive-<%= (((i%2)==0) ? "even" : "odd") %>">
Matt Tucker's avatar
Matt Tucker committed
130
        <td width="1%" valign="top">
Matt Tucker's avatar
Matt Tucker committed
131 132 133
            <%= i %>
        </td>
        <td width="60%">
Derek DeMoro's avatar
Derek DeMoro committed
134
            <a href="group-edit.jsp?group=<%= groupName %>"><%= group.getName() %></a>
Matt Tucker's avatar
Matt Tucker committed
135
            <% if (group.getDescription() != null) { %>
Matt Tucker's avatar
Matt Tucker committed
136 137 138 139
            <br>
                <span class="jive-description">
                <%= group.getDescription() %>
                </span>
Matt Tucker's avatar
Matt Tucker committed
140
             <% } %>
Matt Tucker's avatar
Matt Tucker committed
141
        </td>
Matt Tucker's avatar
Matt Tucker committed
142
        <td width="10%" align="center">
Matt Tucker's avatar
Matt Tucker committed
143 144
            <%= group.getMembers().size() %>
        </td>
Matt Tucker's avatar
Matt Tucker committed
145
        <td width="10%" align="center">
146
            <%= group.getAdmins().size() %>
Matt Tucker's avatar
Matt Tucker committed
147 148
        </td>
        <td width="1%" align="center">
Derek DeMoro's avatar
Derek DeMoro committed
149
            <a href="group-edit.jsp?group=<%= groupName %>"
150
             title=<fmt:message key="group.summary.click_edit" />
Matt Tucker's avatar
Matt Tucker committed
151 152 153
             ><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;">
Derek DeMoro's avatar
Derek DeMoro committed
154
            <a href="group-delete.jsp?group=<%= groupName %>"
155
             title=<fmt:message key="group.summary.click_delete" />
Matt Tucker's avatar
Matt Tucker committed
156 157 158 159 160 161 162 163 164 165 166 167 168 169
             ><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
        </td>
    </tr>

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

<%  if (numPages > 1) { %>

    <p>
170
    <fmt:message key="group.summary.page" />
Matt Tucker's avatar
Matt Tucker committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
    [
    <%  for (i=0; i<numPages; i++) {
            String sep = ((i+1)<numPages) ? " " : "";
            boolean isCurrent = (i+1) == curPage;
    %>
        <a href="group-summary.jsp?start=<%= (i*range) %>"
         class="<%= ((isCurrent) ? "jive-current" : "") %>"
         ><%= (i+1) %></a><%= sep %>

    <%  } %>
    ]
    </p>

<%  } %>

<jsp:include page="bottom.jsp" flush="true" />