implemented UI for find posts, debugged and tweaked the engine implementation
This commit is contained in:
135
web/format/findpost.jsp
Normal file
135
web/format/findpost.jsp
Normal file
@@ -0,0 +1,135 @@
|
||||
<%--
|
||||
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.servlets.Variables" %>
|
||||
<%@ page import = "com.silverwrist.venice.servlets.format.*" %>
|
||||
<%
|
||||
FindPostData data = FindPostData.retrieve(request);
|
||||
Variables.failIfNull(data);
|
||||
RenderData rdat = RenderConfig.createRenderData(application,request,response);
|
||||
%>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- Find Posts --><% } %>
|
||||
<% rdat.writeContentHeader(out,"Find Posts",data.getSubtitle()); %>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><%= data.getReturnLink(rdat) %></FONT><P>
|
||||
|
||||
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("findpost") %>"><DIV CLASS="content">
|
||||
<%= data.getExtraParameters() %>
|
||||
<INPUT TYPE="HIDDEN" NAME="ofs" VALUE="0">
|
||||
<INPUT TYPE="HIDDEN" NAME="fcount" VALUE="-1">
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
Keywords:
|
||||
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=64 MAXLENGTH=255
|
||||
VALUE="<%= data.getTerm() %>"></SPAN>
|
||||
</FONT><BR>
|
||||
<INPUT TYPE=IMAGE NAME="search" SRC="<%= rdat.getFullImagePath("bn_search.gif") %>"
|
||||
ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
</DIV></FORM><P>
|
||||
|
||||
<% List results = data.getResults(); %>
|
||||
<% if (results!=null) { %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- Display Search Results --><% } %>
|
||||
<%
|
||||
// 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"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %>
|
||||
<%-- The initial search results --%>
|
||||
<B>Search Results</B>
|
||||
<% if (data.getFindCount()>0) { %>
|
||||
(Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of
|
||||
<%= data.getFindCount() %>)
|
||||
<% } else { %>(None)<% } %>
|
||||
</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("findpost") %>"><DIV CLASS="content">
|
||||
<%= data.getExtraParameters() %>
|
||||
<INPUT TYPE=HIDDEN NAME="term" VALUE="<%= data.getTerm() %>">
|
||||
<INPUT TYPE=HIDDEN NAME="ofs" VALUE="<%= data.getOffset() %>">
|
||||
<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=6>
|
||||
<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"> </TH>
|
||||
</TR>
|
||||
<% for (int i=0; i<dcount; i++) { %>
|
||||
<TR VALIGN=TOP>
|
||||
<% 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>
|
||||
</TR>
|
||||
<% } // end for %>
|
||||
</TABLE><BR CLEAR=LEFT>
|
||||
<% } // end if %>
|
||||
Reference in New Issue
Block a user