<?php
	/***************************************************************************\
	* phpGroupWare - Notepad													*
	* 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: view.php,v 1.18 2001/05/15 01:36:34 bettina Exp $ */

	if (! $id)
	{ 
		Header('Location: ' . $phpgw->link('/notes/index.php',"cat_id=$cat_id&start=$start&search=$search"));
		$phpgw->common->phpgw_exit();
	}

	$phpgw_info['flags'] = array('currentapp' => 'notes',
					'enable_nextmatchs_class' => True);

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

### CUSTOMIZABLE FEATURES OF THE NOTE PAD ###

	$t = new Template(PHPGW_APP_TPL);
	$t->set_file(array('view' => 'view.tpl'));

	$hidden_vars = '<input type="hidden" name="start" value="' . $start . '">' . "\n"
				. '<input type="hidden" name="search" value="' . $search . '">' . "\n"
				. '<input type="hidden" name="cat_id" value="' . $cat_id . '">' . "\n";

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

	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();
	}

	$t->set_var('lang_time',lang('Time created'));
	$t->set_var('lang_action',lang('Display note for'));
	$t->set_var('name',$phpgw_info['user']['fullname']);
	$t->set_var('font',$font);
	$t->set_var('font_size',$font_size);

### PERFORM QUERY ###

	$phpgw->db->query("SELECT * FROM phpgw_notes WHERE note_id='$id'");

### DISPLAY ROWS OF NOTES ####

	$phpgw->db->next_record();

### FORMAT THE DATE FOR DISPLAY! ###

	$new_date = $phpgw->common->show_date($phpgw->db->f('note_date'));
	$t->set_var('new_date',$new_date);
	$category = $phpgw->db->f('note_category');

### MODIFY IN CASE MAGiC QUOTES IS MIS-CONFIG ###

	$fnote = $phpgw->strip_html($fnote);

### FORMAT NOTE SO IT MAKES \n a <BR> ###

	$fnote = nl2br($phpgw->db->f('note_content'));

	$t->set_var('fnote',$fnote);$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
	$t->set_var('tr_color',$tr_color);

	$t->set_var('done_action',$phpgw->link('/notes/index.php',"cat_id=$category&start=$start&search=$search"));
	$t->set_var('lang_done',lang('Done'));

	$t->pparse('out','view');
	$phpgw->common->phpgw_footer();
?>
