From 969c1e9fcec1fb8c0e67004dc5f22aee9cc4d003 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Sat, 3 Jan 2009 00:14:42 +0000 Subject: [PATCH] Add option that allows email address to be shown on message listings instead of full name (which is then shown in the tool tip) (#1762482) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13387 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- include/load_prefs.php | 3 +++ include/options/display.php | 7 +++++++ src/right_main.php | 3 +++ src/search.php | 3 +++ templates/default/message_list.tpl | 16 ++++++++++++++++ 5 files changed, 32 insertions(+) diff --git a/include/load_prefs.php b/include/load_prefs.php index 9ea748fc..17a38abd 100644 --- a/include/load_prefs.php +++ b/include/load_prefs.php @@ -337,6 +337,9 @@ $mailbox_select_style = getPref($data_dir, $username, 'mailbox_select_style', SM $custom_date_format = getPref($data_dir, $username, 'custom_date_format', ''); $show_full_date = getPref($data_dir, $username, 'show_full_date', SMPREF_OFF); +// Allow user to determine if personal name or email address is shown in mailbox listings +$show_personal_names = getPref($data_dir, $username, 'show_personal_names', SMPREF_ON); + /* Allow user to customize length of from field */ $truncate_sender = getPref($data_dir, $username, 'truncate_sender', 50); /* Allow user to customize length of subject field */ diff --git a/include/options/display.php b/include/options/display.php index 53ad6701..b436fa25 100644 --- a/include/options/display.php +++ b/include/options/display.php @@ -280,6 +280,13 @@ function load_optpage_data_display() { 'size' => SMOPT_SIZE_TINY ); + $optvals[SMOPT_GRP_MAILBOX][] = array( + 'name' => 'show_personal_names', + 'caption' => _("Show Names Instead of Email Addresses"), + 'type' => SMOPT_TYPE_BOOLEAN, + 'refresh' => SMOPT_REFRESH_NONE, + ); + $optvals[SMOPT_GRP_MAILBOX][] = array( 'name' => 'show_full_date', 'caption' => _("Always Show Full Date"), diff --git a/src/right_main.php b/src/right_main.php index b72f8c37..f974d429 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -354,6 +354,9 @@ if ($aMailbox['EXISTS'] > 0) { $oTemplate->assign('checkall', $checkall); $oTemplate->assign('preselected', $preselected); + global $show_personal_names; + $oTemplate->assign('show_personal_names', $show_personal_names); + $oTemplate->display('message_list.tpl'); } else { diff --git a/src/search.php b/src/search.php index 20e624a2..6520fc28 100644 --- a/src/search.php +++ b/src/search.php @@ -1625,6 +1625,9 @@ if ($submit == $search_button_text) { $oTemplate->assign('checkall', $checkall); $oTemplate->assign('preselected', $preselected); + global $show_personal_names; + $oTemplate->assign('show_personal_names', $show_personal_names); + $oTemplate->display('message_list.tpl'); } } diff --git a/templates/default/message_list.tpl b/templates/default/message_list.tpl index 1e46faed..d3733551 100644 --- a/templates/default/message_list.tpl +++ b/templates/default/message_list.tpl @@ -64,6 +64,12 @@ * $aErrors * $checkall * $preselected + * $show_personal_names boolean When turned on, all email + * address fields should display + * the personal name and use the + * email address as a tool tip; + * When turned off, this logic + * should be inverted * * @copyright © 1999-2006 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License @@ -442,6 +448,16 @@ if ($non_clicked_class != 'even' && $non_clicked_class != 'odd' $onclick = (isset($aCol['onclick'])) ? $aCol['onclick'] : ''; $value = (isset($aCol['value'])) ? $aCol['value'] : ''; $target = (isset($aCol['target'])) ? $aCol['target'] : ''; + if (!$show_personal_names + && ($iCol == SQM_COL_FROM + || $iCol == SQM_COL_TO + || $iCol == SQM_COL_CC + || $iCol == SQM_COL_BCC)) { + // swap title and value + $tmp = $title; + $title = $value; + $value = $tmp; + } if ($iCol !== SQM_COL_CHECK) { $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd; } -- 2.25.1