Browse Source

add option to shorten the length of the From field.

Erin Schnabel 22 years ago
parent
commit
25e9ce3acc
3 changed files with 23 additions and 4 deletions
  1. 11 4
      functions/mailbox_display.php
  2. 3 0
      include/load_prefs.php
  3. 9 0
      include/options/display.php

+ 11 - 4
functions/mailbox_display.php

@@ -45,12 +45,14 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
            $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 */
-           $server_sort_order, /* sort value when using server-sorting */
+           $server_sort_order,    /* sort value when using server-sorting */
            $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']) {
@@ -99,6 +101,11 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
         }
     }
     $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)) {

+ 3 - 0
include/load_prefs.php

@@ -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);
 
+/* Allow user to customize length of from field */
+$truncate_sender = getPref($data_dir, $username, 'truncate_sender', 0);
+
 do_hook('loading_prefs');
 
 ?>

+ 9 - 0
include/options/display.php

@@ -154,6 +154,15 @@ function load_optpage_data_display() {
         '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();