![]() |
|
|
|||||||
| For more information about the ads and why they're here, please see the FAQ |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I would like that when user type in address field a ldap request was made(instead of personal addressbook), is it possible? thanks for your answers |
|
#2
|
|||
|
|||
|
Yes, it is. I searched because I was in this same boat, and came across this. This has worked very well for me and beta2
http://trac.roundcube.net/trac.cgi/a...e_391.inc.diff |
|
#3
|
|||
|
|||
|
thanks, this is not working with RC1 because ldap functions was changed, but I will try to adapt... If I found I will post the code here.
|
|
#4
|
|||
|
|||
|
this is working for me on RC1.
changes have been made at the end of program/steps/mail/compose.inc changes are between "//Add for LDAP search" and "//End of LDAP search" Code:
/****** get contacts for this user and add them to client scripts ********/
require_once('include/rcube_contacts.inc');
$CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']);
$CONTACTS->set_pagesize(1000);
if ($result = $CONTACTS->list_records())
{
$a_contacts = array();
while ($sql_arr = $result->iterate())
if ($sql_arr['email'])
$a_contacts[] = format_email_recipient($sql_arr['email'], JQ($sql_arr['name']));
//Add for LDAP search
foreach ($CONFIG['ldap_public'] as $ldapserv_config)
{
$ldapfields = array($ldapserv_config['mail_field'],$ldapserv_config['name_field']);
$cLdap = new rcube_ldap($ldapserv_config);
$cLdap->connect ();
$cLdap->bind($ldapserv_config['base_dn'],''); //second field is for password if required
$results = $cLdap->search ($ldapfields,
"mydomain", //field for search criteria, can't be empty,* is not a Wildcard character
true);
$cLdap->close ();
}
while ($ldap_arr = $results->next())
{
if ($ldap_arr['email'])
$a_contacts[] = format_email_recipient($ldap_arr['email'], JQ($ldap_arr['name']));
}
//End of LDAP search
$OUTPUT->set_env('contacts', $a_contacts);
}
parse_template('compose');
?>
|
|
#5
|
|||
|
|||
|
Hi,
a cleaned up diff version of the above, modified slightly, with current (RC1) version of config parameters: Code:
--- compose.inc.orig 2007-05-18 15:11:22.000000000 +0200
+++ compose.inc 2007-05-31 15:57:50.000000000 +0200
@@ -867,6 +867,7 @@ $OUTPUT->add_handlers(array(
/****** get contacts for this user and add them to client scripts ********/
require_once('include/rcube_contacts.inc');
+require_once('include/rcube_ldap.inc');
$CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']);
$CONTACTS->set_pagesize(1000);
@@ -877,7 +878,23 @@ if ($result = $CONTACTS->list_records())
while ($sql_arr = $result->iterate())
if ($sql_arr['email'])
$a_contacts[] = format_email_recipient($sql_arr['email'], JQ($sql_arr['name']));
-
+
+ foreach ($CONFIG['ldap_public'] as $ldapserv_config)
+ {
+ $ldapfields = array($ldapserv_config['email_field'],$ldapserv_config['name_field']);
+ $cLdap = new rcube_ldap($ldapserv_config);
+ $cLdap->connect ();
+ $cLdap->bind($ldapserv_config['bind_dn'], $ldapserv_config['bind_pass']);
+ $results = $cLdap->search ($ldapfields, "@" /* God, forgive me this nasty hack */, true);
+ $cLdap->close ();
+ }
+
+ while ($ldap_arr = $results->next())
+ {
+ if ($ldap_arr['email'])
+ $a_contacts[] = format_email_recipient($ldap_arr['email'], JQ($ldap_arr['name']));
+ }
+
$OUTPUT->set_env('contacts', $a_contacts);
}
|
|
#6
|
|||
|
|||
|
Thanks, this helps. Will try it out.
|
|
#7
|
|||
|
|||
|
in the composer, I have only the 10 first address found in the ldap
in adress book I can see all my ldap entriesanyone have an idea? |
|
#8
|
|||
|
|||
|
this is this variable that limits the list...
in "include/rcube_ldap.inc" var $page_size = 10; I change to 100 and I've got all the addresses but I don't know if there was other effect... |
|
#9
|
|||
|
|||
|
little improvement : sorting the list
add before this line Code:
$results = $cLdap->search....... Code:
$cLdap->sort_col = 'mail'; ![]() |
|
#10
|
|||
|
|||
|
i too try this...
but not work |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
| For more information about the ads and why they're here, please see the FAQ |