add option to shorten the length of the From field.
authorebullient <ebullient@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 21 Aug 2003 00:57:45 +0000 (00:57 +0000)
committerebullient <ebullient@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 21 Aug 2003 00:57:45 +0000 (00:57 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5534 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mailbox_display.php
include/load_prefs.php
include/options/display.php

index c746a0aa96511be711ddd0759a3a5f0196a627d6..588e813e3546522a80ead0619d72ebda798a498f 100644 (file)
@@ -45,12 +45,14 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
            $default_use_priority,
            $message_highlight_list,
            $index_order,
            $default_use_priority,
            $message_highlight_list,
            $index_order,
-           $indent_array,   /* indent subject by */
-           $pos,            /* Search postion (if any)  */
+           $indent_array,         /* indent subject by */
+           $pos,                  /* Search postion (if any)  */
            $thread_sort_messages, /* thread sorting on/off */
            $thread_sort_messages, /* thread sorting on/off */
-           $server_sort_order, /* sort value when using server-sorting */
+           $server_sort_order,    /* sort value when using server-sorting */
            $row_count,
            $row_count,
-           $allow_server_sort; /* enable/disable server-side sorting */
+           $allow_server_sort,    /* enable/disable server-side sorting */
+           $truncate_sender;      /* number of characters for From/To field (<= 0 for unchanged) */
+
     $color_string = $color[4];
 
     if ($GLOBALS['alt_index_colors']) {
     $color_string = $color[4];
 
     if ($GLOBALS['alt_index_colors']) {
@@ -99,6 +101,11 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
         }
     }
     $senderName = str_replace('&nbsp;',' ',$senderName);
         }
     }
     $senderName = str_replace('&nbsp;',' ',$senderName);
+
+    if ( $truncate_sender > 0 && strlen($senderName) > $truncate_sender ) {
+       $senderName = substr_replace($senderName, '... ', $truncate_sender);
+    }
+
     echo html_tag( 'tr','','','','VALIGN="top"') . "\n";
 
     if (isset($msg['FLAG_FLAGGED']) && ($msg['FLAG_FLAGGED'] == true)) {
     echo html_tag( 'tr','','','','VALIGN="top"') . "\n";
 
     if (isset($msg['FLAG_FLAGGED']) && ($msg['FLAG_FLAGGED'] == true)) {
index 75ed51a841efd183f70c4edb878d624faefde94a..a1948b48b40db4323ff7d5cee10836587f92f1bd 100644 (file)
@@ -264,6 +264,9 @@ $mailbox_select_style = getPref($data_dir, $username, 'mailbox_select_style', 0)
    on time distance from date of message */
 $show_full_date = getPref($data_dir, $username, 'show_full_date', 0);
 
    on time distance from date of message */
 $show_full_date = getPref($data_dir, $username, 'show_full_date', 0);
 
+/* Allow user to customize length of from field */
+$truncate_sender = getPref($data_dir, $username, 'truncate_sender', 0);
+
 do_hook('loading_prefs');
 
 ?>
 do_hook('loading_prefs');
 
 ?>
index 7ee723c3e06b870ae9d26d63abd612ec5e743f9d..1493f9312840b8a156d80602ce2b6d3f4fabc4da 100644 (file)
@@ -154,6 +154,15 @@ function load_optpage_data_display() {
         'refresh' => SMOPT_REFRESH_NONE
     );
 
         'refresh' => SMOPT_REFRESH_NONE
     );
 
+    $optvals[SMOPT_GRP_MAILBOX][] = array(
+        'name'    => 'truncate_sender',
+        'caption' => _("Length of From/To Field (0 for full)"),
+        'type'    => SMOPT_TYPE_INTEGER,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'size'    => SMOPT_SIZE_TINY
+    );
+
+
     /*** Load the General Options into the array ***/
     $optgrps[SMOPT_GRP_MESSAGE] = _("Message Display and Composition");
     $optvals[SMOPT_GRP_MESSAGE] = array();
     /*** Load the General Options into the array ***/
     $optgrps[SMOPT_GRP_MESSAGE] = _("Message Display and Composition");
     $optvals[SMOPT_GRP_MESSAGE] = array();