[Svn] r2887 - in trunk/roundcubemail: . program/include program/steps/addressbook

trac at roundcube.net trac at roundcube.net
Fri Aug 28 15:00:51 CEST 2009


Author: alec
Date: 2009-08-28 08:00:51 -0500 (Fri, 28 Aug 2009)
New Revision: 2887

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/include/rcube_ldap.php
   trunk/roundcubemail/program/steps/addressbook/func.inc
Log:
- Fix LDAP addressbook browsing when only one directory is used (#1486022)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2009-08-28 12:53:23 UTC (rev 2886)
+++ trunk/roundcubemail/CHANGELOG	2009-08-28 13:00:51 UTC (rev 2887)
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Fix LDAP addressbook browsing when only one directory is used (#1486022)
 - Fix endless loop on error response for APPEND command (#1486060)
 - Don't require date.timezone setting in installer (#1485989)
 - Fix date sorting problem with Courier IMAP server (#1486065)

Modified: trunk/roundcubemail/program/include/rcube_ldap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_ldap.php	2009-08-28 12:53:23 UTC (rev 2886)
+++ trunk/roundcubemail/program/include/rcube_ldap.php	2009-08-28 13:00:51 UTC (rev 2887)
@@ -52,7 +52,7 @@
   function __construct($p)
   {
     $this->prop = $p;
-    
+
     foreach ($p as $prop => $value)
       if (preg_match('/^(.+)_field$/', $prop, $matches))
         $this->fieldmap[$matches[1]] = $value;

Modified: trunk/roundcubemail/program/steps/addressbook/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/addressbook/func.inc	2009-08-28 12:53:23 UTC (rev 2886)
+++ trunk/roundcubemail/program/steps/addressbook/func.inc	2009-08-28 13:00:51 UTC (rev 2887)
@@ -19,8 +19,30 @@
 
 */
 
+// add list of address sources to client env
+$js_list = array();
+if (strtolower($CONFIG['address_book_type']) != 'ldap') {
+  // We are using the DB address book, add it.
+  $js_list['0'] = array('id' => 0, 'name' => rcube_label('personaladrbook'), 'readonly' => false);
+}
+if (is_array($CONFIG['ldap_public'])) {
+  foreach ($CONFIG['ldap_public'] as $id => $prop)
+    $js_list[$id] = array('id' => $id, 'name' => $prop['name'], 'readonly' => !$prop['writable']);
+}
+
+$plugin = $RCMAIL->plugins->exec_hook('address_sources', array('sources' => $js_list));
+$js_list = $plugin['sources'];
+
+// select source
+$source = get_input_value('_source', RCUBE_INPUT_GPC);
+
+// if source is not set use first directory
+if (empty($source))
+  $source = $js_list[key($js_list)]['id'];
+
+
 // instantiate a contacts object according to the given source
-$CONTACTS = $RCMAIL->get_address_book(($source = get_input_value('_source', RCUBE_INPUT_GPC)));
+$CONTACTS = $RCMAIL->get_address_book($source);
 
 $CONTACTS->set_pagesize($CONFIG['pagesize']);
 
@@ -34,25 +56,13 @@
 if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']]))
   $CONTACTS->set_search_set($_SESSION['search'][$_REQUEST['_search']]);
 
+
 // set data source env
 $OUTPUT->set_env('source', $source ? $source : '0');
 $OUTPUT->set_env('readonly', $CONTACTS->readonly, false);
+$OUTPUT->set_env('address_sources', $js_list);
 
-// add list of address sources to client env
-$js_list = array();
-if (strtolower($CONFIG['address_book_type']) != 'ldap') {
-  // We are using the DB address book, add it.
-  $js_list['0'] = array('id' => 0, 'name' => rcube_label('personaladrbook'), 'readonly' => false);
-}
-if (is_array($CONFIG['ldap_public'])) {
-  foreach ($CONFIG['ldap_public'] as $id => $prop)
-    $js_list[$id] = array('id' => $id, 'name' => $prop['name'], 'readonly' => !$prop['writable']);
-}
 
-$plugin = $RCMAIL->plugins->exec_hook('address_sources', array('sources' => $js_list));
-$OUTPUT->set_env('address_sources', $plugin['sources']);
-
-
 function rcmail_directory_list($attrib)
 {
   global $RCMAIL, $OUTPUT;

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list