Formatting

This commit is contained in:
Miles Lott 2001-05-06 16:15:43 +00:00
parent e7f38fb001
commit 38882f39ae

View File

@ -12,15 +12,15 @@
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"] = array( $phpgw_info['flags'] = array(
"noheader" => True, 'noheader' => True,
"nonavbar" => True, 'nonavbar' => True,
"currentapp" => "addressbook", 'currentapp' => 'addressbook',
"enable_contacts_class" => True, 'enable_contacts_class' => True,
"enable_nextmatchs_class" => True 'enable_nextmatchs_class' => True
); );
include("../header.inc.php"); include('../header.inc.php');
$this = CreateObject("phpgwapi.contacts"); $this = CreateObject("phpgwapi.contacts");
@ -35,66 +35,75 @@
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} }
if (!$ab_id) { if (!$ab_id)
Header("Location: " . $phpgw->link("/addressbook/index.php")); {
} elseif (!$submit && $ab_id) { Header("Location: " . $phpgw->link('/addressbook/index.php'));
}
elseif (!$submit && $ab_id)
{
$phpgw->common->phpgw_header(); $phpgw->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
} }
$t = new Template($phpgw->common->get_tpl_dir("addressbook")); $t = new Template($phpgw->common->get_tpl_dir('addressbook'));
$t->set_file(array( $t->set_file(array(
"view" => "view.tpl", 'view' => 'view.tpl',
"view_header" => "view_header.tpl", 'view_header' => 'view_header.tpl',
"view_row" => "view_row.tpl", 'view_row' => 'view_row.tpl',
"view_footer" => "view_footer.tpl" 'view_footer' => 'view_footer.tpl'
)); ));
$customfields = array(); $customfields = array();
while (list($col,$descr) = @each($phpgw_info["user"]["preferences"]["addressbook"])) { while (list($col,$descr) = @each($phpgw_info['user']['preferences']['addressbook']))
if ( substr($col,0,6) == 'extra_' ) { {
if ( substr($col,0,6) == 'extra_' )
{
$field = ereg_replace('extra_','',$col); $field = ereg_replace('extra_','',$col);
$field = ereg_replace(' ','_',$field); $field = ereg_replace(' ','_',$field);
$customfields[$field] = ucfirst($field); $customfields[$field] = ucfirst($field);
} }
} }
while ($column = each($this->stock_contact_fields)) { while ($column = each($this->stock_contact_fields))
if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) && {
$phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) { if (isset($phpgw_info['user']['preferences']['addressbook'][$column[0]]) &&
$phpgw_info['user']['preferences']['addressbook'][$column[0]])
{
$columns_to_display[$column[0]] = True; $columns_to_display[$column[0]] = True;
$colname[$column[0]] = $column[0]; $colname[$column[0]] = $column[0];
} }
} }
// No prefs? // No prefs?
if (!$columns_to_display ) { if (!$columns_to_display )
{
$columns_to_display = array( $columns_to_display = array(
"n_given" => "n_given", 'n_given' => 'n_given',
"n_family" => "n_family", 'n_family' => 'n_family',
"org_name" => "org_name", 'org_name' => 'org_name',
"tel_work" => "tel_work", 'tel_work' => 'tel_work',
"tel_home" => "tel_home", 'tel_home' => 'tel_home',
"email" => "email", 'email' => 'email',
"email_home" => "email_home" 'email_home' => 'email_home'
); );
while ($column = each($columns_to_display)) { while ($column = each($columns_to_display))
{
$colname[$column[0]] = $column[1]; $colname[$column[0]] = $column[1];
} }
$noprefs= " - " . lang("Please set your preferences for this app"); $noprefs = " - " . lang('Please set your preferences for this app');
} }
// merge in extra fields // merge in extra fields
$extrafields = array( $extrafields = array(
"ophone" => "ophone", 'ophone' => 'ophone',
"address2" => "address2", 'address2' => 'address2',
"address3" => "address3" 'address3' => 'address3'
); );
$qfields = $this->stock_contact_fields + $extrafields + $customfields; $qfields = $this->stock_contact_fields + $extrafields + $customfields;
$fields = addressbook_read_entry($ab_id,$qfields); $fields = addressbook_read_entry($ab_id,$qfields);
$record_owner = $fields[0]["owner"]; $record_owner = $fields[0]['owner'];
if ($fields[0]["access"] == 'private') if ($fields[0]["access"] == 'private')
{ {
@ -108,7 +117,8 @@
$t->set_var('lang_viewpref',lang("Address book - view") . $noprefs); $t->set_var('lang_viewpref',lang("Address book - view") . $noprefs);
@reset($qfields); @reset($qfields);
while (list($column,$null) = @each($qfields)) { // each entry column while (list($column,$null) = @each($qfields)) // each entry column
{
if(display_name($colname[$column])) if(display_name($colname[$column]))
{ {
$t->set_var('display_col',display_name($colname[$column])); $t->set_var('display_col',display_name($colname[$column]));
@ -182,28 +192,28 @@
{ {
$t->set_var('ref_data',$ref . $data); $t->set_var('ref_data',$ref . $data);
} }
$t->parse("cols","view_row",True); $t->parse('cols','view_row',True);
} }
} }
$cat = CreateObject('phpgwapi.categories'); $cat = CreateObject('phpgwapi.categories');
$catinfo = $cat->return_single($fields[0]['cat_id']); $catinfo = $cat->return_single($fields[0]['cat_id']);
$catname = $catinfo[0]["name"]; $catname = $catinfo[0]['name'];
if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; } if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; }
$cat->app_name = "phpgw"; $cat->app_name = 'phpgw';
$catinfo = $cat->return_single($fields[0]['cat_id']); $catinfo = $cat->return_single($fields[0]['cat_id']);
$catname .= $catinfo[0]["name"]; $catname .= $catinfo[0]['name'];
if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; } if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; }
if (!$catname) { $catname = lang('none'); } if (!$catname) { $catname = lang('none'); }
// These are in the footer // These are in the footer
$t->set_var('lang_owner',lang("Record owner")); $t->set_var('lang_owner',lang('Record owner'));
$t->set_var('owner',$phpgw->common->grab_owner_name($record_owner)); $t->set_var('owner',$phpgw->common->grab_owner_name($record_owner));
$t->set_var('lang_access',lang("Record access")); $t->set_var('lang_access',lang("Record access"));
$t->set_var('access',$access_check); $t->set_var('access',$access_check);
$t->set_var('lang_category',lang("Category")); $t->set_var('lang_category',lang('Category'));
$t->set_var('catname',$catname); $t->set_var('catname',$catname);
$sfields = rawurlencode(serialize($fields[0])); $sfields = rawurlencode(serialize($fields[0]));
@ -248,28 +258,28 @@
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query").'">'; "cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query").'">';
} }
$t->set_var("access_link",$access_link); $t->set_var('access_link',$access_link);
$t->set_var("ab_id",$ab_id); $t->set_var('ab_id',$ab_id);
$t->set_var("sort",$sort); $t->set_var('sort',$sort);
$t->set_var("order",$order); $t->set_var('order',$order);
$t->set_var("filter",$filter); $t->set_var('filter',$filter);
$t->set_var("start",$start); $t->set_var('start',$start);
$t->set_var("cat_id",$cat_id); $t->set_var('cat_id',$cat_id);
$t->parse("header","view_header"); $t->parse('header','view_header');
$t->parse("footer","view_footer"); $t->parse('footer','view_footer');
$t->set_var("lang_ok",lang("ok")); $t->set_var('lang_ok',lang('ok'));
$t->set_var("lang_done",lang("done")); $t->set_var('lang_done',lang('done'));
$t->set_var("lang_copy",lang("copy")); $t->set_var('lang_copy',lang('copy'));
$t->set_var("copy_fields",$sfields); $t->set_var('copy_fields',$sfields);
$t->set_var("lang_submit",lang("submit")); $t->set_var('lang_submit',lang('submit'));
$t->set_var("lang_vcard",lang("vcard")); $t->set_var('lang_vcard',lang('vcard'));
$t->set_var("done_link",$donelink); $t->set_var('done_link',$donelink);
$t->set_var("copy_link",$copylink); $t->set_var('copy_link',$copylink);
$t->set_var("vcard_link",$vcardlink); $t->set_var('vcard_link',$vcardlink);
$t->pfp("out","view"); $t->pfp('out','view');
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>