<?php
	/***************************************************************************\
	* phpGroupWare - Notes														*
	* http://www.phpgroupware.org												*
	* Written by: Andy Holman (LoCdOg)											*
	* --------------------------------------------								*
	* 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: preferences.php,v 1.23 2001/05/15 01:36:34 bettina Exp $ */

	$phpgw_info['flags'] = array('currentapp'  => 'notes',
									'noheader' => True,
									'nonavbar' => True,
								'noappheader' => True,
								'noappfooter' => True);

	include('../header.inc.php');

### CHECK TO SEE IF PREFERENCES IN PREFERENCES TABLE EXISTS ###

	if (isset($phpgw_info['user']['preferences']['notes']['notes_font']))
	{
		$font = $phpgw_info['user']['preferences']['notes']['notes_font'];
	}
	else
	{
		$font = set_font();
	}

	if (isset($phpgw_info['user']['preferences']['notes']['notes_font_size']))
	{
		$font_size = $phpgw_info['user']['preferences']['notes']['notes_font_size'];
	}
	else
	{
		$font_size = set_font_size();
	}

	if ($submit)
	{
		$phpgw->preferences->change('notes','notes_font');
		$phpgw->preferences->change('notes','notes_font_size');
		$phpgw->preferences->commit();
		Header('Location: ' . $phpgw->link('/preferences/index.php'));
		$phpgw->common->phpgw_exit();
	}

	$phpgw->common->phpgw_header();
	echo parse_navbar();

	$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
	$t->set_file(array('prefs' => 'preferences.tpl'));
	$t->set_var('actionurl',$phpgw->link('/notes/preferences.php'));
	$t->set_var('lang_action',lang('Notes preferences'));
	$t->set_var('lang_select_font',lang('Choose a font'));
	$t->set_var('lang_select_size',lang('Choose the font size'));
	$t->set_var('font',$font);
	$t->set_var('font_size',$font_size);

/* the browser needs more than only one font to display the chosen font_style. if the chosen font isnt available on the system the browser
   can display an other font of that family than          */

	if ($phpgw_info['user']['preferences']['notes']['notes_font']=='Arial,Helvetica,sans-serif'):
		$font_sel[0]=' selected';
	elseif ($phpgw_info['user']['preferences']['notes']['notes_font']=='Times New Roman,Times,serif'):
		$font_sel[1]=' selected';
	elseif ($phpgw_info['user']['preferences']['notes']['notes_font']=='Verdana,Arial,Helvetica,sans-serif'):
		$font_sel[2]=' selected';
	elseif ($phpgw_info['user']['preferences']['notes']['notes_font']=='Georgia,Times New Roman,Times,serif'):
		$font_sel[3]=' selected';
	elseif ($phpgw_info['user']['preferences']['notes']['notes_font']=='Courier New,Courier,mono'):
		$font_sel[4]=' selected';
	elseif ($phpgw_info['user']['preferences']['notes']['notes_font']=='Helvetica,Arial,sans-serif'):
		$font_sel[5]=' selected';
	elseif ($phpgw_info['user']['preferences']['notes']['notes_font']=='Tahoma,Verdana,Arial,Helvetica,sans-serif'):
		$font_sel[6]=' selected';
	endif;

	$notes_font = '<option value="Arial,Helvetica,sans-serif"' . $font_sel[0] . '>' . lang('Arial') . '</option>' . "\n"
				. '<option value="Times New Roman,Times,serif"' . $font_sel[1] . '>' . lang('Times New Roman') . '</option>' . "\n"
				. '<option value="Verdana,Arial,Helvetica,sans-serif"' . $font_sel[2] . '>' . lang('Verdana') . '</option>' . "\n"
				. '<option value="Georgia,Times New Roman,Times,serif"' . $font_sel[3] . '>' . lang('Georgia') . '</option>' . "\n"
				. '<option value="Courier New,Courier,mono"' . $font_sel[4] . '>' . lang('Courier New') . '</option>' . "\n"
				. '<option value="Helvetica,Arial,sans-serif"' . $font_sel[5] . '>' . lang('Helvetica') . '</option>' . "\n"
				. '<option value="Tahoma,Verdana,Arial,Helvetica,sans-serif"' . $font_sel[6] . '>' . lang('Tahoma') . '</option>' . "\n";

	$t->set_var('notes_font',$notes_font);

	if ($phpgw_info['user']['preferences']['notes']['notes_font_size']=='1'):                                                                                                             
		$size_sel[0]=' selected';                                                                                                                                                     
	elseif ($phpgw_info['user']['preferences']['notes']['notes_font_size']=='2'):                                                                                                          
		$size_sel[1]=' selected';
	elseif ($phpgw_info['user']['preferences']['notes']['notes_font_size']=='3'):                                                                                                          
		$size_sel[2]=' selected';
	elseif ($phpgw_info['user']['preferences']['notes']['notes_font_size']=='4'):                                                                                                          
		$size_sel[3]=' selected';
	elseif ($phpgw_info['user']['preferences']['notes']['notes_font_size']=='5'):                                                                                                          
		$size_sel[4]=' selected';                                                                                                                                                     
	endif;                                                                                                                                                                              
                                                                                                                                                                                         
	$notes_font_size = '<option value="1"' . $size_sel[0] . '>' . lang('Very Small') . '</option>' . "\n"
					. '<option value="2"' . $size_sel[1] . '>' . lang('Small') . '</option>' . "\n"
					. '<option value="3"' .$size_sel[2] . '>' . lang('Medium') . '</option>' . "\n"
					. '<option value="4"' .$size_sel[3] . '>' . lang('Large') . '</option>' . "\n"
					. '<option value="5"' .$size_sel[4] . '>' . lang('Very Large') . '</option>' . "\n";

	$t->set_var('notes_font_size',$notes_font_size);
	$t->set_var('lang_edit',lang('Edit'));
	$t->pparse('out','prefs');

	$phpgw->common->phpgw_footer();
?>
