group-edit.jsp 21.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
<%--
  -	$RCSfile$
  -	$Revision$
  -	$Date$
  -
  - Copyright (C) 2005 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="java.text.DateFormat,
13 14 15 16 17
                 java.util.*,
                 org.jivesoftware.util.ParamUtils,
                 org.jivesoftware.admin.*,
                 org.xmpp.packet.JID,
                 org.jivesoftware.messenger.group.GroupManager,
Derek DeMoro's avatar
Derek DeMoro committed
18
                 org.jivesoftware.messenger.group.Group,
19 20 21 22
                 java.net.URLEncoder,
                 java.net.URLDecoder,
                 org.jivesoftware.messenger.user.UserManager,
                 org.jivesoftware.messenger.user.UserNotFoundException,
23
                 org.jivesoftware.stringprep.Stringprep,
24 25
                 java.io.UnsupportedEncodingException,
                 org.jivesoftware.util.LocaleUtils"
26 27 28
%>

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
29
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
30
<!-- Define Administration Bean -->
31
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"/>
32
<jsp:useBean id="errors" class="java.util.HashMap"/>
33 34 35 36

<%  webManager.init(pageContext); %>

<%  // Get parameters
37 38
    boolean add = request.getParameter("add") != null;
    boolean delete = request.getParameter("remove") != null;
39 40
    boolean update = request.getParameter("save") != null;
    boolean cancel = request.getParameter("cancel") != null;
Matt Tucker's avatar
Matt Tucker committed
41
    String users = ParamUtils.getParameter(request, "users");
42 43
    String [] adminIDs = ParamUtils.getParameters(request, "admin");
    String [] deleteMembers = ParamUtils.getParameters(request, "delete");
Matt Tucker's avatar
Matt Tucker committed
44
    String groupName = ParamUtils.getParameter(request, "group");
45
    GroupManager groupManager = webManager.getGroupManager();
Derek DeMoro's avatar
Derek DeMoro committed
46 47
    boolean edit = ParamUtils.getBooleanParameter(request, "edit", false);
    String newName = ParamUtils.getParameter(request, "newName");
Matt Tucker's avatar
Matt Tucker committed
48
    String newDescription = ParamUtils.getParameter(request, "newDescription");
49 50
    String newShowInRosterType = ParamUtils.getParameter(request, "newShow");
    boolean newShowInRoster = "onlyGroup".equals(newShowInRosterType) || "everybody".equals(newShowInRosterType);
51
    String  newDisplayName = ParamUtils.getParameter(request, "newDisplay");
Derek DeMoro's avatar
Derek DeMoro committed
52
    boolean groupInfoChanged = ParamUtils.getBooleanParameter(request, "groupChanged", false);
Derek DeMoro's avatar
Derek DeMoro committed
53

54 55 56 57 58 59 60
    boolean enableRosterGroups = ParamUtils.getBooleanParameter(request,"enableRosterGroups");
    String groupDisplayName = ParamUtils.getParameter(request,"groupDisplayName");
    String showGroup = ParamUtils.getParameter(request,"showGroup");
    String[] groupNames = ParamUtils.getParameters(request, "groupNames");

    edit = true;

Matt Tucker's avatar
Matt Tucker committed
61
    Group group = groupManager.getGroup(groupName);
Derek DeMoro's avatar
Derek DeMoro committed
62 63 64
    boolean success = false;
    StringBuffer errorBuf = new StringBuffer();

65 66 67 68
    if (cancel) {
        response.sendRedirect("group-summary.jsp");
        return;
    }
Derek DeMoro's avatar
Derek DeMoro committed
69

