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 74232982a94844faca299d1a94814af8d5b9efd2..d7b3ac7100cd725264ae99adf3f2932a1d9ee6a7 100644 (file)
--- a/log.php
+++ b/log.php
@@ -1,61 +1,90 @@
 <?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/  # ||
-|| ################################################################### ||
+|| # 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
+|| # the Free Software Foundation; version [#]gpl[#] of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
 \*=====================================================================*/
 
+$fetchtemplates = array(
+       'log_node',
+       'log',
+       'pagenav_bit',
+       'pagenav'
+);
+
+define('SVN', '$Id$');
+
 require_once('./global.php');
 
-$navbar = $viewsvn->paths->construct_breadcrumb($path, false);
+$navbar = ConstructNavbar();
 
-// ###################################################################
+$paginate = BSRegister::LoadModule('Pagination');
 
-// this is NOT supposed to allow for revision ranges
-$logs = new SVNLog($repos, $relpath, 0, $viewsvn->paths->fetch_rev_num());
+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;
+}
 
-$isdir = $viewsvn->svn->common->isdir($path);
+$paginate->setPageLinks(2);
+$paginate->setPageVar('p');
+$paginate->setMaxPerPage(20);
+$paginate->setDefaultPerPage(20);
+$paginate->setBitProcessor('_PageBitCallback');
+$paginate->setNavigatorProcessor('_PageNavCallback');
+$paginate->processIncomingData();
+
+// ###################################################################
+
+$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++)
 {
-       $props = '';
-       
-       $prev = $viewsvn->svn->common->fetch_prev_rev($path, $log['rev']);
-       
-       $link['view'] = (!$isdir ? $viewsvn->paths->out('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);
-       }
-
-       foreach ($log AS $key => $val)
-       {
-               if ($key != 'files')
-               {
-                       $val = $viewsvn->svn->format($val);
-                       eval('$props .= "' . $template->fetch('log_prop') . '";');
-               }
-       }
+       $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']);
        
        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') . '");');