First of all, thanks very much for the efforts on roundcube, i love this webmail and use it everyday :-)
Since I'm a LDAP user, I was interested in having the JpegPhoto support, so I coded it on my svn copy of roundcube. I give you my patch, hoping that it will be useful.
(PS : I generated the patch using "svn diff" command, but it did not attach the file "./program/steps/addressbook/ldapjpegphoto.inc", so I joined it to this mail too, and sorry for my bad english, i'm french).
See you
--
Pierre Mauduit
ldapjpegphoto.inc
Description: Binary data
Index: program/include/rcube_ldap.inc =================================================================== --- program/include/rcube_ldap.inc (révision 360) +++ program/include/rcube_ldap.inc (copie de travail) @@ -30,6 +30,8 @@ var $base_dn; var $bind_dn; var $bind_pass; + + var $search_res; // PHP 5 constructor function __construct() @@ -148,6 +150,8 @@ $sr = @ldap_read($this->conn, $base, $filter, $attributes, 0, $limit); if ($sr) { + $this->search_res = $sr; + if ($sort && $scope !== "base") { if (is_array($sort)) Index: program/localization/fr/labels.inc =================================================================== --- program/localization/fr/labels.inc (révision 360) +++ program/localization/fr/labels.inc (copie de travail) @@ -173,7 +173,7 @@ // LDAP search $labels['ldapsearch'] = 'Recherche dans répertoires LDAP'; - +$labels['jpegPhoto'] = 'Photographie'; $labels['ldappublicsearchname'] = 'Nom du contact'; $labels['ldappublicsearchtype'] = 'Correspondance exacte ?'; $labels['ldappublicserverselect'] = 'Sélectionnez les serveurs'; Index: program/localization/en_US/labels.inc =================================================================== --- program/localization/en_US/labels.inc (révision 360) +++ program/localization/en_US/labels.inc (copie de travail) @@ -176,7 +176,7 @@ // LDAP search $labels['ldapsearch'] = 'LDAP directory search'; - +$labels['jpegPhoto'] = 'Photo'; $labels['ldappublicsearchname'] = 'Contact name'; $labels['ldappublicsearchtype'] = 'Exact match?'; $labels['ldappublicserverselect'] = 'Select servers'; Index: program/steps/addressbook/ldapsearchform.inc =================================================================== --- program/steps/addressbook/ldapsearchform.inc (révision 360) +++ program/steps/addressbook/ldapsearchform.inc (copie de travail) @@ -163,12 +163,15 @@ if ($CONFIG['ldap_public'][$server_name]['fuzzy_search']) $exact = isset($_POST['_ldap_public_search_type']) ? true : false; - // perform an ldap search + + // we need index name of the ldap server in order to search on the expected server ... + $CONFIG['ldap_public'][$server_name]['server_name'] = $server_name; + // perform an ldap search + $contacts = rcmail_ldap_contact_search($search_value, $search_field, $CONFIG['ldap_public'][$server_name], $exact); - // if no results, show a warning and return if (!$contacts) { @@ -185,7 +188,7 @@ $attrib['cellspacing'] = 0; // define list of cols to be displayed - $a_show_cols = array('name', 'email'); + $a_show_cols = array('name', 'email', 'jpegPhoto'); // create XHTML table $out = rcube_table_output($attrib, $contacts, $a_show_cols, 'row_id'); @@ -204,26 +207,28 @@ { global $CONFIG; - $attributes = array($server['name_field'], $server['mail_field']); + $attributes = array($server['name_field'], $server['mail_field'], 'jpegPhoto'); $LDAP = new rcube_ldap(); if ($LDAP->connect($server['hosts'], $server['port'], $server['protocol'])) { - $filter = "$search_field=" . ($exact ? $search_value : "*$search_value*"); + $filter = "$search_field=" . ($exact ? $search_value : "*$search_value*"); $result = $LDAP->search($server['base_dn'], $filter, $attributes, $server['scope'], $sort=null); - // add any results to contact array if ($result['count']) { - for ($n = 0; $n < $result['count']; $n++) + for ($n = 0; $n < $result['count']; $n++) { $contacts[$n]['name'] = $result[$n][$server['name_field']][0]; - $contacts[$n]['email'] = $result[$n][$server['mail_field']][0]; - $contacts[$n]['row_id'] = $n + 1; + $contacts[$n]['email'] = $result[$n][$server['mail_field']][0]; +// $contacts[$n]['jpegPhoto'] = $result[$n]['jpegphoto'][0]; + $contacts[$n]['jpegPhoto'] = '<img alt="jpegPhoto" src="?_task=addressbook&_action=ldapjpegPhoto&_dn=' + .urlencode($result[$n]['dn']) . '&_srv='.$server['server_name'].'" />'; + $contacts[$n]['row_id'] = $n + 1; } } } Index: index.php =================================================================== --- index.php (révision 360) +++ index.php (copie de travail) @@ -341,6 +341,9 @@ if ($_action=='ldappublicsearch') include('program/steps/addressbook/ldapsearchform.inc'); + + if ($_action == 'ldapjpegPhoto') + include ('program/steps/addressbook/ldapjpegphoto.inc'); }