muc-room-edit-form.jsp 28.5 KB
Newer Older
Gaston Dombiak's avatar
Gaston Dombiak committed
1 2 3 4
<%--
  -	$Revision$
  -	$Date$
  -
5
  - Copyright (C) 2004-2008 Jive Software. All rights reserved.
Gaston Dombiak's avatar
Gaston Dombiak committed
6
  -
7 8 9
  - This software is published under the terms of the GNU Public License (GPL),
  - a copy of which is included in this distribution, or a commercial license
  - agreement with Jive.
Gaston Dombiak's avatar
Gaston Dombiak committed
10 11 12 13 14
--%>

<%@ page import="org.jivesoftware.util.ParamUtils,
                 java.text.DateFormat,
                 java.util.*,
15 16 17
                 org.jivesoftware.openfire.muc.MUCRoom,
                 org.jivesoftware.openfire.forms.spi.*,
                 org.jivesoftware.openfire.forms.*,
Gaston Dombiak's avatar
Gaston Dombiak committed
18 19
                 org.dom4j.Element,
                 org.xmpp.packet.IQ,
20 21
                 org.xmpp.packet.Message,
                 org.xmpp.packet.JID,
22
                 org.jivesoftware.stringprep.Stringprep,
Gaston Dombiak's avatar
Gaston Dombiak committed
23 24
                 org.jivesoftware.stringprep.StringprepException,
                 java.net.URLEncoder"
Gaston Dombiak's avatar
Gaston Dombiak committed
25 26
    errorPage="error.jsp"
%>
27
<%@ page import="org.jivesoftware.openfire.muc.NotAllowedException"%>
28
<%@ page import="org.jivesoftware.openfire.muc.MultiUserChatService" %>
Gaston Dombiak's avatar
Gaston Dombiak committed
29 30

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

<%  // Get parameters
36
    boolean create = ParamUtils.getBooleanParameter(request,"create");
Gaston Dombiak's avatar
Gaston Dombiak committed
37 38 39
    boolean save = ParamUtils.getBooleanParameter(request,"save");
    boolean success = ParamUtils.getBooleanParameter(request,"success");
    boolean addsuccess = ParamUtils.getBooleanParameter(request,"addsuccess");
40 41 42 43 44 45 46 47 48 49 50 51
    String roomName = ParamUtils.getParameter(request,"roomName");
    String mucName = ParamUtils.getParameter(request,"mucName");
    String roomJIDStr = ParamUtils.getParameter(request,"roomJID");
    JID roomJID = null;
    if (roomName != null && mucName != null) {
        roomJID = new JID(roomName, mucName, null);
    }
    else if (roomJIDStr != null) {
        roomJID = new JID(roomJIDStr);
        roomName = roomJID.getNode();
        mucName = roomJID.getDomain();
    }
Gaston Dombiak's avatar
Gaston Dombiak committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
    String naturalName = ParamUtils.getParameter(request,"roomconfig_roomname");
    String description = ParamUtils.getParameter(request,"roomconfig_roomdesc");
    String maxUsers = ParamUtils.getParameter(request, "roomconfig_maxusers");
    String broadcastModerator = ParamUtils.getParameter(request, "roomconfig_presencebroadcast");
    String broadcastParticipant = ParamUtils.getParameter(request, "roomconfig_presencebroadcast2");
    String broadcastVisitor = ParamUtils.getParameter(request, "roomconfig_presencebroadcast3");
    String password = ParamUtils.getParameter(request, "roomconfig_roomsecret");
    String confirmPassword = ParamUtils.getParameter(request, "roomconfig_roomsecret2");
    String whois = ParamUtils.getParameter(request, "roomconfig_whois");
    String publicRoom = ParamUtils.getParameter(request, "roomconfig_publicroom");
    String persistentRoom = ParamUtils.getParameter(request, "roomconfig_persistentroom");
    String moderatedRoom = ParamUtils.getParameter(request, "roomconfig_moderatedroom");
    String membersOnly = ParamUtils.getParameter(request, "roomconfig_membersonly");
    String allowInvites = ParamUtils.getParameter(request, "roomconfig_allowinvites");
    String changeSubject = ParamUtils.getParameter(request, "roomconfig_changesubject");
    String enableLog = ParamUtils.getParameter(request, "roomconfig_enablelogging");
