Adding language settings to config.php so that people can control the language output...
[viewsvn.git] / browse.php
index 221722fe872fac7f34b1d656bde0206e5f488150..00ccbebbd8405802f429d11ee2c067c70f0e007b 100644 (file)
@@ -1,48 +1,82 @@
 <?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(
+       'browse_node',
+       'browse',
+       'property'
+);
+
+define('SVN', '$Id$');
+
 require_once('./global.php');
 
-$path = $viewsvn->paths->parse();
-$repos = $viewsvn->paths->fetch_repos($path);
-$relpath = $viewsvn->paths->fetch_path($path);
+$navbar = ConstructNavbar();
 
-$listing = $viewsvn->svn->ls($repos, $relpath, 0);
+// ###################################################################
 
-echo '<ul>';
-echo "\n";
+$revision = $headRev = new Revision($input->in['repos'], $input->in['rev'], $input->in['path']);
+if ($input->in['rev'])
+{
+       $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);
+       }
+}
 
-if (!$viewsvn->paths->is_root_path($path))
+if ($revision->revision - 1 > 0)
 {
-       echo '<li><a href="/viewsvn/' . $viewsvn->paths->out('browse.php', $path . '..') . '">Up One Level</a></li>';
-       echo "\n";
+       $show['diff'] = true;
+       $link['diff'] = ConstructLink('diff', $input->in['repos'], $input->in['path'], $revision->revision);
 }
 
-foreach ($listing AS $item)
+// ###################################################################
+
+$props = $revision->getPropsForPath($input->in['path']);
+$show['props'] = (sizeof($props) > 0);
+$proplist = FormatPropList($props);
+
+// ###################################################################
+
+$revision->getRevisionInfo();
+
+$listing = BSXml::Parse($lib->run('ls --xml -r' . $revision->revision . ' ' . $lib->arg($repos->fetchPath($input->in['repos']) . $input->in['path']) . '@' . $revision->revision, true));
+
+BSXml::UnifyNode($listing['lists']['list']['entry']);
+$nodes = '';
+foreach ($listing['lists']['list']['entry'] AS $item)
 {
-       echo '<li>';
-       if ($item{ strlen($item) - 1 } == '/')
-       {
-               echo '<a href="/viewsvn/' . $viewsvn->paths->out('browse.php', $path . $item) . '">' . $item . '</a>';
-       }
-       else
-       {
-               echo '<a href="/viewsvn/' . $viewsvn->paths->out('log.php', $path . $item) . '">'. $item . '</a>';
-       }
-       echo '</li>';
-       echo "\n";
+       $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') . '";');
 }
 
-echo '</ul>';
+// ###################################################################
+
+$link['log'] = ConstructLink('log', $input->in['repos'], $input->in['path'], $input->in['rev']);
+
+eval('$template->flush("' . $template->fetch('browse') . '");');
 
 /*=====================================================================*\
 || ###################################################################