From e4c5976a5eb79ccdec53be2367512f7fae76bb3e Mon Sep 17 00:00:00 2001 From: jangliss Date: Fri, 13 Jun 2003 07:44:53 +0000 Subject: [PATCH] More updates to the folder list. Allowed for user options for the display of unread messages to work as per text in options, where as before it was always displaying the data. Need to find out why my courier is returning no INBOX when folder_prefix is set to INBOX. as it is totally messing up my tree. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5036 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/left_main.php | 167 ++++++++++++++++++++++++++++------------------ 1 file changed, 102 insertions(+), 65 deletions(-) diff --git a/src/left_main.php b/src/left_main.php index f2106085..042abd0f 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -280,96 +280,133 @@ function is_parent_box($curbox_name, $parbox_name) { function listBoxes ($boxes, $j=0 ) { global $data_dir, $username, $startmessage, $color, $unseen_notify, $unseen_type, $move_to_trash, $trash_folder, $collapse_folders, $imapConnection; - $pre = ''; + $pre = ''; $end = ''; $collapse = false; - if ($boxes) { - $mailbox = $boxes->mailboxname_full; - $leader = ''; - for ($k = 0; $k < $j; $k++) { - $leader.= '   '; - } - $mailboxURL = urlencode($mailbox); + $unseen_type = 1; + $unseen_notify = 0; + + /* Get unseen/total display prefs */ + $unseen_type = getPref( $data_dir , $username , 'unseen_type' ); + $unseen_notify = getPref( $data_dir , $username , 'unseen_notify' ); + + if (isset($boxes) && !empty($boxes)) { + $mailbox = $boxes->mailboxname_full; + $leader = ''; + for ($k = 0; $k < $j; $k++) { + $leader.= '   '; + } + $mailboxURL = urlencode($mailbox); - /* get unseen/total messages information */ + /* get unseen/total messages information */ if ($boxes->unseen) { - $unseen = $boxes->unseen; + $unseen = $boxes->unseen; $unseen_string = "($unseen)"; - if ($unseen>0) $unseen_found = TRUE; - if ($boxes->total) { - $numMessages = $boxes->total; - $unseen_string = "($unseen/$numMessages)"; - } - } else $unseen = 0; + if ($unseen>0) { + $unseen_found = TRUE; + } + $unseen_before = ''; + $unseen_after = ''; + if ((($unseen_notify == 2) && (strtolower($mailbox) == 'inbox')) || ($unseen_notify == 3)) { + $unseen_string = '(' . $unseen; + + if ($unseen_type > 1) { + $unseen_string .= '/' . $boxes->total; + } - if (isset($boxes->mbxs[0]) && $collapse_folders) { - $collapse = getPref($data_dir, $username, 'collapse_folder_' . $mailbox); + $unseen_string .= ')'; + + $unseen_string = $unseen_before . $unseen_string . $unseen_after; + } + + } else { + $unseen = 0; + } + + if (isset($boxes->mbxs[0]) && $collapse_folders) { + $collapse = getPref($data_dir, $username, 'collapse_folder_' . $mailbox); $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse); - $link = '$leader + "; + $link = '$leader + "; + } else { + $link .= "fold=$mailboxURL\">$leader - "; + } + $link .= ''; + $pre .= $link; } else { - $link .= "fold=$mailboxURL\">$leader - "; + $pre.= $leader . '   '; } - $link .= ''; - $pre .= $link; - } else { - $pre.= $leader . '   '; - } - /* If there are unseen message, bold the line. */ - if ($unseen > 0) { $pre .= ''; } + /* If there are unseen message, bold the line. */ - if (($move_to_trash) && ($mailbox == $trash_folder)) { + if (($move_to_trash) && ($mailbox == $trash_folder)) { if (! isset($numMessages)) { $status = sqimap_status_messages($imapConnection, $mailbox); $numMessages = $status['MESSAGES']; } - $pre .= ""; + if ($unseen > 0) { + $pre .= ''; + } + + $pre .= ""; + + if ($unseen > 0) { + $end .= ''; + } + $end .= ''; if ($numMessages > 0) { - $pre .= ""; + if ($unseen > 0) { + $pre .= ''; + } + $pre .= ""; + if ($unseen > 0) { + $end .= ''; + } $end .= "\n\n" . "  ("._("purge").")" . ""; } - } else { - if (!$boxes->is_noselect) { - $pre .= ""; - $end .= ''; + } else { + if (!$boxes->is_noselect) { + if ($unseen > 0) { + $pre .= ''; + } + $pre .= ""; + if ($unseen > 0) { + $end .= ''; + } + $end .= ''; + } } - } - - /* If there are unseen message, close bolding. */ - if ($unseen > 0) { $end .= ""; } - /* Print unseen information. */ - if (isset($unseen_found) && $unseen_found) { + /* Print unseen information. */ + if (isset($unseen_found) && $unseen_found) { $end .= " $unseen_string"; - } + } - $font = ''; - $fontend = ''; - if ($boxes->is_special) { + $font = ''; + $fontend = ''; + if ($boxes->is_special) { $font = ""; - $fontend = ""; - } - - if (!$boxes->is_root) { - echo "" . $pre .$font. $boxes->mailboxname_sub .$fontend . $end. '
' . "\n"; - $j++; - } - if (!$collapse || $boxes->is_root) { + $fontend = ""; + } + $end .= '
'; + if (!$boxes->is_root) { + echo "" . $pre .$font. $boxes->mailboxname_sub .$fontend . $end. '
' . "\n"; + $j++; + } + if (!$collapse || $boxes->is_root) { for ($i = 0; $i mbxs); $i++) { - listBoxes($boxes->mbxs[$i],$j); + listBoxes($boxes->mbxs[$i],$j); } - } - + } } } @@ -939,16 +976,16 @@ for ($i = 0; $i < count($boxes); $i++) { } else { /* expiremental code */ $boxes = sqimap_mailbox_tree($imapConnection); if (isset($advanced_tree) && $advanced_tree) { - echo '


'; - echo '
'."\n\n"; - if (!isset($mbx)) $mbx=NULL; + echo '

'; + echo '
'."\n\n"; + if (!isset($mbx)) $mbx=NULL; ListAdvancedBoxes($boxes, $mbx); - echo '
'."\n"; - echo ''."\n"; + echo '
'."\n"; + echo ''."\n"; } else { - ListBoxes($boxes); + ListBoxes($boxes); } } /* if ($oldway) else ... */ do_hook('left_main_after'); -- 2.25.1