From ff804ad25615c9b3c0eec96266d400566f3f03ad Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 9 Apr 2007 05:35:03 +0000 Subject: [PATCH] - Making it so the last component in ConstructNavbar() doesn't work as a link - Making ConstructNavbar() carry over revisions - Added ConstructLink() --- browse.php | 1 + includes/functions.php | 30 +++++++++++++++++++++++++++--- templates/default/browse_node.tpl | 4 ++-- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/browse.php b/browse.php index 2fb0eea..f6f0758 100644 --- a/browse.php +++ b/browse.php @@ -53,6 +53,7 @@ foreach ($listing['lists']['list']['entry'] AS $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') . '";'); } diff --git a/includes/functions.php b/includes/functions.php index 004d7bb..21a9374 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -31,7 +31,7 @@ function ConstructNavbar() $path = preg_split('#/#', BSRegister::Get('input')->in['path'], -1, PREG_SPLIT_NO_EMPTY); $input =& BSRegister::Get('input'); - $html = '[' . $input->in['repos'] . ']: '; + $html = '[' . $input->in['repos'] . ']: '; if (empty($path)) { @@ -39,10 +39,17 @@ function ConstructNavbar() } $build = ''; - foreach ($path AS $part) + foreach ($path AS $index => $part) { $build .= '/' . $part; - $html .= '/ ' . $part . ' '; + if (sizeof($path) - 1 == $index) + { + $html .= '/ ' . $part . ''; + } + else + { + $html .= '/ ' . $part . ' '; + } } return $html; @@ -147,6 +154,23 @@ function FormatSvnDate($string) return preg_replace('#(....)\-(..)\-(..)T(..):(..):(..).(.*)Z#e', 'gmdate("r", mktime(\4, \5, \6, \2, \3, \1))', $string); } +// ################################################################### +/** +* Generates an absolute-pathed link if you just pass it the four +* paramaters +* +* @param string Action/script +* @param string Repository name +* @param string Subpath in repository +* @param integer Revision +* +* @return string Link (not wrapped in ) +*/ +function ConstructLink($action, $repos, $path, $rev) +{ + return BSRegister::Get('webpath') . '/' . $action . '/' . $repos . ':' . $path . ($rev > 0 ? '@' . $rev : ''); +} + /*=====================================================================*\ || ################################################################### || # $HeadURL$ diff --git a/templates/default/browse_node.tpl b/templates/default/browse_node.tpl index d67275c..1388e85 100644 --- a/templates/default/browse_node.tpl +++ b/templates/default/browse_node.tpl @@ -1,8 +1,8 @@
- $item/ + $item/ - $item + $item