commit | author | age
|
4e17e6
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/addressbook/show.inc | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
f11541
|
8 |
| Copyright (C) 2005-2007, 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 |
T |
24 |
if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true))) |
|
25 |
$OUTPUT->set_env('cid', $record['ID']); |
4e17e6
|
26 |
|
T |
27 |
|
|
28 |
function rcmail_contact_details($attrib) |
|
29 |
{ |
f11541
|
30 |
global $CONTACTS, $OUTPUT; |
4e17e6
|
31 |
|
f11541
|
32 |
// check if we have a valid result |
T |
33 |
if (!(($result = $CONTACTS->get_result()) && ($record = $result->first()))) |
|
34 |
{ |
|
35 |
$OUTPUT->show_message('contactnotfound'); |
|
36 |
return false; |
|
37 |
} |
4e17e6
|
38 |
|
T |
39 |
// a specific part is requested |
|
40 |
if ($attrib['part']) |
f11541
|
41 |
return Q($record[$attrib['part']]); |
4e17e6
|
42 |
|
T |
43 |
// return the complete address record as table |
|
44 |
$out = "<table>\n\n"; |
|
45 |
|
64009e
|
46 |
$a_show_cols = array('name', 'firstname', 'surname', 'email'); |
4e17e6
|
47 |
foreach ($a_show_cols as $col) |
T |
48 |
{ |
f11541
|
49 |
if ($col=='email' && !empty($record[$col])) |
T |
50 |
$value = sprintf( |
|
51 |
'<a href="#compose" onclick="%s.command(\'compose\', \'%s\')" title="%s">%s</a>', |
|
52 |
JS_OBJECT_NAME, |
|
53 |
JQ($record[$col]), |
|
54 |
rcube_label('composeto'), |
|
55 |
Q($record[$col])); |
4e17e6
|
56 |
else |
f11541
|
57 |
$value = Q($record[$col]); |
4e17e6
|
58 |
|
f11541
|
59 |
$out .= sprintf("<tr><td class=\"title\">%s</td><td>%s</td></tr>\n", |
T |
60 |
Q(rcube_label($col)), |
|
61 |
$value); |
4e17e6
|
62 |
} |
f11541
|
63 |
|
4e17e6
|
64 |
$out .= "\n</table>"; |
T |
65 |
|
|
66 |
return $out; |
|
67 |
} |
|
68 |
|
|
69 |
|
f11541
|
70 |
//$OUTPUT->framed = $_framed; |
T |
71 |
$OUTPUT->add_handler('contactdetails', 'rcmail_contact_details'); |
|
72 |
$OUTPUT->send('showcontact'); |
64009e
|
73 |
?> |