2000-10-12 16:34:25 +02:00
|
|
|
<?php
|
2001-02-10 13:56:49 +01:00
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - Address Book *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* 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. *
|
|
|
|
\**************************************************************************/
|
2000-10-12 16:34:25 +02:00
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
/* $Id$ */
|
|
|
|
|
2001-05-21 10:04:52 +02:00
|
|
|
$phpgw_info['flags'] = array(
|
|
|
|
'currentapp' => 'addressbook',
|
|
|
|
'noheader' => True,
|
|
|
|
'nonavbar' => True,
|
2001-04-06 04:14:07 +02:00
|
|
|
'noappheader' => True,
|
|
|
|
'noappfooter' => True,
|
2001-05-21 10:04:52 +02:00
|
|
|
'enable_contacts_class' => True,
|
|
|
|
'enable_nextmatchs_class' => True
|
2001-02-19 13:14:25 +01:00
|
|
|
);
|
2000-10-12 16:34:25 +02:00
|
|
|
|
2001-05-21 10:04:52 +02:00
|
|
|
include('../header.inc.php');
|
|
|
|
|
|
|
|
$this = CreateObject('phpgwapi.contacts');
|
2001-03-16 02:31:25 +01:00
|
|
|
|
2001-02-19 13:51:38 +01:00
|
|
|
$extrafields = array(
|
2001-05-21 10:04:52 +02:00
|
|
|
'ophone' => 'ophone',
|
|
|
|
'address2' => 'address2',
|
|
|
|
'address3' => 'address3'
|
2001-02-19 13:51:38 +01:00
|
|
|
);
|
2001-03-16 02:31:25 +01:00
|
|
|
|
2001-03-16 18:56:18 +01:00
|
|
|
$phpgw->preferences->read_repository();
|
|
|
|
$customfields = array();
|
2001-05-21 10:04:52 +02:00
|
|
|
if ($phpgw_info['user']['preferences']['addressbook'])
|
|
|
|
{
|
|
|
|
while (list($col,$descr) = each($phpgw_info['user']['preferences']['addressbook']))
|
|
|
|
{
|
|
|
|
if ( substr($col,0,6) == 'extra_' )
|
|
|
|
{
|
2001-03-16 18:56:18 +01:00
|
|
|
$field = ereg_replace('extra_','',$col);
|
|
|
|
$customfields[$field] = ucfirst($field);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$qfields = $this->stock_contact_fields + $extrafields + $customfields;
|
2001-02-19 13:51:38 +01:00
|
|
|
|
2001-05-21 10:04:52 +02:00
|
|
|
if ($submit)
|
|
|
|
{
|
2001-02-10 13:56:49 +01:00
|
|
|
$totalerrors = 0;
|
2001-05-21 10:04:52 +02:00
|
|
|
if (! count($ab_selected))
|
|
|
|
{
|
|
|
|
$errors[$totalerrors++] = lang('You must select at least 1 column to display');
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
2001-05-21 10:04:52 +02:00
|
|
|
if (! $totalerrors)
|
|
|
|
{
|
2001-02-10 13:56:49 +01:00
|
|
|
$phpgw->preferences->read_repository();
|
2001-05-21 10:04:52 +02:00
|
|
|
while (list($pref[0]) = each($qfields))
|
|
|
|
{
|
|
|
|
if ($ab_selected["$pref[0]"])
|
|
|
|
{
|
|
|
|
$phpgw->preferences->change('addressbook',$pref[0],'addressbook_' . $ab_selected["$pref[0]"]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$phpgw->preferences->delete('addressbook',$pref[0],'addressbook_' . $ab_selected["$pref[0]"]);
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
|
|
|
}
|
2000-12-31 23:58:41 +01:00
|
|
|
|
2001-05-21 10:04:52 +02:00
|
|
|
if ($mainscreen_showbirthdays)
|
|
|
|
{
|
|
|
|
$phpgw->preferences->delete('addressbook','mainscreen_showbirthdays');
|
|
|
|
$phpgw->preferences->add('addressbook','mainscreen_showbirthdays');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$phpgw->preferences->delete('addressbook','mainscreen_showbirthdays');
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
2000-12-13 16:19:03 +01:00
|
|
|
|
2001-05-21 10:04:52 +02:00
|
|
|
if ($autosave_category)
|
|
|
|
{
|
|
|
|
$phpgw->preferences->delete('addressbook','autosave_category');
|
|
|
|
$phpgw->preferences->add('addressbook','autosave_category',True);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$phpgw->preferences->delete('addressbook','autosave_category');
|
2001-03-25 10:46:26 +02:00
|
|
|
}
|
|
|
|
|
2001-05-21 10:04:52 +02:00
|
|
|
if ($cat_id)
|
|
|
|
{
|
|
|
|
$phpgw->preferences->delete('addressbook','default_category');
|
|
|
|
$phpgw->preferences->add('addressbook','default_category',$cat_id);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$phpgw->preferences->delete('addressbook','default_category');
|
2001-03-25 09:36:21 +02:00
|
|
|
}
|
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
$phpgw->preferences->save_repository(True);
|
2001-05-21 10:04:52 +02:00
|
|
|
Header('Location: ' . $phpgw->link('/preferences/index.php'));
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
|
|
|
}
|
2000-10-12 16:34:25 +02:00
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
$phpgw->common->phpgw_header();
|
|
|
|
echo parse_navbar();
|
2000-10-12 16:34:25 +02:00
|
|
|
|
2001-05-21 10:04:52 +02:00
|
|
|
if ($totalerrors)
|
|
|
|
{
|
|
|
|
echo '<p><center>' . $phpgw->common->error_list($errors) . '</center>';
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
2000-10-12 16:34:25 +02:00
|
|
|
|
2001-05-10 14:21:16 +02:00
|
|
|
$t = new Template(PHPGW_APP_TPL);
|
2001-04-04 14:48:57 +02:00
|
|
|
$t->set_file(array(
|
2001-05-21 10:04:52 +02:00
|
|
|
'preferences' => 'preferences.tpl',
|
2001-04-04 14:48:57 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
$t->set_var(action_url,$phpgw->link('/addressbook/preferences.php'));
|
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
$i = 0; $j = 0;
|
|
|
|
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
2001-04-04 14:48:57 +02:00
|
|
|
|
|
|
|
while (list($col, $descr) = each($qfields))
|
|
|
|
{
|
2001-02-10 13:56:49 +01:00
|
|
|
// echo "<br>test: $col - $i $j - " . count($abc);
|
|
|
|
$i++; $j++;
|
2001-03-22 00:57:30 +01:00
|
|
|
$showcol = display_name($col);
|
|
|
|
if (!$showcol) { $showcol = $col; }
|
2001-02-19 13:51:38 +01:00
|
|
|
// yank the *'s prior to testing for a valid column description
|
|
|
|
$coltest = ereg_replace("\*","",$showcol);
|
2001-04-04 14:48:57 +02:00
|
|
|
if ($coltest)
|
|
|
|
{
|
|
|
|
$t->set_var($col,$showcol);
|
2001-05-21 10:04:52 +02:00
|
|
|
if ($phpgw_info['user']['preferences']['addressbook'][$col])
|
2001-04-04 14:48:57 +02:00
|
|
|
{
|
2001-05-21 10:04:52 +02:00
|
|
|
$t->set_var($col.'_checked',' checked');
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
2001-04-04 14:48:57 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$t->set_var($col.'_checked','');
|
2001-02-10 13:56:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-04-04 14:48:57 +02:00
|
|
|
|
|
|
|
if ($customfields)
|
|
|
|
{
|
|
|
|
$custom_var = '
|
|
|
|
<tr>
|
|
|
|
<td><font color="#000000" face="">'.lang('Custom').' '.lang('Fields').':</font></td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
</tr>
|
|
|
|
';
|
|
|
|
while( list($cf) = each($customfields) )
|
|
|
|
{
|
|
|
|
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
|
|
|
$custom_var .= "\n" . '<tr bgcolor="' . $tr_color . '">';
|
|
|
|
$custom_var .= ' <td><input type="checkbox" name="ab_selected['
|
|
|
|
. strtolower($cf) . ']"'
|
2001-05-21 10:04:52 +02:00
|
|
|
. ($phpgw_info['user']['preferences']['addressbook'][$cf]?' checked':'')
|
2001-04-04 14:48:57 +02:00
|
|
|
. '>' . $cf . '</option></td>' . "\n"
|
|
|
|
. '</tr>' . "\n";
|
|
|
|
}
|
|
|
|
$t->set_var(custom_fields,$custom_var);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$t->set_var(custom_fields,'');
|
|
|
|
}
|
|
|
|
|
2001-02-10 13:56:49 +01:00
|
|
|
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
2001-05-21 10:04:52 +02:00
|
|
|
$t->set_var(tr_color,$tr_color);
|
|
|
|
$t->set_var(lang_showbirthday,lang('show birthday reminders on main screen'));
|
2001-04-04 14:48:57 +02:00
|
|
|
|
2001-05-21 10:04:52 +02:00
|
|
|
if ($phpgw_info['user']['preferences']['addressbook']['mainscreen_showbirthdays'])
|
2001-04-04 14:48:57 +02:00
|
|
|
{
|
2001-05-21 10:04:52 +02:00
|
|
|
$t->set_var(show_birthday,' checked');
|
2001-04-04 14:48:57 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$t->set_var(show_birthday,'');
|
|
|
|
}
|
|
|
|
|
2001-05-21 10:04:52 +02:00
|
|
|
$t->set_var(lang_autosave,lang('Autosave default category'));
|
|
|
|
if ($phpgw_info['user']['preferences']['addressbook']['autosave_category'])
|
2001-04-04 14:48:57 +02:00
|
|
|
{
|
2001-05-21 10:04:52 +02:00
|
|
|
$t->set_var(autosave,' checked');
|
2001-04-04 14:48:57 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-05-21 10:04:52 +02:00
|
|
|
$t->set_var(autosave,'');
|
2001-04-04 14:48:57 +02:00
|
|
|
}
|
2001-05-21 10:04:52 +02:00
|
|
|
$t->set_var('lang_defaultcat',lang('Default Category'));
|
|
|
|
$t->set_var('cat_select',cat_option($phpgw_info['user']['preferences']['addressbook']['default_category']));
|
|
|
|
$t->set_var('lang_abprefs',lang('Addressbook').' '.lang('Preferences'));
|
|
|
|
$t->set_var('lang_fields',lang('Fields to show in address list'));
|
|
|
|
$t->set_var('lang_personal',lang('Personal'));
|
|
|
|
$t->set_var('lang_business',lang('Business'));
|
|
|
|
$t->set_var('lang_home',lang('Home'));
|
|
|
|
$t->set_var('lang_phones',lang('Extra').' '.lang('Phone Numbers'));
|
|
|
|
$t->set_var('lang_other',lang('Other').' '.lang('Fields'));
|
|
|
|
$t->set_var('lang_otherprefs',lang('Other').' '.lang('Preferences'));
|
|
|
|
$t->set_var('lang_submit',lang('submit'));
|
2001-04-04 14:48:57 +02:00
|
|
|
|
|
|
|
$t->pparse('out','preferences');
|
2001-02-10 13:56:49 +01:00
|
|
|
$phpgw->common->phpgw_footer();
|
2000-11-16 23:03:49 +01:00
|
|
|
?>
|