From 6535233f952be866d624ad1a573562c6706138de Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 2 Jul 2006 03:17:18 +0000 Subject: Fixed #262. --- framework/Util/TLogRouter.php | 4 +-- framework/Web/UI/WebControls/TCheckBox.php | 46 +++++++++++++++++++-------- framework/Web/UI/WebControls/TRadioButton.php | 3 ++ 3 files changed, 37 insertions(+), 16 deletions(-) (limited to 'framework') diff --git a/framework/Util/TLogRouter.php b/framework/Util/TLogRouter.php index fe0d2964..a9d37b2f 100644 --- a/framework/Util/TLogRouter.php +++ b/framework/Util/TLogRouter.php @@ -22,8 +22,8 @@ * or an external configuration file specified by {@link setConfigFile ConfigFile}. * The format is as follows, * - * <route class="TFileLogRoute" Categories="System.Web.UI" Levels="Warning" /> - * <route class="TEmailLogRoute" Categories="Application" Levels="Fatal" Emails="admin@pradosoft.com" /> + * + * * * You can specify multiple routes with different filtering conditions and different * targets, even if the routes are of the same type. diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php index 3eb486f3..1dc177cf 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; } /** @@ -133,6 +130,22 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl $this->setViewState('Text',$value,''); } + /** + * @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. */ @@ -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($onclick!=='') $writer->addAttribute('onclick',$onclick); diff --git a/framework/Web/UI/WebControls/TRadioButton.php b/framework/Web/UI/WebControls/TRadioButton.php index 2ccda96b..9198be1b 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())==='') -- cgit v1.2.3