68 69 70
    String reservedNick = ParamUtils.getParameter(request, "roomconfig_reservednick");
    String canChangeNick = ParamUtils.getParameter(request, "roomconfig_canchangenick");
    String registrationEnabled = ParamUtils.getParameter(request, "roomconfig_registration");
Gaston Dombiak's avatar
Gaston Dombiak committed
71 72
    String roomSubject = ParamUtils.getParameter(request, "room_topic");

73 74 75 76 77 78
    if (webManager.getMultiUserChatManager().getMultiUserChatServicesCount() < 1) {
        // No services exist, so redirect to where one can configure the services
        response.sendRedirect("muc-service-summary.jsp");
        return;
    }

Gaston Dombiak's avatar
Gaston Dombiak committed
79 80
    // Handle a cancel
    if (request.getParameter("cancel") != null) {
81
        response.sendRedirect("muc-room-summary.jsp?roomJID="+URLEncoder.encode(roomJID.toBareJID(), "UTF-8"));
Gaston Dombiak's avatar
Gaston Dombiak committed
82 83 84 85
        return;
    }

    // Load the room object
86 87
    MUCRoom room = null;
    if (!create) {
88
        room = webManager.getMultiUserChatManager().getMultiUserChatService(roomJID).getChatRoom(roomName);
Gaston Dombiak's avatar
Gaston Dombiak committed
89

90 91
        if (room == null) {
            // The requested room name does not exist so return to the list of the existing rooms
92
            response.sendRedirect("muc-room-summary.jsp?roomJID="+URLEncoder.encode(roomJID.toBareJID(), "UTF-8"));
93 94
            return;
        }
Gaston Dombiak's avatar
Gaston Dombiak committed
95 96
    }

97
    // Handle an save
98
    Map<String, String> errors = new HashMap<String, String>();
