diff --git a/etemplate/inc/class.contact_widget.inc.php b/etemplate/inc/class.contact_widget.inc.php index 293beed990..2a14d0ac61 100644 --- a/etemplate/inc/class.contact_widget.inc.php +++ b/etemplate/inc/class.contact_widget.inc.php @@ -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 diff --git a/etemplate/inc/class.etemplate_widget_entry.inc.php b/etemplate/inc/class.etemplate_widget_entry.inc.php index bb1d1933ec..4ea21e8d90 100644 --- a/etemplate/inc/class.etemplate_widget_entry.inc.php +++ b/etemplate/inc/class.etemplate_widget_entry.inc.php @@ -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) diff --git a/etemplate/inc/class.etemplate_widget_transformer.inc.php b/etemplate/inc/class.etemplate_widget_transformer.inc.php index 295c267f88..18b745b29a 100644 --- a/etemplate/inc/class.etemplate_widget_transformer.inc.php +++ b/etemplate/inc/class.etemplate_widget_transformer.inc.php @@ -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; diff --git a/etemplate/js/et2_widget_entry.js b/etemplate/js/et2_widget_entry.js index 08b3b9abcc..3b47587612 100644 --- a/etemplate/js/et2_widget_entry.js +++ b/etemplate/js/et2_widget_entry.js @@ -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) {