<?php
	$phpgw_info['flags'] = array(
		'currentapp' => 'headlines',
		'noheader'   => True,
		'nonavbar'   => True
	);
	include('../header.inc.php');

	if ($done)
	{
		$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/headlines/index.php'));
	}
	else
	{
		$GLOBALS['phpgw']->common->phpgw_header();
		echo parse_navbar();
	}

	if ($submit)
	{
		$GLOBALS['phpgw']->preferences->change('headlines','headlines_layout');
		$GLOBALS['phpgw']->preferences->commit(True);
	}

	$GLOBALS['phpgw']->template->set_file(array(
		'layout1' => 'basic_sample.tpl',
		'layout2' => 'color_sample.tpl',
		'body'    => 'preferences_layout.tpl'
	));

	$GLOBALS['phpgw']->template->set_var('th_bg',$phpgw_info['theme']['th_bg']);
	$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/headlines/preferences_layout.php'));
	$GLOBALS['phpgw']->template->set_var('title',lang('Headlines layout'));
	$GLOBALS['phpgw']->template->set_var('action_label',lang('Submit'));
	$GLOBALS['phpgw']->template->set_var('done_label',lang('Done'));
	$GLOBALS['phpgw']->template->set_var('reset_label',lang('Reset'));

	$GLOBALS['phpgw']->template->set_var('template_label',lang('Choose layout'));

	if ($submit)
	{
		$selected[$headlines_layout] = ' selected';
	}
	else
	{
		$selected[$phpgw_info['user']['preferences']['headlines']['headlines_layout']] = ' selected';	
	}

	$s  = '<option value="basic"' . $selected['basic'] . '>' . lang('Basic') . '</option>';
	$s .= '<option value="color"' . $selected['color'] . '>' . lang('Color') . '</option>';
	$GLOBALS['phpgw']->template->set_var('template_options',$s);

	$GLOBALS['phpgw']->template->parse('layout_1','layout1');
	$GLOBALS['phpgw']->template->parse('layout_2','layout2');

	$GLOBALS['phpgw']->template->pfp('out','body');
	$GLOBALS['phpgw']->common->phpgw_footer();
