diff options
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | demos/personal/protected/Pages/Home.page | 3 | ||||
-rw-r--r-- | framework/Web/UI/TTemplateManager.php | 17 |
3 files changed, 16 insertions, 5 deletions
@@ -11,6 +11,7 @@ NEW: SQLMap (Wei) Version 3.0.0 May 1, 2006
=========================
BUG: Ticket#131 - TImageMap and TLinkButton continue to postback even client validator fails (Wei)
+BUT: Non-control components can now use expressions in their properties (Qiang)
BUG: TControl.Visible did not make use of overriden getVisible() (Qiang)
BUG: TWizard did not stop navigation upon a validation failure (Qiang)
ENH: TButton, TImageButton and TLinkButton now implement IButtonControl interface (Qiang)
diff --git a/demos/personal/protected/Pages/Home.page b/demos/personal/protected/Pages/Home.page index 32a3b1b2..bd8bd2c7 100644 --- a/demos/personal/protected/Pages/Home.page +++ b/demos/personal/protected/Pages/Home.page @@ -1,5 +1,4 @@ <com:TContent ID="main">
main content
-<com:TTextBox ID="TextBox" /><com:TButton Text="Submit" />
-<com:TLiteral Text=<%=$this->TextBox->Text %> />
+<com:TTextBox ID="TextBox" />
</com:TContent>
\ No newline at end of file diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 13a5cd28..90070a5a 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -202,6 +202,7 @@ class TTemplate extends TApplicationComponent implements ITemplate * @var string hash code of the template
*/
private $_hashCode='';
+ private $_tplControl=null;
/**
@@ -275,6 +276,7 @@ class TTemplate extends TApplicationComponent implements ITemplate */
public function instantiateIn($tplControl)
{
+ $this->_tplControl=$tplControl;
if(($page=$tplControl->getPage())===null)
$page=$this->getService()->getRequestedPage();
$controls=array();
@@ -405,7 +407,13 @@ class TTemplate extends TApplicationComponent implements ITemplate $component->bindProperty($name,$value[1]);
break;
case self::CONFIG_EXPRESSION:
- $component->autoBindProperty($name,$value[1]);
+ if($component instanceof TControl)
+ $component->autoBindProperty($name,$value[1]);
+ else
+ {
+ $setter='set'.$name;
+ $component->$setter($this->_tplControl->evaluateExpression($value[1]));
+ }
break;
case self::CONFIG_TEMPLATE:
$setter='set'.$name;
@@ -451,7 +459,10 @@ class TTemplate extends TApplicationComponent implements ITemplate $component->bindProperty($name,$value[1]);
break;
case self::CONFIG_EXPRESSION: // expression
- $component->autoBindProperty($name,$value[1]);
+ if($component instanceof TControl)
+ $component->autoBindProperty($name,$value[1]);
+ else
+ $component->setSubProperty($name,$this->_tplControl->evaluateExpression($value[1]));
break;
case self::CONFIG_TEMPLATE:
$component->setSubProperty($name,$value[1]);
@@ -823,7 +834,7 @@ class TTemplate extends TApplicationComponent implements ITemplate {
foreach($attributes as $name=>$att)
{
- if(is_array($att) && ($att[0]===self::CONFIG_DATABIND || $att[0]===self::CONFIG_EXPRESSION))
+ if(is_array($att) && ($att[0]===self::CONFIG_DATABIND))
throw new TConfigurationException('template_databind_forbidden',$type,$name);
if(($pos=strpos($name,'.'))!==false)
{
|