give current value higher priority then $value[default_sel] when determining $app

This commit is contained in:
Ralf Becker 2010-11-12 08:16:37 +00:00
parent 15612076fb
commit 3f3bd68969

View File

@ -356,6 +356,7 @@ class link_widget
if (isset($value['current'])) if (isset($value['current']))
{ {
list($app,$id) = explode(':',$value['current'], 2); list($app,$id) = explode(':',$value['current'], 2);
if ($app) unset($value['default_sel']); // would overwrite $app!
} }
} }
else else
@ -414,7 +415,7 @@ class link_widget
'no_app_sel' => !!$extension_data['app'], 'no_app_sel' => !!$extension_data['app'],
'id' => is_array($value) ? $value['current'] : $id, 'id' => is_array($value) ? $value['current'] : $id,
'query' => is_array($value) ? $value['query'] : '', 'query' => is_array($value) ? $value['query'] : '',
'blur' => $cell['blur'] ? lang($cell['blur']) : 'blur' => $cell['blur'] ? lang($cell['blur']) :
(count($options) == 1 ? lang($app) : lang('Search')), (count($options) == 1 ? lang($app) : lang('Search')),
'extra' => $cell['onchange'] ? ','.self::AJAX_NEED_ONCHANGE : null, // store flang for ajax_search, to display extra_line required by onchange 'extra' => $cell['onchange'] ? ','.self::AJAX_NEED_ONCHANGE : null, // store flang for ajax_search, to display extra_line required by onchange
); );
@ -465,7 +466,7 @@ class link_widget
/** /**
* return a_href to view a linked entry * return a_href to view a linked entry
* *
* @param array $link array with values for keys 'id' and 'app' * @param array $link array with values for keys 'id' and 'app'
* @param string $help='' * @param string $help=''
* @return string * @return string
@ -612,7 +613,7 @@ class link_widget
else else
{ {
$value['remark'] = ''; $value['remark'] = '';
if (isset($value['primary']) && !$value['anz_links'] ) if (isset($value['primary']) && !$value['anz_links'] )
{ {
$value['primary'] = $link_id; $value['primary'] = $link_id;
@ -798,9 +799,9 @@ class link_widget
//$args = func_get_args(); $response->addAlert("link_widget::ajax_search('".implode("',\n'",$args)."')\n calling link->query( $app , $search )" ); //$args = func_get_args(); $response->addAlert("link_widget::ajax_search('".implode("',\n'",$args)."')\n calling link->query( $app , $search )" );
//$args = func_get_args(); error_log(__METHOD__."('".implode("','",$args)."')"); //$args = func_get_args(); error_log(__METHOD__."('".implode("','",$args)."')");
$script = "var select = document.getElementById('$id_res');\nselect.options.length=0;\n"; $script = "var select = document.getElementById('$id_res');\nselect.options.length=0;\n";
if(is_array(egw_link::$app_register[$app]['types'])) if(is_array(egw_link::$app_register[$app]['types']))
{ {
$found = egw_link::$app_register[$app]['types']; $found = egw_link::$app_register[$app]['types'];
foreach(egw_link::$app_register[$app]['types'] as $id => $option) foreach(egw_link::$app_register[$app]['types'] as $id => $option)
@ -816,8 +817,8 @@ class link_widget
} }
} }
$script .= "document.getElementById('$id_res').parentNode.style.display='inline';\n"; $script .= "document.getElementById('$id_res').parentNode.style.display='inline';\n";
} }
else else
{ {
$script .= "document.getElementById('$id_res').parentNode.style.display='none';\n"; $script .= "document.getElementById('$id_res').parentNode.style.display='none';\n";
} }