187 lines
6.8 KiB
Plaintext
187 lines
6.8 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@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
|