summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2007-04-02 01:23:05 +0000
committerxue <>2007-04-02 01:23:05 +0000
commitcda6cccf6ca7c3fee2d7c37e50b5c7fd7b2c5662 (patch)
tree56d72b8f993190a1f9d76f3cb007618aa3fc7af8
parent8ce268ab449d1fe63baf6a6302af6d05bcf1d1aa (diff)
Fixed the bug that event handler specified via subproperty in template does not work
-rw-r--r--HISTORY1
-rw-r--r--framework/TComponent.php12
2 files changed, 12 insertions, 1 deletions
diff --git a/HISTORY b/HISTORY
index d33f98a6..51c9dee0 100644
--- a/HISTORY
+++ b/HISTORY
@@ -18,6 +18,7 @@ BUG: Ticket#566 - <%[ tags (localize tags) missing escaping (Qiang)
BUG: Ticket#573 - NumberFormat Bug (Wei)
BUG: Ticket#579 - The rating list lost its Javascript in changeset [1775] (Wei).
BUG: Ticket#584 - Parameter names in TTranslate are case-insensitive (Qiang)
+BUG: Event handler specified via subproperty in template does not work (Qiang)
BUG: TXmlElement did not encode attribute and text values when being saved as a string (Qiang)
BUG: SelectedIndices not return expected result for ActiveListBox (Wei)
ENH: Ticket#367 - Change default extension for XLIFF files (Wei, changed to support .xlf extension).
diff --git a/framework/TComponent.php b/framework/TComponent.php
index 54fe7ec7..79732290 100644
--- a/framework/TComponent.php
+++ b/framework/TComponent.php
@@ -345,7 +345,17 @@ class TComponent
{
if(is_string($handler))
{
- call_user_func($handler,$sender,$param);
+ if(($pos=strrpos($handler,'.'))!==false)
+ {
+ $object=$this->getSubProperty(substr($handler,0,$pos));
+ $method=substr($handler,$pos+1);
+ if(method_exists($object,$method))
+ $object->$method($sender,$param);
+ else
+ throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name);
+ }
+ else
+ call_user_func($handler,$sender,$param);
}
else if(is_callable($handler,true))
{