* * -------------------------------------------- * * 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$ */ if ($submit || ! $ab_id) { $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True); } $phpgw_info["flags"] = array("currentapp" => "addressbook", "enable_contacts_class" => True, "enable_nextmatchs_class" => True); include("../header.inc.php"); $t = new Template($phpgw->common->get_tpl_dir("addressbook")); $t->set_file(array( "view" => "view.tpl")); $this = CreateObject("phpgwapi.contacts"); if (! $ab_id) { Header("Location: " . $phpgw->link("index.php")); } 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]; } } // merge in extra fields $extrafields = array ( "pager" => "pager", "mphone" => "mphone", "ophone" => "ophone", "address2" => "address2", "bday" => "bday", "url" => "url", "notes" => "notes", ); $qfields = $this->stock_contact_fields + $extrafields; $fields = $this->read_single_entry($ab_id,$qfields); $owner = $fields[0]["owner"]; $rights = $phpgw->acl->get_rights('u_'.$owner,$phpgw_info["flags"]["currentapp"]); if ( ($rights & PHPGW_ACL_READ) || ($owner == $phpgw_info["user"]["account_id"]) ) { $view_header = "

 " . lang("Address book - view") . "


"; $view_header .= ''; while ($column = each($columns_to_display)) { // each entry column $columns_html .= ""; $ref=$data=""; $coldata = $fields[0][$column[0]]; // Some fields require special formatting. if ($column[0] == "url") { $ref=''; $data=$coldata.''; } elseif ($column[0] == "email") { if ($phpgw_info["user"]["apps"]["email"]) { $ref=''; } else { $ref=''; } $data=$coldata.""; } else { // But these do not $ref=""; $data=$coldata; } $columns_html .= ""; } /* if ($access == "private") { $access_link .= lang("Record Access") . " - " . $access; } elseif ($access != "private" && $access != "public") { $access_link .= lang("Group access") . " - " . $phpgw->accounts->convert_string_to_names_access($access); } else { $access_link =""; } */ $columns_html .= '' . '
" . lang(display_name($colname[$column[0]])) . ":" . $ref . $data . "
 
' . lang("Record owner") . '' . $phpgw->common->grab_owner_name($owner) . '' . $access_link . '
'; $editlink = $phpgw->common->check_owner($owner,"edit.php",lang("edit"),"ab_id=" . $ab_id . "&start=".$start."&sort=".$sort."&order=".$order); $vcardlink = '

'; $donelink = ''; $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")); $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); $t->set_var("vcard_link",$vcardlink); $t->parse("out","view"); $t->pparse("out","view"); $phpgw->common->phpgw_footer(); } else { $phpgw->redirect($phpgw->session->link($phpgw_info["server"]["webserver_url"]. "/addressbook/","cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query")); $phpgw->common->phpgw_exit(); } ?>