2000-08-18 05:24:22 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - addressbook *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2000-09-18 22:00:25 +02:00
|
|
|
if ($submit || ! $ab_id) {
|
2000-09-05 20:36:13 +02:00
|
|
|
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
|
2000-08-18 05:24:22 +02:00
|
|
|
}
|
|
|
|
|
2000-09-05 20:36:13 +02:00
|
|
|
$phpgw_info["flags"]["currentapp"] = "addressbook";
|
2000-08-18 05:24:22 +02:00
|
|
|
include("../header.inc.php");
|
2000-09-18 22:00:25 +02:00
|
|
|
|
2000-11-12 12:35:51 +01:00
|
|
|
function checkfor_specialformat($field,$data)
|
|
|
|
{
|
|
|
|
global $phpgw_info, $phpgw;
|
|
|
|
|
|
|
|
if ($field == "email") {
|
|
|
|
if ($phpgw_info["user"]["apps"]["email"]) {
|
|
|
|
$s = '<a href="' . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/email/compose.php",
|
|
|
|
"to=" . urlencode($data)) . '" target="_new">' . $data . '</a>';
|
|
|
|
} else {
|
|
|
|
$s = '<a href="mailto:' . $data . '">' . $data . '</a>';
|
|
|
|
}
|
|
|
|
} else if ($field == "URL") {
|
|
|
|
if (! ereg("^http://",$data)) {
|
|
|
|
$data = "http://" . $data;
|
|
|
|
}
|
|
|
|
$s = '<a href="' . $data . '" target="_new">' . $data . '</a>';
|
|
|
|
} else if ($field == "birthday") {
|
|
|
|
$date = explode("/",$data);
|
|
|
|
$s = $phpgw->common->dateformatorder($date[2],$date[1],$date[0],True);
|
|
|
|
} else {
|
|
|
|
$s = $data . " ";
|
|
|
|
}
|
|
|
|
return $s;
|
|
|
|
}
|
|
|
|
|
2000-09-18 22:00:25 +02:00
|
|
|
if (! $ab_id) {
|
|
|
|
Header("Location: " . $phpgw->link("index.php"));
|
|
|
|
}
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2000-11-03 21:07:57 +01:00
|
|
|
if ($filter != "private") {
|
2000-09-18 22:00:25 +02:00
|
|
|
$filtermethod = " or ab_access='public' " . $phpgw->accounts->sql_search("ab_access");
|
2000-11-01 13:32:36 +01:00
|
|
|
}
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2000-11-01 13:32:36 +01:00
|
|
|
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
|
|
|
|
$phpgw->db->query("SELECT * FROM addressbook as a, customers as c WHERE a.ab_company_id = c.company_id "
|
|
|
|
. "AND ab_id=$ab_id AND (ab_owner='"
|
|
|
|
. $phpgw_info["user"]["account_id"] . "' $filtermethod)");
|
2000-10-04 19:49:36 +02:00
|
|
|
} else {
|
2000-11-01 13:32:36 +01:00
|
|
|
$phpgw->db->query("SELECT * FROM addressbook WHERE ab_id=$ab_id AND (ab_owner='"
|
2000-10-25 23:09:00 +02:00
|
|
|
. $phpgw_info["user"]["account_id"] . "' $filtermethod)");
|
2000-10-04 19:49:36 +02:00
|
|
|
}
|
2000-08-18 05:24:22 +02:00
|
|
|
$phpgw->db->next_record();
|
|
|
|
|
2000-11-01 13:32:36 +01:00
|
|
|
echo "<p> <b>" . lang("Address book - view") . "</b><hr><p>";
|
|
|
|
|
|
|
|
$i = 0;
|
|
|
|
while ($column = each($abc)) {
|
|
|
|
if ($phpgw->db->f("ab_" . $column[0])) {
|
|
|
|
$columns_to_display[$i]["field_name"] = $column[1];
|
|
|
|
$columns_to_display[$i]["field_value"] = $phpgw->db->f("ab_" . $column[0]);
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
}
|
2000-11-06 10:50:33 +01:00
|
|
|
|
|
|
|
if ($phpgw->db->f("ab_notes")) {
|
|
|
|
$columns_to_display[$i]["field_name"] = "Notes";
|
|
|
|
$columns_to_display[$i]["field_value"] = $phpgw->db->f("ab_notes");
|
|
|
|
}
|
2000-11-01 13:32:36 +01:00
|
|
|
|
|
|
|
echo '<table border="0" cellspacing="2" cellpadding="2" width="80%" align="center">';
|
|
|
|
for ($i=0;$i<200;) { // The $i<200 is only used for a brake
|
|
|
|
if (! $columns_to_display[$i]["field_name"]) break;
|
|
|
|
|
|
|
|
$columns_html .= "<tr><td><b>" . lang($columns_to_display[$i]["field_name"]) . "</b>:</td>"
|
2000-11-12 12:35:51 +01:00
|
|
|
. "<td>" . checkfor_specialformat($columns_to_display[$i]["field_name"],$columns_to_display[$i]["field_value"])
|
|
|
|
. "</td>";
|
2000-11-01 13:32:36 +01:00
|
|
|
|
|
|
|
$i++;
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2000-11-01 13:32:36 +01:00
|
|
|
if (! $columns_to_display[$i]["field_name"]) break;
|
|
|
|
|
2000-11-12 12:35:51 +01:00
|
|
|
$columns_html .= "<tr><td><b>" . lang($columns_to_display[$i]["field_name"]) . "</b>:</td>"
|
|
|
|
. "<td>" . checkfor_specialformat($columns_to_display[$i]["field_name"],$columns_to_display[$i]["field_value"])
|
|
|
|
. "</td>";
|
2000-11-01 13:32:36 +01:00
|
|
|
|
|
|
|
$i++;
|
|
|
|
$columns_html .= "</td></tr>";
|
|
|
|
}
|
|
|
|
$access = $phpgw->db->f("ab_access");
|
2000-11-01 13:48:48 +01:00
|
|
|
$owner = $phpgw->db->f("ab_owner");
|
|
|
|
$ab_id = $phpgw->db->f("ab_id");
|
|
|
|
|
2000-11-01 13:32:36 +01:00
|
|
|
echo $columns_html . '<tr><td colspan="4"> </td></tr>';
|
|
|
|
echo "<tr><td><b>" . lang("Record owner") . "</b></td><td>"
|
|
|
|
. $phpgw->common->grab_owner_name($phpgw->db->f("ab_owner")) . "</td><td><b>"
|
|
|
|
. lang("Record Access") . "</b></td><td>";
|
|
|
|
|
|
|
|
if ($access != "private" && $access != "public") {
|
2000-11-01 13:48:48 +01:00
|
|
|
echo lang("Group access") . " - " . $phpgw->accounts->convert_string_to_names_access($access);
|
2000-11-01 13:32:36 +01:00
|
|
|
} else {
|
|
|
|
echo $access;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</td></tr></table>";
|
2000-08-18 05:24:22 +02:00
|
|
|
?>
|
2000-11-03 21:07:57 +01:00
|
|
|
|
2000-11-01 13:32:36 +01:00
|
|
|
<TABLE border="0" cellpadding="1" cellspacing="1">
|
|
|
|
<TR>
|
|
|
|
<TD align="left">
|
|
|
|
<?php
|
2000-11-01 13:48:48 +01:00
|
|
|
echo $phpgw->common->check_owner($owner,"edit.php","Edit","ab_id=$ab_id");
|
2000-11-01 13:32:36 +01:00
|
|
|
?>
|
|
|
|
</TD>
|
2000-11-03 21:07:57 +01:00
|
|
|
<TD align=left>
|
|
|
|
<a href="<?php echo $phpgw->link("vcardout.php","ab_id=$ab_id&order=$order&start=$start&filter=$filter&query=$query&sort=$sort");?>">Vcard</a>
|
|
|
|
</TD>
|
2000-11-01 13:32:36 +01:00
|
|
|
<TD align="left">
|
|
|
|
<a href="<?php echo $phpgw->link("index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort"); ?>">Done</a>
|
|
|
|
</TD>
|
|
|
|
</TR>
|
|
|
|
</TABLE>
|
|
|
|
|
2000-09-29 07:24:18 +02:00
|
|
|
<?php
|
|
|
|
$phpgw->common->phpgw_footer();
|
|
|
|
?>
|