Matt Tucker's avatar
Matt Tucker committed
70
    if (newName != null && newName.length() > 0) {
71 72 73 74 75 76
        if (newShowInRoster && (newDisplayName == null || newDisplayName.length() == 0)) {
            errors.put("display", "");
        }
        if (errors.isEmpty()) {
            group.setName(newName);
            group.setDescription(newDescription);
77 78 79 80

                if (enableRosterGroups) {
                    if ("spefgroups".equals(showGroup)) {
                        showGroup = "onlyGroup";
81 82 83
                    }
                    else {
                        groupNames = new String[] {};
84 85 86 87 88
                    }
                    group.getProperties().put("sharedRoster.showInRoster", showGroup);
                    if (groupDisplayName != null) {
                        group.getProperties().put("sharedRoster.displayName", groupDisplayName);
                    }
89
                    group.getProperties().put("sharedRoster.groupList", toList(groupNames, "UTF-8"));
90 91 92 93 94 95 96
                }
                else {
                    group.getProperties().put("sharedRoster.showInRoster", "nobody");
                    group.getProperties().put("sharedRoster.displayName", "");
                    group.getProperties().put("sharedRoster.groupList", "");
                }

97 98 99 100 101 102 103 104 105 106
            groupName = newName;
            groupInfoChanged = true;
             // Get admin list and compare it the admin posted list.
            response.sendRedirect("group-edit.jsp?group=" + URLEncoder.encode(groupName, "UTF-8") + "&groupChanged=true");
            return;
        }
        else {
            // Continue editing since there are some errors
            edit = true;
        }
Derek DeMoro's avatar
Derek DeMoro committed
107 108
    }

Derek DeMoro's avatar
Derek DeMoro committed
109

110 111
    if (update) {
        Set adminIDSet = new HashSet();
112
        for (int i = 0; i < adminIDs.length; i++) {
113 114 115
            String newAdmin = adminIDs[i];
            adminIDSet.add(newAdmin);
            boolean isAlreadyAdmin = group.getAdmins().contains(newAdmin);
116 117 118 119
            if (!isAlreadyAdmin) {
                // Add new admin
                group.getMembers().remove(newAdmin);
                group.getAdmins().add(newAdmin);
120 121 122
            }
        }
        Iterator groupIter = Collections.unmodifiableCollection(group.getAdmins()).iterator();
Matt Tucker's avatar
Matt Tucker committed
123
        Set removeList = new HashSet();
124 125 126
        while (groupIter.hasNext()) {
            String m = (String) groupIter.next();
            if (!adminIDSet.contains(m)) {
127 128 129 130
                removeList.add(m);
            }
        }
        Iterator i = removeList.iterator();
131 132
        while (i.hasNext()) {
            String m = (String) i.next();
133 134 135 136
            group.getAdmins().remove(m);
            group.getMembers().add(m);
        }
        // Get admin list and compare it the admin posted list.
Derek DeMoro's avatar
Derek DeMoro committed
137
        response.sendRedirect("group-edit.jsp?group=" + URLEncoder.encode(groupName, "UTF-8") + "&updatesuccess=true");
138 139
        return;
    }
140
    else if (add && users != null) {
141
        StringTokenizer tokenizer = new StringTokenizer(users, ",");
Matt Tucker's avatar
Matt Tucker committed
142
        int count = 0;
143
        while (tokenizer.hasMoreTokens()) {
Matt Tucker's avatar
Matt Tucker committed
144
            String username = tokenizer.nextToken();
Derek DeMoro's avatar
Derek DeMoro committed
145 146 147
            username = username.trim();
            username = username.toLowerCase();

Matt Tucker's avatar
Matt Tucker committed
148 149 150 151 152 153 154
            // Add to group as member by default.
            if (!group.getMembers().contains(username) && !group.getAdmins().contains(username)) {
                // Ensure that the user is valid
                try {
                    group.getMembers().add(username);
                    count++;
                }
Derek DeMoro's avatar
Derek DeMoro committed
155 156 157 158 159 160
                catch (IllegalArgumentException unfe) {
                  errorBuf.append("<br>"+username + " is not a registered user.");
                }
            }
            else {
                errorBuf.append("<br>"+username+" is already in group.");
161 162
            }
        }
Matt Tucker's avatar
Matt Tucker committed
163 164 165
        if (count > 0) {
            response.sendRedirect("group-edit.jsp?group=" +
                    URLEncoder.encode(groupName, "UTF-8") + "&success=true");
Derek DeMoro's avatar
Derek DeMoro committed
166
            return;
Matt Tucker's avatar
Matt Tucker committed
167 168
        }
        else {
Derek DeMoro's avatar
Derek DeMoro committed
169 170
            success = false;
            add = true;
Matt Tucker's avatar
Matt Tucker committed
171
        }
Derek DeMoro's avatar
Derek DeMoro committed
172 173 174 175

    }
    else if(add && users == null){
        add = false;
176 177
    }
    else if (delete) {
178 179 180 181
        for (int i = 0; i < deleteMembers.length; i++) {
            String member = deleteMembers[i];
            group.getMembers().remove(member);
            group.getAdmins().remove(member);
182
        }
Derek DeMoro's avatar
Derek DeMoro committed
183
        response.sendRedirect("group-edit.jsp?group=" + URLEncoder.encode(groupName, "UTF-8") + "&deletesuccess=true");
184 185
        return;
    }
