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 | |
|
8 |
| Copyright (C) 2005, 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 |
|
|
23 |
if ($_GET['_cid'] || $_POST['_cid']) |
|
24 |
{ |
|
25 |
$cid = $_POST['_cid'] ? $_POST['_cid'] : $_GET['_cid']; |
d7cb77
|
26 |
$DB->query("SELECT * FROM ".get_table_name('contacts')." |
S |
27 |
WHERE contact_id=? |
|
28 |
AND user_id=? |
1cded8
|
29 |
AND del<>1", |
d7cb77
|
30 |
$cid, |
S |
31 |
$_SESSION['user_id']); |
4e17e6
|
32 |
|
T |
33 |
$CONTACT_RECORD = $DB->fetch_assoc(); |
|
34 |
|
|
35 |
if (is_array($CONTACT_RECORD)) |
|
36 |
$OUTPUT->add_script(sprintf("%s.set_env('cid', '%s');", $JS_OBJECT_NAME, $CONTACT_RECORD['contact_id'])); |
|
37 |
} |
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
function rcmail_contact_details($attrib) |
|
42 |
{ |
|
43 |
global $CONTACT_RECORD, $JS_OBJECT_NAME; |
|
44 |
|
|
45 |
if (!$CONTACT_RECORD) |
|
46 |
return show_message('contactnotfound'); |
|
47 |
|
|
48 |
// a specific part is requested |
|
49 |
if ($attrib['part']) |
|
50 |
return rep_specialchars_output($CONTACT_RECORD[$attrib['part']]); |
|
51 |
|
|
52 |
|
|
53 |
// return the complete address record as table |
|
54 |
$out = "<table>\n\n"; |
|
55 |
|
|
56 |
$a_show_cols = array('name', 'firstname', 'surname', 'email'); |
|
57 |
foreach ($a_show_cols as $col) |
|
58 |
{ |
|
59 |
if ($col=='email' && $CONTACT_RECORD[$col]) |
|
60 |
$value = sprintf('<a href="#compose" onclick="%s.command(\'compose\', %d)" title="%s">%s</a>', |
|
61 |
$JS_OBJECT_NAME, |
|
62 |
$CONTACT_RECORD['contact_id'], |
|
63 |
rcube_label('composeto'), |
|
64 |
$CONTACT_RECORD[$col]); |
|
65 |
else |
|
66 |
$value = rep_specialchars_output($CONTACT_RECORD[$col]); |
|
67 |
|
|
68 |
$title = rcube_label($col); |
|
69 |
$out .= sprintf("<tr><td class=\"title\">%s</td><td>%s</td></tr>\n", $title, $value); |
|
70 |
} |
|
71 |
|
|
72 |
|
|
73 |
$out .= "\n</table>"; |
|
74 |
|
|
75 |
return $out; |
|
76 |
} |
|
77 |
|
|
78 |
|
|
79 |
parse_template('showcontact'); |
|
80 |
?> |