Commit 1ab4129f authored by Bill Lynch's avatar Bill Lynch Committed by bill

More UI work


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@443 b35dd754-fafc-0310-a699-88a17e54d16e
parent e61f3196
......@@ -19,35 +19,18 @@
<%@ taglib uri="core" prefix="c"%>
<%-- Define Administration Bean --%>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<% admin.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 Administrators";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Group Chat Admin", "muc-sysadmins.jsp"));
pageinfo.setPageID("muc-sysadmin");
%>
<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);
String userJID = ParamUtils.getParameter(request,"userJID");
boolean add = ParamUtils.getBooleanParameter(request,"add");
boolean add = request.getParameter("add") != null;
boolean delete = ParamUtils.getBooleanParameter(request,"delete");
// Get muc server
MultiUserChatServer mucServer = (MultiUserChatServer)admin.getServiceLookup().lookup(MultiUserChatServer.class);
// Get the total system adminstrators count:
int userCount = mucServer.getSysadmins().size();
// Handle a save
Map errors = new HashMap();
if (add) {
......@@ -69,147 +52,110 @@
response.sendRedirect("muc-sysadmins.jsp?deletesuccess=true");
return;
}
%>
// paginator vars
int numPages = (int)Math.ceil((double)userCount/(double)range);
int curPage = (start/range) + 1;
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<% // Title of this page and breadcrumbs
String title = "Group Chat Administrators";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Group Chat Admin", "muc-sysadmins.jsp"));
pageinfo.setPageID("muc-sysadmin");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<table cellpadding="3" cellspacing="1" border="0" width="600">
<tr><td colspan="1">
<p>
Below is the list of system administrators of the group chat service. System administrators can
enter any groupchat room and their permissions are the same as the room owner.</td></tr>
</table>
<table cellpadding="3" cellspacing="1" border="0" width="600">
<tr class="tableHeader"><td colspan="8" align="left">User Summary</td></tr>
<tr><td colspan="1" class="text">
Total Users: <%= userCount %>.
<% if (numPages > 1) { %>
Showing <%= (start+1) %>-<%= (start+range) %>.
<% } %>
</td></tr>
<% if (numPages > 1) { %>
<tr><td colspan="1" class="text">
Pages:
[
<% for (int pageIndex=0; pageIndex<numPages; pageIndex++) {
String sep = ((pageIndex+1)<numPages) ? " " : "";
boolean isCurrent = (pageIndex+1) == curPage;
%>
<a href="muc-sysadmins.jsp?start=<%= (pageIndex*range) %>"
class="<%= ((isCurrent) ? "jive-current" : "") %>"
><%= (pageIndex+1) %></a><%= sep %>
<% } %>
]
</td></tr>
<% } %>
</table>
enter any groupchat room and their permissions are the same as the room owner.
</p>
<% if ("true".equals(request.getParameter("deletesuccess"))) { %>
<p class="jive-success-text">
User removed from the list successfully.
</p>
<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">
User removed from the list successfully.
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<% if ("true".equals(request.getParameter("addsuccess"))) { %>
<p class="jive-success-text">
User added to the list successfully.
</p>
<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">
User added to the list successfully.
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<form action="muc-sysadmins.jsp" method="post">
<table class="jive-table" cellpadding="3" cellspacing="1" border="0" width="400">
<tr>
<th nowrap align="left">User</th>
<th>Delete</th>
</tr>
<% // Print the list of system administrators
int max = start + range;
max = (max > mucServer.getSysadmins().size() ? mucServer.getSysadmins().size() : max);
Iterator users = mucServer.getSysadmins().subList(start, max).iterator();
if (!users.hasNext()) {
%>
<tr>
<td align="center" colspan="2">
<br>
The list of system administrators is empty.
<br><br>
</td>
</tr>
<%
}
int i = start;
while (users.hasNext()) {
userJID = (String)users.next();
i++;
%>
<tr>
<td width="90%" align="left">
<%= userJID %>
</td>
<td width="10%" align="center">
<a href="muc-sysadmins.jsp?userJID=<%= userJID %>&delete=true"
title="Click to delete..."
onclick="return confirm('Are you sure you want to remove this user from the list?');"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td>
</tr>
<%
}
%>
</table>
<% if (numPages > 1) { %>
<p>
Pages:
[
<% for (int pageIndex=0; pageIndex<numPages; pageIndex++) {
String sep = ((pageIndex+1)<numPages) ? " " : "";
boolean isCurrent = (pageIndex+1) == curPage;
%>
<a href="muc-sysadmins.jsp?start=<%= (pageIndex*range) %>"
class="<%= ((isCurrent) ? "jive-current" : "") %>"
><%= (pageIndex+1) %></a><%= sep %>
<% } %>
]
</p>
<fieldset>
<legend>Add Admin User</legend>
<div>
User (enter JID):
<input type="text" name="userJID" size="30" maxlength="100" value="<%= (userJID != null ? userJID : "") %>">
<input type="submit" name="add" value="Add">
</div>
</fieldset>
<% } %>
</form>
<form action="muc-sysadmins.jsp">
<input type="hidden" name="add" value="true">
<table cellpadding="3" cellspacing="1" border="0" width="400">
<tr>
<td class="c1">
Enter bare JID of user to add:
</td>
<td>
<input type="text" size="30" maxlength="150" name="userJID">
<% if (errors.get("userJID") != null) { %>
<br>
<span class="jive-error-text">
Please enter a valid bare JID (e.g. johndoe@company.org).
</span>
<fieldset>
<legend>Admin Users</legend>
<div>
<div class="jive-table" style="width:400px;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th width="99%">User</th>
<th width="1%">Remove</th>
</tr>
</thead>
<tbody>
<% if (mucServer.getSysadmins().size() == 0) { %>
<tr>
<td colspan="2">
No admins specified, use the form above to add one.
</td>
</tr>
<% } %>
<% for (String user : mucServer.getSysadmins()) { %>
<tr>
<td width="99%">
<%= user %>
</td>
<td width="1%" align="center">
<a href="muc-sysadmins.jsp?userJID=<%= user %>&delete=true"
title="Click to delete..."
onclick="return confirm('Are you sure you want to remove this user from the list?');"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td>
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
</fieldset>
<% } %>
</td>
</tr>
</table>
<br>
<input type="submit" value="Add">
<jsp:include page="bottom.jsp" flush="true" />
\ No newline at end of file
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