cvs: pear /Pager Common.php package.xml /Pager/tests pager_test.php
| From: | Lorenzo Alberton | Date: | Wed, 26 Mar 2008 21:54:10 +0000 |
| Subject: | cvs: pear /Pager Common.php package.xml /Pager/tests pager_test.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-51698@lists.php.net to get a copy of this message | ||
quipo Wed Mar 26 21:54:10 2008 UTC
Modified files:
/pear/Pager Common.php package.xml
/pear/Pager/tests pager_test.php
Log:
request #13509: added 'prevImgEmpty' and 'nextImgEmpty' options to show a
disabled prev/next page link when you are on the last/first page (cweiske)
http://cvs.php.net/viewvc.cgi/pear/Pager/Common.php?r1=1.75&r2=1.76&diff_format=u
Index: pear/Pager/Common.php
diff -u pear/Pager/Common.php:1.75 pear/Pager/Common.php:1.76
--- pear/Pager/Common.php:1.75 Mon Mar 10 20:17:04 2008
+++ pear/Pager/Common.php Wed Mar 26 21:54:10 2008
@@ -33,7 +33,7 @@
* @author Richard Heyes <richard@phpguru.org>
* @copyright 2003-2007 Lorenzo Alberton, Richard Heyes
* @license http://www.debian.org/misc/bsd.license BSD
License (3 Clause)
- * @version CVS: $Id: Common.php,v 1.75 2008/03/10 20:17:04 quipo Exp $
+ * @version CVS: $Id: Common.php,v 1.76 2008/03/26 21:54:10 quipo Exp $
* @link http://pear.php.net/package/Pager
*/
@@ -244,12 +244,31 @@
var $_prevImg = '<< Back';
/**
+ * image/text to use as "prev" link when no prev link is needed (e.g. on the first
page)
+ * NULL deactivates it
+ *
+ * @var string
+ * @access private
+ */
+ var $_prevImgEmpty = null;
+
+ /**
* @var string image/text to use as "next" link
* @access private
*/
var $_nextImg = 'Next >>';
/**
+ * image/text to use as "next" link when
+ * no next link is needed (e.g. on the last page)
+ * NULL deactivates it
+ *
+ * @var string
+ * @access private
+ */
+ var $_nextImgEmpty = null;
+
+ /**
* @var string link separator
* @access private
*/
@@ -454,7 +473,9 @@
'altLast',
'altPage',
'prevImg',
+ 'prevImgEmpty',
'nextImg',
+ 'nextImgEmpty',
'expanded',
'accesskey',
'attributes',
@@ -1049,6 +1070,9 @@
$this->_linkData[$this->_urlVar] = $this->getPreviousPageID();
$back = $this->_renderLink($this->_altPrev, $this->_prevImg)
. $this->_spacesBefore . $this->_spacesAfter;
+ } else if ($this->_prevImgEmpty !== null) {
+ $back = $this->_prevImgEmpty
+ . $this->_spacesBefore . $this->_spacesAfter;
}
return $back;
}
@@ -1098,6 +1122,10 @@
$next = $this->_spacesAfter
. $this->_renderLink($this->_altNext, $this->_nextImg)
. $this->_spacesBefore . $this->_spacesAfter;
+ } else if ($this->_nextImgEmpty !== null) {
+ $next = $this->_spacesAfter
+ . $this->_nextImgEmpty
+ . $this->_spacesBefore . $this->_spacesAfter;
}
return $next;
}
http://cvs.php.net/viewvc.cgi/pear/Pager/package.xml?r1=1.104&r2=1.105&diff_format=u
Index: pear/Pager/package.xml
diff -u pear/Pager/package.xml:1.104 pear/Pager/package.xml:1.105
--- pear/Pager/package.xml:1.104 Wed Mar 26 21:36:28 2008
+++ pear/Pager/package.xml Wed Mar 26 21:54:10 2008
@@ -23,7 +23,7 @@
<active>no</active>
</lead>
<date>2008-03-26</date>
- <time>22:36:27</time>
+ <time>22:53:27</time>
<version>
<release>2.4.6</release>
<api>2.4.6</api>
@@ -36,6 +36,8 @@
<notes>- fixed bug #13316: NOTICE in getLinks() in Jumping mode
- fixed bug #13342: getLinks() returns wrong result with multi-byte arrays
- fixed bug #13469: getPerPageSelectBox() can produce invalid xhtml with no data
+- request #13509: added 'prevImgEmpty' and 'nextImgEmpty' options to show a
disabled
+ prev/next page link when you are on the last/first page (cweiske)
</notes>
<contents>
<dir name="/">
@@ -103,6 +105,8 @@
<notes>- fixed bug #13316: NOTICE in getLinks() in Jumping mode
- fixed bug #13342: getLinks() returns wrong result with multi-byte arrays
- fixed bug #13469: getPerPageSelectBox() can produce invalid xhtml with no data
+- request #13509: added 'prevImgEmpty' and 'nextImgEmpty' options to show a
disabled
+ prev/next page link when you are on the last/first page (cweiske)
</notes>
</release>
<release>
http://cvs.php.net/viewvc.cgi/pear/Pager/tests/pager_test.php?r1=1.30&r2=1.31&diff_format=u
Index: pear/Pager/tests/pager_test.php
diff -u pear/Pager/tests/pager_test.php:1.30 pear/Pager/tests/pager_test.php:1.31
--- pear/Pager/tests/pager_test.php:1.30 Wed Mar 26 21:36:28 2008
+++ pear/Pager/tests/pager_test.php Wed Mar 26 21:54:10 2008
@@ -1,5 +1,5 @@
<?php
-// $Id: pager_test.php,v 1.30 2008/03/26 21:36:28 quipo Exp $
+// $Id: pager_test.php,v 1.31 2008/03/26 21:54:10 quipo Exp $
require_once 'simple_include.php';
require_once 'pager_include.php';
@@ -496,6 +496,21 @@
$expected = '<a href="' . $_SERVER['PHP_SELF'] .
'?pageID=1" title="previous
page">'.$img.'</a> ';
$this->assertEqual($expected, $this->pager->_getBackLink());
}
+ function testGetBackLinkEmpty() {
+ $img = '[FIRST]';
+ $options = array(
+ 'itemData' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+ 'perPage' => 5,
+ );
+ $this->pager = Pager::factory($options);
+ $expected = '';
+ $this->assertEqual($expected, $this->pager->_getBackLink());
+
+ $options['prevImgEmpty'] = $img;
+ $this->pager = Pager::factory($options);
+ $expected = $img.' ';
+ $this->assertEqual($expected, $this->pager->_getBackLink());
+ }
function testGetNexLink() {
$img = '»';
$options = array(
@@ -508,6 +523,22 @@
$expected = ' <a href="' . $_SERVER['PHP_SELF'] .
'?pageID=2" title="next page">'.$img.'</a> ';
$this->assertEqual($expected, $this->pager->_getNextLink());
}
+ function testGetNexLinkEmpty() {
+ $img = '[LAST]';
+ $options = array(
+ 'itemData' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+ 'perPage' => 5,
+ 'currentPage' => 2,
+ );
+ $this->pager = Pager::factory($options);
+ $expected = '';
+ $this->assertEqual($expected, $this->pager->_getNextLink());
+
+ $options['nextImgEmpty'] = $img;
+ $this->pager = Pager::factory($options);
+ $expected = ' '.$img.' ';
+ $this->assertEqual($expected, $this->pager->_getNextLink());
+ }
function testHttpMethodAutoDetect() {
$_POST['pageID'] = 3;
$options = array(