From 63d6e6dfc35e6d82c4a64f37c408794c163becd4 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 28 Sep 2011 15:16:41 -0400
Subject: [PATCH] Bump versions to 0.6 stable

---
 program/steps/settings/folders.inc |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index cc149bc..1d5df46 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -251,6 +251,13 @@
 
     unset($seen);
 
+    // add drop-target representing 'root'
+    $table->add_row(array('id' => 'mailboxroot', 'class' => 'virtual root'));
+    $table->add('name', '&nbsp;');
+    $table->add(null, '&nbsp;');
+
+    $a_js_folders['mailboxroot'] = array('', '', true);
+
     $checkbox_subscribe = new html_checkbox(array(
         'name'    => '_subscribed[]',
         'title'   => rcube_label('changesubscription'),
@@ -260,7 +267,8 @@
     // create list of available folders
     foreach ($list_folders as $i => $folder) {
         $idx        = $i + 1;
-        $subscribed = in_array($folder['id'], $a_subscribed);
+        $sub_key    = array_search($folder['id'], $a_subscribed);
+        $subscribed = $sub_key !== false;
         $protected  = ($CONFIG['protect_default_folders'] == true && in_array($folder['id'], $CONFIG['default_imap_folders']));
         $noselect   = false;
         $classes    = array($i%2 ? 'even' : 'odd');
@@ -306,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']));

--
Gitblit v1.9.1