muc-room-delete.jsp 3.82 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
--%>

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

<%@ 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 24 25 26
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
<% webManager.init(request, response, session, application, out ); %>

<%  // Get parameters //
    boolean cancel = request.getParameter("cancel") != null;
    boolean delete = request.getParameter("delete") != null;
27
    JID roomJID = new JID(ParamUtils.getParameter(request,"roomJID"));
Gaston Dombiak's avatar
Gaston Dombiak committed
28 29
    String alternateJID = ParamUtils.getParameter(request,"alternateJID");
    String reason = ParamUtils.getParameter(request,"reason");
30
    String roomName = roomJID.getNode();
Gaston Dombiak's avatar
Gaston Dombiak committed
31 32 33

    // Handle a cancel
    if (cancel) {
34
        response.sendRedirect("muc-room-summary.jsp?roomJID="+URLEncoder.encode(roomJID.toBareJID(), "UTF-8"));
Gaston Dombiak's avatar
Gaston Dombiak committed
35 36 37 38
        return;
    }

    // Load the room object
39
    MUCRoom room = webManager.getMultiUserChatManager().getMultiUserChatService(roomJID).getChatRoom(roomName);
Gaston Dombiak's avatar
Gaston Dombiak committed
40 41 42 43 44 45 46

    // Handle a room delete:
    if (delete) {
        // Delete the room
        if (room !=  null) {
            // If the room still exists then destroy it
            room.destroyRoom(alternateJID, reason);
47 48
            // Log the event
            webManager.logEvent("destroyed MUC room "+roomName, "reason = "+reason+"\nalt jid = "+alternateJID);
Gaston Dombiak's avatar
Gaston Dombiak committed
49 50
        }
        // Done, so redirect
51
        response.sendRedirect("muc-room-summary.jsp?roomJID="+URLEncoder.encode(roomJID.toBareJID(), "UTF-8")+"&deletesuccess=true");
Gaston Dombiak's avatar
Gaston Dombiak committed
52 53 54 55
        return;
    }
%>

56 57 58 59
<html>
    <head>
        <title><fmt:message key="muc.room.delete.title"/></title>
        <meta name="subPageID" content="muc-room-delete"/>
60
        <meta name="extraParams" content="<%= "roomJID="+URLEncoder.encode(roomJID.toBareJID(), "UTF-8") %>"/>
61 62 63
        <meta name="helpPage" content="delete_a_group_chat_room.html"/>
    </head>
    <body>
Gaston Dombiak's avatar
Gaston Dombiak committed
64 65

<p>
66
<fmt:message key="muc.room.delete.info" />
67
<b><a href="muc-room-edit-form.jsp?roomJID=<%= URLEncoder.encode(room.getJID().toBareJID(), "UTF-8") %>"><%= room.getJID().toBareJID() %></a></b>
68
<fmt:message key="muc.room.delete.detail" />
Gaston Dombiak's avatar
Gaston Dombiak committed
69 70 71
</p>

<form action="muc-room-delete.jsp">
72
<input type="hidden" name="roomJID" value="<%= roomJID.toBareJID() %>">
Gaston Dombiak's avatar
Gaston Dombiak committed
73 74

<fieldset>
75
    <legend><fmt:message key="muc.room.delete.destructon_title" /></legend>
Gaston Dombiak's avatar
Gaston Dombiak committed
76 77 78 79 80
    <div>
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
    <tbody>
        <tr>
            <td class="c1">
81
                <fmt:message key="muc.room.delete.room_id" />
Gaston Dombiak's avatar
Gaston Dombiak committed
82 83
            </td>
            <td>
84
                <%= room.getJID().toBareJID() %>
Gaston Dombiak's avatar
Gaston Dombiak committed
85 86 87 88
            </td>
        </tr>
        <tr>
            <td class="c1">
89
                <fmt:message key="muc.room.delete.reason" />
Gaston Dombiak's avatar
Gaston Dombiak committed
90 91 92 93 94 95 96
            </td>
            <td>
                <input type="text" size="50" maxlength="150" name="reason">
            </td>
        </tr>
        <tr>
            <td class="c1">
97
                <fmt:message key="muc.room.delete.alternate_address" />
Gaston Dombiak's avatar
Gaston Dombiak committed
98 99 100 101 102 103 104 105 106 107 108 109
            </td>
            <td>
                <input type="text" size="30" maxlength="150" name="alternateJID">
            </td>
        </tr>
    </tbody>
    </table>
    </div>
</fieldset>

<br><br>

110 111
<input type="submit" name="delete" value="<fmt:message key="muc.room.delete.destroy_room" />">
<input type="submit" name="cancel" value="<fmt:message key="global.cancel" />">
Gaston Dombiak's avatar
Gaston Dombiak committed
112 113
</form>

114 115
    </body>
</html>