diff --git a/plugins/calendar/drivers/kolab/kolab_user_calendar.php b/plugins/calendar/drivers/kolab/kolab_user_calendar.php index 58c22963..859dc4c8 100644 --- a/plugins/calendar/drivers/kolab/kolab_user_calendar.php +++ b/plugins/calendar/drivers/kolab/kolab_user_calendar.php @@ -74,7 +74,7 @@ class kolab_user_calendar extends kolab_calendar */ public function get_name() { - return $this->userdata['name'] ?: $this->userdata['mail']; + return $this->userdata['displayname'] ?: ($this->userdata['name'] ?: $this->userdata['mail']); } @@ -94,7 +94,7 @@ class kolab_user_calendar extends kolab_calendar */ public function get_title() { - return $this->userdata['mail']; + return trim($this->userdata['displayname'] . '; ' . $this->userdata['mail'], '; '); } diff --git a/plugins/kolab_auth/config.inc.php.dist b/plugins/kolab_auth/config.inc.php.dist index 7a23301f..785fb78e 100644 --- a/plugins/kolab_auth/config.inc.php.dist +++ b/plugins/kolab_auth/config.inc.php.dist @@ -29,6 +29,10 @@ $rcmail_config['kolab_auth_name'] = array('name', 'cn'); $rcmail_config['kolab_auth_email'] = array('email'); $rcmail_config['kolab_auth_organization'] = array('organization'); +// Template for user names displayed in the UI. +// You can use all attributes from the 'fieldmap' property of the 'kolab_auth_addressbook' configuration +$rcmail_config['kolab_auth_user_displayname'] = '{name} ({ou})'; + // Login and password of the admin user. Enables "Login As" feature. $rcmail_config['kolab_auth_admin_login'] = ''; $rcmail_config['kolab_auth_admin_password'] = ''; diff --git a/plugins/kolab_auth/kolab_auth_ldap.php b/plugins/kolab_auth/kolab_auth_ldap.php index 0e3f2384..117db8cb 100644 --- a/plugins/kolab_auth/kolab_auth_ldap.php +++ b/plugins/kolab_auth/kolab_auth_ldap.php @@ -28,12 +28,17 @@ class kolab_auth_ldap extends rcube_ldap_generic { private $icache = array(); + private $conf = array(); + private $fieldmap = array(); function __construct($p) { $rcmail = rcube::get_instance(); + $this->conf = $p; + $this->conf['kolab_auth_user_displayname'] = $rcmail->config->get('kolab_auth_user_displayname', '{name}'); + $this->fieldmap = $p['fieldmap']; $this->fieldmap['uid'] = 'uid'; @@ -340,6 +345,16 @@ class kolab_auth_ldap extends rcube_ldap_generic } } + // compose display name according to config + if (empty($this->fieldmap['displayname'])) { + $entry['displayname'] = rcube_addressbook::compose_search_name( + $entry, + $entry['email'], + $entry['name'], + $this->conf['kolab_auth_user_displayname'] + ); + } + return $entry; } diff --git a/plugins/kolab_notes/kolab_notes.php b/plugins/kolab_notes/kolab_notes.php index cf887727..8475b7d0 100644 --- a/plugins/kolab_notes/kolab_notes.php +++ b/plugins/kolab_notes/kolab_notes.php @@ -220,7 +220,7 @@ class kolab_notes extends rcube_plugin 'id' => $list_id, 'name' => $fullname, 'listname' => $listname, - 'title' => $folder->get_owner(), + 'title' => $folder->get_title(), 'virtual' => true, 'editable' => false, 'group' => 'other virtual', diff --git a/plugins/libkolab/lib/kolab_storage_folder_user.php b/plugins/libkolab/lib/kolab_storage_folder_user.php index 70ded87b..1c37da9e 100644 --- a/plugins/libkolab/lib/kolab_storage_folder_user.php +++ b/plugins/libkolab/lib/kolab_storage_folder_user.php @@ -64,6 +64,16 @@ class kolab_storage_folder_user extends kolab_storage_folder_virtual parent::get_foldername(); } + /** + * Getter for a more informative title of this user folder + * + * @return string Title for the given user record + */ + public function get_title() + { + return trim($this->ldaprec['displayname'] . '; ' . $this->ldaprec['mail'], '; '); + } + /** * Returns the owner of the folder. * diff --git a/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php b/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php index e60719c4..67baa4ce 100644 --- a/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php +++ b/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php @@ -199,7 +199,7 @@ class tasklist_kolab_driver extends tasklist_driver 'id' => $list_id, 'name' => $folder->get_name(), 'listname' => $listname, - 'title' => $folder->get_owner(), + 'title' => $folder->get_title(), 'virtual' => true, 'editable' => false, 'group' => 'other virtual',