X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fleft_main.php;h=0a768061a57b8030e90a457ce21d8bbc31585001;hp=9d18c55126b780cfc2bc2402343b084b5517e3e9;hb=24d1619523e7005477feb74d9a54da6a0efc58a6;hpb=8cd3f6dae1b23eeb8656604cf759d28663601e93 diff --git a/src/left_main.php b/src/left_main.php index 9d18c551..0a768061 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -1,338 +1,883 @@ 0) { + if (($unseen_notify == 2 && $real_box == 'INBOX') || + $unseen_notify == 3) { + $unseen = sqimap_unseen_messages($imapConnection, $real_box); + if ($unseen_type == 1 && $unseen > 0) { $unseen_string = "($unseen)"; - $unseen_found = true; - } else if ($unseen_type == 2) { + $unseen_found = TRUE; + } else if ($unseen_type == 2) { $numMessages = sqimap_get_num_messages($imapConnection, $real_box); $unseen_string = "($unseen/$numMessages)"; - $unseen_found = true; - } - } - - $special_color = false; - if ($use_special_folder_color) { - if ((strtolower($real_box) == 'inbox') - || (($real_box == $trash_folder) && ($move_to_trash)) - || (($real_box == $sent_folder) && ($move_to_sent)) - || (($real_box == $draft_folder) && ($save_as_draft))) { - $special_color = true; - } - } - - /* Start off with a blank line. */ - $line = ''; - - /* If there are unseen message, bold the line. */ - if ($unseen > 0) { $line .= ''; } - - /* Crate the link for this folder. */ - $line .= ""; - if ($special_color == true) - $line .= ""; - $line .= str_replace(' ',' ',$mailbox); - if ($special_color == true) - $line .= ""; - $line .= ''; - - /* If there are unseen message, close bolding. */ - if ($unseen > 0) { $line .= ""; } - - /* Print unseen information. */ - if (isset($unseen_found) && $unseen_found) { - $line .= " $unseen_string"; - } + $unseen_found = TRUE; + } + } + + $special_color = ($use_special_folder_color && isSpecialMailbox( $real_box ) ); + + /* Start off with a blank line. */ + $line = ''; + + /* If there are unseen message, bold the line. */ + if ($unseen > 0) { $line .= ''; } + + /* Crate the link for this folder. */ + $line .= ""; + if ($special_color) { + $line .= ""; + } + if ( $mailbox == 'INBOX' ) { + $line .= _("INBOX"); + } else { + $line .= str_replace(' ',' ',$mailbox); + } + if ($special_color == TRUE) + $line .= ''; + $line .= ''; + + /* If there are unseen message, close bolding. */ + if ($unseen > 0) { $line .= ""; } + + /* Print unseen information. */ + if (isset($unseen_found) && $unseen_found) { + $line .= " $unseen_string"; + } - if (($move_to_trash == true) && ($real_box == $trash_folder)) { - if (! isset($numMessages)) { + if (($move_to_trash) && ($real_box == $trash_folder)) { + if (! isset($numMessages)) { $numMessages = sqimap_get_num_messages($imapConnection, $real_box); - } + } - if ($numMessages > 0) { + if ($numMessages > 0) { $urlMailbox = urlencode($real_box); - $line .= "\n\n"; - $line .= " ("._("purge").")"; - $line .= "\n\n"; - } - } + $line .= "\n\n" . + " ("._("purge").")" . + ""; + } + } - /* Return the final product. */ - return ($line); - } + /* Return the final product. */ + return ($line); +} - /**********************************/ - /* END OF FUNCTION - BACK TO MAIN */ - /**********************************/ +/** + * Recursive function that computes the collapsed status and parent + * (or not parent) status of this box, and the visiblity and collapsed + * status and parent (or not parent) status for all children boxes. + */ +function compute_folder_children(&$parbox, $boxcount) { + global $boxes, $data_dir, $username, $collapse_folders; + $nextbox = $parbox + 1; - if (isset($left_refresh) && ($left_refresh != 'None') && ($left_refresh != '')) { - echo "\n"; - echo "\n"; - echo "\n"; + /* Retreive the name for the parent box. */ + $parbox_name = $boxes[$parbox]['unformatted']; + + /* 'Initialize' this parent box to childless. */ + $boxes[$parbox]['parent'] = FALSE; + + /* Compute the collapse status for this box. */ + if( isset($collapse_folders) && $collapse_folders ) { + $collapse = getPref($data_dir, $username, 'collapse_folder_' . $parbox_name); + $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse); + } else { + $collapse = SM_BOX_UNCOLLAPSED; } - - echo "\n
\n"; + $boxes[$parbox]['collapse'] = $collapse; - do_hook("left_main_before"); + /* Otherwise, get the name of the next box. */ + if (isset($boxes[$nextbox]['unformatted'])) { + $nextbox_name = $boxes[$nextbox]['unformatted']; + } else { + $nextbox_name = ''; + } - $boxes = sqimap_mailbox_list($imapConnection); + /* Compute any children boxes for this box. */ + while (($nextbox < $boxcount) && + (is_parent_box($boxes[$nextbox]['unformatted'], $parbox_name))) { - echo '