You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
roundcubemail/program/steps/addressbook/show.inc

73 lines
2.3 KiB
PHTML

19 years ago
<?php
/*
+-----------------------------------------------------------------------+
| program/steps/addressbook/show.inc |
| |
| This file is part of the RoundCube Webmail client |
| Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
19 years ago
| |
| PURPOSE: |
| Show contact details |
| |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
$Id$
*/
// read contact record
if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true)))
$OUTPUT->set_env('cid', $record['ID']);
19 years ago
function rcmail_contact_details($attrib)
{
global $CONTACTS, $OUTPUT;
19 years ago
// check if we have a valid result
if (!(($result = $CONTACTS->get_result()) && ($record = $result->first())))
{
$OUTPUT->show_message('contactnotfound');
return false;
}
19 years ago
// a specific part is requested
if ($attrib['part'])
return Q($record[$attrib['part']]);
19 years ago
// return the complete address record as table
$out = "<table>\n\n";
$a_show_cols = array('name', 'firstname', 'surname', 'email');
19 years ago
foreach ($a_show_cols as $col)
{
if ($col=='email' && !empty($record[$col]))
$value = sprintf(
'<a href="#compose" onclick="%s.command(\'compose\', \'%s\')" title="%s">%s</a>',
JS_OBJECT_NAME,
JQ($record[$col]),
rcube_label('composeto'),
Q($record[$col]));
19 years ago
else
$value = Q($record[$col]);
19 years ago
$out .= sprintf("<tr><td class=\"title\">%s</td><td>%s</td></tr>\n",
Q(rcube_label($col)),
$value);
19 years ago
}
19 years ago
$out .= "\n</table>";
return $out;
}
//$OUTPUT->framed = $_framed;
$OUTPUT->add_handler('contactdetails', 'rcmail_contact_details');
$OUTPUT->send('showcontact');
?>