Derek DeMoro's avatar
Derek DeMoro committed
186
    success = groupInfoChanged || "true".equals(request.getParameter("success")) ||
Matt Tucker's avatar
Matt Tucker committed
187
            "true".equals(request.getParameter("deletesuccess")) ||
Matt Tucker's avatar
Matt Tucker committed
188 189
            "true".equals(request.getParameter("updatesuccess")) ||
            "true".equals(request.getParameter("creategroupsuccess"));
190 191 192 193

    if (errors.size() == 0) {
        enableRosterGroups = !"nobody".equals(group.getProperties().get("sharedRoster.showInRoster"));
        showGroup = group.getProperties().get("sharedRoster.showInRoster");
194
        if ("onlyGroup".equals(showGroup)) {
195 196 197 198 199 200 201 202 203 204 205 206 207
            String glist = group.getProperties().get("sharedRoster.groupList");
            List l = new ArrayList();
            if (glist != null) {
                StringTokenizer tokenizer = new StringTokenizer(glist,",");
                while (tokenizer.hasMoreTokens()) {
                    String tok = tokenizer.nextToken().trim();
                    l.add(tok.trim());
                }
            }
            groupNames = (String[])l.toArray(new String[]{});
        }
        groupDisplayName = group.getProperties().get("sharedRoster.displayName"); 
    }
208
%>
209 210
    <jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean"/>
<% // Title of this page and breadcrumbs
211
    String title = LocaleUtils.getLocalizedString("group.edit.title");
212 213
    pageinfo.setTitle(title);
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
Matt Tucker's avatar
Matt Tucker committed
214 215 216
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "group-edit.jsp?group="+URLEncoder.encode(groupName, "UTF-8")));
    pageinfo.setSubPageID("group-edit");
    pageinfo.setExtraParams("group="+URLEncoder.encode(groupName, "UTF-8"));
217
%>
218 219 220
    <jsp:include page="top.jsp" flush="true"/>
    <jsp:include page="title.jsp" flush="true"/>
    <p>
221
        <fmt:message key="group.edit.form_info" />
222
    </p>
Gaston Dombiak's avatar
Gaston Dombiak committed
223

Derek DeMoro's avatar
Derek DeMoro committed
224
<%
Matt Tucker's avatar
Matt Tucker committed
225
    if (success) {
Derek DeMoro's avatar
Derek DeMoro committed
226
%>
Matt Tucker's avatar
Matt Tucker committed
227 228 229 230 231 232
    <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">
        <% if (groupInfoChanged) { %>
233
        <fmt:message key="group.edit.update" />
Matt Tucker's avatar
Matt Tucker committed
234
        <% } else if ("true".equals(request.getParameter("success"))) { %>
235
            <fmt:message key="group.edit.update_add_user" />
Matt Tucker's avatar
Matt Tucker committed
236
        <% } else if ("true".equals(request.getParameter("deletesuccess"))) { %>
237
            <fmt:message key="group.edit.update_del_user" />
Matt Tucker's avatar
Matt Tucker committed
238
        <% } else if ("true".equals(request.getParameter("updatesuccess"))) { %>
239
            <fmt:message key="group.edit.update_user" />
Matt Tucker's avatar
Matt Tucker committed
240
         <% } else if ("true".equals(request.getParameter("creategroupsuccess"))) { %>
241
            <fmt:message key="group.edit.update_success" />
Matt Tucker's avatar
Matt Tucker committed
242 243 244 245 246 247 248
        <%
            }
        %>
        </td></tr>
    </tbody>
    </table>
    </div><br>
249 250
<%
    }
