* 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
*/
-function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_skip = 0, $boxes = 0, $parent = false) {
+function sqimap_mailbox_option_list($imap_stream, $show_selected = 0, $folder_skip = 0, $boxes = 0, $parent = false, $use_long_format = false ) {
global $username, $data_dir;
$mbox_options = '';
- $shorten_box_names = getPref($data_dir, $username, 'mailbox_select_style', SMPREF_OFF);
+ if ( $use_long_format ) {
+ $shorten_box_names = 0;
+ } else {
+ $shorten_box_names = getPref($data_dir, $username, 'mailbox_select_style', SMPREF_OFF);
+ }
if ($boxes == 0) {
$boxes = sqimap_mailbox_list($imap_stream);
'<BR>'.
"<TT><SELECT NAME=subfolder>\n";
-$show_selected=0;
-$skip_folders=0;
+$show_selected = array();
+$skip_folders = array();
$server_type = strtolower($imap_server_type);
if ( $server_type == 'courier' ) {
- $show_selected = array('inbox');
- $skip_folders = array('inbox.trash');
+ array_push($skip_folders, 'inbox.trash');
if ( $default_folder_prefix == 'INBOX.' ) {
array_push($skip_folders, 'inbox');
}
// 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)
-echo sqimap_mailbox_option_list($imapConnection, $show_selected, $skip_folders, $boxes, true);
+// 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);
echo "</SELECT></TT>\n";
if ($show_contain_subfolders_option) {
$count_special_folders = 0;
$num_max = 1;
if (strtolower($imap_server_type) == "courier" || $move_to_trash) {
- $num_max++;
+ $num_max++;
}
if ($move_to_sent) {
- $num_max++;
+ $num_max++;
}
if ($save_as_draft) {
- $num_max++;
+ $num_max++;
}
for ($p = 0, $cnt = count($boxes); $p < $cnt && $count_special_folders < $num_max; $p++) {
if (strtolower($boxes[$p]['unformatted']) == 'inbox')
$count_special_folders++;
else if (strtolower($imap_server_type) == 'courier' &&
- strtolower($boxes[$p]['unformatted']) == 'inbox.trash')
+ strtolower($boxes[$p]['unformatted']) == 'inbox.trash') {
$count_special_folders++;
- else if ($boxes[$p]['unformatted'] == $trash_folder && $trash_folder)
+ }
+ else if ($boxes[$p]['unformatted'] == $trash_folder && $trash_folder) {
$count_special_folders++;
- else if ($boxes[$p]['unformatted'] == $sent_folder && $sent_folder)
+ array_push($skip_folders, strtolower($trash_folder));
+ }
+ else if ($boxes[$p]['unformatted'] == $sent_folder && $sent_folder) {
$count_special_folders++;
- else if ($boxes[$p]['unformatted'] == $draft_folder && $draft_folder)
+ array_push($skip_folders, strtolower($sent_folder));
+ }
+ else if ($boxes[$p]['unformatted'] == $draft_folder && $draft_folder) {
$count_special_folders++;
+ array_push($skip_folders, strtolower($draft_folder));
+ }
}
. "<TT><SELECT NAME=old>\n"
. ' <OPTION VALUE="">[ ' . _("Select a folder") . " ]</OPTION>\n";
- echo sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes);
+ echo sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes, false, true);
echo "</SELECT></TT>\n".
"<input type=SUBMIT VALUE=\"".
. "<TT><SELECT NAME=mailbox>\n"
. ' <OPTION VALUE="">[ ' . _("Select a folder") . " ]</OPTION>\n";
- echo sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes);
+ echo sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes, false, true);
echo "</SELECT></TT>\n"
. '<input type=SUBMIT VALUE="'