fixed bug in posting Find forms

This commit is contained in:
Eric J. Bowersox 2002-01-19 01:28:51 +00:00
parent 18c8a5ace1
commit f68066d5e3
2 changed files with 50 additions and 41 deletions

View File

@ -10,7 +10,7 @@
// //
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, // 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 // for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. // Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
// //
// Contributor(s): // Contributor(s):
@ -66,7 +66,10 @@ view.offset = rinput.getParameterInt("ofs",0);
view.findCount = rinput.getParameterInt("fcount",-1); view.findCount = rinput.getParameterInt("fcount",-1);
// Adjust the search return offset based on the command button click. // Adjust the search return offset based on the command button click.
if (rinput.isImageButtonClicked("search")) // EJB 1/18/2002 - N.B.: some browsers can POST the "Search" form without triggering the
// "Search" button (by just pressing Enter), so we include the hidden "newsearch" parameter
// to distinguish between the two
if (rinput.isImageButtonClicked("search") || (rinput.getParameterInt("newsearch",0)==1))
view.offset = 0; view.offset = 0;
else if (rinput.isImageButtonClicked("previous")) else if (rinput.isImageButtonClicked("previous"))
view.offset = Math.max(view.offset - view.maxResults,0); // go backwards view.offset = Math.max(view.offset - view.maxResults,0); // go backwards

View File

