/*=====================================================================*\
|| ###################################################################
|| # ViewSVN [#]version[#]
-|| # Copyright ©2002-[#]year[#] Iris Studios, Inc.
+|| # Copyright ©2002-[#]year[#] Blue Static
|| #
|| # 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
$fetchtemplates = array(
'log_node',
- 'log'
+ 'log',
+ 'pagenav_bit',
+ 'pagenav'
);
+define('SVN', '$Id$');
+
require_once('./global.php');
-$navbar = $viewsvn->paths->construct_breadcrumb($path, false);
+$navbar = ConstructNavbar();
-// ###################################################################
+$paginate = BSRegister::LoadModule('Pagination');
+
+function _PageBitCallback($baselink, $nolink, $number, $paginator)
+{
+ eval('$data = "' . BSRegister::Get('template')->fetch('pagenav_bit') . '";');
+ return $data;
+}
+
+function _PageNavCallback($baselink, $nextpage, $prevpage, $show, $pagebits, $paginator)
+{
+ eval('$data = "' . BSRegister::Get('template')->fetch('pagenav') . '";');
+ return $data;
+}
-// this is NOT supposed to allow for revision ranges
-$logs = new SVNLog($repos, $relpath, 0, $viewsvn->svn->common->fetch_head_rev($path));
+$paginate->setPageLinks(2);
+$paginate->setPageVar('p');
+$paginate->setMaxPerPage(20);
+$paginate->setDefaultPerPage(20);
+$paginate->setBitProcessor('_PageBitCallback');
+$paginate->setNavigatorProcessor('_PageNavCallback');
+$paginate->processIncomingData();
-$isdir = $viewsvn->svn->common->isdir($path);
+// ###################################################################
+
+$logs = BSXml::Parse($lib->run('log --xml ' . $lib->arg($repos->fetchPath($input->in['repos']) . '/' . $input->in['path']), true));
$nodes = '';
-foreach ($logs->fetch() AS $log)
+BSXml::UnifyNode($logs['log']['logentry']);
+
+$paginate->setTotal(sizeof($logs['log']['logentry']));
+$paginate->splitPages();
+
+$i = $paginate->fetchLimit() - $paginate->getPerPage();
+$i = ($i <= 0 ? 0: $i);
+for (; $i < $paginate->fetchLimit($paginate->getPage()); $i++)
{
- $prev = $viewsvn->svn->common->fetch_prev_rev($path, $log['rev']);
-
- $link['view'] = $viewsvn->paths->out(($isdir ? 'browse.php' : 'view.php') . $viewsvn->paths->fetch_rev_str(false, $log['rev']), $path);
- $link['blame'] = $viewsvn->paths->out('blame.php' . $viewsvn->paths->fetch_rev_str(false, $log['rev']), $path);
+
+ $log = $logs['log']['logentry'][$i];
- $show['diffhead'] = $viewsvn->svn->common->fetch_head_rev($path) != $log['rev'];
- if ($show['diffhead'])
- {
- $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $log['rev']), $path);
- }
+ $log['author'] = $log['author']['value'];
+ $log['date'] = FormatSvnDate($log['date']['value']);
+ $log['message_clean'] = FormatLogMessage($log['msg']['value']);
- $show['diffprev'] = $prev != -1;
- if ($show['diffprev'])
- {
- $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $log['rev'], $prev), $path);
- }
+ $link['view'] = ConstructLink('view', $input->in['repos'], $input->in['path'], $log['revision']);
+ $link['blame'] = ConstructLink('blame', $input->in['repos'], $input->in['path'], $log['revision']);
+ $link['diff'] = ConstructLink('diff', $input->in['repos'], $input->in['path'], $log['revision']);
- $log['message_clean'] = $viewsvn->svn->format_log_message($log['message']);
-
eval('$nodes .= "' . $template->fetch('log_node') . '";');
}
+$pagenav = $paginate->constructPageNav(ConstructLink('log', $input->in['repos'], $input->in['path'], 0) . '&', false);
+
// ###################################################################
eval('$template->flush("' . $template->fetch('log') . '");');