summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls
diff options
context:
space:
mode:
authorxue <>2006-06-15 18:18:47 +0000
committerxue <>2006-06-15 18:18:47 +0000
commit6c0154fb4e292ad22667e618f598a37cc5f9d524 (patch)
tree925b51622b8f054d203050cd673eb48a24035c3c /framework/Web/UI/WebControls
parentc8919fa9fc845ab7f3c6701b6de08c8cd042ec30 (diff)
Merge from 3.0 branch till 1166.
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php38
-rw-r--r--framework/Web/UI/WebControls/TDataGrid.php4
-rw-r--r--framework/Web/UI/WebControls/TDataList.php4
-rw-r--r--framework/Web/UI/WebControls/TRepeater.php4
-rw-r--r--framework/Web/UI/WebControls/TTable.php5
5 files changed, 46 insertions, 9 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index 3fe9ee03..1194089e 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -473,10 +473,22 @@ abstract class TBaseValidator extends TLabel implements IValidator
*/
public function validate()
{
+ $this->onValidate();
$this->setIsValid(true);
$control=$this->getValidationTarget();
if($control && $this->getVisible(true) && $this->getEnabled())
- $this->setIsValid($this->evaluateIsValid());
+ {
+ if($this->evaluateIsValid())
+ {
+ $this->setIsValid(true);
+ $this->onSuccess();
+ }
+ else
+ {
+ $this->setIsValid(false);
+ $this->onError();
+ }
+ }
return $this->getIsValid();
}
@@ -504,6 +516,30 @@ abstract class TBaseValidator extends TLabel implements IValidator
abstract protected function evaluateIsValid();
/**
+ * This event is raised when the validator succeeds in validation.
+ */
+ public function onSuccess()
+ {
+ $this->raiseEvent('OnSuccess',$this,null);
+ }
+
+ /**
+ * This event is raised when the validator fails in validation.
+ */
+ public function onError()
+ {
+ $this->raiseEvent('OnError',$this,null);
+ }
+
+ /**
+ * This event is raised right before the validator starts to perform validation.
+ */
+ public function onValidate()
+ {
+ $this->raiseEvent('OnValidate',$this,null);
+ }
+
+ /**
* Renders the validator control.
* @param THtmlWriter writer for the rendering purpose
*/
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php
index d2625c0d..69798c1a 100644
--- a/framework/Web/UI/WebControls/TDataGrid.php
+++ b/framework/Web/UI/WebControls/TDataGrid.php
@@ -1047,10 +1047,12 @@ class TDataGrid extends TBaseDataList implements INamingContainer
$editIndex=$this->getEditItemIndex();
$index=0;
$dsIndex=$ds->getAllowPaging()?$ds->getFirstIndexInPage():0;
- foreach($ds as $data)
+ foreach($ds as $key=>$data)
{
if($keyField!=='')
$keys->add($this->getDataFieldValue($data,$keyField));
+ else
+ $keys->add($key);
if($index===$editIndex)
$itemType=self::IT_EDITITEM;
else if($index===$selectedIndex)
diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php
index 0bec8921..b2bd9229 100644
--- a/framework/Web/UI/WebControls/TDataList.php
+++ b/framework/Web/UI/WebControls/TDataList.php
@@ -1129,10 +1129,12 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
$hasSeparator=$this->_separatorTemplate!==null;
$selectedIndex=$this->getSelectedItemIndex();
$editIndex=$this->getEditItemIndex();
- foreach($data as $dataItem)
+ foreach($data as $key=>$dataItem)
{
if($keyField!=='')
$keys->add($this->getDataFieldValue($dataItem,$keyField));
+ else
+ $keys->add($key);
if($itemIndex===0 && $this->_headerTemplate!==null)
$this->_header=$this->createItemInternal(-1,'Header',true,null);
if($hasSeparator && $itemIndex>0)
diff --git a/framework/Web/UI/WebControls/TRepeater.php b/framework/Web/UI/WebControls/TRepeater.php
index 2070cb1a..9c1cc4ac 100644
--- a/framework/Web/UI/WebControls/TRepeater.php
+++ b/framework/Web/UI/WebControls/TRepeater.php
@@ -443,10 +443,12 @@ class TRepeater extends TDataBoundControl implements INamingContainer
$items=$this->getItems();
$itemIndex=0;
$hasSeparator=$this->_separatorTemplate!==null;
- foreach($data as $dataItem)
+ foreach($data as $key=>$dataItem)
{
if($keyField!=='')
$keys->add($this->getDataFieldValue($dataItem,$keyField));
+ else
+ $keys->add($key);
if($itemIndex===0 && $this->_headerTemplate!==null)
$this->_header=$this->createItemInternal(-1,self::IT_HEADER,true,null);
if($hasSeparator && $itemIndex>0)
diff --git a/framework/Web/UI/WebControls/TTable.php b/framework/Web/UI/WebControls/TTable.php
index aaed37df..1c58c62e 100644
--- a/framework/Web/UI/WebControls/TTable.php
+++ b/framework/Web/UI/WebControls/TTable.php
@@ -68,11 +68,6 @@ Prado::using('System.Web.UI.WebControls.TTableRow');
class TTable extends TWebControl
{
/**
- * @var TTableRowCollection row collection
- */
- private $_rows=null;
-
- /**
* @return string tag name for the table
*/
protected function getTagName()