added the Member List functionality to communities
This commit is contained in:
parent
98d949fd74
commit
5b17952eee
13
etc/web.xml
13
etc/web.xml
|
@ -254,6 +254,14 @@
|
|||
<servlet-class>com.silverwrist.venice.servlets.Gateway</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>memberredirect</servlet-name>
|
||||
<description>
|
||||
Displays the members list for a community (internal redirect to CommunityOperations).
|
||||
</description>
|
||||
<servlet-class>com.silverwrist.venice.servlets.MemberRedirect</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<!-- the following are test servlets, they should go away -->
|
||||
|
||||
<servlet>
|
||||
|
@ -387,6 +395,11 @@
|
|||
<url-pattern>/gw</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>memberredirect</servlet-name>
|
||||
<url-pattern>/members</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- the following are test servlets, they should go away -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>testformdata</servlet-name>
|
||||
|
|
|
@ -1368,7 +1368,8 @@ INSERT INTO refsigftr (ftr_code, is_default, is_locked, is_hidden, require_read,
|
|||
(0, 1, 1, 1, 0, 4900, 0, 'PROF', 'Profile', 'sigprofile'),
|
||||
(1, 1, 1, 1, 0, 5000, 57000, 'ADMN', 'Administration', 'sigadmin'),
|
||||
(2, 0, 1, 1, 0, 10000, 63000, 'SYSA', 'System Administration', 'sysadmin'),
|
||||
(3, 1, 0, 0, 1, 500, 0, 'CONF', 'Conferences', 'confops');
|
||||
(3, 1, 0, 0, 1, 500, 0, 'CONF', 'Conferences', 'confops'),
|
||||
(4, 1, 1, 0, 1, 4800, 0, 'MEMB', 'Members', 'members');
|
||||
|
||||
# Create the initial advertisements (quotes).
|
||||
INSERT INTO adverts (imagepath) VALUES
|
||||
|
@ -1456,7 +1457,7 @@ INSERT INTO propcomm (cid, ndx, data) VALUES (1, 0, '');
|
|||
|
||||
# Insert the desired features for the 'Administration' SIG.
|
||||
INSERT INTO sigftrs (sigid, ftr_code)
|
||||
VALUES (1, 0), (1, 1), (1, 2), (1, 3);
|
||||
VALUES (1, 0), (1, 1), (1, 2), (1, 3), (1, 4);
|
||||
|
||||
# Make the 'Administrator' user the host of the 'Administration' SIG. Also, the Administrator
|
||||
# cannot unjoin the community.
|
||||
|
@ -1490,7 +1491,7 @@ INSERT INTO propcomm (cid, ndx, data) VALUES (2, 0, '');
|
|||
|
||||
# Insert the desired features for La Piazza.
|
||||
INSERT INTO sigftrs (sigid, ftr_code)
|
||||
VALUES (2, 0), (2, 1), (2, 3);
|
||||
VALUES (2, 0), (2, 1), (2, 3), (2, 4);
|
||||
|
||||
# Make 'Anonymous Honyak' a member of La Piazza. This is important because new users will
|
||||
# have the membership list of Anonymous Honyak copied to their account on signup (but with
|
||||
|
@ -1558,7 +1559,7 @@ INSERT INTO contacts (contactid, locality, country, owner_uid, owner_sigid)
|
|||
VALUES (6, 'Anywhere', 'US', 2, 3);
|
||||
INSERT INTO propcomm (cid, ndx, data) VALUES (3, 0, '');
|
||||
INSERT INTO sigftrs (sigid, ftr_code)
|
||||
VALUES (3, 0), (3, 1), (3, 3);
|
||||
VALUES (3, 0), (3, 1), (3, 3), (3, 4);
|
||||
INSERT INTO sigmember (sigid, uid, granted_lvl, locked)
|
||||
VALUES (3, 2, 58500, 1);
|
||||
|
||||
|
@ -1573,6 +1574,6 @@ INSERT INTO contacts (contactid, locality, country, owner_uid, owner_sigid)
|
|||
VALUES (7, 'Anywhere', 'US', 2, 4);
|
||||
INSERT INTO propcomm (cid, ndx, data) VALUES (4, 0, '');
|
||||
INSERT INTO sigftrs (sigid, ftr_code)
|
||||
VALUES (4, 0), (4, 1), (4, 3);
|
||||
VALUES (4, 0), (4, 1), (4, 3), (4, 4);
|
||||
INSERT INTO sigmember (sigid, uid, granted_lvl, locked)
|
||||
VALUES (4, 2, 58500, 1);
|
||||
|
|
|
@ -213,6 +213,29 @@ public class CommunityOperations extends VeniceServlet
|
|||
|
||||
} // end if ("I" command)
|
||||
|
||||
if (cmd.equals("M"))
|
||||
{ // "M" = List Members
|
||||
CommunityContext comm = getCommunityParameter(request,user,true,"top");
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Member list for community: " + comm.getName());
|
||||
|
||||
try
|
||||
{ // return the view dialog
|
||||
ViewCommunityMembers view = new ViewCommunityMembers(engine,comm);
|
||||
view.doInitialList();
|
||||
changeMenuCommunity(request,comm);
|
||||
return view;
|
||||
|
||||
} // end try
|
||||
catch (DataException de)
|
||||
{ // unable to get community members list
|
||||
return new ErrorBox("Database Error","Database error getting community members list: "
|
||||
+ de.getMessage(),"top");
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if ("M" command)
|
||||
|
||||
// this is an error!
|
||||
logger.error("invalid command to CommunityOperations.doGet: " + cmd);
|
||||
return new ErrorBox("Internal Error","Invalid command to CommunityOperations.doGet","top");
|
||||
|
@ -230,6 +253,7 @@ public class CommunityOperations extends VeniceServlet
|
|||
if (cmd.equals("J"))
|
||||
{ // "J" = Join Community (requires community parameter)
|
||||
CommunityContext comm = getCommunityParameter(request,user,true,"top");
|
||||
setMyLocation(request,"sigops?cmd=J&sig=" + comm.getCommunityID());
|
||||
JoinKeyDialog dlg = makeJoinKeyDialog();
|
||||
|
||||
if (dlg.isButtonClicked(request,"cancel")) // cancel - go back to community opening page
|
||||
|
@ -336,6 +360,7 @@ public class CommunityOperations extends VeniceServlet
|
|||
if (cmd.equals("I"))
|
||||
{ // "I" = Send invitation (requires community parameter)
|
||||
CommunityContext comm = getCommunityParameter(request,user,true,"top");
|
||||
setMyLocation(request,"sigops?cmd=I&sig=" + comm.getCommunityID());
|
||||
String on_error = "sig/" + comm.getAlias();
|
||||
|
||||
if (isImageButtonClicked(request,"cancel")) // cancel - go back to community opening page
|
||||
|
@ -376,6 +401,37 @@ public class CommunityOperations extends VeniceServlet
|
|||
|
||||
} // end if ("I" command)
|
||||
|
||||
if (cmd.equals("M"))
|
||||
{ // "M" = Display Members List
|
||||
CommunityContext comm = getCommunityParameter(request,user,true,"top");
|
||||
setMyLocation(request,"sigops?cmd=M&sig=" + comm.getCommunityID());
|
||||
String on_error = "sig/" + comm.getAlias();
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Member list for community: " + comm.getName());
|
||||
|
||||
try
|
||||
{ // generate the members list
|
||||
ViewCommunityMembers view = new ViewCommunityMembers(engine,comm);
|
||||
view.doSearch(request);
|
||||
changeMenuCommunity(request,comm);
|
||||
return view;
|
||||
|
||||
} // end try
|
||||
catch (ValidationException ve)
|
||||
{ // validation error - throw it back to the user
|
||||
return new ErrorBox(null,ve.getMessage() + " Please try again.",
|
||||
"sigops?cmd=M&sig=" + comm.getCommunityID());
|
||||
|
||||
} // end catch
|
||||
catch (DataException de)
|
||||
{ // unable to get community members list
|
||||
return new ErrorBox("Database Error","Database error getting community members list: "
|
||||
+ de.getMessage(),on_error);
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if ("M" command)
|
||||
|
||||
// this is an error!
|
||||
logger.error("invalid command to CommunityOperations.doPost: " + cmd);
|
||||
return new ErrorBox("Internal Error","Invalid command to CommunityOperations.doPost","top");
|
||||
|
@ -383,3 +439,6 @@ public class CommunityOperations extends VeniceServlet
|
|||
} // end doVenicePost
|
||||
|
||||
} // end class CommunityOperations
|
||||
|
||||
|
||||
|
||||
|
|
63
src/com/silverwrist/venice/servlets/MemberRedirect.java
Normal file
63
src/com/silverwrist/venice/servlets/MemberRedirect.java
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* 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@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.servlets;
|
||||
|
||||
import java.io.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.apache.log4j.*;
|
||||
import com.silverwrist.venice.servlets.format.RenderConfig;
|
||||
import com.silverwrist.venice.servlets.format.RenderData;
|
||||
|
||||
public class MemberRedirect extends HttpServlet
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private static Category logger = Category.getInstance(MemberRedirect.class);
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Overrides from class HttpServlet
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getServletInfo()
|
||||
{
|
||||
String rc = "MemberRedirect servlet - Generates the member list for the community\n"
|
||||
+ "Part of the Venice Web Communities System\n";
|
||||
return rc;
|
||||
|
||||
} // end getServletInfo
|
||||
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Hit MemberRedirect");
|
||||
ServletContext ctxt = getServletContext();
|
||||
RenderData rdat = RenderConfig.createRenderData(ctxt,request,response);
|
||||
String url = "sigops?cmd=M&sig=" + request.getParameter("sig");
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Bouncing to URL: " + url);
|
||||
rdat.redirectTo(url);
|
||||
|
||||
} // end doGet
|
||||
|
||||
} // end class MemberRedirect
|
|
@ -34,6 +34,9 @@ public class TopicPosts implements JSPRender
|
|||
|
||||
private static Category logger = Category.getInstance(TopicPosts.class);
|
||||
|
||||
private static int SCALING_NUM = 1;
|
||||
private static int SCALING_DENOM = 2;
|
||||
|
||||
// Attribute name for request attribute
|
||||
protected static final String ATTR_NAME = "com.silverwrist.venice.content.TopicPosts";
|
||||
|
||||
|
@ -98,6 +101,9 @@ public class TopicPosts implements JSPRender
|
|||
HashSet saw_users = new HashSet();
|
||||
if (conf.displayPostPictures() && user.displayPostPictures())
|
||||
{ // build up the mapping of UIDs to photo URLs
|
||||
Dimension psz = engine.getUserPhotoSize();
|
||||
photo_size = new Dimension((psz.width * SCALING_NUM) / SCALING_DENOM,
|
||||
(psz.height * SCALING_NUM) / SCALING_DENOM);
|
||||
photo_size = engine.getUserPhotoSize();
|
||||
uid_photos = new HashMap();
|
||||
|
||||
|
|
|
@ -0,0 +1,332 @@
|
|||
/*
|
||||
* 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@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.servlets.format;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import com.silverwrist.venice.ValidationException;
|
||||
import com.silverwrist.venice.core.*;
|
||||
|
||||
public class ViewCommunityMembers implements JSPRender, SearchMode
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// Attribute name for request attribute
|
||||
protected static final String ATTR_NAME = "com.silverwrist.venice.content.ViewCommunityMembers";
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private VeniceEngine engine; // engine context
|
||||
private CommunityContext comm; // community context
|
||||
private List display_list = null; // list of members to display
|
||||
private boolean simple_list = false; // simple list?
|
||||
private int field = -1; // search field
|
||||
private int mode = -1; // search mode
|
||||
private String term = null; // search term
|
||||
private int offset = 0; // search result offset
|
||||
private int find_count = -1; // search results count
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public ViewCommunityMembers(VeniceEngine engine, CommunityContext comm)
|
||||
{
|
||||
this.engine = engine;
|
||||
this.comm = comm;
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal functions
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private static int getParamInt(ServletRequest request, String name, int default_val)
|
||||
{
|
||||
String str = request.getParameter(name);
|
||||
if (str==null)
|
||||
return -1;
|
||||
|
||||
try
|
||||
{ // parse the integer value
|
||||
return Integer.parseInt(str);
|
||||
|
||||
} // end try
|
||||
catch (NumberFormatException nfe)
|
||||
{ // in case of conversion error, return default
|
||||
return default_val;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end getParamInt
|
||||
|
||||
private static boolean isImageButtonClicked(ServletRequest request, String name)
|
||||
{
|
||||
String val = request.getParameter(name + ".x");
|
||||
return (val!=null);
|
||||
|
||||
} // end isImageButtonClicked
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External static functions
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public static ViewCommunityMembers retrieve(ServletRequest request)
|
||||
{
|
||||
return (ViewCommunityMembers)(request.getAttribute(ATTR_NAME));
|
||||
|
||||
} // end retrieve
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface VeniceContent
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getPageTitle(RenderData rdat)
|
||||
{
|
||||
return "Members of Community " + comm.getName();
|
||||
|
||||
} // end getPageTitle
|
||||
|
||||
public String getPageQID()
|
||||
{
|
||||
return null;
|
||||
|
||||
} // end getPageQID
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface JSPRender
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void store(ServletRequest request)
|
||||
{
|
||||
request.setAttribute(ATTR_NAME,this);
|
||||
|
||||
} // end store
|
||||
|
||||
public String getTargetJSPName()
|
||||
{
|
||||
return "view_member.jsp";
|
||||
|
||||
} // end getTargetJSPName
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void doInitialList() throws DataException
|
||||
{
|
||||
display_list = comm.getMemberList();
|
||||
simple_list = true;
|
||||
term = "";
|
||||
offset = 0;
|
||||
find_count = display_list.size();
|
||||
|
||||
} // end doInitialList
|
||||
|
||||
public void doSearch(ServletRequest request) throws ValidationException, DataException
|
||||
{
|
||||
// Get the "simple list" parameter.
|
||||
int slp = getParamInt(request,"sl",1);
|
||||
simple_list = (slp==1);
|
||||
|
||||
if (simple_list)
|
||||
{ // Retrieve the offset and find count parameters.
|
||||
offset = getParamInt(request,"ofs",0);
|
||||
find_count = getParamInt(request,"fcount",-1);
|
||||
|
||||
// Adjust the search return offset based on the command button click.
|
||||
int count = getNumResultsDisplayed();
|
||||
if (isImageButtonClicked(request,"search"))
|
||||
throw new ValidationException("Invalid button click."); // this can't happen
|
||||
else if (isImageButtonClicked(request,"previous"))
|
||||
{ // adjust the offset in the reverse direction
|
||||
offset -= count;
|
||||
if (offset<0)
|
||||
offset = 0;
|
||||
|
||||
} // end else if
|
||||
else if (isImageButtonClicked(request,"next"))
|
||||
offset += count; // go forwards instead
|
||||
else
|
||||
throw new ValidationException("Unable to determine what action triggered the form.");
|
||||
|
||||
// Get the member list and offset it if necessary.
|
||||
List tmp = comm.getMemberList();
|
||||
if (find_count<0)
|
||||
find_count = tmp.size();
|
||||
if (offset>0)
|
||||
display_list = tmp.subList(offset,tmp.size());
|
||||
else
|
||||
display_list = tmp;
|
||||
|
||||
term = ""; // null out the search term
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // Validate the search field parameter.
|
||||
field = getParamInt(request,"field",FIELD_USER_NAME);
|
||||
if ( (field!=FIELD_USER_NAME) && (field!=FIELD_USER_DESCRIPTION) && (field!=FIELD_USER_GIVEN_NAME)
|
||||
&& (field!=FIELD_USER_FAMILY_NAME))
|
||||
throw new ValidationException("The field search parameter is not valid.");
|
||||
|
||||
// Validate the search mode parameter.
|
||||
mode = getParamInt(request,"mode",SEARCH_PREFIX);
|
||||
if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP))
|
||||
throw new ValidationException("The search mode parameter is not valid.");
|
||||
|
||||
// Retrieve the search term parameter.
|
||||
term = request.getParameter("term");
|
||||
if (term==null)
|
||||
term = "";
|
||||
|
||||
// Retrieve the offset and find count parameters.
|
||||
offset = getParamInt(request,"ofs",0);
|
||||
find_count = getParamInt(request,"fcount",-1);
|
||||
|
||||
// Adjust the search return offset based on the command button click.
|
||||
int count = getNumResultsDisplayed();
|
||||
if (isImageButtonClicked(request,"search"))
|
||||
offset = 0;
|
||||
else if (isImageButtonClicked(request,"previous"))
|
||||
{ // adjust the offset in the reverse direction
|
||||
offset -= count;
|
||||
if (offset<0)
|
||||
offset = 0;
|
||||
|
||||
} // end else if
|
||||
else if (isImageButtonClicked(request,"next"))
|
||||
offset += count; // go forwards instead
|
||||
else
|
||||
throw new ValidationException("Unable to determine what action triggered the form.");
|
||||
|
||||
// Perform the search!
|
||||
display_list = comm.searchForMembers(field,mode,term,offset,count);
|
||||
if (find_count<0)
|
||||
find_count = comm.getSearchMemberCount(field,mode,term);
|
||||
|
||||
} // end else
|
||||
|
||||
} // end doSearch
|
||||
|
||||
public int getNumResultsDisplayed()
|
||||
{
|
||||
return engine.getStdNumSearchResults();
|
||||
|
||||
} // end getNumResultsDisplayed
|
||||
|
||||
public String getCommunityName()
|
||||
{
|
||||
return comm.getName();
|
||||
|
||||
} // end getCommunityName
|
||||
|
||||
public int getCommunityID()
|
||||
{
|
||||
return comm.getCommunityID();
|
||||
|
||||
} // end getCommunityID
|
||||
|
||||
public boolean getSimpleList()
|
||||
{
|
||||
return simple_list;
|
||||
|
||||
} // end getSimpleList
|
||||
|
||||
public int getSimpleListParam()
|
||||
{
|
||||
return (simple_list ? 1 : 0);
|
||||
|
||||
} // end getSimpleListParam
|
||||
|
||||
public int getSearchField()
|
||||
{
|
||||
return field;
|
||||
|
||||
} // end getSearchField
|
||||
|
||||
public int getSearchMode()
|
||||
{
|
||||
return mode;
|
||||
|
||||
} // end getSearchMode
|
||||
|
||||
public boolean searchFieldIs(int value)
|
||||
{
|
||||
return (field==value);
|
||||
|
||||
} // end searchFieldIs
|
||||
|
||||
public boolean searchModeIs(int value)
|
||||
{
|
||||
return (mode==value);
|
||||
|
||||
} // end searchModeIs
|
||||
|
||||
public String getSearchTerm()
|
||||
{
|
||||
return term;
|
||||
|
||||
} // end getSearchTerm
|
||||
|
||||
public int getFindCount()
|
||||
{
|
||||
return find_count;
|
||||
|
||||
} // end getFindCount
|
||||
|
||||
public int getOffset()
|
||||
{
|
||||
return offset;
|
||||
|
||||
} // end getOffset
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return display_list.size();
|
||||
|
||||
} // end getSize
|
||||
|
||||
public boolean displayList()
|
||||
{
|
||||
if ((display_list==null) || (display_list.size()==0))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
} // end displayList
|
||||
|
||||
public UserFound getItem(int ndx)
|
||||
{
|
||||
return (UserFound)(display_list.get(ndx));
|
||||
|
||||
} // end getItem
|
||||
|
||||
} // end class ViewCommunityMembers
|
143
web/format/view_member.jsp
Normal file
143
web/format/view_member.jsp
Normal file
|
@ -0,0 +1,143 @@
|
|||
<%--
|
||||
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@silcom.com>,
|
||||
for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
Copyright (C) 2001 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.security.Capability" %>
|
||||
<%@ page import = "com.silverwrist.venice.servlets.Variables" %>
|
||||
<%@ page import = "com.silverwrist.venice.servlets.format.*" %>
|
||||
<%
|
||||
ViewCommunityMembers data = ViewCommunityMembers.retrieve(request);
|
||||
Variables.failIfNull(data);
|
||||
RenderData rdat = RenderConfig.createRenderData(application,request,response);
|
||||
%>
|
||||
<% rdat.writeContentHeader(out,"Members of Community:",data.getCommunityName()); %>
|
||||
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %><B>Find members of community
|
||||
"<%= data.getCommunityName() %>":</B></FONT><P>
|
||||
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("sigops") %>"><DIV CLASS="content">
|
||||
<INPUT TYPE="HIDDEN" NAME="sig" VALUE="<%= data.getCommunityID() %>">
|
||||
<INPUT TYPE="HIDDEN" NAME="cmd" VALUE="M">
|
||||
<INPUT TYPE="HIDDEN" NAME="sl" VALUE="0">
|
||||
<INPUT TYPE="HIDDEN" NAME="ofs" VALUE="0">
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
Display all community members whose
|
||||
<SELECT NAME="field" SIZE=1>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_NAME %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_NAME)) { %>SELECTED<% } %> >user name</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_DESCRIPTION %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_DESCRIPTION)) { %>SELECTED<% } %> >description</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_GIVEN_NAME %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_GIVEN_NAME)) { %>SELECTED<% } %> >first name</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_FAMILY_NAME %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_FAMILY_NAME)) { %>SELECTED<% } %> >last name</OPTION>
|
||||
</SELECT><BR>
|
||||
|
||||
<SELECT NAME="mode" SIZE=1>
|
||||
<OPTION VALUE="<%= SearchMode.SEARCH_PREFIX %>"
|
||||
<% if (data.searchModeIs(SearchMode.SEARCH_PREFIX)) { %>SELECTED<% } %> >starts with the string</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.SEARCH_SUBSTRING %>"
|
||||
<% if (data.searchModeIs(SearchMode.SEARCH_SUBSTRING)) { %>SELECTED<% } %> >contains the string</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.SEARCH_REGEXP %>"
|
||||
<% if (data.searchModeIs(SearchMode.SEARCH_REGEXP)) { %>SELECTED<% } %> >matches the regular
|
||||
expression</OPTION>
|
||||
</SELECT>
|
||||
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=32 MAXLENGTH=255
|
||||
VALUE="<%= data.getSearchTerm() %>"></SPAN><BR>
|
||||
<INPUT TYPE=IMAGE NAME="search" SRC="<%= rdat.getFullImagePath("bn_search.gif") %>"
|
||||
ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0><BR>
|
||||
</FONT>
|
||||
</DIV></FORM>
|
||||
|
||||
<% if (data.displayList()) { %>
|
||||
<HR>
|
||||
<%
|
||||
int dcount = data.getSize();
|
||||
// Determine the number of results to display and whether to display a "next" button
|
||||
boolean go_next = false;
|
||||
if (dcount>data.getNumResultsDisplayed())
|
||||
{ // there's a "next"
|
||||
dcount = data.getNumResultsDisplayed();
|
||||
go_next = true;
|
||||
|
||||
} // end if
|
||||
%>
|
||||
<TABLE WIDTH="100%" BORDER=0 ALIGN=CENTER><TR VALIGN=MIDDLE>
|
||||
<TD WIDTH="50%" ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<%-- The community members/search results header --%>
|
||||
<FONT SIZE=+1><B><% if (data.getSimpleList()) { %>Community Members:<% } else { %>Search Results:<% } %></B></FONT>
|
||||
(Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of
|
||||
<%= data.getFindCount() %>)
|
||||
</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 --%>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- Navigational Form --><% } %>
|
||||
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("sigops") %>"><DIV CLASS="content">
|
||||
<INPUT TYPE=HIDDEN NAME="sig" VALUE="<%= data.getCommunityID() %>">
|
||||
<INPUT TYPE=HIDDEN NAME="cmd" VALUE="M">
|
||||
<INPUT TYPE=HIDDEN NAME="sl" VALUE="<%= data.getSimpleListParam() %>">
|
||||
<INPUT TYPE=HIDDEN NAME="ofs" VALUE="<%= data.getOffset() %>">
|
||||
<INPUT TYPE=HIDDEN NAME="field" VALUE="<%= data.getSearchField() %>">
|
||||
<INPUT TYPE=HIDDEN NAME="mode" VALUE="<%= data.getSearchMode() %>">
|
||||
<INPUT TYPE=HIDDEN NAME="term" VALUE="<%= data.getSearchTerm() %>">
|
||||
<INPUT TYPE=HIDDEN NAME="fcount" VALUE="<%= data.getFindCount() %>">
|
||||
<% if (data.getOffset()>0) { %>
|
||||
<INPUT TYPE=IMAGE NAME="previous" SRC="<%= rdat.getFullImagePath("bn_ar_previous.gif") %>"
|
||||
ALT="Previous" WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
<% } else { %>
|
||||
<IMG SRC="<%= rdat.getFullImagePath("bn_transparent.gif") %>" WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
<% } // end if %>
|
||||
|
||||
<% if (go_next) { %>
|
||||
<INPUT TYPE=IMAGE NAME="next" SRC="<%= rdat.getFullImagePath("bn_ar_next.gif") %>"
|
||||
ALT="Next" WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
<% } else { %>
|
||||
<IMG SRC="<%= rdat.getFullImagePath("bn_transparent.gif") %>" WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
<% } // end if %>
|
||||
|
||||
</DIV></FORM>
|
||||
<% } else { %> <% } %>
|
||||
</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>
|
||||
<IMG SRC="<%= rdat.getFullImagePath("purple-ball.gif") %>" ALT="*" WIDTH=14 HEIGHT=14 BORDER=0>
|
||||
</TD>
|
||||
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<% UserFound uf = data.getItem(i); %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("user/" + uf.getName()) %>"><%= uf.getName() %></A><BR>
|
||||
<%= StringUtil.encodeHTML(uf.getGivenName()) %> <%= StringUtil.encodeHTML(uf.getFamilyName()) %>,
|
||||
from <%= StringUtil.encodeHTML(uf.getLocality()) %>, <%= StringUtil.encodeHTML(uf.getRegion()) %>
|
||||
<%= uf.getCountry() %>
|
||||
<% if (Capability.isCommunityAdmin(uf.getLevel())) { %>
|
||||
<IMG SRC="<%= rdat.getFullImagePath("tag_host.gif") %>" ALT="Host!" HSPACE=2 VSPACE=0 BORDER=0
|
||||
WIDTH=40 HEIGHT=20 ALIGN=BOTTOM>
|
||||
<% } // end if %>
|
||||
<% if (uf.getDescription()!=null) { %><BR><EM><%= StringUtil.encodeHTML(uf.getDescription()) %></EM><% } %>
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
<% } // end for %>
|
||||
</TABLE><BR CLEAR=LEFT>
|
||||
<% } // end if %>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user