[Svn] r4860 - in trunk/roundcubemail: . program/steps/settings

trac at roundcube.net trac at roundcube.net
Fri Jun 17 10:03:07 CEST 2011


Author: alec
Date: 2011-06-17 03:03:07 -0500 (Fri, 17 Jun 2011)
New Revision: 4860

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/steps/settings/edit_folder.inc
   trunk/roundcubemail/program/steps/settings/folders.inc
   trunk/roundcubemail/program/steps/settings/func.inc
   trunk/roundcubemail/program/steps/settings/save_folder.inc
Log:
- Improved namespace roots handling in folder manager


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2011-06-17 06:39:39 UTC (rev 4859)
+++ trunk/roundcubemail/CHANGELOG	2011-06-17 08:03:07 UTC (rev 4860)
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Improved namespace roots handling in folder manager
 - Added searching in all addressbook sources
 - Added addressbook source selection in contacts import
 - Implement LDAPv3 Virtual List View (VLV) for paged results listing

Modified: trunk/roundcubemail/program/steps/settings/edit_folder.inc
===================================================================
--- trunk/roundcubemail/program/steps/settings/edit_folder.inc	2011-06-17 06:39:39 UTC (rev 4859)
+++ trunk/roundcubemail/program/steps/settings/edit_folder.inc	2011-06-17 08:03:07 UTC (rev 4860)
@@ -135,7 +135,7 @@
     );
 
     // Settings: threading
-    if ($threading_supported && !$options['noselect']) {
+    if ($threading_supported && !$options['noselect'] && !$options['is_root']) {
         $select = new html_select(array('name' => '_viewmode', 'id' => '_listmode'));
         $select->add(rcube_label('list'), 0);
         $select->add(rcube_label('threads'), 1);
@@ -192,7 +192,7 @@
             'content' => array()
         );
 
-        if (!$options['noselect']) {
+        if (!$options['noselect'] && !$options['is_root']) {
             $msgcount = $RCMAIL->imap->messagecount($mbox_imap, 'ALL', true, false);
 
             // Size

Modified: trunk/roundcubemail/program/steps/settings/folders.inc
===================================================================
--- trunk/roundcubemail/program/steps/settings/folders.inc	2011-06-17 06:39:39 UTC (rev 4859)
+++ trunk/roundcubemail/program/steps/settings/folders.inc	2011-06-17 08:03:07 UTC (rev 4860)
@@ -179,7 +179,7 @@
 
     list($form_start, $form_end) = get_form_tags($attrib, 'folders');
     unset($attrib['form']);
-  
+
     if (!$attrib['id'])
         $attrib['id'] = 'rcmSubscriptionlist';
 
@@ -197,6 +197,7 @@
     $a_unsubscribed = $IMAP->list_unsubscribed();
     $a_subscribed   = $IMAP->list_mailboxes();
     $delimiter      = $IMAP->get_hierarchy_delimiter();
+    $namespace      = $IMAP->get_namespace();
     $a_js_folders   = array();
     $seen           = array();
     $list_folders   = array();
@@ -253,6 +254,7 @@
         $idx        = $i + 1;
         $subscribed = in_array($folder['id'], $a_subscribed);
         $protected  = ($CONFIG['protect_default_folders'] == true && in_array($folder['id'], $CONFIG['default_imap_folders']));
+        $noselect   = false;
         $classes    = array($i%2 ? 'even' : 'odd');
 
         $folder_js      = Q($folder['id']);
@@ -271,6 +273,19 @@
 
         $disabled = (($protected && $subscribed) || $noselect);
 
+        // check if the folder is a namespace prefix, then disable subscription option on it
+        if (!$disabled && $folder['virtual'] && $folder['level'] == 0 && !empty($namespace)) {
+            $fname = $folder['id'] . $delimiter;
+            foreach ($namespace as $ns) {
+                foreach ($ns as $item) {
+                    if ($item[0] === $fname) {
+                        $disabled = true;
+                        break;
+                    }
+                }
+            }
+        }
+
         $table->add_row(array('id' => 'rcmrow'.$idx, 'class' => join(' ', $classes),
             'foldername' => $folder['id']));
 

Modified: trunk/roundcubemail/program/steps/settings/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/settings/func.inc	2011-06-17 06:39:39 UTC (rev 4859)
+++ trunk/roundcubemail/program/steps/settings/func.inc	2011-06-17 08:03:07 UTC (rev 4860)
@@ -790,14 +790,29 @@
 
     $acl             = $RCMAIL->imap->get_capability('ACL');
     $default_folders = (array) $RCMAIL->config->get('default_imap_folders');
+    $delimiter       = $RCMAIL->imap->get_hierarchy_delimiter();
+    $namespace       = $RCMAIL->imap->get_namespace();
     $options         = array();
 
+    // check if the folder is a namespace prefix
+    if (!empty($namespace)) {
+        $mbox = $mailbox . $delimiter;
+        foreach ($namespace as $ns) {
+            foreach ($ns as $item) {
+                if ($item[0] === $mbox) {
+                    $options['is_root'] = true;
+                    break;
+                }
+            }
+        }
+    }
+
     $options['name']      = $mailbox;
     $options['options']   = $RCMAIL->imap->mailbox_options($mailbox, true);
     $options['namespace'] = $RCMAIL->imap->mailbox_namespace($mailbox);
-    $options['rights']    = $acl ? (array)$RCMAIL->imap->my_rights($mailbox) : array();
+    $options['rights']    = $acl && !$options['is_root'] ? (array)$RCMAIL->imap->my_rights($mailbox) : array();
     $options['special']   = in_array($mailbox, $default_folders);
-    $options['protected'] = $options['special'] && $RCMAIL->config->get('protect_default_folders');
+    $options['protected'] = $options['is_root'] || ($options['special'] && $RCMAIL->config->get('protect_default_folders'));
 
     if (is_array($options['options'])) {
         foreach ($options['options'] as $opt) {

Modified: trunk/roundcubemail/program/steps/settings/save_folder.inc
===================================================================
--- trunk/roundcubemail/program/steps/settings/save_folder.inc	2011-06-17 06:39:39 UTC (rev 4859)
+++ trunk/roundcubemail/program/steps/settings/save_folder.inc	2011-06-17 08:03:07 UTC (rev 4860)
@@ -72,6 +72,7 @@
     $folder['name']     = $name_imap;
     $folder['oldname']  = $old_imap;
     $folder['class']    = '';
+    $folder['options']  = $options;
     $folder['settings'] = array(
         // List view mode: 0-list, 1-threads
         'view_mode'   => (int) get_input_value('_viewmode', RCUBE_INPUT_POST),

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list