Changeset View
Changeset View
Standalone View
Standalone View
plugins/kolab_addressbook/kolab_addressbook.php
Context not available. | |||||
public function folder_tree_html($node, $data, &$jsdata) | public function folder_tree_html($node, $data, &$jsdata) | ||||
{ | { | ||||
$out = ''; | $out = ''; | ||||
foreach ($node->children as $folder) { | if (!empty($node->children)) { | ||||
$id = $folder->id; | foreach ($node->children as $folder) { | ||||
$source = $data[$id]; | $id = $folder->id; | ||||
$is_collapsed = strpos($this->rc->config->get('collapsed_abooks',''), '&'.rawurlencode($id).'&') !== false; | $source = $data[$id]; | ||||
$is_collapsed = strpos($this->rc->config->get('collapsed_abooks',''), '&'.rawurlencode($id).'&') !== false; | |||||
if ($folder->virtual) { | |||||
$source = $this->abook_prop($folder->id, $folder); | if ($folder->virtual) { | ||||
} | $source = $this->abook_prop($folder->id, $folder); | ||||
else if (empty($source)) { | } | ||||
$this->sources[$id] = new rcube_kolab_contacts($folder->name); | else if (empty($source)) { | ||||
$source = $this->abook_prop($id, $this->sources[$id]); | $this->sources[$id] = new rcube_kolab_contacts($folder->name); | ||||
} | $source = $this->abook_prop($id, $this->sources[$id]); | ||||
} | |||||
$content = $this->addressbook_list_item($id, $source, $jsdata); | $content = $this->addressbook_list_item($id, $source, $jsdata); | ||||
if (!empty($folder->children)) { | if (!empty($folder->children)) { | ||||
$child_html = $this->folder_tree_html($folder, $data, $jsdata); | $child_html = $this->folder_tree_html($folder, $data, $jsdata); | ||||
// copy group items... | // copy group items... | ||||
if (preg_match('!<ul[^>]*>(.*)</ul>\n*$!Ums', $content, $m)) { | if (preg_match('!<ul[^>]*>(.*)</ul>\n*$!Ums', $content, $m)) { | ||||
$child_html = $m[1] . $child_html; | $child_html = $m[1] . $child_html; | ||||
$content = substr($content, 0, -strlen($m[0]) - 1); | $content = substr($content, 0, -strlen($m[0]) - 1); | ||||
} | } | ||||
// ... and re-create the subtree | // ... and re-create the subtree | ||||
if (!empty($child_html)) { | if (!empty($child_html)) { | ||||
$content .= html::tag('ul', array('class' => 'groups', 'style' => ($is_collapsed ? "display:none;" : null)), $child_html); | $content .= html::tag('ul', array('class' => 'groups', 'style' => ($is_collapsed ? "display:none;" : null)), $child_html); | ||||
} | |||||
} | } | ||||
} | |||||
$out .= $content . '</li>'; | $out .= $content . '</li>'; | ||||
} | |||||
} | } | ||||
return $out; | return $out; | ||||
Context not available. |