Gaston Dombiak's avatar
Gaston Dombiak committed
99 100
    if (save) {
        // do validation
101

Gaston Dombiak's avatar
Gaston Dombiak committed
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
        if (naturalName == null) {
            errors.put("roomconfig_roomname","roomconfig_roomname");
        }
        if (description == null) {
            errors.put("roomconfig_roomdesc","roomconfig_roomdesc");
        }
        if (maxUsers == null) {
            errors.put("roomconfig_maxusers","roomconfig_maxusers");
        }
        if (password != null && !password.equals(confirmPassword)) {
            errors.put("roomconfig_roomsecret2","roomconfig_roomsecret2");
        }
        if (whois == null) {
            errors.put("roomconfig_whois","roomconfig_whois");
        }
117 118 119 120 121
        if (create && errors.size() == 0) {
            if (roomName == null || roomName.contains("@")) {
                errors.put("roomName","roomName");
            }
            else {
122 123 124 125 126 127 128 129 130 131
                // Check that the room name is a valid node
                try {
                    roomName = Stringprep.nodeprep(roomName);
                }
                catch (StringprepException e) {
                    errors.put("roomName","roomName");
                }
            }

            if (errors.size() == 0) {
132
                // Check that the requested room ID is available
133
                room = webManager.getMultiUserChatManager().getMultiUserChatService(roomJID).getChatRoom(roomName);
134 135 136 137 138
                if (room != null) {
                    errors.put("room_already_exists", "room_already_exists");
                }
                else {
                    // Try to create a new room
139
                    JID address = new JID(webManager.getUser().getUsername(), webManager.getServerInfo().getXMPPDomain(), null);
140
                    try {
141
                        room = webManager.getMultiUserChatManager().getMultiUserChatService(roomJID).getChatRoom(roomName, address);
142 143 144 145 146
                        // Check if the room was created concurrently by another user
                        if (!room.getOwners().contains(address.toBareJID())) {
                            errors.put("room_already_exists", "room_already_exists");
                        }
                    }
147
                    catch (NotAllowedException e) {
148 149 150 151 152 153 154
                        // This user is not allowed to create rooms
                        errors.put("not_enough_permissions", "not_enough_permissions");
                    }
                }
            }
        }

Gaston Dombiak's avatar
Gaston Dombiak committed
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
        if (errors.size() == 0) {
            // Set the new configuration sending an IQ packet with an dataform
            FormField field;
            XDataFormImpl dataForm = new XDataFormImpl(DataForm.TYPE_SUBMIT);

            field = new XFormFieldImpl("FORM_TYPE");
            field.setType(FormField.TYPE_HIDDEN);
            field.addValue("http://jabber.org/protocol/muc#roomconfig");
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_roomname");
            field.addValue(naturalName);
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_roomdesc");
            field.addValue(description);
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_changesubject");
            field.addValue((changeSubject == null) ? "0": "1");
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_maxusers");
            field.addValue(maxUsers);
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_presencebroadcast");
            if (broadcastModerator != null) {
                field.addValue("moderator");
            }
            if (broadcastParticipant != null) {
                field.addValue("participant");
            }
            if (broadcastVisitor != null) {
                field.addValue("visitor");
            }
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_publicroom");
            field.addValue((publicRoom == null) ? "0": "1");
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_persistentroom");
            field.addValue((persistentRoom == null) ? "0": "1");
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_moderatedroom");
            field.addValue((moderatedRoom == null) ? "0": "1");
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_membersonly");
            field.addValue((membersOnly == null) ? "0": "1");
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_allowinvites");
            field.addValue((allowInvites == null) ? "0": "1");
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_passwordprotectedroom");
            field.addValue((password == null) ? "0": "1");
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_roomsecret");
            field.addValue(password);
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_whois");
            field.addValue(whois);
            dataForm.addField(field);

            field = new XFormFieldImpl("muc#roomconfig_enablelogging");
            field.addValue((enableLog == null) ? "0": "1");
            dataForm.addField(field);

229 230 231 232 233 234 235 236 237 238 239 240
            field = new XFormFieldImpl("x-muc#roomconfig_reservednick");
            field.addValue((reservedNick == null) ? "0": "1");
            dataForm.addField(field);

            field = new XFormFieldImpl("x-muc#roomconfig_canchangenick");
            field.addValue((canChangeNick == null) ? "0": "1");
            dataForm.addField(field);

            field = new XFormFieldImpl("x-muc#roomconfig_registration");
            field.addValue((registrationEnabled == null) ? "0": "1");
            dataForm.addField(field);

Gaston Dombiak's avatar
Gaston Dombiak committed
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
            // Keep the existing list of admins
            field = new XFormFieldImpl("muc#roomconfig_roomadmins");
            for (String jid : room.getAdmins()) {
                field.addValue(jid);
            }
            dataForm.addField(field);

            // Keep the existing list of owners
            field = new XFormFieldImpl("muc#roomconfig_roomowners");
            for (String jid : room.getOwners()) {
                field.addValue(jid);
            }
            dataForm.addField(field);

            // Create an IQ packet and set the dataform as the main fragment
            IQ iq = new IQ(IQ.Type.set);
            Element element = iq.setChildElement("query", "http://jabber.org/protocol/muc#owner");
            element.add(dataForm.asXMLElement());
            // Send the IQ packet that will modify the room's configuration
            room.getIQOwnerHandler().handleIQ(iq, room.getRole());

262 263 264 265 266 267 268 269 270
            if (roomSubject != null) {
                // Change the subject of the room by sending a new message
                Message message = new Message();
                message.setType(Message.Type.groupchat);
                message.setSubject(roomSubject);
                message.setFrom(room.getRole().getRoleAddress());
                message.setTo(room.getRole().getRoleAddress());
                room.changeSubject(message, room.getRole());
            }
Gaston Dombiak's avatar
Gaston Dombiak committed
271 272

            // Changes good, so redirect
273
            String params;
274
            if (create) {
275
                params = "addsuccess=true&roomJID=" + URLEncoder.encode(roomJID.toBareJID(), "UTF-8");
276 277
                // Log the event
                webManager.logEvent("created new MUC room "+roomName, "subject = "+roomSubject+"\nroomdesc = "+description+"\nroomname = "+naturalName+"\nmaxusers = "+maxUsers);
278 279
            }
            else {
280
                params = "success=true&roomJID=" + URLEncoder.encode(roomJID.toBareJID(), "UTF-8");
281 282
                // Log the event
                webManager.logEvent("updated MUC room "+roomName, "subject = "+roomSubject+"\nroomdesc = "+description+"\nroomname = "+naturalName+"\nmaxusers = "+maxUsers);
283 284
            }
            response.sendRedirect("muc-room-edit-form.jsp?" + params);
Gaston Dombiak's avatar
Gaston Dombiak committed
285 286 287 288
            return;
        }
    }
    else {
289 290 291 292 293 294 295 296 297 298
        if (create) {
            // TODO Make this default values configurable (see JM-79)
            maxUsers = "30";
            broadcastModerator = "true";
            broadcastParticipant = "true";
            broadcastVisitor = "true";
            whois = "moderator";
            publicRoom = "true";
            // Rooms created from the admin console are always persistent
            persistentRoom = "true";
299 300
            canChangeNick = "true";
            registrationEnabled = "true";
301 302 303 304 305 306 307 308 309 310 311 312 313
        }
        else {
            naturalName = room.getNaturalLanguageName();
            description = room.getDescription();
            roomSubject = room.getSubject();
            maxUsers = Integer.toString(room.getMaxUsers());
            broadcastModerator = Boolean.toString(room.canBroadcastPresence("moderator"));
            broadcastParticipant = Boolean.toString(room.canBroadcastPresence("participant"));
            broadcastVisitor = Boolean.toString(room.canBroadcastPresence("visitor"));
            password = room.getPassword();
            confirmPassword = room.getPassword();
            whois = (room.canAnyoneDiscoverJID() ? "anyone" : "moderator");
            publicRoom = Boolean.toString(room.isPublicRoom());
Gaston Dombiak's avatar
Gaston Dombiak committed
314
            persistentRoom = Boolean.toString(room.isPersistent());
315 316 317 318 319
            moderatedRoom = Boolean.toString(room.isModerated());
            membersOnly = Boolean.toString(room.isMembersOnly());
            allowInvites = Boolean.toString(room.canOccupantsInvite());
            changeSubject = Boolean.toString(room.canOccupantsChangeSubject());
            enableLog = Boolean.toString(room.isLogEnabled());
320 321 322
            reservedNick = Boolean.toString(room.isLoginRestrictedToNickname());
            canChangeNick = Boolean.toString(room.canChangeNickname());
            registrationEnabled = Boolean.toString(room.isRegistrationEnabled());
Gaston Dombiak's avatar
Gaston Dombiak committed
323 324 325 326
        }
    }
    // Formatter for dates
    DateFormat dateFormatter = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
