2000-08-18 05:24:22 +02:00
|
|
|
<?php
|
2001-02-10 13:56:49 +01:00
|
|
|
/**************************************************************************\
|
|
|
|
* 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. *
|
|
|
|
\**************************************************************************/
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
/* $Id$ */
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
if ($submit || ! $ab_id) {
|
2001-02-19 13:14:25 +01:00
|
|
|
$phpgw_info["flags"] = array(
|
|
|
|
"noheader" => True,
|
|
|
|
"nonavbar" => True
|
|
|
|
);
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2001-02-13 04:20:33 +01:00
|
|
|
$phpgw_info["flags"] = array(
|
|
|
|
"currentapp" => "addressbook",
|
|
|
|
"enable_contacts_class" => True,
|
|
|
|
"enable_nextmatchs_class" => True);
|
2001-02-02 02:34:22 +01:00
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
include("../header.inc.php");
|
2000-09-18 22:00:25 +02:00
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
$t = new Template($phpgw->common->get_tpl_dir("addressbook"));
|
|
|
|
$t->set_file(array( "view" => "view.tpl"));
|
2001-02-12 14:57:59 +01:00
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
$this = CreateObject("phpgwapi.contacts");
|
2001-02-12 14:57:59 +01:00
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
if (! $ab_id) {
|
2001-03-08 14:31:05 +01:00
|
|
|
Header("Location: " . $phpgw->link("/addressbook/index.php"));
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
2001-01-14 04:29:39 +01:00
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
while ($column = each($this->stock_contact_fields)) {
|
|
|
|
if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) &&
|
|
|
|
$phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) {
|
|
|
|
$columns_to_display[$column[0]] = True;
|
|
|
|
$colname[$column[0]] = $column[1];
|
|
|
|
}
|
|
|
|
}
|
2001-03-13 17:19:05 +01:00
|
|
|
|
|
|
|
// No prefs?
|
|
|
|
if (!$columns_to_display ) {
|
|
|
|
$columns_to_display = array(
|
|
|
|
"n_given" => "n_given",
|
|
|
|
"n_family" => "n_family",
|
|
|
|
"org_name" => "org_name"
|
|
|
|
);
|
|
|
|
while ($column = each($columns_to_display)) {
|
|
|
|
$colname[$column[0]] = $column[1];
|
|
|
|
}
|
2001-03-13 17:21:58 +01:00
|
|
|
$noprefs= " - " . lang("Please set your preferences for this app");
|
2001-03-13 17:19:05 +01:00
|
|
|
}
|
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
// merge in extra fields
|
2001-03-16 02:31:25 +01:00
|
|
|
$extrafields = array(
|
2001-02-11 04:23:58 +01:00
|
|
|
"ophone" => "ophone",
|
|
|
|
"address2" => "address2",
|
2001-03-16 02:31:25 +01:00
|
|
|
"address3" => "address3"
|
2001-02-11 04:23:58 +01:00
|
|
|
);
|
2001-02-10 13:56:49 +01:00
|
|
|
$qfields = $this->stock_contact_fields + $extrafields;
|
2001-03-16 02:31:25 +01:00
|
|
|
|
2001-02-14 01:56:07 +01:00
|
|
|
$fields = addressbook_read_entry($ab_id,$qfields);
|
2001-03-16 02:31:25 +01:00
|
|
|
|
2001-02-19 13:14:25 +01:00
|
|
|
$record_owner = $fields[0]["owner"];
|
2001-02-12 14:57:59 +01:00
|
|
|
|
2001-03-13 17:21:58 +01:00
|
|
|
$view_header = "<p> <b>" . lang("Address book - view") . $noprefs . "</b><hr><p>";
|
2001-02-14 01:56:07 +01:00
|
|
|
$view_header .= '<table border="0" cellspacing="2" cellpadding="2" width="80%" align="center">';
|
2001-02-19 13:14:25 +01:00
|
|
|
|
2001-03-13 17:19:05 +01:00
|
|
|
reset($columns_to_display);
|
2001-02-14 01:56:07 +01:00
|
|
|
while ($column = each($columns_to_display)) { // each entry column
|
2001-02-15 18:21:38 +01:00
|
|
|
$columns_html .= "<tr><td><b>" . display_name($colname[$column[0]]) . "</b>:</td>";
|
2001-02-14 01:56:07 +01:00
|
|
|
$ref=$data="";
|
|
|
|
$coldata = $fields[0][$column[0]];
|
|
|
|
// Some fields require special formatting.
|
|
|
|
if ($column[0] == "url") {
|
|
|
|
$ref='<a href="'.$coldata.'" target="_new">';
|
|
|
|
$data=$coldata.'</a>';
|
2001-03-16 02:31:25 +01:00
|
|
|
} elseif (($column[0] == "email") || ($column[0] == "email_home")) {
|
2001-02-14 01:56:07 +01:00
|
|
|
if ($phpgw_info["user"]["apps"]["email"]) {
|
2001-03-08 14:31:05 +01:00
|
|
|
$ref='<a href="'.$phpgw->link("/email/compose.php","to=" . urlencode($coldata)).'" target="_new">';
|
2001-02-14 01:56:07 +01:00
|
|
|
} else {
|
|
|
|
$ref='<a href="mailto:'.$coldata.'">';
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
2001-02-14 01:56:07 +01:00
|
|
|
$data=$coldata."</a>";
|
|
|
|
} else { // But these do not
|
|
|
|
$ref=""; $data=$coldata;
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
2001-02-14 01:56:07 +01:00
|
|
|
$columns_html .= "<td>" . $ref . $data . "</td>";
|
|
|
|
}
|
2000-11-12 12:35:51 +01:00
|
|
|
|
2001-02-14 01:56:07 +01:00
|
|
|
$columns_html .= '<tr><td colspan="4"> </td></tr>'
|
2001-02-12 14:57:59 +01:00
|
|
|
. '<tr><td><b>' . lang("Record owner") . '</b></td><td>'
|
2001-02-19 13:14:25 +01:00
|
|
|
. $phpgw->common->grab_owner_name($record_owner) . '</td><td><b>'
|
2001-02-12 14:57:59 +01:00
|
|
|
. $access_link . '</b></td><td></table>';
|
2001-02-14 01:56:07 +01:00
|
|
|
|
2001-03-18 00:52:36 +01:00
|
|
|
$sfields = rawurlencode(serialize($fields[0]));
|
2001-03-08 14:31:05 +01:00
|
|
|
$editlink = $phpgw->common->check_owner($record_owner,"/addressbook/edit.php",lang("edit"),"ab_id=" . $ab_id . "&start=".$start."&sort=".$sort."&order=".$order);
|
2001-03-18 00:52:36 +01:00
|
|
|
$copylink = '<form action="'.$phpgw->link("/addressbook/add.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort").'">';
|
2001-03-08 14:31:05 +01:00
|
|
|
$vcardlink = '<form action="'.$phpgw->link("/addressbook/vcardout.php","ab_id=$ab_id&order=$order&start=$start&filter=$filter&query=$query&sort=$sort").'">';
|
|
|
|
$donelink = '<form action="'.$phpgw->link("/addressbook/index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort").'">';
|
2001-03-16 02:31:25 +01:00
|
|
|
|
2001-02-14 01:56:07 +01:00
|
|
|
$t->set_var("access_link",$access_link);
|
|
|
|
$t->set_var("ab_id",$ab_id);
|
|
|
|
$t->set_var("sort",$sort);
|
|
|
|
$t->set_var("order",$order);
|
|
|
|
$t->set_var("filter",$filter);
|
|
|
|
$t->set_var("start",$start);
|
|
|
|
$t->set_var("view_header",$view_header);
|
|
|
|
$t->set_var("cols",$columns_html);
|
|
|
|
$t->set_var("lang_ok",lang("ok"));
|
|
|
|
$t->set_var("lang_done",lang("done"));
|
|
|
|
$t->set_var("lang_edit",lang("edit"));
|
2001-03-18 00:52:36 +01:00
|
|
|
$t->set_var("lang_copy",lang("copy"));
|
|
|
|
$t->set_var("copy_fields",$sfields);
|
2001-02-14 01:56:07 +01:00
|
|
|
$t->set_var("lang_submit",lang("submit"));
|
|
|
|
$t->set_var("lang_vcard",lang("vcard"));
|
|
|
|
$t->set_var("done_link",$donelink);
|
|
|
|
$t->set_var("edit_link",$editlink);
|
2001-03-18 00:52:36 +01:00
|
|
|
$t->set_var("copy_link",$copylink);
|
2001-02-14 01:56:07 +01:00
|
|
|
$t->set_var("vcard_link",$vcardlink);
|
2001-02-12 14:57:59 +01:00
|
|
|
|
2001-02-14 01:56:07 +01:00
|
|
|
$t->parse("out","view");
|
|
|
|
$t->pparse("out","view");
|
2001-03-16 02:31:25 +01:00
|
|
|
|
2001-02-14 01:56:07 +01:00
|
|
|
$phpgw->common->phpgw_footer();
|
2000-09-29 07:24:18 +02:00
|
|
|
?>
|