summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-07-02 03:17:18 +0000
committerxue <>2006-07-02 03:17:18 +0000
commit6535233f952be866d624ad1a573562c6706138de (patch)
treed5c15d5569ccc8ec3c1afb29ef86694c188b4fd0
parent3d8aabc15b85e1a3088295f9278d3407ff71dfea (diff)
Fixed #262.
-rw-r--r--HISTORY1
-rw-r--r--framework/Util/TLogRouter.php4
-rw-r--r--framework/Web/UI/WebControls/TCheckBox.php46
-rw-r--r--framework/Web/UI/WebControls/TRadioButton.php3
4 files changed, 38 insertions, 16 deletions
diff --git a/HISTORY b/HISTORY
index 0f45f68e..f3f66c13 100644
--- a/HISTORY
+++ b/HISTORY
@@ -17,6 +17,7 @@ ENH: Ticket#231 - Added TButton.ButtonType property to allow reset button (Qiang
ENH: Ticket#232 - Allow <%# %> and <%= %> embedded within property values (Qiang)
ENH: Ticket#256 - Datagrid columns can now be accessed via IDs (Qiang)
ENH: Ticket#257 - OnSelectedIndexChanged event of TDataList and TDataGrid now passes the original command parameter (Qiang)
+ENH: Ticket#262 - Added TCheckBox.Value property (Qiang)
ENH: TRepeater, TDataList and TDataGrid will store data indices in DataKeys if DataKeyField is not set. (Qiang)
ENH: Added TPageService.BasePageClass property (Qiang)
ENH: Added TDataGrid.EmptyTemplate property (Qiang)
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,
* <code>
- * &lt;route class="TFileLogRoute" Categories="System.Web.UI" Levels="Warning" /&gt;
- * &lt;route class="TEmailLogRoute" Categories="Application" Levels="Fatal" Emails="admin@pradosoft.com" /&gt;
+ * <route class="TFileLogRoute" Categories="System.Web.UI" Levels="Warning" />
+ * <route class="TEmailLogRoute" Categories="Application" Levels="Fatal" Emails="admin@pradosoft.com" />
* </code>
* 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;
}
/**
@@ -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($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())==='')