summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/TTemplateManager.php4
-rw-r--r--framework/Web/UI/TThemeManager.php53
2 files changed, 42 insertions, 15 deletions
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php
index 950f2c70..332ed7ab 100644
--- a/framework/Web/UI/TTemplateManager.php
+++ b/framework/Web/UI/TTemplateManager.php
@@ -177,7 +177,7 @@ class TTemplate extends TApplicationComponent implements ITemplate
* '<%[%#~\\$=\\[](.*?)%>' - expressions
* '<prop:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/>' - group subproperty tags
*/
- const REGEX_RULES='/<!--.*?--!>|<!--.*?-->|<\/?com:([\w\.]+)((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?"|\s*[\w\.]+\s*=\s*<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?")*)\s*%>|<%[%#~\\$=\\[](.*?)%>|<prop:([\w\.]+)((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?"|\s*[\w\.]+\s*=\s*<%.*?%>)*)\s*\/>/msS';
+ const REGEX_RULES='/<!--.*?--!?>|<\/?com:([\w\.]+)((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?"|\s*[\w\.]+\s*=\s*<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?")*)\s*%>|<%[%#~\\$=\\[](.*?)%>|<prop:([\w\.]+)((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?"|\s*[\w\.]+\s*=\s*<%.*?%>)*)\s*\/>/msS';
/**
* Different configurations of component property/event/attribute
@@ -484,6 +484,7 @@ class TTemplate extends TApplicationComponent implements ITemplate
$component->$setter(Prado::localize($value[1]));
break;
default: // an error if reaching here
+ throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
break;
}
}
@@ -529,6 +530,7 @@ class TTemplate extends TApplicationComponent implements ITemplate
$component->setSubProperty($name,Prado::localize($value[1]));
break;
default: // an error if reaching here
+ throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
break;
}
}
diff --git a/framework/Web/UI/TThemeManager.php b/framework/Web/UI/TThemeManager.php
index f87f0783..6b3fe53c 100644
--- a/framework/Web/UI/TThemeManager.php
+++ b/framework/Web/UI/TThemeManager.php
@@ -301,11 +301,13 @@ class TTheme extends TApplicationComponent implements ITheme
unset($skin[2]['skinid']);
if(isset($this->_skins[$type][$id]))
throw new TConfigurationException('theme_skinid_duplicated',$type,$id,dirname($themePath));
+ /*
foreach($skin[2] as $name=>$value)
{
if(is_array($value) && ($value[0]===TTemplate::CONFIG_DATABIND || $value[0]===TTemplate::CONFIG_PARAMETER))
throw new TConfigurationException('theme_databind_forbidden',dirname($themePath),$type,$id);
}
+ */
$this->_skins[$type][$id]=$skin[2];
}
}
@@ -363,28 +365,51 @@ class TTheme extends TApplicationComponent implements ITheme
Prado::trace("Applying skin $name to $type",'System.Web.UI.TThemeManager');
if(is_array($value))
{
- if($value[0]===TTemplate::CONFIG_EXPRESSION)
- $value=$this->evaluateExpression($value[1]);
- else if($value[0]===TTemplate::CONFIG_ASSET)
- $value=$this->_themeUrl.'/'.ltrim($value[1],'/');
+ switch($value[0])
+ {
+ case TTemplate::CONFIG_EXPRESSION:
+ $value=$this->evaluateExpression($value[1]);
+ break;
+ case TTemplate::CONFIG_ASSET:
+ $value=$this->_themeUrl.'/'.ltrim($value[1],'/');
+ break;
+ case TTemplate::CONFIG_DATABIND:
+ $control->bindProperty($name,$value[1]);
+ break;
+ case TTemplate::CONFIG_PARAMETER:
+ $control->setSubProperty($name,$this->getApplication()->getParameters()->itemAt($value[1]));
+ break;
+ case TTemplate::CONFIG_TEMPLATE:
+ $control->setSubProperty($name,$value[1]);
+ break;
+ case TTemplate::CONFIG_LOCALIZATION:
+ $control->setSubProperty($name,Prado::localize($value[1]));
+ break;
+ default:
+ throw new TConfigurationException('theme_tag_unexpected',$name,$value[0]);
+ break;
+ }
}
- if(strpos($name,'.')===false) // is simple property or custom attribute
+ if(!is_array($value))
{
- if($control->hasProperty($name))
+ if(strpos($name,'.')===false) // is simple property or custom attribute
{
- if($control->canSetProperty($name))
+ if($control->hasProperty($name))
{
- $setter='set'.$name;
- $control->$setter($value);
+ if($control->canSetProperty($name))
+ {
+ $setter='set'.$name;
+ $control->$setter($value);
+ }
+ else
+ throw new TConfigurationException('theme_property_readonly',$type,$name);
}
else
- throw new TConfigurationException('theme_property_readonly',$type,$name);
+ throw new TConfigurationException('theme_property_undefined',$type,$name);
}
- else
- throw new TConfigurationException('theme_property_undefined',$type,$name);
+ else // complex property
+ $control->setSubProperty($name,$value);
}
- else // complex property
- $control->setSubProperty($name,$value);
}
return true;
}