Derek DeMoro's avatar
Derek DeMoro committed
251
    else if(!success && add){
252
%>
Derek DeMoro's avatar
Derek DeMoro committed
253 254 255 256 257 258
 <div class="jive-error">
    <table cellpadding="0" cellspacing="0" border="0">
    <tbody>
        <tr><td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"></td>
        <td class="jive-icon-label">
        <% if(add) { %>
259
        <fmt:message key="group.edit.not_update" />
Derek DeMoro's avatar
Derek DeMoro committed
260
        <%= errorBuf %>
Derek DeMoro's avatar
Derek DeMoro committed
261 262 263 264 265 266
        <% } %>
        </td></tr>
    </tbody>
    </table>
    </div><br>
<% } %>
Derek DeMoro's avatar
Derek DeMoro committed
267 268 269
<form name="ff" action="group-edit.jsp">
<input type="hidden" name="group" value="<%= groupName %>"/>

270 271
    <fieldset>
        <legend>
272
            <fmt:message key="group.edit.group_summary" />
Derek DeMoro's avatar
Derek DeMoro committed
273 274
        </legend>

275 276
        <table cellpadding="3" cellspacing="1" border="0">
            <tr>
Bill Lynch's avatar
Bill Lynch committed
277
                <td  width="1%" nowrap>
278
                    <fmt:message key="group.edit.group_name" />
279
                </td>
Matt Tucker's avatar
Matt Tucker committed
280
                <% if(!edit) { %>
Derek DeMoro's avatar
Derek DeMoro committed
281
                <td align=left nowrap width="1%">
282 283
                    <b><%= group.getName() %></b>
                </td>
Derek DeMoro's avatar
Derek DeMoro committed
284
                <td>
Matt Tucker's avatar
Matt Tucker committed
285
                    <a href="group-edit.jsp?edit=true&group=<%= URLEncoder.encode(groupName, "UTF-8") %>">
Derek DeMoro's avatar
Derek DeMoro committed
286 287 288
                    <img src="images/edit-16x16.gif" border="0">
                   </a>
                </td>
Matt Tucker's avatar
Matt Tucker committed
289
                <% } else { %>
Derek DeMoro's avatar
Derek DeMoro committed
290 291

                <td>
Matt Tucker's avatar
Matt Tucker committed
292
                <input type="text" name="newName" value="<%= group.getName() %>">
Derek DeMoro's avatar
Derek DeMoro committed
293 294 295
                </td>

                <% } %>
Matt Tucker's avatar
Matt Tucker committed
296
            </tr>
297
            <tr>
Bill Lynch's avatar
Bill Lynch committed
298
                <td width="1%" nowrap>
299
                    <fmt:message key="group.edit.group_description" />
300
                </td>
Matt Tucker's avatar
Matt Tucker committed
301
                <% if(!edit) { %>
302
                <td colspan="2">
303
                    <%= ((group.getDescription() != null) ? group.getDescription() : "<i>"+LocaleUtils.getLocalizedString("group.edit.group_not_description")+"</i>") %>
304
                </td>
Matt Tucker's avatar
Matt Tucker committed
305 306 307
                <% } else { %>

                <td>
308
                <textarea name="newDescription" cols="40" rows="4"><%= group.getDescription() != null ? group.getDescription() : "" %></textarea>
Matt Tucker's avatar
Matt Tucker committed
309 310 311
                </td>

                <% } %>
312
            </tr>
313
            </table>
314 315 316



317
    <br>
318
    <p><fmt:message key="group.edit.group_share_title" /></p>
319

320
    <p>
321
    <fmt:message key="group.edit.group_share_content" />
322
    </p>
323

324 325 326 327 328 329 330
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
    <tbody>
        <tr>
            <td width="1%">
                <input type="radio" name="enableRosterGroups" value="false" id="rb201" <%= !enableRosterGroups ? "checked" : "" %>>
            </td>
            <td width="99%">
331
                <label for="rb201"><fmt:message key="group.edit.group_share_not_in_rosters" /></label>
332 333 334 335 336 337 338
            </td>
        </tr>
        <tr>
            <td width="1%">
                <input type="radio" name="enableRosterGroups" value="true" id="rb202" <%= enableRosterGroups ? "checked" : "" %>>
            </td>
            <td width="99%">
339
                <label for="rb202"><fmt:message key="group.edit.group_share_in_rosters" /></label>
