From fbe54043cf598b19a753dc2b21a7ed558d23fd15 Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Thu, 18 Aug 2011 13:40:07 -0400 Subject: [PATCH] Fix folders drop-down list: descend into root folder (e.g. INBOX) even if part of the exception list --- program/steps/settings/folders.inc | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index 6a773df..1d5df46 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -256,7 +256,7 @@ $table->add('name', ' '); $table->add(null, ' '); - $a_js_folders['mailboxroot'] = array('.', '', true); + $a_js_folders['mailboxroot'] = array('', '', true); $checkbox_subscribe = new html_checkbox(array( 'name' => '_subscribed[]', @@ -277,9 +277,6 @@ $folder_utf8 = rcube_charset_convert($folder['id'], 'UTF7-IMAP'); $display_folder = str_repeat(' ', $folder['level']) . Q($protected ? rcmail_localize_foldername($folder['id']) : $folder['name']); - - if ($sub_key !== false) - unset($a_subscribed[$sub_key]); if ($folder['virtual']) { $classes[] = 'virtual'; @@ -317,6 +314,16 @@ } } } + // check if the folder is shared, then disable subscription option on it + if (!$disabled && $folder['virtual'] && !empty($namespace)) { + $tmp_ns = array_merge((array)$namespace['other'], (array)$namespace['shared']); + foreach ($tmp_ns as $item) { + if (strpos($folder['id'], $item[0]) === 0) { + $disabled = true; + break; + } + } + } $table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes), 'foldername' => $folder['id'])); @@ -327,11 +334,6 @@ $a_js_folders['rcmrow'.$idx] = array($folder_utf8, Q($display_folder), $protected || $folder['virtual']); - } - - // Unsubscribe from non-existing folders - foreach ($a_subscribed as $folder) { - $IMAP->unsubscribe($folder); } $RCMAIL->plugins->exec_hook('folders_list', array('table' => $table)); -- Gitblit v1.9.1