From 4d784be2b9dbd1b0be8c35f17bae43eeee035062 Mon Sep 17 00:00:00 2001 From: alecpl Date: Fri, 29 Jul 2011 11:53:35 +0000 Subject: - Fix 'exceptions' parameter of rcmail_mailbox_select() to handle directories on any level of the structure --- program/include/main.inc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'program/include') diff --git a/program/include/main.inc b/program/include/main.inc index 6d0cb7242..26bc8cd0d 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -1229,7 +1229,7 @@ function rcmail_mailbox_select($p = array()) if ($p['noselection']) $select->add($p['noselection'], ''); - rcmail_render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames']); + rcmail_render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames'], 0, $p['exceptions']); return $select; } @@ -1402,11 +1402,15 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, &$jslist, $at * @access private * @return string */ -function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, &$select, $realnames=false, $nestLevel=0) +function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, &$select, $realnames=false, $nestLevel=0, $exceptions=array()) { $out = ''; - foreach ($arrFolders as $key=>$folder) { + foreach ($arrFolders as $key => $folder) { + if (!empty($exceptions) && in_array($folder['id'], $exceptions)) { + continue; + } + if (!$realnames && ($folder_class = rcmail_folder_classname($folder['id']))) $foldername = rcube_label($folder_class); else { @@ -1420,7 +1424,8 @@ function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, $select->add(str_repeat(' ', $nestLevel*4) . $foldername, $folder['id']); if (!empty($folder['folders'])) - $out .= rcmail_render_folder_tree_select($folder['folders'], $mbox_name, $maxlength, $select, $realnames, $nestLevel+1); + $out .= rcmail_render_folder_tree_select($folder['folders'], $mbox_name, $maxlength, + $select, $realnames, $nestLevel+1, $exceptions); } return $out; -- cgit v1.2.3