summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/TClientScriptManager.php4
-rw-r--r--framework/Web/UI/TTemplateManager.php21
-rw-r--r--framework/Web/UI/WebControls/TOutputCache.php12
3 files changed, 22 insertions, 15 deletions
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index cb945fbf..94ef19b6 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -171,8 +171,8 @@ class TClientScriptManager extends TApplicationComponent
*/
public function registerPostBackControl($jsClass,$options)
{
- if(!isset($options['FormID']))
- $options['FormID']=$this->_page->getForm()->getClientID();
+ if(!isset($options['FormID']) && ($form=$this->_page->getForm())!==null)
+ $options['FormID']=$form->getClientID();
$optionString=TJavaScript::encode($options);
$code="new $jsClass($optionString);";
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php
index 07d65fd0..7961a121 100644
--- a/framework/Web/UI/TTemplateManager.php
+++ b/framework/Web/UI/TTemplateManager.php
@@ -289,11 +289,11 @@ class TTemplate extends TApplicationComponent implements ITemplate
if(isset($object[2])) // component
{
$component=Prado::createComponent($object[1]);
- if($component instanceof TOutputCache)
- $component->setCacheKeyPrefix($this->_hashCode.$key);
$properties=&$object[2];
if($component instanceof TControl)
{
+ if($component instanceof TOutputCache)
+ $component->setCacheKeyPrefix($this->_hashCode.$key);
$component->setTemplateControl($tplControl);
if(isset($properties['id']))
{
@@ -332,17 +332,16 @@ class TTemplate extends TApplicationComponent implements ITemplate
$parent->addParsedObject($component);
}
}
- else // string
+ else if(is_string($object[1]))
+ $parent->addParsedObject($object[1]);
+ else if($object[1] instanceof TCompositeLiteral)
{
- if($object[1] instanceof TCompositeLiteral)
- {
- $o=clone $object[1];
- $o->setContainer($tplControl);
- $parent->addParsedObject($o);
- }
- else
- $parent->addParsedObject($object[1]);
+ $o=clone $object[1];
+ $o->setContainer($tplControl);
+ $parent->addParsedObject($o);
}
+ else
+ throw new TConfigurationException('template_content_unexpected',(string)$object[1]);
}
}
diff --git a/framework/Web/UI/WebControls/TOutputCache.php b/framework/Web/UI/WebControls/TOutputCache.php
index a19965b0..76d74b47 100644
--- a/framework/Web/UI/WebControls/TOutputCache.php
+++ b/framework/Web/UI/WebControls/TOutputCache.php
@@ -257,10 +257,18 @@ class TOutputCache extends TControl implements INamingContainer
$name=trim($name);
$params[$name]=$request->itemAt($name);
}
- return self::CACHE_ID_PREFIX.$this->_keyPrefix.$this->getUniqueID().serialize($params);
+ return $this->getBaseCacheKey().serialize($params);
}
else
- return self::CACHE_ID_PREFIX.$this->_keyPrefix.$this->getUniqueID();
+ return $this->getBaseCacheKey();
+ }
+
+ /**
+ * @return string basic cache key without variations
+ */
+ protected function getBaseCacheKey()
+ {
+ return self::CACHE_ID_PREFIX.$this->_keyPrefix.$this->getPage()->getPagePath().$this->getUniqueID();
}
/**