From 70bf5a7fbeab48b10a6c5bdf762f780aaaf0033c Mon Sep 17 00:00:00 2001 From: jmunro Date: Mon, 2 Sep 2002 07:45:01 +0000 Subject: [PATCH 1/1] When using unseen notify on all folders this code adds a total unseen value to the left of the folder name for any unread mail in a collapsed folder's subfolders. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3527 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/left_main.php | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/left_main.php b/src/left_main.php index ef74259e..c424a16a 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -162,15 +162,44 @@ function compute_folder_children(&$parbox, $boxcount) { * currently appropriate. */ function create_collapse_link($boxnum) { - global $boxes; + global $boxes, $imapConnection, $unseen_notify, $color; $mailbox = urlencode($boxes[$boxnum]['unformatted']); - + /* Create the link for this collapse link. */ $link = '+"; - } else { + + /* this code checks unseen_notify settings and displays + * a total next to a colapsed folder for the amount of + * unread mail in its sunfolders + */ + $box_count = count($boxes); + $cur_box = $boxes[$boxnum]['unformatted']; + $parent_unseen = 0; + $length = strlen($cur_box); + if (($unseen_notify == 2 && $cur_box == 'INBOX') || $unseen_notify == 3) { + for ($i=0;$i<$box_count;$i++) { + $this_unseen = 0; + if ($cur_box != $boxes[$i]['unformatted']) { + if (substr($boxes[$i]['unformatted'], 0, $length) == $cur_box) { + if (!in_array('noselect', $boxes[$i]['flags'])) { + $this_unseen = sqimap_unseen_messages($imapConnection, + $boxes[$i]['unformatted']); + } + } + } + $parent_unseen += $this_unseen; + } + } + if ($parent_unseen > 0) { + $link .= "unfold=$mailbox\">+($parent_unseen)"; + } + else { + $link .= "unfold=$mailbox\">+"; + } + } + else { $link .= "fold=$mailbox\">-"; } $link .= ''; -- 2.25.1