forked from extern/egroupware
Entry type / transformer changes
- better support for entry-types in nextmatch-customfilter - if transformer changes widget type, run new widget's beforeSendToClient
This commit is contained in:
parent
12b8dc1ed4
commit
b1b1269e0e
@ -1207,8 +1207,8 @@ class etemplate_widget_nextmatch_customfilter extends etemplate_widget_transform
|
|||||||
|
|
||||||
$this->setElementAttribute($form_name, 'options', trim($this->attrs['widget_options']) != '' ? $this->attrs['widget_options'] : '');
|
$this->setElementAttribute($form_name, 'options', trim($this->attrs['widget_options']) != '' ? $this->attrs['widget_options'] : '');
|
||||||
|
|
||||||
parent::beforeSendToClient($cname, $expand);
|
|
||||||
$this->setElementAttribute($form_name, 'type', $this->attrs['type']);
|
$this->setElementAttribute($form_name, 'type', $this->attrs['type']);
|
||||||
|
parent::beforeSendToClient($cname, $expand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +122,7 @@ abstract class etemplate_widget_transformer extends etemplate_widget
|
|||||||
|
|
||||||
//echo $this; _debug_array($unmodified); _debug_array($attrs); _debug_array(array_diff_assoc($attrs, $unmodified));
|
//echo $this; _debug_array($unmodified); _debug_array($attrs); _debug_array(array_diff_assoc($attrs, $unmodified));
|
||||||
// compute the difference and send it to the client as modifications
|
// compute the difference and send it to the client as modifications
|
||||||
|
$type_changed = false;
|
||||||
foreach(array_diff_assoc($attrs, $unmodified) as $attr => $val)
|
foreach(array_diff_assoc($attrs, $unmodified) as $attr => $val)
|
||||||
{
|
{
|
||||||
switch($attr)
|
switch($attr)
|
||||||
@ -136,6 +137,7 @@ abstract class etemplate_widget_transformer extends etemplate_widget
|
|||||||
self::$request->sel_options[$form_name] = $val;
|
self::$request->sel_options[$form_name] = $val;
|
||||||
break;
|
break;
|
||||||
case 'type': // not an attribute in etemplate2
|
case 'type': // not an attribute in etemplate2
|
||||||
|
$type_changed = true;
|
||||||
if($val == 'template')
|
if($val == 'template')
|
||||||
{
|
{
|
||||||
// If the widget has been transformed into a template, we
|
// If the widget has been transformed into a template, we
|
||||||
@ -146,12 +148,22 @@ abstract class etemplate_widget_transformer extends etemplate_widget
|
|||||||
$this->expand_widget($transformed_template, $expand);
|
$this->expand_widget($transformed_template, $expand);
|
||||||
$transformed_template->run('beforeSendToClient',array($cname,$expand));
|
$transformed_template->run('beforeSendToClient',array($cname,$expand));
|
||||||
}
|
}
|
||||||
|
$type_changed = false;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
self::setElementAttribute($form_name, $attr, $val);
|
self::setElementAttribute($form_name, $attr, $val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($type_changed)
|
||||||
|
{
|
||||||
|
// Run the new widget type's beforeSendToClient
|
||||||
|
$expanded_child = self::factory($attrs['type'], false,$this->id);
|
||||||
|
$expanded_child->id = $this->id;
|
||||||
|
$expanded_child->type = $attrs['type'];
|
||||||
|
$expanded_child->attrs = $attrs;
|
||||||
|
$expanded_child->run('beforeSendToClient',array($cname,$expand));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,4 +150,4 @@ var et2_entry = et2_valueWidget.extend(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
et2_register_widget(et2_entry, ["entry", 'contact-value', 'contact-account', 'contact-template', 'infolog-value','tracker-value']);
|
et2_register_widget(et2_entry, ["entry", 'contact-value', 'contact-account', 'contact-template', 'infolog-value','tracker-value','records-value']);
|
Loading…
Reference in New Issue
Block a user