| | |
| | | $OUTPUT->set_pagetitle(rcube_label('addressbook')); |
| | | } |
| | | |
| | | |
| | | function rcmail_directory_list($attrib) |
| | | { |
| | | global $RCMAIL, $OUTPUT; |
| | |
| | | $local_id = '0'; |
| | | $jsdata = array(); |
| | | $current = get_input_value('_source', RCUBE_INPUT_GPC); |
| | | $line_templ = html::tag('li', array('id' => 'rcmli%s', 'class' => 'addressbook %s'), |
| | | html::a(array('href' => '%s', 'onclick' => "return ".JS_OBJECT_NAME.".command('list','%s',this)"), '%s')); |
| | | $line_templ = html::tag('li', array( |
| | | 'id' => 'rcmli%s', 'class' => 'addressbook %s'), |
| | | html::a(array('href' => '%s', |
| | | 'onclick' => "return ".JS_OBJECT_NAME.".command('list','%s',this)"), '%s')); |
| | | |
| | | if (!$current && strtolower($RCMAIL->config->get('address_book_type', 'sql')) != 'ldap') { |
| | | $current = '0'; |
| | |
| | | $js_id = JQ($id); |
| | | $dom_id = preg_replace('/[^a-z0-9\-_]/i', '', $id); |
| | | $out .= sprintf($line_templ, $dom_id, ($current == $id ? 'selected' : ''), |
| | | Q(rcmail_url(null, array('_source' => $id))), $js_id, (!empty($source['name']) ? Q($source['name']) : Q($id))); |
| | | Q(rcmail_url(null, array('_source' => $id))), |
| | | $js_id, (!empty($source['name']) ? Q($source['name']) : Q($id))); |
| | | $groupdata = rcmail_contact_groups(array('out' => $out, 'jsdata' => $jsdata, 'source' => $id)); |
| | | $jsdata = $groupdata['jsdata']; |
| | | $out = $groupdata['out']; |
| | |
| | | $groups = $RCMAIL->get_address_book($args['source'])->list_groups(); |
| | | |
| | | if (!empty($groups)) { |
| | | $line_templ = html::tag('li', array('id' => 'rcmliG%s%s', 'class' => 'contactgroup'), |
| | | html::a(array('href' => '#', 'onclick' => "return ".JS_OBJECT_NAME.".command('listgroup',{'source':'%s','id':'%s'},this)"), '%s')); |
| | | $line_templ = html::tag('li', array( |
| | | 'id' => 'rcmliG%s%s', 'class' => 'contactgroup'), |
| | | html::a(array('href' => '#', |
| | | 'onclick' => "return ".JS_OBJECT_NAME.".command('listgroup',{'source':'%s','id':'%s'},this)"), '%s')); |
| | | |
| | | $jsdata = array(); |
| | | foreach ($groups as $group) { |
| | | $args['out'] .= sprintf($line_templ, $args['source'], $group['ID'], $args['source'], $group['ID'], Q($group['name'])); |
| | | $args['jsdata']['G'.$args['source'].$group['ID']] = array( |
| | | 'source' => $args['source'], 'id' => $group['ID'], 'name' => $group['name'], 'type' => 'group'); |
| | | 'source' => $args['source'], 'id' => $group['ID'], |
| | | 'name' => $group['name'], 'type' => 'group'); |
| | | } |
| | | } |
| | | |
| | |
| | | // define list of cols to be displayed |
| | | $a_show_cols = array('name'); |
| | | |
| | | while ($row = $result->next()) |
| | | { |
| | | while ($row = $result->next()) { |
| | | $a_row_cols = array(); |
| | | |
| | | // format each col |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | function rcmail_get_rowcount_text() |
| | | { |
| | | global $CONTACTS; |
| | | |
| | | // read nr of contacts |
| | | $result = $CONTACTS->get_result(); |
| | | if (!$result) |
| | | if (!$result) { |
| | | $result = $CONTACTS->count(); |
| | | } |
| | | |
| | | if ($result->count == 0) |
| | | $out = rcube_label('nocontactsfound'); |
| | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | function rcmail_contact_form($form, $record) |
| | | { |
| | | global $RCMAIL; |
| | | |
| | | // Allow plugins to modify contact form content |
| | | $plugin = $RCMAIL->plugins->exec_hook('contact_form', array( |
| | | 'form' => $form, 'record' => $record)); |
| | | |
| | | $form = $plugin['form']; |
| | | $record = $plugin['record']; |
| | | $out = ''; |
| | | |
| | | foreach ($form as $fieldset) { |
| | | if (empty($fieldset['content'])) |
| | | continue; |
| | | |
| | | $content = ''; |
| | | if (is_array($fieldset['content'])) { |
| | | $table = new html_table(array('cols' => 2)); |
| | | |
| | | foreach ($fieldset['content'] as $col => $colprop) { |
| | | $colprop['id'] = 'rcmfd_'.$col; |
| | | |
| | | $label = !empty($colprop['label']) ? $colprop['label'] : rcube_label($col); |
| | | |
| | | if (!empty($colprop['value'])) { |
| | | $value = $colprop['value']; |
| | | } |
| | | else if ($RCMAIL->action == 'show') { |
| | | $value = $record[$col]; |
| | | } |
| | | else { |
| | | $value = rcmail_get_edit_field($col, $record[$col], $colprop, $colprop['type']); |
| | | } |
| | | |
| | | $table->add('title', sprintf('<label for="%s">%s</label>', $colprop['id'], Q($label))); |
| | | $table->add(null, $value); |
| | | } |
| | | $content = $table->show(); |
| | | } |
| | | else { |
| | | $content = $fieldset['content']; |
| | | } |
| | | |
| | | $out .= html::tag('fieldset', null, html::tag('legend', null, Q($fieldset['name'])) . $content) ."\n"; |
| | | } |
| | | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | // register UI objects |
| | | $OUTPUT->add_handlers(array( |
| | | 'directorylist' => 'rcmail_directory_list', |
| | |
| | | 'recordscountdisplay' => 'rcmail_rowcount_display', |
| | | 'searchform' => array($OUTPUT, 'search_form') |
| | | )); |
| | | |