diff options
author | wei <> | 2006-08-29 12:53:23 +0000 |
---|---|---|
committer | wei <> | 2006-08-29 12:53:23 +0000 |
commit | 2db708960f4435e2b98518f8fa84cc036ac9f2eb (patch) | |
tree | 6dc4ae8a624bf2afeaadfbed5be81cdd8c1b0ffe /framework/Web/UI | |
parent | f0a6fad58f8eae14554443081ffb166aaf71762a (diff) |
Update active controls.
Diffstat (limited to 'framework/Web/UI')
-rw-r--r-- | framework/Web/UI/ActiveControls/TActiveDropDownList.php | 17 | ||||
-rw-r--r-- | framework/Web/UI/ActiveControls/TActiveListBox.php | 16 | ||||
-rw-r--r-- | framework/Web/UI/ActiveControls/TActiveTextBox.php | 25 | ||||
-rw-r--r-- | framework/Web/UI/ActiveControls/TBaseActiveControl.php | 4 | ||||
-rw-r--r-- | framework/Web/UI/ActiveControls/TInPlaceTextBox.php | 22 | ||||
-rw-r--r-- | framework/Web/UI/TPage.php | 16 |
6 files changed, 18 insertions, 82 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveDropDownList.php b/framework/Web/UI/ActiveControls/TActiveDropDownList.php index 0a6a3832..302b0afa 100644 --- a/framework/Web/UI/ActiveControls/TActiveDropDownList.php +++ b/framework/Web/UI/ActiveControls/TActiveDropDownList.php @@ -67,23 +67,6 @@ class TActiveDropDownList extends TDropDownList implements ICallbackEventHandler } /** - * Loads user input data. - * Disables ActiveControl.EnableUpdate subproperty during loading post data - * to avoid duplicating selection changes. - * @param string the key that can be used to retrieve data from the input data collection - * @param array the input data collection - * @return boolean whether the data of the component has been changed - */ - public function loadPostData($key,$values) - { - $enabled = $this->getActiveControl()->getEnableUpdate(); - $this->getActiveControl()->setEnableUpdate(false); - $result = parent::loadPostData($key, $values); - $this->getActiveControl()->setEnableUpdate($enabled); - return $result; - } - - /** * Creates a collection object to hold list items. A specialized * TActiveListItemCollection is created to allow the drop down list options * to be added. diff --git a/framework/Web/UI/ActiveControls/TActiveListBox.php b/framework/Web/UI/ActiveControls/TActiveListBox.php index 30eeba2c..cb982be2 100644 --- a/framework/Web/UI/ActiveControls/TActiveListBox.php +++ b/framework/Web/UI/ActiveControls/TActiveListBox.php @@ -51,22 +51,6 @@ class TActiveListBox extends TListBox implements IActiveControl, ICallbackEventH } /** - * Loads user input data. Disables the client-side update during loading - * and restore the EnableUpdate of ActiveControl after loading. - * @param string the key that can be used to retrieve data from the input data collection - * @param array the input data collection - * @return boolean whether the data of the component has been changed - */ - public function loadPostData($key,$values) - { - $enabled = $this->getActiveControl()->getEnableUpdate(); - $this->getActiveControl()->setEnableUpdate(false); - $result = parent::loadPostData($key, $values); - $this->getActiveControl()->setEnableUpdate($enabled); - return $result; - } - - /** * Sets the selection mode of the list control (Single, Multiple) * on the client-side if the {@link setEnableUpdate EnableUpdate} * property is set to true. diff --git a/framework/Web/UI/ActiveControls/TActiveTextBox.php b/framework/Web/UI/ActiveControls/TActiveTextBox.php index c5f0f152..20358a36 100644 --- a/framework/Web/UI/ActiveControls/TActiveTextBox.php +++ b/framework/Web/UI/ActiveControls/TActiveTextBox.php @@ -85,31 +85,6 @@ class TActiveTextBox extends TTextBox implements ICallbackEventHandler, IActiveC }
/**
- * Loads user input data.
- * This method is primarly used by framework developers.
- * @param string the key that can be used to retrieve data from the input data collection
- * @param array the input data collection
- * @return boolean whether the data of the component has been changed
- */
- public function loadPostData($key,$values)
- {
- $value=$values[$key];
- if($this->getAutoTrim())
- $value=trim($value);
- if(!$this->getReadOnly() && $this->getText()!==$value)
- {
- $enabled = $this->getActiveControl()->getEnableUpdate();
- $this->getActiveControl()->setEnableUpdate(false);
- $this->setText($value);
- $this->getActiveControl()->setEnableUpdate($enabled);
- return true;
- }
- else
- return false;
- }
-
-
- /**
* Renders the javascript for textbox.
*/
protected function renderClientControlScript($writer)
diff --git a/framework/Web/UI/ActiveControls/TBaseActiveControl.php b/framework/Web/UI/ActiveControls/TBaseActiveControl.php index e5fe8f16..ed2e50db 100644 --- a/framework/Web/UI/ActiveControls/TBaseActiveControl.php +++ b/framework/Web/UI/ActiveControls/TBaseActiveControl.php @@ -119,13 +119,15 @@ class TBaseActiveControl extends TComponent /**
* Returns true if callback response is allowed to update the browser contents.
* Is is true if the control is initilized, and is a callback request and
- * the {@link setEnableUpdate EnabledUpdate} property is true.
+ * the {@link setEnableUpdate EnabledUpdate} property is true and
+ * the page is not loading post data.
* @return boolean true if the callback response is allowed update
* client-side contents.
*/
public function canUpdateClientSide()
{
return $this->getControl()->getHasChildInitialized()
+ && $this->getPage()->getIsLoadingPostData() == false
&& $this->getPage()->getIsCallback()
&& $this->getEnableUpdate();
}
diff --git a/framework/Web/UI/ActiveControls/TInPlaceTextBox.php b/framework/Web/UI/ActiveControls/TInPlaceTextBox.php index b783be88..b131da24 100644 --- a/framework/Web/UI/ActiveControls/TInPlaceTextBox.php +++ b/framework/Web/UI/ActiveControls/TInPlaceTextBox.php @@ -190,28 +190,6 @@ class TInPlaceTextBox extends TLabel implements $this->setViewState('ValidationGroup',$value,'');
}
- /**
- * Loads user input data.
- * This method is primarly used by framework developers.
- * @param string the key that can be used to retrieve data from the input data collection
- * @param array the input data collection
- * @return boolean whether the data of the component has been changed
- */
- public function loadPostData($key,$values)
- {
- $value=$values[$key];
- if($this->getText()!==$value)
- {
- $enabled = $this->getActiveControl()->getEnableUpdate();
- $this->getActiveControl()->setEnableUpdate(false);
- $this->setText($value);
- $this->getActiveControl()->setEnableUpdate($enabled);
- return true;
- }
- else
- return false;
- }
-
public function raisePostDataChangedEvent()
{
$this->onTextChanged(null);
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index 60586fab..2bdfd3cf 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -153,6 +153,10 @@ class TPage extends TTemplateControl * @var array post data loader IDs.
*/
private $_postDataLoaders=array();
+ /**
+ * @var boolean true if loading post data.
+ */
+ private $_isLoadingPostData=false;
/**
* Constructor.
@@ -271,7 +275,7 @@ class TPage extends TTemplateControl protected function processCallbackRequest($writer)
{
Prado::using('System.Web.UI.ActiveControls.TActivePageAdapter');
-
+
$this->setAdapter(new TActivePageAdapter($this));
Prado::trace("Page onPreInit()",'System.Web.UI.TPage');
@@ -825,6 +829,7 @@ class TPage extends TTemplateControl */
protected function processPostData($postData,$beforeLoad)
{
+ $this->_isLoadingPostData=true;
if($beforeLoad)
$this->_restPostData=new TMap;
foreach($postData as $key=>$value)
@@ -859,6 +864,15 @@ class TPage extends TTemplateControl unset($this->_controlsRequiringPostData[$key]);
}
}
+ $this->_isLoadingPostData=false;
+ }
+
+ /**
+ * @return boolean true if loading post data.
+ */
+ public function getIsLoadingPostData()
+ {
+ return $this->_isLoadingPostData;
}
/**
|