From 984ffd32335727c8329cb15d777fbc9adc0d3052 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 30 Jan 2006 04:46:34 +0000 Subject: Modified viewstate saving method so that much smaller state data is generated. --- framework/Web/UI/TControl.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'framework/Web') diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index 8b272f30..7b9fee4e 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -1320,12 +1320,14 @@ class TControl extends TComponent { if(isset($state[$control->_id])) { - $s=&$state[$control->_id]; + $control->loadStateRecursive($state[$control->_id],$needViewState); unset($state[$control->_id]); } else - $s=null; - $control->loadStateRecursive($s,$needViewState); + { + $s=array(); + $control->loadStateRecursive($s,$needViewState); + } } } } @@ -1339,9 +1341,9 @@ class TControl extends TComponent } /** - * Saves the all control state (viewstate and controlstate) as a collection. + * Saves all control state (viewstate and controlstate) as a collection. * @param boolean whether the viewstate should be saved - * @return TMap the collection of the control state (including its children's state). + * @return array the collection of the control state (including its children's state). */ final protected function &saveStateRecursive($needViewState=true) { @@ -1355,11 +1357,12 @@ class TControl extends TComponent if($control instanceof TControl) { $cs=&$control->saveStateRecursive($needViewState); - $state[$control->_id]=&$cs; + if(!empty($cs)) + $state[$control->_id]=&$cs; } } } - if($needViewState) + if($needViewState && !empty($this->_viewState)) $state[0]=&$this->_viewState; if(isset($this->_rf[self::RF_CONTROLSTATE])) $state[1]=&$this->_rf[self::RF_CONTROLSTATE]; -- cgit v1.2.3