require_once('./global.php');
-$navbar = $controller->construct_breadcrumb();
+$navbar = ConstructNavbar();
// ###################################################################
-$latest = $controller->cachev->fetch_node();
-
-$link['log'] = $controller->href_compound('log.php');
-
-$show['head'] = ($latest['revision'] != $controller->revctx);
-if ($show['head'])
-{
- $link['gohead'] = $controller->href_compound('browse.php', null, Paths::fetch_rev_str(false, 'HEAD'));
- $link['diffhead'] = $controller->href_compound('diff.php', null, Paths::fetch_rev_str(true, 'HEAD', $controller->revctx));
-}
-
-$show['prev'] = ($controller->cachev->fetch_prev_revision($controller->revctx) != -1);
-if ($show['prev'])
-{
- $link['diffprev'] = $controller->href_compound('diff.php', null, Paths::fetch_rev_str(false, $controller->revctx));
-}
+$revision = new Revision($input->in['repos'], $input->in['rev']);
// ###################################################################
+/*
$show['props'] = false;
$proplist = '';
if (sizeof($latest['properties']) > 0)
eval('$proplist .= "' . $template->fetch('property') . '";');
}
}
+*/
// ###################################################################
-$revinfo = $controller->cachev->fetch_revision($controller->revctx);
+// $revinfo['message_clean'] = SVNCommon::format_log_message($revinfo['message']);
+// $revinfo['date'] = SVNCommon::format_date_string($revinfo['dateline']);
-$revinfo['message_clean'] = SVNCommon::format_log_message($revinfo['message']);
-$revinfo['date'] = SVNCommon::format_date_string($revinfo['dateline']);
-
-$listing = $controller->library->command('ls');
+$listing = BSXml::Parse($lib->run('ls --xml -r' . $revision->revision . ' ' . $lib->arg($repos->fetchPath($input->in['repos']) . $input->in['path']), true));
+BSXml::UnifyNode($listing['lists']['list']['entry']);
$nodes = '';
-
-foreach ($listing AS $item)
+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'];
eval('$nodes .= "' . $template->fetch('browse_node') . '";');
}
\*=====================================================================*/
require_once('./includes/init.php');
-require_once('./includes/controller.php');
-$input->in['rev'] = $input->clean(substr($input->in['path'], strpos($input->in['path'], '@') + 1), TYPE_UINT);
-$input->in['path'] = substr($input->in['path'], 0, strpos($input->in['path'], '@'));
+require_once('./includes/functions.php');
+require_once('./includes/class_revision.php');
+
+// ###################################################################
+// define the path variables
+$atpos = strpos($input->in['path'], '@');
+$input->in['rev'] = $input->clean(substr($input->in['path'], $atpos + 1), TYPE_UINT);
+if ($atpos !== false)
+{
+ $input->in['path'] = substr($input->in['path'], 0, strpos($input->in['path'], '@'));
+}
+
+// ###################################################################
+// setup the SVN library
+require_once('./includes/class_libsvn.php');
+BSRegister::Register('lib', $lib = new LibSVN($conf['paths']['svn']));
$fetchtemplates[] = 'header';
$fetchtemplates[] = 'footer';
--- /dev/null
+<?php
+/*=====================================================================*\
+|| ###################################################################
+|| # ViewSVN [#]version[#]
+|| # 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
+|| ###################################################################
+\*=====================================================================*/
+
+/**
+* Revision
+*
+* This class represents one revision in a given repository
+*
+* @author Blue Static
+* @copyright Copyright (c)2002 - [#]year[#], Blue Static
+* @version $Revision$
+* @package ViewSVN
+*
+*/
+class Revision
+{
+ /**
+ * Repository path
+ * @var string
+ */
+ private $path;
+
+ /**
+ * Repository name
+ * @var string
+ */
+ private $repos;
+
+ /**
+ * The revision number
+ * @var integer
+ */
+ public $revision;
+
+ // ###################################################################
+ /**
+ * Creates a new revision for a given repository and revision
+ *
+ * @param string Repository
+ * @param integer Revision to get; to get HEAD, specify 0
+ */
+ public function __construct($repos, $rev = 0)
+ {
+ $this->path = BSRegister::Get('repos')->fetchPath($repos);
+ $this->repos = $repos;
+
+ $this->_fetchRevision($rev);
+ }
+
+ // ###################################################################
+ /**
+ * Gets the desired XML revision information from the repository
+ *
+ * @param integer Desired revision
+ */
+ private function _fetchRevision($desired)
+ {
+ $xml = BSXml::Parse(BSRegister::Get('lib')->run('info --xml ' . ($desired > 0 ? '-r' . intval($desired) . ' ' : '') . BSRegister::Get('lib')->arg($this->path), true));
+ $this->revision = intval($xml['info']['entry']['commit']['revision']);
+ }
+}
+
+/*=====================================================================*\
+|| ###################################################################
+|| # $HeadURL$
+|| # $Id$
+|| ###################################################################
+\*=====================================================================*/
+?>
\ No newline at end of file
+++ /dev/null
-<?php
-/*=====================================================================*\
-|| ###################################################################
-|| # ViewSVN [#]version[#]
-|| # Copyright ©2002-[#]year[#] Iris Studios, Inc.
-|| #
-|| # 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
-|| ###################################################################
-\*=====================================================================*/
-
-/**
-* Node Controller
-*
-* This class represents one node in SVN. For each node that you need
-* to display information about, create a new instance of this class.
-* Generally, however, this one instance should be able to handle
-* the needs of the entire class.
-*
-* @author Iris Studios, Inc.
-* @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc.
-* @version $Revision$
-* @package ViewSVN
-*
-*/
-class Controller
-{
- /**
- * Registry class
- * @var object
- * @access private
- */
- var $registry = null;
-
- /**
- * Xquery layer
- * @var object
- * @access private
- */
- var $xquery = null;
-
- /**
- * Xquery method library
- * @var object
- * @access private
- */
- var $library = null;
-
- /**
- * cacheV layer
- * @var object
- * @access private
- */
- var $cachev = null;
-
- /**
- * Full, universal path of the node
- * @var string
- * @access public
- */
- var $fullpath;
-
- /**
- * Repository of the path
- * @var string
- * @access public
- */
- var $repos;
-
- /**
- * The full path to the repository
- * @var string
- * @access public
- */
- var $repospath;
-
- /**
- * Relative path in the repository
- * @var string
- * @access public
- */
- var $path;
-
- /**
- * The current revision number
- * @var integer
- * @access public
- */
- var $revnum;
-
- /**
- * The current revision as a string argument
- * @var string
- * @access public
- */
- var $revstr;
-
- /**
- * The revision number in context for this node. For instance, r40 may be passed, but the file only has revision 38 (and that's what this would be)
- * @var integer
- * @access public
- */
- var $revctx;
-
- // ###################################################################
- /**
- * Constructor
- *
- * @param string The path of the node
- */
- function Controller($nodepath)
- {
- global $viewsvn;
-
- // variables
- $this->fullpath = $nodepath;
-
- $temp = preg_split('#/#', $this->fullpath, -1, PREG_SPLIT_NO_EMPTY);
-
- $this->repos = $temp[0];
-
- unset($temp[0]);
- $this->path = '/' . implode('/', $temp);
-
- // objects
- $this->registry =& $viewsvn;
-
- $this->repospath = $this->registry->repos->fetch_path($this->repos);
-
- $this->revnum = Paths::fetch_rev_num();
- $this->revstr = Paths::fetch_rev_str();
-
- require_once('./includes/shellcmd.php');
- $this->xquery = new Shell($this);
-
- require_once('./includes/svnlib.php');
- $this->library = new SVNLib($this);
-
- require_once('./includes/cachev.php');
- $this->cachev = new cacheV($this);
-
- $this->revctx = $this->cachev->fetch_revision_context($this->revnum);
- $this->revctx = $this->revctx['revision'];
- }
-
- // ###################################################################
- /**
- * Produces a link href that allows for a completely different path
- * than the one in the controller. This is used for navigating upstream.
- *
- * @access public
- *
- * @param string Base path (e.g. browse.php)
- * @param string New relative path
- *
- * @return string Constructed path
- */
- function href_struct($base, $path)
- {
- $url = Paths::fetch_arguments($base);
- $path = Paths::sanitize($path);
-
- return $this->registry->path . '/' . $url[0] . '/' . $this->repos . ($path{0} != '/' ? '/' : '') . $path . ($url[1] ? '?' . $url[1] : '');
- }
-
- // ###################################################################
- /**
- * Compounds a path by adding another level. This is used for navigating
- * downstream.
- *
- * @access public
- *
- * @param string Base path (e.g. browse.php)
- * @param string Attach path (or none for current)
- * @param bool Attach a given revision string, null for none
- *
- * @return string Constructed path
- */
- function href_compound($base, $attach = null, $revstr = null)
- {
- $url = Paths::fetch_arguments($base . ($revstr === null ? ((strpos($base, '?') !== false) ? '&' . $this->revstr : $this->revstr) : $revstr));
-
- if ($attach === null)
- {
- $path = $this->path;
- }
- else
- {
- $attach = Paths::sanitize($attach);
- $path = $this->path . (($attach[0] != '/' AND $this->path[ strlen($this->path) - 1 ] != '/') ? '/' : '') . $attach;
- }
-
- return $this->href_struct($base . ($url[1] ? '?' . $url[1] : ''), $path);
- }
-
- // ###################################################################
- /**
- * Create path breadcrumb
- *
- * @access public
- *
- * @return string Breadcrumb HTML
- */
- function construct_breadcrumb()
- {
- $html = '/ ';
-
- $temp = preg_split('#/#', $this->fullpath, -1, PREG_SPLIT_NO_EMPTY);
- $count = sizeof($temp) - 1;
-
- $donerepos = false;
-
- foreach ($temp AS $val => $item)
- {
- if ($donerepos != false)
- {
- $itembit .= $item;
- $this->registry->debug($item . " > " . $itembit);
- $itembit .= (($count != $val OR $this->cachev->isdir($itembit)) ? '/' : '');
- }
-
- $donerepos = true;
- $html .= '<a href="' . $this->href_struct('browse.php' . $this->revstr, ($val == 0 ? '' : $itembit)) . '">' . $item . '</a>'. ($count != $val ? ' / ' : '');
- }
-
- return $html;
- }
-}
-
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
-?>
\ No newline at end of file
--- /dev/null
+<?php
+/*=====================================================================*\
+|| ###################################################################
+|| # ViewSVN [#]version[#]
+|| # 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
+|| ###################################################################
+\*=====================================================================*/
+
+// ###################################################################
+/**
+* Constructs the navbar from the given path elememnts. The current
+* element is never selectable
+*
+* @return string Compiled HTML navigation bar
+*/
+function ConstructNavbar()
+{
+ $path = preg_split('#/#', BSRegister::Get('input')->in['path'], -1, PREG_SPLIT_NO_EMPTY);
+ if (empty($path))
+ {
+ return '<strong>/</strong>';
+ }
+
+ $html = '';
+ $build = '';
+ foreach ($path AS $part)
+ {
+ $build .= '/' . $part;
+ $html .= '/ <a href="' . BSRegister::Get('webpath') . '/browse/' . BSRegister::Get('input')->in['repos'] . ':' . $build . '"><strong>' . $part . '</strong></a> ';
+ }
+
+ return $html;
+}
+
+/*=====================================================================*\
+|| ###################################################################
+|| # $HeadURL$
+|| # $Id$
+|| ###################################################################
+\*=====================================================================*/
+?>
\ No newline at end of file
require_once('ISSO/Functions.php');
require_once('ISSO/Xml.php');
+BSRegister::SetDebug($debug);
+
BSRegister::Register('db', $db = BSRegister::LoadModule('DbMySql'));
$db->connect($conf['db']['server'], $conf['db']['user'], $conf['db']['pass'], $conf['db']['name'], 0);
if (sizeof($this->repositories) < 1)
{
- $viewsvn->trigger->error($viewsvn->lang->string('There are no valid repositories'));
+ $viewsvn->trigger->error(_('There are no valid repositories'));
}
}
/**
* Returns a path to a repository
*
- * @access public
- *
* @param string Repository name
*
* @return string Full path to the repository
*/
- function fetch_path($repository = '')
+ public function fetchPath($repository = '')
{
global $viewsvn;
- if (!in_array($repository, $this->fetch_list()))
+ if (!in_array($repository, $this->repositories))
{
- $viewsvn->trigger->error($viewsvn->lang->string('Invalid repository name specified'));
+ $viewsvn->trigger->error(_('Invalid repository name specified'));
}
if ($this->container)
/**
* Verifies a path inside a repository
*
- * @access public
- *
* @param string Repository name
* @param string Path
*
* @return bool Validity
*/
- function verify($repos, $path)
+ public function verify($repos, $path)
{
global $viewsvn;
- if ($repospath = $this->fetch_path($repos))
+ if ($repospath = $this->fetchPath($repos))
{
return true;
}
<div class="content" style="border-width: 0px 1px 1px 1px">
- <if condition="$show['directory']">
- <a href="$browse"><strong>$item</strong></a>
+ <if condition="$isDir">
+ <a href="{BSRegister::Get('webpath')}/browse/{$input->in['repos']}:{$input->in['path']}/$item"><strong>$item/</strong></a>
<else />
- <a href="$view">$item</a>
+ <a href="{BSRegister::Get('webpath')}/view/{$input->in['repos']}:{$input->in['path']}/$item">$item</a>
</if>
- <span class="nodelink">
- <if condition="!$show['directory']"><a href="$blame">{@"Blame"}</a> - </if>
+ <!-- <span class="nodelink">
+ <if condition="$isDir"><a href="$blame">{@"Blame"}</a> - </if>
<a href="$log">{@"View Log"}</a>
- </span>
+ </span> -->
</div>
\ No newline at end of file