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 c746a0a..588e813 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 75ed51a..a1948b4 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 7ee723c..1493f93 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();