RoundCube Webmail Forum  

Go Back   RoundCube Webmail Forum > Release Support > Older Versions > Release Candidate 1

For more information about the ads and why they're here, please see the FAQ
Reply
  #1  
Old 05-30-2007, 04:12 PM
em em is offline
Registered User
 
Join Date: May 2007
Posts: 9
Downloads: 0
Uploads: 0
Default ldap as default addressbook

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 05-30-2007, 09:14 PM
Registered User
 
Join Date: Dec 2006
Posts: 9
Downloads: 0
Uploads: 0
Default Re: ldap as default addressbook

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 05-31-2007, 11:14 AM
em em is offline
Registered User
 
Join Date: May 2007
Posts: 9
Downloads: 0
Uploads: 0
Default Re: ldap as default addressbook

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 05-31-2007, 01:59 PM
em em is offline
Registered User
 
Join Date: May 2007
Posts: 9
Downloads: 0
Uploads: 0
Default Re: ldap as default addressbook

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');
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 05-31-2007, 03:02 PM
Registered User
 
Join Date: May 2007
Posts: 8
Downloads: 0
Uploads: 0
Default Re: ldap as default addressbook

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);
  }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 06-01-2007, 04:52 PM
Registered User
 
Join Date: Dec 2006
Posts: 9
Downloads: 0
Uploads: 0
Default Re: ldap as default addressbook

Thanks, this helps. Will try it out.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 07-06-2007, 03:00 PM
em em is offline
Registered User
 
Join Date: May 2007
Posts: 9
Downloads: 0
Uploads: 0
Default Re: ldap as default addressbook

in the composer, I have only the 10 first address found in the ldap in adress book I can see all my ldap entries

anyone have an idea?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 07-10-2007, 12:42 PM
em em is offline
Registered User
 
Join Date: May 2007
Posts: 9
Downloads: 0
Uploads: 0
Default Re: ldap as default addressbook

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...

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9  
Old 07-10-2007, 02:19 PM
em em is offline
Registered User
 
Join Date: May 2007
Posts: 9
Downloads: 0
Uploads: 0
Default Re: ldap as default addressbook

little improvement : sorting the list

add before this line
Code:
$results = $cLdap->search.......
this :
Code:
$cLdap->sort_col = 'mail';
change 'mail' by the ldap field you want

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10  
Old 07-31-2007, 01:21 AM
Registered User
 
Join Date: Jul 2007
Posts: 1
Downloads: 0
Uploads: 0
Default Re: ldap as default addressbook

i too try this...
but not work
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

For more information about the ads and why they're here, please see the FAQ

All times are GMT. The time now is 05:20 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright © 2006-2008 RoundCube Webmail Community