{
$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') . '";');
}
$path = preg_split('#/#', BSRegister::Get('input')->in['path'], -1, PREG_SPLIT_NO_EMPTY);
$input =& BSRegister::Get('input');
- $html = '[<a href="' . BSRegister::Get('webpath') . '/browse/' . $input->in['repos'] . ':">' . $input->in['repos'] . '</a>]: ';
+ $html = '[<a href="' . ConstructLink('browse', $input->in['repos'], null, $input->in['rev']) . '">' . $input->in['repos'] . '</a>]: ';
if (empty($path))
{
}
$build = '';
- foreach ($path AS $part)
+ foreach ($path AS $index => $part)
{
$build .= '/' . $part;
- $html .= '/ <a href="' . BSRegister::Get('webpath') . '/browse/' . $input->in['repos'] . ':' . $build . '"><strong>' . $part . '</strong></a> ';
+ if (sizeof($path) - 1 == $index)
+ {
+ $html .= '/ <strong>' . $part . '</strong>';
+ }
+ else
+ {
+ $html .= '/ <a href="' . ConstructLink('browse', $input->in['repos'], $build, $input->in['rev']) . '"><strong>' . $part . '</strong></a> ';
+ }
}
return $html;
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 <a>)
+*/
+function ConstructLink($action, $repos, $path, $rev)
+{
+ return BSRegister::Get('webpath') . '/' . $action . '/' . $repos . ':' . $path . ($rev > 0 ? '@' . $rev : '');
+}
+
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
<div class="content" style="border-width: 0px 1px 1px 1px">
<if condition="$isDir">
- <a href="{BSRegister::Get('webpath')}/browse/{$input->in['repos']}:{$input->in['path']}/$item"><strong>$item/</strong></a>
+ <a href="$itemLink"><strong>$item/</strong></a>
<else />
- <a href="{BSRegister::Get('webpath')}/view/{$input->in['repos']}:{$input->in['path']}/$item">$item</a>
+ <a href="$itemLink">$item</a>
</if>
<!-- <span class="nodelink">
<if condition="$isDir"><a href="$blame">{@"Blame"}</a> - </if>