Adding language settings to config.php so that people can control the language output...
[viewsvn.git] / browse.php
index 45f239d784dcd8fa468e3f0daa82978ef4f56e1a..00ccbebbd8405802f429d11ee2c067c70f0e007b 100644 (file)
@@ -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(
        'browse_node',
-       'browse'
+       'browse',
+       'property'
 );
 
+define('SVN', '$Id$');
+
 require_once('./global.php');
 
-$navbar = $controller->construct_breadcrumb();
+$navbar = ConstructNavbar();
 
 // ###################################################################
 
-$node = preg_replace('#(^/|/$)#', '', ($viewsvn->paths->relpath == '' ? $viewsvn->paths->path : $viewsvn->paths->relpath));
-$latest = $controller->cachev->fetch_node($node);
-
-$link['log'] = $controller->out('log.php' . $viewsvn->paths->revstr);
-
-$show['head'] = ($latest['revision'] != $viewsvn->paths->revnum AND $viewsvn->paths->revnum != 'HEAD');
-if ($show['head'])
+$revision = $headRev = new Revision($input->in['repos'], $input->in['rev'], $input->in['path']);
+if ($input->in['rev'])
 {
-       $link['gohead'] = $controller->out('browse.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'));
-       $link['diffhead'] = $controller->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->revnum));
+       $headRev = new Revision($input->in['repos'], 0, $input->in['path']);
+       if ($headRev->revision != $revision->revision)
+       {
+               $show['head'] = true;
+               $link['gohead'] = ConstructLink('browse', $input->in['repos'], $input->in['path'], 0);
+       }
 }
 
-$show['prev'] = ($prev = $controller->cachev->fetch_prev_revision($viewsvn->paths->relpath, $viewsvn->paths->revnum));
-if ($show['prev'])
+if ($revision->revision - 1 > 0)
 {
-       $link['diffprev'] = $controller->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->revnum, $prev));
+       $show['diff'] = true;
+       $link['diff'] = ConstructLink('diff', $input->in['repos'], $input->in['path'], $revision->revision);
 }
 
 // ###################################################################
 
-$revinfo = $controller->cachev->fetch_revision($latest['revision']);
+$props = $revision->getPropsForPath($input->in['path']);
+$show['props'] = (sizeof($props) > 0);
+$proplist = FormatPropList($props);
 
-$revinfo['message_clean'] = SVNCommon::format_log_message($revinfo['message']);
-$revinfo['date'] = SVNCommon::format_date_string($revinfo['dateline']);
+// ###################################################################
 
-$listing = $controller->library->ls($controller->repos, $controller->path, $controller->revnum);
+$revision->getRevisionInfo();
 
-$nodes = '';
+$listing = BSXml::Parse($lib->run('ls --xml -r' . $revision->revision . ' ' . $lib->arg($repos->fetchPath($input->in['repos']) . $input->in['path']) . '@' . $revision->revision, true));
 
-foreach ($listing AS $item)
+BSXml::UnifyNode($listing['lists']['list']['entry']);
+$nodes = '';
+foreach ($listing['lists']['list']['entry'] AS $item)
 {
-       if ($item{ strlen($item) - 1 } == '/')
-       {
-               $show['directory'] = true;
-               $browse = $controller->href_compound('browse.php', $item);
-       }
-       else
-       {
-               $show['directory'] = false;
-               $view = $controller->href_compound('view.php', $item);
-               $blame = $controller->href_compound('blame.php', $item);
-       }
-       
-       $log = $controller->href_compound('log.php', $item);
-       
+       $isDir = ($item['kind'] == 'dir');
+       $item = $item['name']['value'];
+       $itemLink = ConstructLink(($isDir ? 'browse' : 'view'), $input->in['repos'], $input->in['path'] . '/' . $item, $input->in['rev']);
        eval('$nodes .= "' . $template->fetch('browse_node') . '";');
 }
 
 // ###################################################################
 
+$link['log'] = ConstructLink('log', $input->in['repos'], $input->in['path'], $input->in['rev']);
+
 eval('$template->flush("' . $template->fetch('browse') . '");');
 
 /*=====================================================================*\