Gaston Dombiak's avatar
Gaston Dombiak committed
327
    roomName = roomName == null ? "" : roomName;
Gaston Dombiak's avatar
Gaston Dombiak committed
328 329
%>

330
<html>
Ryan Graham's avatar
Ryan Graham committed
331 332
<head>
<% if (create) { %>
333
<title><fmt:message key="muc.room.edit.form.create.title"/></title>
Ryan Graham's avatar
Ryan Graham committed
334 335
<meta name="pageID" content="muc-room-create"/>
<% } else { %>
336
<title><fmt:message key="muc.room.edit.form.edit.title"/></title>
Ryan Graham's avatar
Ryan Graham committed
337 338
<meta name="subPageID" content="muc-room-edit-form"/>
<% } %>
339
<meta name="extraParams" content="<%= "roomJID="+(roomJID != null ? URLEncoder.encode(roomJID.toBareJID(), "UTF-8") : "")+"&create="+create %>"/>
Ryan Graham's avatar
Ryan Graham committed
340 341 342
<meta name="helpPage" content="view_group_chat_room_summary.html"/>
</head>
<body>
Gaston Dombiak's avatar
Gaston Dombiak committed
343

344 345 346 347 348 349
<%  if (!errors.isEmpty()) { %>

    <div class="jive-error">
    <table cellpadding="0" cellspacing="0" border="0">
    <tbody>
        <tr>
350
            <td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0" alt=""/></td>
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
            <td class="jive-icon-label">

            <% if (errors.get("roomconfig_roomname") != null) { %>
                <fmt:message key="muc.room.edit.form.valid_hint_name" />
            <% } else if (errors.get("roomconfig_roomdesc") != null) { %>
                <fmt:message key="muc.room.edit.form.valid_hint_description" />
            <% } else if (errors.get("roomconfig_maxusers") != null) { %>
                <fmt:message key="muc.room.edit.form.valid_hint_max_room" />
            <% } else if (errors.get("roomconfig_roomsecret2") != null) { %>
                <fmt:message key="muc.room.edit.form.new_password" />
            <% } else if (errors.get("roomconfig_whois") != null) { %>
                <fmt:message key="muc.room.edit.form.role" />
            <% } else if (errors.get("roomName") != null) { %>
                <fmt:message key="muc.room.edit.form.valid_hint" />
            <% } else if (errors.get("room_already_exists") != null) { %>
                <fmt:message key="muc.room.edit.form.error_created_id" />
            <% } else if (errors.get("not_enough_permissions") != null) { %>
                <fmt:message key="muc.room.edit.form.error_created_privileges" />
            <% } else if (errors.get("room_topic") != null) { %>
                <fmt:message key="muc.room.edit.form.valid_hint_subject" />
            <% } %>
            </td>
        </tr>
    </tbody>
    </table>
Ryan Graham's avatar
Ryan Graham committed
376
    </div><br>
377 378

<%  } else if (success || addsuccess) { %>
Gaston Dombiak's avatar
Gaston Dombiak committed
379 380 381 382

    <div class="jive-success">
    <table cellpadding="0" cellspacing="0" border="0">
    <tbody>
383
        <tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0" alt=""></td>
Gaston Dombiak's avatar
Gaston Dombiak committed
384 385 386
        <td class="jive-icon-label">
        <%  if (success) { %>

387
        <fmt:message key="muc.room.edit.form.edited" />
Gaston Dombiak's avatar
Gaston Dombiak committed
388 389 390

        <%  } else if (addsuccess) { %>

391
        <fmt:message key="muc.room.edit.form.created" />
Gaston Dombiak's avatar
Gaston Dombiak committed
392 393 394 395 396

        <%  } %>
        </td></tr>
    </tbody>
    </table>
397
    </div><br>
Gaston Dombiak's avatar
Gaston Dombiak committed
398 399 400

<%  } %>

