From 6903c7bd530c01b1fbfae003d2c27da238400422 Mon Sep 17 00:00:00 2001 From: kink Date: Thu, 9 Jan 2003 15:56:38 +0000 Subject: [PATCH] When in threaddisplay, trim subjects of indented messages more. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4403 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mailbox_display.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 1b002ec4..8861f11c 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -76,7 +76,7 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, $senderName = sqimap_find_displayable_name($msg['FROM']); } - $subject = processSubject($msg['SUBJECT']); + $subject = processSubject($msg['SUBJECT'], $indent_array[$msg['ID']]); echo html_tag( 'tr','','','','VALIGN="top"') . "\n"; @@ -175,7 +175,7 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox, case 4: /* subject */ $td_str = $bold; if ($thread_sort_messages == 1) { - if (isset($indent_array[$msg["ID"]])) { + if (isset($indent_array[$msg['ID']])) { $td_str .= str_repeat("    ",$indent_array[$msg['ID']]); } } @@ -1168,18 +1168,24 @@ function get_paginator_str($box, $start_msg, $end_msg, $num_msgs, return ($result); } -function processSubject($subject) { +function processSubject($subject, $threadlevel = 0) { global $languages, $squirrelmail_language; /* Shouldn't ever happen -- caught too many times in the IMAP functions */ if ($subject == '') return _("(no subject)"); - if (strlen($subject) <= 55) + $trim_at = 55; + + /* if this is threaded, substract two chars per indentlevel */ + if($threadlevel > 0 && $threadlevel <= 10) + $trim_at -= (2*$threadlevel); + + if (strlen($subject) <= $trim_at) return $subject; $ent_strlen = strlen($subject); - $trim_val=50; - $ent_offset=0; + $trim_val = $trim_at - 5; + $ent_offset = 0; /* * see if this is entities-encoded string * If so, Iterate through the whole string, find out @@ -1193,7 +1199,7 @@ function processSubject($subject) { $ent_offset = $ent_loc_end+1; } - if ($ent_strlen <= 55){ + if ($ent_strlen <= $trim_at){ return $subject; } -- 2.25.1