Commit 6233ff36 authored by Ryan Graham's avatar Ryan Graham Committed by ryang

initial check-in


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1358 b35dd754-fafc-0310-a699-88a17e54d16e
parent 8d371dd4
<%@ page import="java.util.*,
java.net.URLEncoder,
org.jivesoftware.util.*,
org.jivesoftware.messenger.PresenceManager,
org.jivesoftware.messenger.user.*,
org.jivesoftware.admin.*,
org.xmpp.packet.Presence"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager"/>
<% webManager.init(request, response, session, application, out); %>
<%
String criteria = ParamUtils.getParameter(request, "criteria");
UserManager userManager = webManager.getUserManager();
Set<String> searchFields = userManager.getSearchFields();
List<User> users = new ArrayList<User>();
for (String searchField : searchFields) {
boolean searchValue = ParamUtils.getBooleanParameter(request, searchField, false);
if (searchValue) {
Collection<User> foundUsers = userManager.findUsers(new HashSet<String>(Arrays.asList(searchField)), criteria);
// Filter out all duplicate users.
for (User user : foundUsers) {
if (!users.contains(user)) {
users.add(user);
}
}
}
}
%>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean"/>
<%
String title = "Advance User Search";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "advance-user-search.jsp"));
pageinfo.setPageID("advance-user-search");
%>
<jsp:include page="top.jsp" flush="true"/>
<jsp:include page="title.jsp" flush="true"/>
<form name="f" action="advance-user-search.jsp">
<input type="hidden" name="search" value="true"/>
<fieldset>
<legend>Search for User</legend>
<div>
<p>
The following fields are available for search. Wildcard (*) characters are allowed as part the of query.
</p>
<table cellpadding="3" cellspacing="1" border="0" width="600">
<tr class="c1">
<td width="1%" nowrap>Search:</td>
<td class="c2">
<input type="text" name="criteria" value="<%= (criteria != null ? criteria : "") %>" size="30" maxlength="75"/>
</td>
</tr>
<%
for (String searchField : searchFields) {
%>
<tr class="c1">
<td width="1%" nowrap><%=searchField %>:</td>
<td class="c2">
<input type="checkbox" checked="checked" name="<%=searchField %>"/>
</td>
</tr>
<%
}
%>
<tr><td colspan="2" nowrap><input type="submit" name="search" value="Search"/></td>
</tr>
</table>
</fieldset>
</form>
<% if (criteria != null) { %>
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th>&nbsp;</th>
<th nowrap>Online</th>
<th nowrap>Username</th>
<th nowrap>Name</th>
<th nowrap>Email</th>
<th nowrap>Edit</th>
<th nowrap>Delete</th>
</tr>
</thead>
<tbody>
<% if (users.isEmpty()) { %>
<tr>
<td align="center" colspan="7">No users found.</td>
</tr>
<%
} else {
int i = 0;
PresenceManager presenceManager = webManager.getPresenceManager();
for (User user : users) {
i++;
%>
<tr class="jive-<%= (((i%2)==0) ? "even" : "odd") %>">
<td width="1%">
<%= i %>
</td>
<td width="1%" align="center" valign="middle">
<% if (presenceManager.isAvailable(user)) {
Presence presence = presenceManager.getPresence(user);
%>
<% if (presence.getShow() == null) { %>
<img src="images/user-green-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="user.properties.available" />">
<% } %>
<% if (presence.getShow() == Presence.Show.chat) { %>
<img src="images/user-green-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="session.details.chat_available" />">
<% } %>
<% if (presence.getShow() == Presence.Show.away) { %>
<img src="images/user-yellow-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="session.details.away" />">
<% } %>
<% if (presence.getShow() == Presence.Show.xa) { %>
<img src="images/user-yellow-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="session.details.extended" />">
<% } %>
<% if (presence.getShow() == Presence.Show.dnd) { %>
<img src="images/user-red-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="session.details.not_disturb" />">
<% } %>
<% } else { %>
<img src="images/user-clear-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="user.properties.offline" />">
<% } %>
</td>
<td width="30%">
<a href="../../user-properties.jsp?username=<%= URLEncoder.encode(user.getUsername(), "UTF-8") %>"><%= user.getUsername() %></a>
</td>
<td width="35">
<%= user.getName() %> &nbsp;
</td>
<td width="35%">
<%= user.getEmail() %> &nbsp;
</td>
<td width="1%" align="center">
<a href="../../user-edit-form.jsp?username=<%= URLEncoder.encode(user.getUsername(), "UTF-8") %>"
title="<fmt:message key="user.summary.click_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="../../user-delete.jsp?username=<%= URLEncoder.encode(user.getUsername(), "UTF-8") %>"
title="<fmt:message key="user.summary.click_delete" />"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td>
</tr>
<%
}
}
%>
</tbody>
</table>
</div>
<% } %>
<jsp:include page="bottom.jsp" flush="true"/>
<%@ page import="java.util.*,
org.jivesoftware.admin.*,
org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.plugin.SearchPlugin,
org.jivesoftware.util.*"
errorPage="error.jsp"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<%-- Define Administration Bean --%>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<c:set var="admin" value="${admin.manager}" />
<% admin.init(request, response, session, application, out ); %>
<% // Get parameters
boolean save = request.getParameter("save") != null;
boolean success = request.getParameter("success") != null;
String searchName = ParamUtils.getParameter(request, "searchname");
boolean searchEnabled = ParamUtils.getBooleanParameter(request, "searchEnabled");
SearchPlugin plugin = (SearchPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("search");
// Handle a save
Map errors = new HashMap();
if (save) {
if (searchName == null || searchName.indexOf('.') >= 0 || searchName.trim().length() < 1) {
errors.put("searchname", "searchname");
}
if (errors.size() == 0) {
plugin.setServiceEnabled(searchEnabled);
plugin.setServiceName(searchName.trim());
response.sendRedirect("search-props-edit-form.jsp?success=true");
return;
}
}
else {
searchName = plugin.getServiceName();
}
if (errors.size() == 0) {
searchName = plugin.getServiceName();
}
searchEnabled = plugin.getServiceEnabled();
%>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%
String title = "Search Service Properties";
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "search-props-edit-form.jsp"));
pageinfo.setPageID("search-props-edit-form");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<p>
Use the form below to edit search service settings, these settings do not affect the user search in the admin console.<br>
</p>
<% if (success) { %>
<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">
Service properties edited successfully.
</td></tr>
</tbody>
</table>
</div><br>
<% } else if (errors.size() > 0) { %>
<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">
Error setting the service name.
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<form action="search-props-edit-form.jsp?save" method="post">
<fieldset>
<legend>Service Enabled</legend>
<div>
<p>
You can choose to enable or disable user searches from clients. Disabling this services does not prevent user searches from the admin console.
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td width="1%">
<input type="radio" name="searchEnabled" value="true" id="rb01"
<%= ((searchEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01"><b>Enabled</b></label> - Clients will be able to search for users.
</td>
</tr>
<tr>
<td width="1%">
<input type="radio" name="searchEnabled" value="false" id="rb02"
<%= ((!searchEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb02"><b>Disabled</b></label> - Clients will not be able to search for users.
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br><br>
<fieldset>
<legend>Service Name</legend>
<div>
<table cellpadding="3" cellspacing="0" border="0">
<tr>
<td class="c1">
Search service name:
</td>
<td>
<input type="text" size="30" maxlength="150" name="searchname" value="<%= (searchName != null ? searchName : "") %>">.<%=XMPPServer.getInstance().getServerInfo().getName() %>
<% if (errors.containsKey("searchname")) { %>
<span class="jive-error-text">
<br>Please enter a valid name.
</span>
<% } %>
</td>
</tr>
</table>
</div>
</fieldset>
<br><br>
<input type="submit" value="Save Properties">
</form>
<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