summaryrefslogtreecommitdiff
path: root/program/steps/addressbook
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2005-09-25 14:18:03 +0000
committerthomascube <thomas@roundcube.net>2005-09-25 14:18:03 +0000
commit4e17e6c9dbac8991ee8b302cb2581241247dc8bc (patch)
treed877546f6bd334b041734498e81f6299e005b01c /program/steps/addressbook
Initial revision
Diffstat (limited to 'program/steps/addressbook')
-rw-r--r--program/steps/addressbook/delete.inc104
-rw-r--r--program/steps/addressbook/edit.inc123
-rw-r--r--program/steps/addressbook/func.inc198
-rw-r--r--program/steps/addressbook/list.inc59
-rw-r--r--program/steps/addressbook/save.inc168
-rw-r--r--program/steps/addressbook/show.inc81
6 files changed, 733 insertions, 0 deletions
diff --git a/program/steps/addressbook/delete.inc b/program/steps/addressbook/delete.inc
new file mode 100644
index 000000000..99d9e33d4
--- /dev/null
+++ b/program/steps/addressbook/delete.inc
@@ -0,0 +1,104 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/addressbook/delete.inc |
+ | |
+ | This file is part of the RoundCube Webmail client |
+ | Copyright (C) 2005, RoundCube Dev. - Switzerland |
+ | All rights reserved. |
+ | |
+ | PURPOSE: |
+ | Delete the submitted contacts (CIDs) from the users address book |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com> |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
+
+$REMOTE_REQUEST = TRUE;
+
+if ($_GET['_cid'])
+ {
+ $DB->query(sprintf("UPDATE %s
+ SET del='1'
+ WHERE user_id=%d
+ AND contact_id IN (%s)",
+ get_table_name('contacts'),
+ $_SESSION['user_id'],
+ $_GET['_cid']));
+
+ $count = $DB->affected_rows();
+ if (!$count)
+ {
+ // send error message
+ exit;
+ }
+
+
+ // count contacts for this user
+ $sql_result = $DB->query(sprintf("SELECT COUNT(contact_id) AS rows
+ FROM %s
+ WHERE del!='1'
+ AND user_id=%d",
+ get_table_name('contacts'),
+ $_SESSION['user_id']));
+
+ $sql_arr = $DB->fetch_assoc($sql_result);
+ $rowcount = $sql_arr['rows'];
+
+ // update message count display
+ $pages = ceil($rowcount/$CONFIG['pagesize']);
+ $commands = sprintf("this.set_rowcount('%s');\n", rcmail_get_rowcount_text($rowcount));
+ $commands .= sprintf("this.set_env('pagecount', %d);\n", $pages);
+
+
+ // add new rows from next page (if any)
+ if ($_GET['_from']!='show' && $pages>1 && $_SESSION['page'] < $pages)
+ {
+ $start_row = ($_SESSION['page'] * $CONFIG['pagesize']) - $count;
+
+ // get contacts from DB
+ $sql_result = $DB->query(sprintf("SELECT * FROM %s
+ WHERE del!='1'
+ AND user_id=%d
+ ORDER BY name
+ LIMIT %d, %d",
+ get_table_name('contacts'),
+ $_SESSION['user_id'],
+ $start_row,
+ $count));
+
+ $commands .= rcmail_js_contacts_list($sql_result);
+
+/*
+ // define list of cols to be displayed
+ $a_show_cols = array('name', 'email');
+
+ while ($sql_arr = $DB->fetch_assoc($sql_result))
+ {
+ $a_row_cols = array();
+
+ // format each col
+ foreach ($a_show_cols as $col)
+ {
+ $cont = rep_specialchars_output($sql_arr[$col]);
+ $a_row_cols[$col] = $cont;
+ }
+
+ $commands .= sprintf("this.add_contact_row(%s, %s);\n",
+ $sql_arr['contact_id'],
+ array2js($a_row_cols));
+ }
+*/
+ }
+
+ // send response
+ rcube_remote_response($commands);
+ }
+
+exit;
+?> \ No newline at end of file
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc
new file mode 100644
index 000000000..db7b77a59
--- /dev/null
+++ b/program/steps/addressbook/edit.inc
@@ -0,0 +1,123 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/addressbook/edit.inc |
+ | |
+ | This file is part of the RoundCube Webmail client |
+ | Copyright (C) 2005, RoundCube Dev. - Switzerland |
+ | All rights reserved. |
+ | |
+ | PURPOSE: |
+ | Show edit form for a contact entry or to add a new one |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com> |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
+
+
+if (($_GET['_cid'] || $_POST['_cid']) && $_action=='edit')
+ {
+ $cid = $_POST['_cid'] ? $_POST['_cid'] : $_GET['_cid'];
+ $DB->query(sprintf("SELECT * FROM %s
+ WHERE contact_id=%d
+ AND user_id=%d
+ AND del!='1'",
+ get_table_name('contacts'),
+ $cid,
+ $_SESSION['user_id']));
+
+ $CONTACT_RECORD = $DB->fetch_assoc();
+
+ if (is_array($CONTACT_RECORD))
+ $OUTPUT->add_script(sprintf("%s.set_env('cid', '%s');", $JS_OBJECT_NAME, $CONTACT_RECORD['contact_id']));
+ }
+
+
+
+function rcmail_contact_editform($attrib)
+ {
+ global $CONTACT_RECORD, $JS_OBJECT_NAME;
+
+ if (!$CONTACT_RECORD && $GLOBALS['_action']!='add')
+ return rcube_label('contactnotfound');
+
+ list($form_start, $form_end) = get_form_tags($attrib);
+ unset($attrib['form']);
+
+
+ // a specific part is requested
+ if ($attrib['part'])
+ {
+ $out = $form_start;
+ $out .= rcmail_get_edit_field($attrib['part'], $CONTACT_RECORD[$attrib['part']], $attrib);
+ return $out;
+ }
+
+
+ // return the complete address edit form as table
+ $out = "$form_start<table>\n\n";
+
+ $a_show_cols = array('name', 'firstname', 'surname', 'email');
+ foreach ($a_show_cols as $col)
+ {
+ $attrib['id'] = 'rcmfd_'.$col;
+ $title = rcube_label($col);
+ $value = rcmail_get_edit_field($col, $CONTACT_RECORD[$col], $attrib);
+ $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
+ $attrib['id'],
+ $title,
+ $value);
+ }
+
+ $out .= "\n</table>$form_end";
+
+ return $out;
+ }
+
+
+// similar function as in /steps/settings/edit_identity.inc
+function get_form_tags($attrib)
+ {
+ global $CONTACT_RECORD, $OUTPUT, $JS_OBJECT_NAME, $EDIT_FORM, $SESS_HIDDEN_FIELD;
+
+ $form_start = '';
+ if (!strlen($EDIT_FORM))
+ {
+ $hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task']));
+ $hiddenfields->add(array('name' => '_action', 'value' => 'save'));
+
+ if ($_GET['_framed'] || $_POST['_framed'])
+ $hiddenfields->add(array('name' => '_framed', 'value' => 1));
+
+ if ($CONTACT_RECORD['contact_id'])
+ $hiddenfields->add(array('name' => '_cid', 'value' => $CONTACT_RECORD['contact_id']));
+
+ $form_start = !strlen($attrib['form']) ? '<form name="form" action="./" method="post">' : '';
+ $form_start .= "\n$SESS_HIDDEN_FIELD\n";
+ $form_start .= $hiddenfields->show();
+ }
+
+ $form_end = (strlen($EDIT_FORM) && !strlen($attrib['form'])) ? '</form>' : '';
+ $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form';
+
+ if (!strlen($EDIT_FORM))
+ $OUTPUT->add_script("$JS_OBJECT_NAME.gui_object('editform', '$form_name');");
+
+ $EDIT_FORM = $form_name;
+
+ return array($form_start, $form_end);
+ }
+
+
+
+if (!$CONTACT_RECORD && template_exists('addcontact'))
+ parse_template('addcontact');
+
+// this will be executed if no template for addcontact exists
+parse_template('editcontact');
+?> \ No newline at end of file
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
new file mode 100644
index 000000000..309c2a3a2
--- /dev/null
+++ b/program/steps/addressbook/func.inc
@@ -0,0 +1,198 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/addressbook/func.inc |
+ | |
+ | This file is part of the RoundCube Webmail client |
+ | Copyright (C) 2005, RoundCube Dev. - Switzerland |
+ | All rights reserved. |
+ | |
+ | PURPOSE: |
+ | Provide addressbook functionality and GUI objects |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com> |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
+
+$CONTACTS_LIST = array();
+
+// set list properties and session vars
+if (strlen($_GET['_page']))
+ {
+ $CONTACTS_LIST['page'] = $_GET['_page'];
+ $_SESSION['page'] = $_GET['_page'];
+ }
+else
+ $CONTACTS_LIST['page'] = $_SESSION['page'] ? $_SESSION['page'] : 1;
+
+
+
+// return the message list as HTML table
+function rcmail_contacts_list($attrib)
+ {
+ global $DB, $CONFIG, $OUTPUT, $CONTACTS_LIST, $JS_OBJECT_NAME;
+
+ //$skin_path = $CONFIG['skin_path'];
+ //$image_tag = '<img src="%s%s" alt="%s" border="0" />';
+
+ // count contacts for this user
+ $sql_result = $DB->query(sprintf("SELECT COUNT(contact_id) AS rows
+ FROM %s
+ WHERE del!='1'
+ AND user_id=%d",
+ get_table_name('contacts'),
+ $_SESSION['user_id']));
+
+ $sql_arr = $DB->fetch_assoc($sql_result);
+ $rowcount = $sql_arr['rows'];
+
+ if ($rowcount)
+ {
+ $start_row = ($CONTACTS_LIST['page']-1) * $CONFIG['pagesize'];
+
+ // get contacts from DB
+ $sql_result = $DB->query(sprintf("SELECT * FROM %s
+ WHERE del!='1'
+ AND user_id=%d
+ ORDER BY name
+ LIMIT %d, %d",
+ get_table_name('contacts'),
+ $_SESSION['user_id'],
+ $start_row,
+ $CONFIG['pagesize']));
+ }
+ else
+ $sql_result = NULL;
+
+
+ // add id to message list table if not specified
+ if (!strlen($attrib['id']))
+ $attrib['id'] = 'rcmAddressList';
+
+ // define list of cols to be displayed
+ $a_show_cols = array('name', 'email');
+
+ // create XHTML table
+ $out = rcube_table_output($attrib, $sql_result, $a_show_cols, 'contact_id');
+
+ // set client env
+ $javascript = sprintf("%s.gui_object('contactslist', '%s');\n", $JS_OBJECT_NAME, $attrib['id']);
+ $javascript .= sprintf("%s.set_env('current_page', %d);\n", $JS_OBJECT_NAME, $CONTACTS_LIST['page']);
+ $javascript .= sprintf("%s.set_env('pagecount', %d);\n", $JS_OBJECT_NAME, ceil($rowcount/$CONFIG['pagesize']));
+ //$javascript .= sprintf("%s.set_env('contacts', %s);", $JS_OBJECT_NAME, array2js($a_js_message_arr));
+
+ $OUTPUT->add_script($javascript);
+
+ return $out;
+ }
+
+
+
+function rcmail_js_contacts_list($sql_result, $obj_name='this')
+ {
+ global $DB;
+
+ $commands = '';
+
+ if (!$sql_result)
+ return '';
+
+ // define list of cols to be displayed
+ $a_show_cols = array('name', 'email');
+
+ while ($sql_arr = $DB->fetch_assoc($sql_result))
+ {
+ $a_row_cols = array();
+
+ // format each col
+ foreach ($a_show_cols as $col)
+ {
+ $cont = rep_specialchars_output($sql_arr[$col]);
+ $a_row_cols[$col] = $cont;
+ }
+
+ $commands .= sprintf("%s.add_contact_row(%s, %s);\n",
+ $obj_name,
+ $sql_arr['contact_id'],
+ array2js($a_row_cols));
+ }
+
+ return $commands;
+ }
+
+
+// similar function as /steps/settings/identities.inc::rcmail_identity_frame()
+function rcmail_contact_frame($attrib)
+ {
+ global $OUTPUT, $JS_OBJECT_NAME;
+
+ if (!$attrib['id'])
+ $attrib['id'] = 'rcmcontactframe';
+
+ $attrib['name'] = $attrib['id'];
+
+ $OUTPUT->add_script(sprintf("%s.set_env('contentframe', '%s');", $JS_OBJECT_NAME, $attrib['name']));
+
+ $attrib_str = create_attrib_string($attrib, array('name', 'id', 'class', 'style', 'src', 'width', 'height', 'frameborder'));
+ $out = '<iframe'. $attrib_str . '></iframe>';
+
+ return $out;
+ }
+
+
+function rcmail_rowcount_display($attrib)
+ {
+ global $OUTPUT, $JS_OBJECT_NAME;
+
+ if (!$attrib['id'])
+ $attrib['id'] = 'rcmcountdisplay';
+
+ $OUTPUT->add_script(sprintf("%s.gui_object('countdisplay', '%s');", $JS_OBJECT_NAME, $attrib['id']));
+
+ // allow the following attributes to be added to the <span> tag
+ $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));
+
+
+ $out = '<span' . $attrib_str . '>';
+ $out .= rcmail_get_rowcount_text();
+ $out .= '</span>';
+ return $out;
+ }
+
+
+
+function rcmail_get_rowcount_text($max=NULL)
+ {
+ global $CONTACTS_LIST, $CONFIG, $DB;
+
+ $start_row = ($CONTACTS_LIST['page']-1) * $CONFIG['pagesize'] + 1;
+
+ // get nr of contacts
+ if ($max===NULL)
+ {
+ $sql_result = $DB->query(sprintf("SELECT 1 FROM %s
+ WHERE del!='1'
+ AND user_id=%d",
+ get_table_name('contacts'),
+ $_SESSION['user_id']));
+
+ $max = $DB->num_rows($sql_result);
+ }
+
+ if ($max==0)
+ $out = rcube_label('nocontactsfound');
+ else
+ $out = rcube_label(array('name' => 'contactsfromto',
+ 'vars' => array('from' => $start_row,
+ 'to' => min($max, $start_row + $CONFIG['pagesize'] - 1),
+ 'count' => $max)));
+
+ return $out;
+ }
+
+?> \ No newline at end of file
diff --git a/program/steps/addressbook/list.inc b/program/steps/addressbook/list.inc
new file mode 100644
index 000000000..87ac888de
--- /dev/null
+++ b/program/steps/addressbook/list.inc
@@ -0,0 +1,59 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/addressbook/list.inc |
+ | |
+ | This file is part of the RoundCube Webmail client |
+ | Copyright (C) 2005, RoundCube Dev. - Switzerland |
+ | All rights reserved. |
+ | |
+ | PURPOSE: |
+ | Send contacts list to client (as remote response) |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com> |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
+
+$REMOTE_REQUEST = TRUE;
+
+// count contacts for this user
+$sql_result = $DB->query(sprintf("SELECT COUNT(contact_id) AS rows
+ FROM %s
+ WHERE del!='1'
+ AND user_id=%d",
+ get_table_name('contacts'),
+ $_SESSION['user_id']));
+
+$sql_arr = $DB->fetch_assoc($sql_result);
+$rowcount = $sql_arr['rows'];
+
+// update message count display
+$pages = ceil($rowcount/$CONFIG['pagesize']);
+$commands = sprintf("this.set_rowcount('%s');\n", rcmail_get_rowcount_text($rowcount));
+$commands .= sprintf("this.set_env('pagecount', %d);\n", $pages);
+
+$start_row = ($CONTACTS_LIST['page']-1) * $CONFIG['pagesize'];
+
+// get contacts from DB
+$sql_result = $DB->query(sprintf("SELECT * FROM %s
+ WHERE del!='1'
+ AND user_id=%d
+ ORDER BY name
+ LIMIT %d, %d",
+ get_table_name('contacts'),
+ $_SESSION['user_id'],
+ $start_row,
+ $CONFIG['pagesize']));
+
+$commands .= rcmail_js_contacts_list($sql_result);
+
+// send response
+rcube_remote_response($commands);
+
+exit;
+?> \ No newline at end of file
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
new file mode 100644
index 000000000..c0afd23d8
--- /dev/null
+++ b/program/steps/addressbook/save.inc
@@ -0,0 +1,168 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/addressbook/save.inc |
+ | |
+ | This file is part of the RoundCube Webmail client |
+ | Copyright (C) 2005, RoundCube Dev. - Switzerland |
+ | All rights reserved. |
+ | |
+ | PURPOSE: |
+ | Save a contact entry or to add a new one |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com> |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
+
+
+$a_save_cols = array('name', 'firstname', 'surname', 'email');
+
+
+// update an existing contact
+if ($_POST['_cid'])
+ {
+ $a_write_sql = array();
+
+ foreach ($a_save_cols as $col)
+ {
+ $fname = '_'.$col;
+ if (!isset($_POST[$fname]))
+ continue;
+
+ $a_write_sql[] = sprintf("%s='%s'", $col, addslashes($_POST[$fname]));
+ }
+
+ if (sizeof($a_write_sql))
+ {
+ $DB->query(sprintf("UPDATE %s
+ SET %s
+ WHERE contact_id=%d
+ AND user_id=%d
+ AND del!='1'",
+ get_table_name('contacts'),
+ join(', ', $a_write_sql),
+ $_POST['_cid'],
+ $_SESSION['user_id']));
+
+ $updated = $DB->affected_rows();
+ }
+
+ if ($updated)
+ {
+ $_action = 'show';
+ show_message('successfullysaved', 'confirmation');
+
+ if ($_POST['_framed'])
+ {
+ // define list of cols to be displayed
+ $a_show_cols = array('name', 'email');
+ $a_js_cols = array();
+
+ $sql_result = $DB->query(sprintf("SELECT * FROM %s
+ WHERE contact_id=%d
+ AND user_id=%d
+ AND del!='1'",
+ get_table_name('contacts'),
+ $_POST['_cid'],
+ $_SESSION['user_id']));
+
+ $sql_arr = $DB->fetch_assoc($sql_result);
+ foreach ($a_show_cols as $col)
+ $a_js_cols[] = (string)$sql_arr[$col];
+
+ // update the changed col in list
+ $OUTPUT->add_script(sprintf("if(parent.%s)parent.%s.update_contact_row('%d', %s);",
+ $JS_OBJECT_NAME,
+ $JS_OBJECT_NAME,
+ $_POST['_cid'],
+ array2js($a_js_cols)));
+
+ // show confirmation
+ show_message('successfullysaved', 'confirmation');
+ }
+ }
+ else
+ {
+ // show error message
+ show_message('errorsaving', 'error');
+ $_action = 'show';
+ }
+ }
+
+// insert a new contact
+else
+ {
+ $a_insert_cols = $a_insert_values = array();
+
+ foreach ($a_save_cols as $col)
+ {
+ $fname = '_'.$col;
+ if (!isset($_POST[$fname]))
+ continue;
+
+ $a_insert_cols[] = $col;
+ $a_insert_values[] = sprintf("'%s'", addslashes($_POST[$fname]));
+ }
+
+ if (sizeof($a_insert_cols))
+ {
+ $DB->query(sprintf("INSERT INTO %s
+ (user_id, %s)
+ VALUES (%d, %s)",
+ get_table_name('contacts'),
+ join(', ', $a_insert_cols),
+ $_SESSION['user_id'],
+ join(', ', $a_insert_values)));
+
+ $insert_id = $DB->insert_id();
+ }
+
+ if ($insert_id)
+ {
+ $_action = 'show';
+ $_GET['_cid'] = $insert_id;
+
+ if ($_POST['_framed'])
+ {
+ // add contact row or jump to the page where it should appear
+ $commands = sprintf("if(parent.%s)parent.", $JS_OBJECT_NAME);
+ $sql_result = $DB->query(sprintf("SELECT * FROM %s
+ WHERE contact_id=%d
+ AND user_id=%d",
+ get_table_name('contacts'),
+ $insert_id,
+ $_SESSION['user_id']));
+ $commands .= rcmail_js_contacts_list($sql_result, $JS_OBJECT_NAME);
+
+ $commands .= sprintf("if(parent.%s)parent.%s.select('%d');\n",
+ $JS_OBJECT_NAME,
+ $JS_OBJECT_NAME,
+ $insert_id);
+
+ // update record count display
+ $commands .= sprintf("if(parent.%s)parent.%s.set_rowcount('%s');\n",
+ $JS_OBJECT_NAME,
+ $JS_OBJECT_NAME,
+ rcmail_get_rowcount_text());
+
+ $OUTPUT->add_script($commands);
+
+ // show confirmation
+ show_message('successfullysaved', 'confirmation');
+ }
+ }
+ else
+ {
+ // show error message
+ show_message('errorsaving', 'error');
+ $_action = 'add';
+ }
+ }
+
+
+?> \ No newline at end of file
diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc
new file mode 100644
index 000000000..9317645d0
--- /dev/null
+++ b/program/steps/addressbook/show.inc
@@ -0,0 +1,81 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/addressbook/show.inc |
+ | |
+ | This file is part of the RoundCube Webmail client |
+ | Copyright (C) 2005, RoundCube Dev. - Switzerland |
+ | All rights reserved. |
+ | |
+ | PURPOSE: |
+ | Show contact details |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com> |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
+
+
+if ($_GET['_cid'] || $_POST['_cid'])
+ {
+ $cid = $_POST['_cid'] ? $_POST['_cid'] : $_GET['_cid'];
+ $DB->query(sprintf("SELECT * FROM %s
+ WHERE contact_id=%d
+ AND user_id=%d
+ AND del!='1'",
+ get_table_name('contacts'),
+ $cid,
+ $_SESSION['user_id']));
+
+ $CONTACT_RECORD = $DB->fetch_assoc();
+
+ if (is_array($CONTACT_RECORD))
+ $OUTPUT->add_script(sprintf("%s.set_env('cid', '%s');", $JS_OBJECT_NAME, $CONTACT_RECORD['contact_id']));
+ }
+
+
+
+function rcmail_contact_details($attrib)
+ {
+ global $CONTACT_RECORD, $JS_OBJECT_NAME;
+
+ if (!$CONTACT_RECORD)
+ return show_message('contactnotfound');
+
+ // a specific part is requested
+ if ($attrib['part'])
+ return rep_specialchars_output($CONTACT_RECORD[$attrib['part']]);
+
+
+ // return the complete address record as table
+ $out = "<table>\n\n";
+
+ $a_show_cols = array('name', 'firstname', 'surname', 'email');
+ foreach ($a_show_cols as $col)
+ {
+ if ($col=='email' && $CONTACT_RECORD[$col])
+ $value = sprintf('<a href="#compose" onclick="%s.command(\'compose\', %d)" title="%s">%s</a>',
+ $JS_OBJECT_NAME,
+ $CONTACT_RECORD['contact_id'],
+ rcube_label('composeto'),
+ $CONTACT_RECORD[$col]);
+ else
+ $value = rep_specialchars_output($CONTACT_RECORD[$col]);
+
+ $title = rcube_label($col);
+ $out .= sprintf("<tr><td class=\"title\">%s</td><td>%s</td></tr>\n", $title, $value);
+ }
+
+
+ $out .= "\n</table>";
+
+ return $out;
+ }
+
+
+parse_template('showcontact');
+?> \ No newline at end of file