* * -------------------------------------------- * * 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$ */ $phpgw_info["flags"] = array( "noheader" => True, "nonavbar" => True, "currentapp" => "addressbook", "enable_contacts_class" => True, "enable_nextmatchs_class" => True ); include("../header.inc.php"); $this = CreateObject("phpgwapi.contacts"); // First, make sure they have permission to this entry $check = addressbook_read_entry($ab_id,array('owner' => 'owner')); if (! ($this->check_perms($this->grants[$check[0]['owner']],PHPGW_ACL_READ) || $check[0]['owner'] != $phpgw_info['user']['account_id']) ) { Header("Location: " . $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); $phpgw->common->phpgw_exit(); } if (!$ab_id) { Header("Location: " . $phpgw->link("/addressbook/index.php")); } elseif (!$submit && $ab_id) { $phpgw->common->phpgw_header(); echo parse_navbar(); } $t = new Template($phpgw->common->get_tpl_dir("addressbook")); $t->set_file(array( "view" => "view.tpl")); 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[0]; } } // No prefs? if (!$columns_to_display ) { $columns_to_display = array( "n_given" => "n_given", "n_family" => "n_family", "org_name" => "org_name", "tel_work" => "tel_work", "tel_home" => "tel_home", "email" => "email", "email_home" => "email_home" ); while ($column = each($columns_to_display)) { $colname[$column[0]] = $column[1]; } $noprefs= " - " . lang("Please set your preferences for this app"); } // merge in extra fields $extrafields = array( "ophone" => "ophone", "address2" => "address2", "address3" => "address3" ); $qfields = $this->stock_contact_fields + $extrafields; $fields = addressbook_read_entry($ab_id,$qfields); $record_owner = $fields[0]["owner"]; if ($fields[0]["access"] == 'private') { $access_check = lang('private'); } else { $access_check = lang('public'); } $view_header = "
" . lang("Address book - view") . $noprefs . "
"; $view_header .= '
" . display_name($colname[$column[0]]) . ": | "; $ref=$data=""; $coldata = $fields[0][$column[0]]; // Some fields require special formatting. if ($column[0] == "url") { $ref=''; $data=$coldata.''; } elseif (($column[0] == "email") || ($column[0] == "email_home")) { if ($phpgw_info["user"]["apps"]["email"]) { $ref=''; } else { $ref=''; } $data=$coldata.""; } else { // But these do not $ref=""; $data=$coldata; } $columns_html .= "" . $ref . $data . " | "; } $cat = CreateObject('phpgwapi.categories'); $catinfo = $cat->return_single($fields[0]['cat_id']); $catname = $catinfo[0]["name"]; if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; } $cat->app_name = "phpgw"; $catinfo = $cat->return_single($fields[0]['cat_id']); $catname .= $catinfo[0]["name"]; if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; } if (!$catname) { $catname = lang('none'); } $columns_html .= '||
' . lang("Record owner") . ' | ' . $phpgw->common->grab_owner_name($record_owner) . ' | ||
' . lang("Record access") . ' | ' . $access_check . ' | ||
' . lang("Category") . ' | ' . $catname . ' |