X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fleft_main.php;h=f6165b9ef665377529441e518a1646abd71aba58;hb=45fc8f479f66cf4df6e73a70f899ef46e4b88754;hp=4bb0e0b6165f2dc373ea30c31f0a58da0b091420;hpb=d6def997ed1c35054ff1bb48c4a605c28dc0d549;p=squirrelmail.git diff --git a/src/left_main.php b/src/left_main.php index 4bb0e0b6..f6165b9e 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -1,282 +1,988 @@ 0) { $line .= ''; } - 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) { - $numMessages = sqimap_get_num_messages($imapConnection, $real_box); - $unseen_string = "($unseen/$numMessages)"; - $unseen_found = true; - } - } - - $special_color = false; - if ((strtolower($real_box) == 'inbox') || - (($real_box == $trash_folder) && ($move_to_trash)) || - (($real_box == $sent_folder) && ($move_to_sent))) - $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"; - } + /* Create the link for this folder. */ + if ($status !== false) { + $line .= ''; + } + if ($special_color) { + $line .= ""; + } + if ( $mailbox == 'INBOX' ) { + $line .= _("INBOX"); + } else { + $line .= str_replace(' ',' ',$mailbox); + } + if ($special_color == TRUE) + $line .= ''; + if ($status !== false) { + $line .= ''; + } + + /* If there are unseen message, close bolding. */ + if ($unseen > 0) { $line .= ""; } + + /* Print unseen information. */ + if ($unseen_string != '') { + $line .= " $unseen_string"; + } - if (($move_to_trash == true) && ($real_box == $trash_folder)) { - if (! isset($numMessages)) { + /* If it's the trash folder, show a purge link when needed */ + 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) or ($box_array['parent'] == 1)) { $urlMailbox = urlencode($real_box); - $line .= "\n\n"; - $line .= " ("._("purge").")"; - $line .= "\n\n"; - } - } + $line .= "\n\n" . + " ("._("purge").")" . + ""; + } else { + $line .= concat_hook_function('left_main_after_each_folder', + array(isset($numMessages) ? $numMessages : '',$real_box,$imapConnection)); + } + } - /* Return the final product. */ - return ($line); - } + /* Return the final product. */ + return ($line); +} + +/** + * 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; + + /* Retreive the name for the parent box. */ + $parbox_name = $boxes[$parbox]['unformatted']; + + /* 'Initialize' this parent box to childless. */ + $boxes[$parbox]['parent'] = FALSE; - if (isset($left_refresh) && ($left_refresh != 'None') && ($left_refresh != '')) { - echo "\n"; - echo "\n"; - echo "\n"; + /* 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; + } + $boxes[$parbox]['collapse'] = $collapse; + + /* Otherwise, get the name of the next box. */ + if (isset($boxes[$nextbox]['unformatted'])) { + $nextbox_name = $boxes[$nextbox]['unformatted']; + } else { + $nextbox_name = ''; } - - echo "\n
\n"; - do_hook("left_main_before"); + /* Compute any children boxes for this box. */ + while (($nextbox < $boxcount) && + (is_parent_box($boxes[$nextbox]['unformatted'], $parbox_name))) { - $boxes = sqimap_mailbox_list($imapConnection); + /* Note that this 'parent' box has at least one child. */ + $boxes[$parbox]['parent'] = TRUE; - echo '