Author: jmorliaguet Date: Fri Feb 17 00:09:39 2006 New Revision: 2393 Modified: cpsskins/branches/jmo-perspectives/ui/framework/ctal.js cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Log:
- the 'javascript:...' notation evaluates the expression in the context of the data. with: data = { items: [{'title': 'test'}, ...] } <div ctal:repeat="item items"> <span ctal:content="item/title">...</span> </div> is equivalent to: <div ctal:repeat="item items"> <span ctal:content="javascript:item['title']">...</span> </div> Modified: cpsskins/branches/jmo-perspectives/ui/framework/ctal.js ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/ctal.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/ctal.js Fri Feb 17 00:09:39 2006 @@ -238,7 +238,8 @@ } else if (etype == 'path') { return ctal.eval_pathexpr(data, value) } else if (etype == 'javascript') { - return eval(value) + // evaluate the expression in context + return data.eval(value); } else { throw new ctal.TALESError('TALES Expression type "' + etype + '" is not implemented') Modified: cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/tests/unit/cpsskins_ctal_test.html Fri Feb 17 00:09:39 2006 @@ -280,7 +280,7 @@ <div id="e31b"><span ctal:content="javascript:1+1">...</span></div> <div id="e31c"><span - ctal:content="javascript:data['k']['l']['m']">...</span></div> + ctal:content="javascript:k['l']['m']">...</span></div> <!-- edge cases --> -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins