UW Folder badness take two.
This commit is contained in:
parent
eaccc266f1
commit
20b51df26d
2 changed files with 20 additions and 14 deletions
|
@ -419,9 +419,14 @@ function user_strcasecmp($a, $b) {
|
|||
* $folder_skip - array of folders to keep out of option list (compared in lower)
|
||||
* $boxes - list of already fetched boxes (for places like folder panel, where
|
||||
* you know these options will be shown 3 times in a row.. (most often unset).
|
||||
* $parent - used to indicate whether or not listed boxes can be parents
|
||||
* $flag - flag to check for in mailbox flags, used to filter out mailboxes.
|
||||
* 'noselect' by default to remove unselectable mailboxes.
|
||||
* 'noinferiors' used to filter out folders that can not contain subfolders.
|
||||
* NULL to avoid flag check entirely.
|
||||
* $use_long_format - override folder display preference and always show full folder name.
|
||||
*/
|
||||
function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_skip = 0, $boxes = 0, $parent = false, $use_long_format = false ) {
|
||||
function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_skip = 0, $boxes = 0,
|
||||
$flag = 'noselect', $use_long_format = false ) {
|
||||
global $username, $data_dir;
|
||||
$mbox_options = '';
|
||||
|
||||
|
@ -434,14 +439,9 @@ function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_sk
|
|||
if ($boxes == 0) {
|
||||
$boxes = sqimap_mailbox_list($imap_stream);
|
||||
}
|
||||
if ($parent) {
|
||||
$flag = 'noinferiors';
|
||||
}
|
||||
else {
|
||||
$flag = 'noselect';
|
||||
}
|
||||
|
||||
foreach ($boxes as $boxes_part) {
|
||||
if (!in_array($flag, $boxes_part['flags'])) {
|
||||
if ($flag == NULL || !in_array($flag, $boxes_part['flags'])) {
|
||||
$box = $boxes_part['unformatted'];
|
||||
$lowerbox = strtolower($box);
|
||||
|
||||
|
|
|
@ -120,9 +120,9 @@ if ( $default_sub_of_inbox == false ) {
|
|||
|
||||
// Call sqimap_mailbox_option_list, using existing connection to IMAP server,
|
||||
// the arrays of folders to include or skip (assembled above),
|
||||
// and indicate that folders listed should be parents (we're creating folders,
|
||||
// so we want to list the folders that can contain other folders), also force long form
|
||||
echo sqimap_mailbox_option_list($imapConnection, $show_selected, $skip_folders, $boxes, true, true);
|
||||
// use 'noinferiors' as a mailbox filter to leave out folders that can not contain other folders.
|
||||
// use the long format to show subfolders in an intelligible way if parent is missing (special folder)
|
||||
echo sqimap_mailbox_option_list($imapConnection, $show_selected, $skip_folders, $boxes, 'noinferiors', true);
|
||||
|
||||
echo "</SELECT></TT>\n";
|
||||
if ($show_contain_subfolders_option) {
|
||||
|
@ -183,7 +183,11 @@ if ($count_special_folders < count($boxes)) {
|
|||
. "<TT><SELECT NAME=old>\n"
|
||||
. ' <OPTION VALUE="">[ ' . _("Select a folder") . " ]</OPTION>\n";
|
||||
|
||||
echo sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes, false, true);
|
||||
// use existing IMAP connection, we have no special values to show,
|
||||
// but we do include values to skip. Use the pre-created $boxes to save an IMAP query.
|
||||
// send NULL for the flag - ALL folders are eligible for rename!
|
||||
// use long format to make sure folder names make sense when parents may be missing.
|
||||
echo sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes, NULL, true);
|
||||
|
||||
echo "</SELECT></TT>\n".
|
||||
"<input type=SUBMIT VALUE=\"".
|
||||
|
@ -211,7 +215,9 @@ if ($count_special_folders < count($boxes)) {
|
|||
. "<TT><SELECT NAME=mailbox>\n"
|
||||
. ' <OPTION VALUE="">[ ' . _("Select a folder") . " ]</OPTION>\n";
|
||||
|
||||
echo sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes, false, true);
|
||||
// send NULL for the flag - ALL folders are eligible for delete (except what we've got in skiplist)
|
||||
// use long format to make sure folder names make sense when parents may be missing.
|
||||
echo sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes, NULL, true);
|
||||
|
||||
echo "</SELECT></TT>\n"
|
||||
. '<input type=SUBMIT VALUE="'
|
||||
|
|
Loading…
Add table
Reference in a new issue