<?php
/*=====================================================================*\
|| ################################################################### ||
|| # ViewSVN [#]version[#]
|| # --------------------------------------------------------------- # ||
|| # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
|| # This file may not be reproduced in any way without permission.  # ||
|| # --------------------------------------------------------------- # ||
|| # User License Agreement at http://www.iris-studios.com/license/  # ||
|| ################################################################### ||
\*=====================================================================*/

require_once('./global.php');

$path = $viewsvn->paths->parse();
$repos = $viewsvn->paths->fetch_repos($path);
$relpath = $viewsvn->paths->fetch_path($path);

echo $viewsvn->paths->construct_breadcrumb($path);

echo '<br />';

$prev = $viewsvn->svn->common->fetch_prev_rev($path, $viewsvn->paths->fetch_rev_num());

if ($viewsvn->svn->common->fetch_head_rev($path) != $viewsvn->paths->fetch_rev_num() AND $viewsvn->paths->fetch_rev_num() != 'HEAD')
{
	echo '<a href="/viewsvn/' . $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $path) . '">Go to HEAD</a>';
}

echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->fetch_rev_num()), $path) . '">Diff to HEAD</a>' .
($prev != -1 ? ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $prev), $path) . '">Diff to PREV</a>' : '') .
' - <a href="/viewsvn/' . $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path) . '">View Log</a>';

echo '<pre>' . print_r($viewsvn->svn->common->fetch_log($path, $viewsvn->paths->fetch_rev_num()), true) . '</pre>';

$listing = $viewsvn->svn->ls($repos, $relpath, @$viewsvn->in['rev']);

echo '<ul>';
echo "\n";

foreach ($listing AS $item)
{
	echo '<li>';
	if ($item{ strlen($item) - 1 } == '/')
	{
		echo '<a href="/viewsvn/' . $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(), $path . $item) . '">' . $item . '</a>';
	}
	else
	{
		echo '<a href="/viewsvn/' . $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path . $item) . '">'. $item . '</a>';
		echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(), $path . $item) . '">Blame</a>';
	}

	echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('log.php' . $viewsvn->paths->fetch_rev_str(), $path . $item) . '">View Log</a>';
	//echo ' - <a href="/viewsvn/' . $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->fetch_rev_num()), $path . $item) . '">Diff to PREV</a>';

	echo '</li>';
	echo "\n";
}

echo '</ul>';

/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>