summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/func.inc8
-rw-r--r--program/steps/addressbook/save.inc3
-rw-r--r--program/steps/mail/addcontact.inc5
-rw-r--r--program/steps/mail/list_contacts.inc2
-rw-r--r--program/steps/settings/func.inc15
-rw-r--r--program/steps/settings/save_prefs.inc1
6 files changed, 24 insertions, 10 deletions
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index f6ce79ed1..f261527e4 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -347,13 +347,9 @@ function rcmail_js_contacts_list($result, $prefix='')
// format each col
foreach ($a_show_cols as $col) {
- $val = $row[$col];
- if ($val == '' && $col == 'name') {
- $val = rcube_addressbook::compose_display_name($row, true);
- }
-
+ $val = $col == 'name' ? rcube_addressbook::compose_list_name($row) : $row[$col];
$a_row_cols[$col] = Q($val);
- }
+ }
$OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols);
}
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index f584a0e6a..038b9057f 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -135,8 +135,7 @@ if (!empty($cid))
$a_js_cols = array();
$record = $CONTACTS->get_record($newcid ? $newcid : $cid, true);
$record['email'] = reset($CONTACTS->get_col_values('email', $record, true));
- if (empty($record['name']))
- $record['name'] = rcube_addressbook::compose_display_name($record, true);
+ $record['name'] = rcube_addressbook::compose_list_name($record);
foreach (array('name', 'email') as $col)
$a_js_cols[] = Q((string)$record[$col]);
diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc
index 8e11272e0..74768116e 100644
--- a/program/steps/mail/addcontact.inc
+++ b/program/steps/mail/addcontact.inc
@@ -61,7 +61,10 @@ if (!empty($_POST['_address']) && is_object($CONTACTS))
}
$contact['email'] = rcube_idn_to_utf8($contact['email']);
- $contact['name'] = rcube_addressbook::compose_display_name($contact);
+ $contact = $RCMAIL->plugins->exec_hook('contact_displayname', $contact);
+
+ if (empty($contact['firstname']) || empty($contact['surname']))
+ $contact['name'] = rcube_addressbook::compose_display_name($contact);
// validate contact record
if (!$CONTACTS->validate($contact, true)) {
diff --git a/program/steps/mail/list_contacts.inc b/program/steps/mail/list_contacts.inc
index 23804b155..0791ae350 100644
--- a/program/steps/mail/list_contacts.inc
+++ b/program/steps/mail/list_contacts.inc
@@ -68,7 +68,7 @@ if ($CONTACTS && $CONTACTS->ready) {
else if (!empty($result) && $result->count > 0) {
// create javascript list
while ($row = $result->next()) {
- $name = rcube_addressbook::compose_display_name($row, true);
+ $name = rcube_addressbook::compose_list_name($row);
// add record for every email address of the contact
foreach ($CONTACTS->get_col_values('email', $row, true) as $i => $email) {
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 48230f5bb..35e015dc8 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -651,6 +651,21 @@ function rcmail_user_prefs($current=null)
);
}
+ // show addressbook listing mode selection
+ if (!isset($no_override['addressbook_name_listing'])) {
+ $field_id = 'rcmfd_addressbook_name_listing';
+ $select_listing = new html_select(array('name' => '_addressbook_name_listing', 'id' => $field_id));
+ $select_listing->add(rcube_label('name'), 0);
+ $select_listing->add(rcube_label('firstname') . ' ' . rcube_label('surname'), 1);
+ $select_listing->add(rcube_label('surname') . ' ' . rcube_label('firstname'), 2);
+ $select_listing->add(rcube_label('surname') . ', ' . rcube_label('firstname'), 3);
+
+ $blocks['main']['options']['list_name_listing'] = array(
+ 'title' => html::label($field_id, Q(rcube_label('listnamedisplay'))),
+ 'content' => $select_listing->show($config['addressbook_name_listing']),
+ );
+ }
+
// show addressbook sort column
if (!isset($no_override['addressbook_sort_col'])) {
$field_id = 'rcmfd_addressbook_sort_col';
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index 87d06ef3e..4af4a3f8f 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -98,6 +98,7 @@ switch ($CURR_SECTION)
'default_addressbook' => get_input_value('_default_addressbook', RCUBE_INPUT_POST, true),
'autocomplete_single' => isset($_POST['_autocomplete_single']) ? TRUE : FALSE,
'addressbook_sort_col' => get_input_value('_addressbook_sort_col', RCUBE_INPUT_POST),
+ 'addressbook_name_listing' => intval(get_input_value('_addressbook_name_listing', RCUBE_INPUT_POST)),
'addressbook_pagesize' => is_numeric($_POST['_addressbook_pagesize']) ? max(2, intval($_POST['_addressbook_pagesize'])) : $CONFIG['addressbook_pagesize'],
);