Add option that allows email address to be shown on message listings instead of full...
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 3 Jan 2009 00:14:42 +0000 (00:14 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 3 Jan 2009 00:14:42 +0000 (00:14 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13387 7612ce4b-ef26-0410-bec9-ea0150e637f0

include/load_prefs.php
include/options/display.php
src/right_main.php
src/search.php
templates/default/message_list.tpl

index 9ea748f..17a38ab 100644 (file)
@@ -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 */
index 53ad670..b436fa2 100644 (file)
@@ -281,6 +281,13 @@ function load_optpage_data_display() {
     );
 
     $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"),
         'type'    => SMOPT_TYPE_BOOLEAN,
index b72f8c3..f974d42 100644 (file)
@@ -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 {
index 20e624a..6520fc2 100644 (file)
@@ -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');
                     }
                 }
index 1e46fae..d373355 100644 (file)
  *    $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 &copy; 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;
         }