cvs: pear /Pager HtmlWidgets.php package.xml /Pager/tests pager_test.php
| From: | Lorenzo Alberton | Date: | Thu, 25 Jan 2007 19:06:35 +0000 |
| Subject: | cvs: pear /Pager HtmlWidgets.php package.xml /Pager/tests pager_test.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44378@lists.php.net to get a copy of this message | ||
quipo Thu Jan 25 19:06:35 2007 UTC
Modified files:
/pear/Pager HtmlWidgets.php package.xml
/pear/Pager/tests pager_test.php
Log:
getPerPagerSelectBox() with $showAllData = true and $start > $totalItems was returning an empty
select menu (bug #9946)
http://cvs.php.net/viewvc.cgi/pear/Pager/HtmlWidgets.php?r1=1.2&r2=1.3&diff_format=u
Index: pear/Pager/HtmlWidgets.php
diff -u pear/Pager/HtmlWidgets.php:1.2 pear/Pager/HtmlWidgets.php:1.3
--- pear/Pager/HtmlWidgets.php:1.2 Fri Nov 24 13:46:05 2006
+++ pear/Pager/HtmlWidgets.php Thu Jan 25 19:06:35 2007
@@ -32,7 +32,7 @@
* @author Lorenzo Alberton <l dot alberton at quipo dot it>
* @copyright 2003-2006 Lorenzo Alberton
* @license http://www.debian.org/misc/bsd.license BSD
License (3 Clause)
- * @version CVS: $Id: HtmlWidgets.php,v 1.2 2006/11/24 13:46:05 quipo Exp $
+ * @version CVS: $Id: HtmlWidgets.php,v 1.3 2007/01/25 19:06:35 quipo Exp $
* @link http://pear.php.net/package/Pager
*/
@@ -130,7 +130,7 @@
}
$tmp .= '>'.sprintf($optionText, $i).'</option>';
}
- if ($showAllData && $last < $this->pager->_totalItems) {
+ if ($showAllData && $last != $this->pager->_totalItems) {
$tmp .= '<option
value="'.$this->pager->_totalItems.'"';
if ($this->pager->_totalItems == $selected) {
$tmp .= ' selected="selected"';
http://cvs.php.net/viewvc.cgi/pear/Pager/package.xml?r1=1.82&r2=1.83&diff_format=u
Index: pear/Pager/package.xml
diff -u pear/Pager/package.xml:1.82 pear/Pager/package.xml:1.83
--- pear/Pager/package.xml:1.82 Tue Dec 12 17:25:50 2006
+++ pear/Pager/package.xml Thu Jan 25 19:06:35 2007
@@ -22,7 +22,7 @@
<email>richard@phpguru.org</email>
<active>no</active>
</lead>
- <date>2006-12-12</date>
+ <date>2007-01-25</date>
<time>10:44:27</time>
<version>
<release>2.4.4</release>
@@ -34,6 +34,8 @@
</stability>
<license uri="http://www.debian.org/misc/bsd.license">BSD</license>
<notes>- handle UNION queries in the Wrapper (bug #9601)
+- getPerPagerSelectBox() with $showAllData = true and $start > $totalItems was
+ returning an empty select menu (bug #9946)
</notes>
<contents>
<dir name="/">
@@ -96,9 +98,11 @@
<release>stable</release>
<api>stable</api>
</stability>
- <date>2006-12-12</date>
+ <date>2007-01-25</date>
<license uri="http://www.debian.org/misc/bsd.license">BSD</license>
<notes>- handle UNION queries in the Wrapper (bug #9601)
+- getPerPagerSelectBox() with $showAllData = true and $start > $totalItems was
+ returning an empty select menu (bug #9946)
</notes>
</release>
<release>
http://cvs.php.net/viewvc.cgi/pear/Pager/tests/pager_test.php?r1=1.24&r2=1.25&diff_format=u
Index: pear/Pager/tests/pager_test.php
diff -u pear/Pager/tests/pager_test.php:1.24 pear/Pager/tests/pager_test.php:1.25
--- pear/Pager/tests/pager_test.php:1.24 Fri Nov 24 13:53:36 2006
+++ pear/Pager/tests/pager_test.php Thu Jan 25 19:06:35 2007
@@ -1,5 +1,5 @@
<?php
-// $Id: pager_test.php,v 1.24 2006/11/24 13:53:36 quipo Exp $
+// $Id: pager_test.php,v 1.25 2007/01/25 19:06:35 quipo Exp $
require_once 'simple_include.php';
require_once 'pager_include.php';
@@ -115,6 +115,19 @@
);
$this->assertEqual($selectBox, $this->pager->getPerPageSelectBox(5, 15, 5, true,
$params));
}
+ function testSelectBoxWithShowAllAndFewValues() {
+ //test getPerPagerSelectBox() with $showAllData = true and $start > $totalItems
+ $options = array(
+ 'itemData' => range(1, 5),
+ 'perPage' => 5,
+ 'showAllText' => 'Show All',
+ );
+ $this->pager = Pager::factory($options);
+ $selectBox = '<select
name="'.$this->pager->_sessionVar.'">';
+ $selectBox .= '<option
value="'.max($this->pager->_itemData).'"
selected="selected">Show All</option>';
+ $selectBox .= '</select>';
+ $this->assertEqual($selectBox, $this->pager->getPerPageSelectBox(25, 30, 1, true,
array('checkMaxLimit' => true)));
+ }
function testSelectBoxInvalid() {
$err = $this->pager->getPerPageSelectBox(5, 15, 5, false, '%s bugs');
$this->assertEqual(ERROR_PAGER_INVALID_PLACEHOLDER, $err->getCode());