From 5ba6cd4be568f686d890835a77586077cde1a943 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 25 Apr 2006 01:31:43 +0000 Subject: Merge from 3.0 branch till 967. --- framework/Web/Javascripts/TJavaScript.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'framework/Web/Javascripts/TJavaScript.php') diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php index 4066565b..a3848201 100644 --- a/framework/Web/Javascripts/TJavaScript.php +++ b/framework/Web/Javascripts/TJavaScript.php @@ -96,9 +96,16 @@ class TJavaScript * //expects the following javascript code * // {'onLoading':'doit','onComplete':'more'} * + * + * To pass raw javascript statements start strings with + * javascript:. E.g. + * + * $options['onLoading'] = "javascript:function(){ alert('hello'); }"; + * //outputs {'onLoading':function(){ alert('hello'); }} + * * - * For higher complexity data structures use {@link jsonEncode} and {@link jsonDecode} - * to serialize and unserialize. + * For higher complexity data structures use {@link jsonEncode} and {@link + * jsonDecode} to serialize and unserialize. * * @param mixed PHP variable to be encoded * @param boolean whether the output is a map or a list. @@ -115,6 +122,8 @@ class TJavaScript if(($first==='[' && $last===']') || ($first==='{' && $last==='}')) return $value; } + else if(strpos($value, 'javascript:')===0) + return substr($value,11); return "'".self::quoteString($value)."'"; } else if(is_bool($value)) -- cgit v1.2.3