From a6172cd5e018245cb6886c239b2a4dcf55c87538 Mon Sep 17 00:00:00 2001 From: jangliss Date: Fri, 13 Jun 2003 05:02:11 +0000 Subject: [PATCH] Changed the default behaviour to use Marc's experimental cpde... note this is devel, and would be great to get some field testing (courier/uw would be great)... it seems to fix the folder display issues with Exchange IMAP where folders where appearing in the wrong order. Fixed an E_ALL error, and pulled the $imapConnection into the function, Marc are you running with E_ALL? The code caused an immediate error as it couldn't connect to the IMAP server, causing a nice folder order to appear: (http://nuts.netdork.net/bad_folders.jpg) Also fixed a couple of cases of "Editor Envy" and replaced \t with " " (hence the massive diff). Also fixed the code so that the "Trash" is now selectable, and moved the (purge) link back to after the mailbox name. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5029 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/left_main.php | 585 +++++++++++++++++++++++----------------------- 1 file changed, 293 insertions(+), 292 deletions(-) diff --git a/src/left_main.php b/src/left_main.php index c72f89dc..f2106085 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -47,10 +47,10 @@ function formatMailboxName($imapConnection, $box_array) { $status = array('',''); if (($unseen_notify == 2 && $real_box == 'INBOX') || $unseen_notify == 3) { - $tmp_status = create_unseen_string($real_box, $box_array, $imapConnection, $unseen_type ); - if ($status !== false) { - $status = $tmp_status; - } + $tmp_status = create_unseen_string($real_box, $box_array, $imapConnection, $unseen_type ); + if ($status !== false) { + $status = $tmp_status; + } } list($unseen_string, $unseen) = $status; $special_color = ($use_special_folder_color && isSpecialMailbox($real_box)); @@ -63,9 +63,9 @@ function formatMailboxName($imapConnection, $box_array) { /* Create the link for this folder. */ if ($status !== false) { - $line .= ''; - } + } if ($special_color) { $line .= ""; } @@ -77,7 +77,7 @@ function formatMailboxName($imapConnection, $box_array) { if ($special_color == TRUE) $line .= ''; if ($status !== false) { - $line .= ''; + $line .= ''; } /* If there are unseen message, close bolding. */ @@ -88,7 +88,7 @@ function formatMailboxName($imapConnection, $box_array) { $line .= " $unseen_string"; } - /* If it's the trash folder, show a purge link when needed */ + /* 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); @@ -164,7 +164,7 @@ function compute_folder_children(&$parbox, $boxcount) { function create_collapse_link($boxnum) { global $boxes, $imapConnection, $unseen_notify, $color; $mailbox = urlencode($boxes[$boxnum]['unformatted']); - + /* Create the link for this collapse link. */ $link = '0) $unseen_found = TRUE; - if ($boxes->total) { - $numMessages = $boxes->total; - $unseen_string = "($unseen/$numMessages)"; - } - } 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 + "; - } else { - $link .= "fold=$mailboxURL\">$leader - "; - } - $link .= ''; - $pre .= $link; - } else { - $pre.= $leader . '   '; - } - - - /* If there are unseen message, bold the line. */ - if ($unseen > 0) { $pre .= ''; } - - if (($move_to_trash) && ($mailbox == $trash_folder)) { - if (! isset($numMessages)) { - $status = sqimap_status_messages($imapConnection, $mailbox); - $numMessages = $status['MESSAGES']; - } - - if ($numMessages > 0) { - $urlMailbox = urlencode($mailbox); - $pre .= "\n\n" . - "  ("._("purge").")" . - ""; - } - } else { - if (!$boxes->is_noselect) { - $pre .= ""; - $end .= ''; - } - } - - /* If there are unseen message, close bolding. */ - if ($unseen > 0) { $end .= ""; } - - /* Print unseen information. */ - if (isset($unseen_found) && $unseen_found) { - $end .= " $unseen_string"; - } - - $font = ''; - $fontend = ''; - if ($boxes->is_special) { - $font = ""; - $fontend = ""; - } - - if (!$boxes->is_root) { - echo "" . $pre .$font. $boxes->mailboxname_sub .$fontend . $end. '
'; - $j++; - } - if (!$collapse || $boxes->is_root) { - for ($i = 0; $i mbxs); $i++) { - listBoxes($boxes->mbxs[$i],$j); - } - } - + $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 (isset($boxes->mbxs[0]) && $collapse_folders) { + $collapse = getPref($data_dir, $username, 'collapse_folder_' . $mailbox); + $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse); + + $link = '$leader + "; + } else { + $link .= "fold=$mailboxURL\">$leader - "; + } + $link .= ''; + $pre .= $link; + } else { + $pre.= $leader . '   '; + } + + + /* If there are unseen message, bold the line. */ + if ($unseen > 0) { $pre .= ''; } + + if (($move_to_trash) && ($mailbox == $trash_folder)) { + if (! isset($numMessages)) { + $status = sqimap_status_messages($imapConnection, $mailbox); + $numMessages = $status['MESSAGES']; + } + + $pre .= ""; + $end .= ''; + if ($numMessages > 0) { + $pre .= ""; + $end .= "\n\n" . + "  ("._("purge").")" . + ""; + } + } else { + if (!$boxes->is_noselect) { + $pre .= ""; + $end .= ''; + } + } + + /* If there are unseen message, close bolding. */ + if ($unseen > 0) { $end .= ""; } + + /* Print unseen information. */ + if (isset($unseen_found) && $unseen_found) { + $end .= " $unseen_string"; + } + + $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) { + for ($i = 0; $i mbxs); $i++) { + listBoxes($boxes->mbxs[$i],$j); + } + } + } } @@ -381,121 +383,121 @@ function ListAdvancedBoxes ($boxes, $mbx, $j='ID.0000' ) { $pre = ''; $end = ''; $collapse = false; - + if ($boxes) { - $mailbox = $boxes->mailboxname_full; - $mailboxURL = urlencode($mailbox); + $mailbox = $boxes->mailboxname_full; + $mailboxURL = urlencode($mailbox); - /* get unseen/total messages information */ + /* get unseen/total messages information */ if ($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 there are unseen message, bold the line. */ - if ($unseen > 0) { $pre .= ''; } - - /* color special boxes */ - if ($boxes->is_special) { - $pre .= ""; - $end .= ''; - } - - /* If there are unseen message, close bolding. */ - if ($unseen > 0) { $end .= ''; } - - /* Print unseen information. */ - if (isset($unseen_found) && $unseen_found) { - $end .= " $unseen_string"; - } - - if (($move_to_trash) && ($mailbox == $trash_folder)) { - if (! isset($numMessages)) { - $numMessages = $boxes->total; - } - if ($numMessages > 0) { - $urlMailbox = urlencode($mailbox); - $pre .= "\n\n" . - "  ("._("purge").")" . - ""; - } - } else { - if (!$boxes->is_noselect) { /* \Noselect boxes can't be selected */ - $pre .= ""; - $end .= ''; - } - } - - if (!$boxes->is_root) { - if ($use_folder_images) { - if ($boxes->is_inbox) { - $folder_img = '../images/inbox.gif'; - } else if ($boxes->is_sent) { - $folder_img = '../images/senti.gif'; - } else if ($boxes->is_trash) { - $folder_img = '../images/delitem.gif'; - } else if ($boxes->is_draft) { - $folder_img = '../images/draft.gif'; - } else $folder_img = '../images/folder.gif'; - $folder_img = '  '; - } else $folder_img = ''; - if (!isset($boxes->mbxs[0])) { - echo ' ' . html_tag( 'div', - $pre . $folder_img . $boxes->mailboxname_sub . $end , - 'left', '', 'class="mbx_sub" id="' .$j. '"' ) - . "\n"; - } else { - /* get collapse information */ - if ($collapse_folders) { - $link = ''." "; - } else { - $link = ''.""; - } - $collapse_link = $link; - } else $collapse_link=''; - echo ' ' . html_tag( 'div', - $collapse_link . $pre . $folder_img . ' '. $boxes->mailboxname_sub . $end , - 'left', '', 'class="mbx_par" id="' .$j. 'P"' ) - . "\n"; - echo ' '."\n"; - } - } - if ($collapse) { - $visible = ' style="display:none;"'; - } else { - $visible = ' style="display:block;"'; - } - - if (isset($boxes->mbxs[0]) && !$boxes->is_root) /* mailbox contains childs */ - echo html_tag( 'div', '', 'left', '', 'class="par_area" id='.$j.'.0000 '. $visible ) . "\n"; - - if ($j !='ID.0000') { - $j = $j .'.0000'; - } - for ($i = 0; $i mbxs); $i++) { - $j++; - listAdvancedBoxes($boxes->mbxs[$i],$mbx,$j); - } - if (isset($boxes->mbxs[0]) && !$boxes->is_root ) echo ''."\n\n"; + $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 there are unseen message, bold the line. */ + if ($unseen > 0) { $pre .= ''; } + + /* color special boxes */ + if ($boxes->is_special) { + $pre .= ""; + $end .= ''; + } + + /* If there are unseen message, close bolding. */ + if ($unseen > 0) { $end .= ''; } + + /* Print unseen information. */ + if (isset($unseen_found) && $unseen_found) { + $end .= " $unseen_string"; + } + + if (($move_to_trash) && ($mailbox == $trash_folder)) { + if (! isset($numMessages)) { + $numMessages = $boxes->total; + } + if ($numMessages > 0) { + $urlMailbox = urlencode($mailbox); + $pre .= "\n\n" . + "  ("._("purge").")" . + ""; + } + } else { + if (!$boxes->is_noselect) { /* \Noselect boxes can't be selected */ + $pre .= ""; + $end .= ''; + } + } + + if (!$boxes->is_root) { + if ($use_folder_images) { + if ($boxes->is_inbox) { + $folder_img = '../images/inbox.gif'; + } else if ($boxes->is_sent) { + $folder_img = '../images/senti.gif'; + } else if ($boxes->is_trash) { + $folder_img = '../images/delitem.gif'; + } else if ($boxes->is_draft) { + $folder_img = '../images/draft.gif'; + } else $folder_img = '../images/folder.gif'; + $folder_img = '  '; + } else $folder_img = ''; + if (!isset($boxes->mbxs[0])) { + echo ' ' . html_tag( 'div', + $pre . $folder_img . $boxes->mailboxname_sub . $end , + 'left', '', 'class="mbx_sub" id="' .$j. '"' ) + . "\n"; + } else { + /* get collapse information */ + if ($collapse_folders) { + $link = ''." "; + } else { + $link = ''.""; + } + $collapse_link = $link; + } else $collapse_link=''; + echo ' ' . html_tag( 'div', + $collapse_link . $pre . $folder_img . ' '. $boxes->mailboxname_sub . $end , + 'left', '', 'class="mbx_par" id="' .$j. 'P"' ) + . "\n"; + echo ' '."\n"; + } + } + if ($collapse) { + $visible = ' style="display:none;"'; + } else { + $visible = ' style="display:block;"'; + } + + if (isset($boxes->mbxs[0]) && !$boxes->is_root) /* mailbox contains childs */ + echo html_tag( 'div', '', 'left', '', 'class="par_area" id='.$j.'.0000 '. $visible ) . "\n"; + + if ($j !='ID.0000') { + $j = $j .'.0000'; + } + for ($i = 0; $i mbxs); $i++) { + $j++; + listAdvancedBoxes($boxes->mbxs[$i],$mbx,$j); + } + if (isset($boxes->mbxs[0]) && !$boxes->is_root ) echo ''."\n\n"; } } @@ -531,24 +533,24 @@ if (isset($left_refresh) && ($left_refresh != '') && } /** - * $advanced_tree and $oldway are boolean vars which are default set to default - * SM behaviour. - * Setting $oldway to false causes left_main.php to use the new experimental + * $advanced_tree and $oldway are boolean vars which are default set to default + * SM behaviour. + * Setting $oldway to false causes left_main.php to use the new experimental * way of getting the mailbox-tree. - * Setting $advanced tree to true causes SM to display a experimental + * Setting $advanced tree to true causes SM to display a experimental * mailbox-tree with dhtml behaviour. - * It only works on browsers which supports css and javascript. The used - * javascript is experimental and doesn't support all browsers. It is tested on + * It only works on browsers which supports css and javascript. The used + * javascript is experimental and doesn't support all browsers. It is tested on * IE6 an Konquerer 3.0.0-2. * In the function ListAdvancedBoxes there is another var $use_folder_images. * setting this to true is only usefull if the images exists in ../images. - * + * * Feel free to experiment with the code and report bugs and enhancements * to marc@its-projects.nl - **/ + **/ $advanced_tree = false; /* set this to true if you want to see a nicer mailboxtree */ -$oldway = true; /* default SM behaviour */ +$oldway = false; /* default SM behaviour */ if ($advanced_tree) { $xtra .= << 35) { new_col_width = parseInt(RegExp.$1) - 25; } } - masterf.cols = calc_col(new_col_width); + masterf.cols = calc_col(new_col_width); } //--> - + ECHO; @@ -815,7 +817,7 @@ echo "\n'; echo ''; @@ -824,9 +826,9 @@ if ($advanced_tree) { echo '


