summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TControl.php
diff options
context:
space:
mode:
authorxue <>2006-01-12 03:22:03 +0000
committerxue <>2006-01-12 03:22:03 +0000
commite126c0067e9efee6542d08bf649588e2cf3a5924 (patch)
treee1b14841cfdf8f05ce307ff9d63e8d2a466999a7 /framework/Web/UI/TControl.php
parenta06e326f247bff617191b1c87a7b004414495275 (diff)
Fixed several issues about viewstate handling. Prado Composer is nearly completed.
Diffstat (limited to 'framework/Web/UI/TControl.php')
-rw-r--r--framework/Web/UI/TControl.php36
1 files changed, 11 insertions, 25 deletions
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index db0e141b..18b7d1e0 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -1285,11 +1285,11 @@ class TControl extends TComponent
*/
final protected function loadStateRecursive(&$state,$needViewState=true)
{
- // A null state means the stateful properties all take default values.
- // So if the state is enabled, we have to assign the null value.
- $needViewState=($needViewState && !($this->_flags & self::IS_DISABLE_VIEWSTATE));
- if(is_array($state))
+ if($state!==null)
{
+ // A null state means the stateful properties all take default values.
+ // So if the state is enabled, we have to assign the null value.
+ $needViewState=($needViewState && !($this->_flags & self::IS_DISABLE_VIEWSTATE));
if(isset($state[1]))
{
$this->_rf[self::RF_CONTROLSTATE]=&$state[1];
@@ -1324,24 +1324,11 @@ class TControl extends TComponent
}
if(!empty($state))
$this->_rf[self::RF_CHILD_STATE]=&$state;
+ $this->_stage=self::CS_STATE_LOADED;
+ $this->onLoadState(null);
}
- else
- {
- unset($this->_rf[self::RF_CONTROLSTATE]);
- if($needViewState)
- $this->_viewState=array();
- if($this->getHasControls())
- {
- foreach($this->_rf[self::RF_CONTROLS] as $control)
- {
- $s=null;
- if($control instanceof TControl)
- $control->loadStateRecursive($s,$needViewState);
- }
- }
- }
- $this->onLoadState(null);
- $this->_stage=self::CS_STATE_LOADED;
+ else // no state to load and thus no need onLoadState()
+ $this->_stage=self::CS_STATE_LOADED;
}
/**
@@ -1361,14 +1348,13 @@ class TControl extends TComponent
if($control instanceof TControl)
{
$cs=&$control->saveStateRecursive($needViewState);
- if(!empty($cs))
- $state[$control->_id]=&$cs;
+ $state[$control->_id]=&$cs;
}
}
}
- if($needViewState && !empty($this->_viewState))
+ if($needViewState)
$state[0]=&$this->_viewState;
- if(isset($this->_rf[self::RF_CONTROLSTATE]) && !empty($this->_rf[self::RF_CONTROLSTATE]))
+ if(isset($this->_rf[self::RF_CONTROLSTATE]))
$state[1]=&$this->_rf[self::RF_CONTROLSTATE];
return $state;
}