* * -------------------------------------------- * * 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_config_class' => True, 'enable_country_class' => True ); include('../header.inc.php'); $contacts = CreateObject('phpgwapi.contacts'); // First, make sure they have permission to this entry $check = addressbook_read_entry($ab_id,array('owner' => 'owner')); if ( !$contacts->check_perms($contacts->grants[$check[0]['owner']],PHPGW_ACL_EDIT) && ($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',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); $phpgw->common->phpgw_exit(); } if (!$submit) { $phpgw->common->phpgw_header(); echo parse_navbar(); } // Read in user custom fields, if any $customfields = array(); while (list($col,$descr) = @each($phpgw_info['user']['preferences']['addressbook'])) { if ( substr($col,0,6) == 'extra_' ) { $field = ereg_replace('extra_','',$col); $field = ereg_replace(' ','_',$field); $customfields[$field] = ucfirst($field); } } if (!$submit) { // merge in extra fields $extrafields = array( 'ophone' => 'ophone', 'address2' => 'address2', 'address3' => 'address3' ); $qfields = $contacts->stock_contact_fields + $extrafields + $customfields; $fields = addressbook_read_entry($ab_id,$qfields); addressbook_form('edit','edit.php',lang('Edit'),$fields[0],$customfields); $t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); $t->set_file(array("edit" => "edit.tpl")); $t->set_var('th_bg',$phpgw_info['theme']['th_bg']); $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('query',$query); $t->set_var('start',$start); $t->set_var('cat_id',$cat_id); $t->set_var('tid',$tid); $t->set_var('lang_ok',lang('ok')); $t->set_var('lang_clear',lang('clear')); $t->set_var('lang_cancel',lang('cancel')); $t->set_var('lang_submit',lang('submit')); $t->set_var('cancel_link','