summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/UI/TControl.php15
-rw-r--r--framework/Web/UI/WebControls/TDataGridPagerStyle.php29
-rw-r--r--framework/Web/UI/WebControls/TFont.php17
-rw-r--r--framework/Web/UI/WebControls/TLabel.php2
-rw-r--r--framework/Web/UI/WebControls/TListItem.php29
-rw-r--r--framework/Web/UI/WebControls/TLiteral.php2
-rw-r--r--framework/Web/UI/WebControls/TPanelStyle.php21
-rw-r--r--framework/Web/UI/WebControls/TStyle.php61
-rw-r--r--framework/Web/UI/WebControls/TTextBox.php2
9 files changed, 168 insertions, 10 deletions
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index 055b5521..afe1daa3 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -769,13 +769,19 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable
{
if($this->_trackViewState)
{
- $this->_viewState[$key]=$value;
unset($this->_tempState[$key]);
+ if($value===$defaultValue)
+ unset($this->_viewState[$key]);
+ else
+ $this->_viewState[$key]=$value;
}
else
{
unset($this->_viewState[$key]);
- $this->_tempState[$key]=$value;
+ if($value===$defaultValue)
+ unset($this->_tempState[$key]);
+ else
+ $this->_tempState[$key]=$value;
}
}
@@ -1655,7 +1661,10 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable
foreach($this->_rf[self::RF_CONTROLS] as $control)
{
if($control instanceof TControl)
- $state[$control->_id]=&$control->saveStateRecursive($needViewState);
+ {
+ if(count($tmp = &$control->saveStateRecursive($needViewState)))
+ $state[$control->_id]=$tmp;
+ }
}
}
if($needViewState && !empty($this->_viewState))
diff --git a/framework/Web/UI/WebControls/TDataGridPagerStyle.php b/framework/Web/UI/WebControls/TDataGridPagerStyle.php
index b96d0cd2..36d55ba9 100644
--- a/framework/Web/UI/WebControls/TDataGridPagerStyle.php
+++ b/framework/Web/UI/WebControls/TDataGridPagerStyle.php
@@ -33,6 +33,35 @@ class TDataGridPagerStyle extends TPanelStyle
private $_buttonType=null;
/**
+ * Returns an array with the names of all variables of this object that should NOT be serialized
+ * because their value is the default one or useless to be cached for the next page loads.
+ * Reimplement in derived classes to add new variables, but remember to also to call the parent
+ * implementation first.
+ */
+ protected function __getZappableSleepProps(&$exprops)
+ {
+ parent::__getZappableSleepProps($exprops);
+ if ($this->_mode===null)
+ $exprops[] = "\0TDataGridPagerStyle\0_mode";
+ if ($this->_nextText===null)
+ $exprops[] = "\0TDataGridPagerStyle\0_nextText";
+ if ($this->_prevText===null)
+ $exprops[] = "\0TDataGridPagerStyle\0_prevText";
+ if ($this->_firstText===null)
+ $exprops[] = "\0TDataGridPagerStyle\0_firstText";
+ if ($this->_lastText===null)
+ $exprops[] = "\0TDataGridPagerStyle\0_lastText";
+ if ($this->_buttonCount===null)
+ $exprops[] = "\0TDataGridPagerStyle\0_buttonCount";
+ if ($this->_position===null)
+ $exprops[] = "\0TDataGridPagerStyle\0_position";
+ if ($this->_visible===null)
+ $exprops[] = "\0TDataGridPagerStyle\0_visible";
+ if ($this->_buttonType===null)
+ $exprops[] = "\0TDataGridPagerStyle\0_buttonType";
+ }
+
+ /**
* @return TDataGridPagerMode pager mode. Defaults to TDataGridPagerMode::NextPrev.
*/
public function getMode()
diff --git a/framework/Web/UI/WebControls/TFont.php b/framework/Web/UI/WebControls/TFont.php
index 52a5db71..ab09c58e 100644
--- a/framework/Web/UI/WebControls/TFont.php
+++ b/framework/Web/UI/WebControls/TFont.php
@@ -54,6 +54,23 @@ class TFont extends TComponent
private $_size='';
/**
+ * Returns an array with the names of all variables of this object that should NOT be serialized
+ * because their value is the default one or useless to be cached for the next page loads.
+ * Reimplement in derived classes to add new variables, but remember to also to call the parent
+ * implementation first.
+ */
+ protected function __getZappableSleepProps(&$exprops)
+ {
+ parent::__getZappableSleepProps($exprops);
+ if ($this->_flags===0)
+ $exprops[] = "\0TFont\0_flags";
+ if ($this->_name==='')
+ $exprops[] = "\0TFont\0_name";
+ if ($this->_size==='')
+ $exprops[] = "\0TFont\0_size";
+ }
+
+ /**
* @return boolean whether the font is in bold face. Defaults to false.
*/
public function getBold()
diff --git a/framework/Web/UI/WebControls/TLabel.php b/framework/Web/UI/WebControls/TLabel.php
index bf43b4d2..28b0ffd4 100644
--- a/framework/Web/UI/WebControls/TLabel.php
+++ b/framework/Web/UI/WebControls/TLabel.php
@@ -102,7 +102,7 @@ class TLabel extends TWebControl implements IDataRenderer
*/
public function setText($value)
{
- $this->setViewState('Text',$value,'');
+ $this->setViewState('Text',TPropertyValue::ensureString($value),'');
}
/**
diff --git a/framework/Web/UI/WebControls/TListItem.php b/framework/Web/UI/WebControls/TListItem.php
index aec006db..5a9122d6 100644
--- a/framework/Web/UI/WebControls/TListItem.php
+++ b/framework/Web/UI/WebControls/TListItem.php
@@ -32,19 +32,19 @@ class TListItem extends TComponent
/**
* @var string text of the item
*/
- private $_text;
+ private $_text='';
/**
* @var string value of the item
*/
- private $_value;
+ private $_value='';
/**
* @var boolean whether the item is enabled
*/
- private $_enabled;
+ private $_enabled=true;
/**
* @var boolean whether the item is selected
*/
- private $_selected;
+ private $_selected=false;
/**
* Constructor.
@@ -62,6 +62,27 @@ class TListItem extends TComponent
}
/**
+ * Returns an array with the names of all variables of this object that should NOT be serialized
+ * because their value is the default one or useless to be cached for the next page loads.
+ * Reimplement in derived classes to add new variables, but remember to also to call the parent
+ * implementation first.
+ */
+ protected function __getZappableSleepProps(&$exprops)
+ {
+ parent::__getZappableSleepProps($exprops);
+ if ($this->_attributes===null)
+ $exprops[] = "\0TListItem\0_attributes";
+ if($this->_text==='')
+ $exprops[] = "\0TListItem\0_text";
+ if($this->_value==='')
+ $exprops[] = "\0TListItem\0_value";
+ if ($this->_enabled===true)
+ $exprops[] = "\0TListItem\0_enabled";
+ if ($this->_selected===false)
+ $exprops[] = "\0TListItem\0_selected";
+ }
+
+ /**
* @return boolean whether the item is enabled
*/
public function getEnabled()
diff --git a/framework/Web/UI/WebControls/TLiteral.php b/framework/Web/UI/WebControls/TLiteral.php
index f2306b4b..650ed070 100644
--- a/framework/Web/UI/WebControls/TLiteral.php
+++ b/framework/Web/UI/WebControls/TLiteral.php
@@ -45,7 +45,7 @@ class TLiteral extends TControl implements IDataRenderer
*/
public function setText($value)
{
- $this->setViewState('Text',$value,'');
+ $this->setViewState('Text',TPropertyValue::ensureString($value),'');
}
/**
diff --git a/framework/Web/UI/WebControls/TPanelStyle.php b/framework/Web/UI/WebControls/TPanelStyle.php
index 2e0f1a2a..a3558dc7 100644
--- a/framework/Web/UI/WebControls/TPanelStyle.php
+++ b/framework/Web/UI/WebControls/TPanelStyle.php
@@ -46,6 +46,27 @@ class TPanelStyle extends TStyle
private $_wrap=null;
/**
+ * Returns an array with the names of all variables of this object that should NOT be serialized
+ * because their value is the default one or useless to be cached for the next page loads.
+ * Reimplement in derived classes to add new variables, but remember to also to call the parent
+ * implementation first.
+ */
+ protected function __getZappableSleepProps(&$exprops)
+ {
+ parent::__getZappableSleepProps($exprops);
+ if ($this->_backImageUrl===null)
+ $exprops[] = "\0TPanelStyle\0_backImageUrl";
+ if ($this->_direction===null)
+ $exprops[] = "\0TPanelStyle\0_direction";
+ if ($this->_horizontalAlign===null)
+ $exprops[] = "\0TPanelStyle\0_horizontalAlign";
+ if ($this->_scrollBars===null)
+ $exprops[] = "\0TPanelStyle\0_scrollBars";
+ if ($this->_wrap===null)
+ $exprops[] = "\0TPanelStyle\0_wrap";
+ }
+
+ /**
* Adds attributes related to CSS styles to renderer.
* This method overrides the parent implementation.
* @param THtmlWriter the writer used for the rendering purpose
diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php
index eb47f2f7..552a3786 100644
--- a/framework/Web/UI/WebControls/TStyle.php
+++ b/framework/Web/UI/WebControls/TStyle.php
@@ -47,6 +47,27 @@ class TStyle extends TComponent
private $_displayStyle='Fixed';
/**
+ * Returns an array with the names of all variables of this object that should NOT be serialized
+ * because their value is the default one or useless to be cached for the next page loads.
+ * Reimplement in derived classes to add new variables, but remember to also to call the parent
+ * implementation first.
+ */
+ protected function __getZappableSleepProps(&$exprops)
+ {
+ parent::__getZappableSleepProps($exprops);
+ if ($this->_fields===array())
+ $exprops[] = "\0TStyle\0_fields";
+ if($this->_font===null)
+ $exprops[] = "\0TStyle\0_font";
+ if($this->_class===null)
+ $exprops[] = "\0TStyle\0_class";
+ if ($this->_customStyle===null)
+ $exprops[] = "\0TStyle\0_customStyle";
+ if ($this->_displayStyle==='Fixed')
+ $exprops[] = "\0TStyle\0_displayStyle";
+ }
+
+ /**
* Constructor.
* @param TStyle style to copy from
*/
@@ -463,6 +484,29 @@ class TTableStyle extends TStyle
private $_borderCollapse=null;
/**
+ * Returns an array with the names of all variables of this object that should NOT be serialized
+ * because their value is the default one or useless to be cached for the next page loads.
+ * Reimplement in derived classes to add new variables, but remember to also to call the parent
+ * implementation first.
+ */
+ protected function __getZappableSleepProps(&$exprops)
+ {
+ parent::__getZappableSleepProps($exprops);
+ if ($this->_backImageUrl===null)
+ $exprops[] = "\0TTableStyle\0_backImageUrl";
+ if ($this->_horizontalAlign===null)
+ $exprops[] = "\0TTableStyle\0_horizontalAlign";
+ if ($this->_cellPadding===null)
+ $exprops[] = "\0TTableStyle\0_cellPadding";
+ if ($this->_cellSpacing===null)
+ $exprops[] = "\0TTableStyle\0_cellSpacing";
+ if ($this->_gridLines===null)
+ $exprops[] = "\0TTableStyle\0_gridLines";
+ if ($this->_borderCollapse===null)
+ $exprops[] = "\0TTableStyle\0_borderCollapse";
+ }
+
+ /**
* Sets the style attributes to default values.
* This method overrides the parent implementation by
* resetting additional TTableStyle specific attributes.
@@ -691,6 +735,23 @@ class TTableItemStyle extends TStyle
private $_wrap=null;
/**
+ * Returns an array with the names of all variables of this object that should NOT be serialized
+ * because their value is the default one or useless to be cached for the next page loads.
+ * Reimplement in derived classes to add new variables, but remember to also to call the parent
+ * implementation first.
+ */
+ protected function __getZappableSleepProps(&$exprops)
+ {
+ parent::__getZappableSleepProps($exprops);
+ if ($this->_horizontalAlign===null)
+ $exprops[] = "\0TTableItemStyle\0_horizontalAlign";
+ if ($this->_verticalAlign===null)
+ $exprops[] = "\0TTableItemStyle\0_verticalAlign";
+ if ($this->_wrap===null)
+ $exprops[] = "\0TTableItemStyle\0_wrap";
+ }
+
+ /**
* Sets the style attributes to default values.
* This method overrides the parent implementation by
* resetting additional TTableItemStyle specific attributes.
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index f3a0c166..cd7b1c57 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -478,7 +478,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
*/
public function setText($value)
{
- $this->setViewState('Text',$value,'');
+ $this->setViewState('Text',TPropertyValue::ensureString($value),'');
$this->_safeText = null;
}