diff options
author | xue <> | 2006-07-02 18:05:42 +0000 |
---|---|---|
committer | xue <> | 2006-07-02 18:05:42 +0000 |
commit | 7e002c23edc5fb5db70935591aa6adeda25fc7fb (patch) | |
tree | 846feb337405448cc1559c2e7b4ed6f85798e0c7 /framework/Web/UI | |
parent | 618293517861b69334cd470068199394120cd20a (diff) |
Merge from 3.0 branch till 1224.
Diffstat (limited to 'framework/Web/UI')
-rw-r--r-- | framework/Web/UI/WebControls/TBaseValidator.php | 23 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TCheckBox.php | 46 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/THtmlArea.php | 2 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TRadioButton.php | 3 |
4 files changed, 57 insertions, 17 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index a0801d4c..9366de62 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -124,7 +124,7 @@ abstract class TBaseValidator extends TLabel implements IValidator } /** - * Adds attributes to renderer. Calls parent implementation and renders the + * Adds attributes to renderer. Calls parent implementation and renders the * client control scripts. * @param THtmlWriter the renderer */ @@ -237,7 +237,7 @@ abstract class TBaseValidator extends TLabel implements IValidator $this->registerClientScriptValidator(); $this->updateControlCssClass(); } - + /** * Update the ControlToValidate component's css class depending * if the ControlCssClass property is set, and whether this is valid. @@ -635,6 +635,25 @@ class TClientSideValidatorOptions extends TClientSideOptions } /** + * @param boolean true to revalidate when the control to validate changes value. + */ + public function setObserveChanges($value) + { + $this->setOption('ObserveChanges', TPropertyValue::ensureBoolean($value)); + } + + /** + * @return boolean true to observe changes. + */ + public function getObserveChanges() + { + if(($option=$this->getOption('ObserveChanges'))!==null) + return $option; + else + return true; + } + + /** * Ensure the string is a valid javascript function. If the string begins * with "javascript:" valid javascript function is assumed, otherwise the * code block is enclosed with "function(validator, sender){ }" block. diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php index 6fe562c9..04733f95 100644 --- a/framework/Web/UI/WebControls/TCheckBox.php +++ b/framework/Web/UI/WebControls/TCheckBox.php @@ -60,13 +60,10 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl public function loadPostData($key,$values)
{
$checked=$this->getChecked();
- if(isset($values[$key])!=$checked)
- {
- $this->setChecked(!$checked);
- return true;
- }
- else
- return false;
+ if($newChecked=isset($values[$key]))
+ $this->setValue($values[$key]);
+ $this->setChecked($newChecked);
+ return $newChecked!==$checked;
}
/**
@@ -134,6 +131,22 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl }
/**
+ * @return string the value of the checkbox. Defaults to empty.
+ */
+ public function getValue()
+ {
+ return $this->getViewState('Value','');
+ }
+
+ /**
+ * @param string the value of the checkbox
+ */
+ public function setValue($value)
+ {
+ $this->setViewState('Value',$value,'');
+ }
+
+ /**
* @return string the alignment (Left or Right) of the text caption, defaults to Right.
*/
public function getTextAlign()
@@ -309,13 +322,18 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl */
protected function getValueAttribute()
{
- $attributes=$this->getViewState('InputAttributes',null);
- if($attributes && $attributes->contains('value'))
- return $attributes->itemAt('value');
- else if($this->hasAttribute('value'))
- return $this->getAttribute('value');
+ if(($value=$this->getValue())!=='')
+ return $value;
else
- return '';
+ {
+ $attributes=$this->getViewState('InputAttributes',null);
+ if($attributes && $attributes->contains('value'))
+ return $attributes->itemAt('value');
+ else if($this->hasAttribute('value'))
+ return $this->getAttribute('value');
+ else
+ return '';
+ }
}
/**
@@ -345,7 +363,7 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl if($clientID!=='')
$writer->addAttribute('id',$clientID);
$writer->addAttribute('type','checkbox');
- if(($value = $this->getValueAttribute()) !== '')
+ if(($value=$this->getValueAttribute())!=='')
$writer->addAttribute('value',$value);
if(!empty($onclick))
$writer->addAttribute('onclick',$onclick);
diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php index 09f8328c..2a1e311d 100644 --- a/framework/Web/UI/WebControls/THtmlArea.php +++ b/framework/Web/UI/WebControls/THtmlArea.php @@ -219,7 +219,7 @@ class THtmlArea extends TTextBox */
protected function addAttributesToRender($writer)
{
- if($this->getEnableVisualEdit())
+ if($this->getEnableVisualEdit() && $this->getEnabled(true))
{
$writer->addAttribute('id',$this->getClientID());
$this->registerEditorClientScript($writer);
diff --git a/framework/Web/UI/WebControls/TRadioButton.php b/framework/Web/UI/WebControls/TRadioButton.php index bb3e0658..2bbdf22e 100644 --- a/framework/Web/UI/WebControls/TRadioButton.php +++ b/framework/Web/UI/WebControls/TRadioButton.php @@ -101,6 +101,9 @@ class TRadioButton extends TCheckBox $this->setViewState('GroupName',$value,'');
}
+ /**
+ * @return string the value attribute to be rendered
+ */
protected function getValueAttribute()
{
if(($value=parent::getValueAttribute())==='')
|