summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-03-12 18:12:51 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-03-12 18:12:51 (GMT)
commit69d702c6b226b905c3f4d375e885b6a3272bc8a4 (patch)
treedc19de3f89ec7cbf9702f628c6cf04101527f150
parenteb69c1a2395a7175003155152f6b56c000678df5 (diff)
downloadroundcubemail-plugins-kolab-69d702c6b226b905c3f4d375e885b6a3272bc8a4.tar.gz
Fix the hierarchical address book list and correctly apply the stored collapse/expand state
-rw-r--r--plugins/kolab_addressbook/kolab_addressbook.php11
1 files changed, 7 insertions, 4 deletions
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);
}
}