4 +-----------------------------------------------------------------------+
5 | program/steps/addressbook/show.inc |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Show contact details |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
18 $Id: show.inc 2237 2009-01-17 01:55:39Z till $
23 // read contact record
24 if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true))) {
25 $OUTPUT->set_env('cid', $record['ID']);
28 function rcmail_contact_details($attrib)
30 global $CONTACTS, $OUTPUT;
32 // check if we have a valid result
33 if (!(($result = $CONTACTS->get_result()) && ($record = $result->first()))) {
34 $OUTPUT->show_message('contactnotfound');
38 // a specific part is requested
39 if ($attrib['part']) {
40 return Q($record[$attrib['part']]);
43 // return the complete address record as table
44 $table = new html_table(array('cols' => 2));
46 $a_show_cols = array('name', 'firstname', 'surname', 'email');
47 $microformats = array('name' => 'fn', 'email' => 'email');
49 foreach ($a_show_cols as $col) {
50 if ($col == 'email' && !empty($record[$col])) {
51 $value = html::a(array(
52 'href' => 'mailto:' . $record[$col],
53 'onclick' => sprintf("return %s.command('compose','%s',this)", JS_OBJECT_NAME, JQ($record[$col])),
54 'title' => rcube_label('composeto'),
55 'class' => $microformats[$col],
58 else if (!empty($record[$col])) {
59 $value = html::span($microformats[$col], Q($record[$col]));
64 $table->add('title', Q(rcube_label($col)));
65 $table->add(null, $value);
68 return $table->show($attrib + array('class' => 'vcard'));
72 //$OUTPUT->framed = $_framed;
73 $OUTPUT->add_handler('contactdetails', 'rcmail_contact_details');
74 $OUTPUT->send('showcontact');