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

Last change on this file since 308 was 308, checked in by tri, 7 years ago

Improvements for SVN 306 Bug (Ticket #1483950)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 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, 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 | Author: Tobias 'tri' Richter  <tobias@datenwerkstatt-richter.de       |
17 +-----------------------------------------------------------------------+
18
19 $Id$
20
21*/
22
23
24if ($_GET['_cid'] || $_POST['_cid'])
25  {
26  $cid = $_POST['_cid'] ? $_POST['_cid'] : $_GET['_cid'];
27  $DB->query("SELECT * FROM ".get_table_name('contacts')."
28              WHERE  contact_id=?
29              AND    user_id=?
30              AND    del<>1",
31              $cid,
32              $_SESSION['user_id']);
33 
34  $CONTACT_RECORD = $DB->fetch_assoc();
35 
36  if (is_array($CONTACT_RECORD))
37    $OUTPUT->add_script(sprintf("%s.set_env('cid', '%s');", $JS_OBJECT_NAME, $CONTACT_RECORD['contact_id']));
38  }
39
40
41
42function rcmail_contact_details($attrib)
43  {
44  global $CONTACT_RECORD, $JS_OBJECT_NAME;
45
46  if (!$CONTACT_RECORD)
47    return show_message('contactnotfound');
48 
49  // a specific part is requested
50  if ($attrib['part'])
51    return rep_specialchars_output($CONTACT_RECORD[$attrib['part']]);
52
53
54  // return the complete address record as table
55  $out = "<table>\n\n";
56
57  $a_show_cols = array('name', 'email', 'first_name', 'middle_name', 'last_name', 'edu_title', 'addon', 'nickname', 'company', 'organisation', 'department', 'job_title', 'note', 'tel_work1_voice', 'tel_work2_voice', 'tel_home1_voice', 'tel_home2_voice', 'tel_cell_voice', 'tel_car_voice', 'tel_pager_voice', 'tel_additional', 'tel_work_fax', 'tel_home_fax', 'tel_isdn', 'tel_preferred', 'tel_telex', 'work_street', 'work_zip', 'work_city', 'work_region', 'work_country', 'home_street', 'home_zip', 'home_city', 'home_region', 'home_country', 'postal_street', 'postal_zip', 'postal_city', 'postal_region', 'postal_country', 'url_work', 'role', 'birthday', 'rev', 'lang');
58  foreach ($a_show_cols as $col)
59    {
60    if ($col=='email' && $CONTACT_RECORD[$col])
61      $value = sprintf('<a href="#compose" onclick="%s.command(\'compose\', %d)" title="%s">%s</a>',
62                       $JS_OBJECT_NAME,
63                       $CONTACT_RECORD['contact_id'],
64                       rcube_label('composeto'),
65                       $CONTACT_RECORD[$col]);
66    else
67      $value = rep_specialchars_output($CONTACT_RECORD[$col]);
68   
69    $title = rcube_label($col);
70    $out .= sprintf("<tr><td class=\"title\">%s</td><td>%s</td></tr>\n", $title, $value);
71    }
72
73
74  $out .= "\n</table>";
75 
76  return $out; 
77  }
78
79
80parse_template('showcontact');
81?>
Note: See TracBrowser for help on using the repository browser.