Author: pyaschenko
Date: 2007-07-06 12:03:27 -0400 (Fri, 06 Jul 2007)
New Revision: 1526
Modified:
branches/3.0.2/richfaces/common/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
Log:
Modified:
branches/3.0.2/richfaces/common/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
===================================================================
---
branches/3.0.2/richfaces/common/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2007-07-06
16:01:55 UTC (rev 1525)
+++
branches/3.0.2/richfaces/common/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2007-07-06
16:03:27 UTC (rev 1526)
@@ -104,15 +104,35 @@
var value = '';
try {
- with (object) {
- value = eval(template);
+ value = object.eval(template);
if (typeof value == 'function') {
value = value(object);
}
- }
} catch (e) {
LOG.warn('Exception: ' + e.message + '\n[' + template + ']');
}
return value;
};
+
+Richfaces.VARIABLE_NAME_PATTERN = /^\s*[_,A-Z,a-z][\w,_]*\s*$/;
+
+Richfaces.evalMacro = function(template, object)
+{
+ var value="";
+ if (Richfaces.VARIABLE_NAME_PATTERN.test(template))
+ {
+ value = object[template];
+ if (!value) {value=window[template]; if (!value) value="";}
+ } else
+ {
+ try { value=object.eval(template); } catch (e) { LOG.warn("Exception:
"+e.Message + "\n[" + template + "]"); }
+ }
+ return value;
+}
+Richfaces.evalSimpleMacro = function(template, object)
+{
+ var value = object[template];
+ if (!value) {value=window[template]; if (!value) value="";}
+ return value;
+}
Show replies by date