| | |
| | | // get address book name (for display) |
| | | if ($abook && $_SESSION['addressbooks_count'] > 1) { |
| | | $name = $abook->get_name(); |
| | | if (!$name && $source == 0) { |
| | | if (!$name) { |
| | | $name = rcube_label('personaladrbook'); |
| | | } |
| | | $OUTPUT->set_env('sourcename', html_entity_decode($name, ENT_COMPAT, 'UTF-8')); |
| | |
| | | $attrib['id'] = 'rcmdirectorylist'; |
| | | |
| | | $out = ''; |
| | | $local_id = '0'; |
| | | $jsdata = array(); |
| | | |
| | | $line_templ = html::tag('li', array( |
| | |
| | | |
| | | $groups_html = ''; |
| | | $groups = $RCMAIL->get_address_book($args['source'])->list_groups(); |
| | | $js_id = $RCMAIL->JQ($args['source']); |
| | | |
| | | if (!empty($groups)) { |
| | | $line_templ = html::tag('li', array( |
| | |
| | | $is_collapsed = strpos($RCMAIL->config->get('collapsed_abooks',''), '&'.rawurlencode($args['source']).'&') !== false; |
| | | $args['out'] .= html::div('treetoggle ' . ($is_collapsed ? 'collapsed' : 'expanded'), ' '); |
| | | |
| | | $jsdata = array(); |
| | | foreach ($groups as $group) { |
| | | $groups_html .= sprintf($line_templ, |
| | | rcube_utils::html_identifier('G' . $args['source'] . $group['ID'], true), |
| | |
| | | } |
| | | |
| | | $args['out'] .= html::tag('ul', |
| | | array('class' => 'groups', 'style' => ($is_collapsed ? "display:none;" : null)), |
| | | array('class' => 'groups', 'style' => ($is_collapsed || empty($groups) ? "display:none;" : null)), |
| | | $groups_html); |
| | | |
| | | return $args; |
| | |
| | | // iterate over possible subtypes and collect values with their subtype |
| | | if (is_array($colprop['subtypes'])) { |
| | | $values = $subtypes = array(); |
| | | foreach ($colprop['subtypes'] as $i => $st) { |
| | | $newval = false; |
| | | if ($record[$field.':'.$st]) { |
| | | $subtypes[count($values)] = $st; |
| | | $newval = $record[$field.':'.$st]; |
| | | foreach (rcube_addressbook::get_col_values($field, $record) as $st => $vals) { |
| | | foreach((array)$vals as $value) { |
| | | $i = count($values); |
| | | $subtypes[$i] = $st; |
| | | $values[$i] = $value; |
| | | } |
| | | else if ($i == 0 && $record[$field]) { |
| | | $subtypes[count($values)] = $st; |
| | | $newval = $record[$field]; |
| | | } |
| | | if ($newval !== false) { |
| | | if (is_array($newval) && isset($newval[0])) |
| | | $values = array_merge($values, $newval); |
| | | else |
| | | $values[] = $newval; |
| | | } |
| | | // TODO: add $st to $select_subtype if missing ? |
| | | } |
| | | } |
| | | else { |
| | |
| | | } |
| | | } |
| | | else { |
| | | if (substr($id, -($got_source+1)) == "-$source") { |
| | | if (substr($id, -($got_source+1)) === "-$source") { |
| | | $id = substr($id, 0, -($got_source+1)); |
| | | } |
| | | $result[$source][] = $id; |