summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r--framework/Web/UI/WebControls/TCheckBox.php14
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxList.php13
-rw-r--r--framework/Web/UI/WebControls/TDropDownList.php14
-rw-r--r--framework/Web/UI/WebControls/TFileUpload.php13
-rw-r--r--framework/Web/UI/WebControls/THiddenField.php14
-rw-r--r--framework/Web/UI/WebControls/TImageButton.php12
-rw-r--r--framework/Web/UI/WebControls/TListBox.php19
-rw-r--r--framework/Web/UI/WebControls/TTextBox.php13
8 files changed, 104 insertions, 8 deletions
diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php
index bf2f9d05..7a0fc603 100644
--- a/framework/Web/UI/WebControls/TCheckBox.php
+++ b/framework/Web/UI/WebControls/TCheckBox.php
@@ -42,6 +42,8 @@
*/
class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatable, IDataRenderer
{
+ private $_dataChanged=false;
+
/**
* @return string tag name of the button
*/
@@ -63,7 +65,7 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
if($newChecked=isset($values[$key]))
$this->setValue($values[$key]);
$this->setChecked($newChecked);
- return $newChecked!==$checked;
+ return $this->_dataChanged=($newChecked!==$checked);
}
/**
@@ -105,6 +107,16 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
}
/**
+ * Returns a value indicating whether postback has caused the control data change.
+ * This method is required by the IPostBackDataHandler interface.
+ * @return boolean whether postback has caused the control data change. False if the page is not in postback mode.
+ */
+ public function getDataChanged()
+ {
+ return $this->_dataChanged;
+ }
+
+ /**
* Returns the value of the property that needs validation.
* @return mixed the property value to be validated
*/
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php
index 09b771eb..d0f4c7ce 100644
--- a/framework/Web/UI/WebControls/TCheckBoxList.php
+++ b/framework/Web/UI/WebControls/TCheckBoxList.php
@@ -52,6 +52,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
private $_repeatedControl;
private $_isEnabled;
private $_changedEventRaised=false;
+ private $_dataChanged=false;
/**
* Constructor.
@@ -315,7 +316,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
if(!$this->_changedEventRaised)
{
$this->_changedEventRaised=true;
- return true;
+ return $this->_dataChanged=true;
}
}
}
@@ -391,6 +392,16 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
}
/**
+ * Returns a value indicating whether postback has caused the control data change.
+ * This method is required by the IPostBackDataHandler interface.
+ * @return boolean whether postback has caused the control data change. False if the page is not in postback mode.
+ */
+ public function getDataChanged()
+ {
+ return $this->_dataChanged;
+ }
+
+ /**
* Returns the value to be validated.
* This methid is required by IValidatable interface.
* @return mixed the value of the property to be validated.
diff --git a/framework/Web/UI/WebControls/TDropDownList.php b/framework/Web/UI/WebControls/TDropDownList.php
index 5bcf0f35..90668b95 100644
--- a/framework/Web/UI/WebControls/TDropDownList.php
+++ b/framework/Web/UI/WebControls/TDropDownList.php
@@ -35,6 +35,8 @@ Prado::using('System.Web.UI.WebControls.TListControl');
*/
class TDropDownList extends TListControl implements IPostBackDataHandler, IValidatable
{
+ private $_dataChanged=false;
+
/**
* Adds attributes to renderer.
* @param THtmlWriter the renderer
@@ -74,7 +76,7 @@ class TDropDownList extends TListControl implements IPostBackDataHandler, IValid
if($this->getSelectedIndex()!==$index)
{
$this->setSelectedIndex($index);
- return true;
+ return $this->_dataChanged=true;
}
}
return false;
@@ -95,6 +97,16 @@ class TDropDownList extends TListControl implements IPostBackDataHandler, IValid
}
/**
+ * Returns a value indicating whether postback has caused the control data change.
+ * This method is required by the IPostBackDataHandler interface.
+ * @return boolean whether postback has caused the control data change. False if the page is not in postback mode.
+ */
+ public function getDataChanged()
+ {
+ return $this->_dataChanged;
+ }
+
+ /**
* @return integer the index (zero-based) of the item being selected.
* If none is selected, the return value is 0 meaning the first item is selected.
* If there is no items, it returns -1.
diff --git a/framework/Web/UI/WebControls/TFileUpload.php b/framework/Web/UI/WebControls/TFileUpload.php
index 04c2c496..b3026e7c 100644
--- a/framework/Web/UI/WebControls/TFileUpload.php
+++ b/framework/Web/UI/WebControls/TFileUpload.php
@@ -58,6 +58,7 @@ class TFileUpload extends TWebControl implements IPostBackDataHandler, IValidata
* @var integer error code of the current file upload
*/
private $_errorCode=UPLOAD_ERR_NO_FILE;
+ private $_dataChanged=false;
/**
* @return string tag name of the file upload control
@@ -207,7 +208,7 @@ class TFileUpload extends TWebControl implements IPostBackDataHandler, IValidata
$this->_fileType=$_FILES[$key]['type'];
$this->_errorCode=$_FILES[$key]['error'];
$this->_localName=$_FILES[$key]['tmp_name'];
- return true;
+ return $this->_dataChanged=true;
}
else
return false;
@@ -236,6 +237,16 @@ class TFileUpload extends TWebControl implements IPostBackDataHandler, IValidata
}
/**
+ * Returns a value indicating whether postback has caused the control data change.
+ * This method is required by the IPostBackDataHandler interface.
+ * @return boolean whether postback has caused the control data change. False if the page is not in postback mode.
+ */
+ public function getDataChanged()
+ {
+ return $this->_dataChanged;
+ }
+
+ /**
* Returns the original file name as the property value to be validated.
* This method is required by IValidatable property.
* @return mixed the property value to be validated
diff --git a/framework/Web/UI/WebControls/THiddenField.php b/framework/Web/UI/WebControls/THiddenField.php
index acead9f0..c206e65b 100644
--- a/framework/Web/UI/WebControls/THiddenField.php
+++ b/framework/Web/UI/WebControls/THiddenField.php
@@ -25,6 +25,8 @@
*/
class THiddenField extends TControl implements IPostBackDataHandler, IValidatable, IDataRenderer
{
+ private $_dataChanged=false;
+
/**
* @return string tag name of the hidden field.
*/
@@ -85,11 +87,21 @@ class THiddenField extends TControl implements IPostBackDataHandler, IValidatabl
else
{
$this->setValue($value);
- return true;
+ return $this->_dataChanged=true;
}
}
/**
+ * Returns a value indicating whether postback has caused the control data change.
+ * This method is required by the IPostBackDataHandler interface.
+ * @return boolean whether postback has caused the control data change. False if the page is not in postback mode.
+ */
+ public function getDataChanged()
+ {
+ return $this->_dataChanged;
+ }
+
+ /**
* Returns the value to be validated.
* This methid is required by IValidatable interface.
* @return mixed the value of the property to be validated.
diff --git a/framework/Web/UI/WebControls/TImageButton.php b/framework/Web/UI/WebControls/TImageButton.php
index 44d4c14b..90055ea0 100644
--- a/framework/Web/UI/WebControls/TImageButton.php
+++ b/framework/Web/UI/WebControls/TImageButton.php
@@ -66,6 +66,7 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven
* @var integer y coordinate that the image is being clicked at
*/
private $_y=0;
+ private $_dataChanged=false;
/**
* @return string tag name of the button
@@ -202,6 +203,7 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven
$this->_y=intval($values["{$uid}_y"]);
if($this->getPage()->getPostBackEventTarget()===null)
$this->getPage()->setPostBackEventTarget($this);
+ $this->_dataChanged=true;
}
return false;
}
@@ -257,6 +259,16 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven
}
/**
+ * Returns a value indicating whether postback has caused the control data change.
+ * This method is required by the IPostBackDataHandler interface.
+ * @return boolean whether postback has caused the control data change. False if the page is not in postback mode.
+ */
+ public function getDataChanged()
+ {
+ return $this->_dataChanged;
+ }
+
+ /**
* @return boolean whether postback event trigger by this button will cause input validation, default is true
*/
public function getCausesValidation()
diff --git a/framework/Web/UI/WebControls/TListBox.php b/framework/Web/UI/WebControls/TListBox.php
index c49e2561..6112915f 100644
--- a/framework/Web/UI/WebControls/TListBox.php
+++ b/framework/Web/UI/WebControls/TListBox.php
@@ -38,6 +38,8 @@ Prado::using('System.Web.UI.WebControls.TListControl');
*/
class TListBox extends TListControl implements IPostBackDataHandler, IValidatable
{
+ private $_dataChanged=false;
+
/**
* Adds attribute name-value pairs to renderer.
* This method overrides the parent implementation with additional list box specific attributes.
@@ -99,7 +101,7 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl
if($this->getSelectedIndex()!==$index)
{
$this->setSelectedIndex($index);
- return true;
+ return $this->_dataChanged=true;
}
else
return false;
@@ -127,13 +129,16 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl
else
$flag=true;
if($flag)
+ {
$this->setSelectedIndices($list);
+ $this->_dataChanged=true;
+ }
return $flag;
}
else if($this->getSelectedIndex()!==-1)
{
$this->clearSelection();
- return true;
+ return $this->_dataChanged=true;
}
else
return false;
@@ -154,6 +159,16 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl
}
/**
+ * Returns a value indicating whether postback has caused the control data change.
+ * This method is required by the IPostBackDataHandler interface.
+ * @return boolean whether postback has caused the control data change. False if the page is not in postback mode.
+ */
+ public function getDataChanged()
+ {
+ return $this->_dataChanged;
+ }
+
+ /**
* @return boolean whether this control allows multiple selection
*/
protected function getIsMultiSelect()
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index 3517c73a..1fd54191 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -66,6 +66,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
* @var string safe textbox content with javascript stripped off
*/
private $_safeText;
+ private $_dataChanged=false;
/**
* @return string tag name of the textbox
@@ -216,13 +217,23 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
if(!$this->getReadOnly() && $this->getText()!==$value)
{
$this->setText($value);
- return true;
+ return $this->_dataChanged=true;
}
else
return false;
}
/**
+ * Returns a value indicating whether postback has caused the control data change.
+ * This method is required by the IPostBackDataHandler interface.
+ * @return boolean whether postback has caused the control data change. False if the page is not in postback mode.
+ */
+ public function getDataChanged()
+ {
+ return $this->_dataChanged;
+ }
+
+ /**
* Returns the value to be validated.
* This methid is required by IValidatable interface.
* @return mixed the value of the property to be validated.