diff options
author | svncommit <devs@roundcube.net> | 2008-08-28 08:15:31 +0000 |
---|---|---|
committer | svncommit <devs@roundcube.net> | 2008-08-28 08:15:31 +0000 |
commit | f5aa16541e6901d2fc543f9044be1c898365b61e (patch) | |
tree | 3b469ffaa730a06cfb651d4ca9bb7677f720fcf3 /program/include/main.inc | |
parent | 79aeb308cb195dcc48004851795e811cee6f8ca1 (diff) |
Add folder hierarchy collapsing.
Diffstat (limited to 'program/include/main.inc')
-rw-r--r-- | program/include/main.inc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index 2b4797873..869921edb 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -1000,7 +1000,7 @@ function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='') */ function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, $maxlength, $realnames=false, $nestLevel=0) { - global $COMM_PATH, $IMAP, $CONFIG, $OUTPUT; + global $COMM_PATH, $IMAP, $CONFIG, $OUTPUT, $RCMAIL; $idx = 0; $out = ''; @@ -1046,11 +1046,17 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, $maxlength, $ if ($folder['id'] == $mbox_name) $classes[] = 'selected'; + $collapsed = preg_match('/&'.rawurlencode($folder['id']).'&/', $RCMAIL->config->get('collapsed_folders')); + $js_name = JQ($folder['id']); $out .= html::tag('li', array( 'id' => "rcmli".$folder_id, 'class' => join(' ', $classes), 'noclose' => true), + html::div(array( + 'class' => empty($folder['folders']) ? 'nocollapse' : ($collapsed ? 'collapsed' : 'expanded'), + 'onclick' => sprintf("%s.command('collapse-folder', '%s')", JS_OBJECT_NAME, $js_name) + ), ' ') . html::a(array( 'href' => rcmail_url('', array('_mbox' => $folder['id'])), 'onclick' => sprintf("return %s.command('list','%s',this)", JS_OBJECT_NAME, $js_name), @@ -1061,12 +1067,14 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, $maxlength, $ ), Q($foldername))); if (!empty($folder['folders'])) - $out .= "\n<ul>\n" . rcmail_render_folder_tree_html($folder['folders'], $mbox_name, $maxlength, $realnames, $nestLevel+1) . "</ul>\n"; + $out .= "\n<ul" . ($collapsed ? " style=\"display: none;\"" : "") . ">\n" . rcmail_render_folder_tree_html($folder['folders'], $mbox_name, $maxlength, $realnames, $nestLevel+1) . "</ul>\n"; $out .= "</li>\n"; $idx++; } + $OUTPUT->set_env('collapsed_folders', $RCMAIL->config->get('collapsed_folders')); + return $out; } |