fix for the optgroupfeature, which messed up some callback checking (validation) of the selected values.

This is since the assumption of being an array as value of the selectkey is a sufficient marker to recognize an optgroup 
does not always match for optgroups only. Projectmember roles dialog employs select options with label/title arrays as value
This commit is contained in:
Klaus Leithoff 2008-02-27 15:48:52 +00:00
parent a0e5556c62
commit 5f9104250b

View File

@ -1493,18 +1493,24 @@ foreach($sess as $key => $val)
if (!isset($GLOBALS['egw_info']['etemplate']['to_process'][$form_name]))
{
// fix for optgroup's
$options=array();
foreach($sels as $key => $val)
{
# we want the key anyway, even if this allowes more values than wanted (the name/key of the optgroup if there is one,
# the keys of the arrays in case you have key/value pair(s) as value for the value of your option ).
$options[$key]=$key;
if (is_array($val))
{
$sels += array_keys($val);
unset($sels[$key]);
}
foreach(array_keys($val) as $key2)
{
$options[$key2]=$key2;
}
}
}
$GLOBALS['egw_info']['etemplate']['to_process'][$form_name] = array(
'type' => $cell['type'],
'needed' => $cell['needed'],
'allowed' => array_keys($sels),
'allowed' => array_keys($options),
'multiple'=> $multiple,
);
}