<?php
/*
 * $Horde: chora/annotate.php,v 1.5 2001/02/27 07:05:59 avsm Exp $
 *
 * Copyright 2000, 2001 Anil Madhavapeddy <anil@recoil.org>
 *
 * See the enclosed file COPYING for license information (GPL).  If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 */

	$GLOBALS['phpgw_info']['flags'] = array(
		'currentapp' => 'chora',
		'enable_config_class' => True
	);

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

	/* Spawn the file object */
	if (substr($where, 0, 1) == '/')
		$where = substr($where, 1);
	$fl = new CVSLib_File($CVS, $CVS->cvsRoot().'/'.$where);
	checkError($fl->getBrowseInfo());

	if (!isset($rev))
	{
		$rev='1.1';
	}

	if (!CVSLib_Rev::valid($rev))
	{
		//fatal('404 Not Found',"Revision $rev not found");
		echo lang("Revision %1 not found", $rev);
		$GLOBALS['phpgw']->common->phpgw_footer();
		$GLOBALS['phpgw']->common->exit();
	}

	$ann = new CVSLib_Annotate($CVS, $fl);
	checkError($lines = $ann->doAnnotate($rev));

	$title = 'CVS '.lang("Annotation of %1 for version %2", $where, $rev);
	include($conf['paths']['templates'].'/page_header.inc');
	include($conf['paths']['templates'].'/annotate_header.inc');

	@reset($lines);
	while(list(,$line) = @each($lines))
	{
		$author = showAuthorName($line['author']);
		$rev = $line['rev'];
		$line = htmlspecialchars($line['line']);
		include($conf['paths']['templates'].'/annotate_line.inc');
	}

	include($conf['paths']['templates'].'/annotate_footer.inc');
	//include($conf['paths']['templates'].'/page_footer.inc');
	$GLOBALS['phpgw']->common->phpgw_footer();
?>