@ -61,6 +61,7 @@
<% } // end if %> <% } // end if %>
<INPUT TYPE="HIDDEN" NAME="ofs" VALUE="0"> <INPUT TYPE="HIDDEN" NAME="ofs" VALUE="0">
<INPUT TYPE="HIDDEN" NAME="fcount" VALUE="-1"> <INPUT TYPE="HIDDEN" NAME="fcount" VALUE="-1">
<INPUT TYPE="HIDDEN" NAME="newsearch" VALUE="1"><%-- EJB 1/18/2002 --%>
<util:font color="content.fg" size="content"> <util:font color="content.fg" size="content">
Keywords: <SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=64 MAXLENGTH=255 Keywords: <SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=64 MAXLENGTH=255
VALUE="<%= view.getTerm() %>"></SPAN> VALUE="<%= view.getTerm() %>"></SPAN>
@ -68,7 +69,6 @@
<util:button id="search" type="input"/> <util:button id="search" type="input"/>
</DIV></util:form><P> </DIV></util:form><P>
<% List results = view.getResults(); %> <% List results = view.getResults(); %>
<% if (results!=null) { %> <% if (results!=null) { %>
<util:comment>Display Search Results</util:comment> <util:comment>Display Search Results</util:comment>
@ -109,6 +109,7 @@
<INPUT TYPE=HIDDEN NAME="term" VALUE="<%= view.getTerm() %>"> <INPUT TYPE=HIDDEN NAME="term" VALUE="<%= view.getTerm() %>">
<INPUT TYPE=HIDDEN NAME="ofs" VALUE="<%= view.getOffset() %>"> <INPUT TYPE=HIDDEN NAME="ofs" VALUE="<%= view.getOffset() %>">
<INPUT TYPE=HIDDEN NAME="fcount" VALUE="<%= view.getFindCount() %>"> <INPUT TYPE=HIDDEN NAME="fcount" VALUE="<%= view.getFindCount() %>">
<INPUT TYPE=HIDDEN NAME="newsearch" VALUE="0"><%-- EJB 1/18/2002 --%>
<% if (view.getOffset()>0) { %> <% if (view.getOffset()>0) { %>
<util:button id="previous" type="input"/> <util:button id="previous" type="input"/>
<% } else { %> <% } else { %>
@ -125,44 +126,49 @@
</TD> </TD>
</TR></TABLE><BR> </TR></TABLE><BR>
<%-- Display the results of the search --%> <% if (results.size()>0) { %><%-- EJB 1/18/2002 - omit headers if there's nothing to say --%>
<TABLE BORDER=0 ALIGN=LEFT CELLPADDING=0 CELLSPACING=6> <%-- Display the results of the search --%>
<TR VALIGN=TOP> <TABLE BORDER=0 ALIGN=LEFT CELLPADDING=0 CELLSPACING=6>
<TH ALIGN=LEFT CLASS="CONTENT">
<util:font color="content.fg" size="content"><B><U>Post Link</U></B></util:font>
</TH>
<TH ALIGN=LEFT CLASS="CONTENT">
<util:font color="content.fg" size="content"><B><U>Author</U></B></util:font>
</TH>
<TH ALIGN=LEFT CLASS="CONTENT">
<util:font color="content.fg" size="content"><B><U>Post Date</U></B></util:font>
</TH>
<TH ALIGN=LEFT CLASS="CONTENT">
<util:font color="content.fg" size="content"><B><U>Lines</U></B></util:font>
</TH>
<TH ALIGN=LEFT CLASS="CONTENT">&nbsp;</TH>
</TR>
<% for (int i=0; i<dcount; i++) { %>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<% TopicMessageFound post = (TopicMessageFound)(results.get(i)); %> <TH ALIGN=LEFT CLASS="CONTENT">
<TD ALIGN=LEFT CLASS="content"><util:font color="content.fg" size="content"><util:xlink> <util:font color="content.fg" size="content"><B><U>Post Link</U></B></util:font>
<util:href type="servlet">go/<%= post.getIdentifier() %></util:href> </TH>
<util:text><%= post.getIdentifier() %></util:text> <TH ALIGN=LEFT CLASS="CONTENT">
</util:xlink></util:font></TD> <util:font color="content.fg" size="content"><B><U>Author</U></B></util:font>
<TD ALIGN=LEFT CLASS="content"><util:font color="content.fg" size="content"><util:xlink> </TH>
<util:href type="servlet">user/<%= post.getAuthor() %></util:href> <TH ALIGN=LEFT CLASS="CONTENT">
<util:text><%= post.getAuthor() %></util:text> <util:font color="content.fg" size="content"><B><U>Post Date</U></B></util:font>
</util:xlink></util:font></TD> </TH>
<TD ALIGN=LEFT CLASS="content" NOWRAP><util:font color="content.fg" size="content"> <TH ALIGN=LEFT CLASS="CONTENT">
<%= view.formatDate(post.getPostDate()) %> <util:font color="content.fg" size="content"><B><U>Lines</U></B></util:font>
</util:font></TD> </TH>
<TD ALIGN=LEFT CLASS="content"><util:font color="content.fg" size="content"> <TH ALIGN=LEFT CLASS="CONTENT">&nbsp;</TH>
<%= post.getLineCount() %>
</util:font></TD>
<TD ALIGN=LEFT CLASS="content"><util:font color="content.fg" size="content">
<util:escape><%= post.getText() %></util:escape>
</util:font></TD>
</TR> </TR>
<% } // end for %> <% for (int i=0; i<dcount; i++) { %>
</TABLE><BR CLEAR=LEFT> <TR VALIGN=TOP>
<% TopicMessageFound post = (TopicMessageFound)(results.get(i)); %>
<TD ALIGN=LEFT CLASS="content"><util:font color="content.fg" size="content"><util:xlink>
<util:href type="servlet">go/<%= post.getIdentifier() %></util:href>
<util:text><%= post.getIdentifier() %></util:text>
</util:xlink></util:font></TD>
<TD ALIGN=LEFT CLASS="content"><util:font color="content.fg" size="content"><util:xlink>
<util:href type="servlet">user/<%= post.getAuthor() %></util:href>
<util:text><%= post.getAuthor() %></util:text>
</util:xlink></util:font></TD>
<TD ALIGN=LEFT CLASS="content" NOWRAP><util:font color="content.fg" size="content">
<%= view.formatDate(post.getPostDate()) %>
</util:font></TD>
<TD ALIGN=LEFT CLASS="content"><util:font color="content.fg" size="content">
<%= post.getLineCount() %>
</util:font></TD>
<TD ALIGN=LEFT CLASS="content"><util:font color="content.fg" size="content">
<util:escape><%= post.getText() %></util:escape>
</util:font></TD>
</TR>
<% } // end for %>
</TABLE><BR CLEAR=LEFT>
<% } // end if %>
<% } // end if %> <% } // end if %>