'; } -echo "\n\n" . html_tag( 'table', '', 'left', '', 'border="0" cellspacing="0" cellpadding="0" width="99%"' ) . - html_tag( 'tr' ) . - html_tag( 'td', '', 'left' ) . +echo "\n\n" . html_tag( 'table', '', 'left', '', 'border="0" cellspacing="0" cellpadding="0" width="99%"' ) . + html_tag( 'tr' ) . + html_tag( 'td', '', 'left' ) . '
'. _("Folders") . "
\n\n"; if ($date_format != 6) { @@ -879,7 +881,7 @@ if ( $collapse_folders ) { } if ($oldway) { /* normal behaviour SM */ - + $boxes = sqimap_mailbox_list($imapConnection); /* Prepare do do out collapsedness and visibility computation. */ $curbox = 0; @@ -892,7 +894,6 @@ while ($curbox < $boxcount) { compute_folder_children($curbox, $boxcount); } - for ($i = 0; $i < count($boxes); $i++) { if ( $boxes[$i]['visible'] ) { $mailbox = $boxes[$i]['formatted']; @@ -935,19 +936,19 @@ for ($i = 0; $i < count($boxes); $i++) { echo $line; } } -} else { /* expiremental code */ +} else { /* expiremental code */ $boxes = sqimap_mailbox_tree($imapConnection); if (isset($advanced_tree) && $advanced_tree) { - echo '


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

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