From 2db708960f4435e2b98518f8fa84cc036ac9f2eb Mon Sep 17 00:00:00 2001 From: wei <> Date: Tue, 29 Aug 2006 12:53:23 +0000 Subject: Update active controls. --- .../Web/UI/ActiveControls/TActiveDropDownList.php | 17 --------------- framework/Web/UI/ActiveControls/TActiveListBox.php | 16 -------------- framework/Web/UI/ActiveControls/TActiveTextBox.php | 25 ---------------------- .../Web/UI/ActiveControls/TBaseActiveControl.php | 4 +++- .../Web/UI/ActiveControls/TInPlaceTextBox.php | 22 ------------------- framework/Web/UI/TPage.php | 16 +++++++++++++- 6 files changed, 18 insertions(+), 82 deletions(-) (limited to 'framework/Web/UI') 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 @@ -66,23 +66,6 @@ class TActiveDropDownList extends TDropDownList implements ICallbackEventHandler return 'Prado.WebUI.TActiveDropDownList'; } - /** - * 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 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 @@ -50,22 +50,6 @@ class TActiveListBox extends TListBox implements IActiveControl, ICallbackEventH return 'Prado.WebUI.TActiveListBox'; } - /** - * 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} 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 @@ -84,31 +84,6 @@ class TActiveTextBox extends TTextBox implements ICallbackEventHandler, IActiveC $this->raiseEvent('OnCallback', $this, $param); } - /** - * 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. */ 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; } /** -- cgit v1.2.3