diff --git a/etemplate/inc/class.etemplate_widget_menupopup.inc.php b/etemplate/inc/class.etemplate_widget_menupopup.inc.php index c0d53ce4fb..f227b5a1eb 100644 --- a/etemplate/inc/class.etemplate_widget_menupopup.inc.php +++ b/etemplate/inc/class.etemplate_widget_menupopup.inc.php @@ -148,7 +148,20 @@ class etemplate_widget_menupopup extends etemplate_widget */ public function beforeSendToClient($cname) { - $form_name = self::form_name($cname, $this->id); + $matches = null; + if ($cname == '$row') // happens eg. with custom-fields: $cname='$row', this->id='#something' + { + $form_name = $this->id; + } + // happens with fields in nm-header: $cname='nm', this->id='${row}[something]' or '{$row}[something]' + elseif ($cname == 'nm' && preg_match('/(\${row}|{\$row})\[([^]]+)\]$/', $this->id, $matches)) + { + $form_name = $matches[2]; + } + else + { + $form_name = self::form_name($cname, $this->id); + } if (!is_array(self::$request->sel_options[$form_name])) self::$request->sel_options[$form_name] = array(); if ($this->attrs['type']) { diff --git a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php index 5f1952c2f0..8b0dbe8dd1 100644 --- a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php +++ b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php @@ -175,18 +175,7 @@ class etemplate_widget_nextmatch extends etemplate_widget { $cat_app = $value['cat_app'] ? $value['cat_app'] : $GLOBALS['egw_info']['flags']['current_app']; $value['options-cat_id'] = array('' => lang('all')) + etemplate_widget_menupopup::typeOptions('select-cat', ',,'.$cat_app,$no_lang,false,$value['cat_id']); - // Prevent double encoding - widget does this on its own, but we're just grabbing the options - foreach($value['options-cat_id'] as &$label) - { - if(!is_array($label)) - { - $label = html_entity_decode($label, ENT_NOQUOTES,'utf-8'); - } - elseif($label['label']) - { - $label['label'] = html_entity_decode($label['label'], ENT_NOQUOTES,'utf-8'); - } - } + etemplate_widget_menupopup::fix_encoded_options($value['options-cat_id']); } // Favorite group for admins @@ -547,7 +536,7 @@ class etemplate_widget_nextmatch extends etemplate_widget if (is_int($n) && is_array($rows)) { if (is_null($first)) $first = $n; - + if ($row[$is_parent]) // if app supports parent_id / hierarchy, set parent_id and is_parent { $row['is_parent'] = isset($is_parent_value) ? diff --git a/etemplate/js/et2_widget_selectbox.js b/etemplate/js/et2_widget_selectbox.js index 392d194559..fe0405d9b8 100644 --- a/etemplate/js/et2_widget_selectbox.js +++ b/etemplate/js/et2_widget_selectbox.js @@ -199,25 +199,30 @@ var et2_selectbox = et2_inputWidget.extend( } // Maybe in a row, and options got stuck in ${row} instead of top level - var row_stuck = ['${row}','{$row}']; - for(var i = 0; i < row_stuck.length; i++) + // not sure this code is still needed, as server-side no longer creates ${row} or {$row} for select-options + if(!content_options || content_options.length == 0) { - if((!content_options || content_options.length == 0) && ( - // perspectiveData.row in nm, data["${row}"] in an auto-repeat grid - this.getArrayMgr("sel_options").perspectiveData.row || this.getArrayMgr("sel_options").data[row_stuck[i]])) + var row_stuck = ['${row}','{$row}']; + for(var i = 0; i < row_stuck.length; i++) { - var row_id = this.id.replace(/[0-9]+/,row_stuck[i]); - content_options = this.getArrayMgr("sel_options").getEntry(row_id); - if(!content_options || content_options.length == 0) + // perspectiveData.row in nm, data["${row}"] in an auto-repeat grid + if(this.getArrayMgr("sel_options").perspectiveData.row || this.getArrayMgr("sel_options").data[row_stuck[i]]) { - content_options = this.getArrayMgr("sel_options").getEntry(row_stuck[i] + '[' + this.id + ']'); + var row_id = this.id.replace(/[0-9]+/,row_stuck[i]); + content_options = this.getArrayMgr("sel_options").getEntry(row_id); + if(!content_options || content_options.length == 0) + { + content_options = this.getArrayMgr("sel_options").getEntry(row_stuck[i] + '[' + this.id + ']'); + } } } } - if(_attrs["select_options"] && content_options) + if(_attrs["select_options"] && !jQuery.isEmptyObject(_attrs['select_options']) && content_options) { _attrs["select_options"] = jQuery.extend({},_attrs["select_options"],content_options); - } else if (content_options) { + } + else if (content_options) + { _attrs["select_options"] = content_options; } }