340 341 342 343 344 345 346 347 348 349 350 351
            </td>
        </tr>
        <tr>
            <td width="1%">
                &nbsp;
            </td>
            <td width="99%">

                <table cellpadding="3" cellspacing="0" border="0" width="100%">
                <tbody>
                    <tr>
                        <td width="1%" nowrap>
352
                            <fmt:message key="group.edit.group_display_name" />
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
                        </td>
                        <td width="99%">
                            <input type="text" name="groupDisplayName" size="30" maxlength="100" value="<%= (groupDisplayName != null ? groupDisplayName : "") %>"
                             onclick="this.form.enableRosterGroups[1].checked=true;">
                        </td>
                    </tr>
                </tbody>
                </table>

                <table cellpadding="3" cellspacing="0" border="0" width="100%">
                <tbody>
                    <tr>
                        <td width="1%" nowrap>
                            <input type="radio" name="showGroup" value="everybody" id="rb002"
                             onclick="this.form.enableRosterGroups[1].checked=true;"
                             <%= ("everybody".equals(showGroup) ? "checked" : "") %>>
                        </td>
                        <td width="99%">
371
                            <label for="rb002"><fmt:message key="group.edit.show_groups_in_all_user" /></label>
372 373 374 375 376 377
                        </td>
                    </tr>
                    <tr>
                        <td width="1%" nowrap>
                            <input type="radio" name="showGroup" value="onlyGroup" id="rb001"
                             onclick="this.form.enableRosterGroups[1].checked=true;"
378
                             <%= ("onlyGroup".equals(showGroup) && (groupNames == null || groupNames.length == 0) ? "checked" : "") %>>
379 380
                        </td>
                        <td width="99%">
381
                            <label for="rb001"><fmt:message key="group.edit.show_groups_in_groups_members" /></label>
382 383 384 385 386 387 388 389 390
                        </td>
                    </tr>
                    <tr>
                        <td width="1%" nowrap>
                            <input type="radio" name="showGroup" value="spefgroups" id="rb003"
                             onclick="this.form.enableRosterGroups[1].checked=true;"
                             <%= (groupNames != null && groupNames.length > 0) ? "checked" : "" %>>
                        </td>
                        <td width="99%">
391
                            <label for="rb003"><fmt:message key="group.edit.show_group_in_roster_group" /></label>
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
                        </td>
                    </tr>
                    <tr>
                        <td width="1%" nowrap>
                            &nbsp;
                        </td>
                        <td width="99%">
                            <select name="groupNames" size="6" onclick="this.form.showGroup[2].checked=true;this.form.enableRosterGroups[1].checked=true;"
                             multiple style="width:300px;font-family:verdana,arial,helvetica,sans-serif;font-size:8pt;">

                            <%  for (Group g : webManager.getGroupManager().getGroups()) { %>

                                <option value="<%= URLEncoder.encode(g.getName(), "UTF-8") %>"
                                 <%= (contains(groupNames, g.getName()) ? "selected" : "") %>
                                 ><%= g.getName() %></option>

                            <%  } %>

                            </select>
                        </td>
                    </tr>
                </tbody>
                </table>
415

Matt Tucker's avatar
Matt Tucker committed
416
            </td>
417 418 419
        </tr>
    </tbody>
    </table>
Matt Tucker's avatar
Matt Tucker committed
420

421
    </fieldset>
422 423
    <br>

424
    <%  if (edit) { %>
425 426
        <input type="submit" name="save" value="<fmt:message key="global.save_settings" />">
        <input type="submit" name="cancel" value="<fmt:message key="global.cancel" />">
427 428 429 430 431 432
    <%  } %>

                    </form>

    <br><br>

Derek DeMoro's avatar
Derek DeMoro committed
433
    <form action="group-edit.jsp" method="post" name="f">
434 435 436 437 438
        <input type="hidden" name="group" value="<%= groupName %>">
        <input type="hidden" name="add" value="Add"/>
        <table cellpadding="3" cellspacing="1" border="0">
            <tr>
                <td nowrap width="1%">
439
                    <fmt:message key="group.edit.add_user" />
440 441 442
                </td>
                <td nowrap class="c1" align="left">
                    <input type="text" size="40" name="users"/>
