diff options
author | wei <> | 2006-04-25 01:00:08 +0000 |
---|---|---|
committer | wei <> | 2006-04-25 01:00:08 +0000 |
commit | c84f3e19b54cf54f525f4b2d158696ae32d1bf60 (patch) | |
tree | 60720fba29ef72175db47dd3cd4b74d8bbed605b /framework/Web/Javascripts/TJavaScript.php | |
parent | 09edc6590523e26fffbf32f7b0e7958c166f7537 (diff) |
Add TListControlValidator. Update client-side validators, datepicker.js, colorpicker.js.
Diffstat (limited to 'framework/Web/Javascripts/TJavaScript.php')
-rw-r--r-- | framework/Web/Javascripts/TJavaScript.php | 13 |
1 files changed, 11 insertions, 2 deletions
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'}
* </code>
+ *
+ * To pass raw javascript statements start strings with
+ * <tt>javascript:</tt>. E.g.
+ * <code>
+ * $options['onLoading'] = "javascript:function(){ alert('hello'); }";
+ * //outputs {'onLoading':function(){ alert('hello'); }}
+ * </code>
*
- * 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))
|