summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authorsvncommit <devs@roundcube.net>2006-01-08 23:23:26 +0000
committersvncommit <devs@roundcube.net>2006-01-08 23:23:26 +0000
commit9d2c0d496713fef847415616146ae8e6868ba242 (patch)
treee14c073eacd98e29f5f783a14ee5b5b06621cbeb /program/steps
parentc0da982d9e11bb80ec9948e89ccdb55b90bc77e3 (diff)
fixed bug with field choice dropdown not appearing when only one ldap server is configured - thanks to Pieter Hoekstra for the report
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/ldapsearchform.inc35
1 files changed, 24 insertions, 11 deletions
diff --git a/program/steps/addressbook/ldapsearchform.inc b/program/steps/addressbook/ldapsearchform.inc
index f7d7cc9f5..036ade6c8 100644
--- a/program/steps/addressbook/ldapsearchform.inc
+++ b/program/steps/addressbook/ldapsearchform.inc
@@ -82,23 +82,36 @@ function rcmail_ldap_public_search_form($attrib)
$out .= '<tr><td class="title"><label for="' . $field_id . '">' .
rep_specialchars_output(rcube_label('ldappublicsearchfield')) .
"</label></td><td>" . $search_fields->show() . "</td></tr>\n";
+
+ $attributes = array('name' => '_ldap_public_search_type',
+ 'id' => 'rcmfd_ldap_public_search_type');
- $search_type = new checkbox(array('name' => '_ldap_public_search_type',
- 'id' => 'rcmfd_ldap_public_search_type', 'value' => 0));
+ // if there's only one server, and it doesn't accept fuzzy searches,
+ // then check and disable the check box - thanks pieter
+ if ($server_count == 1 && !$server['fuzzy_search'])
+ {
+ $attributes['CHECKED'] = 'CHECKED';
+ $attributes['disabled'] = 'disabled';
+ }
+
+ $search_type = new checkbox($attributes);
$out .= '<tr id="ldap_fuzzy_search"><td class="title"><label for="rcmfd_ldap_public_search_type">' .
rep_specialchars_output(rcube_label('ldappublicsearchtype')) .
"</label></td><td>" . $search_type->show() . "</td></tr>\n";
}
-
- // store the search fields in a js array for each server
- $js = '';
- foreach ($server['search_fields'] as $k => $search_field)
- $js .= "'$search_field', ";
-
- // store whether this server accepts fuzzy search as last item in array
- $js .= $server['fuzzy_search'] ? "'fuzzy'" : "'exact'";
- $OUTPUT->add_script("rcmail.set_env('{$server_names[$i]}_search_fields', new Array($js));");
+
+ if ($server_count > 1)
+ {
+ // store the search fields in a js array for each server
+ $js = '';
+ foreach ($server['search_fields'] as $k => $search_field)
+ $js .= "'$search_field', ";
+
+ // store whether this server accepts fuzzy search as last item in array
+ $js .= $server['fuzzy_search'] ? "'fuzzy'" : "'exact'";
+ $OUTPUT->add_script("rcmail.set_env('{$server_names[$i]}_search_fields', new Array($js));");
+ }
}
// add contact button label text