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 @@ ...@@ -19,35 +19,18 @@
<%@ taglib uri="core" prefix="c"%> <%@ taglib uri="core" prefix="c"%>
<%-- Define Administration Bean --%>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" /> <jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<% admin.init(request, response, session, application, out ); %> <% 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 <% // Get parameters
int start = ParamUtils.getIntParameter(request,"start",0);
int range = ParamUtils.getIntParameter(request,"range",15);
String userJID = ParamUtils.getParameter(request,"userJID"); String userJID = ParamUtils.getParameter(request,"userJID");
boolean add = ParamUtils.getBooleanParameter(request,"add"); boolean add = request.getParameter("add") != null;
boolean delete = ParamUtils.getBooleanParameter(request,"delete"); boolean delete = ParamUtils.getBooleanParameter(request,"delete");
// Get muc server // Get muc server
MultiUserChatServer mucServer = (MultiUserChatServer)admin.getServiceLookup().lookup(MultiUserChatServer.class); MultiUserChatServer mucServer = (MultiUserChatServer)admin.getServiceLookup().lookup(MultiUserChatServer.class);
// Get the total system adminstrators count:
int userCount = mucServer.getSysadmins().size();
// Handle a save // Handle a save
Map errors = new HashMap(); Map errors = new HashMap();
if (add) { if (add) {
...@@ -69,147 +52,110 @@ ...@@ -69,147 +52,110 @@
response.sendRedirect("muc-sysadmins.jsp?deletesuccess=true"); response.sendRedirect("muc-sysadmins.jsp?deletesuccess=true");
return; return;
} }
%>
// paginator vars <jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
int numPages = (int)Math.ceil((double)userCount/(double)range); <% // Title of this page and breadcrumbs
int curPage = (start/range) + 1; 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"> <p>
<tr><td colspan="1">
Below is the list of system administrators of the group chat service. System administrators can 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> enter any groupchat room and their permissions are the same as the room owner.
</table> </p>
<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>
<% if ("true".equals(request.getParameter("deletesuccess"))) { %> <% if ("true".equals(request.getParameter("deletesuccess"))) { %>
<p class="jive-success-text"> <div class="jive-success">
User removed from the list successfully. <table cellpadding="0" cellspacing="0" border="0">
</p> <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"))) { %> <% if ("true".equals(request.getParameter("addsuccess"))) { %>
<p class="jive-success-text"> <div class="jive-success">
User added to the list successfully. <table cellpadding="0" cellspacing="0" border="0">
</p> <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"> <fieldset>
<tr> <legend>Add Admin User</legend>
<th nowrap align="left">User</th> <div>
<th>Delete</th> User (enter JID):
</tr> <input type="text" name="userJID" size="30" maxlength="100" value="<%= (userJID != null ? userJID : "") %>">
<% // Print the list of system administrators <input type="submit" name="add" value="Add">
int max = start + range; </div>
max = (max > mucServer.getSysadmins().size() ? mucServer.getSysadmins().size() : max); </fieldset>
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>
<% } %> </form>
<form action="muc-sysadmins.jsp"> <br>
<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) { %>
<span class="jive-error-text"> <fieldset>
Please enter a valid bare JID (e.g. johndoe@company.org). <legend>Admin Users</legend>
</span> <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" /> <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