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$ */
$phpgw_info["flags"] = array(
"noheader" => True,
"nonavbar" => True,
"currentapp" => "addressbook",
"enable_contacts_class" => True,
"enable_nextmatchs_class" => True
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'addressbook',
'enable_contacts_class' => True,
'enable_nextmatchs_class' => True
);
include("../header.inc.php");
include('../header.inc.php');
$this = CreateObject("phpgwapi.contacts");
@ -35,66 +35,75 @@
$phpgw->common->phpgw_exit();
}
if (!$ab_id) {
Header("Location: " . $phpgw->link("/addressbook/index.php"));
} elseif (!$submit && $ab_id) {
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 = new Template($phpgw->common->get_tpl_dir('addressbook'));
$t->set_file(array(
"view" => "view.tpl",
"view_header" => "view_header.tpl",
"view_row" => "view_row.tpl",
"view_footer" => "view_footer.tpl"
'view' => 'view.tpl',
'view_header' => 'view_header.tpl',
'view_row' => 'view_row.tpl',
'view_footer' => 'view_footer.tpl'
));
$customfields = array();
while (list($col,$descr) = @each($phpgw_info["user"]["preferences"]["addressbook"])) {
if ( substr($col,0,6) == 'extra_' ) {
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);
}
}
while ($column = each($this->stock_contact_fields)) {
if (isset($phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) &&
$phpgw_info["user"]["preferences"]["addressbook"][$column[0]]) {
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 ) {
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"
'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)) {
while ($column = each($columns_to_display))
{
$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
$extrafields = array(
"ophone" => "ophone",
"address2" => "address2",
"address3" => "address3"
'ophone' => 'ophone',
'address2' => 'address2',
'address3' => 'address3'
);
$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')
{
@ -108,7 +117,8 @@
$t->set_var('lang_viewpref',lang("Address book - view") . $noprefs);
@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]))
{
$t->set_var('display_col',display_name($colname[$column]));
@ -127,7 +137,7 @@
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$t->set_var('th_bg',$tr_color);
$coldata = $fields[0][$column];
// Some fields require special formatting.
// Some fields require special formatting.
if ( ($column == "note" || $column == "label" || $column == "pubkey") && $coldata )
{
$datarray = explode ("\n",$coldata);
@ -182,28 +192,28 @@
{
$t->set_var('ref_data',$ref . $data);
}
$t->parse("cols","view_row",True);
$t->parse('cols','view_row',True);
}
}
$cat = CreateObject('phpgwapi.categories');
$catinfo = $cat->return_single($fields[0]['cat_id']);
$catname = $catinfo[0]["name"];
$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";
$cat->app_name = 'phpgw';
$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 (!$catname) { $catname = lang('none'); }
// 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('lang_access',lang("Record access"));
$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);
$sfields = rawurlencode(serialize($fields[0]));
@ -225,7 +235,7 @@
$t->set_var('edit_button','<input type="submit" name="edit" value="' . lang('Edit') . '">');
}
$copylink = '<form method="POST" action="' . $phpgw->link("/addressbook/add.php").'">';
$copylink = '<form method="POST" action="' . $phpgw->link("/addressbook/add.php").'">';
if ($fields[0]['n_family'] && $fields[0]['n_given'])
{
$vcardlink = '<form method="POST" action="' . $phpgw->link("/addressbook/vcardout.php").'">';
@ -237,39 +247,39 @@
if ($referer)
{
$referer = ereg_replace('/phpgroupware','',$referer);
$donelink = '<form method="POST" action="'
$donelink = '<form method="POST" action="'
. $phpgw->link($referer,
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query").'">';
}
else
{
$donelink = '<form method="POST" action="'
$donelink = '<form method="POST" action="'
. $phpgw->link("/addressbook/index.php",
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query").'">';
}
$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("cat_id",$cat_id);
$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('cat_id',$cat_id);
$t->parse("header","view_header");
$t->parse("footer","view_footer");
$t->parse('header','view_header');
$t->parse('footer','view_footer');
$t->set_var("lang_ok",lang("ok"));
$t->set_var("lang_done",lang("done"));
$t->set_var("lang_copy",lang("copy"));
$t->set_var("copy_fields",$sfields);
$t->set_var("lang_submit",lang("submit"));
$t->set_var("lang_vcard",lang("vcard"));
$t->set_var("done_link",$donelink);
$t->set_var("copy_link",$copylink);
$t->set_var("vcard_link",$vcardlink);
$t->set_var('lang_ok',lang('ok'));
$t->set_var('lang_done',lang('done'));
$t->set_var('lang_copy',lang('copy'));
$t->set_var('copy_fields',$sfields);
$t->set_var('lang_submit',lang('submit'));
$t->set_var('lang_vcard',lang('vcard'));
$t->set_var('done_link',$donelink);
$t->set_var('copy_link',$copylink);
$t->set_var('vcard_link',$vcardlink);
$t->pfp("out","view");
$t->pfp('out','view');
$phpgw->common->phpgw_footer();
?>