plugins/kolab_folders

Thomas Brüderli bruederli at kolabsys.com
Thu Jul 3 11:21:08 CEST 2014


 plugins/kolab_folders/kolab_folders.php |   36 ++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 11 deletions(-)

New commits:
commit e16712804356c4ee655369f7e625b236d7e705c4
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Thu Jul 3 11:21:01 2014 +0200

    Adapt 'folders_list' hook to new arguments after update in Roundcube core

diff --git a/plugins/kolab_folders/kolab_folders.php b/plugins/kolab_folders/kolab_folders.php
index 836b3e0..0cea259 100644
--- a/plugins/kolab_folders/kolab_folders.php
+++ b/plugins/kolab_folders/kolab_folders.php
@@ -111,23 +111,37 @@ class kolab_folders extends rcube_plugin
             return $args;
         }
 
-        $table = $args['table'];
-
         // Add type-based style for table rows
         // See kolab_folders::folder_class_name()
-        for ($i=1, $cnt=$table->size(); $i<=$cnt; $i++) {
-            $attrib = $table->get_row_attribs($i);
-            $folder = $attrib['foldername']; // UTF7-IMAP
-            $type   = $folderdata[$folder];
+        if ($table = $args['table']) {
+            for ($i=1, $cnt=$table->size(); $i<=$cnt; $i++) {
+                $attrib = $table->get_row_attribs($i);
+                $folder = $attrib['foldername']; // UTF7-IMAP
+                $type   = $folderdata[$folder];
+
+                if (!$type) {
+                    $type = 'mail';
+                }
 
-            if (!$type) {
-                $type = 'mail';
+                $class_name = self::folder_class_name($type);
+                $attrib['class'] = trim($attrib['class'] . ' ' . $class_name);
+                $table->set_row_attribs($attrib, $i);
             }
+        }
 
-            $class_name = self::folder_class_name($type);
+        // Add type-based class for list items
+        if (is_array($args['list'])) {
+            foreach ((array)$args['list'] as $k => $item) {
+                $folder = $item['folder_imap']; // UTF7-IMAP
+                $type   = $folderdata[$folder];
 
-            $attrib['class'] = trim($attrib['class'] . ' ' . $class_name);
-            $table->set_row_attribs($attrib, $i);
+                if (!$type) {
+                    $type = 'mail';
+                }
+
+                $class_name = self::folder_class_name($type);
+                $args['list'][$k]['class'] = trim($item['class'] . ' ' . $class_name);
+            }
         }
 
         return $args;




More information about the commits mailing list