Implement form::name() pseudo function

This commit is contained in:
Nathan Gray 2012-03-29 22:41:54 +00:00
parent a3ada52adf
commit ced0e0787e

View File

@ -32,7 +32,7 @@
* @param string _cname name-prefix / name-space * @param string _cname name-prefix / name-space
* @return string * @return string
*/ */
function js_pseudo_funcs(_val) function js_pseudo_funcs(_val,widget)
{ {
if (_val.indexOf('egw::link(') != -1) if (_val.indexOf('egw::link(') != -1)
{ {
@ -41,8 +41,9 @@
if (_val.indexOf('form::name(') != -1) if (_val.indexOf('form::name(') != -1)
{ {
// XXX Use the widget reference XXX // et2_form_name doesn't care about ][, just [
//_val = _val.replace(/form::name\(/g,_cname ? "et2_form_name('"+_cname+"'," : '('); var _cname = widget.getPath() ? widget.getPath().join("[") : false;
_val = _val.replace(/form::name\(/g,_cname ? "et2_form_name('"+_cname+"'," : '(');
} }
if (_val.indexOf('egw::lang(') != -1) if (_val.indexOf('egw::lang(') != -1)
@ -87,7 +88,7 @@
this.et2_compileLegacyJS = function(_code, _widget, _context) { this.et2_compileLegacyJS = function(_code, _widget, _context) {
// Replace the javascript pseudo-functions // Replace the javascript pseudo-functions
_code = js_pseudo_funcs(_code); _code = js_pseudo_funcs(_code,_widget);
// Check whether _code is simply "1" -- if yes replace it accordingly // Check whether _code is simply "1" -- if yes replace it accordingly
if (_code === '1') if (_code === '1')