summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-06-16 11:43:44 +0000
committerctrlaltca@gmail.com <>2011-06-16 11:43:44 +0000
commitbbbb873ce571d03d574087b5ae5038a0beed0961 (patch)
treeae054e192340be0e0968e9b3fc4f9da37e46c18d /framework
parent926660127a13207650852ff8c7f5a6f5c9033002 (diff)
backported r2980 to branch/3.1
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/UI/WebControls/TDataGrid.php46
-rw-r--r--framework/Web/UI/WebControls/TDataGridPagerStyle.php38
2 files changed, 81 insertions, 3 deletions
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php
index 9551b376..faa03352 100644
--- a/framework/Web/UI/WebControls/TDataGrid.php
+++ b/framework/Web/UI/WebControls/TDataGrid.php
@@ -9,7 +9,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -176,6 +176,8 @@ class TDataGrid extends TBaseDataList implements INamingContainer
const CMD_PAGE='Page';
const CMD_PAGE_NEXT='Next';
const CMD_PAGE_PREV='Previous';
+ const CMD_PAGE_FIRST='First';
+ const CMD_PAGE_LAST='Last';
/**
* @var TDataGridColumnCollection manually created column collection
@@ -736,6 +738,10 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$pageIndex=$this->getCurrentPageIndex()+1;
else if(strcasecmp($p,self::CMD_PAGE_PREV)===0)
$pageIndex=$this->getCurrentPageIndex()-1;
+ else if(strcasecmp($p,self::CMD_PAGE_FIRST)===0)
+ $pageIndex=0;
+ else if(strcasecmp($p,self::CMD_PAGE_LAST)===0)
+ $pageIndex=$this->getPageCount()-1;
else
$pageIndex=TPropertyValue::ensureInteger($p)-1;
$this->onPageIndexChanged(new TDataGridPageChangedEventParameter($sender,$pageIndex));
@@ -1264,11 +1270,25 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$currentPageIndex=$this->getCurrentPageIndex();
if($currentPageIndex===0)
{
+ if(($text=$style->getFirstPageText())!=='')
+ {
+ $label=$this->createPagerButton($buttonType,false,$text,'','');
+ $controls->add($label);
+ $controls->add("\n");
+ }
+
$label=$this->createPagerButton($buttonType,false,$style->getPrevPageText(),'','');
$controls->add($label);
}
else
{
+ if(($text=$style->getFirstPageText())!=='')
+ {
+ $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_FIRST);
+ $controls->add($button);
+ $controls->add("\n");
+ }
+
$button=$this->createPagerButton($buttonType,true,$style->getPrevPageText(),self::CMD_PAGE,self::CMD_PAGE_PREV);
$controls->add($button);
}
@@ -1277,11 +1297,23 @@ class TDataGrid extends TBaseDataList implements INamingContainer
{
$label=$this->createPagerButton($buttonType,false,$style->getNextPageText(),'','');
$controls->add($label);
+ if(($text=$style->getLastPageText())!=='')
+ {
+ $controls->add("\n");
+ $label=$this->createPagerButton($buttonType,false,$text,'','');
+ $controls->add($label);
+ }
}
else
{
$button=$this->createPagerButton($buttonType,true,$style->getNextPageText(),self::CMD_PAGE,self::CMD_PAGE_NEXT);
$controls->add($button);
+ if(($text=$style->getLastPageText())!=='')
+ {
+ $controls->add("\n");
+ $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_LAST);
+ $controls->add($button);
+ }
}
}
@@ -1314,6 +1346,12 @@ class TDataGrid extends TBaseDataList implements INamingContainer
if($startPageIndex>1)
{
+ if(($text=$style->getFirstPageText())!=='')
+ {
+ $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_FIRST);
+ $controls->add($button);
+ $controls->add("\n");
+ }
$prevPageIndex=$startPageIndex-1;
$button=$this->createPagerButton($buttonType,true,$style->getPrevPageText(),self::CMD_PAGE,"$prevPageIndex");
$controls->add($button);
@@ -1342,6 +1380,12 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$nextPageIndex=$endPageIndex+1;
$button=$this->createPagerButton($buttonType,true,$style->getNextPageText(),self::CMD_PAGE,"$nextPageIndex");
$controls->add($button);
+ if(($text=$style->getLastPageText())!=='')
+ {
+ $controls->add("\n");
+ $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_LAST);
+ $controls->add($button);
+ }
}
}
diff --git a/framework/Web/UI/WebControls/TDataGridPagerStyle.php b/framework/Web/UI/WebControls/TDataGridPagerStyle.php
index e29b9dc9..6d31e72d 100644
--- a/framework/Web/UI/WebControls/TDataGridPagerStyle.php
+++ b/framework/Web/UI/WebControls/TDataGridPagerStyle.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -27,6 +27,8 @@ class TDataGridPagerStyle extends TPanelStyle
private $_mode=null;
private $_nextText=null;
private $_prevText=null;
+ private $_firstText=null;
+ private $_lastText=null;
private $_buttonCount=null;
private $_position=null;
private $_visible=null;
@@ -89,7 +91,7 @@ class TDataGridPagerStyle extends TPanelStyle
}
/**
- * @param string text for the next page button.
+ * @param string text for the previous page button.
*/
public function setPrevPageText($value)
{
@@ -97,6 +99,38 @@ class TDataGridPagerStyle extends TPanelStyle
}
/**
+ * @return string text for the first page button. Defaults to '<<'.
+ */
+ public function getFirstPageText()
+ {
+ return $this->_firstText===null?'<<':$this->_firstText;
+ }
+
+ /**
+ * @param string text for the first page button.
+ */
+ public function setFirstPageText($value)
+ {
+ $this->_firstText=$value;
+ }
+
+ /**
+ * @return string text for the last page button. Defaults to '>>'.
+ */
+ public function getLastPageText()
+ {
+ return $this->_lastText===null?'>>':$this->_lastText;
+ }
+
+ /**
+ * @param string text for the last page button.
+ */
+ public function setLastPageText($value)
+ {
+ $this->_lastText=$value;
+ }
+
+ /**
* @return integer maximum number of pager buttons to be displayed. Defaults to 10.
*/
public function getPageButtonCount()