commit | author | age
|
4e17e6
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/addressbook/show.inc | |
|
6 |
| | |
e019f2
|
7 |
| This file is part of the Roundcube Webmail client | |
A |
8 |
| Copyright (C) 2005-2009, Roundcube Dev. - Switzerland | |
30233b
|
9 |
| Licensed under the GNU GPL | |
4e17e6
|
10 |
| | |
T |
11 |
| PURPOSE: | |
|
12 |
| Show contact details | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id$ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
|
22 |
|
f11541
|
23 |
// read contact record |
f92aba
|
24 |
if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true))) { |
f11541
|
25 |
$OUTPUT->set_env('cid', $record['ID']); |
f92aba
|
26 |
} |
4e17e6
|
27 |
|
T |
28 |
function rcmail_contact_details($attrib) |
f92aba
|
29 |
{ |
f11541
|
30 |
global $CONTACTS, $OUTPUT; |
4e17e6
|
31 |
|
f11541
|
32 |
// check if we have a valid result |
f92aba
|
33 |
if (!(($result = $CONTACTS->get_result()) && ($record = $result->first()))) { |
f11541
|
34 |
$OUTPUT->show_message('contactnotfound'); |
T |
35 |
return false; |
|
36 |
} |
4e17e6
|
37 |
|
T |
38 |
// a specific part is requested |
f92aba
|
39 |
if ($attrib['part']) { |
f11541
|
40 |
return Q($record[$attrib['part']]); |
f92aba
|
41 |
} |
4e17e6
|
42 |
|
T |
43 |
// return the complete address record as table |
f92aba
|
44 |
$table = new html_table(array('cols' => 2)); |
4e17e6
|
45 |
|
64009e
|
46 |
$a_show_cols = array('name', 'firstname', 'surname', 'email'); |
f92aba
|
47 |
$microformats = array('name' => 'fn', 'email' => 'email'); |
T |
48 |
|
|
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], |
|
56 |
), Q($record[$col])); |
4e17e6
|
57 |
} |
f92aba
|
58 |
else if (!empty($record[$col])) { |
T |
59 |
$value = html::span($microformats[$col], Q($record[$col])); |
|
60 |
} |
|
61 |
else |
|
62 |
$value = ''; |
|
63 |
|
|
64 |
$table->add('title', Q(rcube_label($col))); |
|
65 |
$table->add(null, $value); |
4e17e6
|
66 |
} |
f92aba
|
67 |
|
T |
68 |
return $table->show($attrib + array('class' => 'vcard')); |
|
69 |
} |
4e17e6
|
70 |
|
T |
71 |
|
f11541
|
72 |
//$OUTPUT->framed = $_framed; |
T |
73 |
$OUTPUT->add_handler('contactdetails', 'rcmail_contact_details'); |
|
74 |
$OUTPUT->send('showcontact'); |