Commit df7944c4 authored by Ryan Graham's avatar Ryan Graham Committed by ryang

* Added the ability to disable specific fields from being searched.

* Added internationalization (i18n) support.
* Updated UI to match later versions of Wildfire.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@7393 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1bd98d8d
......@@ -2,7 +2,7 @@
<html>
<head>
<title>Search Plugin Changelog</title>
<title>Search Plugin Changelog</title>
<style type="text/css">
BODY {
font-size : 100%;
......@@ -44,9 +44,16 @@
Search Plugin Changelog
</h1>
<p><b>1.3.0</b> -- February 28, 2007</p>
<ul>
<li>Added the ability to disable specific fields from being searched.</li>
<li>Added internationalization (i18n) support.</li>
<li>Updated UI to match later versions of Wildfire.</li>
</ul>
<p><b>1.2.1</b> -- September 7, 2006</p>
<ul>
<li>Search results no longer shows edit and delete if users are read-only.</li>
<li>Search results no longer shows edit and delete if users are read-only.</li>
</ul>
<p><b>1.2.1</b> -- October 06, 2006</p>
......
......@@ -3,26 +3,26 @@
<plugin>
<class>org.jivesoftware.wildfire.plugin.SearchPlugin</class>
<name>Search</name>
<description>Provides support for Jabber Search (JEP-0055)</description>
<description>Provides support for Jabber Search (XEP-0055)</description>
<author>Ryan Graham</author>
<version>1.2.1</version>
<date>10/06/2006</date>
<version>1.3.0</version>
<date>02/28/2007</date>
<minServerVersion>3.1.0</minServerVersion>
<adminconsole>
<tab id="tab-server">
<sidebar id="sidebar-server-settings">
<item id="search-props-edit-form" name="Search Properties"
url="search-props-edit-form.jsp"
description="Edit search service properties" />
</sidebar>
<adminconsole>
<tab id="tab-server">
<sidebar id="sidebar-server-settings">
<item id="search-props-edit-form" name="Search Properties"
url="search-props-edit-form.jsp"
description="Edit search service properties" />
</sidebar>
</tab>
<tab id="tab-users">
<sidebar id="sidebar-users">
<item id="advance-user-search" name="Advanced User Search"
url="advance-user-search.jsp"
description="Advanced user search" />
</sidebar>
<tab id="tab-users">
<sidebar id="sidebar-users">
<item id="advance-user-search" name="Advanced User Search"
url="advance-user-search.jsp"
description="Advanced user search" />
</sidebar>
</tab>
</adminconsole>
</plugin>
\ No newline at end of file
</plugin>
......@@ -2,7 +2,7 @@
<html>
<head>
<title>Search Plugin Readme</title>
<title>Search Plugin Readme</title>
<style type="text/css">
BODY {
font-size : 100%;
......@@ -44,15 +44,13 @@ Search Plugin Readme
</h1>
<h2>Overview</h2>
<p>
The search plugin adds Jabber Search <a href="http://www.jabber.org/jeps/jep-0055.html">JEP-0055</a>
The search plugin adds Jabber Search <a href="http://www.xmpp.org/extensions/xep-0055.html">XEP-0055</a>
capabilities to Wildfire. This plugin is designed to work with various Jabber clients to allow
other users to search for users currently registered on the same server they are.
</p>
<h2>Installation</h2>
<p>
Copy the file, &quot;search.jar&quot; into the plugins directory of your Wildfire installation. The plugin will
then be automatically deployed. To upgrade to a new version: 1) go to the plugin screen of the Admin
......@@ -61,15 +59,16 @@ copy the new search.jar into the plugins directory of your Wildfire installation
</p>
<h2>Configuration</h2>
<p>
The search plugin is configured via the "Search Service Properites" sidebar item located under the "Server" tab
in the Wildfire Admin Console. By default, after the search plugin has been deployed all of its features
are enabled. To enable or disable the plugin select the appropirate radio button and then click on the
"Save Properties" button. To change the service name enter the new name for the service and then click on the
"Save Properties" button
"Save Properties" button. To disable a field from being searched by clients un-check the corresponding checkbox
and click on the "Save Properties" button.
</p>
<h2>Using the Plugin</h2>
<p>
Use of this plugin varies from client to client; however, basic instructions for accessing the search screen
for some of the more popular clients are listed below. On the search screen there is a single
......@@ -78,13 +77,16 @@ and/or email that you want to find. As an example, if you want to find your frie
if his last name is spelled "Smith" or "Smyth", try entering "John S*" in the search field and making
sure the name checkbox is selected. The "*" symbol acts as a wildcard so your search might return not
only "John Smith" but all the users whose name begins with "John S", i.e. "John Slater", "John Salazar", etc.
</p>
<li>
Admin Console - Navigate to the "Advance User Search" sidebar item located in under the "Users/Groups" tab.
</li>
<br>
<li>
Spark - Use the search field along the bottom portion of the main Spark window.
</li>
<br>
<li>
Exodus - After clicking on the magnifying glass with the red "+" sign, a screen will appear displaying the search
service that will be used which will be used. Click on the "Next" button and the search screen will
......@@ -109,6 +111,6 @@ view the search screen.
Psi - On the lower left-hand corner of the client, click on the main Psi toolbar, select "Service Discovery", and click on your username. After the service discovery windowappears, select the "User Search" entry and click on
the magnifying glass at the top of the window to view the search screen.
</li>
<br>
</p>
</body>
</html>
login.title=Admin Console
advance.user.search.title=User Search
advance.user.search.search_user=Search For User
advance.user.search.search=Search
advance.user.search.details=The following fields are available for searching. Wildcard (*) characters are allowed as part the of query.
advance.user.search.more_options=More Options
advance.user.search.less_options=Less Options
advance.user.search.users_found=Users Found
advance.user.search.online=Online
advance.user.search.username=Username
advance.user.search.name=Name
advance.user.search.created=Created
advance.user.search.edit=Edit
advance.user.search.delete=Delete
advance.user.search.no_users=No users in the system.
advance.user.search.available=Available
advance.user.search.chat_available=Free to chat
advance.user.search.away=Away
advance.user.search.extended=Extended away
advance.user.search.offline=Offline
search.props.edit.form.title=Search Service Properties
search.props.edit.form.directions=Use the form below to edit search service settings, these settings do not affect the user search in the admin console.
search.props.edit.form.successful_edit=Service properties edited successfully.
search.props.edit.form.error=Error setting the service name.
search.props.edit.form.service_enabled=Service Enabled
search.props.edit.form.service_enabled_directions=You can choose to enable or disable user searches from clients. Disabling this services does not prevent user searches from the admin console.
search.props.edit.form.enabled=Enabled
search.props.edit.form.enabled_details=Clients will be able to search for users.
search.props.edit.form.disabled=Disabled
search.props.edit.form.disabled_details=Clients will not be able to search for users.
search.props.edit.form.service_name=Service Name
search.props.edit.form.search_service_name=Search service Name
search.props.edit.form.search_service_name_details=Please enter a valid name.
search.props.edit.form.searchable_fields=Searchable Fields
search.props.edit.form.searchable_fields_details=Use the form below to enable which fields users can search on.
search.props.edit.form.fields=Fields
search.props.edit.form.save_properties=Save Properties
search.service_unavailable=This service is unavailable.
<%@ page import="java.util.*,
java.net.URLEncoder,
org.jivesoftware.util.*,
org.jivesoftware.wildfire.PresenceManager,
java.net.URLEncoder,
org.jivesoftware.util.*,
org.jivesoftware.wildfire.PresenceManager,
org.jivesoftware.wildfire.user.*,
org.jivesoftware.wildfire.XMPPServer,
org.xmpp.packet.Presence"
......@@ -12,7 +12,7 @@
<html>
<head>
<title>User Search</title>
<title><fmt:message key="advance.user.search.title" /></title>
<meta name="pageID" content="advance-user-search"/>
</head>
<body>
......@@ -48,52 +48,51 @@
<form name="f" action="advance-user-search.jsp">
<input type="hidden" name="search" value="true"/>
<input type="hidden" name="moreOptions" value="<%=moreOptions %>"/>
<fieldset>
<legend><fmt:message key="user.search.search_user" /></legend>
<div>
<table cellpadding="3" cellspacing="1" border="0" width="600">
<div class="jive-contentBoxHeader"><fmt:message key="advance.user.search.search_user" /></div>
<div class="jive-contentBox">
<table cellpadding="3" cellspacing="1" border="0" width="600">
<tr class="c1">
<td width="1%" colspan="2" nowrap>
Search:
<fmt:message key="advance.user.search.search" />
&nbsp;<input type="text" name="criteria" value="<%=(criteria != null ? criteria : "") %>" size="30" maxlength="75"/>
&nbsp;<input type="submit" name="search" value="<fmt:message key="user.search.search" />"/>
</td>
&nbsp;<input type="submit" name="search" value="<fmt:message key="advance.user.search.search" />"/>
</td>
</tr>
<% if (moreOptions) { %>
<tr class="c1">
<td width="1%" colspan="2" nowrap>Wildcard (*) characters are allowed as part the of query. The following fields are available for searching:</td>
<td width="1%" colspan="2" nowrap><fmt:message key="advance.user.search.details" />:</td>
</tr>
<% for (String searchField : searchFields) { %>
<tr class="c1">
<td width="1%" nowrap><%=searchField %>:</td>
<td class="c2">
<% if (criteria == null) { %>
<input type="checkbox" checked name="<%=searchField %>"/>
<% } else { %>
<input type="checkbox" <%=selectedFields.contains(searchField) ? "checked" : "" %> name="<%=searchField %>"/>
<% } %>
</td>
</tr>
<% } %>
<tr>
<td nowrap>&raquo;&nbsp;<a href="advance-user-search.jsp?moreOptions=false">Less Options</a></td>
<td nowrap>&raquo;&nbsp;<a href="advance-user-search.jsp?moreOptions=false"><fmt:message key="advance.user.search.less_options" /></a></td>
</tr>
<% } else { %>
<tr>
<td nowrap>&raquo;&nbsp;<a href="advance-user-search.jsp?moreOptions=true">More Options</a></td>
<td nowrap>&raquo;&nbsp;<a href="advance-user-search.jsp?moreOptions=true"><fmt:message key="advance.user.search.more_options" /></a></td>
</tr>
<% } %>
</table>
</div>
</fieldset>
</form>
</div>
</form>
<% if (criteria != null) { %>
<p>
Users Found: <%=users.size() %>
<fmt:message key="advance.user.search.users_found" />: <%=users.size() %>
</p>
<div class="jive-table">
......@@ -101,14 +100,14 @@ Users Found: <%=users.size() %>
<thead>
<tr>
<th>&nbsp;</th>
<th nowrap><fmt:message key="session.details.online" /></th>
<th nowrap><fmt:message key="user.create.username" /></th>
<th nowrap><fmt:message key="user.create.name" /></th>
<th nowrap><fmt:message key="user.summary.created" /></th>
<th nowrap><fmt:message key="advance.user.search.online" /></th>
<th nowrap><fmt:message key="advance.user.search.username" /></th>
<th nowrap><fmt:message key="advance.user.search.name" /></th>
<th nowrap><fmt:message key="advance.user.search.created" /></th>
<% // Don't allow editing or deleting if users are read-only.
if (!UserManager.getUserProvider().isReadOnly()) { %>
<th nowrap><fmt:message key="user.summary.edit" /></th>
<th nowrap><fmt:message key="global.delete" /></th>
<th nowrap><fmt:message key="advance.user.search.edit" /></th>
<th nowrap><fmt:message key="advance.user.search.delete" /></th>
<% } %>
</tr>
</thead>
......@@ -116,14 +115,14 @@ Users Found: <%=users.size() %>
<% if (users.isEmpty()) { %>
<tr>
<td align="center" colspan="7"><fmt:message key="user.summary.not_user" /></td>
<td align="center" colspan="7"><fmt:message key="advance.user.search.no_users" /></td>
</tr>
<%
<%
} else {
int i = 0;
PresenceManager presenceManager = XMPPServer.getInstance().getPresenceManager();
for (User user : users) {
i++;
%>
......@@ -136,26 +135,26 @@ Users Found: <%=users.size() %>
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" />"> <%
}
%> <img src="images/user-green-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="advance.user.search.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" />"> <%
%> <img src="images/user-green-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="advance.user.search.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" />"> <%
}
%> <img src="images/user-yellow-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="advance.user.search.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" />"> <%
}
%> <img src="images/user-yellow-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="advance.user.search.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" />"> <%
%> <img src="images/user-red-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="advance.user.search.not_disturb" />"> <%
}
} else {
%> <img src="images/user-clear-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="user.properties.offline" />"> <%
} else {
%> <img src="images/user-clear-16x16.gif" width="16" height="16" border="0" alt="<fmt:message key="advance.user.search.offline" />"> <%
}
%>
</td>
......
<%@ page import="java.util.*,
org.jivesoftware.wildfire.XMPPServer,
org.jivesoftware.wildfire.plugin.SearchPlugin,
org.jivesoftware.wildfire.plugin.SearchPlugin,
org.jivesoftware.wildfire.user.*,
org.jivesoftware.util.*"
%>
......@@ -11,9 +12,9 @@
boolean save = request.getParameter("save") != null;
boolean success = request.getParameter("success") != null;
String searchName = ParamUtils.getParameter(request, "searchname");
boolean searchEnabled = ParamUtils.getBooleanParameter(request, "searchEnabled");
boolean searchEnabled = ParamUtils.getBooleanParameter(request, "searchEnabled");
SearchPlugin plugin = (SearchPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("search");
SearchPlugin plugin = (SearchPlugin) XMPPServer.getInstance().getPluginManager().getPlugin("search");
// Handle a save
Map errors = new HashMap();
......@@ -23,8 +24,17 @@
}
if (errors.size() == 0) {
plugin.setServiceEnabled(searchEnabled);
plugin.setServiceEnabled(searchEnabled);
plugin.setServiceName(searchName.trim());
ArrayList<String> excludedFields = new ArrayList<String>();
for (String field : UserManager.getInstance().getSearchFields()) {
if (!ParamUtils.getBooleanParameter(request, field)) {
excludedFields.add(field);
}
}
plugin.setExcludedFields(excludedFields);
response.sendRedirect("search-props-edit-form.jsp?success=true");
return;
}
......@@ -38,17 +48,18 @@
}
searchEnabled = plugin.getServiceEnabled();
Collection<String> searchableFields = plugin.getFilteredSearchFields();
%>
<html>
<head>
<title>Search Service Properties</title>
<title><fmt:message key="search.props.edit.form.title" /></title>
<meta name="pageID" content="search-props-edit-form"/>
</head>
<body>
<p>
Use the form below to edit search service settings, these settings do not affect the user search in the admin console.<br>
<fmt:message key="search.props.edit.form.directions" />
</p>
<% if (success) { %>
......@@ -58,7 +69,7 @@ Use the form below to edit search service settings, these settings do not affect
<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.
<fmt:message key="search.props.edit.form.successful_edit" />
</td></tr>
</tbody>
</table>
......@@ -71,7 +82,7 @@ Use the form below to edit search service settings, these settings do not affect
<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.
<fmt:message key="search.props.edit.form.error" />
</td></tr>
</tbody>
</table>
......@@ -81,11 +92,10 @@ Use the form below to edit search service settings, these settings do not affect
<form action="search-props-edit-form.jsp?save" method="post">
<fieldset>
<legend>Service Enabled</legend>
<div>
<div class="jive-contentBoxHeader"><fmt:message key="search.props.edit.form.service_enabled" /></div>
<div class="jive-contentBox">
<p>
You can choose to enable or disable user searches from clients. Disabling this services does not prevent user searches from the admin console.
<fmt:message key="search.props.edit.form.service_enabled_directions" />
</p>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
......@@ -95,7 +105,7 @@ Use the form below to edit search service settings, these settings do not affect
<%= ((searchEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01"><b>Enabled</b></label> - Clients will be able to search for users.
<label for="rb01"><b><fmt:message key="search.props.edit.form.enabled" /></b></label> - <fmt:message key="search.props.edit.form.enabled_details" />
</td>
</tr>
<tr>
......@@ -104,24 +114,21 @@ Use the form below to edit search service settings, these settings do not affect
<%= ((!searchEnabled) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb02"><b>Disabled</b></label> - Clients will not be able to search for users.
<label for="rb02"><b><fmt:message key="search.props.edit.form.disabled" /></b></label> - <fmt:message key="search.props.edit.form.disabled_details" />
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
</div>
<br><br>
<br>
<fieldset>
<legend>Service Name</legend>
<div>
<div class="jive-contentBoxHeader"><fmt:message key="search.props.edit.form.service_name" /></div>
<div class="jive-contentBox">
<table cellpadding="3" cellspacing="0" border="0">
<tr>
<td class="c1">
Search service name:
<fmt:message key="search.props.edit.form.search_service_name" />:
</td>
<td>
<input type="text" size="30" maxlength="150" name="searchname" value="<%= (searchName != null ? searchName : "") %>">.<%=XMPPServer.getInstance().getServerInfo().getName() %>
......@@ -129,19 +136,39 @@ Use the form below to edit search service settings, these settings do not affect
<% if (errors.containsKey("searchname")) { %>
<span class="jive-error-text">
<br>Please enter a valid name.
<br><fmt:message key="search.props.edit.form.search_service_name_details" />
</span>
<% } %>
</td>
</tr>
</table>
</div>
</fieldset>
</div>
<br>
<div class="jive-contentBoxHeader"><fmt:message key="search.props.edit.form.searchable_fields" /></div>
<div class="jive-contentBox">
<p>
<fmt:message key="search.props.edit.form.searchable_fields_details" />
</p>
<table class="jive-table" cellpadding="3" cellspacing="0" border="0" width="400">
<tr>
<th align="center" width="1%"><fmt:message key="search.props.edit.form.enabled" /></th>
<th align="left" width="99%"><fmt:message key="search.props.edit.form.fields" /></th>
</tr>
<% for (String field : UserManager.getInstance().getSearchFields()) { %>
<tr>
<td align="center" width="1%"><input type="checkbox" <%=searchableFields.contains(field) ? "checked" : "" %> name="<%=field %>"></td>
<td align="left" width="99%"><%=field %></td>
</tr>
<% } %>
</table>
</div>
<br><br>
<br>
<input type="submit" value="Save Properties">
<input type="submit" value="<fmt:message key="search.props.edit.form.save_properties" />">
</form>
</body>
......
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