added community find page and some necessary patches to the framework, fixed
bugs
This commit is contained in:
parent
3fa600206e
commit
b1d1f8e381
|
@ -1130,5 +1130,6 @@ INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link, perm_ns
|
|||
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
|
||||
VALUES (4, 6, 'find.menu', 'Find', NULL);
|
||||
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES
|
||||
(4, 0, 'TEXT', 'Users', 'SERVLET', 'find_users.js.vs' ),
|
||||
(4, 1, 'TEXT', 'Categories', 'SERVLET', 'find_categories.js.vs');
|
||||
(4, 0, 'TEXT', 'Communities', 'SERVLET', 'find_communities.js.vs'),
|
||||
(4, 1, 'TEXT', 'Users', 'SERVLET', 'find_users.js.vs' ),
|
||||
(4, 2, 'TEXT', 'Categories', 'SERVLET', 'find_categories.js.vs' );
|
||||
|
|
|
@ -608,4 +608,10 @@ class GroupObject implements DynamoGroup
|
|||
|
||||
} // end setAcl
|
||||
|
||||
public synchronized int getMemberCount() throws DatabaseException
|
||||
{
|
||||
return m_ops.getMemberCount(m_gid);
|
||||
|
||||
} // end getMemberCount
|
||||
|
||||
} // end class GroupObject
|
||||
|
|
|
@ -60,4 +60,6 @@ abstract class GroupObjectOps extends OpsBase
|
|||
|
||||
abstract void setAclID(int gid, int aclid) throws DatabaseException;
|
||||
|
||||
abstract int getMemberCount(int gid) throws DatabaseException;
|
||||
|
||||
} // end class GroupObjectOps
|
||||
|
|
|
@ -553,4 +553,36 @@ class GroupObjectOps_mysql extends GroupObjectOps
|
|||
|
||||
} // end setAclID
|
||||
|
||||
int getMemberCount(int gid) throws DatabaseException
|
||||
{
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
ArrayList tmp = null;
|
||||
try
|
||||
{ // get a connection
|
||||
conn = getConnection();
|
||||
|
||||
// create a query to get all the UIDs
|
||||
stmt = conn.prepareStatement("SELECT COUNT(*) FROM groupmembers WHERE gid = ?;");
|
||||
stmt.setInt(1,gid);
|
||||
rs = stmt.executeQuery();
|
||||
return SQLUtils.getReturnCountInt(rs,1);
|
||||
|
||||
} // end try
|
||||
catch (SQLException e)
|
||||
{ // translate to a general DatabaseException
|
||||
throw generalException(e);
|
||||
|
||||
} // end catch
|
||||
finally
|
||||
{ // shut everything down
|
||||
SQLUtils.shutdown(rs);
|
||||
SQLUtils.shutdown(stmt);
|
||||
SQLUtils.shutdown(conn);
|
||||
|
||||
} // end finally
|
||||
|
||||
} // end getMemberCount
|
||||
|
||||
} // end class GroupObjectOps_mysql
|
||||
|
|
|
@ -235,6 +235,12 @@ abstract class GroupProxy implements DynamoGroup, DynamicWrapper
|
|||
|
||||
} // end setAcl
|
||||
|
||||
public int getMemberCount() throws DatabaseException
|
||||
{
|
||||
return getRealGroup().getMemberCount();
|
||||
|
||||
} // end getMemberCount
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface DynamicWrapper
|
||||
*--------------------------------------------------------------------------------
|
||||
|
|
|
@ -45,4 +45,6 @@ public interface DynamoGroup extends Group, NamedObject, SecureObjectStore
|
|||
|
||||
public void setAcl(DynamoUser caller, DynamoAcl acl) throws DatabaseException, DynamoSecurityException;
|
||||
|
||||
public int getMemberCount() throws DatabaseException;
|
||||
|
||||
} // end interface DynamoGroup
|
||||
|
|
|
@ -185,6 +185,8 @@ class CommunityImpl implements VeniceCommunity
|
|||
*/
|
||||
public Object getObject(String namespace, String name)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("CommunityImpl.getObject: namespace = " + namespace + ", name = " + name);
|
||||
try
|
||||
{ // convert the namespace name to an ID here
|
||||
PropertyKey key = new PropertyKey(m_nscache.namespaceNameToId(namespace),name);
|
||||
|
@ -196,19 +198,31 @@ class CommunityImpl implements VeniceCommunity
|
|||
{ // no use - need to try the database
|
||||
rc = m_ops.getProperty(m_id,key);
|
||||
if (rc!=null)
|
||||
{ // found in the database
|
||||
m_properties.put(key,rc);
|
||||
logger.debug("value found in database");
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
else
|
||||
logger.debug("value found in cache");
|
||||
|
||||
} // end synchronized block
|
||||
|
||||
if (rc==null)
|
||||
{ // the object was not found
|
||||
logger.debug("value not found");
|
||||
throw new NoSuchObjectException(this.toString(),namespace,name);
|
||||
|
||||
} // end if
|
||||
|
||||
return rc;
|
||||
|
||||
} // end try
|
||||
catch (DatabaseException e)
|
||||
{ // translate into our NoSuchObjectException but retain the DatabaseException
|
||||
logger.debug("Database exception while doing find",e);
|
||||
throw new NoSuchObjectException(this.toString(),namespace,name,e);
|
||||
|
||||
} // end catch
|
||||
|
|
|
@ -150,7 +150,7 @@ class CommunityOps_mysql extends CommunityOps
|
|||
conn = getConnection();
|
||||
|
||||
// look up the property
|
||||
stmt = conn.prepareStatement("SELECT prop_value FROM commprop WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt = conn.prepareStatement("SELECT prop_value FROM commprops WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,key.getNamespaceID());
|
||||
stmt.setString(3,key.getName());
|
||||
|
@ -209,10 +209,10 @@ class CommunityOps_mysql extends CommunityOps
|
|||
|
||||
// lock the table
|
||||
stmt2 = conn.createStatement();
|
||||
stmt2.executeUpdate("LOCK TABLES commprop WRITE, communities WRITE;");
|
||||
stmt2.executeUpdate("LOCK TABLES commprops WRITE, communities WRITE;");
|
||||
|
||||
// look to see if the property value is already there
|
||||
stmt = conn.prepareStatement("SELECT prop_value FROM commprop WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt = conn.prepareStatement("SELECT prop_value FROM commprops WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,key.getNamespaceID());
|
||||
stmt.setString(3,key.getName());
|
||||
|
@ -225,7 +225,7 @@ class CommunityOps_mysql extends CommunityOps
|
|||
|
||||
if (old_value!=null)
|
||||
{ // prepare the statement to update the existing record
|
||||
stmt = conn.prepareStatement("UPDATE commprop SET prop_value = ? WHERE cid = ? AND nsid = ? "
|
||||
stmt = conn.prepareStatement("UPDATE commprops SET prop_value = ? WHERE cid = ? AND nsid = ? "
|
||||
+ "AND prop_name = ?;");
|
||||
stmt.setString(1,serialized_value);
|
||||
stmt.setInt(2,cid);
|
||||
|
@ -235,7 +235,7 @@ class CommunityOps_mysql extends CommunityOps
|
|||
} // end if
|
||||
else
|
||||
{ // prepare the statement to insert a new record
|
||||
stmt = conn.prepareStatement("INSERT INTO commprop (cid, nsid, prop_name, prop_value) VALUES (?, ?, ?, ?);");
|
||||
stmt = conn.prepareStatement("INSERT INTO commprops (cid, nsid, prop_name, prop_value) VALUES (?, ?, ?, ?);");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,key.getNamespaceID());
|
||||
stmt.setString(3,key.getName());
|
||||
|
@ -293,10 +293,10 @@ class CommunityOps_mysql extends CommunityOps
|
|||
|
||||
// lock the table
|
||||
stmt2 = conn.createStatement();
|
||||
stmt2.executeUpdate("LOCK TABLES commprop WRITE, communities WRITE;");
|
||||
stmt2.executeUpdate("LOCK TABLES commprops WRITE, communities WRITE;");
|
||||
|
||||
// look to see if the property value is already there
|
||||
stmt = conn.prepareStatement("SELECT prop_value FROM commprop WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt = conn.prepareStatement("SELECT prop_value FROM commprops WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,key.getNamespaceID());
|
||||
stmt.setString(3,key.getName());
|
||||
|
@ -311,7 +311,7 @@ class CommunityOps_mysql extends CommunityOps
|
|||
SQLUtils.shutdown(stmt);
|
||||
|
||||
// delete the database row
|
||||
stmt = conn.prepareStatement("DELETE FROM commprop WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt = conn.prepareStatement("DELETE FROM commprops WHERE cid = ? AND nsid = ? AND prop_name = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,key.getNamespaceID());
|
||||
stmt.setString(3,key.getName());
|
||||
|
@ -358,7 +358,7 @@ class CommunityOps_mysql extends CommunityOps
|
|||
conn = getConnection();
|
||||
|
||||
// execute the query!
|
||||
stmt = conn.prepareStatement("SELECT DISTINCT nsid FROM commprop WHERE cid = ?;");
|
||||
stmt = conn.prepareStatement("SELECT DISTINCT nsid FROM commprops WHERE cid = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
|
@ -400,7 +400,7 @@ class CommunityOps_mysql extends CommunityOps
|
|||
conn = getConnection();
|
||||
|
||||
// execute the query!
|
||||
stmt = conn.prepareStatement("SELECT prop_name, prop_value FROM commprop WHERE cid = ? AND nsid = ?;");
|
||||
stmt = conn.prepareStatement("SELECT prop_name, prop_value FROM commprops WHERE cid = ? AND nsid = ?;");
|
||||
stmt.setInt(1,cid);
|
||||
stmt.setInt(2,namespace);
|
||||
rs = stmt.executeQuery();
|
||||
|
|
|
@ -90,7 +90,7 @@ if (rc==null)
|
|||
rc.setParameter("results",results);
|
||||
|
||||
// Load the profile menu.
|
||||
mprov = vcast.queryMenuProvider(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-menus"));
|
||||
mprov = vcast.queryMenuProvider(rhelp.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-menus"));
|
||||
menu = mprov.getInlineMenu(user,VeniceNamespaces.CONTENT_LAF_NAMESPACE,"find.menu",cast.newIntArray(0));
|
||||
ndx = menu.getItemContainingLinkText("find_categories.js.vs");
|
||||
menu.setSelectedIndex(ndx);
|
||||
|
|
147
venice-data/scripts/find_communities.js
Normal file
147
venice-data/scripts/find_communities.js
Normal file
|
@ -0,0 +1,147 @@
|
|||
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
//
|
||||
// Contributor(s):
|
||||
|
||||
importPackage(java.lang);
|
||||
importClass(Packages.com.silverwrist.dynamo.Namespaces);
|
||||
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||
importPackage(Packages.com.silverwrist.dynamo.util);
|
||||
importClass(Packages.com.silverwrist.venice.CommunitySearchField);
|
||||
importClass(Packages.com.silverwrist.venice.SearchMode);
|
||||
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
|
||||
importPackage(Packages.com.silverwrist.venice.community);
|
||||
importPackage(Packages.com.silverwrist.venice.content);
|
||||
importPackage(Packages.com.silverwrist.venice.iface);
|
||||
|
||||
req = bsf.lookupBean("request"); // get request
|
||||
rhelp = bsf.lookupBean("request_help"); // get request helper
|
||||
session = rhelp.getSession(); // get the session
|
||||
user = vlib.getUser(session); // get user
|
||||
|
||||
// Tell the session we visited this page last.
|
||||
session.setObject("/find.js.vs","last.visited","find_communities.js.vs");
|
||||
|
||||
// Get the user's configured page size.
|
||||
pagesize = cast.toInteger(user.getObject(VeniceNamespaces.USER_SETTINGS_NAMESPACE,"search.result.count"));
|
||||
|
||||
field = CommunitySearchField.NAME;
|
||||
mode = SearchMode.PREFIX;
|
||||
term = "";
|
||||
ofs = 0;
|
||||
fcount = -1;
|
||||
results = null;
|
||||
category = null;
|
||||
rc = null;
|
||||
|
||||
if (rhelp.isVerb("POST"))
|
||||
{ // Read the form parameters
|
||||
field = CommunitySearchField.getEnum(rhelp.getParameter("field"));
|
||||
mode = SearchMode.getEnum(rhelp.getParameter("mode"));
|
||||
term = rhelp.getParameter("term");
|
||||
ofs = rhelp.getParameterInt("ofs",0);
|
||||
fcount = rhelp.getParameterInt("fcount",-1);
|
||||
|
||||
if (rhelp.hasParameter("cat"))
|
||||
{ // get the current category
|
||||
catsvc = vcast.queryCategoryService(rhelp.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"categories"));
|
||||
category = catsvc.getCategory(rhelp.getParameterInt("cat",-1));
|
||||
|
||||
} // end if
|
||||
|
||||
// Adjust offset based on the button that was clicked.
|
||||
if (rhelp.isImageButtonClicked("search"))
|
||||
{ // beginning of a new search
|
||||
ofs = 0;
|
||||
fcount = -1;
|
||||
|
||||
} // end if
|
||||
else if (rhelp.isImageButtonClicked("previous"))
|
||||
ofs = Math.max(ofs - pagesize,0);
|
||||
else if (rhelp.isImageButtonClicked("next"))
|
||||
ofs += pagesize;
|
||||
|
||||
// Get the community service object.
|
||||
commsvc = vcast.queryCommunityService(rhelp.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"communities"));
|
||||
|
||||
try
|
||||
{ // search for communities!
|
||||
if (category!=null)
|
||||
{ // look in the category
|
||||
if (fcount<0)
|
||||
fcount = commsvc.getNumCommunitiesInCategory(user,category);
|
||||
results = commsvc.getCommunitiesInCategory(user,category,ofs,pagesize);
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // do a normal search
|
||||
if (fcount<0)
|
||||
fcount = commsvc.getSearchCommunityCount(user,field,mode,term);
|
||||
results = commsvc.searchForCommunities(user,field,mode,term,ofs,pagesize);
|
||||
|
||||
} // end else
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception thrown
|
||||
rc = new ErrorBox("Database Error",e,"SERVLET","find_communities.js.vs");
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // get the category we're loading
|
||||
catsvc = vcast.queryCategoryService(rhelp.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"categories"));
|
||||
commsvc = vcast.queryCommunityService(rhelp.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"communities"));
|
||||
try
|
||||
{ // get the category and listings
|
||||
category = catsvc.getCategory(rhelp.getParameterInt("cat",-1));
|
||||
fcount = commsvc.getNumCommunitiesInCategory(user,category);
|
||||
results = commsvc.getCommunitiesInCategory(user,category,0,pagesize);
|
||||
if (results.isEmpty())
|
||||
results = null;
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // exception thrown
|
||||
rc = new ErrorBox("Database Error",e,"SERVLET","find_communities.js.vs");
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end else
|
||||
|
||||
if (rc==null)
|
||||
{ // create the VelocityView for the output
|
||||
rc = new VelocityView("Find Communities","find_communities.vm");
|
||||
rc.setParameter("field",field.getName());
|
||||
rc.setParameter("mode",mode.getName());
|
||||
rc.setParameter("term",term.toString());
|
||||
rc.setParameter("ofs",cast.toIntegerObject(ofs));
|
||||
rc.setParameter("fcount",cast.toIntegerObject(fcount));
|
||||
rc.setParameter("pagesize",cast.toIntegerObject(pagesize));
|
||||
if (category!=null)
|
||||
rc.setParameter("category",category);
|
||||
if (results!=null)
|
||||
rc.setParameter("results",results);
|
||||
|
||||
// Load the profile menu.
|
||||
mprov = vcast.queryMenuProvider(rhelp.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-menus"));
|
||||
menu = mprov.getInlineMenu(user,VeniceNamespaces.CONTENT_LAF_NAMESPACE,"find.menu",cast.newIntArray(0));
|
||||
ndx = menu.getItemContainingLinkText("find_communities.js.vs");
|
||||
menu.setSelectedIndex(ndx);
|
||||
rc.setParameter("menu",menu);
|
||||
|
||||
} // end if
|
||||
|
||||
dynamo.scriptOutput(rc);
|
|
@ -94,7 +94,7 @@ if (rc==null)
|
|||
rc.setParameter("results",results);
|
||||
|
||||
// Load the profile menu.
|
||||
mprov = vcast.queryMenuProvider(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-menus"));
|
||||
mprov = vcast.queryMenuProvider(rhelp.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-menus"));
|
||||
menu = mprov.getInlineMenu(user,VeniceNamespaces.CONTENT_LAF_NAMESPACE,"find.menu",cast.newIntArray(0));
|
||||
ndx = menu.getItemContainingLinkText("find_users.js.vs");
|
||||
menu.setSelectedIndex(ndx);
|
||||
|
|
|
@ -64,7 +64,7 @@ if (rhelp.isRequestType("_SESSION") && rhelp.isVerb("PUT"))
|
|||
|
||||
// Configure other session attributes.
|
||||
session = rhelp.getSession();
|
||||
session.setObject("/find.js.vs","last.visited","find_categories.js.vs");
|
||||
session.setObject("/find.js.vs","last.visited","find_communities.js.vs");
|
||||
|
||||
} // end if (session is HTTP)
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#comment( "Results display" )
|
||||
<hr />
|
||||
<table width="100%" border="0" align="center"><tr valign="middle">
|
||||
<td width="50%" align="left">
|
||||
<td width="50%" align="left" class="subhead">
|
||||
<b>Search Results</b>
|
||||
#if( $is_form >= 1 )
|
||||
(Displaying ${ndx_first}-${ndx_last} of ${fcount})
|
||||
|
|
186
venice-data/velocity/find_communities.vm
Normal file
186
venice-data/velocity/find_communities.vm
Normal file
|
@ -0,0 +1,186 @@
|
|||
#*
|
||||
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
*#
|
||||
#*
|
||||
Parameters:
|
||||
field = Search field (string equivalent)
|
||||
mode = Search mode (string equivalent)
|
||||
term = Search term
|
||||
ofs = Offset within the search we're at right now
|
||||
fcount = Total number of items found in current search
|
||||
pagesize = Number of items to display per page
|
||||
category = Current category (may be null)
|
||||
results = Results list from find, a List of DynamoUser objects (may be null)
|
||||
menu = Tab menu to render across the top
|
||||
*#
|
||||
#render( $menu )
|
||||
#header1( "Find Communities" )
|
||||
<form method="POST" action="#formatURL( "SERVLET" "find_communities.js.vs")">
|
||||
<input type="hidden" name="ofs" value="0">
|
||||
#comment( "Find Communities form" )
|
||||
<div align="left"><p>
|
||||
Display all communities whose
|
||||
<select name="field" size="1">
|
||||
<option value="NAME" #if( $field.equals("NAME") )selected="selected"#end >name</option>
|
||||
<option value="SYNOPSIS" #if( $field.equals("SYNOPSIS") )selected="selected"#end >synopsis</option>
|
||||
</select>
|
||||
<select name="mode" size="1">
|
||||
<option value="PREFIX" #if( $mode.equals("PREFIX") )selected="selected"#end >starts with the string</option>
|
||||
<option value="SUBSTRING" #if( $mode.equals("SUBSTRING") )selected="selected"#end >contains the string</option>
|
||||
<option value="REGEXP" #if( $mode.equals("REGEXP") )selected="selected"#end >matches the regular
|
||||
expression</option>
|
||||
</select>
|
||||
<input type="text" name="term" size="32" maxlength="255" value="$!term" /></p>
|
||||
<p>#button( "INPUT" "search" )</p>
|
||||
</div>
|
||||
#comment( "end Find Communities form" )
|
||||
</form>
|
||||
|
||||
#if( $category )
|
||||
#comment( "Category Name" )
|
||||
<hr />
|
||||
<div class="subhead"><b>
|
||||
Category:
|
||||
#if ( $category.getCategoryID()<0 )
|
||||
Top
|
||||
#else
|
||||
<a href="#formatURL( "SERVLET" "find_communities.js.vs" )">Top</a>
|
||||
#set( $limit = $category.getNumLevels() - 1 )
|
||||
#foreach( $i in [0..$limit] )
|
||||
#if( $i < $limit )
|
||||
: <a href="#formatURL( "SERVLET" "find_communities.js.vs?cat=${category.getIDAtLevel($i)}" )">#encodeHTML( $category.getTitleAtLevel($i) )</a>
|
||||
#else
|
||||
: #encodeHTML( $category.getTitleAtLevel($i) )
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
</b></div><br />
|
||||
|
||||
#set( $list = $category.getSubCategories() )
|
||||
#if( $list.size() > 0 )
|
||||
#comment( "Begin Category List" )
|
||||
<div>
|
||||
<b>Subcategories:</b>
|
||||
#foreach( $subcat in $category.getSubCategories() )
|
||||
#set( $endpt = $subcat.getNumLevels() - 1 )
|
||||
<br />#bullet()
|
||||
<b><a href="#formatURL( "SERVLET" "find_communities.js.vs?cat=${subcat.getLinkedCategoryID()}" )">#encodeHTML( $subcat.getTitleAtLevel($endpt) )</a></b>
|
||||
#if( $subcat.isSymbolicLink() )<em>@</em>#end
|
||||
#end
|
||||
</div>
|
||||
#comment( "End Category List" )
|
||||
#end
|
||||
#end
|
||||
|
||||
#if( $results )
|
||||
## Do a tricky set of computations here to figure out what we need to display in terms of the search results
|
||||
## and the form to the right that lets us page through results.
|
||||
#set( $resultcount = $results.size() )
|
||||
#set( $is_next = 0 )
|
||||
#set( $is_prev = 0 )
|
||||
#if( $resultcount > $pagesize )
|
||||
#set( $resultcount = $pagesize )
|
||||
#set( $is_next = 1 )
|
||||
#end
|
||||
#if( $ofs > 0 )
|
||||
#set( $is_prev = 1 )
|
||||
#end
|
||||
#set( $is_form = $is_next + $is_prev )
|
||||
#set( $ndx_first = $ofs + 1 )
|
||||
#set( $ndx_last = $ofs + $pagesize )
|
||||
#if( $ndx_last > $fcount )
|
||||
#set( $ndx_last = $fcount )
|
||||
#end
|
||||
|
||||
#comment( "Results display" )
|
||||
<hr />
|
||||
<table width="100%" border="0" align="center"><tr valign="middle">
|
||||
<td width="50%" align="left" class="subhead">
|
||||
#if( $category )
|
||||
<b>Communities In Category</b>
|
||||
#else
|
||||
<b>Search Results</b>
|
||||
#end
|
||||
#if( $is_form >= 1 )
|
||||
(Displaying ${ndx_first}-${ndx_last} of ${fcount})
|
||||
#end
|
||||
</td>
|
||||
<td width="50%" align="right">
|
||||
#if( $is_form >= 1 )
|
||||
#comment( "Results navigation form" )
|
||||
<form method="POST" action="#formatURL( "SERVLET" "find_communities.js.vs")">
|
||||
#if( $category )
|
||||
<input type="hidden" name="cat" value="${category.getLinkedCategoryID()}">
|
||||
#end
|
||||
<input type="hidden" name="field" value="$field" />
|
||||
<input type="hidden" name="mode" value="$mode" />
|
||||
<input type="hidden" name="term" value="$term" />
|
||||
<input type="hidden" name="ofs" value="$ofs" />
|
||||
<input type="hidden" name="fcount" value="$fcount" />
|
||||
#if( $is_prev == 1 )
|
||||
#button( "INPUT" "previous" )
|
||||
#else
|
||||
#button( "IMAGE" "0transparent" )
|
||||
#end
|
||||
|
||||
#if( $is_next == 1 )
|
||||
#button( "INPUT" "next" )
|
||||
#else
|
||||
#button( "IMAGE" "0transparent" )
|
||||
#end
|
||||
</form>
|
||||
#else
|
||||
|
||||
#end
|
||||
</td>
|
||||
</tr></table>
|
||||
|
||||
#if( $fcount > 0 )
|
||||
#set( $prof_ns = "http://www.silverwrist.com/NS/venice/2003/05/29/community.profile" )
|
||||
#set( $i = $resultcount )
|
||||
<table border="0" align="left" cellpadding="0" cellspacing="4">
|
||||
#foreach( $comm in $results )
|
||||
#set( $i = $i - 1 )
|
||||
#if( $i >= 0 )
|
||||
#set( $descr = $std.getProperty($comm,$prof_ns,"synopsis") )
|
||||
#set( $mcount = $comm.getMemberGroup().getMemberCount() )
|
||||
<tr valign="top">
|
||||
<td align="center" width="14">#bullet()</td>
|
||||
<td align="left" class="content">
|
||||
<a href="#formatURL( "SERVLET" "TODO" )">#encodeHTML( $comm.Name )</a><br />
|
||||
Host: <a href="#formatURL( "SERVLET" "user/${comm.HostUser.Name}" )">#encodeHTML( $comm.HostUser.Name )</a>
|
||||
- $mcount
|
||||
#if( $mcount == 1 )
|
||||
member
|
||||
#else
|
||||
members
|
||||
#end
|
||||
<br />Latest activity: #formatActivity( $comm.LastUpdateDate )
|
||||
#if( $descr )
|
||||
<br /><em>#encodeHTML( $descr )</em>
|
||||
#end
|
||||
</td>
|
||||
</tr>
|
||||
#end
|
||||
#end
|
||||
</table>
|
||||
#else
|
||||
<em>No communities found.</em>
|
||||
#end
|
||||
|
||||
#comment( "End results display" )
|
||||
#end
|
|
@ -74,7 +74,7 @@
|
|||
#comment( "Results display" )
|
||||
<hr />
|
||||
<table width="100%" border="0" align="center"><tr valign="middle">
|
||||
<td width="50%" align="left">
|
||||
<td width="50%" align="left" class="subhead">
|
||||
<b>Search Results</b>
|
||||
#if( $is_form >= 1 )
|
||||
(Displaying ${ndx_first}-${ndx_last} of ${fcount})
|
||||
|
|
|
@ -38,6 +38,13 @@ body td.smcontent, body div.smcontent, body p.smcontent {
|
|||
font-size: x-small;
|
||||
}
|
||||
|
||||
body td.subhead, body div.subhead, body p.subhead {
|
||||
font-size: small;
|
||||
voice-family: "\"}\"";
|
||||
voice-family: inherit;
|
||||
font-size: medium;
|
||||
}
|
||||
|
||||
body td.framefooter, body div.framefooter, body p.framefooter {
|
||||
font-size: xx-small;
|
||||
voice-family: "\"}\"";
|
||||
|
@ -85,6 +92,10 @@ html>body td.smcontent, html>body div.smcontent, html>body p.smcontent {
|
|||
font-size: x-small;
|
||||
}
|
||||
|
||||
html>body td.subhead, html>body div.subhead, html>body p.subhead {
|
||||
font-size: medium;
|
||||
}
|
||||
|
||||
html>body td.framefooter, html>body div.framefooter, html>body p.framefooter {
|
||||
font-size: x-small;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,12 @@ div.frametopright {
|
|||
font-size: 9px;
|
||||
}
|
||||
|
||||
.subhead {
|
||||
color: #000000;
|
||||
background-color: #ffffff;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.framefooter {
|
||||
color: #000000;
|
||||
background-color: #ffffff;
|
||||
|
|
Loading…
Reference in New Issue
Block a user