venice-main-classic/web/format/sysadmin/find_user.jsp

158 lines
7.3 KiB
Plaintext

<%--
The contents of this file are subject to the Mozilla Public License Version 1.1
(the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
WARRANTY OF ANY KIND, either express or implied. See the License for the specific
language governing rights and limitations under the License.
The Original Code is the Venice Web Communities System.
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@users.sf.net>,
for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
--%>
<%@ page import = "java.util.*" %>
<%@ page import = "com.silverwrist.util.StringUtil" %>
<%@ page import = "com.silverwrist.venice.core.*" %>
<%@ page import = "com.silverwrist.venice.ui.view.AdminFindUserView" %>
<%@ taglib uri="/tlds/util" prefix="util" %>
<%
AdminFindUserView data = AdminFindUserView.get(request);
%>
<util:comment>Admin Find Users Menu</util:comment>
<util:header title="User Account Management"/>
<util:font color="content.fg" size="content"><util:link href="sysadmin/menu.js.vs" type="servlet">Return to
System Administration Menu</util:link></util:font><P>
<%-- Display the search form --%>
<util:comment>User Search Form</util:comment>
<util:form action="sysadmin/find_user.js.vs" type="servlet"><div class="content">
<input type="hidden" name="ofs" value="0" />
<util:font color="content.fg" size="content-heading"><b>Find Users:</b></util:font><br />
<util:font color="content.fg" size="content">
Display all users whose&nbsp;&nbsp;
<select name="field" size="1">
<option value="<%= SearchMode.FIELD_USER_NAME %>"
<% if (data.testField(SearchMode.FIELD_USER_NAME)) { %>selected="selected"<% } %> >user name</option>
<option value="<%= SearchMode.FIELD_USER_DESCRIPTION %>"
<% if (data.testField(SearchMode.FIELD_USER_DESCRIPTION)) { %>selected="selected"<% } %> >description</option>
<option value="<%= SearchMode.FIELD_USER_GIVEN_NAME %>"
<% if (data.testField(SearchMode.FIELD_USER_GIVEN_NAME)) { %>selected="selected"<% } %> >first name</option>
<option value="<%= SearchMode.FIELD_USER_FAMILY_NAME %>"
<% if (data.testField(SearchMode.FIELD_USER_FAMILY_NAME)) { %>selected="selected"<% } %> >last name</option>
</select><br />
<select name="mode" size="1">
<option value="<%= SearchMode.SEARCH_PREFIX %>"
<% if (data.testMode(SearchMode.SEARCH_PREFIX)) { %>selected="selected"<% } %> >starts with the string</option>
<option value="<%= SearchMode.SEARCH_SUBSTRING %>"
<% if (data.testMode(SearchMode.SEARCH_SUBSTRING)) { %>selected="selected"<% } %> >contains the string</option>
<option value="<%= SearchMode.SEARCH_REGEXP %>"
<% if (data.testMode(SearchMode.SEARCH_REGEXP)) { %>selected="selected"<% } %> >matches the regular
expression</option>
</select>
&nbsp;&nbsp;
<span class="cinput"><input type="text" class="cinput" name="term" size="32" maxlength="255"
value="<%= data.getTerm() %>" /></span><br />
<util:button id="search" type="input"/><br />
</util:font>
</div></util:form>
<% List results = data.getResults(); %>
<% if (results!=null) { %>
<util:comment>Display Search Results</util:comment>
<%
// Determine the number of results to display and whether to display a "next" button
int dcount = results.size();
boolean go_next = false;
if (dcount>data.getMaxResults())
{ // there's a "next"
dcount = data.getMaxResults();
go_next = true;
} // end if
%>
<hr />
<table width="100%" border="0" align="center"><tr valign="middle">
<td width="50%" align="left" class="content"><util:font color="content.fg" size="subhead">
<%-- The initial search results --%>
<b>Search Results</b>
<% if (data.getFindCount()>0) { %>
(Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of
<%= data.getFindCount() %>)
<% } else { %>(None)<% } %>
</util:font></td>
<td width="50%" align="right" class="content">
<% if (go_next || (data.getOffset()>0)) { %>
<%-- The navigational form that allows us to page through the results --%>
<util:comment>Navigational Form</util:comment>
<util:form action="sysadmin/find_user.js.vs" type="servlet"><div class="content">
<input type="hidden" name="ofs" value="<%= data.getOffset() %>" />
<input type="hidden" name="field" value="<%= data.getField() %>" />
<input type="hidden" name="mode" value="<%= data.getMode() %>" />
<input type="hidden" name="term" value="<%= data.getTerm() %>" />
<input type="hidden" name="fcount" value="<%= data.getFindCount() %>" />
<% if (data.getOffset()>0) { %>
<util:button id="previous" type="input"/>
<% } else { %>
<util:button id="_null_"/>
<% } // end if %>
&nbsp;&nbsp;
<% if (go_next) { %>
<util:button id="next" type="input"/>
<% } else { %>
<util:button id="_null_"/>
<% } // end if %>
</div></util:form>
<% } else { %>&nbsp;<% } %>
</td>
</tr></table><br />
<%-- Display the results of the search --%>
<table border="0" align="left" cellpadding="0" cellspacing="4">
<% for (int i=0; i<dcount; i++) { %>
<tr valign="top">
<td align="center" width="14"><util:stdbullet/></td>
<td align="left" class="content"><util:font color="content.fg" size="content">
<%
UserFound uf = (UserFound)(results.get(i));
String fullname = uf.getGivenName() + " " + uf.getFamilyName();
fullname = fullname.trim();
if (StringUtil.isStringEmpty(fullname))
fullname = uf.getName();
String whence = "";
if (!(StringUtil.isStringEmpty(uf.getLocality())))
{ // combine locations
if (!(StringUtil.isStringEmpty(uf.getRegion())))
whence = uf.getLocality() + ", " + uf.getRegion();
else
whence = uf.getLocality();
} // end if
else if (!(StringUtil.isStringEmpty(uf.getRegion())))
whence = uf.getRegion();
%>
<util:xlink>
<util:href type="servlet">user/<%= uf.getName() %></util:href>
<util:text><%= uf.getName() %></util:text>
</util:xlink><br />
<util:escape><%= fullname %></util:escape>,
from <util:escape><%= whence %></util:escape>
<% if (!(uf.getCountry().equals("XX"))) { %><%= uf.getCountry() %><% } %>
<% if (!StringUtil.isStringEmpty(uf.getDescription())) { %>
<br /><i><util:escape><%= uf.getDescription() %></util:escape></i>
<% } // end if %>
<br /><util:xlink>
<util:href type="servlet">sysadmin/modify_user.js.vs?uid=<%= uf.getUID() %></util:href>
<util:text>[Modify User]</util:text>
</util:xlink>
</util:font></td>
</tr>
<% } // end for %>
</table><br clear="left" />
<% } // end if (results found) %>
<%-- EOF --%>