401 402
<%  if (!create) { %>
    <p>
403
    <fmt:message key="muc.room.edit.form.info" />
404 405 406 407 408
    </p>
    <div class="jive-table">
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
    <thead>
        <tr>
409 410 411 412
            <th scope="col"><fmt:message key="muc.room.edit.form.room_id" /></th>
            <th scope="col"><fmt:message key="muc.room.edit.form.users" /></th>
            <th scope="col"><fmt:message key="muc.room.edit.form.on" /></th>
            <th scope="col"><fmt:message key="muc.room.edit.form.modified" /></th>
413 414 415 416 417
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><%= room.getName() %></td>
418
            <% if (room.getOccupantsCount() == 0) { %>
419
            <td><%= room.getOccupantsCount() %> / <%= room.getMaxUsers() %></td>
420
            <% } else { %>
421
            <td><a href="muc-room-occupants.jsp?roomJID=<%= URLEncoder.encode(roomJID.toBareJID(), "UTF-8")%>"><%= room.getOccupantsCount() %> / <%= room.getMaxUsers() %></a></td>
422
            <% } %>
423 424 425 426 427 428 429
            <td><%= dateFormatter.format(room.getCreationDate()) %></td>
            <td><%= dateFormatter.format(room.getModificationDate()) %></td>
        </tr>
    </tbody>
    </table>
    </div>
    <br>
430
    <p><fmt:message key="muc.room.edit.form.change_room" /></p>
431
<%  } else { %>
432
    <p><fmt:message key="muc.room.edit.form.persistent_room" /></p>
433 434 435
<%  } %>
<form action="muc-room-edit-form.jsp">
<% if (!create) { %>
436
    <input type="hidden" name="roomJID" value="<%= roomJID.toBareJID() %>">
437
<% } %>
Gaston Dombiak's avatar
Gaston Dombiak committed
438
<input type="hidden" name="save" value="true">
439 440
<input type="hidden" name="create" value="<%= create %>">
<input type="hidden" name="roomconfig_persistentroom" value="<%= persistentRoom %>">
Gaston Dombiak's avatar
Gaston Dombiak committed
441 442

    <table width="100%" border="0"> <tr>
