source: subversion/trunk/roundcubemail/program/steps/addressbook/show.inc @ 543

Last change on this file since 543 was 543, checked in by thomasb, 6 years ago

Merged branch devel-addressbook from r443 back to trunk

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1<?php
2
3/*
4 +-----------------------------------------------------------------------+
5 | program/steps/addressbook/show.inc                                    |
6 |                                                                       |
7 | This file is part of the RoundCube Webmail client                     |
8 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
9 | Licensed under the GNU GPL                                            |
10 |                                                                       |
11 | PURPOSE:                                                              |
12 |   Show contact details                                                |
13 |                                                                       |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16 +-----------------------------------------------------------------------+
17
18 $Id$
19
20*/
21
22
23// read contact record
24if (($cid = get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true)))
25  $OUTPUT->set_env('cid', $record['ID']);
26
27
28function rcmail_contact_details($attrib)
29  {
30  global $CONTACTS, $OUTPUT;
31
32  // check if we have a valid result
33  if (!(($result = $CONTACTS->get_result()) && ($record = $result->first())))
34  {
35    $OUTPUT->show_message('contactnotfound');
36    return false;
37  }
38 
39  // a specific part is requested
40  if ($attrib['part'])
41    return Q($record[$attrib['part']]);
42
43  // return the complete address record as table
44  $out = "<table>\n\n";
45
46  $a_show_cols = array('name', 'firstname', 'surname', 'email');
47  foreach ($a_show_cols as $col)
48    {
49    if ($col=='email' && !empty($record[$col]))
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]));
56    else
57      $value = Q($record[$col]);
58   
59    $out .= sprintf("<tr><td class=\"title\">%s</td><td>%s</td></tr>\n",
60                    Q(rcube_label($col)),
61                    $value);
62    }
63 
64  $out .= "\n</table>";
65 
66  return $out; 
67  }
68
69
70//$OUTPUT->framed = $_framed;
71$OUTPUT->add_handler('contactdetails', 'rcmail_contact_details');
72$OUTPUT->send('showcontact');
73?>
Note: See TracBrowser for help on using the repository browser.