- Add special handling for ids like something[{}] to only send select options once

- Don't need to process or send options for account, it is done client side now.
This commit is contained in:
Nathan Gray 2014-07-22 14:18:33 +00:00
parent 57e187cc2d
commit 6dfd8c616b

View File

@ -184,6 +184,11 @@ class etemplate_widget_menupopup extends etemplate_widget
{ {
$form_name = $matches[2]; $form_name = $matches[2];
} }
// happens in auto-repeat grids: $cname='', this->id='something[{$row}]'
elseif (preg_match('/([^[]+)\[({\$row})\]$/', $this->id, $matches))
{
$form_name = $matches[1];
}
else else
{ {
$form_name = self::form_name($cname, $this->id); $form_name = self::form_name($cname, $this->id);
@ -224,6 +229,10 @@ class etemplate_widget_menupopup extends etemplate_widget
{ {
self::setElementAttribute($form_name, "search", true); self::setElementAttribute($form_name, "search", true);
} }
if(!self::$request->sel_options[$options])
{
unset(self::$request->sel_options[$options]);
}
} }
} }
@ -495,30 +504,6 @@ class etemplate_widget_menupopup extends etemplate_widget
$no_lang = True; $no_lang = True;
break; break;
case 'select-account': // options: #rows,{accounts(default)|both|groups|owngroups},{0(=lid)|1(default=name)|2(=lid+name),expand-multiselect-rows,not-to-show-accounts,...)}
// Get preference for selection display
// Get important attributes in a non-legacy way
if($widget != null && $widget->attrs['account_type'])
{
$type = $widget->attrs['account_type'];
}
$select_pref = $GLOBALS['egw_info']['user']['preferences']['common']['account_selection'];
// in case of readonly, we read/create only the needed entries, as reading accounts is expensive
if (!is_array($value) && strpos($value,',') !== false) $value = explode(',',$value);
if ($readonly || $select_pref == 'popup')
{
$no_lang = True;
foreach(is_array($value) ? $value : array($value) as $id)
{
$options[$id] = !$id && !is_numeric($rows) ? lang($rows) :
self::accountInfo($id, null, $type2, $type=='both');
}
break;
}
break;
case 'select-year': // options: #rows,#before(default=3),#after(default=2) case 'select-year': // options: #rows,#before(default=3),#after(default=2)
$options[''] = ''; $options[''] = '';
if ($type <= 0) $type = 3; if ($type <= 0) $type = 3;