443
                    &nbsp;<input type="submit" name="addbutton" value="<fmt:message key="global.add" />">
444 445 446 447 448
                </td>
            </tr>
        </table>
    </form>

Derek DeMoro's avatar
Derek DeMoro committed
449
    <form action="group-edit.jsp" method="post" name="main">
450 451 452
        <input type="hidden" name="group" value="<%= groupName %>">
        <table class="jive-table" cellpadding="3" cellspacing="0" border="0" width="600">
            <tr>
Bill Lynch's avatar
Bill Lynch committed
453 454 455
                <th nowrap><fmt:message key="group.edit.username" /></th>
                <th width="1%" nowrap><fmt:message key="group.edit.admin" /></th>
                <th width="1%" nowrap><fmt:message key="group.edit.remove" /></th>
456 457
            </tr>
            <!-- Add admins first -->
458
<%
Matt Tucker's avatar
Matt Tucker committed
459
            int memberCount = group.getMembers().size() + group.getAdmins().size();
460 461
            Iterator members = group.getMembers().iterator();
            Iterator admins = group.getAdmins().iterator();
462 463
%>
<%
464 465 466
            if (memberCount == 0) {
%>
                <tr>
Matt Tucker's avatar
Matt Tucker committed
467
                    <td align="center" colspan="3">
468
                        <br>
469
                        <fmt:message key="group.edit.user_hint" />
470 471 472 473
                        <br>
                        <br>
                    </td>
                </tr>
474
<%
475
            }
476 477
%>
<%
478 479
            boolean showUpdateButtons = memberCount > 0;
            while (admins.hasNext()) {
Matt Tucker's avatar
Matt Tucker committed
480
                String username = (String)admins.next();
481
%>
482
                <tr>
Matt Tucker's avatar
Matt Tucker committed
483 484 485
                    <td><%= username %></td>
                    <td align="center">
                        <input type="checkbox" name="admin" value="<%= username %>" checked>
486 487
                    </td>
                    <td align="center">
Matt Tucker's avatar
Matt Tucker committed
488
                        <input type="checkbox" name="delete" value="<%= username %>">
489 490 491 492 493 494 495
                    </td>
                </tr>
<%
            }
%>
<%
            while (members.hasNext()) {
Matt Tucker's avatar
Matt Tucker committed
496
                String username = (String)members.next();
497 498
%>
                <tr>
Matt Tucker's avatar
Matt Tucker committed
499 500 501
                    <td><%= username %></td>
                    <td align="center">
                        <input type="checkbox" name="admin" value="<%= username %>">
502 503
                    </td>
                    <td align="center">
Matt Tucker's avatar
Matt Tucker committed
504
                        <input type="checkbox" name="delete" value="<%= username %>">
505 506 507 508 509 510 511 512 513
                    </td>
                </tr>
<%
            }
%>
<%
            if (showUpdateButtons) {
%>
                <tr>
Matt Tucker's avatar
Matt Tucker committed
514
                    <td>
515 516 517
                        &nbsp;
                    </td>
                    <td align="center">
518
                        <input type="submit" name="save" value="Update">
519 520 521 522 523 524 525 526 527 528 529
                    </td>
                    <td align="center">
                        <input type="submit" name="remove" value="Remove">
                    </td>
                </tr>
<%
            }
%>
        </table>
        </div>
    </form>
530 531

    <script type="text/javascript">
532 533
        document.f.users.focus();
    </script>
534 535 536 537 538 539

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



<%!
540
    private static String toList(String[] array, String enc) {
541 542 543 544 545 546
        if (array == null || array.length == 0) {
            return "";
        }
        StringBuffer buf = new StringBuffer();
        String sep = "";
        for (int i=0; i<array.length; i++) {
547 548 549 550 551 552 553 554
            String item;
            try {
                item = URLDecoder.decode(array[i], enc);
            }
            catch (UnsupportedEncodingException e) {
                item = array[i];
            }
            buf.append(sep).append(item);
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571
            sep = ",";
        }
        return buf.toString();
    }

    private static boolean contains(String[] array, String item) {
        if (array == null || array.length == 0 || item == null) {
            return false;
        }
        for (int i=0; i<array.length; i++) {
            if (item.equals(array[i])) {
                return true;
            }
        }
        return false;
    }
%>