plugins/kolab_addressbook

Thomas Brüderli bruederli at kolabsys.com
Thu Mar 12 19:12:56 CET 2015


 plugins/kolab_addressbook/kolab_addressbook.php |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 69d702c6b226b905c3f4d375e885b6a3272bc8a4
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Thu Mar 12 19:12:51 2015 +0100

    Fix the hierarchical address book list and correctly apply the stored collapse/expand state

diff --git a/plugins/kolab_addressbook/kolab_addressbook.php b/plugins/kolab_addressbook/kolab_addressbook.php
index a8046b3..6a2aaa6 100644
--- a/plugins/kolab_addressbook/kolab_addressbook.php
+++ b/plugins/kolab_addressbook/kolab_addressbook.php
@@ -224,11 +224,14 @@ class kolab_addressbook extends rcube_plugin
             if (!empty($folder->children)) {
                 $child_html = $this->folder_tree_html($folder, $data, $jsdata);
 
-                if (!empty($child_html) && preg_match('!</ul>\n*$!', $content)) {
-                    $content = preg_replace('!</ul>\n*$!', $child_html . '</ul>', $content);
+                // copy group items...
+                if (preg_match('!<ul[^>]*>(.*)</ul>\n*$!Ums', $content, $m)) {
+                    $child_html = $m[1] . $child_html;
+                    $content = substr($content, 0, -strlen($m[0]) - 1);
                 }
-                else if (!empty($child_html)) {
-                    $content .= html::tag('ul', array('style' => ($is_collapsed ? "display:none;" : null)), $child_html);
+                // ... and re-create the subtree
+                if (!empty($child_html)) {
+                    $content .= html::tag('ul', array('class' => 'groups', 'style' => ($is_collapsed ? "display:none;" : null)), $child_html);
                 }
             }
 




More information about the commits mailing list