443 444
         <td width="70%">
            <table width="100%" border="0">
Gaston Dombiak's avatar
Gaston Dombiak committed
445
                <tbody>
446 447
                <% if (create) { %>
                <tr>
448
                    <td><fmt:message key="muc.room.edit.form.room_id" />:</td>
449 450
                    <td><input type="text" name="roomName" value="<%= roomName %>">
                        <% if (webManager.getMultiUserChatManager().getMultiUserChatServicesCount() > 1) { %>
451
                        @<select name="mucName">
452
                        <% for (MultiUserChatService service : webManager.getMultiUserChatManager().getMultiUserChatServices()) { %>
453
                        <%      if (service.isHidden()) continue; %>
454
                        <option value="<%= service.getServiceName() %>"<%= service.getServiceDomain().equals(mucName) ? " selected='selected'" : "" %>><%= service.getServiceDomain() %></option>
455 456 457 458 459 460
                        <% } %>
                        </select>
                        <% } else { %>
                        @<%
                            // We only have one service, none-the-less, we have to run through the list to get the first
                            for (MultiUserChatService service : webManager.getMultiUserChatManager().getMultiUserChatServices()) {
461
                                if (service.isHidden()) {
462 463 464
                                    // Private and hidden, skip it.
                                    continue;
                                }
465
                                out.print("<input type='hidden' name='mucName' value='"+service.getServiceDomain()+"'/>"+service.getServiceDomain());
466 467 468 469
                                break;
                            }
                        %>
                        <% } %>
470 471
                    </td>
                </tr>
472 473 474 475 476
                <% } else { %>
                <tr>
                   <td><fmt:message key="muc.room.edit.form.service" />:</td>
                   <td><%= roomJID.getDomain() %></td>
               </tr>
477
                <% } %>
Gaston Dombiak's avatar
Gaston Dombiak committed
478
                 <tr>
479
                    <td><fmt:message key="muc.room.edit.form.room_name" />:</td>
Gaston Dombiak's avatar
Gaston Dombiak committed
480 481 482 483
                    <td><input type="text" name="roomconfig_roomname" value="<%= (naturalName == null ? "" : naturalName) %>">
                    </td>
                </tr>
                 <tr>
484
                    <td><fmt:message key="muc.room.edit.form.description" />:</td>
Gaston Dombiak's avatar
Gaston Dombiak committed
485 486 487 488
                    <td><input name="roomconfig_roomdesc" value="<%= (description == null ? "" : description) %>" type="text" size="40">
                    </td>
                </tr>
                 <tr>
489
                    <td><fmt:message key="muc.room.edit.form.topic" />:</td>
Gaston Dombiak's avatar
Gaston Dombiak committed
490 491 492 493
                    <td><input name="room_topic" value="<%= (roomSubject == null ? "" : roomSubject) %>" type="text" size="40">
                    </td>
                </tr>
                 <tr>
494
                    <td><fmt:message key="muc.room.edit.form.max_room" />:</td>
