allow the link-query method of an app to set further attributes of the option used to display the entry, eg. a title (tooltip) of a certain entry: instead of id => title pairs, you return eg id => array(label=>title,title=>tooltip) like for html::select or the select widget

This commit is contained in:
Ralf Becker 2008-02-07 02:54:11 +00:00
parent 9eaa3efb75
commit ea2c699f5c

View File

@ -632,9 +632,17 @@
else
{
$script = "var select = document.getElementById('$id_res');\nselect.options.length=0;\n";
foreach($found as $id => $title)
foreach($found as $id => $option)
{
$script .= "select.options[select.options.length] = new Option('".addslashes($title)."','$id');\n";
if (!is_array($option)) $option = array('label' => $option);
$script .= "opt = select.options[select.options.length] = new Option('".addslashes($option['label'])."','$id');\n";
if (count($option) > 1)
{
foreach($option as $name => $value)
{
if ($name != 'label') $script .= "opt.$name = '".addslashes($value)."';\n";
}
}
}
$script .= "select.options[select.options.length] = new Option('".addslashes(lang('New search').' ...')."','');\n";
foreach(explode(',',$id_show) as $id)