From 459e3347e4434d9d15a9f57e220ef21ee0700adb Mon Sep 17 00:00:00 2001 From: ebullient Date: Thu, 21 Aug 2003 00:57:45 +0000 Subject: [PATCH] add option to shorten the length of the From field. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5534 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mailbox_display.php | 15 +++++++++++---- include/load_prefs.php | 3 +++ include/options/display.php | 9 +++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index c746a0aa..588e813e 100644 --- a/functions/mailbox_display.php +++ b/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(' ',' ',$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)) { diff --git a/include/load_prefs.php b/include/load_prefs.php index 75ed51a8..a1948b48 100644 --- a/include/load_prefs.php +++ b/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'); ?> diff --git a/include/options/display.php b/include/options/display.php index 7ee723c3..1493f931 100644 --- a/include/options/display.php +++ b/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(); -- 2.25.1