Commit f57306733217145c7345ef2fe6238efd6a480014

Authored by Neil Blakey-Milner
1 parent 9889ce86

Fix off-by-one in whether to display the 'Next' button.

SF Tracker:	1058334
Submitted by:	David Linsin (dlinsin) (bug report)


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2984 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/visualpatterns/PatternBrowsableSearchResults.inc
... ... @@ -205,14 +205,14 @@ class PatternBrowseableSearchResults {
205 205 $sToRender .= "<tr>\n";
206 206 $sToRender .= "<input type=\"hidden\" name=\"fStartIndex\" value=\"$iEndIndex\" />\n";
207 207 // Display only the next button
208   - if (($this->iStartIndex + $this->iResultsToDisplay) < $iTotalResults && $this->iStartIndex == 1) {
  208 + if (($this->iStartIndex + $this->iResultsToDisplay - 1) < $iTotalResults && $this->iStartIndex == 1) {
209 209 $sToRender .= "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>";
210 210 $sToRender .= "<td align=\"left\">";
211 211 $sToRender .= "<input type=\"image\" src=\"" . KTHtml::getNextButton() . "\" onClick=\"setActionAndSubmit('" . $_SERVER["PHP_SELF"] . "?fStartIndex=" . ($this->iStartIndex + $this->iResultsToDisplay) . $this->sQueryString . "')\" />";
212 212 $sToRender .= "</td>\n";
213 213 }
214 214 // Display both the next and the previous buttons
215   - else if (($this->iStartIndex + $this->iResultsToDisplay) < $iTotalResults && $this->iStartIndex > 1) {
  215 + else if (($this->iStartIndex + $this->iResultsToDisplay - 1) < $iTotalResults && $this->iStartIndex > 1) {
216 216 $sToRender .= "<td>";
217 217 $sToRender .= "<input type=\"image\" src=\"$default->graphicsUrl/widgets/previous.gif\" onClick=\"setActionAndSubmit('" . $_SERVER["PHP_SELF"] . "?fStartIndex=" . ($this->iStartIndex - $this->iResultsToDisplay) . $this->sQueryString . "')\" />";
218 218 $sToRender .= "</td>";
... ...