Gaston Dombiak's avatar
Gaston Dombiak committed
495 496 497 498 499 500
                    <td><select name="roomconfig_maxusers">
                            <option value="10" <% if ("10".equals(maxUsers)) out.write("selected");%>>10</option>
                            <option value="20" <% if ("20".equals(maxUsers)) out.write("selected");%>>20</option>
                            <option value="30" <% if ("30".equals(maxUsers)) out.write("selected");%>>30</option>
                            <option value="40" <% if ("40".equals(maxUsers)) out.write("selected");%>>40</option>
                            <option value="50" <% if ("50".equals(maxUsers)) out.write("selected");%>>50</option>
501
                            <option value="0" <% if ("0".equals(maxUsers)) out.write("selected");%>><fmt:message key="muc.room.edit.form.none" /></option>
Gaston Dombiak's avatar
Gaston Dombiak committed
502 503 504 505
                        </select>
                    </td>
                </tr>
                 <tr>
506
                    <td valign="top"><fmt:message key="muc.room.edit.form.broadcast" />:</td>
Gaston Dombiak's avatar
Gaston Dombiak committed
507 508
                    <td><fieldset>
                        <input name="roomconfig_presencebroadcast" type="checkbox" value="true" id="moderator" <% if ("true".equals(broadcastModerator)) out.write("checked");%>>
509
                        <LABEL FOR="moderator"><fmt:message key="muc.room.edit.form.moderator" /></LABEL>
Gaston Dombiak's avatar
Gaston Dombiak committed
510
                        <input name="roomconfig_presencebroadcast2" type="checkbox" value="true" id="participant" <% if ("true".equals(broadcastParticipant)) out.write("checked");%>>
511
                        <LABEL FOR="participant"><fmt:message key="muc.room.edit.form.participant" /></LABEL>
Gaston Dombiak's avatar
Gaston Dombiak committed
512
                        <input name="roomconfig_presencebroadcast3" type="checkbox" value="true" id="visitor" <% if ("true".equals(broadcastVisitor)) out.write("checked");%>>
513
                        <LABEL FOR="visitor"><fmt:message key="muc.room.edit.form.visitor" /></LABEL>
Gaston Dombiak's avatar
Gaston Dombiak committed
514 515 516
                        </fieldset></td>
                </tr>
                 <tr>
517
                    <td><fmt:message key="muc.room.edit.form.required_password" />:</td>
Gaston Dombiak's avatar
Gaston Dombiak committed
518 519 520
                    <td><input type="password" name="roomconfig_roomsecret" <% if(password != null) { %> value="<%= password %>" <% } %>></td>
                </tr>
                 <tr>
521
                    <td><fmt:message key="muc.room.edit.form.confirm_password" />:</td>
Gaston Dombiak's avatar
Gaston Dombiak committed
522 523 524 525
                    <td><input type="password" name="roomconfig_roomsecret2" <% if(confirmPassword != null) { %> value="<%= confirmPassword %>" <% } %>>
                    </td>
                </tr>
                 <tr>
526
                    <td><fmt:message key="muc.room.edit.form.discover_jid" />:</td>
Gaston Dombiak's avatar
Gaston Dombiak committed
527
                    <td><select name="roomconfig_whois">
528 529
                            <option value="moderator" <% if ("moderator".equals(whois)) out.write("selected");%>><fmt:message key="muc.room.edit.form.moderator" /></option>
                            <option value="anyone" <% if ("anyone".equals(whois)) out.write("selected");%>><fmt:message key="muc.room.edit.form.anyone" /></option>
Gaston Dombiak's avatar
Gaston Dombiak committed
530 531 532 533
                        </select>
                    </td>
                 </tr>
         </tbody>
534 535 536
         </table>

         </td>
Gaston Dombiak's avatar
Gaston Dombiak committed
537 538
        <td width="30%" valign="top" >
        <fieldset>
539
        <legend><fmt:message key="muc.room.edit.form.room_options" /></legend>
