fixed cat-id in nextmatch header of addressbook is in id-order and not alphabetic/hierarchical order

This commit is contained in:
Ralf Becker 2014-02-18 16:35:54 +00:00
parent f04d607e2b
commit ae057bd957
3 changed files with 32 additions and 25 deletions

View File

@ -147,8 +147,21 @@ class etemplate_widget_menupopup extends etemplate_widget
* @param string $cname
*/
public function beforeSendToClient($cname)
{
$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'])
{

View File

@ -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

View File

@ -199,12 +199,14 @@ var et2_selectbox = et2_inputWidget.extend(
}
// Maybe in a row, and options got stuck in ${row} instead of top level
// 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)
{
var row_stuck = ['${row}','{$row}'];
for(var i = 0; i < row_stuck.length; i++)
{
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]]))
if(this.getArrayMgr("sel_options").perspectiveData.row || this.getArrayMgr("sel_options").data[row_stuck[i]])
{
var row_id = this.id.replace(/[0-9]+/,row_stuck[i]);
content_options = this.getArrayMgr("sel_options").getEntry(row_id);
@ -214,10 +216,13 @@ var et2_selectbox = et2_inputWidget.extend(
}
}
}
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;
}
}