Adding language settings to config.php so that people can control the language output...
[viewsvn.git] / log.php
diff --git a/log.php b/log.php
index 04371a4e953e7c0f4764f771d3a4e85a936667d6..d7b3ac7100cd725264ae99adf3f2932a1d9ee6a7 100644 (file)
--- a/log.php
+++ b/log.php
@@ -2,7 +2,7 @@
 /*=====================================================================*\
 || ###################################################################
 || # 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 = $controller->construct_breadcrumb();
+$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($controller);
+$paginate->setPageLinks(2);
+$paginate->setPageVar('p');
+$paginate->setMaxPerPage(20);
+$paginate->setDefaultPerPage(20);
+$paginate->setBitProcessor('_PageBitCallback');
+$paginate->setNavigatorProcessor('_PageNavCallback');
+$paginate->processIncomingData();
 
-$isdir = $controller->cachev->isdir();
+// ###################################################################
+
+$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 = $controller->cachev->fetch_prev_revision($log['rev']);
-       $prev = $prev['revision'];
-       
-       $link['view'] = $controller->href_compound(($isdir ? 'browse.php' : 'view.php'), null, Paths::fetch_rev_str(false, $log['rev']));
-       $link['blame'] = $controller->href_compound('blame.php', null, Paths::fetch_rev_str(false, $log['rev']));
+
+       $log = $logs['log']['logentry'][$i];
        
-       $show['diffhead'] = $controller->cachev->fetch_head_revision() != $log['rev'];
-       if ($show['diffhead'])
-       {
-               $link['diffhead'] = $controller->href_compound('diff.php', null, Paths::fetch_rev_str(true, 'HEAD', $log['rev']));
-       }
+       $log['author'] = $log['author']['value'];
+       $log['date'] = FormatSvnDate($log['date']['value']);
+       $log['message_clean'] = FormatLogMessage($log['msg']['value']);
        
-       $show['diffprev'] = ($prev !== null);
-       if ($show['diffprev'])
-       {
-               $link['diffprev'] = $controller->href_compound('diff.php', null, Paths::fetch_rev_str(true, $log['rev'], $prev));
-       }
+       $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'] = SVNCommon::format_log_message($log['message']);
-
        eval('$nodes .= "' . $template->fetch('log_node') . '";');
 }
 
+$pagenav = $paginate->constructPageNav(ConstructLink('log', $input->in['repos'], $input->in['path'], 0) . '&amp;', false);
+
 // ###################################################################
 
 eval('$template->flush("' . $template->fetch('log') . '");');