implemented UI for find posts, debugged and tweaked the engine implementation

This commit is contained in:
Eric J. Bowersox
2001-12-08 05:02:00 +00:00
parent 4b1acef325
commit ae129e5410
15 changed files with 730 additions and 116 deletions

View File

@@ -32,57 +32,68 @@
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("find") %>"><DIV CLASS="content">
<INPUT TYPE=HIDDEN NAME="disp" VALUE="<%= data.getDisplayOption() %>">
<INPUT TYPE=HIDDEN NAME="ofs" VALUE="0">
<% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %>
<% if (rdat.useHTMLComments()) { %><!-- Find Communities Form --><% } %>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Communities:</B></FONT><BR>
<% if (data.getDisplayOption()==FindData.FD_POSTS) { %>
<% if (rdat.useHTMLComments()) { %><!-- Find Posts Form --><% } %>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Posts:</B></FONT><BR>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
Display all communities whose&nbsp;&nbsp;
<SELECT NAME="field" SIZE=1>
<OPTION VALUE="<%= SearchMode.FIELD_COMMUNITY_NAME %>"
<% if (data.searchFieldIs(SearchMode.FIELD_COMMUNITY_NAME)) { %>SELECTED<% } %> >name</OPTION>
<OPTION VALUE="<%= SearchMode.FIELD_COMMUNITY_SYNOPSIS %>"
<% if (data.searchFieldIs(SearchMode.FIELD_COMMUNITY_SYNOPSIS)) { %>SELECTED<% } %> >synopsis</OPTION>
</SELECT><BR>
<% } else if (data.getDisplayOption()==FindData.FD_USERS) { %>
<% if (rdat.useHTMLComments()) { %><!-- Find Users Form --><% } %>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Users:</B></FONT><BR>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
Display all users whose&nbsp;&nbsp;
<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>
<% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
<% if (rdat.useHTMLComments()) { %><!-- Find Categories Form --><% } %>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Categories:</B></FONT><BR>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
Display all categories whose name&nbsp;&nbsp;
Keywords:
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=64 MAXLENGTH=255
VALUE="<%= data.getSearchTerm() %>"></SPAN>
</FONT><BR>
<% } else { %>
<%-- shouldn't get here --%>
<H1><FONT COLOR="red">Display parameter invalid!</FONT></H1>
<% } // end if %>
<% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %>
<% if (rdat.useHTMLComments()) { %><!-- Find Communities Form --><% } %>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Communities:</B></FONT><BR>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
Display all communities whose&nbsp;&nbsp;
<SELECT NAME="field" SIZE=1>
<OPTION VALUE="<%= SearchMode.FIELD_COMMUNITY_NAME %>"
<% if (data.searchFieldIs(SearchMode.FIELD_COMMUNITY_NAME)) { %>SELECTED<% } %> >name</OPTION>
<OPTION VALUE="<%= SearchMode.FIELD_COMMUNITY_SYNOPSIS %>"
<% if (data.searchFieldIs(SearchMode.FIELD_COMMUNITY_SYNOPSIS)) { %>SELECTED<% } %> >synopsis</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>
<% if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %><BR><% } else { %>&nbsp;&nbsp;<% } %>
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=32 MAXLENGTH=255
VALUE="<%= data.getSearchTerm() %>"></SPAN><BR>
<% } else if (data.getDisplayOption()==FindData.FD_USERS) { %>
<% if (rdat.useHTMLComments()) { %><!-- Find Users Form --><% } %>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Users:</B></FONT><BR>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
Display all users whose&nbsp;&nbsp;
<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>
<% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
<% if (rdat.useHTMLComments()) { %><!-- Find Categories Form --><% } %>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Categories:</B></FONT><BR>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
Display all categories whose name&nbsp;&nbsp;
<% } else { %>
<%-- shouldn't get here --%>
<H1><FONT COLOR="red">Display parameter invalid!</FONT></H1>
<% } // end if %>
<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>
<% if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %><BR><% } else { %>&nbsp;&nbsp;<% } %>
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=32 MAXLENGTH=255
VALUE="<%= data.getSearchTerm() %>"></SPAN><BR>
<% } // end if %>
<INPUT TYPE=IMAGE NAME="search" SRC="<%= rdat.getFullImagePath("bn_search.gif") %>"
ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0><BR>
</FONT>
@@ -206,46 +217,82 @@
</TR></TABLE><BR>
<%-- Display the results of the search --%>
<TABLE BORDER=0 ALIGN=LEFT CELLPADDING=0 CELLSPACING=4>
<TABLE BORDER=0 ALIGN=LEFT CELLPADDING=0 CELLSPACING=6>
<% if ((data.getDisplayOption()==FindData.FD_POSTS) && (results.size()>0)) { %>
<TR VALIGN=TOP>
<TH ALIGN=LEFT CLASS="CONTENT">
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Post Link</U></B></FONT>
</TH>
<TH ALIGN=LEFT CLASS="CONTENT">
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Author</U></B></FONT>
</TH>
<TH ALIGN=LEFT CLASS="CONTENT">
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Post Date</U></B></FONT>
</TH>
<TH ALIGN=LEFT CLASS="CONTENT">
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Lines</U></B></FONT>
</TH>
<TH ALIGN=LEFT CLASS="CONTENT">&nbsp;</TH>
</TR>
<% } // end if %>
<% 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) %>
<% Object item = results.get(i); %>
<% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %>
<%
CommunityContext comm = (CommunityContext)item;
String host_name = FindData.getCommunityHostName(comm);
int members = FindData.getCommunityMemberCount(comm);
%>
<A HREF="<%= rdat.getEncodedServletPath("sig/" + comm.getAlias()) %>"><%= StringUtil.encodeHTML(comm.getName()) %></A><BR>
<% if (host_name!=null) { %>
Host: <A HREF="<%= rdat.getEncodedServletPath("user/" + host_name) %>"><%= host_name %></A>
<% } // end if (got host name) %>
<% if (members>=0) { %>
<% if (host_name!=null) { %> - <% } %>
<%= members %> members
<% } // end if (got member count) %>
<% if ((host_name!=null) || (members>=0)) { %><BR><% } %>
Latest activity: <%= FindData.getActivityString(comm,rdat) %><BR>
<EM><%= StringUtil.encodeHTML(comm.getSynopsis()) %></EM>
<% if (data.getDisplayOption()==FindData.FD_POSTS) { %>
<% TopicMessageFound post = (TopicMessageFound)(results.get(i)); %>
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
<A HREF="<%= rdat.getEncodedServletPath("go/" + post.getIdentifier()) %>"><%= post.getIdentifier() %></A>
</FONT></TD>
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
<A HREF="<%= rdat.getEncodedServletPath("user/" + post.getAuthor()) %>"><%= post.getAuthor() %></A>
</FONT></TD>
<TD ALIGN=LEFT CLASS="content" NOWRAP><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
<%= rdat.formatDateForDisplay(post.getPostDate()) %>
</FONT></TD>
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
<%= post.getLineCount() %>
</FONT></TD>
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
<%= StringUtil.encodeHTML(post.getText()) %>
</FONT></TD>
<% } else { %>
<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) %>
<% Object item = results.get(i); %>
<% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %>
<%
CommunityContext comm = (CommunityContext)item;
String host_name = FindData.getCommunityHostName(comm);
int members = FindData.getCommunityMemberCount(comm);
%>
<A HREF="<%= rdat.getEncodedServletPath("sig/" + comm.getAlias()) %>"><%= StringUtil.encodeHTML(comm.getName()) %></A><BR>
<% if (host_name!=null) { %>
Host: <A HREF="<%= rdat.getEncodedServletPath("user/" + host_name) %>"><%= host_name %></A>
<% } // end if (got host name) %>
<% if (members>=0) { %>
<% if (host_name!=null) { %> - <% } %>
<%= members %> members
<% } // end if (got member count) %>
<% if ((host_name!=null) || (members>=0)) { %><BR><% } %>
Latest activity: <%= FindData.getActivityString(comm,rdat) %><BR>
<EM><%= StringUtil.encodeHTML(comm.getSynopsis()) %></EM>
<% } else if (data.getDisplayOption()==FindData.FD_USERS) { %>
<% UserFound uf = (UserFound)item; %>
<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 (uf.getDescription()!=null) { %><BR><EM><%= StringUtil.encodeHTML(uf.getDescription()) %></EM><% } %>
<% } else if (data.getDisplayOption()==FindData.FD_USERS) { %>
<% UserFound uf = (UserFound)item; %>
<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 (uf.getDescription()!=null) { %><BR><EM><%= StringUtil.encodeHTML(uf.getDescription()) %></EM><% } %>
<% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
<% CategoryDescriptor cd = (CategoryDescriptor)item; %>
<A HREF="<%= data.getCatJumpLink(rdat,cd.getLinkedCategoryID()) %>"><%= StringUtil.encodeHTML(cd.toString()) %></A>
<% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
<% CategoryDescriptor cd = (CategoryDescriptor)item; %>
<A HREF="<%= data.getCatJumpLink(rdat,cd.getLinkedCategoryID()) %>"><%= StringUtil.encodeHTML(cd.toString()) %></A>
<% } %>
</FONT></TD>
<% } // end if%>
</FONT></TD>
<% } // end if %>
</TR>
<% } // end for %>