mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
If a widget is transformed into a template, try to load and process that template too.
This commit is contained in:
parent
4e27f324c9
commit
06abca167d
@ -175,7 +175,7 @@ class contact_widget extends etemplate_widget_entry
|
||||
{
|
||||
$value = 'account:'.($attrs['name'] != 'account:' ? $value : $GLOBALS['egw_info']['user']['account_id']);
|
||||
}
|
||||
// fall-throught
|
||||
// fall-through
|
||||
case 'contact-value':
|
||||
default:
|
||||
if (substr($value,0,12) == 'addressbook:') $value = substr($value,12); // link-entry syntax
|
||||
|
@ -58,7 +58,7 @@ abstract class etemplate_widget_entry extends etemplate_widget_transformer
|
||||
*
|
||||
* @param string $cname
|
||||
*/
|
||||
public function beforeSendToClient($cname)
|
||||
public function beforeSendToClient($cname, array $expand=array())
|
||||
{
|
||||
$attrs = $this->attrs;
|
||||
|
||||
@ -96,7 +96,7 @@ abstract class etemplate_widget_entry extends etemplate_widget_transformer
|
||||
|
||||
$old_type = self::getElementAttribute($this->id, 'type');
|
||||
|
||||
parent::beforeSendToClient($cname);
|
||||
parent::beforeSendToClient($cname, $expand);
|
||||
|
||||
// Check for conflict - more than one with same id/field and different type
|
||||
if($old_type && $old_type != $this->type)
|
||||
|
@ -99,7 +99,7 @@ abstract class etemplate_widget_transformer extends etemplate_widget
|
||||
*
|
||||
* @param string $cname
|
||||
*/
|
||||
public function beforeSendToClient($cname)
|
||||
public function beforeSendToClient($cname, array $expand=array())
|
||||
{
|
||||
$attrs = $this->attrs;
|
||||
$form_name = self::form_name($cname, $this->id);
|
||||
@ -136,6 +136,14 @@ abstract class etemplate_widget_transformer extends etemplate_widget
|
||||
self::$request->sel_options[$form_name] = $val;
|
||||
break;
|
||||
case 'type': // not an attribute in etemplate2
|
||||
if($val == 'template')
|
||||
{
|
||||
// If the widget has been transformed into a template, we
|
||||
// also need to try and instanciate & parse the template too
|
||||
$transformed_template = etemplate_widget_template::instance($attrs['template']);
|
||||
$this->expand_widget($transformed_template, $expand);
|
||||
$transformed_template->run('beforeSendToClient',array($cname,$expand));
|
||||
}
|
||||
default:
|
||||
self::setElementAttribute($form_name, $attr, $val);
|
||||
break;
|
||||
|
@ -59,9 +59,6 @@ var et2_entry = et2_valueWidget.extend(
|
||||
|
||||
legacyOptions: ["field","compare","alternate_fields"],
|
||||
|
||||
// Doesn't really need a namespace, but this simplifies the sub-widgets
|
||||
createNamespace: true,
|
||||
|
||||
prefix: '~',
|
||||
|
||||
/**
|
||||
@ -102,17 +99,17 @@ var et2_entry = et2_valueWidget.extend(
|
||||
*/
|
||||
loadField: function() {
|
||||
// Create widget of correct type
|
||||
var entry = {type: 'label'};
|
||||
var attrs = {
|
||||
id: this.id + '[' +this.options.field+']',
|
||||
type: 'label',
|
||||
readonly: this.options.readonly
|
||||
};
|
||||
var modifications = this.getArrayMgr("modifications");
|
||||
if(modifications && this.options.field)
|
||||
{
|
||||
jQuery.extend(entry, modifications.getEntry(this.options.field));
|
||||
jQuery.extend(attrs, modifications.getEntry(attrs.id));
|
||||
}
|
||||
var attrs = {
|
||||
id: this.options.field,
|
||||
type: entry.type || 'label',
|
||||
readonly: this.options.readonly
|
||||
};
|
||||
|
||||
// Supress labels on templates
|
||||
if(attrs.type == 'template' && this.options.label)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user