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 9ea748fc790f40727a9ace06d65f2b593187ea40..17a38abdcb7d8ab253b16b4701a454af1a77de39 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);
 
 $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 */
 /* 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 53ad67016b749ce401c30bfb113ebf5db95925cb..b436fa25649314d04d4bd472581598aa89e27112 100644 (file)
@@ -280,6 +280,13 @@ function load_optpage_data_display() {
         'size'    => SMOPT_SIZE_TINY
     );
 
         '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"),
     $optvals[SMOPT_GRP_MAILBOX][] = array(
         'name'    => 'show_full_date',
         'caption' => _("Always Show Full Date"),
index b72f8c376f13701fa1c04253e494de899873684c..f974d4299df9216879cebf98e74257fefcfccd0b 100644 (file)
@@ -354,6 +354,9 @@ if ($aMailbox['EXISTS'] > 0) {
     $oTemplate->assign('checkall', $checkall);
     $oTemplate->assign('preselected', $preselected);
 
     $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 {
     $oTemplate->display('message_list.tpl');
 
 } else {
index 20e624a2a2aaca9b24cb58923c022060b8207705..6520fc281daac92528ccb5b2e1377184dda8a00f 100644 (file)
@@ -1625,6 +1625,9 @@ if ($submit == $search_button_text) {
                         $oTemplate->assign('checkall', $checkall);
                         $oTemplate->assign('preselected', $preselected);
 
                         $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');
                     }
                 }
                         $oTemplate->display('message_list.tpl');
                     }
                 }
index 1e46faed1accc3b9e876983edd9b1e30cc816155..d3733551e83cff5960fd88250903e39287133455 100644 (file)
  *    $aErrors
  *    $checkall
  *    $preselected
  *    $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
  *
  * @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']     : '';
         $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;
         }
         if ($iCol !== SQM_COL_CHECK) {
             $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
         }