Commit 2e849c01 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Initial version. JM-77


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@699 b35dd754-fafc-0310-a699-88a17e54d16e
parent 13968f72
This diff is collapsed.
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2004 Jive Software. All rights reserved.
-
- This software is the proprietary information of Jive Software.
- Use is subject to license terms.
--%>
<%@ page import="org.jivesoftware.util.ParamUtils,
org.jivesoftware.admin.*,
java.util.*,
org.jivesoftware.messenger.muc.MUCRoom,
org.jivesoftware.messenger.*,
org.jivesoftware.messenger.auth.UnauthorizedException,
org.xmpp.packet.JID"
errorPage="error.jsp"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
<% webManager.init(request, response, session, application, out); %>
<% // Get parameters
boolean save = ParamUtils.getBooleanParameter(request,"save");
String roomName = ParamUtils.getParameter(request,"roomName");
// Handle a cancel
if (request.getParameter("cancel") != null) {
response.sendRedirect("muc-room-summary.jsp");
return;
}
// Handle a save
Map errors = new HashMap();
if (save) {
// do validation
if (roomName == null || roomName.contains("@")) {
errors.put("roomName","roomName");
}
MUCRoom room = null;
// If everything is ok so far then try to create a new room (with default configuration)
if (errors.size() == 0) {
// Check that the requested room ID is available
room = webManager.getMultiUserChatServer().getChatRoom(roomName);
if (room != null) {
errors.put("room_already_exists", "room_already_exists");
}
else {
// Try to create a new room
JID address = new JID(webManager.getUser().getUsername(), webManager.getServerInfo().getName(), null);
try {
room = webManager.getMultiUserChatServer().getChatRoom(roomName, address);
// Check if the room was created concurrently by another user
if (!room.getOwners().contains(address.toBareJID())) {
errors.put("room_already_exists", "room_already_exists");
}
}
catch (UnauthorizedException e) {
// This user is not allowed to create rooms
errors.put("not_enough_permissions", "not_enough_permissions");
}
}
}
if (errors.size() == 0) {
// Creation good, so redirect
response.sendRedirect("muc-room-edit-form.jsp?addsuccess=true&roomconfig_persistentroom=true&roomName=" + roomName);
return;
}
}
%>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<% // Title of this page and breadcrumbs
String title = "Room Creation";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "muc-room-create.jsp"));
pageinfo.setPageID("muc-room-create");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<p>Use the form below to create a new room. After the room has been created you will need to set the
room configuration to unlock the room.</p>
<% if (errors.containsKey("room_already_exists") || errors.containsKey("not_enough_permissions")) { %>
<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 (errors.containsKey("room_already_exists")) { %>
Error creating the room. A room with the request ID already exists.
<% } else if (errors.containsKey("not_enough_permissions")) { %>
Error creating the room. You do not have enough privileges to create rooms.
<% } %>
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<form action="muc-room-create.jsp">
<input type="hidden" name="save" value="true">
<table cellpadding="3" cellspacing="1" border="0" width="350">
<tr class="jive-even">
<td width="70">
Room ID:
</td>
<td><input type="text" name="roomName" value="<%= roomName != null ? roomName : ""%>">
<% if (errors.get("roomName") != null) { %>
<span class="jive-error-text">
Please enter a valid ID. Do not include the service name in the ID.
</span>
<% } %>
</td>
</tr>
</table>
<br>
<input type="submit" name="Submit" value="Create Room">
<input type="submit" name="cancel" value="Cancel">
</form>
<jsp:include page="bottom.jsp" flush="true" />
\ No newline at end of file
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2004 Jive Software. All rights reserved.
-
- This software is the proprietary information of Jive Software.
- Use is subject to license terms.
--%>
<%@ page import="org.jivesoftware.util.*,
org.jivesoftware.admin.*,
org.jivesoftware.messenger.muc.MUCRoom"
errorPage="error.jsp"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<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;
String roomName = ParamUtils.getParameter(request,"roomName");
String alternateJID = ParamUtils.getParameter(request,"alternateJID");
String reason = ParamUtils.getParameter(request,"reason");
// Handle a cancel
if (cancel) {
response.sendRedirect("muc-room-summary.jsp");
return;
}
// Load the room object
MUCRoom room = webManager.getMultiUserChatServer().getChatRoom(roomName);
// Handle a room delete:
if (delete) {
// Delete the room
if (room != null) {
// If the room still exists then destroy it
room.destroyRoom(alternateJID, reason);
}
// Done, so redirect
response.sendRedirect("muc-room-summary.jsp?deletesuccess=true");
return;
}
%>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<% // Title of this page and breadcrumbs
String title = "Destroy Room";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "muc-room-delete.jsp?roomName="+roomName));
pageinfo.setSubPageID("muc-room-delete");
pageinfo.setExtraParams("roomName="+roomName);
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<p>
Are you sure you want to destroy the room
<b><a href="muc-room-edit-form.jsp?roomName=<%= room.getName() %>"><%= room.getName() %></a></b>
from the system? You may specify a reason for the room destruction and an alternative room
address that will replace this room. This information will be sent to room occupants.
</p>
<form action="muc-room-delete.jsp">
<input type="hidden" name="roomName" value="<%= roomName %>">
<fieldset>
<legend>Destruction Details</legend>
<div>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td class="c1">
Room ID:
</td>
<td>
<%= room.getName() %>
</td>
</tr>
<tr>
<td class="c1">
Reason:
</td>
<td>
<input type="text" size="50" maxlength="150" name="reason">
</td>
</tr>
<tr>
<td class="c1">
Alternate Room Address:
</td>
<td>
<input type="text" size="30" maxlength="150" name="alternateJID">
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br><br>
<input type="submit" name="delete" value="Destroy Room">
<input type="submit" name="cancel" value="Cancel">
</form>
<jsp:include page="bottom.jsp" flush="true" />
This diff is collapsed.
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2004 Jive Software. All rights reserved.
-
- This software is the proprietary information of Jive Software.
- Use is subject to license terms.
--%>
<%@ page import="org.jivesoftware.util.*,
org.jivesoftware.messenger.muc.spi.*,
java.text.DateFormat,
org.jivesoftware.admin.*,
org.jivesoftware.messenger.muc.MUCRoom,
java.util.*"
errorPage="error.jsp"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<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
String title = "Group Chat Rooms";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "muc-room-summary.jsp"));
pageinfo.setPageID("muc-room-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 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>
Below is an overview of the Group Chat Rooms in the system. From here you can view the rooms, edit their
properties, and create new rooms.
</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">
Room destroyed successfully.
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<p>
Total Rooms: <%= roomsCount %>,
<% if (numPages > 1) { %>
Showing <%= (start+1) %>-<%= (maxRoomIndex) %>,
<% } %>
Sorted by Room ID
</p>
<% if (numPages > 1) { %>
<p>
Pages:
[
<% 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>
<th>Room ID</th>
<th>Description</th>
<th>Lock</th>
<th>Users</th>
<th>Edit</th>
<th>Destroy</th>
</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">
No rooms in the Group Chat service.
</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>
<td width="45%" align="center" valign="middle">
<%= room.getName() %>
</td>
<td width="45%" align="center" valign="middle">
<%= room.getDescription() %>
</td>
<td width="1%" align="center">
<% if (room.isLocked()) { %>
<img src="images/lock-16x16.gif" width="16" height="16" border="0" alt="Room is locked">
<% } else { %>
<img src="images/lock-open-16x16.gif" width="16" height="16" border="0" alt="Room is unlocked">
<% } %>
</td>
<td width="1%" align="center">
<%= room.getOccupantsCount() %> / <%= room.getMaxUsers() %>
</td>
<td width="1%" align="center">
<a href="muc-room-edit-form.jsp?roomName=<%= room.getName() %>"
title="Click to edit..."
><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;">
<a href="muc-room-delete.jsp?roomName=<%= room.getName() %>"
title="Click to delete..."
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td>
</tr>
<%
}
%>
</tbody>
</table>
</div>
<% if (numPages > 1) { %>
<p>
Pages:
[
<% 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>
<% } %>
<jsp:include page="bottom.jsp" flush="true" />
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment