summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/TTemplateManager.php23
-rw-r--r--framework/Web/UI/WebControls/TPanel.php5
2 files changed, 23 insertions, 5 deletions
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php
index 5d17a6fe..b293c4bc 100644
--- a/framework/Web/UI/TTemplateManager.php
+++ b/framework/Web/UI/TTemplateManager.php
@@ -152,9 +152,9 @@ class TTemplate extends TComponent implements ITemplate
* '<\/?com:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/?>' - component tags
* '<\/?prop:([\w\.]+)\s*>' - property tags
* '<%@\s*((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>' - directives
- * '<%[%#~\\$=](.*?)%>' - expressions
+ * '<%[%#~\\$=\\[](.*?)%>' - expressions
*/
- const REGEX_RULES='/<!.*?!>|<!--.*?-->|<\/?com:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>|<%[%#~\\$=](.*?)%>/msS';
+ const REGEX_RULES='/<!.*?!>|<!--.*?-->|<\/?com:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>|<%[%#~\\$=\\[](.*?)%>/msS';
/**
* Different configurations of component property/event/attribute
@@ -163,6 +163,7 @@ class TTemplate extends TComponent implements ITemplate
const CONFIG_EXPRESSION=1;
const CONFIG_ASSET=2;
const CONFIG_PARAMETER=3;
+ const CONFIG_LOCALIZATION=4;
/**
* @var array list of component tags and strings
@@ -376,6 +377,9 @@ class TTemplate extends TComponent implements ITemplate
case self::CONFIG_PARAMETER: // application parameter
$component->$setter($this->getApplication()->getParameters()->itemAt($v));
break;
+ case self::CONFIG_LOCALIZATION:
+ $component->$setter(localize($v));
+ break;
default: // an error if reaching here
break;
}
@@ -413,6 +417,9 @@ class TTemplate extends TComponent implements ITemplate
case self::CONFIG_PARAMETER: // application parameter
$component->setSubProperty($name,$this->getApplication()->getParameters()->itemAt($v));
break;
+ case self::CONFIG_LOCALIZATION:
+ $component->setSubProperty($name,localize($v));
+ break;
default: // an error if reaching here
break;
}
@@ -444,6 +451,9 @@ class TTemplate extends TComponent implements ITemplate
case self::CONFIG_PARAMETER:
$value=$this->getApplication()->getParameters()->itemAt($value[1]);
break;
+ case self::CONFIG_LOCALIZATION:
+ $value=localize($value[1]);
+ break;
default:
break;
}
@@ -682,10 +692,15 @@ class TTemplate extends TComponent implements ITemplate
return $attributes;
}
+ /**
+ * Parses a single attribute.
+ * @param string the string to be parsed.
+ * @return array attribute initialization
+ */
protected function parseAttribute($value)
{
$matches=array();
- if(!preg_match('/^\s*(<%#.*?%>|<%=.*?%>|<%~.*?%>|<%\\$.*?%>)\s*$/msS',$value,$matches))
+ if(!preg_match('/^(<%#.*?%>|<%=.*?%>|<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>)$/msS',$value,$matches))
return $value;
$value=$matches[1];
if($value[2]==='#') // databind
@@ -694,6 +709,8 @@ class TTemplate extends TComponent implements ITemplate
return array(self::CONFIG_EXPRESSION,substr($value,3,strlen($value)-5));
else if($value[2]==='~') // a URL
return array(self::CONFIG_ASSET,trim(substr($value,3,strlen($value)-5)));
+ else if($value[2]==='[')
+ return array(self::CONFIG_LOCALIZATION,trim(substr($value,3,strlen($value)-6)));
else if($value[2]==='$')
return array(self::CONFIG_PARAMETER,trim(substr($value,3,strlen($value)-5)));
}
diff --git a/framework/Web/UI/WebControls/TPanel.php b/framework/Web/UI/WebControls/TPanel.php
index 5065aa61..6661eadb 100644
--- a/framework/Web/UI/WebControls/TPanel.php
+++ b/framework/Web/UI/WebControls/TPanel.php
@@ -74,8 +74,9 @@ class TPanel extends TWebControl
{
$scripts = $this->getPage()->getClientScript();
$js = $scripts->registerDefaultButtonScript($this,$button);
- $scripts->registerEndScript($this->ClientID.'defaultButton', $js);
- $writer->addAttribute('id',$this->getClientID());
+ $clientID=$this->getClientID();
+ $scripts->registerEndScript($clientID.'defaultButton', $js);
+ $writer->addAttribute('id',$clientID);
}
}
}