Gaston Dombiak's avatar
Gaston Dombiak committed
540 541 542 543
        <table width="100%"  border="0">
        <tbody>
            <tr>
                <td><input type="checkbox" name="roomconfig_publicroom" value="true" id="public" <% if ("true".equals(publicRoom)) out.write("checked");%>>
544
                    <LABEL FOR="public"><fmt:message key="muc.room.edit.form.list_room" /></LABEL></td>
Gaston Dombiak's avatar
Gaston Dombiak committed
545 546 547
            </tr>
            <tr>
                <td><input type="checkbox" name="roomconfig_moderatedroom" value="true" id="moderated" <% if ("true".equals(moderatedRoom)) out.write("checked");%>>
548
                    <LABEL FOR="moderated"><fmt:message key="muc.room.edit.form.room_moderated" /></LABEL></td>
Gaston Dombiak's avatar
Gaston Dombiak committed
549 550 551
            </tr>
            <tr>
                <td><input type="checkbox" name="roomconfig_membersonly" value="true" id="membersOnly" <% if ("true".equals(membersOnly)) out.write("checked");%>>
552
                    <LABEL FOR="membersOnly"><fmt:message key="muc.room.edit.form.moderated_member_only" /></LABEL></td>
Gaston Dombiak's avatar
Gaston Dombiak committed
553 554 555
            </tr>
            <tr>
                <td><input type="checkbox" name="roomconfig_allowinvites" value="true" id="allowinvites" <% if ("true".equals(allowInvites)) out.write("checked");%>>
556
                    <LABEL FOR="allowinvites"><fmt:message key="muc.room.edit.form.invite_other" /></LABEL></td>
Gaston Dombiak's avatar
Gaston Dombiak committed
557 558 559
            </tr>
            <tr>
                <td><input type="checkbox" name="roomconfig_changesubject" value="true" id="changesubject" <% if ("true".equals(changeSubject)) out.write("checked");%>>
560
                    <LABEL FOR="changesubject"><fmt:message key="muc.room.edit.form.change_subject" /></LABEL></td>
Gaston Dombiak's avatar
Gaston Dombiak committed
561
            </tr>
562 563 564 565 566 567 568 569 570 571 572 573
            <tr>
                <td><input type="checkbox" name="roomconfig_reservednick" value="true" id="reservednick" <% if ("true".equals(reservedNick)) out.write("checked");%>>
                    <LABEL FOR="reservednick"><fmt:message key="muc.room.edit.form.reservednick" /></LABEL></td>
            </tr>
            <tr>
                <td><input type="checkbox" name="roomconfig_canchangenick" value="true" id="canchangenick" <% if ("true".equals(canChangeNick)) out.write("checked");%>>
                    <LABEL FOR="canchangenick"><fmt:message key="muc.room.edit.form.canchangenick" /></LABEL></td>
            </tr>
            <tr>
                <td><input type="checkbox" name="roomconfig_registration" value="true" id="registration" <% if ("true".equals(registrationEnabled)) out.write("checked");%>>
                    <LABEL FOR="registration"><fmt:message key="muc.room.edit.form.registration" /></LABEL></td>
            </tr>
Gaston Dombiak's avatar
Gaston Dombiak committed
574 575
            <tr>
                <td><input type="checkbox" name="roomconfig_enablelogging" value="true" id="enablelogging" <% if ("true".equals(enableLog)) out.write("checked");%>>
576
                    <LABEL FOR="enablelogging"><fmt:message key="muc.room.edit.form.log" /></LABEL></td>
Gaston Dombiak's avatar
Gaston Dombiak committed
577
            </tr>
578
        </tbody>
Gaston Dombiak's avatar
Gaston Dombiak committed
579 580 581 582
        </table>
        </fieldset>
        </tr>
         <tr align="center">
583 584
            <td colspan="2"><input type="submit" name="Submit" value="<fmt:message key="global.save_changes" />">
            <input type="submit" name="cancel" value="<fmt:message key="global.cancel" />"></td>
Gaston Dombiak's avatar
Gaston Dombiak committed
585 586 587 588
        </tr>
    </table>
</form>

589 590
    </body>
</html>