From 5619673737450c926cf406d4aeb802d0544f52ed Mon Sep 17 00:00:00 2001 From: pdontthink Date: Mon, 1 Oct 2007 20:11:00 +0000 Subject: [PATCH] Enabled user selection of address format when adding from address book during message composition git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12719 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 2 ++ functions/addressbook.php | 15 +++++++-------- include/load_prefs.php | 3 +++ include/options/compose.php | 17 ++++++++++++++--- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index d7bc8374..02bdeedf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -220,6 +220,8 @@ Version 1.5.2 - SVN - Added "preselected" query argument to mailbox list. - Make the Message Details plugin actually show the correct entity when viewing details of attached messages. + - Enabled user selection of address format when adding from address + book during message composition. Version 1.5.1 (branched on 2006-02-12) -------------------------------------- diff --git a/functions/addressbook.php b/functions/addressbook.php index 3408c83f..086e078c 100644 --- a/functions/addressbook.php +++ b/functions/addressbook.php @@ -485,15 +485,14 @@ class AddressBook { * @return string email address with real name prepended */ function full_address($row) { - global $addrsrch_fullname, $data_dir, $username; - $prefix = getPref($data_dir, $username, 'addrsrch_fullname'); - if (($prefix != "" || (isset($addrsrch_fullname) && - $prefix == $addrsrch_fullname)) && $prefix != 'noprefix') { - $name = ($prefix == 'nickname' ? $row['nickname'] : $row['name']); - return $name . ' <' . trim($row['email']) . '>'; - } else { + global $data_dir, $username; + $addrsrch_fullname = getPref($data_dir, $username, 'addrsrch_fullname'); + if ($addrsrch_fullname == 'fullname') + return $row['name'] . ' <' . trim($row['email']) . '>'; + else if ($addrsrch_fullname == 'nickname') + return $row['nickname'] . ' <' . trim($row['email']) . '>'; + else // "noprefix" return trim($row['email']); - } } /** diff --git a/include/load_prefs.php b/include/load_prefs.php index 2774b7cc..5cc69749 100644 --- a/include/load_prefs.php +++ b/include/load_prefs.php @@ -256,6 +256,9 @@ $collapse_folders = $show_html_default = getPref($data_dir, $username, 'show_html_default', SMPREF_ON); +$addrsrch_fullname = + getPref($data_dir, $username, 'addrsrch_fullname', SMPREF_ON); + $enable_forward_as_attachment = getPref($data_dir, $username, 'enable_forward_as_attachment', SMPREF_ON); diff --git a/include/options/compose.php b/include/options/compose.php index 1b6ce419..dbc53c41 100644 --- a/include/options/compose.php +++ b/include/options/compose.php @@ -71,11 +71,22 @@ function load_optpage_data_compose() { $optvals[SMOPT_GRP_COMPOSE][] = array( 'name' => 'use_javascript_addr_book', - 'caption' => _("Addressbook Display Format"), + 'caption' => _("Address Book Display Format"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_NONE, - 'posvals' => array('1' => _("Javascript"), - '0' => _("HTML")) + 'posvals' => array('1' => _("Pop-up window"), + '0' => _("In-page")) + ); + + + $optvals[SMOPT_GRP_COMPOSE][] = array( + 'name' => 'addrsrch_fullname', + 'caption' => _("Format of Addresses Added From Address Book"), + 'type' => SMOPT_TYPE_STRLIST, + 'refresh' => SMOPT_REFRESH_NONE, + 'posvals' => array('noprefix' => _("No prefix/Address only"), + 'nickname' => _("Nickname and address"), + 'fullname' => _("Full name and address")) ); -- 2.25.1