From 86861b65f865807d34ee9e3b629ec361f7c6684c Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Wed, 4 Apr 2001 12:48:57 +0000 Subject: [PATCH] Templified prefs page --- addressbook/preferences.php | 134 +++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 54 deletions(-) diff --git a/addressbook/preferences.php b/addressbook/preferences.php index 12a7243fe9..0c033feab2 100644 --- a/addressbook/preferences.php +++ b/addressbook/preferences.php @@ -90,73 +90,99 @@ echo "

" . $phpgw->common->error_list($errors) . "
"; } - echo "

" . lang("Addressbook preferences") . ":" . "


"; -?> -

- - \n"; + $t = new Template($phpgw->common->get_tpl_dir("addressbook")); + $t->set_file(array( + "preferences" => "preferences.tpl", + )); + + $t->set_var(action_url,$phpgw->link('/addressbook/preferences.php')); + $i = 0; $j = 0; $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); echo "\n"; - while (list($col, $descr) = each($qfields)) { + + while (list($col, $descr) = each($qfields)) + { // echo "
test: $col - $i $j - " . count($abc); $i++; $j++; $showcol = display_name($col); if (!$showcol) { $showcol = $col; } // yank the *'s prior to testing for a valid column description $coltest = ereg_replace("\*","",$showcol); - if ($coltest) { - echo "\t\n"; - } else { - $i--; - next; - } - if ($i == 3) { - echo "\n"; - $i = 0; - } - if ($i == 0 && $coltest) { - $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - echo "\n"; - } - if ($j == count($qfields)) { - if ($i == 1) { - echo "\t\n"; + if ($coltest) + { + $t->set_var($col,$showcol); + if ($phpgw_info["user"]["preferences"]["addressbook"][$col]) + { + $t->set_var($col.'_checked'," checked"); } - if ($i == 2) { - echo "\t\n"; + else + { + $t->set_var($col.'_checked',''); } - echo "\n"; } } + + if ($customfields) + { + $custom_var = ' + + + + + +'; + while( list($cf) = each($customfields) ) + { + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + $custom_var .= "\n" . ''; + $custom_var .= ' ' . "\n" + . '' . "\n"; + } + $t->set_var(custom_fields,$custom_var); + } + else + { + $t->set_var(custom_fields,''); + } + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - ?> - - - - nextmatchs->alternate_row_color($tr_color);?> - - - - nextmatchs->alternate_row_color($tr_color);?> - - - - - - - -
 
' . $showcol - . "
   
'.lang('Custom').' '.lang('Fields').':
' . $cf . '
>
>
- "> -
-
-set_var(tr_color,$tr_color); + $t->set_var(lang_showbirthday,lang("show birthday reminders on main screen")); + + if ($phpgw_info["user"]["preferences"]["addressbook"]["mainscreen_showbirthdays"]) + { + $t->set_var(show_birthday," checked"); + } + else + { + $t->set_var(show_birthday,''); + } + + $t->set_var(lang_autosave,lang("Autosave default category")); + if ($phpgw_info["user"]["preferences"]["addressbook"]["autosave_category"]) + { + $t->set_var(autosave," checked"); + } + else + { + $t->set_var(autosave,""); + } + $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")); + + $t->pparse('out','preferences'); $phpgw->common->phpgw_footer(); ?>