source: github/program/steps/addressbook/show.inc @ d7cb774

HEADcourier-fixdev-browser-capabilitiespdorelease-0.6release-0.7release-0.8
Last change on this file since d7cb774 was d7cb774, checked in by svncommit <devs@…>, 8 years ago

more pear/mdb2 integration

  • Property mode set to 100644
File size: 2.5 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 +-----------------------------------------------------------------------+
17
18 $Id$
19
20*/
21
22
23if ($_GET['_cid'] || $_POST['_cid'])
24  {
25  $cid = $_POST['_cid'] ? $_POST['_cid'] : $_GET['_cid'];
26  $DB->query("SELECT * FROM ".get_table_name('contacts')."
27              WHERE  contact_id=?
28              AND    user_id=?
29              AND    del<>'1'",
30              $cid,
31              $_SESSION['user_id']);
32 
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
41function 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
79parse_template('showcontact');
80?>
Note: See TracBrowser for help on using the repository browser.