| | |
| | | // 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')); |
| | |
| | | $jsdata = array(); |
| | | |
| | | $line_templ = html::tag('li', array( |
| | | 'id' => 'rcmli%s', 'class' => '%s'), |
| | | 'id' => 'rcmli%s', 'class' => '%s', 'noclose' => true), |
| | | html::a(array('href' => '%s', |
| | | 'rel' => '%s', |
| | | 'onclick' => "return ".JS_OBJECT_NAME.".command('list','%s',this)"), '%s')); |
| | |
| | | |
| | | $name = !empty($source['name']) ? $source['name'] : $id; |
| | | $out .= sprintf($line_templ, |
| | | html_identifier($id), |
| | | rcube_utils::html_identifier($id, true), |
| | | $class_name, |
| | | Q(rcmail_url(null, array('_source' => $id))), |
| | | $source['id'], |
| | |
| | | $groupdata = rcmail_contact_groups($groupdata); |
| | | $jsdata = $groupdata['jsdata']; |
| | | $out = $groupdata['out']; |
| | | $out .= '</li>'; |
| | | } |
| | | |
| | | $line_templ = html::tag('li', array( |
| | | 'id' => 'rcmliS%s', 'class' => '%s'), |
| | | 'id' => 'rcmli%s', 'class' => '%s'), |
| | | html::a(array('href' => '#', 'rel' => 'S%s', |
| | | 'onclick' => "return ".JS_OBJECT_NAME.".command('listsearch', '%s', this)"), '%s')); |
| | | |
| | |
| | | $class_name .= ' ' . $source['class_name']; |
| | | |
| | | $out .= sprintf($line_templ, |
| | | html_identifier($id), |
| | | rcube_utils::html_identifier('S'.$id, true), |
| | | $class_name, |
| | | $id, |
| | | $js_id, (!empty($source['name']) ? Q($source['name']) : Q($id))); |
| | | } |
| | | |
| | | $OUTPUT->set_env('contactgroups', $jsdata); |
| | | $OUTPUT->set_env('collapsed_abooks', (string)$RCMAIL->config->get('collapsed_abooks','')); |
| | | $OUTPUT->add_gui_object('folderlist', $attrib['id']); |
| | | $OUTPUT->include_script('treelist.js'); |
| | | |
| | | // add some labels to client |
| | | $OUTPUT->add_label('deletegroupconfirm', 'groupdeleting', 'addingmember', 'removingmember'); |
| | | |
| | |
| | | global $RCMAIL; |
| | | |
| | | $groups = $RCMAIL->get_address_book($args['source'])->list_groups(); |
| | | $js_id = $RCMAIL->JQ($args['source']); |
| | | $groups_html = ''; |
| | | |
| | | if (!empty($groups)) { |
| | | $line_templ = html::tag('li', array( |
| | | 'id' => 'rcmliG%s', 'class' => 'contactgroup'), |
| | | 'id' => 'rcmli%s', 'class' => 'contactgroup'), |
| | | html::a(array('href' => '#', |
| | | 'rel' => '%s:%s', |
| | | 'onclick' => "return ".JS_OBJECT_NAME.".command('listgroup',{'source':'%s','id':'%s'},this)"), '%s')); |
| | | |
| | | // append collapse/expand toggle and open a new <ul> |
| | | $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) { |
| | | $args['out'] .= sprintf($line_templ, |
| | | html_identifier($args['source'] . $group['ID']), |
| | | $groups_html .= sprintf($line_templ, |
| | | rcube_utils::html_identifier('G' . $args['source'] . $group['ID'], true), |
| | | $args['source'], $group['ID'], |
| | | $args['source'], $group['ID'], Q($group['name']) |
| | | ); |
| | |
| | | 'name' => $group['name'], 'type' => 'group'); |
| | | } |
| | | } |
| | | |
| | | $args['out'] .= html::tag('ul', |
| | | array('class' => 'groups', 'style' => ($is_collapsed || empty($groups) ? "display:none;" : null)), |
| | | $groups_html); |
| | | |
| | | return $args; |
| | | } |
| | |
| | | global $CONTACTS, $OUTPUT; |
| | | |
| | | // define list of cols to be displayed |
| | | $a_show_cols = array('name'); |
| | | $a_show_cols = array('name','action'); |
| | | |
| | | // add id to message list table if not specified |
| | | if (!strlen($attrib['id'])) |
| | |
| | | return; |
| | | |
| | | // define list of cols to be displayed |
| | | $a_show_cols = array('name'); |
| | | $a_show_cols = array('name','action'); |
| | | |
| | | while ($row = $result->next()) { |
| | | $row['CID'] = $row['ID']; |
| | | $row['email'] = reset(rcube_addressbook::get_col_values('email', $row, true)); |
| | | |
| | | $source_id = $OUTPUT->get_env('source'); |
| | | $a_row_cols = array(); |
| | | $classes = array('person'); // org records will follow some day |
| | | $classes = array($row['_type'] ? $row['_type'] : 'person'); |
| | | |
| | | // build contact ID with source ID |
| | | if (isset($row['sourceid'])) { |
| | | $row['ID'] = $row['ID'].'-'.$row['sourceid']; |
| | | $source_id = $row['sourceid']; |
| | | } |
| | | |
| | | // format each col |
| | | foreach ($a_show_cols as $col) { |
| | | $val = $col == 'name' ? rcube_addressbook::compose_list_name($row) : $row[$col]; |
| | | $a_row_cols[$col] = Q($val); |
| | | $val = ''; |
| | | switch ($col) { |
| | | case 'name': |
| | | $val = Q(rcube_addressbook::compose_list_name($row)); |
| | | break; |
| | | |
| | | case 'action': |
| | | if ($row['_type'] == 'group') { |
| | | $val = html::a(array( |
| | | 'href' => '#list', |
| | | 'rel' => $row['ID'], |
| | | 'title' => rcube_label('listgroup'), |
| | | 'onclick' => sprintf("return %s.command('pushgroup',{'source':'%s','id':'%s'},this,event)", JS_OBJECT_NAME, $source_id, $row['CID']), |
| | | ), '»'); |
| | | } |
| | | else |
| | | $val = ' '; |
| | | break; |
| | | |
| | | default: |
| | | $val = Q($row[$col]); |
| | | break; |
| | | } |
| | | |
| | | $a_row_cols[$col] = $val; |
| | | } |
| | | |
| | | if ($row['readonly']) |
| | | $classes[] = 'readonly'; |
| | | |
| | | $OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols, join(' ', $classes)); |
| | | $OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols, join(' ', $classes), array_intersect_key($row, array('ID'=>1,'readonly'=>1,'_type'=>1,'email'=>1,'name'=>1))); |
| | | } |
| | | } |
| | | |
| | | |
| | | function rcmail_contacts_list_title($attrib) |
| | | { |
| | | global $OUTPUT; |
| | | |
| | | $attrib += array('label' => 'contacts', 'id' => 'rcmabooklisttitle', 'tag' => 'span'); |
| | | unset($attrib['name']); |
| | | |
| | | $OUTPUT->add_gui_object('addresslist_title', $attrib['id']); |
| | | $OUTPUT->add_label('contacts'); |
| | | |
| | | return html::tag($attrib['tag'], $attrib, rcube_label($attrib['label']), html::$common_attrib); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | function rcmail_contact_form($form, $record, $attrib = null) |
| | | { |
| | | global $RCMAIL, $CONFIG; |
| | | global $RCMAIL; |
| | | |
| | | // Allow plugins to modify contact form content |
| | | $plugin = $RCMAIL->plugins->exec_hook('contact_form', array( |
| | |
| | | $form = $plugin['form']; |
| | | $record = $plugin['record']; |
| | | $edit_mode = $RCMAIL->action != 'show'; |
| | | $del_button = $attrib['deleteicon'] ? html::img(array('src' => $CONFIG['skin_path'] . $attrib['deleteicon'], 'alt' => rcube_label('delete'))) : rcube_label('delete'); |
| | | $del_button = $attrib['deleteicon'] ? html::img(array('src' => $RCMAIL->output->get_skin_file($attrib['deleteicon']), 'alt' => rcube_label('delete'))) : rcube_label('delete'); |
| | | unset($attrib['deleteicon']); |
| | | $out = ''; |
| | | |
| | |
| | | |
| | | function rcmail_contact_photo($attrib) |
| | | { |
| | | global $SOURCE_ID, $CONTACTS, $CONTACT_COLTYPES, $RCMAIL, $CONFIG; |
| | | global $SOURCE_ID, $CONTACTS, $CONTACT_COLTYPES, $RCMAIL; |
| | | |
| | | if ($result = $CONTACTS->get_result()) |
| | | $record = $result->first(); |
| | | |
| | | $photo_img = $attrib['placeholder'] ? $CONFIG['skin_path'] . $attrib['placeholder'] : 'program/resources/blank.gif'; |
| | | $photo_img = $attrib['placeholder'] ? $RCMAIL->output->get_skin_file($attrib['placeholder']) : 'program/resources/blank.gif'; |
| | | if ($record['_type'] == 'group' && $attrib['placeholdergroup']) |
| | | $photo_img = $RCMAIL->output->get_skin_file($attrib['placeholdergroup']); |
| | | |
| | | $RCMAIL->output->set_env('photo_placeholder', $photo_img); |
| | | unset($attrib['placeholder']); |
| | | |
| | |
| | | } |
| | | } |
| | | 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; |
| | |
| | | 'directorylist' => 'rcmail_directory_list', |
| | | // 'groupslist' => 'rcmail_contact_groups', |
| | | 'addresslist' => 'rcmail_contacts_list', |
| | | 'addresslisttitle' => 'rcmail_contacts_list_title', |
| | | 'addressframe' => 'rcmail_contact_frame', |
| | | 'recordscountdisplay' => 'rcmail_rowcount_display', |
| | | 'searchform' => array($OUTPUT, 'search_form') |